title: Is anyone familiar with the undocumented ObReferenceObjectByName windows kernel function?
body: <p>I read a very fascinating article that was about programming drivers using the wdk, and one of the functions it used is called ObReferenceObjectByName.  This function has given me lots of headaches.  The first bad thing is that it's not documented by microsoft.  The second thing, is that the language used in the article was C++, and I want to keep my code in plain ol' C.  I know that most of the time this shouldn't be a problem, but I haven't - for the life of me - been able to figure out how to include this function.</p>
  
  <p>The code in the article goes something like:</p>
  
  <pre><code>extern "C"{
  
   #include &lt;ntifs.h&gt;
  
  
   NTSYSAPI NTSTATUS NTAPI ObReferenceObjectByName(PUNICODE_STRING ObjectName,
  
           ULONG Attributes,
  
           PACCESS_STATE AccessState,
  
           ACCESS_MASK DesiredAccess,
  
           POBJECT_TYPE ObjectType,
  
           KPROCESSOR_MODE AccessMode,
  
           PVOID ParseContext OPTIONAL,
  
           PVOID* Object);
  }
  </code></pre>
  
  <p>I've been trying to replicate this for hours.  I tried declaring it without the 'extern' keyword, I tried changing the calling convention, I tried changing the includes... I always end up with the error "unresolved external symbol...".  </p>
  
  <p>I'm absolutely stumped, so if anyone could offer some advice, I'd be grateful.  Thanks.</p>