mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
[shell32]
- Implement showing the target type in shortcut properties dialog - Patch by Edijs Kolesnikovics - See CORE-7366 svn path=/trunk/; revision=62143
This commit is contained in:
parent
4a41022ab9
commit
e32e2b13ef
1 changed files with 41 additions and 0 deletions
|
@ -76,6 +76,43 @@ struct volume_info
|
|||
|
||||
#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);
|
||||
|
@ -1949,6 +1986,10 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
|||
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));
|
||||
|
|
Loading…
Reference in a new issue