我正在使用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)有没有办法获得读取安全事件的权限?
发布于 2015-09-22 15:53:54
以管理员身份运行应用程序。
https://stackoverflow.com/questions/27268405
复制相似问题