Creating a Windows Session Programmatically

I have a service running in a windows services session (0). After connecting to the client, I need to create a new Windows session for the given user credentials, register this user and run the application in this new session.

Is there a way to programmatically create a user session for given user credentials?

+4
source share
1 answer

AFAIK, you cannot program sessions. To do this, the client must connect to the device using Terminal Services or Remote Desktop. However, you can program the login to the user account and impersonate it if you just need to start the process as this user without making it visible on the screen. See LogonUser() and ImpersonateLoggedOnUser() , CreateProcessAsUser() or CreateProcessWithLogonW() .

+5
source

Source: https://habr.com/ru/post/1444782/


All Articles