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

commit 93fac5533d377e86f65cb4c3ad2abe6ef44ea1a0
Author:     Mark Jansen <[email protected]>
AuthorDate: Thu Feb 3 23:22:37 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Mon Feb 7 20:56:46 2022 +0100

    [SHELL32] ShellExecute: Retry after searching for the file in the 
SEE_MASK_INVOKEIDLIST case
    
    CORE-18035
---
 dll/win32/shell32/shlexec.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/dll/win32/shell32/shlexec.cpp b/dll/win32/shell32/shlexec.cpp
index 7cfc0021470..a3a4a05a2c3 100644
--- a/dll/win32/shell32/shlexec.cpp
+++ b/dll/win32/shell32/shlexec.cpp
@@ -1486,7 +1486,18 @@ static HRESULT 
shellex_get_contextmenu(LPSHELLEXECUTEINFOW sei, CComPtr<IContext
         SFGAOF sfga = 0;
         HRESULT hr = SHParseDisplayName(sei->lpFile, NULL, &allocatedPidl, 
SFGAO_STORAGECAPMASK, &sfga);
         if (FAILED(hr))
-            return hr;
+        {
+            WCHAR Buffer[MAX_PATH] = {};
+            // FIXME: MAX_PATH.....
+            UINT retval = SHELL_FindExecutable(sei->lpDirectory, sei->lpFile, 
sei->lpVerb, Buffer, _countof(Buffer), NULL, NULL, NULL, sei->lpParameters);
+            if (retval <= 32)
+                return HRESULT_FROM_WIN32(retval);
+
+            hr = SHParseDisplayName(Buffer, NULL, &allocatedPidl, 
SFGAO_STORAGECAPMASK, &sfga);
+            // This should not happen, we found it...
+            if (FAILED_UNEXPECTEDLY(hr))
+                return hr;
+        }
 
         pidl = allocatedPidl;
     }

Reply via email to