when CreateDirectory returns ERROR_ACCESS_DENIED and “shouldn't”
My Win32 app A1 (actually a collection of processes) is trying to use CreateDirectory to create a directory D1 within parent directory P. The path to P is the value of the TMP environment variable, which makes P a potentially busy but generally permissive place. The vast majority of the time, everything works fine, but, rarely, CreateDirectory fails and GetLastError then returns ERROR_ACCESS_DENIED , the meaning of which in this context is not documented. I wrote a test application A2 which does nothing but repeatedly create and delete a directory D2 as fast as it can within P, and I chose a