[Solved] How to elevate privileges for child process


OK, this shouldn’t actually be too hard, provided that UAC is configured with the default settings.

I believe that the reason CreateProcessWithLogonW() is failing is that the target executable requires elevation. If you instead run an executable that is not configured to require elevation, it should work.

At that point, you are running in the context of a limited token belonging to an administrative user. If you then attempt to launch an elevated process, e.g., using ShellExecute(), you will still get a UAC dialog – but it will be a yes/no dialog; the user will not need to enter the password.

2

solved How to elevate privileges for child process