Create Windows session programmatically

前端 未结 2 1497
醉梦人生
醉梦人生 2021-02-09 02:30

I have a service running in the Windows services (0) session. Upon connection from a client I need to create a new Windows session for given user credentials, log in that user a

2条回答
  •  有刺的猬
    2021-02-09 02:42

    AFAIK, you cannot create sessions programmably. The client would have to connect to the machine using Terminal Services or Remote Desktop for that. You can, however, programmably log in to a user account and impersonate it if you just need to run a process as that user without making it visible to the screen. Look at LogonUser() and ImpersonateLoggedOnUser(), CreateProcessAsUser(), or CreateProcessWithLogonW().

提交回复
热议问题