wtsapi32

How can I get the current user token for the physical session?

南笙酒味 提交于 2019-12-01 03:47:00
问题 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, &currentToken); 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();