src/Helpers.c
static DWORD_PTR _SHGetFileInfoEx(LPCWSTR pszPath, DWORD dwFileAttributes,
  SHFILEINFO* psfi, UINT cbFileInfo, UINT uFlags)
{
  if (PathFileExists(pszPath))
  {
    DWORD_PTR dw = SHGetFileInfo(pszPath, dwFileAttributes, psfi, cbFileInfo, uFlags);
    if (StringCchLenW(psfi->szDisplayName, COUNTOF(psfi->szDisplayName)) < StringCchLen(PathFindFileName(pszPath), MAX_PATH))
      StringCchCat(psfi->szDisplayName, COUNTOF(psfi->szDisplayName), PathFindExtension(pszPath));
    return(dw);
  }

  DWORD_PTR dw = SHGetFileInfo(pszPath, FILE_ATTRIBUTE_NORMAL, psfi, cbFileInfo, uFlags | SHGFI_USEFILEATTRIBUTES);
  if (StringCchLenW(psfi->szDisplayName, COUNTOF(psfi->szDisplayName)) < StringCchLen(PathFindFileName(pszPath), MAX_PATH)) {
    StringCchCat(psfi->szDisplayName, COUNTOF(psfi->szDisplayName), PathFindExtension(pszPath));
  }
  return(dw);
}
//=============================================================================
//
//  _SHGetFileInfoEx()
//
//  Return a default name when the file has been removed, and always append
//  a filename extension
//
_SHGetFileInfoEx()
Return a default name when the file has been removed, and always append
a filename extension
_SHGetFileInfoEx () Return a default name when the file has been removed and always append a filename extension
static DWORD_PTR _SHGetFileInfoEx(LPCWSTR pszPath, DWORD dwFileAttributes,
  SHFILEINFO* psfi, UINT cbFileInfo, UINT uFlags)
{
  if (PathFileExists(pszPath))
  {
    DWORD_PTR dw = SHGetFileInfo(pszPath, dwFileAttributes, psfi, cbFileInfo, uFlags);
    if (StringCchLenW(psfi->szDisplayName, COUNTOF(psfi->szDisplayName)) < StringCchLen(PathFindFileName(pszPath), MAX_PATH))
      StringCchCat(psfi->szDisplayName, COUNTOF(psfi->szDisplayName), PathFindExtension(pszPath));
    return(dw);
  }
  DWORD_PTR dw = SHGetFileInfo(pszPath, FILE_ATTRIBUTE_NORMAL, psfi, cbFileInfo, uFlags | SHGFI_USEFILEATTRIBUTES);
  if (StringCchLenW(psfi->szDisplayName, COUNTOF(psfi->szDisplayName)) < StringCchLen(PathFindFileName(pszPath), MAX_PATH)) {
    StringCchCat(psfi->szDisplayName, COUNTOF(psfi->szDisplayName), PathFindExtension(pszPath));
  }
  return(dw);
}
static DWORD_PTR _SHGetFileInfoEx ( LPCWSTR pszPath , DWORD dwFileAttributes , SHFILEINFO * psfi , UINT cbFileInfo , UINT uFlags ) { if ( PathFileExists ( pszPath ) ) { DWORD_PTR dw = SHGetFileInfo ( pszPath , dwFileAttributes , psfi , cbFileInfo , uFlags ) ; if ( StringCchLenW ( psfi -> szDisplayName , COUNTOF ( psfi -> szDisplayName ) ) < StringCchLen ( PathFindFileName ( pszPath ) , MAX_PATH ) ) StringCchCat ( psfi -> szDisplayName , COUNTOF ( psfi -> szDisplayName ) , PathFindExtension ( pszPath ) ) ; return ( dw ) ; } DWORD_PTR dw = SHGetFileInfo ( pszPath , FILE_ATTRIBUTE_NORMAL , psfi , cbFileInfo , uFlags | SHGFI_USEFILEATTRIBUTES ) ; if ( StringCchLenW ( psfi -> szDisplayName , COUNTOF ( psfi -> szDisplayName ) ) < StringCchLen ( PathFindFileName ( pszPath ) , MAX_PATH ) ) { StringCchCat ( psfi -> szDisplayName , COUNTOF ( psfi -> szDisplayName ) , PathFindExtension ( pszPath ) ) ; } return ( dw ) ; }
_SHGetFileInfoEx()
Return a default name when the file has been removed, and always append
a filename extension
_SHGetFileInfoEx () Return a default name when the file has been removed and always append a filename extension