【发布时间】:2014-12-03 09:50:17
【问题描述】:
我正在使用 JNA 读取 Windows 事件日志,如下所示:
EventLogIterator iterator = new EventLogIterator("Security");
while (iterator.hasNext()) {
EventLogRecord curRecord = iterator.next();
}
但是抛出异常(Application等其他通道读取成功):
Exception in thread "main" com.sun.jna.platform.win32.Win32Exception: A required privilege is not held by the client.
at com.sun.jna.platform.win32.Advapi32Util$EventLogIterator.<init>(Advapi32Util.java:1929)
at com.sun.jna.platform.win32.Advapi32Util$EventLogIterator.<init>(Advapi32Util.java:1922)
at com.emc.windowsagent.EventLogReader.getEventsByIterator(EventLogReader.java:155)
at com.emc.windowsagent.WindowsAgentMain.main(WindowsAgentMain.java:17)
有没有办法获得读取安全事件的权限?
【问题讨论】:
-
取决于范围:使用管理员用户运行它?
-
我还没试过那个。尽管如此,我还是希望每个用户都能访问安全事件。
-
Windows 安全问题是否比 Java 安全问题更大,即使它是 JNI?