How do you deal with UAC when creating a process as a different user?

Posted by sysrpl on Stack Overflow See other posts from Stack Overflow or by sysrpl
Published on 2010-03-26T13:32:22Z Indexed on 2010/03/29 18:43 UTC
Read the original article Hit count: 487

Filed under:

I am having an issue with UAC and executing a non interactive process as a different user (APIs such as CreateProcessAsUser or CreateProcessWithLogonW).

My program is intended to do the following:

1) Create a new windows user account (check, works correctly)

2) Create a non interactive child process as new user account (fails when UAC is enabled)

My application includes a administrator manifest, and elevates correct when UAC is enabled in order to complete step 1.

But step 2 is failing to execute correctly. I suspect this is because the child process which executes as another user is not inheriting the elevated rights of my main process (which executes as the interactive user).

I would like to know how to resolve this issue. When UAC is off my program works correctly. How can I deal with UAC or required elevated rights in this situation?

If it helps any, the child process needs to run as another user in order to setup file encryption for the new user account.

© Stack Overflow or respective owner

Related posts about uac