【发布时间】:2010-03-26 08:39:23
【问题描述】:
这是多年来在 Windows XP 上运行良好的代码。用户不是本地管理员。
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_ProcessStopTrace");
ConnectionOptions co = new ConnectionOptions();
co.EnablePrivileges = true;
ManagementEventWatcher watcher = new ManagementEventWatcher(new ManagementScope(@"root\cimv2",co), query);
watcher.EventArrived += StopEventArrived;
watcher.Start();
这会在 Windows 7 上引发 SecurityException,以非管理员身份运行时拒绝访问。在 XP 上,无需管理员即可正常工作。
在此link MS 上声明“Windows 7:低完整性用户对本地 WMI 操作具有只读权限。”。我想这就是问题所在。
但我找不到任何关于如何改变它的线索。
【问题讨论】:
-
我添加了 ""co.EnablePrivileges = true; Windows 7 的一部分,但无济于事。 XP没有那个