https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6eb6aa289518b530f40b06...
commit 6eb6aa289518b530f40b065837d2bcf7506595e5 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Sun Aug 26 22:37:15 2018 +0900 Commit: Hermès BÉLUSCA - MAÏTO hermes.belusca-maito@reactos.org CommitDate: Sun Aug 26 15:37:15 2018 +0200
[SHELL32] Fix CShellLink::GetIconLocation (#810)
Fixes a regression from PR #784. CORE-14961, CORE-14009 --- dll/win32/shell32/CShellLink.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dll/win32/shell32/CShellLink.cpp b/dll/win32/shell32/CShellLink.cpp index 7efddc998e..67da3ed848 100644 --- a/dll/win32/shell32/CShellLink.cpp +++ b/dll/win32/shell32/CShellLink.cpp @@ -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) + { + hr = SHELL_PidlGetIconLocationW(m_pPidl, uFlags, pszIconFile, cchMax, piIndex, pwFlags); + } + else { - if (m_pPidl) - hr = SHELL_PidlGetIconLocationW(m_pPidl, uFlags, pszIconFile, cchMax, piIndex, pwFlags); + *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-transla... // 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) {