http://bugs.winehq.org/show_bug.cgi?id=25207
Summary: SHFileOperation does not create new directory on FO_MOVE Product: Wine Version: 1.3.6 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: shell32 AssignedTo: wine-bugs@winehq.org ReportedBy: richard@rtrussell.co.uk
Created an attachment (id=32007) --> (http://bugs.winehq.org/attachment.cgi?id=32007) C program to demonstrate the problem
SHFileOperation should create the destination directory on an FO_MOVE operation, if it does not already exist, but fails to do so. See:
http://msdn.microsoft.com/en-us/library/bb759795.aspx
"Copy and Move operations can specify destination directories that do not exist. In those cases, the system attempts to create them and normally displays a dialog box to ask the user if they want to create the new directory. To suppress this dialog box and have the directories created silently, set the FOF_NOCONFIRMMKDIR flag in fFlags".
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #1 from Richard Russell richard@rtrussell.co.uk 2010-11-17 17:37:24 CST --- Created an attachment (id=32008) --> (http://bugs.winehq.org/attachment.cgi?id=32008) Executable to demonstrate the problem
Program should display 'Tests completed successfully' but under Wine 1.3.6 it displays 'SHFileOperation (FO_MOVE) failed with return value 1223'.
http://bugs.winehq.org/show_bug.cgi?id=25207
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Severity|major |normal
--- Comment #2 from Jeff Zaroyko jeffz@jeffz.name 2010-11-17 17:40:31 CST --- not major: http://bugs.winehq.org/page.cgi?id=fields.html#bug_severity (unless you can list several applications which rely on this behavior)
Confirming the testcase passes on Windows Vista SP2 32bit.
http://bugs.winehq.org/show_bug.cgi?id=25207
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #3 from Richard Russell richard@rtrussell.co.uk 2011-11-19 07:03:37 CST --- "unless you can list several applications which rely on this behavior"
The majority of applications compiled using 'BBC BASIC for Windows' will fail to run because of this bug. The total number is likely to be in the hundreds, although that would be difficult to confirm.
Here are just a few of the applications affected:
QBASIC to BBC BASIC translator: http://www.bbcbasic.co.uk/qb2bbc/QB2BBC.exe LB Booster: http://www.lbbooster.com/LBB.exe Test Card Generator: http://www.rtrussell.co.uk/tccgen/tcsetup.exe FIR Filter Design: http://www.rtr.myzen.co.uk/firbbc.exe BBC Free-D Camera Tracking: http://www.rtr.myzen.co.uk/fdsetup.exe Colour Recovery: http://www.rtr.myzen.co.uk/crexe128.zip Alien Eliminator: http://www.bb4wgames.com/progs/zip/alieneliminator.zip Vapiki: http://www.jeroengroenendaal.com/games/vapiki.exe Unnamed Shooter: http://81red.dk/UnnamedShooter.zip
http://bugs.winehq.org/show_bug.cgi?id=25207
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |adys.wh@gmail.com Severity|normal |major
--- Comment #4 from Jerome Leclanche adys.wh@gmail.com 2011-11-19 12:09:50 CST --- Major.
http://bugs.winehq.org/show_bug.cgi?id=25207
Erik Siers eriksiers@bmi.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eriksiers@bmi.net
http://bugs.winehq.org/show_bug.cgi?id=25207
Grahame Pratt softappstudio@comcast.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |softappstudio@comcast.net
--- Comment #5 from Grahame Pratt softappstudio@comcast.net 2011-11-20 23:01:36 CST --- I have four of my own BB4W applications which I would have to seriously rewrite to run under wine as long as this limitation applies. I suspect that there are hundreds of other BB4W users in the same boat. At the moment I am using Virtual-Win98SE machines to run them, terrible kluge!
http://bugs.winehq.org/show_bug.cgi?id=25207
net201416 net201416@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |net201416@yahoo.com
--- Comment #6 from net201416 net201416@yahoo.com --- Same problem x86 Wine 1.4.1
http://bugs.winehq.org/show_bug.cgi?id=25207
lizhenbo litimetal@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |litimetal@gmail.com
--- Comment #7 from lizhenbo litimetal@gmail.com --- Same problem on wine-1.7.11
http://bugs.winehq.org/show_bug.cgi?id=25207
lizhenbo litimetal@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |Paul.Vriens.Wine@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #8 from lizhenbo litimetal@gmail.com --- This is first detected by Paul Vriens in dlls/shell32/tests/shlfileop.c
--old code-- retval = SHFileOperationA(&shfo2); if (dir_exists("test6.txt")) { /* Vista and W2K8 (broken or new behavior ?) */ ok(retval == ERROR_NO_VOLUME_LABEL, "Expected ERROR_NO_VOLUME_LABEL, got %d\n", retval); ok(DeleteFileA("test6.txt\test1.txt"), "The file is not moved\n"); RemoveDirectoryA("test6.txt"); ok(DeleteFileA("test7.txt\test2.txt"), "The file is not moved\n"); RemoveDirectoryA("test7.txt"); } else { ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval); ok(!file_exists("test6.txt"), "The file is not moved - many files are " "specified as a target\n"); } ------------
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #9 from lizhenbo litimetal@gmail.com --- Created attachment 47382 --> http://bugs.winehq.org/attachment.cgi?id=47382 0001-shell32-tests-SHFileOperation-should-create-new-direct.txt
Patch for wine testcase
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #10 from lizhenbo litimetal@gmail.com --- Created attachment 47383 --> http://bugs.winehq.org/attachment.cgi?id=47383 0002-shell32-SHFileOperation-should-create-new-directory-on.txt
Patch for this problem
I'm looking forward to your feedbacks, thank you.
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #11 from Richard Russell richard@rtrussell.co.uk --- The destination directory requiring to be created may be of the form '....\dir1\dir2\dir3' (where neither dir1 nor dir2 exist), in other words it may require iteratively creating new subdirectories until the required 'level' is reached.
The proposed patch appears only to call CreateDirectoryW which, unless I am mistaken, will not achieve that.
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #12 from lizhenbo litimetal@gmail.com --- (In reply to comment #11)
The destination directory requiring to be created may be of the form '....\dir1\dir2\dir3' (where neither dir1 nor dir2 exist), in other words it may require iteratively creating new subdirectories until the required 'level' is reached.
The proposed patch appears only to call CreateDirectoryW which, unless I am mistaken, will not achieve that.
Thank you for checking that. You're right, I made a mistake.
Could I use SHCreateDirectory ?
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #13 from lizhenbo litimetal@gmail.com --- Created attachment 47384 --> http://bugs.winehq.org/attachment.cgi?id=47384 C program to demonstrate the problem(v2).c
It shows a behavior: CreateDirectory function will only create the final directory in the path.
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #14 from Richard Russell richard@rtrussell.co.uk --- (In reply to comment #12)
Could I use SHCreateDirectory ?
Probably yes, although in Windows Vista and later, SHCreateDirectory has been replaced by SHCreateDirectoryEx; I don't know what the situation is in Wine.
My only concern would be what to supply as the 'hwnd' parameter. Maybe you should pass NULL when the FOF_SILENT flag is set and lpFileOp->hwnd if not?
http://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #15 from lizhenbo litimetal@gmail.com --- (In reply to comment #14)
(In reply to comment #12)
Could I use SHCreateDirectory ?
Probably yes, although in Windows Vista and later, SHCreateDirectory has been replaced by SHCreateDirectoryEx; I don't know what the situation is in Wine.
My only concern would be what to supply as the 'hwnd' parameter. Maybe you should pass NULL when the FOF_SILENT flag is set and lpFileOp->hwnd if not?
Thank you. I checked wine's code, and I found SHCreateDirectoryEx has been implemented. As test_sh_create_dir() shows, SHCreateDirectoryEx should work in most situations (but may lack of tests for exceptions)
Besides of it, I worry about dependencies. Luckily, SHCreateDirectoryExW and SHFileOperationW is in the same file, but I don't know if it is guaranteed.
Thanks for mentioning 'hwnd'. I think we should do more tests, instead of only studying MSDN(although it's a good reference) IMHO.
Sorry for my humble expressions.
https://bugs.winehq.org/show_bug.cgi?id=25207
Murray Colpman muzerakascooby@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |muzerakascooby@gmail.com
--- Comment #16 from Murray Colpman muzerakascooby@gmail.com --- I believe Block Post Software's simulators are affected by this bug (it could be another bug; I don't know exactly what it's calling, but it seems likely to be this issue given the error is about failure to create a file in a directory that actually doesn't exist). Demonstration versions are available.
https://bugs.winehq.org/show_bug.cgi?id=25207
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de
https://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #17 from lizhenbo litimetal@gmail.com --- I've sent a patch: http://source.winehq.org/patches/data/113646
https://bugs.winehq.org/show_bug.cgi?id=25207
lizhenbo litimetal@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |aric@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=25207
lizhenbo litimetal@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #47382|0 |1 is obsolete| | Attachment #47383|0 |1 is obsolete| |
--- Comment #18 from lizhenbo litimetal@gmail.com --- Created attachment 52274 --> https://bugs.winehq.org/attachment.cgi?id=52274 patch v2.txt
This is my second version of patch. However, I don't think this patch can be accepted to wine soon.
If your application is blocked, maybe you can try wine-staging? See: https://bugs.wine-staging.com/show_bug.cgi?id=541
https://bugs.winehq.org/show_bug.cgi?id=25207
Michael Müller michael@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |STAGED CC| |michael@fds-team.de Staged patchset| |https://github.com/wine-com | |pholio/wine-staging/tree/ma | |ster/patches/shell32-SHFile | |Operation_Move
https://bugs.winehq.org/show_bug.cgi?id=25207
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=25207
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nerv@dawncrow.de Staged patchset|https://github.com/wine-com |https://github.com/wine-sta |pholio/wine-staging/tree/ma |ging/wine-staging/tree/mast |ster/patches/shell32-SHFile |er/patches/shell32-SHFileOp |Operation_Move |eration_Move
https://bugs.winehq.org/show_bug.cgi?id=25207
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #19 from joaopa jeremielapuree@yahoo.fr --- Bug still occurs with wine-5.2:
SHFileOperation (FO_MOVE) failed with return value 1223
https://bugs.winehq.org/show_bug.cgi?id=25207
Bruno Santos brunomanuelsantos@tecnico.ulisboa.pt changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |brunomanuelsantos@tecnico.u | |lisboa.pt
https://bugs.winehq.org/show_bug.cgi?id=25207
nekoNexus@protonmail.ch changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nekoNexus@protonmail.ch
https://bugs.winehq.org/show_bug.cgi?id=25207
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #20 from Zeb Figura z.figura12@gmail.com --- (In reply to Murray Colpman from comment #16)
I believe Block Post Software's simulators are affected by this bug (it could be another bug; I don't know exactly what it's calling, but it seems likely to be this issue given the error is about failure to create a file in a directory that actually doesn't exist). Demonstration versions are available.
I can confirm that this application is fixed by the relevant patch.
All of the other applications in comment 3 are either no longer accessible, or it's not clear to me how to trigger the failure, assuming it was ever actually related.
https://bugs.winehq.org/show_bug.cgi?id=25207
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://web.archive.org/web | |/20240317200525/https://blo | |ckpostsoftware.co.uk/files/ | |Ford_Version_R1_setup.exe
https://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #21 from lizhenbo litimetal@gmail.com --- (In reply to Zeb Figura from comment #20)
I can confirm that this application is fixed by the relevant patch.
All of the other applications in comment 3 are either no longer accessible, or it's not clear to me how to trigger the failure, assuming it was ever actually related.
I tried my test code https://bugs.winehq.org/attachment.cgi?id=47384
With wine-9.4, it still shows Creating file C:\users\lizhenbo\Temp\shfotest.tmp Moving file to C:\users\lizhenbo\Temp\newsubdir\dir2\dir3\dir4\shfotest.tmp SHFileOperation (FO_MOVE) failed with return value 1223
I'm sorry for dropping my patch to wine-staging for years[1]. I'd like to pick up my staging patch and let it be accepted by wine-get
[1]: https://github.com/wine-staging/wine-staging/tree/master/patches/shell32-SHF...
https://bugs.winehq.org/show_bug.cgi?id=25207
--- Comment #22 from Zeb Figura z.figura12@gmail.com --- (In reply to lizhenbo from comment #21)
With wine-9.4, it still shows Creating file C:\users\lizhenbo\Temp\shfotest.tmp Moving file to C:\users\lizhenbo\Temp\newsubdir\dir2\dir3\dir4\shfotest.tmp SHFileOperation (FO_MOVE) failed with return value 1223
It's not upstream yet. I submitted it as 5335.
https://bugs.winehq.org/show_bug.cgi?id=25207
Vijay Kamuju infyquest@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|STAGED |RESOLVED Fixed by SHA1| |b4a5775ffb2e5c27ff85399f89f | |6b37f1d1298d3 Resolution|--- |FIXED CC| |infyquest@gmail.com
--- Comment #23 from Vijay Kamuju infyquest@gmail.com --- Patch upstreamed - https://source.winehq.org/git/wine.git/commit/b4a5775ffb2e5c27ff85399f89f6b3...
https://bugs.winehq.org/show_bug.cgi?id=25207
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #24 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.5.
https://bugs.winehq.org/show_bug.cgi?id=25207
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |9.0.x