Skip to content

Commit

Permalink
Merge pull request java-native-access#686 from matthiasblaesing/winne…
Browse files Browse the repository at this point in the history
…twk_mapping

Correct typemapper used for structures defined
  • Loading branch information
matthiasblaesing authored Aug 2, 2016
2 parents c3cb85a + 9049d05 commit 5d7e4b0
Show file tree
Hide file tree
Showing 37 changed files with 1,351 additions and 318 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Bug Fixes
* [#674](https://github.com/java-native-access/jna/pull/674): Update references to Apache License as requested by issue #673 [@bhamail](https://github.com/bhamail)
* [#636](https://github.com/java-native-access/jna/issues/636): Staticly link visual c++ runtime when building with MSVC - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#624](https://github.com/java-native-access/jna/issues/624): WinDef.DWORD getLow() & getHigh() using incorrect bit mask - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#668](https://github.com/java-native-access/jna/issues/668): Correct typemapper used for structures defined in `com.sun.jna.platform.win32.DsGetDC`, `com.sun.jna.platform.win32.LMAccess`, `com.sun.jna.platform.win32.LMShare`, `com.sun.jna.platform.win32.Sspi`, `com.sun.jna.platform.win32.WinBase`, `com.sun.jna.platform.win32.WinCrypt`, `com.sun.jna.platform.win32.WinUser` and `com.sun.jna.platform.win32.Winnetwk` - [@matthiasblaesing](https://github.com/matthiasblaesing).

Release 4.2.1
=============
Expand Down
1,326 changes: 1,102 additions & 224 deletions contrib/platform/nbproject/build-impl.xml

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions contrib/platform/src/com/sun/jna/platform/win32/DsGetDC.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.Guid.GUID;
import com.sun.jna.platform.win32.WinNT.PSID;
import com.sun.jna.win32.W32APITypeMapper;

/**
* Ported from DsGetDC.h. Windows SDK 6.0a
Expand Down Expand Up @@ -107,11 +108,11 @@ public static class ByReference extends DOMAIN_CONTROLLER_INFO
public String ClientSiteName;

public DOMAIN_CONTROLLER_INFO() {
super();
super(W32APITypeMapper.DEFAULT);
}

public DOMAIN_CONTROLLER_INFO(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
read();
}

Expand Down Expand Up @@ -235,11 +236,11 @@ protected List<String> getFieldOrder() {
}

public DS_DOMAIN_TRUSTS() {
super();
super(W32APITypeMapper.DEFAULT);
}

public DS_DOMAIN_TRUSTS(Pointer p) {
super(p);
super(p, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
read();
}
};
Expand Down
14 changes: 10 additions & 4 deletions contrib/platform/src/com/sun/jna/platform/win32/Kernel32.java
Original file line number Diff line number Diff line change
Expand Up @@ -1264,10 +1264,16 @@ boolean CreateProcessW(String lpApplicationName, char[] lpCommandLine,
/**
* This function returns a handle to an existing process object.
*
* @param fdwAccess
* Not supported; set to zero.
* @param fInherit
* Not supported; set to FALSE.
* @param fdwAccess The access to the process object. This access right is
* checked against the security descriptor for the process. This parameter
* can be one or more of the process access rights.
* <p>
* If the caller has enabled the SeDebugPrivilege privilege, the requested
* access is granted regardless of the contents of the security
* descriptor.</p>
*
* @param fInherit If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.
*
* @param IDProcess
* Specifies the process identifier of the process to open.
* @return An open handle to the specified process indicates success. NULL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public static Map<String,String> getEnvironmentVariables(Pointer lpszEnvironment
if (lpszEnvironmentBlock == null) {
return null;
}

Map<String,String> vars=new TreeMap<String,String>();
boolean asWideChars=isWideCharEnvironmentStringBlock(lpszEnvironmentBlock, offset);
long stepFactor=asWideChars ? 2L : 1L;
Expand Down
45 changes: 23 additions & 22 deletions contrib/platform/src/com/sun/jna/platform/win32/LMAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinNT.PSID;
import com.sun.jna.win32.W32APITypeMapper;

/**
* Ported from LMAccess.h.
Expand All @@ -31,11 +32,11 @@ public static class LOCALGROUP_INFO_0 extends Structure {
public String lgrui0_name;

public LOCALGROUP_INFO_0() {
super();
super(W32APITypeMapper.UNICODE);
}

public LOCALGROUP_INFO_0(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand All @@ -52,11 +53,11 @@ public static class LOCALGROUP_INFO_1 extends Structure {
public String lgrui1_comment;

public LOCALGROUP_INFO_1() {
super();
super(W32APITypeMapper.UNICODE);
}

public LOCALGROUP_INFO_1(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down Expand Up @@ -88,11 +89,11 @@ public static class USER_INFO_0 extends Structure {
public String usri0_name;

public USER_INFO_0() {
super();
super(W32APITypeMapper.UNICODE);
}

public USER_INFO_0(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down Expand Up @@ -153,11 +154,11 @@ public static class USER_INFO_1 extends Structure {
public String usri1_script_path;

public USER_INFO_1() {
super();
super(W32APITypeMapper.UNICODE);
}

public USER_INFO_1(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down Expand Up @@ -232,11 +233,11 @@ public static class USER_INFO_23 extends Structure {
public PSID.ByReference usri23_user_sid;

public USER_INFO_23() {
super();
super(W32APITypeMapper.UNICODE);
}

public USER_INFO_23(Pointer memory) {
useMemory(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand All @@ -257,11 +258,11 @@ public static class GROUP_USERS_INFO_0 extends Structure {
public String grui0_name;

public GROUP_USERS_INFO_0() {
super();
super(W32APITypeMapper.UNICODE);
}

public GROUP_USERS_INFO_0(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand All @@ -282,11 +283,11 @@ public static class LOCALGROUP_USERS_INFO_0 extends Structure {
public String lgrui0_name;

public LOCALGROUP_USERS_INFO_0() {
super();
super(W32APITypeMapper.UNICODE);
}

public LOCALGROUP_USERS_INFO_0(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand All @@ -311,11 +312,11 @@ public static class GROUP_INFO_0 extends Structure {
public String grpi0_name;

public GROUP_INFO_0() {
super();
super(W32APITypeMapper.UNICODE);
}

public GROUP_INFO_0(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down Expand Up @@ -345,11 +346,11 @@ public static class GROUP_INFO_1 extends Structure {
public String grpi1_comment;

public GROUP_INFO_1() {
super();
super(W32APITypeMapper.UNICODE);
}

public GROUP_INFO_1(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down Expand Up @@ -390,11 +391,11 @@ public static class GROUP_INFO_2 extends Structure {
public int grpi2_attributes;

public GROUP_INFO_2() {
super();
super(W32APITypeMapper.UNICODE);
}

public GROUP_INFO_2(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down Expand Up @@ -435,11 +436,11 @@ public static class GROUP_INFO_3 extends Structure {
public int grpi3_attributes;

public GROUP_INFO_3() {
super();
super(W32APITypeMapper.UNICODE);
}

public GROUP_INFO_3(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down
9 changes: 5 additions & 4 deletions contrib/platform/src/com/sun/jna/platform/win32/LMShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

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

/**
* Ported from LMShare.h.
Expand Down Expand Up @@ -118,11 +119,11 @@ public static class SHARE_INFO_2 extends Structure {
public String shi2_passwd;

public SHARE_INFO_2() {
super();
super(W32APITypeMapper.UNICODE);
}

public SHARE_INFO_2(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down Expand Up @@ -202,11 +203,11 @@ public static class SHARE_INFO_502 extends Structure {
public Pointer shi502_security_descriptor;

public SHARE_INFO_502() {
super();
super(W32APITypeMapper.UNICODE);
}

public SHARE_INFO_502(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
read();
}

Expand Down
6 changes: 6 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 @@ -17,6 +17,8 @@
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.TypeMapper;
import com.sun.jna.win32.W32APITypeMapper;

/**
* Ported from Sspi.h.
Expand Down Expand Up @@ -450,6 +452,10 @@ public static class ByReference extends SecPkgInfo implements Structure.ByRefere
*/
public String Comment;

public SecPkgInfo() {
super(W32APITypeMapper.DEFAULT);
}

@Override
protected List<String> getFieldOrder() {
return FIELDS;
Expand Down
6 changes: 6 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/WinBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.ByteByReference;
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
import com.sun.jna.win32.W32APITypeMapper;

/**
* Ported from Winbase.h (kernel32.dll/kernel services).
Expand Down Expand Up @@ -427,6 +428,10 @@ public static class TIME_ZONE_INFORMATION extends Structure {
public SYSTEMTIME DaylightDate;
public LONG DaylightBias;

public TIME_ZONE_INFORMATION() {
super(W32APITypeMapper.DEFAULT);
}

@Override
protected List<String> getFieldOrder() {
return Arrays.asList(new String[] { "Bias", "StandardName", "StandardDate", "StandardBias", "DaylightName", "DaylightDate", "DaylightBias" });
Expand Down Expand Up @@ -902,6 +907,7 @@ protected List<String> getFieldOrder() {
}

public STARTUPINFO() {
super(W32APITypeMapper.DEFAULT);
cb = new DWORD(size());
}
}
Expand Down
5 changes: 3 additions & 2 deletions contrib/platform/src/com/sun/jna/platform/win32/WinCrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.win32.W32APITypeMapper;

/**
* Ported from WinCrypt.h.
Expand Down Expand Up @@ -101,11 +102,11 @@ public static class CRYPTPROTECT_PROMPTSTRUCT extends Structure {
public String szPrompt;

public CRYPTPROTECT_PROMPTSTRUCT() {
super();
super(W32APITypeMapper.DEFAULT);
}

public CRYPTPROTECT_PROMPTSTRUCT(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
read();
}

Expand Down
4 changes: 3 additions & 1 deletion contrib/platform/src/com/sun/jna/platform/win32/WinUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.sun.jna.platform.win32.BaseTSD.ULONG_PTR;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
import com.sun.jna.win32.W32APITypeMapper;

/**
* Ported from WinUser.h Microsoft Windows SDK 6.0A.
Expand Down Expand Up @@ -1166,6 +1167,7 @@ public static class ByReference extends WNDCLASSEX implements
* Instantiates a new wndclassex.
*/
public WNDCLASSEX() {
super(W32APITypeMapper.DEFAULT);
}

/**
Expand All @@ -1175,7 +1177,7 @@ public WNDCLASSEX() {
* the memory
*/
public WNDCLASSEX(Pointer memory) {
super(memory);
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
read();
}

Expand Down
Loading

0 comments on commit 5d7e4b0

Please sign in to comment.