https://git.reactos.org/?p=reactos.git;a=commitdiff;h=257e7307b4fb4de43b4c5…
commit 257e7307b4fb4de43b4c50e4700b6ef52d0f653e
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Dec 8 07:58:14 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Dec 8 07:58:14 2019 +0900
[SHELL32] Fix hung-up of shell32:shlfileop (#2136)
#2085 caused some failures and hung-up in shell32:shlfileop testcase. This PR will fix
it.
CORE-16546
---
dll/win32/shell32/shlfileop.cpp | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/dll/win32/shell32/shlfileop.cpp b/dll/win32/shell32/shlfileop.cpp
index e7f53fcd448..9c20be4a6c1 100644
--- a/dll/win32/shell32/shlfileop.cpp
+++ b/dll/win32/shell32/shlfileop.cpp
@@ -1811,6 +1811,18 @@ static void check_flags(FILEOP_FLAGS fFlags)
}
#ifdef __REACTOS__
+
+/* Error codes could be pre-Win32 */
+#define DE_SAMEFILE 0x71
+#define DE_MANYSRC1DEST 0x72
+#define DE_DIFFDIR 0x73
+#define DE_OPCANCELLED 0x75
+#define DE_DESTSUBTREE 0x76
+#define DE_INVALIDFILES 0x7C
+#define DE_DESTSAMETREE 0x7D
+#define DE_FLDDESTISFILE 0x7E
+#define DE_FILEDESTISFLD 0x80
+
static DWORD
validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo)
{
@@ -1821,7 +1833,7 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom,
FILE_LIST *flT
UINT wFunc = lpFileOp->wFunc;
HWND hwnd = lpFileOp->hwnd;
- dwNumDest = ((lpFileOp->fFlags & FOF_MULTIDESTFILES) ? flTo->dwNumFiles :
1);
+ dwNumDest = flTo->dwNumFiles;
if (wFunc != FO_COPY && wFunc != FO_MOVE)
return ERROR_SUCCESS;
@@ -1844,7 +1856,7 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom,
FILE_LIST *flT
if (lstrcmpiW(szFrom, szTo) == 0 &&
(wFunc == FO_MOVE || !(lpFileOp->fFlags &
FOF_RENAMEONCOLLISION)))
{
- if (!(lpFileOp->fFlags & FOF_SILENT))
+ if (!(lpFileOp->fFlags & (FOF_NOERRORUI | FOF_SILENT)))
{
if (wFunc == FO_MOVE)
{
@@ -1861,7 +1873,7 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom,
FILE_LIST *flT
MessageBoxW(hwnd, szText, strTitle, MB_ICONERROR);
}
}
- return ERROR_SHARING_VIOLATION;
+ return DE_OPCANCELLED;
}
// subfolder?
@@ -1878,7 +1890,7 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom,
FILE_LIST *flT
if (compare == 0)
{
- if (!(lpFileOp->fFlags & FOF_SILENT))
+ if (!(lpFileOp->fFlags & (FOF_NOERRORUI | FOF_SILENT)))
{
if (wFunc == FO_MOVE)
{
@@ -1895,7 +1907,7 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom,
FILE_LIST *flT
MessageBoxW(hwnd, szText, strTitle, MB_ICONERROR);
}
}
- return ERROR_SHARING_VIOLATION;
+ return ERROR_SUCCESS;
}
}
}