Author: hbelusca
Date: Fri Feb 20 02:05:46 2015
New Revision: 66361
URL:
http://svn.reactos.org/svn/reactos?rev=66361&view=rev
Log:
[SHELL32]: Partial sync:
SHA-1: a08160680be1a3164e882fcc41504f115ba62f12
* shell32: Automatically expand CPL applet path string.
(Hermès Bélusca-Maïto)
Modified:
trunk/reactos/dll/win32/shell32/wine/control.c
Modified: trunk/reactos/dll/win32/shell32/wine/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/wine/con…
==============================================================================
--- trunk/reactos/dll/win32/shell32/wine/control.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/wine/control.c [iso-8859-1] Fri Feb 20 02:05:46 2015
@@ -49,6 +49,7 @@
FreeLibrary(applet->hModule);
next = applet->next;
+ HeapFree(GetProcessHeap(), 0, applet->cmd);
HeapFree(GetProcessHeap(), 0, applet);
return next;
}
@@ -56,6 +57,7 @@
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
{
CPlApplet* applet;
+ DWORD len;
unsigned i;
CPLINFO info;
NEWCPLINFOW newinfo;
@@ -63,16 +65,32 @@
if (!(applet = (CPlApplet *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*applet))))
return applet;
+ len = ExpandEnvironmentStringsW(cmd, NULL, 0);
+ if (len > 0)
+ {
+ if (!(applet->cmd = HeapAlloc(GetProcessHeap(), 0, (len+1) * sizeof(WCHAR))))
+ {
+ WARN("Cannot allocate memory for applet path\n");
+ goto theError;
+ }
+ ExpandEnvironmentStringsW(cmd, applet->cmd, len+1);
+ }
+ else
+ {
+ WARN("Cannot expand applet path\n");
+ goto theError;
+ }
+
applet->hWnd = hWnd;
- if (!(applet->hModule = LoadLibraryW(cmd)))
- {
- WARN("Cannot load control panel applet %s\n", debugstr_w(cmd));
+ if (!(applet->hModule = LoadLibraryW(applet->cmd)))
+ {
+ WARN("Cannot load control panel applet %s\n",
debugstr_w(applet->cmd));
goto theError;
}
if (!(applet->proc = (APPLET_PROC)GetProcAddress(applet->hModule,
"CPlApplet")))
{
- WARN("Not a valid control panel applet %s\n", debugstr_w(cmd));
+ WARN("Not a valid control panel applet %s\n",
debugstr_w(applet->cmd));
goto theError;
}
if (!applet->proc(hWnd, CPL_INIT, 0L, 0L))
@@ -155,9 +173,9 @@
panel->hWnd = hWnd;
}
-#define XICON 32
+#define XICON 32
#define XSTEP 128
-#define YICON 32
+#define YICON 32
#define YSTEP 64
static BOOL Control_Localize(const CPanel* panel, int cx, int cy,