Browse Source

Merge b8d5799d01 into 43e1173e30

pull/991/merge
idconsultants GitHub 6 months ago
parent
commit
77c27cbdd2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 2 deletions
  1. +13
    -2
      common/JackTools.cpp

+ 13
- 2
common/JackTools.cpp View File

@@ -69,8 +69,19 @@ namespace Jack {
int JackTools::GetUID() int JackTools::GetUID()
{ {
#ifdef WIN32 #ifdef WIN32
return _getpid();
//#error "No getuid function available"
HANDLE tokenHandle = nullptr;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &tokenHandle)) {
return 0;
}

TOKEN_STATISTICS tokenStats;
DWORD returnLength;
if (!GetTokenInformation(tokenHandle, TokenStatistics, &tokenStats, sizeof(tokenStats), &returnLength)) {
CloseHandle(tokenHandle);
return 0;
}

return(tokenStats.AuthenticationId.LowPart);
#else #else
return geteuid(); return geteuid();
#endif #endif


Loading…
Cancel
Save