http://bugs.winehq.org/show_bug.cgi?id=9353
Summary: CreateFile with OPEN_ALWAYS on an existing directory sets wrong error code Product: Wine Version: 0.9.43. Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-kernel AssignedTo: wine-bugs@winehq.org ReportedBy: lindevel@gmx.net
When I call CreateFile like this: CreateFile("testdir", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, NULL); with the directory "testdir" existing, it sets ERROR_ACCESS_DENIED, while Windows XP SP 2 sets ERROR_ALREADY_EXISTS (didn't confirm the Windows side myself). The correct flag I should be passing instead of OPEN_ALWAYS is OPEN_EXISTING (which works on Windows XP as well).
From a first try to find the cause for this, I believe that it is not in
CreateFile and neither in NtCreateFile, but somewhere in wineserver.