title: CreateFileA fails with ERROR_ACCESS_DENIED
body: <p>I need to retrieve a handle to a directory to be able to call <strong><a href="http://msdn.microsoft.com/en-us/library/aa365465%28v=vs.85%29.aspx" rel="nofollow">ReadDirectoryChangesW</a></strong> on it. Actually I would need a bit more than that but let’s go easy first. I have narrowed down the problem to this:</p>
  
  <pre><code>m_directoryHandle = CreateFileA(
      "C:\\Users\\victor\\Documents\\Projets\\libxnotify\\unittests", // __in      LPCTSTR lpFileName,
      FILE_LIST_DIRECTORY,    // __in      DWORD dwDesiredAccess,
      0,                      // __in      DWORD dwShareMode,
      0,                      // __in_opt  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
      OPEN_EXISTING,          // __in      DWORD dwCreationDisposition,
      0,                      // __in      DWORD dwFlagsAndAttributes,
      0                       // __in_opt  HANDLE hTemplateFile
  );
  </code></pre>
  
  <p>This return an <code>INVALID_HANDLE_VALUE</code> with a last error code of <code>ERROR_ACCESS_DENIED</code>. Needless to say, I have tried oodles of different parameters, none on them did work. I run my program as victor, and to make sure I really had the rights in that unittests directory, I opened a command shell and typed:</p>
  
  <p><code>C:\Users\victor&gt;echo bla &gt;&gt; "C:\Users\victor\Documents\Projets\libxnotify\unittests\test"</code></p>
  
  <p>and it worked.</p>