During testing noticed that the win32 GetLastError() function was incorrrectly returning the value 2 immediately after a successful call of CreateDirectory().
After a bit of looking about in the source I noticed that the line:
SetLastError = true
was missing in the [DllImport] attribute definition for the signature of CreateDirectory(). When I added this to the [DllImport] as per GetFileAttributes() function immediately below it in the source code, GetLastError() returned zero as expected.
After a quick search also noticed the the same "
SetLastError = true" was also missing from the following functions:
PS. Keep up the good work