title: How to use NtOpenProcess
body: <p>I am trying to use <code>NtOpenProcess()</code> I have not find any example in town.</p>
  
  <p>I am getting an error any help is much appreciated.</p>
  
  <pre><code>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR szCmdLine, int showCmd)
  {
      HANDLE handle;
      HWND myWindow =FindWindow(NULL, L"Notepad");
      PCLIENT_ID PID;
      GetWindowThreadProcessId(myWindow, (LPDWORD)&amp;PID);
      ZwOpenProcess(&amp;handle, PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, NULL,PID);
      return 0;
  }
  </code></pre>
  
  <p>The errors are</p>
  
  <pre><code>1&gt;c:\users\asus\source\repos\windowsproject2\windowsproject2\windowsproject2.cpp(14): error C2065: 'PCLIENT_ID': undeclared identifier
  1&gt;c:\users\asus\source\repos\windowsproject2\windowsproject2\windowsproject2.cpp(14): error C2146: syntax error: missing ')' before identifier 'PID'
  1&gt;c:\users\asus\source\repos\windowsproject2\windowsproject2\windowsproject2.cpp(14): error C3861: 'NtOpenProcess': identifier not found
  1&gt;c:\users\asus\source\repos\windowsproject2\windowsproject2\windowsproject2.cpp(14): error C2146: syntax error: missing ';' before identifier 'PID'
  1&gt;c:\users\asus\source\repos\windowsproject2\windowsproject2\windowsproject2.cpp(14): error C2059: syntax error: ')'
  </code></pre>
  
  <p>This are my include files.</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  #include &lt;ntddk.h&gt;
  #include &lt;Ntifs.h&gt;
  #include "stdafx.h"
  </code></pre>