Author: janderwald
Date: Mon Aug 25 16:02:21 2008
New Revision: 35643
URL:
http://svn.reactos.org/svn/reactos?rev=35643&view=rev
Log:
- 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
Modified:
trunk/reactos/dll/win32/shell32/control.c
trunk/reactos/dll/win32/shell32/shlexec.c
trunk/reactos/dll/win32/shell32/shv_def_cmenu.c
Modified: trunk/reactos/dll/win32/shell32/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/control.…
==============================================================================
--- trunk/reactos/dll/win32/shell32/control.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/control.c [iso-8859-1] Mon Aug 25 16:02:21 2008
@@ -427,12 +427,20 @@
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);
Modified: trunk/reactos/dll/win32/shell32/shlexec.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlexec.…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shlexec.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlexec.c [iso-8859-1] Mon Aug 25 16:02:21 2008
@@ -129,6 +129,7 @@
used++;
if (used < len)
*res++ = '"';
+ break;
}
else
{
@@ -146,7 +147,10 @@
}
break;
}
- /* else fall through */
+ else
+ {
+ break;
+ }
case '1':
if (!done || (*fmt == '1'))
{
Modified: trunk/reactos/dll/win32/shell32/shv_def_cmenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_def_…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shv_def_cmenu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shv_def_cmenu.c [iso-8859-1] Mon Aug 25 16:02:21 2008
@@ -1508,6 +1508,8 @@
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 @@
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;
}