MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / CanGetSessionIdOk

Function CanGetSessionIdOk

libcppcryptfs/util/util.cpp:905–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

903}
904
905bool CanGetSessionIdOk()
906{
907 DWORD sessionid1 = 0;
908 DWORD sessionid2 = 0;
909
910 // using GetCurrentProcessToken() fails on some systems
911 HANDLE h = OpenTokenForCurrentProcess();
912 if (h == NULL)
913 return false;
914 const bool got1ok = GetSessionIdFromToken(h, sessionid1);
915 CloseHandle(h);
916 if (!got1ok)
917 return false;
918
919 const bool got2ok = ProcessIdToSessionId(GetCurrentProcessId(), &sessionid2);
920
921 return got2ok && sessionid1 == sessionid2;
922}

Callers 1

MountMethod · 0.85

Calls 2

GetSessionIdFromTokenFunction · 0.85

Tested by

no test coverage detected