首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用JNA读取Windows安全事件?

如何使用JNA读取Windows安全事件?
EN

Stack Overflow用户
提问于 2014-12-03 17:50:18
回答 1查看 574关注 0票数 1

我正在使用JNA读取Windows事件日志,如下所示:

代码语言:javascript
复制
EventLogIterator iterator = new EventLogIterator("Security");
while (iterator.hasNext()) {
    EventLogRecord curRecord = iterator.next();
}

但会抛出一个异常(成功读取Application等其他通道):

代码语言:javascript
复制
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)

有没有办法获得读取安全事件的权限?

EN

回答 1

Stack Overflow用户

发布于 2015-09-22 15:53:54

以管理员身份运行应用程序。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27268405

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档