Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Call <a href="http://msdn.microsoft.com/en-us/library/ms684320%28VS.85%29.aspx" rel="noreferrer"><code>OpenProcess</code></a> to get a handle to the process associated with your PID. Once you have a handle to the process, call <a href="http://msdn.microsoft.com/en-us/library/ms683198%28VS.85%29.aspx" rel="noreferrer"><code>GetModuleFileNameEx</code></a> to get its fully-qualified path. Don't forget to call <a href="http://msdn.microsoft.com/en-us/library/ms724211%28VS.85%29.aspx" rel="noreferrer"><code>CloseHandle</code></a> when you're finished using the process handle.</p> <p>Here's a sample program that performs the required calls (replace 1234 with your PID):</p> <pre><code>#include &lt;windows.h&gt; #include &lt;psapi.h&gt; // For access to GetModuleFileNameEx #include &lt;tchar.h&gt; #include &lt;iostream&gt; using namespace std; #ifdef _UNICODE #define tcout wcout #define tcerr wcerr #else #define tcout cout #define tcerr cerr #endif int _tmain(int argc, TCHAR * argv[]) { HANDLE processHandle = NULL; TCHAR filename[MAX_PATH]; processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, 1234); if (processHandle != NULL) { if (GetModuleFileNameEx(processHandle, NULL, filename, MAX_PATH) == 0) { tcerr &lt;&lt; "Failed to get module filename." &lt;&lt; endl; } else { tcout &lt;&lt; "Module filename is: " &lt;&lt; filename &lt;&lt; endl; } CloseHandle(processHandle); } else { tcerr &lt;&lt; "Failed to open process." &lt;&lt; endl; } return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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