mirror of
https://github.com/reactos/reactos.git
synced 2024-08-11 21:58:10 +00:00
[SHELL32]
* Apply Wine commit a2c90524 by Aric Stewart: Improve the FO_MOVE operation. * More shell32:shlfileop tests run, less fail. CORE-8540 svn path=/trunk/; revision=65159
This commit is contained in:
parent
7a2c925aed
commit
46551d006f
|
@ -1559,14 +1559,18 @@ static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, co
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the FO_MOVE operation */
|
/* 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;
|
DWORD i;
|
||||||
|
INT mismatched = 0;
|
||||||
const FILE_ENTRY *entryToMove;
|
const FILE_ENTRY *entryToMove;
|
||||||
const FILE_ENTRY *fileDest;
|
const FILE_ENTRY *fileDest;
|
||||||
|
|
||||||
if (!flFrom->dwNumFiles || !flTo->dwNumFiles)
|
if (!flFrom->dwNumFiles)
|
||||||
return ERROR_CANCELLED;
|
return ERROR_SUCCESS;
|
||||||
|
|
||||||
|
if (!flTo->dwNumFiles)
|
||||||
|
return ERROR_FILE_NOT_FOUND;
|
||||||
|
|
||||||
if (!(lpFileOp->fFlags & FOF_MULTIDESTFILES) &&
|
if (!(lpFileOp->fFlags & FOF_MULTIDESTFILES) &&
|
||||||
flTo->dwNumFiles > 1 && flFrom->dwNumFiles > 1)
|
flTo->dwNumFiles > 1 && flFrom->dwNumFiles > 1)
|
||||||
|
@ -1584,29 +1588,44 @@ static HRESULT move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, c
|
||||||
if (!PathFileExistsW(flTo->feFiles[0].szDirectory))
|
if (!PathFileExistsW(flTo->feFiles[0].szDirectory))
|
||||||
return ERROR_CANCELLED;
|
return ERROR_CANCELLED;
|
||||||
|
|
||||||
if ((lpFileOp->fFlags & FOF_MULTIDESTFILES) &&
|
if (lpFileOp->fFlags & FOF_MULTIDESTFILES)
|
||||||
flFrom->dwNumFiles != flTo->dwNumFiles)
|
mismatched = flFrom->dwNumFiles - flTo->dwNumFiles;
|
||||||
{
|
|
||||||
return ERROR_CANCELLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
fileDest = &flTo->feFiles[0];
|
fileDest = &flTo->feFiles[0];
|
||||||
for (i = 0; i < flFrom->dwNumFiles; i++)
|
for (i = 0; i < flFrom->dwNumFiles; i++)
|
||||||
{
|
{
|
||||||
entryToMove = &flFrom->feFiles[i];
|
entryToMove = &flFrom->feFiles[i];
|
||||||
|
|
||||||
if (lpFileOp->fFlags & FOF_MULTIDESTFILES)
|
|
||||||
fileDest = &flTo->feFiles[i];
|
|
||||||
|
|
||||||
if (!PathFileExistsW(fileDest->szDirectory))
|
if (!PathFileExistsW(fileDest->szDirectory))
|
||||||
return ERROR_CANCELLED;
|
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))
|
if (fileDest->bExists && IsAttribDir(fileDest->attributes))
|
||||||
move_to_dir(lpFileOp, entryToMove, fileDest);
|
move_to_dir(lpFileOp, entryToMove, fileDest);
|
||||||
else
|
else
|
||||||
SHNotifyMoveFileW(entryToMove->szFullPath, fileDest->szFullPath, IsAttribDir(entryToMove->attributes));
|
SHNotifyMoveFileW(entryToMove->szFullPath, fileDest->szFullPath, IsAttribDir(entryToMove->attributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mismatched > 0)
|
||||||
|
{
|
||||||
|
if (flFrom->bAnyDirectories)
|
||||||
|
return DE_DESTSAMETREE;
|
||||||
|
else
|
||||||
|
return DE_SAMEFILE;
|
||||||
|
}
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,8 @@ BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
|
||||||
#define RFF_NOLABEL 0x08
|
#define RFF_NOLABEL 0x08
|
||||||
#define RFF_NOSEPARATEMEM 0x20 /* NT only */
|
#define RFF_NOSEPARATEMEM 0x20 /* NT only */
|
||||||
|
|
||||||
#define DE_SAMEFILE 0x71
|
#define DE_SAMEFILE 0x71
|
||||||
|
#define DE_DESTSAMETREE 0x7D
|
||||||
|
|
||||||
/* RunFileFlg notification structure */
|
/* RunFileFlg notification structure */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
Loading…
Reference in a new issue