Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added field order in Win32 APIs, fixed Windows JNA tests. #119

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/DsGetDC.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public DOMAIN_CONTROLLER_INFO(Pointer memory) {
* subnet that the computer is in with a valid site.
*/
public WString ClientSiteName;

{ setFieldOrder(new String[] { "DomainControllerName", "DomainControllerAddress", "DomainControllerAddressType", "DomainGuid", "DomainName", "DnsForestName", "Flags", "DcSiteName", "ClientSiteName" }); }
}

/**
Expand All @@ -112,6 +114,8 @@ public static class ByReference extends PDOMAIN_CONTROLLER_INFO implements Struc
}

public DOMAIN_CONTROLLER_INFO.ByReference dci;

{ setFieldOrder(new String[] { "dci" }); }
}

/**
Expand Down Expand Up @@ -195,6 +199,8 @@ public static class ByReference extends DS_DOMAIN_TRUSTS implements Structure.By
*/
public GUID DomainGuid;

{ setFieldOrder(new String[] { "NetbiosDomainName", "DnsDomainName", "Flags", "ParentIndex", "TrustType", "TrustAttributes", "DomainSid", "DomainGuid" }); }

public DS_DOMAIN_TRUSTS() {
}

Expand All @@ -212,6 +218,8 @@ public static class ByReference extends PDS_DOMAIN_TRUSTS implements Structure.B
}

public DS_DOMAIN_TRUSTS.ByReference t;

{ setFieldOrder(new String[] { "t" }); }

/**
* Returns domain trusts.
Expand Down
2 changes: 2 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/Guid.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,7 @@ public GUID(byte[] data) {
public short Data2;
public short Data3;
public byte[] Data4 = new byte[8];

{ setFieldOrder(new String[] { "Data1", "Data2", "Data3", "Data4" }); }
}
}
24 changes: 23 additions & 1 deletion contrib/platform/src/com/sun/jna/platform/win32/LMAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public LOCALGROUP_INFO_0(Pointer memory) {
}

public WString lgrui0_name;

{ setFieldOrder(new String[] { "lgrui0_name" }); }
}

public static class LOCALGROUP_INFO_1 extends Structure {
Expand All @@ -50,6 +52,8 @@ public LOCALGROUP_INFO_1(Pointer memory) {

public WString lgrui1_name;
public WString lgrui1_comment;

{ setFieldOrder(new String[] { "lgrui1_name", "lgrui1_comment" }); }
}

//
Expand Down Expand Up @@ -80,6 +84,8 @@ public USER_INFO_0(Pointer memory) {
* Pointer to a Unicode string that specifies the name of the user account.
*/
public WString usri0_name;

{ setFieldOrder(new String[] { "usri0_name" }); }
}

/**
Expand Down Expand Up @@ -136,6 +142,8 @@ public USER_INFO_1(Pointer memory) {
* logon script file.
*/
public WString usri1_script_path;

{ setFieldOrder(new String[] { "usri1_name", "usri1_password", "usri1_password_age", "usri1_priv", "usri1_home_dir", "usri1_comment", "usri1_flags", "usri1_script_path" }); }
}

/**
Expand Down Expand Up @@ -206,7 +214,9 @@ public USER_INFO_23(Pointer memory) {
* A pointer to a SID structure that contains the security identifier (SID)
* that uniquely identifies the user. The NetUserAdd and NetUserSetInfo functions ignore this member.
*/
public PSID.ByReference usri23_user_sid;
public PSID.ByReference usri23_user_sid;

{ setFieldOrder(new String[] { "usri23_name", "usri23_full_name", "usri23_comment", "usri23_flags", "usri23_user_sid" }); }
}

/**
Expand All @@ -226,6 +236,8 @@ public GROUP_USERS_INFO_0(Pointer memory) {
* Pointer to a null-terminated Unicode character string that specifies a name.
*/
public WString grui0_name;

{ setFieldOrder(new String[] { "grui0_name" }); }
}

/**
Expand All @@ -245,6 +257,8 @@ public LOCALGROUP_USERS_INFO_0(Pointer memory) {
* Pointer to a Unicode string specifying the name of a local group to which the user belongs.
*/
public WString lgrui0_name;

{ setFieldOrder(new String[] { "lgrui0_name" }); }
}

/**
Expand All @@ -267,6 +281,8 @@ public GROUP_INFO_0(Pointer memory) {
* the name of the global group.
*/
public WString grpi0_name;

{ setFieldOrder(new String[] { "grpi0_name" }); }
}

/**
Expand Down Expand Up @@ -294,6 +310,8 @@ public GROUP_INFO_1(Pointer memory) {
* string. The comment can contain MAXCOMMENTSZ characters.
*/
public WString grpi1_comment;

{ setFieldOrder(new String[] { "grpi1_name", "grpi1_comment" }); }
}

/**
Expand Down Expand Up @@ -331,6 +349,8 @@ public GROUP_INFO_2(Pointer memory) {
* and SE_GROUP_ENABLED_BY_DEFAULT.
*/
public int grpi2_attributes;

{ setFieldOrder(new String[] { "grpi2_name", "grpi2_comment", "grpi2_group_id", "grpi2_attributes" }); }
}

/**
Expand Down Expand Up @@ -368,6 +388,8 @@ public GROUP_INFO_3(Pointer memory) {
* SE_GROUP_ENABLED_BY_DEFAULT.
*/
public int grpi3_attributes;

{ setFieldOrder(new String[] { "grpi3_name", "grpi3_comment", "grpi3_group_sid" }); }
}

//
Expand Down
18 changes: 16 additions & 2 deletions contrib/platform/src/com/sun/jna/platform/win32/NTSecApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public static class ByReference extends LSA_UNICODE_STRING implements Structure.
*/
public Pointer Buffer;

{ setFieldOrder(new String[] { "Length", "MaximumLength", "Buffer" }); }

/**
* String representation of the buffer.
* @return
Expand Down Expand Up @@ -97,11 +99,15 @@ public static class LSA_FOREST_TRUST_DOMAIN_INFO extends Structure {
public PSID.ByReference Sid;
public LSA_UNICODE_STRING DnsName;
public LSA_UNICODE_STRING NetbiosName;

{ setFieldOrder(new String[] { "Sid", "DnsName", "NetbiosName" }); }
}

public static class LSA_FOREST_TRUST_BINARY_DATA extends Structure {
public int Length;
public Pointer Buffer;

{ setFieldOrder(new String[] { "Length", "Buffer" }); }
}

public static class LSA_FOREST_TRUST_RECORD extends Structure {
Expand Down Expand Up @@ -144,7 +150,9 @@ public static class ByReference extends UNION implements Structure.ByReference
* Data type depending on ForestTrustType.
*/
public UNION u;


{ setFieldOrder(new String[] { "Flags", "ForestTrustType", "Time", "u" }); }

public void read() {
super.read();

Expand All @@ -171,6 +179,8 @@ public static class ByReference extends PLSA_FOREST_TRUST_RECORD implements Stru
}

public LSA_FOREST_TRUST_RECORD.ByReference tr;

{ setFieldOrder(new String[] { "tr" }); }
}

public static class LSA_FOREST_TRUST_INFORMATION extends Structure {
Expand Down Expand Up @@ -198,6 +208,8 @@ public static class ByReference extends LSA_FOREST_TRUST_INFORMATION implements
public PLSA_FOREST_TRUST_RECORD[] getEntries() {
return (PLSA_FOREST_TRUST_RECORD[]) Entries.toArray(RecordCount);
}

{ setFieldOrder(new String[] { "RecordCount" }); }
}
/**
* The LSA_FOREST_TRUST_INFORMATION structure contains Local Security Authority
Expand All @@ -209,6 +221,8 @@ public static class ByReference extends PLSA_FOREST_TRUST_INFORMATION implements

}

public LSA_FOREST_TRUST_INFORMATION.ByReference fti;
public LSA_FOREST_TRUST_INFORMATION.ByReference fti;

{ setFieldOrder(new String[] { "fti" }); }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.DsGetDC.PDOMAIN_CONTROLLER_INFO;
import com.sun.jna.platform.win32.DsGetDC.PDS_DOMAIN_TRUSTS;
import com.sun.jna.platform.win32.Guid.GUID;
import com.sun.jna.platform.win32.NTSecApi.PLSA_FOREST_TRUST_INFORMATION;
import com.sun.jna.ptr.IntByReference;
Expand Down
4 changes: 4 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/SetupApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ public SP_DEVICE_INTERFACE_DATA(Pointer memory) {
* Reserved. Do not use.
*/
public Pointer Reserved;

{ setFieldOrder(new String[] { "cbSize", "InterfaceClassGuid", "Flags", "Reserved" }); }
}

/**
Expand Down Expand Up @@ -330,5 +332,7 @@ public SP_DEVINFO_DATA(Pointer memory) {
* Reserved. For internal use only.
*/
public Pointer Reserved;

{ setFieldOrder(new String[] { "cbSize", "InterfaceClassGuid", "DevInst", "Reserved" }); }
}
}
2 changes: 2 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/ShellAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,7 @@ public String encodePaths(String[] paths) {
}
return encoded + "\0";
}

{ setFieldOrder(new String[] { "hwnd", "wFunc", "pFrom", "pTo", "fFlags", "fAnyOperationsAborted", "pNameMappings", "lpszProgressTitle" }); }
}
}
14 changes: 14 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/Sspi.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public interface Sspi extends StdCallLibrary {
public static class SecHandle extends Structure {
public Pointer dwLower;
public Pointer dwUpper;

{ setFieldOrder(new String[] { "dwLower", "dwUpper" }); }

public static class ByReference extends SecHandle implements Structure.ByReference {

Expand Down Expand Up @@ -172,6 +174,8 @@ public static class ByReference extends PSecHandle implements Structure.ByRefere
* The first entry in an array of SecPkgInfo structures.
*/
public SecHandle.ByReference secHandle;

{ setFieldOrder(new String[] { "secHandle" }); }

public PSecHandle() {

Expand Down Expand Up @@ -251,6 +255,8 @@ public byte[] getBytes() {
*/
public Pointer pvBuffer;

{ setFieldOrder(new String[] { "cbBuffer", "BufferType", "pvBuffer" }); }

/**
* Create a new SECBUFFER_EMPTY buffer.
*/
Expand Down Expand Up @@ -314,6 +320,8 @@ public static class SecBufferDesc extends Structure {
*/
public SecBuffer.ByReference[] pBuffers;

{ setFieldOrder(new String[] { "ulVersion", "cBuffers", "pBuffers" }); }

/**
* Create a new SecBufferDesc with one SECBUFFER_EMPTY buffer.
*/
Expand Down Expand Up @@ -378,6 +386,8 @@ public SECURITY_INTEGER() {
dwLower = 0;
dwUpper = 0;
}

{ setFieldOrder(new String[] { "dwLower", "dwUpper" }); }
}

/**
Expand Down Expand Up @@ -411,6 +421,8 @@ public PSecPkgInfo() {
public SecPkgInfo.ByReference[] toArray(int size) {
return (SecPkgInfo.ByReference[]) pPkgInfo.toArray(size);
}

{ setFieldOrder(new String[] { "poPkgInfo" }); }
}

/**
Expand Down Expand Up @@ -462,5 +474,7 @@ public SecPkgInfo() {
wRPCID = 0;
cbMaxToken = 0;
}

{ setFieldOrder(new String[] { "fCapabilities", "wVersion", "wRPCID", "cbMaxToken", "Name", "Comment" }); }
}
}
2 changes: 2 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/Tlhelp32.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,7 @@ public PROCESSENTRY32(Pointer memory) {
* retrieve the full path of the executable file for a 64-bit process.
*/
public char[] szExeFile = new char[WinDef.MAX_PATH];

{ setFieldOrder(new String[] { "dwSize", "cntUsage", "th32ProcessID", "th32DefaultHeapID", "th32ModuleID", "cntThreads", "th32ParentProcessID", "pcPriClassBase", "dwFlags", "szExeFile" }); }
}
}
2 changes: 2 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/VerRsrc.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@ public VS_FIXEDFILEINFO(Pointer memory) {
* The least significant 32 bits of the file's 64-bit binary creation date and time stamp.
*/
public WinDef.DWORD dwFileDateLS;

{ setFieldOrder(new String[] { "dwSignature", "dwStrucVersion", "dwFileVersionMS", "dwFileVersionLS", "dwProductVersionMS", "dwProductVersionLS", "dwFileFlagsMask", "dwFileFlags", "dwFileOS", "dwFileType", "dwFileSubtype", "dwFileDateMS", "dwFileDateLS" }); }
}
}
4 changes: 4 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/Wdm.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public KEY_BASIC_INFORMATION(Pointer memory) {
*/
public char[] Name;
/**
* Name of the key.
* Name of the key.
* Name of the key.
* @return String.
*/
Expand All @@ -74,6 +76,8 @@ public void read() {
Name = new char[NameLength / 2];
readField("Name");
}

{ setFieldOrder(new String[] { "LastWriteTime", "TitleIndex", "NameLength", "Name" }); }
}

/**
Expand Down
Loading