pSIDTokenUser = reinterpret_cast<PTOKEN_USER>(new BYTE[dwReturnLength]);
memset(pSIDTokenUser, 0, dwReturnLength);
- if (!pSIDTokenUser) {
- if (debug)
- wcout << L"Could not recieve token, skiping" << endl;
- continue;
- }
-
if (debug)
- wcout << L"Recieved token, saving information" << endl;
+ wcout << L"Received token, saving information" << endl;
//write Info in pSIDTokenUser
if (!GetTokenInformation(hToken, TokenUser, pSIDTokenUser, dwReturnLength, NULL))
AcctName = reinterpret_cast<LPWSTR>(new WCHAR[dwAcctName]);
DomainName = reinterpret_cast<LPWSTR>(new WCHAR[dwDomainName]);
- if (!AcctName || !DomainName)
- continue;
-
if (!LookupAccountSid(NULL, pSIDTokenUser->User.Sid, AcctName,
(LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName, &sidNameUse))
continue;
delete[] reinterpret_cast<LPWSTR>(DomainName);
} while (Process32Next(hProcessSnap, &pe32));
-
die:
if (hProcessSnap)
if (pSIDTokenUser)
delete[] reinterpret_cast<PTOKEN_USER>(pSIDTokenUser);
return numProcs;
-}
\ No newline at end of file
+}