From f77688822de476bd0708c8d84dea838503a1ca04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=A4sing?= Date: Wed, 26 Apr 2017 21:24:41 +0200 Subject: [PATCH] com.sun.jna.platform.win32.WinDef.WORDByReference holds a WORD (16bit) WORD is defined to hold 16 bit on windows, so it needs to be accessed as short (getShort()). Closes: #795 --- CHANGES.md | 1 + contrib/platform/src/com/sun/jna/platform/win32/WinDef.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index e91de118f6..ba676abe2c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,7 @@ Bug Fixes --------- * [#776](https://github.com/java-native-access/jna/issues/776): Do not include ClassPath attribute in MANIFEST.MF of jna-platform. - [@matthiasblaesing](https://github.com/matthiasblaesing). * [#785](https://github.com/java-native-access/jna/issues/785): OaIdlUtil#toPrimitiveArray fails if dimension bounds are not 0-based - [@matthiasblaesing](https://github.com/matthiasblaesing). +* [#795](https://github.com/java-native-access/jna/issues/795): com.sun.jna.platform.win32.WinDef.WORDByReference holds a WORD which is defined to 16 bit on windows, so it needs to be accessed as short (getShort()). Fix suggested by - [@kdeines](https://github.com/kdeines). Release 4.4.0 ============= diff --git a/contrib/platform/src/com/sun/jna/platform/win32/WinDef.java b/contrib/platform/src/com/sun/jna/platform/win32/WinDef.java index 61c10dbffd..7029b85cff 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/WinDef.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/WinDef.java @@ -115,7 +115,7 @@ public void setValue(WORD value) { * @return the value */ public WORD getValue() { - return new WORD(getPointer().getInt(0)); + return new WORD(getPointer().getShort(0)); } }