WinAPI C - RunAsUser from REDMON_USER and REDMON_SESSIONID

Posted by scriptmaster on Stack Overflow See other posts from Stack Overflow or by scriptmaster
Published on 2010-05-25T18:45:27Z Indexed on 2010/05/26 6:41 UTC
Read the original article Hit count: 420

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about c++

Related posts about c