[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.
This commit is contained in:
Katayama Hirofumi MZ 2024-01-12 16:01:21 +09:00 committed by GitHub
parent f51258ae51
commit 4490a053d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;