mirror of
https://github.com/reactos/reactos.git
synced 2024-06-21 13:31:38 +00:00
[0.4.9][SHELL32] Fix SHFileOperation Move operation (#1487)
Reduce failures of Move operation of shell32!SHFileOperation function. CORE-13450 And also fixes regression CORE-13176 "Drag and drop with multiple files is broken" which regressed by SVN r74380 == gitfd91fe3337
fix picked from commit 0.4.12-dev-1080-gc65156002c
This commit is contained in:
parent
763e08ed5e
commit
913c11aaa7
|
@ -5,6 +5,7 @@
|
|||
* Copyright 2002 Andriy Palamarchuk
|
||||
* Copyright 2004 Dietrich Teickner (from Odin)
|
||||
* Copyright 2004 Rolf Kalbermatter
|
||||
* Copyright 2019 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -1062,11 +1063,15 @@ static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
|
|||
{
|
||||
DWORD dwLen = lstrlenW(szFile) + 1;
|
||||
LPCWSTR ptr;
|
||||
LPCWSTR ptr2;
|
||||
|
||||
feFile->szFullPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
|
||||
lstrcpyW(feFile->szFullPath, szFile);
|
||||
|
||||
ptr = StrRChrW(szFile, NULL, '\\');
|
||||
ptr2 = StrRChrW(szFile, NULL, '/');
|
||||
if (!ptr || ptr < ptr2)
|
||||
ptr = ptr2;
|
||||
if (ptr)
|
||||
{
|
||||
dwLen = ptr - szFile + 1;
|
||||
|
@ -1083,10 +1088,14 @@ static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
|
|||
static LPWSTR wildcard_to_file(LPCWSTR szWildCard, LPCWSTR szFileName)
|
||||
{
|
||||
LPCWSTR ptr;
|
||||
LPCWSTR ptr2;
|
||||
LPWSTR szFullPath;
|
||||
DWORD dwDirLen, dwFullLen;
|
||||
|
||||
ptr = StrRChrW(szWildCard, NULL, '\\');
|
||||
ptr2 = StrRChrW(szWildCard, NULL, '/');
|
||||
if (!ptr || ptr < ptr2)
|
||||
ptr = ptr2;
|
||||
dwDirLen = ptr - szWildCard + 1;
|
||||
|
||||
dwFullLen = dwDirLen + lstrlenW(szFileName) + 1;
|
||||
|
@ -1586,6 +1595,9 @@ static void move_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWST
|
|||
|
||||
destroy_file_list(&flFromNew);
|
||||
destroy_file_list(&flToNew);
|
||||
|
||||
if (PathIsDirectoryEmptyW(feFrom->szFullPath))
|
||||
Win32RemoveDirectoryW(feFrom->szFullPath);
|
||||
}
|
||||
|
||||
/* moves a file or directory to another directory */
|
||||
|
@ -1624,7 +1636,8 @@ static DWORD move_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flF
|
|||
|
||||
if (!(multiDest) &&
|
||||
!flFrom->bAnyDirectories &&
|
||||
flFrom->dwNumFiles > flTo->dwNumFiles)
|
||||
flFrom->dwNumFiles > flTo->dwNumFiles &&
|
||||
!(flTo->bAnyDirectories && flTo->dwNumFiles == 1))
|
||||
{
|
||||
return ERROR_CANCELLED;
|
||||
}
|
||||
|
@ -1735,6 +1748,7 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
|
|||
if (FAILED(ret))
|
||||
return ret;
|
||||
|
||||
lpFileOp->fAnyOperationsAborted = FALSE;
|
||||
check_flags(lpFileOp->fFlags);
|
||||
|
||||
ZeroMemory(&flFrom, sizeof(FILE_LIST));
|
||||
|
|
Loading…
Reference in a new issue