mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[SHELL32] Fix CShellLink::GetIconLocation (#810)
Fixes a regression from PR #784. CORE-14961, CORE-14009
This commit is contained in:
parent
0cf5efc14c
commit
6eb6aa2895
1 changed files with 14 additions and 4 deletions
|
@ -1721,6 +1721,9 @@ static HRESULT SHELL_PidlGetIconLocationW(PCIDLIST_ABSOLUTE pidl,
|
|||
HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(UINT uFlags, PWSTR pszIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
pszIconFile[0] = UNICODE_NULL;
|
||||
|
||||
/*
|
||||
* It is possible for a shell link to point to another shell link,
|
||||
* and in particular there is the possibility to point to itself.
|
||||
|
@ -1739,11 +1742,17 @@ HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(UINT uFlags, PWSTR pszIcon
|
|||
*/
|
||||
uFlags |= GIL_FORSHORTCUT;
|
||||
|
||||
if (uFlags & GIL_DEFAULTICON)
|
||||
return E_FAIL;
|
||||
|
||||
hr = GetIconLocation(pszIconFile, cchMax, piIndex);
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr) || pszIconFile[0] == UNICODE_NULL)
|
||||
{
|
||||
if (m_pPidl)
|
||||
hr = SHELL_PidlGetIconLocationW(m_pPidl, uFlags, pszIconFile, cchMax, piIndex, pwFlags);
|
||||
hr = SHELL_PidlGetIconLocationW(m_pPidl, uFlags, pszIconFile, cchMax, piIndex, pwFlags);
|
||||
}
|
||||
else
|
||||
{
|
||||
*pwFlags = GIL_NOTFILENAME | GIL_PERCLASS;
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
@ -1888,13 +1897,14 @@ HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT i
|
|||
*/
|
||||
// FIXME: http://stackoverflow.com/questions/2976489/ishelllinkseticonlocation-translates-my-icon-path-into-program-files-which-i
|
||||
// if (PathFullyUnExpandEnvStringsW(pszIconPath, szUnExpIconPath, _countof(szUnExpIconPath)))
|
||||
SHExpandEnvironmentStringsW(pszIconPath, szUnExpIconPath, _countof(szUnExpIconPath));
|
||||
PathUnExpandEnvStringsW(pszIconPath, szUnExpIconPath, _countof(szUnExpIconPath));
|
||||
if (wcscmp(pszIconPath, szUnExpIconPath) != 0)
|
||||
{
|
||||
/* Unexpansion succeeded, so we need an icon environment block */
|
||||
EXP_SZ_LINK buffer;
|
||||
LPEXP_SZ_LINK pInfo;
|
||||
|
||||
pszIconPath = szUnExpIconPath;
|
||||
pInfo = (LPEXP_SZ_LINK)SHFindDataBlock(m_pDBList, EXP_SZ_ICON_SIG);
|
||||
if (pInfo)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue