Vista 上的 DeleteIpForwardEntry 访问被拒绝
调用DeleteIpForwardEntry() 在Windows XP 和Windows 7 上工作得非常好。但是,在Windows Vista 上,它会失败并显示ERROR_ACCESS_DENIED。
该文档称“用户在本地计算机上缺乏所需的管理权限,或者应用程序没有作为内置管理员(RunAs 管理员)在增强的 shell 中运行。”
好吧,在我的例子中,用户是本地计算机上的管理员,应用程序是通过 SOFTWARE\Microsoft\Windows\CurrentVersion\Run 登录时运行的,所以我不能真正告诉它在“增强的 shell”中运行。
有没有办法解决 Vista 中的“第 22 条军规”问题?
Calling DeleteIpForwardEntry() works perfectly well on Windows XP and Windows 7. On Windows Vista, however, it fails with ERROR_ACCESS_DENIED.
The documentation says that "the user lacks the required administrative privileges on the local computer or the application is not running in an enhanced shell as the built-in Administrator (RunAs administrator)."
Well, in my case the user is the Administrator on the local computer and the application is run on logon via SOFTWARE\Microsoft\Windows\CurrentVersion\Run so I can't really tell it to run in an "enhanced shell".
Is there a way to solve this "Catch 22" situation in Vista?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不明白为什么这会在 Windows 7 上工作。文档表明失败将是相同的。
此外,您的帖子表明登录用户是管理员。您的 Windows 7 和 Windows Vista 测试是否有可能针对不同的用户 - 在 Windows 7 上您的测试用户是管理员,在 Windows Vista 计算机上测试用户不是?
没有办法解决以这种方式运行应用程序的问题。您能否将其重新实现为在管理员帐户中运行的 Windows 服务,该服务作用于计算机上的交互式登录事件以根据需要操作 IP 配置?
I don't understand why this would work on Windows 7. The docs indicate the failure will be the same.
Also, your post indicates the logged on user is an Administrator. Is it possible that your Windows 7 and Windows Vista tests are for different users - on Windows 7 your test user is an admin, on Windows Vista machine the test user is not?
There's no way to work around this running the app in that way. Can you re-implement this as a Windows Service running in an admin account, which acts on interactive logon events on the machine to manipulate the IP configuration as needed?