https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4490a053d01b54f957627bc0e1c59a471638ae49
commit 4490a053d01b54f957627bc0e1c59a471638ae49 Author: Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com> AuthorDate: Fri Jan 12 16:01:21 2024 +0900 Commit: GitHub <nore...@github.com> CommitDate: Fri Jan 12 16:01:21 2024 +0900 [SHELL32] Improve error message on copying files (#6290) Based on KRosUser's copyerrorfix.patch. JIRA issue: CORE-19414 - If feFrom->szFilename was empty, then use feFrom->szFullPath instead. --- dll/win32/shell32/shlfileop.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dll/win32/shell32/shlfileop.cpp b/dll/win32/shell32/shlfileop.cpp index 3480cfd2af0..f1ecc455428 100644 --- a/dll/win32/shell32/shlfileop.cpp +++ b/dll/win32/shell32/shlfileop.cpp @@ -1883,6 +1883,8 @@ static void check_flags(FILEOP_FLAGS fFlags) FIXME("Unsupported flags: %04x\n", fFlags); } +#define GET_FILENAME(fe) ((fe)->szFilename[0] ? (fe)->szFilename : (fe)->szFullPath) + static DWORD validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo) { @@ -1922,14 +1924,14 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flT { strTitle.LoadStringW(IDS_MOVEERRORTITLE); if (IsAttribDir(feFrom->attributes)) - strText.Format(IDS_MOVEERRORSAMEFOLDER, feFrom->szFilename); + strText.Format(IDS_MOVEERRORSAMEFOLDER, GET_FILENAME(feFrom)); else - strText.Format(IDS_MOVEERRORSAME, feFrom->szFilename); + strText.Format(IDS_MOVEERRORSAME, GET_FILENAME(feFrom)); } else { strTitle.LoadStringW(IDS_COPYERRORTITLE); - strText.Format(IDS_COPYERRORSAME, feFrom->szFilename); + strText.Format(IDS_COPYERRORSAME, GET_FILENAME(feFrom)); return ERROR_SUCCESS; } MessageBoxW(hwnd, strText, strTitle, MB_ICONERROR); @@ -1957,12 +1959,12 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flT if (wFunc == FO_MOVE) { strTitle.LoadStringW(IDS_MOVEERRORTITLE); - strText.Format(IDS_MOVEERRORSUBFOLDER, feFrom->szFilename); + strText.Format(IDS_MOVEERRORSUBFOLDER, GET_FILENAME(feFrom)); } else { strTitle.LoadStringW(IDS_COPYERRORTITLE); - strText.Format(IDS_COPYERRORSUBFOLDER, feFrom->szFilename); + strText.Format(IDS_COPYERRORSUBFOLDER, GET_FILENAME(feFrom)); } MessageBoxW(hwnd, strText, strTitle, MB_ICONERROR); return DE_DESTSUBTREE;