c# - How do you de-elevate privileges for a child process -
I know how a process can be started with a process with administrator privileges:
proc .StartInfo.UseShellExecute = True; Proc.StartInfo.Verb = "runas";
Where proc is a system. Diagnostics Process but how does it contribute?
If your process has already advanced, how can you start a new process without administration rights? More precisely, we need to launch the new process with the same permission level as the Windows Explorer, so if no UAC is not inactive, but if UAC is enabled, but our process is getting high, then we have a certain operation There is a need to do that is not immutable because we are building a virtual drive and if it is built with high permissions and Windows A Explorer running unchanged it will not be displayed.
Feel free to change the title, I can not come up with a good description.
The solution is for you to use the EXPLORER.exe process.
The idea of running this process in the UN-elevator mode using the file explorer process of explorer.exe
() windows. It is said that the project that we want to launch is on $ TEMP \ MyUnElevatedProcess.exe
.
Therefore, for the NSIC code, I will just write: (but can be played in any language)
Exec '"$ WINDIR \ explorer.exe" $ TEMP \ MyUnElevatedProcess.exe "'
Example code ( Installer using NSIS )
Exec' $ WINDIR \ explorer.exe "" $ TEMP \ MyUnElevatedProcess.exe "'
*** Code
Comments
Post a Comment