jna

JNA call RegisterDeviceNotification fails with error 1066

我们两清 提交于 2020-01-06 05:42:26
问题 I am attempting to register for notifications on USB device arrival and device remove complete events from a java swing application. I have successfully called SetWindowLong(hWnd, MyUser32.GWLP_WNDPROC, listener); to register a listener and I am getting notifications of type WM_DEVICECHANGE . So far so good. Now I want to call RegisterDeviceNotification to ensure that I am notified of device arrival and remove complete events. Here is what I have tried: HWND hWnd = new HWND(); hWnd.setPointer

JNA call RegisterDeviceNotification fails with error 1066

喜你入骨 提交于 2020-01-06 05:42:21
问题 I am attempting to register for notifications on USB device arrival and device remove complete events from a java swing application. I have successfully called SetWindowLong(hWnd, MyUser32.GWLP_WNDPROC, listener); to register a listener and I am getting notifications of type WM_DEVICECHANGE . So far so good. Now I want to call RegisterDeviceNotification to ensure that I am notified of device arrival and remove complete events. Here is what I have tried: HWND hWnd = new HWND(); hWnd.setPointer

Java Native Access code Error: “Invalid memory access”

为君一笑 提交于 2020-01-06 05:28:07
问题 I have access to test.h and test.so files: test.h int insert_data(void *location_data, uint64_t device_id, uint64_t event_id, uint64_t motion_seq, uint64_t utc_time, uint32_t sensor_seq, uint32_t device_seq, uint32_t tick_mark, uint16_t ble, int movement, int path_id); I am now writing JNA code to call the above method. interface TestCLibrary extends Library { TestCLibrary INSTANCE = (TestCLibrary) Native.loadLibrary(“test”, TestCLibrary); int insert_data(Pointer test_data, long device_id,

JNA - EnumProcessModules() not returning all DLLs?

 ̄綄美尐妖づ 提交于 2020-01-05 22:17:34
问题 I trying to read coordinates from a game. This works perfectly fine, when using ReadProcessMemory on a HANDLE that I receive through OpenProcess, with the memory I find in CheatEngine. For example, if I know the float value in the running process is at 0x5AB38F68, I can read this. However, the address changes everytime the game restarts. It depends on a module called AkSoundEngine.dll. So basically the address would be at AkSoundEngine.dll+0x168F68. However, I cannot for the life of me find

JNA - EnumProcessModules() not returning all DLLs?

◇◆丶佛笑我妖孽 提交于 2020-01-05 22:16:13
问题 I trying to read coordinates from a game. This works perfectly fine, when using ReadProcessMemory on a HANDLE that I receive through OpenProcess, with the memory I find in CheatEngine. For example, if I know the float value in the running process is at 0x5AB38F68, I can read this. However, the address changes everytime the game restarts. It depends on a module called AkSoundEngine.dll. So basically the address would be at AkSoundEngine.dll+0x168F68. However, I cannot for the life of me find

JNA pointer to unsigned char*

流过昼夜 提交于 2020-01-05 12:09:06
问题 I have an array of bytes and I want to pass it to C function using JNA. However I only found examples which allocated a pointer using new Memory and used write function to copy array data but for me is not acceptable because I have big block of data. Is there a possibility just to pass my Java array directly to c library ? I want to do something like this : MyLib lib = Native.loadLibrary("test"); Pointer p = myByteArray; //I want to make it possible lib.someFunction(p); 回答1: Passing a

function mapping delphi/pascal dll in jna handle and string

微笑、不失礼 提交于 2020-01-05 12:07:08
问题 I'm trying to call a function in a delphi dll using JNA. the function definition is: function myFuncGetName (aHandle : THandle; var aBuf : pwideChar ): integer; export; my jna mapping looks like this: int myFuncGetName(PointerByReference aHandle, WString aBuf); the return value should be 0 for success and -1 for fail and I'm always getting -1. I have started up WinDbg and attached to the process and it breaks at myFuncGetName. 057cb384 eb11 jmp myDLL!myFuncGetName+0x87 (057cb397) 057cb386

Get starttime of a process in windows / linux? [duplicate]

夙愿已清 提交于 2020-01-04 06:11:00
问题 This question already has answers here : How to get a list of current open windows/process with Java? (13 answers) Closed 4 months ago . I have the ID (pid) of this process. Now i want to find out when the process with this id has started. Note1: The process is not a java thread. Note2: JNA Solutions would also be welcome From my java context i want to get this information. How can it be done? UPDATE: see Note2. 回答1: On linux (I am running Ubuntu 14) public class SO { public static void main

Get starttime of a process in windows / linux? [duplicate]

吃可爱长大的小学妹 提交于 2020-01-04 06:08:27
问题 This question already has answers here : How to get a list of current open windows/process with Java? (13 answers) Closed 4 months ago . I have the ID (pid) of this process. Now i want to find out when the process with this id has started. Note1: The process is not a java thread. Note2: JNA Solutions would also be welcome From my java context i want to get this information. How can it be done? UPDATE: see Note2. 回答1: On linux (I am running Ubuntu 14) public class SO { public static void main

DLL (Delphi) with ADO (connection and query) not work in Java (using jna)

我怕爱的太早我们不能终老 提交于 2020-01-04 02:10:06
问题 I have a dll (Delphi) that contains a ADOConnection and ADOQuery, but when running the called DLL in java (using JNA) appear some error information to the console (below): A fatal error has been detected by the Java Runtime Environment: Internal Error (0xeedfade), pid=4400, tid=3840 JRE version: 6.0_25-b06 Java VM: Java HotSpot(TM) Client VM (20.0-b11 mixed mode, sharing windows-x86 ) Problematic frame: C [KERNELBASE.dll+0x812f] An error report file with more information is saved as: C:\Users