dlls/shell32/cpanelfolder.c - extended

Ge van Geldorp gvg at reactos.com
Wed Feb 9 02:50:23 CST 2005


Now with "Wine-style" initialization of wide string

Changelog:
  Ge van Geldorp <gvg at reactos.com>
  - Fix quoting of .cpl filename
  - Use "cplopen" verb to execute .cpl files

Index: dlls/shell32/cpanelfolder.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/cpanelfolder.c,v
retrieving revision 1.12
diff -u -r1.12 cpanelfolder.c
--- dlls/shell32/cpanelfolder.c	14 Jan 2005 16:02:20 -0000	1.12
+++ dlls/shell32/cpanelfolder.c	9 Feb 2005 08:47:32 -0000
@@ -964,6 +964,7 @@
 
 static HRESULT WINAPI IShellExecuteHookW_fnExecute(IShellExecuteHookW* iface, LPSHELLEXECUTEINFOW psei)
 {
+    static const WCHAR wCplopen[] = {'c','p','l','o','p','e','n','\0'};
     ICPanelImpl *This = (ICPanelImpl *)iface;
 
     SHELLEXECUTEINFOW sei_tmp;
@@ -983,17 +984,20 @@
 	return E_INVALIDARG;
 
     path[0] = '\"';
-    l = 1 + MultiByteToWideChar(CP_ACP, 0, pcpanel->szName, -1, path+1, MAX_PATH);
+    /* Return value from MultiByteToWideChar includes terminating NUL, which
+     * compensates for the starting double quote we just put in */
+    l = MultiByteToWideChar(CP_ACP, 0, pcpanel->szName, -1, path+1, MAX_PATH);
 
     /* pass applet name to Control_RunDLL to distinguish between applets in one .cpl file */
-    path[++l] = '"';
-    path[++l] = ' ';
+    path[l++] = '"';
+    path[l++] = ' ';
 
     MultiByteToWideChar(CP_ACP, 0, pcpanel->szName+pcpanel->offsDispName, -1, path+l, MAX_PATH);
 
     memcpy(&sei_tmp, psei, sizeof(sei_tmp));
     sei_tmp.lpFile = path;
     sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
+    sei_tmp.lpVerb = wCplopen;
 
     ret = ShellExecuteExW(&sei_tmp);
     if (ret)



More information about the wine-patches mailing list