The solution really depends on your needs and can be quite complicated (thanks in full to Windows Vista). This will probably be beyond your needs, but it will help others who find this page through a search.
1:
Windows Vista - 0. 0, 0. 1. (pre Vista) 0.
. 0 .
1), . 0.
:
LogonUser, ExpandEnvironmentStringsForUser, GetLogonSID, LoadUserProfile, CreateEnvironmentBlock, CreateProcessAsUser.
Google
2: , , , : WTSEnumerateSessions WTSQuerySessionInformation, , WTSQueryUserToken, . API- CreateProcessAsUser Win32.
, / . , , .
WTSGetActiveConsoleSessionId.
3:
, # 1, , STARTUPINFO lpDesktop. winsta0\Default. OpenDesktop Win32 API, , CreateDesktop. SetSecurityInfo SE_WINDOW_OBJECT GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION.
, , , .
4:
, , . , , . , , . , , , , ExecutionLevel = "requireAdministrator"
:
- SetTokenInformation TokenSessionId
- .
- , Vista .