Author: akhaldi
Date: Fri Oct 31 18:46:27 2014
New Revision: 65159
URL:
http://svn.reactos.org/svn/reactos?rev=65159&view=rev
Log:
[SHELL32]
* Apply Wine commit a2c90524 by Aric Stewart: Improve the FO_MOVE operation.
* More shell32:shlfileop tests run, less fail.
CORE-8540
Modified:
trunk/reactos/dll/win32/shell32/shlfileop.cpp
trunk/reactos/dll/win32/shell32/undocshell.h
Modified: trunk/reactos/dll/win32/shell32/shlfileop.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfileo…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shlfileop.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlfileop.cpp [iso-8859-1] Fri Oct 31 18:46:27 2014
@@ -1559,14 +1559,18 @@
}
/* the FO_MOVE operation */
-static HRESULT move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, const
FILE_LIST *flTo)
+static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, const
FILE_LIST *flTo)
{
DWORD i;
+ INT mismatched = 0;
const FILE_ENTRY *entryToMove;
const FILE_ENTRY *fileDest;
- if (!flFrom->dwNumFiles || !flTo->dwNumFiles)
- return ERROR_CANCELLED;
+ if (!flFrom->dwNumFiles)
+ return ERROR_SUCCESS;
+
+ if (!flTo->dwNumFiles)
+ return ERROR_FILE_NOT_FOUND;
if (!(lpFileOp->fFlags & FOF_MULTIDESTFILES) &&
flTo->dwNumFiles > 1 && flFrom->dwNumFiles > 1)
@@ -1584,27 +1588,42 @@
if (!PathFileExistsW(flTo->feFiles[0].szDirectory))
return ERROR_CANCELLED;
- if ((lpFileOp->fFlags & FOF_MULTIDESTFILES) &&
- flFrom->dwNumFiles != flTo->dwNumFiles)
- {
- return ERROR_CANCELLED;
- }
+ if (lpFileOp->fFlags & FOF_MULTIDESTFILES)
+ mismatched = flFrom->dwNumFiles - flTo->dwNumFiles;
fileDest = &flTo->feFiles[0];
for (i = 0; i < flFrom->dwNumFiles; i++)
{
entryToMove = &flFrom->feFiles[i];
- if (lpFileOp->fFlags & FOF_MULTIDESTFILES)
- fileDest = &flTo->feFiles[i];
-
if (!PathFileExistsW(fileDest->szDirectory))
return ERROR_CANCELLED;
+
+ if (lpFileOp->fFlags & FOF_MULTIDESTFILES)
+ {
+ if (i >= flTo->dwNumFiles)
+ break;
+ fileDest = &flTo->feFiles[i];
+ if (mismatched && !fileDest->bExists)
+ {
+ create_dest_dirs(flTo->feFiles[i].szFullPath);
+ flTo->feFiles[i].bExists = TRUE;
+ flTo->feFiles[i].attributes = FILE_ATTRIBUTE_DIRECTORY;
+ }
+ }
if (fileDest->bExists && IsAttribDir(fileDest->attributes))
move_to_dir(lpFileOp, entryToMove, fileDest);
else
SHNotifyMoveFileW(entryToMove->szFullPath, fileDest->szFullPath,
IsAttribDir(entryToMove->attributes));
+ }
+
+ if (mismatched > 0)
+ {
+ if (flFrom->bAnyDirectories)
+ return DE_DESTSAMETREE;
+ else
+ return DE_SAMEFILE;
}
return ERROR_SUCCESS;
Modified: trunk/reactos/dll/win32/shell32/undocshell.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/undocshe…
==============================================================================
--- trunk/reactos/dll/win32/shell32/undocshell.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/undocshell.h [iso-8859-1] Fri Oct 31 18:46:27 2014
@@ -83,7 +83,8 @@
#define RFF_NOLABEL 0x08
#define RFF_NOSEPARATEMEM 0x20 /* NT only */
-#define DE_SAMEFILE 0x71
+#define DE_SAMEFILE 0x71
+#define DE_DESTSAMETREE 0x7D
/* RunFileFlg notification structure */
typedef struct