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) { + LPCITEMIDLIST pidl = (LPCITEMIDLIST)sei_tmp.lpIDList; + CComPtr pSEH; - - HRESULT hr = SHBindToParent((LPCITEMIDLIST)sei_tmp.lpIDList, IID_PPV_ARG(IShellExecuteHookW, &pSEH), NULL); - + 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)); }