diff --git a/CHANGES.md b/CHANGES.md index 112c607bd3..19cdf50b3e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Next release (5.4.0) Features -------- +* [#1105](https://github.com/java-native-access/jna/issues/1105): Deprecate `c.s.j.p.win32.Advapi32Util#getEventId` in favor of `#getInstanceId` - [@dbwiddis](https://github.com/dbwiddis). * [#1097](https://github.com/java-native-access/jna/issues/1097): Allow `.ocx` as extension of native libraries on windows - [@dmigowski](https://github.com/dmigowski). Bug Fixes diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java b/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java index 031c46802e..f4d650f3ca 100755 --- a/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java @@ -55,6 +55,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; @@ -92,7 +93,6 @@ import com.sun.jna.ptr.LongByReference; import com.sun.jna.ptr.PointerByReference; import com.sun.jna.win32.W32APITypeMapper; -import java.util.List; /** * Advapi32 utility API. @@ -2342,10 +2342,23 @@ public EVENTLOGRECORD getRecord() { } /** - * Event Id. + * The Instance ID, a resource identifier that corresponds to a string + * definition in the message resource file of the event source. The + * Event ID is the Instance ID with the top two bits masked off. * - * @return Integer. + * @return An integer representing the 32-bit Instance ID. + */ + public int getInstanceId() { + return _record.EventID.intValue(); + } + + /** + * @deprecated As of 5.4.0, replaced by {@link #getInstanceId()}. The + * Event ID displayed in the Windows Event Viewer + * corresponds to {@link #getStatusCode()} for + * system-generated events. */ + @Deprecated public int getEventId() { return _record.EventID.intValue(); } @@ -2360,9 +2373,11 @@ public String getSource() { } /** - * Status code for the facility, part of the Event ID. + * Status code, the rightmost 16 bits of the Instance ID. Corresponds to + * the Event ID field in the Windows Event Viewer for system-generated + * events. * - * @return Status code. + * @return An integer representing the low 16-bits of the Instance ID. */ public int getStatusCode() { return _record.EventID.intValue() & 0xFFFF;