Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>#include &lt;cstdio&gt; #include &lt;windows.h&gt; #include &lt;tlhelp32.h&gt; int main( int, char *[] ) { PROCESSENTRY32 entry; entry.dwSize = sizeof(PROCESSENTRY32); HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); if (Process32First(snapshot, &amp;entry) == TRUE) { while (Process32Next(snapshot, &amp;entry) == TRUE) { if (stricmp(entry.szExeFile, "target.exe") == 0) { HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID); // Do stuff.. CloseHandle(hProcess); } } } CloseHandle(snapshot); return 0; } </code></pre> <p>Also, if you'd like to use PROCESS_ALL_ACCESS in OpenProcess, you could try this:</p> <pre><code>#include &lt;cstdio&gt; #include &lt;windows.h&gt; #include &lt;tlhelp32.h&gt; void EnableDebugPriv() { HANDLE hToken; LUID luid; TOKEN_PRIVILEGES tkp; OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &amp;hToken); LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &amp;luid); tkp.PrivilegeCount = 1; tkp.Privileges[0].Luid = luid; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken, false, &amp;tkp, sizeof(tkp), NULL, NULL); CloseHandle(hToken); } int main( int, char *[] ) { EnableDebugPriv(); PROCESSENTRY32 entry; entry.dwSize = sizeof(PROCESSENTRY32); HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); if (Process32First(snapshot, &amp;entry) == TRUE) { while (Process32Next(snapshot, &amp;entry) == TRUE) { if (stricmp(entry.szExeFile, "target.exe") == 0) { HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID); // Do stuff.. CloseHandle(hProcess); } } } CloseHandle(snapshot); return 0; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload