jna

Android app “Device or resource busy” when accessing USB device via JNA

ぃ、小莉子 提交于 2020-01-03 02:47:12
问题 In making use of JNA in an Android app, I encounter a LastErrorException with the message Device or resource busy when I attempt to perform an ioctl operation on a USB device. I cannot guess why this is or what to do about it. Can anyone offer any guidance at all? I am in fact using a 3rd-party snippet, whose source is viewable here. The error I get reads as follows: E/AndroidRuntime: FATAL EXCEPTION: Thread-556 Process: edu.ucdavis.auditoryenhancer, PID: 31335 com.sun.jna.LastErrorException:

Java JNA Mapping in Delphi Dll function

。_饼干妹妹 提交于 2020-01-02 15:26:07
问题 How do i map this function with JNA: Delphi Dll Function Code: function send_command (const command : byte; var size : byte; var data : pbyte) : integer; stdcall external 'comunication.dll'; Use example in Delphi Example Program: send_command (cmdCLOCK_ADJUST, tam, pb); Where: const cmdCLOCK_ADJUST = $18; var tam : byte; pb, p : pbyte; begin ... tam = 7; p:= pb; for i:= 1 to tam do begin p^:= Dados [i]; inc (p) end; send_command (cmdCLOCK_ADJUST, tam, pb); freemem (pb); ... end The int value

JNA Windows Service Startup Type

走远了吗. 提交于 2020-01-02 12:06:52
问题 I've been playing around with JNA and am able to return the status of a Windows Service (i.e. started or stopped) using the code below. I'm not sure how to return the startup type of the service though. I'm sure there are ways outside of JNA, but I would like to continue to use JNA if possible. import com.sun.jna.*; import com.sun.jna.Library.Handler; import com.sun.jna.platform.win32.*; import com.sun.jna.platform.win32.Advapi32Util.*; import com.sun.jna.platform.win32.WinNT.*; import com

JNA Windows Service Startup Type

孤街浪徒 提交于 2020-01-02 12:05:12
问题 I've been playing around with JNA and am able to return the status of a Windows Service (i.e. started or stopped) using the code below. I'm not sure how to return the startup type of the service though. I'm sure there are ways outside of JNA, but I would like to continue to use JNA if possible. import com.sun.jna.*; import com.sun.jna.Library.Handler; import com.sun.jna.platform.win32.*; import com.sun.jna.platform.win32.Advapi32Util.*; import com.sun.jna.platform.win32.WinNT.*; import com

Kernel32.INSTANCE.ReadProcessMemory REALLY Slow In JNA

半世苍凉 提交于 2020-01-02 11:43:16
问题 I'm writing a game hack which uses memory manipulation to work and decided to do it in Java for the FUD aspect (native hacks can be detected almost immediatly). I have this method which reads a memory object from the windows call ReadProcessMemory public static Memory readMemory(Pointer process, long address, int bytesToRead) { Memory output = new Memory(bytesToRead); KERNEL32.ReadProcessMemory(process, address, output, bytesToRead, 0); return output; } Memory output = new Memory(bytesToRead)

Kernel32.INSTANCE.ReadProcessMemory REALLY Slow In JNA

自古美人都是妖i 提交于 2020-01-02 11:43:05
问题 I'm writing a game hack which uses memory manipulation to work and decided to do it in Java for the FUD aspect (native hacks can be detected almost immediatly). I have this method which reads a memory object from the windows call ReadProcessMemory public static Memory readMemory(Pointer process, long address, int bytesToRead) { Memory output = new Memory(bytesToRead); KERNEL32.ReadProcessMemory(process, address, output, bytesToRead, 0); return output; } Memory output = new Memory(bytesToRead)

JAVA JNA 讯飞离线语音合成

馋奶兔 提交于 2019-12-31 22:56:01
JAVA JNA 讯飞离线语音合成 SDK下载 JNA MAVEN依赖 JAVA代码 SDK下载 URL:https://www.xfyun.cn/sdk/dispatcher windows离线语音SDK包下载 JNA MAVEN依赖 < ! -- https : / / mvnrepository . com / artifact / net . java . dev . jna / jna -- > < dependency > < groupId > net . java . dev . jna < / groupId > < artifactId > jna < / artifactId > < version > 5.5 .0 < / version > < / dependency > JAVA代码 package com . xunfei . tts ; import com . sun . jna . Library ; import com . sun . jna . Native ; import com . sun . jna . Pointer ; import com . sun . jna . ptr . IntByReference ; import java . io . IOException ; import java . io .

Change desktop background of MAC sytem using Java native access

时间秒杀一切 提交于 2019-12-31 03:44:28
问题 I have got a code snippet to change system desktop using JNA, it is worked fine for me. What change i need to make this code for working on Mac Os. Help is highly appreciated. Thanks, Shihab. 回答1: Looks like you need to Map the NSWorkspace class to JNA. Define an interface that extends Library class in JNA. Then map the setDesktopImageURL:forScreen:options:error: method ot JNA. http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class

How do I get a java JNA call to a DLL to get data returned in parameters?

房东的猫 提交于 2019-12-30 07:49:29
问题 I have this java test package ftct; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Platform; import com.sun.jna.win32.StdCallLibrary; import java.util.Date; public class LibFTCT { public LibFTCT() { } public interface LibFTCTLib extends StdCallLibrary { LibFTCTLib INSTANCE = (LibFTCTLib) Native.loadLibrary( "FTCTLib", LibFTCTLib.class); int a(int x); int DoCommand(int Command, int Param); int GetDataRecord(int RecordNum, int StreamNum, Date ReadingTime, double AIN1,

Java on Windows: how to delete a file to trash (using JNA)

↘锁芯ラ 提交于 2019-12-30 06:53:14
问题 I'm not experiences with Windows API at all, so please excuse my ignorance. I want to delete files to the trash. How to do that using JNA and how to detect if this would not be possible, e.g., because the files are located on a network share? 回答1: Use com.sun.jna.platform.win32.W32FileUtils, which has moveToTrash and hasTrash methods defined. 回答2: Use com.sun.jna.platform.FileUtils instead of com.sun.jna.platform.win32.W32FileUtils directly. import java.io.File; import java.io.IOException;