Vista?这个好像得修改manifest中的xml配置,不过不知道用程序方式进行切换,可到MSFT查下.

解决方案 »

  1.   

    没太说详细。可以加Restricted Token,看看这个:http://weblogs.asp.net/kennykerr/archive/2006/09/29/Windows-Vista-for-Developers-_1320_-Part-4-_1320_-User-Account-Control.aspx
      

  2.   

    One of our modules is an executable that will always be run as administrator (after getting permission from user). One of its screens allows the user to run a different executable, which the code currently does by CreateProcess. The problem is that since the first process is running as admin, CreateProcess has the second process run as admin also. This is undesirable because it is a security breach (the second process can open browse dialogs that should not have admin privileges in this scenario). How do I get the second to run without admin privileges? I do NOT want attach a manifest to the second exe that says it does not want admin privileges because under certain circumstances (not from the first exe), it SHOULD be run with admin privileges. I would have expected CreateProcess to allow control over the privileges to be given to the child process, but can not find any documentation for this. Help! 
      

  3.   

    Well in that case CreateProcessAsUser is the exact API you want to use. By passing in a restricted token, you can limit the privilege of your spawn process. You can almost copy the code from the URL I gave above.