[PATCH] shell32: SHFileOperation can move several files into one directory

James Hawkins truiken at gmail.com
Tue Jun 17 20:20:14 CDT 2008


2008/6/17 Vitaly Perov <vitperov at etersoft.ru>:
> The test was sent 2 hours ago
> If FOF_MULTIDESTFILES flag is set it's not olny mean that pTo contains
> multiple destination files, it also can contain one folder.
>
> Changelog:
> - shell32: SHFileOperation can move several files into one directory
>

--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -1426,7 +1426,8 @@ static HRESULT move_files(LPSHFILEOPSTRUCTW
lpFileOp, const FILE_LIST *flFrom, c
         return ERROR_CANCELLED;

     if ((lpFileOp->fFlags & FOF_MULTIDESTFILES) &&
-        flFrom->dwNumFiles != flTo->dwNumFiles)
+        flFrom->dwNumFiles != flTo->dwNumFiles  &&
+        !IsAttribDir(fileDest->attributes))
     {
         return ERROR_CANCELLED;
     }

There is a glaring error right here.  For one, you should heed
compiler warnings:

wine/dlls/shell32/shlfileop.c: In function 'SHFileOperationW':
wine/dlls/shell32/shlfileop.c:1428: warning: 'fileDest' is used
uninitialized in this function
wine/dlls/shell32/shlfileop.c:1407: note: 'fileDest' was declared here

You're using fileDest when it hasn't been initialized (as the warning
says).  Second, the tests fail:

shlfileop.c:1132: Test failed: The file is not moved - many files are
specified as a target
shlfileop.c:1206: Test failed: Expected d.txt to not exist
make: *** [shlfileop.ok] Error 2

-- 
James Hawkins



More information about the wine-devel mailing list