How can I ask the user for elevated permissions at runtime?

后端 未结 4 1188
小蘑菇
小蘑菇 2020-12-29 15:01

Some applications, started with a regular user will ask for elevated permissions when necessary (e.g. a file manager needs to write such folder), and then carry on with the

4条回答
  •  渐次进展
    2020-12-29 15:34

    See this question on elevating privileges only when required in C# and this article on User Account Control

    To sum it up: one needs to launch a new process with elevated permissions. The elevation level cannot be changed at runtime. Launching with elevated permissions is done either via WinAPI or embedding a correct manifest in the executable.

提交回复
热议问题