发起一个进程,提升或非提升模式 [英] Launch a process with elevated or non-elevated mode

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

问题描述

我检查Vista的电梯源代码在 http://www.codeproject.com /KB/vista-security/VistaElevator.aspx 但它在C ++。任何人有在C#源代码。谢谢

I check Vista Elevator source code on http://www.codeproject.com/KB/vista-security/VistaElevator.aspx but it's in C++. Anyone has it in C# source code. Thanks.

我有一个很大的问题:
如何未提升的过程中就可以开始提升的过程。
和如何提升的过程可以启动非提升的过程。

I have a big problem: How a non-elevated process can start an elevated process. And how an elevated process can start an non-elevated process.

感谢。

推荐答案

据链接的网页,

如果未提升的过程中需要启动高架之一,所有它做的是调用的ShellExecuteEx()API,并提供了运行方式动词作为其参数之一。

If a non-elevated process needs to start an elevated one, all it has to do is call the ShellExecuteEx() API and supply the "runas" verb as one of its parameters.

因此,所有你在C#中需要的是:

So all you need in C# is:

  • Process.Start Method
  • ProcessStartInfo Class
  • ProcessStartInfo.Verb Property

这篇关于发起一个进程,提升或非提升模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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