Skip to content

Commit

Permalink
Deprecate EventLogRecord#getEventId and use #getInstanceId
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwiddis committed Jun 11, 2019
1 parent 65e43fb commit 6514eb1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.EventLogRecord#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
Expand Down
25 changes: 20 additions & 5 deletions contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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();
}
Expand All @@ -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;
Expand Down

0 comments on commit 6514eb1

Please sign in to comment.