title: CreateFile with OPEN_ALWAYS on existing file in OneDrive For Business (OFB) failed as ERROR_ACCESS_DENIED
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;Windows.h&gt;
  int main()
  {
      HANDLE a = CreateFileW((LPCWSTR)u&quot;D:\\OneDrive - 翁悸会\\test2.txt&quot;, GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
      DWORD b = GetLastError();
      std::cout &lt;&lt; a &lt;&lt; &quot;\n&quot; &lt;&lt; b;
  }
  </code></pre>
  <p>This code can successfully open or create a file anywhere other than my OFB - where, if the file exists, it will return an error code 5, ERROR_ACCESS_DENIED according to <a href="https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-</a></p>
  <p>This error happens in all subdirectories in the OFB. On the contrary, even my OneDrive Personal will allow this operation. And of course, I have full access to the OFB - I can normally create or open any file with Windows Explorer.</p>
  <p>Either if the file does not exist or the file is not in the OFB, CreateFile succeeds.</p>
  <p>Is it a windows bug, or I did something wrong?</p>
  <p>OS: Win11 22499.1010</p>
  <p>OFB: 21.225.1031.0005</p>