[SHELL32] SHBrowseForFolder: Fix pszDisplayName (#6549)

pszDisplayName is for display name, not for full path.
JIRA issue: CORE-5866
- If lpBrowseInfo->pszDisplayName is valid,
  use SHGetFileInfoW to get display name.
- Don't use SHGetPathFromIDListW to get
  display name. It's wrong.
This commit is contained in:
Katayama Hirofumi MZ 2024-02-28 13:23:27 +09:00 committed by GitHub
parent d634ef54e4
commit 776c3a3495
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1052,7 +1052,19 @@ static BOOL BrsFolder_OnCommand( browse_info *info, UINT id )
info->pidlRet = _ILCreateDesktop();
pdump( info->pidlRet );
if (lpBrowseInfo->pszDisplayName)
#ifdef __REACTOS__
{
SHFILEINFOW fileInfo = { NULL };
lpBrowseInfo->pszDisplayName[0] = UNICODE_NULL;
if (SHGetFileInfoW((LPCWSTR)info->pidlRet, 0, &fileInfo, sizeof(fileInfo),
SHGFI_PIDL | SHGFI_DISPLAYNAME))
{
lstrcpynW(lpBrowseInfo->pszDisplayName, fileInfo.szDisplayName, MAX_PATH);
}
}
#else
SHGetPathFromIDListW( info->pidlRet, lpBrowseInfo->pszDisplayName );
#endif
EndDialog( info->hWnd, 1 );
return TRUE;