Windows 7上的特权提升

编程入门 行业动态 更新时间:2024-10-12 03:16:21
本文介绍了Windows 7上的特权提升的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在Windows 7上以编程方式获取特权提升. 实际上,我想以编程方式编辑主机文件,但它给路径提供了错误访问被拒绝.

How to get Elevated Privileges on windows 7 programatically. Actually i want to edit hosts file programatically but it gives error Access Denied to path.

推荐答案

您不能-不仅如此.如果可以的话,那会破坏目的,不是吗?! 首选方法是为您的应用程序创建一个清单文件集,以设置为requireAdministrator- stackoverflow. com/questions/4084585/how-to-embed-a-manifest-file-at-compile-time-in-visual-studio-2010 [ ^ ] stackoverflow. com/questions/2818179/how-to-force-my-net-app-to-run-as-administrator-on-windows-7 [ ^ ] 否则,您仍然需要执行某种模拟,这将导致一个对话框来检索执行模拟所用的用户名\密码凭据,这实际上就是您对清单所做的事情. You can''t - not just like that. If you could, it would kind of defeat the purpose wouldn''t it?! The preferred way is to create a manifest file set to requireAdministrator for your application - stackoverflow/questions/4084585/how-to-embed-a-manifest-file-at-compile-time-in-visual-studio-2010[^] stackoverflow/questions/2818179/how-to-force-my-net-app-to-run-as-administrator-on-windows-7[^] Otherwise, you''d still need to perform some sort of imperstonation, which would result in a dialog to retrieve user name \ password credentials with which to perform the impersonation, which is essentially what you''re doing with the manifest.

更多推荐

Windows 7上的特权提升

本文发布于:2023-11-02 09:52:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552063.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:特权   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!