Vault 7: CIA Hacking Tools Revealed
![](/https/wikileaks.org/ciav7p1/logo.png)
Navigation: » Directory » Knowledge Base
Code Sample
HANDLE
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if(hProcessSnap != INVALID_HANDLE_VALUE)
{
THREADENTRY32 te32;
te32.dwSize = sizeof(THREADENTRY32);
if(Thread32First(hProcessSnap, &te32))
{
do
{
if(te32.th32OwnerProcessID == iPid)
{
HANDLE hThread = OpenThread(MAXIMUM_ALLOWED, FALSE, te32.th32ThreadID);
if(hThread)
{
MessageBox(NULL, L"Found Thread ", L"INFO", MB_OK);
pSetInfoToken(hTokenDup, TokenPrivileges, NULL, 0);
//pSetInfoThread(hThread, ThreadImpersonationToken, &hTokenDup, sizeof(hTokenDup));
/*if(!SetThreadToken(&hThread, hTokenDup))
{
WCHAR wcDum[MAX_PATH] = {0};
wsprintf(wcDum, L"Failed to set thread token: %d", GetLastError());
MessageBox(NULL, wcDum, L"INFO", MB_OK);
}
*/
CloseHandle(hThread);
}
}
}
while(Thread32Next(hProcessSnap, &te32));
}
CloseHandle(hProcessSnap);
}
Test adding a section of code