title: How to find the root cause for some Access Denied error on a windows machine?
body: <p>I was wondering if there is a way to discover the exact reasons for an Access Denied error on a windows box.</p>
  
  <p>For instance, I have this code that crashes with Access Denied on Win2008R2 when it runs unelevated. I was hoping that ProcMon will tell me exactly which resource denied access - it did not, although I did not filter the events.</p>
  
  <p>So, I am a bit lost - how on earth am I supposed to troubleshoot it?</p>
  
  <p>For the reference, the code I am trying to run is <code>ICertAdmin2.ResubmitRequest</code>. It runs OK elevated, but fails with Access Denied when ran unelevated:</p>
  
  <pre><code>System.UnauthorizedAccessException: CCertAdmin::ResubmitRequest: Access is denied. 0x80070005 (WIN32: 5)
     at CERTADMINLib.ICertAdmin2.ResubmitRequest(String strConfig, Int32 RequestId)
  </code></pre>
  
  <p>Thanks in advance to all the Good Samaritans out there.</p>