[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.
This commit is contained in:
Katayama Hirofumi MZ 2024-01-09 19:38:34 +09:00 committed by GitHub
parent f105b50c4f
commit 3299e96e91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
{