I need to spawn a process which need to invoke UAC. I have read this post: How can I run a child process that requires elevation and wait?.
Unfortunatelly I can't run a process as a real child. The new process run as a separate and continue to run even after spawner close. But I need it to close automatically when parent exits (normal exit or by crash or any other reason).
One of the solution that were provided is to use jobs for that. Unfortunately I can't assign a process created with ShellExecuteEx
to a job. It returns me an error ERROR_ACCESS_DENIED
. To handle this I have to pass CREATE_BREAKAWAY_FROM_JOB
to CreateProcess
. And this is the closed circle. I have to use ShellExecuteEx
but not CreateProcess
.