Skip to content

Commit ab84488

Browse files
Correct typemapper used for structures defined
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
1 parent c3cb85a commit ab84488

File tree

12 files changed

+74
-45
lines changed

12 files changed

+74
-45
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Bug Fixes
7676
* [#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)
7777
* [#636](https://github.com/java-native-access/jna/issues/636): Staticly link visual c++ runtime when building with MSVC - [@matthiasblaesing](https://github.com/matthiasblaesing).
7878
* [#624](https://github.com/java-native-access/jna/issues/624): WinDef.DWORD getLow() & getHigh() using incorrect bit mask - [@matthiasblaesing](https://github.com/matthiasblaesing).
79+
* [#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).
7980

8081
Release 4.2.1
8182
=============

contrib/platform/src/com/sun/jna/platform/win32/DsGetDC.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.sun.jna.Structure;
1919
import com.sun.jna.platform.win32.Guid.GUID;
2020
import com.sun.jna.platform.win32.WinNT.PSID;
21+
import com.sun.jna.win32.W32APITypeMapper;
2122

2223
/**
2324
* Ported from DsGetDC.h. Windows SDK 6.0a
@@ -107,11 +108,11 @@ public static class ByReference extends DOMAIN_CONTROLLER_INFO
107108
public String ClientSiteName;
108109

109110
public DOMAIN_CONTROLLER_INFO() {
110-
super();
111+
super(W32APITypeMapper.DEFAULT);
111112
}
112113

113114
public DOMAIN_CONTROLLER_INFO(Pointer memory) {
114-
super(memory);
115+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
115116
read();
116117
}
117118

@@ -235,11 +236,11 @@ protected List<String> getFieldOrder() {
235236
}
236237

237238
public DS_DOMAIN_TRUSTS() {
238-
super();
239+
super(W32APITypeMapper.DEFAULT);
239240
}
240241

241242
public DS_DOMAIN_TRUSTS(Pointer p) {
242-
super(p);
243+
super(p, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
243244
read();
244245
}
245246
};

contrib/platform/src/com/sun/jna/platform/win32/LMAccess.java

+23-22
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.sun.jna.Pointer;
1818
import com.sun.jna.Structure;
1919
import com.sun.jna.platform.win32.WinNT.PSID;
20+
import com.sun.jna.win32.W32APITypeMapper;
2021

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

3334
public LOCALGROUP_INFO_0() {
34-
super();
35+
super(W32APITypeMapper.UNICODE);
3536
}
3637

3738
public LOCALGROUP_INFO_0(Pointer memory) {
38-
super(memory);
39+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
3940
read();
4041
}
4142

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

5455
public LOCALGROUP_INFO_1() {
55-
super();
56+
super(W32APITypeMapper.UNICODE);
5657
}
5758

5859
public LOCALGROUP_INFO_1(Pointer memory) {
59-
super(memory);
60+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
6061
read();
6162
}
6263

@@ -88,11 +89,11 @@ public static class USER_INFO_0 extends Structure {
8889
public String usri0_name;
8990

9091
public USER_INFO_0() {
91-
super();
92+
super(W32APITypeMapper.UNICODE);
9293
}
9394

9495
public USER_INFO_0(Pointer memory) {
95-
super(memory);
96+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
9697
read();
9798
}
9899

@@ -153,11 +154,11 @@ public static class USER_INFO_1 extends Structure {
153154
public String usri1_script_path;
154155

155156
public USER_INFO_1() {
156-
super();
157+
super(W32APITypeMapper.UNICODE);
157158
}
158159

159160
public USER_INFO_1(Pointer memory) {
160-
super(memory);
161+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
161162
read();
162163
}
163164

@@ -232,11 +233,11 @@ public static class USER_INFO_23 extends Structure {
232233
public PSID.ByReference usri23_user_sid;
233234

234235
public USER_INFO_23() {
235-
super();
236+
super(W32APITypeMapper.UNICODE);
236237
}
237238

238239
public USER_INFO_23(Pointer memory) {
239-
useMemory(memory);
240+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
240241
read();
241242
}
242243

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

259260
public GROUP_USERS_INFO_0() {
260-
super();
261+
super(W32APITypeMapper.UNICODE);
261262
}
262263

263264
public GROUP_USERS_INFO_0(Pointer memory) {
264-
super(memory);
265+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
265266
read();
266267
}
267268

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

284285
public LOCALGROUP_USERS_INFO_0() {
285-
super();
286+
super(W32APITypeMapper.UNICODE);
286287
}
287288

288289
public LOCALGROUP_USERS_INFO_0(Pointer memory) {
289-
super(memory);
290+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
290291
read();
291292
}
292293

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

313314
public GROUP_INFO_0() {
314-
super();
315+
super(W32APITypeMapper.UNICODE);
315316
}
316317

317318
public GROUP_INFO_0(Pointer memory) {
318-
super(memory);
319+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
319320
read();
320321
}
321322

@@ -345,11 +346,11 @@ public static class GROUP_INFO_1 extends Structure {
345346
public String grpi1_comment;
346347

347348
public GROUP_INFO_1() {
348-
super();
349+
super(W32APITypeMapper.UNICODE);
349350
}
350351

351352
public GROUP_INFO_1(Pointer memory) {
352-
super(memory);
353+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
353354
read();
354355
}
355356

@@ -390,11 +391,11 @@ public static class GROUP_INFO_2 extends Structure {
390391
public int grpi2_attributes;
391392

392393
public GROUP_INFO_2() {
393-
super();
394+
super(W32APITypeMapper.UNICODE);
394395
}
395396

396397
public GROUP_INFO_2(Pointer memory) {
397-
super(memory);
398+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
398399
read();
399400
}
400401

@@ -435,11 +436,11 @@ public static class GROUP_INFO_3 extends Structure {
435436
public int grpi3_attributes;
436437

437438
public GROUP_INFO_3() {
438-
super();
439+
super(W32APITypeMapper.UNICODE);
439440
}
440441

441442
public GROUP_INFO_3(Pointer memory) {
442-
super(memory);
443+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
443444
read();
444445
}
445446

contrib/platform/src/com/sun/jna/platform/win32/LMShare.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import com.sun.jna.Pointer;
1818
import com.sun.jna.Structure;
19+
import com.sun.jna.win32.W32APITypeMapper;
1920

2021
/**
2122
* Ported from LMShare.h.
@@ -118,11 +119,11 @@ public static class SHARE_INFO_2 extends Structure {
118119
public String shi2_passwd;
119120

120121
public SHARE_INFO_2() {
121-
super();
122+
super(W32APITypeMapper.UNICODE);
122123
}
123124

124125
public SHARE_INFO_2(Pointer memory) {
125-
super(memory);
126+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
126127
read();
127128
}
128129

@@ -202,11 +203,11 @@ public static class SHARE_INFO_502 extends Structure {
202203
public Pointer shi502_security_descriptor;
203204

204205
public SHARE_INFO_502() {
205-
super();
206+
super(W32APITypeMapper.UNICODE);
206207
}
207208

208209
public SHARE_INFO_502(Pointer memory) {
209-
super(memory);
210+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE);
210211
read();
211212
}
212213

contrib/platform/src/com/sun/jna/platform/win32/Sspi.java

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import com.sun.jna.Memory;
1818
import com.sun.jna.Pointer;
1919
import com.sun.jna.Structure;
20+
import com.sun.jna.TypeMapper;
21+
import com.sun.jna.win32.W32APITypeMapper;
2022

2123
/**
2224
* Ported from Sspi.h.
@@ -450,6 +452,10 @@ public static class ByReference extends SecPkgInfo implements Structure.ByRefere
450452
*/
451453
public String Comment;
452454

455+
public SecPkgInfo() {
456+
super(W32APITypeMapper.DEFAULT);
457+
}
458+
453459
@Override
454460
protected List<String> getFieldOrder() {
455461
return FIELDS;

contrib/platform/src/com/sun/jna/platform/win32/WinBase.java

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.sun.jna.platform.win32.WinNT.HANDLE;
2727
import com.sun.jna.ptr.ByteByReference;
2828
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
29+
import com.sun.jna.win32.W32APITypeMapper;
2930

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

431+
public TIME_ZONE_INFORMATION() {
432+
super(W32APITypeMapper.DEFAULT);
433+
}
434+
430435
@Override
431436
protected List<String> getFieldOrder() {
432437
return Arrays.asList(new String[] { "Bias", "StandardName", "StandardDate", "StandardBias", "DaylightName", "DaylightDate", "DaylightBias" });
@@ -902,6 +907,7 @@ protected List<String> getFieldOrder() {
902907
}
903908

904909
public STARTUPINFO() {
910+
super(W32APITypeMapper.DEFAULT);
905911
cb = new DWORD(size());
906912
}
907913
}

contrib/platform/src/com/sun/jna/platform/win32/WinCrypt.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.sun.jna.Pointer;
2020
import com.sun.jna.Structure;
2121
import com.sun.jna.platform.win32.WinDef.HWND;
22+
import com.sun.jna.win32.W32APITypeMapper;
2223

2324
/**
2425
* Ported from WinCrypt.h.
@@ -101,11 +102,11 @@ public static class CRYPTPROTECT_PROMPTSTRUCT extends Structure {
101102
public String szPrompt;
102103

103104
public CRYPTPROTECT_PROMPTSTRUCT() {
104-
super();
105+
super(W32APITypeMapper.DEFAULT);
105106
}
106107

107108
public CRYPTPROTECT_PROMPTSTRUCT(Pointer memory) {
108-
super(memory);
109+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
109110
read();
110111
}
111112

contrib/platform/src/com/sun/jna/platform/win32/WinUser.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.sun.jna.platform.win32.BaseTSD.ULONG_PTR;
2323
import com.sun.jna.platform.win32.WinNT.HANDLE;
2424
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
25+
import com.sun.jna.win32.W32APITypeMapper;
2526

2627
/**
2728
* Ported from WinUser.h Microsoft Windows SDK 6.0A.
@@ -1166,6 +1167,7 @@ public static class ByReference extends WNDCLASSEX implements
11661167
* Instantiates a new wndclassex.
11671168
*/
11681169
public WNDCLASSEX() {
1170+
super(W32APITypeMapper.DEFAULT);
11691171
}
11701172

11711173
/**
@@ -1175,7 +1177,7 @@ public WNDCLASSEX() {
11751177
* the memory
11761178
*/
11771179
public WNDCLASSEX(Pointer memory) {
1178-
super(memory);
1180+
super(memory, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
11791181
read();
11801182
}
11811183

contrib/platform/src/com/sun/jna/platform/win32/Winnetwk.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.sun.jna.Pointer;
2020
import com.sun.jna.Structure;
21+
import com.sun.jna.win32.W32APITypeMapper;
2122

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

348349
public NETRESOURCE() {
349-
super();
350+
super(W32APITypeMapper.DEFAULT);
350351
}
351352

352353
public NETRESOURCE(Pointer address) {
353-
super(address);
354+
super(address, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
354355
read();
355356
}
356357

@@ -391,11 +392,11 @@ public ByReference(Pointer memory) {
391392
public String lpUniversalName;
392393

393394
public UNIVERSAL_NAME_INFO() {
394-
super();
395+
super(W32APITypeMapper.DEFAULT);
395396
}
396397

397398
public UNIVERSAL_NAME_INFO(Pointer address) {
398-
super(address);
399+
super(address, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
399400
read();
400401
}
401402

@@ -444,11 +445,11 @@ public ByReference(Pointer memory) {
444445
public String lpRemainingPath;
445446

446447
public REMOTE_NAME_INFO() {
447-
super();
448+
super(W32APITypeMapper.DEFAULT);
448449
}
449450

450451
public REMOTE_NAME_INFO(Pointer address) {
451-
super(address);
452+
super(address, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT);
452453
read();
453454
}
454455

contrib/platform/src/com/sun/jna/platform/win32/Winsvc.java

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import com.sun.jna.Memory;
1919
import com.sun.jna.Pointer;
2020
import com.sun.jna.Structure;
21-
import com.sun.jna.TypeMapper;
2221
import com.sun.jna.platform.win32.WinNT.HANDLE;
2322
import com.sun.jna.win32.W32APITypeMapper;
2423

0 commit comments

Comments
 (0)