How can I get the current user token for the physical session?
问题 I have some code, with which I'm trying to get the current session user token: #include <Wtsapi32.h> DWORD activeSessionId = WTSGetActiveConsoleSessionId(); HANDLE currentToken; BOOL queryRet = WTSQueryUserToken(activeSessionId, ¤tToken); if (!queryRet) { DWORD err = GetLastError(); return 0; } Value of err is 1314. Update 1 No luck so far, tried to grant the current process SE_TCB_NAME - but still get same error from WTSQueryUserToken (1314). HANDLE process = GetCurrentProcess();