Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving session ID

Status
Not open for further replies.

Bertv100

Programmer
Apr 27, 2000
204
BE
Hi,

I'm trying to retrieve the session ID of a process. More specifically, a printer driver process; and the session ID I need is the one in which the user who submitted the print job is working.

In Windows XP, I use the user's security token to let SYSTEM impersonate as that user, call GetCurrentProcessId and convert the process ID to a session ID using ProcessIdToSessionId.

My problem lies with Vindows Vista: here, the driver runs as user LOCAL SERVICE and ProcessIdToSessionId fails with error 5, E_ACCESSDENIED.

Does anyone know how I can get the process to session ID conversion working in Vista?

If you need more information about what I'm trying to do, please ask.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
 
Found a solution.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top