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

Force read of processorArchitecture member of SYSTEM_INFO union #1134

Merged
merged 2 commits into from
Sep 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Bug Fixes
* [#1127](https://github.com/java-native-access/jna/issues/1127): Windows needs a wide string in `c.s.j.p.win32.COM.IShellFolder#ParseDisplayName` - [@dbwiddis](https://github.com/dbwiddis).
* [#1128](https://github.com/java-native-access/jna/issues/1128): KEY_ALL_ACCESS value is incorrect in `c.s.j.p.win32.WinNT.java` - [@trevormaggs](https://github.com/trevormaggs).
* [#1133](https://github.com/java-native-access/jna/issues/1133): Ensure JARs created from the build system don't contain invalid `Info-ZIP Unicode Path` extra info - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#1134](https://github.com/java-native-access/jna/issues/1134): Read correct member of `WinBase.SYSTEM_INFO.processorArchitecture` union - [@dbwiddis](https://github.com/dbwiddis).

Release 5.4.0
=============
Expand Down
8 changes: 8 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 @@ -1226,6 +1226,14 @@ public static class ByReference extends UNION implements Structure.ByReference {
* Architecture-dependent processor revision.
*/
public WORD wProcessorRevision;

// the dwOemID union member is obsolete. Force read of pi instead.
@Override
public void read() {
super.read();
processorArchitecture.setType(PI.class);
processorArchitecture.read();
dbwiddis marked this conversation as resolved.
Show resolved Hide resolved
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ public void testGetSystemInfo() {
SYSTEM_INFO lpSystemInfo = new SYSTEM_INFO();
Kernel32.INSTANCE.GetSystemInfo(lpSystemInfo);
assertTrue(lpSystemInfo.dwNumberOfProcessors.intValue() > 0);
// the dwOemID member is obsolete, but gets a value.
// the pi member is a structure and isn't read by default
assertEquals(lpSystemInfo.processorArchitecture.dwOemID.getLow(),
lpSystemInfo.processorArchitecture.pi.wProcessorArchitecture);
}

public void testGetSystemTimes() {
Expand Down