https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3299e96e91da7c4abe171…
commit 3299e96e91da7c4abe17182bc56e6953d95184b7
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Jan 9 19:38:34 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Jan 9 19:38:34 2024 +0900
[SHELL32] SHFileOperation: Fail elegantly if source doesn't exist (#6318)
Based on KRosUser's dragdropfixpart2.patch.
JIRA issue: CORE-19417, CORE-19211
- Check source file existence.
---
dll/win32/shell32/shlfileop.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dll/win32/shell32/shlfileop.cpp b/dll/win32/shell32/shlfileop.cpp
index cc3bc40748c..3480cfd2af0 100644
--- a/dll/win32/shell32/shlfileop.cpp
+++ b/dll/win32/shell32/shlfileop.cpp
@@ -1735,11 +1735,13 @@ static BOOL move_file_to_file(FILE_OPERATION *op, const WCHAR
*szFrom, const WCH
/* moves a file or directory to another directory */
static void move_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY
*feTo)
{
- WCHAR szDestPath[MAX_PATH];
+ if (feFrom->attributes == INVALID_FILE_ATTRIBUTES)
+ return;
if (!PathFileExistsW(feTo->szFullPath))
SHNotifyCreateDirectoryW(feTo->szFullPath, NULL);
+ WCHAR szDestPath[MAX_PATH];
PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename);
if (IsAttribFile(feFrom->attributes))
@@ -1763,6 +1765,9 @@ static DWORD move_files(FILE_OPERATION *op, BOOL multiDest, const
FILE_LIST *flF
if (!flTo->dwNumFiles)
return ERROR_FILE_NOT_FOUND;
+ if (flFrom->bAnyDontExist)
+ return ERROR_SHELL_INTERNAL_FILE_NOT_FOUND;
+
if (!(multiDest) &&
flTo->dwNumFiles > 1 && flFrom->dwNumFiles > 1)
{