https://git.reactos.org/?p=reactos.git;a=commitdiff;h=73798d2e71c23db0fb467f7c5d86a45ac23e343b

commit 73798d2e71c23db0fb467f7c5d86a45ac23e343b
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Tue Aug 21 20:49:32 2018 +0900
Commit:     Hermès BÉLUSCA - MAÏTO <[email protected]>
CommitDate: Tue Aug 21 13:49:32 2018 +0200

    [SHELL32] Enable to change shortcut icon (#784)
    
    CORE-11407
---
 dll/win32/shell32/CShellLink.cpp | 29 ++++-------------------------
 1 file changed, 4 insertions(+), 25 deletions(-)

diff --git a/dll/win32/shell32/CShellLink.cpp b/dll/win32/shell32/CShellLink.cpp
index 1bbb2e1111..7efddc998e 100644
--- a/dll/win32/shell32/CShellLink.cpp
+++ b/dll/win32/shell32/CShellLink.cpp
@@ -1739,36 +1739,14 @@ HRESULT STDMETHODCALLTYPE 
CShellLink::GetIconLocation(UINT uFlags, PWSTR pszIcon
      */
     uFlags |= GIL_FORSHORTCUT;
 
-    if (m_pPidl || m_sPath)
+    hr = GetIconLocation(pszIconFile, cchMax, piIndex);
+    if (FAILED(hr))
     {
-        /* first look for an icon using the PIDL (if present) */
         if (m_pPidl)
             hr = SHELL_PidlGetIconLocationW(m_pPidl, uFlags, pszIconFile, 
cchMax, piIndex, pwFlags);
-        else
-            hr = E_FAIL;
-
-#if 0 // FIXME: Analyse further whether this is needed...
-        /* if we couldn't find an icon yet, look for it using the file system 
path */
-        if (FAILED(hr) && m_sPath)
-        {
-            LPITEMIDLIST pidl;
-            CComPtr<IShellFolder> pdsk;
-
-            hr = SHGetDesktopFolder(&pdsk);
-
-            /* LPITEMIDLIST pidl = ILCreateFromPathW(sPath); */
-            hr = pdsk->ParseDisplayName(0, NULL, m_sPath, NULL, &pidl, NULL);
-            if (SUCCEEDED(hr))
-            {
-                hr = SHELL_PidlGetIconLocationW(pidl, uFlags, pszIconFile, 
cchMax, piIndex, pwFlags);
-                SHFree(pidl);
-            }
-        }
-#endif
-        return hr;
     }
 
-    return S_OK;
+    return hr;
 }
 
 HRESULT STDMETHODCALLTYPE
@@ -2967,6 +2945,7 @@ LRESULT CShellLink::OnNotify(HWND hwndDlg, int idFrom, 
LPNMHDR pnmhdr)
 
         TRACE("This %p m_sLinkPath %S\n", this, m_sLinkPath);
         Save(m_sLinkPath, TRUE);
+        SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATHW, m_sLinkPath, NULL);
         SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
         return TRUE;
     }

Reply via email to