jna

Java JNA UCHAR and PUCHAR

╄→гoц情女王★ 提交于 2019-12-11 03:01:40
问题 I'm looking to get a Java string to ' WlanHostedNetworkSetSecondaryKey ' and ' WlanHostedNetworkSetProperty '. One wants a struct within a struct with a CHAR[] and the first one wants a PUCHAR. I tried using String, char[], byte[] and Memory , but they will keep producing me the same errors (Bad parameters or Bad profile something for the first). Any way maybe to debug more with JNA (probably not :()? I also can't read anywhere the characterencoding which is used, except that it's not ANSI..

Issue when executing IWbemServices.ExecQuery when executing WMI using JNA

六眼飞鱼酱① 提交于 2019-12-11 02:46:43
问题 I am trying to write a Java program which uses JNA to execute WMI query to execute on remote machine (Provided username/password). I am trying to port this WMI example. I have modified this code here for my testing purpose (directly provided username/password) and it works fine. But, in my java code, when executing the query using ExecQuery, I am getting the error code 0x80070005. String machineName = "machine"; String userNameWithDomain = "\\administrator"; String pass = "Password"; String

Using JNA to Get NSWindow from JComponent on mac

六月ゝ 毕业季﹏ 提交于 2019-12-11 02:36:57
问题 Is it possible to get the pointer or the window number of the underlying NSWindow of a JComponent on Mac, using JNA. I found methods getWindowID and getWindowPointer in com.sun.jna.Native. The documentation mentions getWindowID is for X11 and getWindowPointer is for win32. Is there a similar function for Mac OSX ?? I know how to get the cocoa window of a component using a JNI function but I am interested in using something in Java without writing a JNI function. -Thanks, Abhinay. 回答1: If you

Key listener written in Java JNA. Prevent multiple Callback

此生再无相见时 提交于 2019-12-11 01:32:27
问题 I use the following code to listen to global key events: Win32HookManager.java import com.sun.jna.Pointer; import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.User32; import com.sun.jna.platform.win32.WinDef.HMODULE; import com.sun.jna.platform.win32.WinDef.LRESULT; import com.sun.jna.platform.win32.WinDef.WPARAM; import com.sun.jna.platform.win32.WinDef.LPARAM; import com.sun.jna.platform.win32.WinUser; import com.sun.jna.platform.win32.WinUser.HHOOK; import com.sun

List all exported symbol names using JNA

◇◆丶佛笑我妖孽 提交于 2019-12-11 01:06:23
问题 How can you list all available function names in a given dll using JNA? 回答1: JNA lets you invoke those functions at runtime. To see what is available, use a tool appropriate for the job. On windows, you have "dumpbin /exports". On linux, you have objdump. On MacOSX you have otool. If you want to dynamically look up function names in a DLL from a running Java program using JNA, then you'd need to duplicate at least some of the functionality of those programs to parse the object file looking

JNA Exception in thread “main” java.lang.Error: Invalid memory access(Unknown Source)

跟風遠走 提交于 2019-12-11 00:38:45
问题 I'm using JNA 4.0.0 to access some DLL function from Java, this DLL Native Function is declared as the following: int ApplicationInit(HANDLE hEMV, TLV *tlv_Appl, TLV *tlv_AIP); Types of the input parameters are described below /* Opaque structure */ typedef void *HANDLE; typedef struct { unsigned char *_lenptr; /* pointer to 'len' field (Private member) */ unsigned int _len; /* 'outer' length, specified by user (Private member) */ unsigned short _offset; unsigned short len; /* number of bytes

How to set global memory byte alignment for all structures in JNA library?

廉价感情. 提交于 2019-12-10 23:59:30
问题 Is there any way to set global memory byte alignment for all data structures in JNA library (*.dll Java wrapper)? Sometimes I have to determine correct alignment by trial and error during implementation and currently I'm doing this in very clumsy way - I'm setting data alignment (super(ALIGN_NONE)) in each and every structure (a lot of structures in separate files). edit: The best way to solve my problem was to extend Structure: public abstract class StructureAligned extends Structure {

Is it somehow possible to get a HWND of a JavaFX window in Java 9?

Deadly 提交于 2019-12-10 22:46:21
问题 Java 9 will restrict any access to private API. That means that the known methods of retrieving the window hwnd using Reflection won't work anymore. Is there still a way to get them? I ask because I have a library that offers an API for manipulating the Taskbar (in a similar way that Java9 offers). The Java 9 API is still for AWT, so I hope I can get my project setup for Java 9 and JavaFX. I used to just call the private methods, but this will stop working. Any solution is appreciated. Native

Why my JNA using application doesn't react in a right way?

谁都会走 提交于 2019-12-10 21:41:10
问题 I'm trying to build a java application by using the JNA to gain access to the window messages (for e.g WM_POINTERDOWN). With this option, I will turn my application into a touch-sensitive application. So far my current code gets this window messages but possibly overwrites some other important java native code so that the JFrame doesn't react in the way I expect (for example, while resizing the JFrame to a bigger one, it fills the new added area black). This is my Listener, which will be

Java JNA writing memory boolean

妖精的绣舞 提交于 2019-12-10 20:37:49
问题 I'm hacking a game and I'm using Java JNA to write memory to the game, I can only write byte arrays but I need to write booleans as well (if that makes sense). So this is my write methods VKernel32.java public abstract boolean WriteProcessMemory(Pointer paramPointer1, long paramLong, Pointer paramPointer2, int paramInt, IntByReference paramIntByReference); Actual Memory Writing: public void writeMemory(int address, byte[] data) { int size = data.length; Memory toWrite = new Memory(size); for