Is it possible to UAC elevate a process without starting another process

僤鯓⒐⒋嵵緔 提交于 2019-12-04 18:12:58

问题


I was wondering if it is possible for a program to prompt the user with a UAC prompt to raise it's own privileges without starting another process.

All the examples I can find on the internet seem to ShellExecute "runas" which creates a new process with elevated privileges.

If this is not possible then my best solution I guess would be create a named pipe, ShellExecute my own program with a special argument, and then shove all the data that it will need to perform the operation down the pipe. If there are any better suggestions then this I would be glad to hear them.

Thanks for any input.


回答1:


No, you can't elevate an existing process. You're right - you have start a new elevated process and get that to do the work for you.




回答2:


One other possible answer (which ends up being essentially the same answer) is to have a service which runs as LocalSystem that does the elevated work for you.



来源:https://stackoverflow.com/questions/1032021/is-it-possible-to-uac-elevate-a-process-without-starting-another-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!