Index: dll/win32/shell32/shelllink.cpp =================================================================== --- dll/win32/shell32/shelllink.cpp (revision 59552) +++ dll/win32/shell32/shelllink.cpp (working copy) @@ -74,6 +74,43 @@ #include "poppack.h" +/************************************************************************** +* SH_GetTargetTypeByPath +* +* Function to get target type by passing full path to it +*/ +LPWSTR SH_GetTargetTypeByPath(LPCWSTR lpcwFullPath) +{ + LPCWSTR pwszExt; + static WCHAR wszBuf[MAX_PATH]; + + /* Get file information */ + SHFILEINFO fi; + if (!SHGetFileInfoW(lpcwFullPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES )) + { + ERR("SHGetFileInfoW failed for %ls (%lu)\n", lpcwFullPath, GetLastError()); + fi.szTypeName[0] = L'\0'; + fi.hIcon = NULL; + } + + pwszExt = PathFindExtensionW(lpcwFullPath); + if (pwszExt[0]) + { + if (!fi.szTypeName[0]) + { + /* The file type is unknown, so default to string "FileExtension File" */ + size_t cchRemaining = 0; + LPWSTR pwszEnd = NULL; + + StringCchPrintfExW(wszBuf, _countof(wszBuf), &pwszEnd, &cchRemaining, 0, L"%s ", pwszExt + 1); + } + else + StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s (%s)", fi.szTypeName, pwszExt); /* Update file type */ + } + + return wszBuf; +} + /* IShellLink Implementation */ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWorkDir, LPWSTR* psPath); @@ -1947,6 +1984,10 @@ else ERR("ExtractIconW failed %ls %u\n", pThis->sIcoPath, pThis->iIcoNdx); + /* target type */ + if (pThis->sPath) + SetDlgItemTextW(hwndDlg, 14005, SH_GetTargetTypeByPath(pThis->sPath)); + /* target location */ if (pThis->sWorkDir) SetDlgItemTextW(hwndDlg, 14007, PathFindFileName(pThis->sWorkDir));