I have a nifty Shell system that I am getting ready to put into the CodeBank but I have one question that I can't find an answer to.

I use CreateProcess for most of the shelling options but since CreateProcess doesn't deal with UAC's it cannot be used to elevate for shelling with Administrative rights. So I use ShellExecuteEx when I need to raise privilege to run as an administrator. All of that works fine except when I use ShellExecuteEx I can't communicate with the shelled-to process when its rights are elevated. Normally when I use ShellExecuteEx I can get a handle to the process using hProcess which is in the UDT ShellExecuteInfo but whenever I tell ShellExecuteEx to raise privilege the variable hProcess always returns 0 so I don't get a handle. I have read in several places that this is intentional so that normal processes can't communicate with elevated processes. I can't find that definitively anywhere though and I am hoping someone on the forum has successfully dealt with this.

Mainly what this does is it prevents me from doing a wait until execution is complete before returning control to the shelling program. I can do that fine with CreateProcess and I can do it with ShellExecuteEx as long as there is no elevation.

Can anyone steer me in the right direction to deal with this? I can think of several workarounds but they get pretty messy quickly.