mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
- Prevent a crash by checking the applet name if it is empty and does exist
- %1 is used for file argument, where %2, %3, %n indicate the index of the passed param, %* is the rest of the command - Directly pass the full filename to ShellExecuteExW from the default context menu - Should fix executing cpl in default shellview svn path=/trunk/; revision=35643
This commit is contained in:
parent
d0e1f5701b
commit
909de8f972
|
@ -427,12 +427,20 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
|
|||
sp = 0;
|
||||
}
|
||||
|
||||
if ((extraPmts)&&(!spSet))
|
||||
if ((extraPmts) && extraPmts[0] &&(!spSet))
|
||||
{
|
||||
while ((lstrcmpiW(extraPmts, applet->info[sp].szName)) && (sp < applet->count))
|
||||
sp++;
|
||||
}
|
||||
|
||||
if (sp >= applet->count)
|
||||
{
|
||||
ReleaseMutex(hMutex);
|
||||
CloseHandle(hMutex);
|
||||
Control_UnloadApplet(applet);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (applet->info[sp].dwSize) {
|
||||
if (!applet->proc(applet->hWnd, CPL_STARTWPARMSA, sp, (LPARAM)extraPmts))
|
||||
applet->proc(applet->hWnd, CPL_DBLCLK, sp, applet->info[sp].lData);
|
||||
|
|
|
@ -129,6 +129,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
|
|||
used++;
|
||||
if (used < len)
|
||||
*res++ = '"';
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -146,7 +147,10 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
|
|||
}
|
||||
break;
|
||||
}
|
||||
/* else fall through */
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
case '1':
|
||||
if (!done || (*fmt == '1'))
|
||||
{
|
||||
|
|
|
@ -1508,6 +1508,8 @@ DoStaticShellExtensions(
|
|||
IDefaultContextMenuImpl *This,
|
||||
LPCMINVOKECOMMANDINFO lpcmi)
|
||||
{
|
||||
STRRET strFile;
|
||||
WCHAR szPath[MAX_PATH];
|
||||
SHELLEXECUTEINFOW sei;
|
||||
PStaticShellEntry pCurrent = This->shead;
|
||||
int verb = LOWORD(lpcmi->lpVerb) - This->iIdSCMFirst;
|
||||
|
@ -1520,16 +1522,25 @@ DoStaticShellExtensions(
|
|||
return E_FAIL;
|
||||
|
||||
|
||||
if (IShellFolder2_GetDisplayNameOf(This->dcm.psf, This->dcm.apidl[0], SHGDN_FORPARSING, &strFile) != S_OK)
|
||||
{
|
||||
ERR("IShellFolder_GetDisplayNameOf failed for apidl\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (StrRetToBufW(&strFile, This->dcm.apidl[0], szPath, MAX_PATH) != S_OK)
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
ZeroMemory(&sei, sizeof(sei));
|
||||
sei.cbSize = sizeof(sei);
|
||||
sei.fMask = SEE_MASK_CLASSNAME | SEE_MASK_IDLIST;
|
||||
sei.fMask = SEE_MASK_CLASSNAME;
|
||||
sei.lpClass = pCurrent->szClass;
|
||||
sei.hwnd = lpcmi->hwnd;
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpVerb = pCurrent->szVerb;
|
||||
sei.lpIDList = ILCombine(This->dcm.pidlFolder, This->dcm.apidl[0]);
|
||||
sei.lpFile = szPath;
|
||||
ShellExecuteExW(&sei);
|
||||
SHFree(sei.lpIDList);
|
||||
return S_OK;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue