I have a sample using CreateProcessWithLogonW (attached).
The problems I am having are:
1. it hangs when trying to read output
2. I need to be able to capture both stderr and stdout - and it seems that stderr comes on the stdout handle?
3. it needs to be able to hide the application it starts (don't know if this works - needs to be verified)
4. I need to be able to read output from an x86 process when this starter process is running as x64 (this probably works - needs to be verified)
I am also attaching a project that writes to both stdout and stderr that could be used for testing.
I guess there are something wrong with the pinvoke definitions.