title: Library for device drivers
body: <p>I made a library for mapping into a memory address any PE format file, the thing is i did it only user land, using Visual Studio 2013 with standar .lib format. Does this means that my library cant be used inside a device driver? </p>
  
  <p>For example i have the following snippet:</p>
  
  <pre><code>    HMODULE ntdllmod = LoadLibraryA("ntdll.dll");
      if (ntdllmod)
      {
          ZwQueryInformationProcess func = (ZwQueryInformationProcess)GetProcAddress(ntdllmod, "ZwQueryInformationProcess");
      }
  </code></pre>
  
  <p>This works well on user land, but on kernel i dont need to call GetProcAddress, i just can call ZwQueryInformationProcess directly, since its a ntoskrnl export... Cant i just do this for example?:</p>
  
  <pre><code>#IF USER_LAND
     HMODULE ntdllmod = LoadLibraryA("ntdll.dll");
     if (ntdllmod)
     {
         ZwQueryInformationProcess func = (ZwQueryInformationProcess)GetProcAddress(ntdllmod, "ZwQueryInformationProcess");
     }
  #elif KERNEL_MODE
     //Run my Kernel version code here.
  </code></pre>
  
  <p>If this is not possible then how i can build a device driver library in VS2013? (cant find the option) Also any guide or reference for knowing how to link drivers library would help, assuming its different than a normal library.</p>
  
  <p><strong>EDIT: I already know about using ZwQueryInformationProcess, the question is if i can use the preprocessor directive #IF to generate a driver library or a user mode library and having both implementations in the same solution.</strong></p>
  
  <p>Thanks.</p>