gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 14:20:19 25 4
gpt4 key购买 nike

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

EventLogIterator iterator = new EventLogIterator("Security");
while (iterator.hasNext()) {
EventLogRecord curRecord = iterator.next();
}

但是抛出异常(其他 channel 如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)

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

最佳答案

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

关于java - 如何使用 JNA 读取 Windows 安全事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27268405/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com