Privilege Exaltation only when and if required

My application only occasionally requires privilege escalation ... I need to refer to some third-party COM components that only work correctly when run as an administrator.

I want my application to request privilege escalation only when it needs it ... As a rule, I do not want my application to run as an administrator if I do not need to use third-party COM components.

I see that CoCreateAsAdmin can potentially solve the problem, but the author of the component does not install the necessary registry entries, and I'm not sure how to use CoCreateAsAdmin in C # and in combination with the Runtime-Callable-Wrapper, which is created by tlbimp.

Another solution would be to create a different process, but I still have no experience with this ... I do not want to create a completely separate application ... I would be happy to create an assembly that works in a split if someone can show me how to force its work.

Thank...

+3
source share
2 answers

Process privileges are based on the token of the user who works in the process, which is assigned only when the process starts. Therefore, there is no way to enhance your process after it starts. The only reliable way to get up at runtime is to create a new process.

, . Process , COM-. , .exe, , , , .

+3

Source: https://habr.com/ru/post/1750560/


All Articles