提升进程权限无效 [英] Elevating process privilege not working

查看:54
本文介绍了提升进程权限无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码有什么问题?

What is wrong with the following code?

ProcessStartInfo startInfo = default(ProcessStartInfo);

     startInfo = new ProcessStartInfo(SetupProgramPath)
     {
         UseShellExecute = true,
         Verb = "runas",
         WindowStyle = ProcessWindowStyle.Normal,
         CreateNoWindow = false
     };

     Process.Start(startInfo);



预计会提示输入凭据,但不显示任何内容。系统启用了UAC,不应该更改。

我很感谢你在这个方面的帮助。提前谢谢。



我尝试过:



有尝试设置


It is expected to prompt for credentials but nothing shows up. The system has the UAC enabled and not supposed to be changed.
I appreciate your help in this one. Thank you in advance.

What I have tried:

Have tried setting

UseShellExecute = False

此外,尝试删除WindowStyle和CreateNoWindow

Also, tried removing WindowStyle and CreateNoWindow

推荐答案

子进程继承了环境启动它的过程。如果您发布的此代码已作为管理员运行,则您启动的子进程将继承该代码。没有必要要求权限,因为它已经拥有它们。



现在,运行此代码的帐户......在执行此代码时,是计算机上管理员组中的帐户或管理员组中的组中的帐户?或者这是一个普通的用户帐户,而不是管理员组?
A child process inherits the environment of the process that launched it. If this code you posted is being run as an administrator already the child process you launch will inherit it. There would be no need to ask for permissions because it already has them.

Now, the account running this code ... at the time this code is executed, is the account in the administrators group on the machine or in a group that is in the administrators group? Or is this a normal user account, not in the administrators group?


这篇关于提升进程权限无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆