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

commit f335322ace05590c3edc74de58f90ee070307c5a
Author:     Whindmar Saksit <whinds...@proton.me>
AuthorDate: Fri Jan 31 21:15:13 2025 +0100
Commit:     GitHub <nore...@github.com>
CommitDate: Fri Jan 31 21:15:13 2025 +0100

    [SHELL32] SEE_MASK_IDLIST should not assume the PIDL is always a FS path 
(#7693)
    
    CORE-16898 CORE-14177
---
 dll/win32/shell32/shlexec.cpp | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/dll/win32/shell32/shlexec.cpp b/dll/win32/shell32/shlexec.cpp
index 371f6ad44eb..9e3af71a27f 100644
--- a/dll/win32/shell32/shlexec.cpp
+++ b/dll/win32/shell32/shlexec.cpp
@@ -2076,10 +2076,10 @@ static BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, 
SHELL_ExecuteW32 execfunc)
     if (sei_tmp.fMask & SEE_MASK_IDLIST &&
         (sei_tmp.fMask & SEE_MASK_INVOKEIDLIST) != SEE_MASK_INVOKEIDLIST)
     {
-        CComPtr<IShellExecuteHookW> pSEH;
-
-        HRESULT hr = SHBindToParent((LPCITEMIDLIST)sei_tmp.lpIDList, 
IID_PPV_ARG(IShellExecuteHookW, &pSEH), NULL);
+        LPCITEMIDLIST pidl = (LPCITEMIDLIST)sei_tmp.lpIDList;
 
+        CComPtr<IShellExecuteHookW> pSEH;
+        HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellExecuteHookW, 
&pSEH), NULL);
         if (SUCCEEDED(hr))
         {
             hr = pSEH->Execute(&sei_tmp);
@@ -2087,7 +2087,14 @@ static BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, 
SHELL_ExecuteW32 execfunc)
                 return TRUE;
         }
 
-        SHGetPathFromIDListW((LPCITEMIDLIST)sei_tmp.lpIDList, 
wszApplicationName);
+        hr = SHGetNameAndFlagsW(pidl, SHGDN_FORPARSING, wszApplicationName, 
dwApplicationNameLen, NULL);
+        if (FAILED(hr))
+        {
+            if (dwApplicationNameLen)
+                *wszApplicationName = UNICODE_NULL;
+            if (!_ILIsDesktop(pidl))
+                TRACE("Unable to get PIDL parsing path\n");
+        }
         appKnownSingular = TRUE;
         TRACE("-- idlist=%p (%s)\n", sei_tmp.lpIDList, 
debugstr_w(wszApplicationName));
     }

Reply via email to