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.
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #1 from Austin English austinenglish@gmail.com 2007-08-17 16:32:22 --- Can you upload a sample program/testcase (source and binary) that demonstrates this problem?
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #2 from Dennis Schridde lindevel@gmx.net 2007-08-17 17:59:44 --- Created an attachment (id=7645) --> (http://bugs.winehq.org/attachment.cgi?id=7645) Testcase
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #3 from Dennis Schridde lindevel@gmx.net 2007-08-17 18:00:29 --- Created an attachment (id=7646) --> (http://bugs.winehq.org/attachment.cgi?id=7646) Testcase - binary
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #4 from Dennis Schridde lindevel@gmx.net 2007-08-17 18:02:13 --- Compiled with GCC 4.2.0 for mingw32, with w32api-3.9, mingw-runtime-3.12.
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #5 from Dennis Schridde lindevel@gmx.net 2007-08-17 19:00:35 --- I just confirmed (on WinXPSP2 in a VBox): On Windows XP OPEN_ALWAYS seems to work as well (opposing to the info I initially got from someone else on IRC).
The testcase currently uses testdir in the "current directory", which, according to MSDN, is not supported. It should instead specify an absolute path, eg. "C:\testdir". This doesn't change anything, neither on the Wine side (where it still does not work) nor on the Windows side (where it still works). (With OPEN_EXISTING and absolute paths, it also still works on both sides.)
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #6 from Dennis Schridde lindevel@gmx.net 2007-08-17 19:03:00 --- PS: "works" in the 1st paragraph means: Windows is able to open the directory and lock it successfully, without errors.
http://bugs.winehq.org/show_bug.cgi?id=9353
Dennis Schridde lindevel@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|CreateFile with OPEN_ALWAYS |CreateFile with OPEN_ALWAYS |on an existing directory |on an existing directory |sets wrong error code |fails with | |ERROR_ACCESS_DENIED
--- Comment #7 from Dennis Schridde lindevel@gmx.net 2007-08-18 04:34:00 --- Just confirmed it again on the WinXPSP2 in my VBox. Wine seems wrong with failing to open the file, so I edited the bug-summary.
http://bugs.winehq.org/show_bug.cgi?id=9353
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Keywords| |download, testcase Resolution| |FIXED
--- Comment #8 from Austin English austinenglish@gmail.com 2008-04-09 04:42:42 --- Works fine for me in wine 0.9.59.
http://bugs.winehq.org/show_bug.cgi?id=9353
Louis Lenders xerox_xerox2000@yahoo.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |xerox_xerox2000@yahoo.co.uk Status|RESOLVED |UNCONFIRMED Resolution|FIXED |
--- Comment #9 from Louis Lenders xerox_xerox2000@yahoo.co.uk 2008-04-09 11:30:11 --- I don't think this is fixed:
mkdir testdir wine testlock.exe Failure! Error was: 5 - Access denied
Please be careful resolving bugs as fixed, whereas they are not
http://bugs.winehq.org/show_bug.cgi?id=9353
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #10 from Austin English austinenglish@gmail.com 2008-04-09 11:56:10 --- Thanks for catching that Louis. I misunderstood the code and since no instructions were included, assumed that when the program returned 'Success!' that it meant it.
Confirming then.
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #11 from Andrew Nguyen arethusa26@gmail.com 2008-11-29 22:14:54 --- The test application seems to work in today's Git (wine-1.1.9-183-gbbaa72d), so this is fixed.
http://bugs.winehq.org/show_bug.cgi?id=9353
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #12 from James Hawkins truiken@gmail.com 2008-11-29 22:21:25 --- Fixed.
http://bugs.winehq.org/show_bug.cgi?id=9353
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |
--- Comment #13 from Jeff Zaroyko jeffz@jeffz.name 2008-11-29 22:40:25 --- the issue still persists as per comment #9, reopening
http://bugs.winehq.org/show_bug.cgi?id=9353
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #7645 is|0 |1 obsolete| |
--- Comment #14 from Jeff Zaroyko jeffz@jeffz.name 2008-11-30 01:55:24 --- Created an attachment (id=17559) --> (http://bugs.winehq.org/attachment.cgi?id=17559) patch + testcase
http://bugs.winehq.org/show_bug.cgi?id=9353
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeffz@jeffz.name
--- Comment #15 from Jeff Zaroyko jeffz@jeffz.name 2008-11-30 01:57:58 --- Dennis,
Your testcase works after I apply my patch, is there a real application that this bug affects?
http://bugs.winehq.org/show_bug.cgi?id=9353
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #16 from Dennis Schridde lindevel@gmx.net 2008-11-30 04:22:52 --- Jeff: If I would have finished the application I was writing, I could ensure you: Yes, there is. But since I did not, I can not confirm nor deny whether any real world application is affected by this issue.
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #17 from Dmitry Timoshkov dmitry@codeweavers.com 2008-12-02 22:57:42 --- Probably
(flags & (~O_TRUNC & ~O_CREAT))
should be replaced by
(flags & (~(O_TRUNC | O_CREAT)))
to make the intent more clear.
http://bugs.winehq.org/show_bug.cgi?id=9353
--- Comment #18 from Jeff Zaroyko jeffz@jeffz.name 2008-12-03 00:01:12 --- (In reply to comment #17)
to make the intent more clear.
fair enough, I thought mine looked less noisy. Thanks for the feedback.
http://bugs.winehq.org/show_bug.cgi?id=9353
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED
--- Comment #19 from Jeff Zaroyko jeffz@jeffz.name 2008-12-03 19:01:10 --- Patches have been committed.
http://source.winehq.org/git/wine.git/?a=commit;h=afce6158304ac4e0cb22bfde4d... http://source.winehq.org/git/wine.git/?a=commit;h=f8b5aa34dc4f4681a151cdc07a...
http://bugs.winehq.org/show_bug.cgi?id=9353
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #20 from Alexandre Julliard julliard@winehq.org 2008-12-05 11:12:39 --- Closing bugs fixed in 1.1.10.