No navigation frame on the left?  Click here.

CreateProcessAsUser

 

One of the little problems that crop up more often than I'd ever have guessed is this: Given a service, launch a GUI program under another user account and give it access to the interactive desktop.

The steps this involves are roughly:

bulletLogonUser(), or get an impersonation token and DuplicateTokenEx() to get a primary token
bulletLocate the interactive window station, add the user to its DACL
bulletSame for the default desktop in that window station
bulletCall CreateProcessAsUser()

lu_cpau_gui.cpp, 14 KB