Skip to content

Commit

Permalink
Correct typemapper used for structures defined
Browse files Browse the repository at this point in the history
Winnetwk definitions follow the typemapper set by the "w32.ascii"
property, following the convention demonstrated/used in
W32APIOptions.DEFAULT.

The definitions in LMShare are defined as pure UNICODE.

Closes: #668
  • Loading branch information
matthiasblaesing committed Aug 2, 2016
1 parent c3cb85a commit ab84488
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 45 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
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
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
13 changes: 7 additions & 6 deletions contrib/platform/src/com/sun/jna/platform/win32/Winnetwk.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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

/**
* Ported from AccCtrl.h. Microsoft Windows SDK 7.1
Expand Down Expand Up @@ -346,11 +347,11 @@ public ByReference(Pointer memory) {
public String lpProvider;

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

public NETRESOURCE(Pointer address) {
super(address);
super(address, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
read();
}

Expand Down Expand Up @@ -391,11 +392,11 @@ public ByReference(Pointer memory) {
public String lpUniversalName;

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

public UNIVERSAL_NAME_INFO(Pointer address) {
super(address);
super(address, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
read();
}

Expand Down Expand Up @@ -444,11 +445,11 @@ public ByReference(Pointer memory) {
public String lpRemainingPath;

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

public REMOTE_NAME_INFO(Pointer address) {
super(address);
super(address, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
read();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.TypeMapper;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.win32.W32APITypeMapper;

Expand Down
Loading

0 comments on commit ab84488

Please sign in to comment.