Skip to content

Commit

Permalink
Move new win32 structures into the correct Java files. Migrate new wi…
Browse files Browse the repository at this point in the history
…n32 interfaces still in the old project structure.
  • Loading branch information
tmyroadctfig committed Jul 6, 2011
1 parent ffa4cc6 commit a4a7fab
Show file tree
Hide file tree
Showing 18 changed files with 368 additions and 393 deletions.
5 changes: 2 additions & 3 deletions contrib/platform/src/com/sun/jna/platform/win32/Kernel32.java
Expand Up @@ -25,7 +25,6 @@
import com.sun.jna.platform.win32.WinNT.LARGE_INTEGER;
import com.sun.jna.platform.win32.WinNT.OSVERSIONINFO;
import com.sun.jna.platform.win32.WinNT.OSVERSIONINFOEX;
import com.sun.jna.platform.win32.structures.PROCESSENTRY32W;
import com.sun.jna.ptr.ByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.LongByReference;
Expand Down Expand Up @@ -1385,7 +1384,7 @@ boolean DeviceIoControl(HANDLE hDevice, int dwIoControlCode, Pointer lpInBuffer,
* ERROR_NO_MORE_FILES error value is returned by the GetLastError function if no processes exist or the snapshot
* does not contain process information.
*/
boolean Process32FirstW(HANDLE hSnapshot, PROCESSENTRY32W.ByReference lppe);
boolean Process32FirstW(HANDLE hSnapshot, Tlhelp32.PROCESSENTRY32W.ByReference lppe);

/**
* Retrieves information about the next process recorded in a system snapshot.
Expand All @@ -1397,5 +1396,5 @@ boolean DeviceIoControl(HANDLE hDevice, int dwIoControlCode, Pointer lpInBuffer,
* ERROR_NO_MORE_FILES error value is returned by the GetLastError function if no processes exist or the snapshot
* does not contain process information.
*/
boolean Process32NextW(HANDLE hSnapshot, PROCESSENTRY32W.ByReference lppe);
boolean Process32NextW(HANDLE hSnapshot, Tlhelp32.PROCESSENTRY32W.ByReference lppe);
}
Expand Up @@ -6,7 +6,7 @@
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

/**
/**
* Provides access to the w32 MSI installer library.
*/
public interface Msi extends StdCallLibrary {
Expand All @@ -28,11 +28,11 @@ public interface Msi extends StdCallLibrary {
static int INSTALLSTATE_LOCAL = 3;
static int INSTALLSTATE_SOURCE = 4;
static int INSTALLSTATE_DEFAULT = 5;

int MsiGetComponentPathW(WString szProduct, WString szComponent, char[] lpPathBuf, IntByReference pcchBuf);

int MsiLocateComponentW(WString szComponent, char[] lpPathBuf, IntByReference pcchBuf);

int MsiGetProductCodeW(WString szComponent, char[] lpProductBuf);

int MsiEnumComponents(WinDef.DWORD iComponentIndex, char[] lpComponentBuf);
Expand Down
@@ -1,10 +1,9 @@
package com.sun.jna.platform.win32;


import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.GUID;
import com.sun.jna.platform.win32.structures.SP_DEVICE_INTERFACE_DATA;
import com.sun.jna.platform.win32.structures.SP_DEVINFO_DATA;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
Expand All @@ -14,8 +13,8 @@ public interface SetupApi extends StdCallLibrary {
SetupApi INSTANCE = (SetupApi)
Native.loadLibrary("setupapi", SetupApi.class, W32APIOptions.DEFAULT_OPTIONS);

public static GUID GUID_DEVINTERFACE_DISK = new GUID(new byte[]
{
public static Guid.GUID GUID_DEVINTERFACE_DISK = new Guid.GUID(new byte[]
{
0x07, 0x63, (byte) 0xf5, 0x53, (byte) 0xbf, (byte) 0xb6, (byte) 0xd0, 0x11,
(byte) 0x94, (byte) 0xf2, 0x00, (byte) 0xa0, (byte) 0xc9, (byte) 0x1e, (byte) 0xfb, (byte) 0x8b
});
Expand All @@ -29,11 +28,11 @@ public interface SetupApi extends StdCallLibrary {
public int SPDRP_REMOVAL_POLICY = 0x0000001F;
public int CM_DEVCAP_REMOVABLE = 0x00000004;

WinNT.HANDLE SetupDiGetClassDevs(GUID.ByReference classGuid, Pointer enumerator, Pointer hwndParent, int flags);
WinNT.HANDLE SetupDiGetClassDevs(Guid.GUID.ByReference classGuid, Pointer enumerator, Pointer hwndParent, int flags);

boolean SetupDiDestroyDeviceInfoList(WinNT.HANDLE hDevInfo);

boolean SetupDiEnumDeviceInterfaces(WinNT.HANDLE hDevInfo, Pointer devInfo, GUID.ByReference interfaceClassGuid,
boolean SetupDiEnumDeviceInterfaces(WinNT.HANDLE hDevInfo, Pointer devInfo, Guid.GUID.ByReference interfaceClassGuid,
int memberIndex, SP_DEVICE_INTERFACE_DATA.ByReference deviceInterfaceData);

boolean SetupDiGetDeviceInterfaceDetail(WinNT.HANDLE hDevInfo, SP_DEVICE_INTERFACE_DATA.ByReference deviceInterfaceData,
Expand All @@ -43,4 +42,56 @@ boolean SetupDiGetDeviceInterfaceDetail(WinNT.HANDLE hDevInfo, SP_DEVICE_INTERFA
boolean SetupDiGetDeviceRegistryProperty(WinNT.HANDLE DeviceInfoSet, SP_DEVINFO_DATA.ByReference DeviceInfoData, int Property,
IntByReference PropertyRegDataType, Pointer PropertyBuffer, int PropertyBufferSize,
IntByReference RequiredSize);
}

public static class SP_DEVICE_INTERFACE_DATA extends Structure {

public static class ByReference extends SP_DEVINFO_DATA implements Structure.ByReference {
public ByReference() {
}

public ByReference(Pointer memory) {
super(memory);
}
}

public SP_DEVICE_INTERFACE_DATA() {
cbSize = size();
}

public SP_DEVICE_INTERFACE_DATA(Pointer memory) {
useMemory(memory);
read();
}

public int cbSize;
public Guid.GUID InterfaceClassGuid;
public int Flags;
public Pointer Reserved;
}

public static class SP_DEVINFO_DATA extends Structure {

public static class ByReference extends SP_DEVINFO_DATA implements Structure.ByReference {
public ByReference() {
}

public ByReference(Pointer memory) {
super(memory);
}
}

public SP_DEVINFO_DATA() {
cbSize = size();
}

public SP_DEVINFO_DATA(Pointer memory) {
useMemory(memory);
read();
}

public int cbSize;
public Guid.GUID InterfaceClassGuid;
public int Flags;
public Pointer Reserved;
}
}
40 changes: 40 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/Tlhelp32.java
@@ -0,0 +1,40 @@
package com.sun.jna.platform.win32;

import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.win32.StdCallLibrary;

public interface Tlhelp32 extends StdCallLibrary {

public static class PROCESSENTRY32W extends Structure {

public static class ByReference extends PROCESSENTRY32W implements Structure.ByReference {
public ByReference() {
}

public ByReference(Pointer memory) {
super(memory);
}
}

public PROCESSENTRY32W() {
dwSize = new WinDef.DWORD(size());
}

public PROCESSENTRY32W(Pointer memory) {
useMemory(memory);
read();
}

public WinDef.DWORD dwSize;
public WinDef.DWORD cntUsage;
public WinDef.DWORD th32ProcessID;
public BaseTSD.ULONG_PTR th32DefaultHeapID;
public WinDef.DWORD th32ModuleID;
public WinDef.DWORD cntThreads;
public WinDef.DWORD th32ParentProcessID;
public WinDef.LONG pcPriClassBase;
public WinDef.DWORD dwFlags;
public char[] szExeFile = new char[WinDef.MAX_PATH];
}
}
3 changes: 1 addition & 2 deletions contrib/platform/src/com/sun/jna/platform/win32/User32.java
Expand Up @@ -28,7 +28,6 @@
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.platform.win32.WinUser.BLENDFUNCTION;
import com.sun.jna.platform.win32.WinUser.FLASHWINFO;
import com.sun.jna.platform.win32.structures.INPUT;
import com.sun.jna.platform.win32.WinUser.GUITHREADINFO;
import com.sun.jna.platform.win32.WinUser.HHOOK;
import com.sun.jna.platform.win32.WinUser.HOOKPROC;
Expand Down Expand Up @@ -915,7 +914,7 @@ boolean PeekMessage(MSG lpMsg, HWND hWnd, int wMsgFilterMin,
* This function fails when it is blocked by UIPI. Note that neither GetLastError nor the return value will
* indicate the failure was caused by UIPI blocking.
*/
DWORD SendInput(DWORD nInputs, INPUT[] pInputs,int cbSize);
DWORD SendInput(DWORD nInputs, WinUser.INPUT[] pInputs,int cbSize);

/**
* Waits until the specified process has finished processing its initial input and is waiting for user input with no
Expand Down
42 changes: 42 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/VerRsrc.java
@@ -0,0 +1,42 @@
package com.sun.jna.platform.win32;

import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.win32.StdCallLibrary;

public interface VerRsrc extends StdCallLibrary {

public static class VS_FIXEDFILEINFO extends Structure {

public static class ByReference extends VS_FIXEDFILEINFO implements Structure.ByReference {
public ByReference() {
}

public ByReference(Pointer memory) {
super(memory);
}
}

public VS_FIXEDFILEINFO() {
}

public VS_FIXEDFILEINFO(Pointer memory) {
useMemory(memory);
read();
}

public int Signature;
public int StrucVersion;
public int FileVersionMS;
public int FileVersionLS;
public int ProductVersionMS;
public int ProductVersionLS;
public int FileFlagsMask;
public int FileFlags;
public int FileOS;
public int FileType;
public int FileSubtype;
public int FileDateMS;
public int FileDateLS;
}
}
Expand Up @@ -7,7 +7,7 @@
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

/**
/**
* Provides access to the w32 version library.
*/
public interface Version extends StdCallLibrary {
Expand All @@ -16,8 +16,8 @@ public interface Version extends StdCallLibrary {
Native.loadLibrary("version", Version.class, W32APIOptions.DEFAULT_OPTIONS);

int GetFileVersionInfoSize(String lptstrFilename, IntByReference lpdwHandle);

boolean GetFileVersionInfo(String lptstrFilename, int dwHandle, int dwLen, Pointer lpData);

boolean VerQueryValue(Pointer pBlock, String lpSubBlock, PointerByReference lplpBuffer, IntByReference puLen);
}

0 comments on commit a4a7fab

Please sign in to comment.