WinAPI C - RunAsUser from REDMON_USER and REDMON_SESSIONID
- by scriptmaster
I installed a PostScript printer driver and have setup REDMON (redmonnt.dll) for redirecting postscript output to my program. In my rather simple c program I capture the data from STDIN and I am able to successfully save it into a .ps file. The file looks OK.
However, I want to start gsview.exe for viewing the file. If I call ShellExecute it fails in Windows 7 because of permission issues. It seems that my program is called under a different user account (LOCAL SERVICE). So I am looking for a way to run gsview.exe under a specific username (the user who initiated the print job is available to me in a variable as REDMON_USER along with the SESSIONID as well.
I am stuck (and my stack is overflowing =) What are the minimum WinAPI call I need to use to launch a program given a username and a sessionid?
Any code examples in C/C++, .NET would be very helpful