Author: janderwald
Date: Mon Aug 25 02:54:19 2008
New Revision: 35624
URL:
http://svn.reactos.org/svn/reactos?rev=35624&view=rev
Log:
- Partly fix launching control panel applets
Modified:
trunk/reactos/dll/win32/shell32/control.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 02:54:19 2008
@@ -348,7 +348,7 @@
LPWSTR beg = NULL;
LPWSTR end;
WCHAR ch;
- LPWSTR ptr, ptr2;
+ LPCWSTR ptr, ptr2;
WCHAR szName[MAX_PATH];
unsigned sp = 0;
LPWSTR extraPmts = NULL;
@@ -359,22 +359,32 @@
ptr = wcsrchr(wszCmd, L'\\');
ptr2 = wcsrchr(wszCmd, L',');
- if (!ptr || !ptr2)
- return;
-
- Length = (ptr2 - ptr - 1);
+ if (!ptr2)
+ {
+ ptr2 = wszCmd + wcslen(wszCmd) + 1;
+ }
+
+ if (ptr)
+ ptr++;
+ else
+ ptr = wszCmd;
+
+ Length = (ptr2 - ptr);
if (Length >= MAX_PATH)
return;
- memcpy(szName, ptr + 1, Length * sizeof(WCHAR));
+ memcpy(szName, (LPVOID)ptr, Length * sizeof(WCHAR));
szName[Length] = L'\0';
hMutex = CreateMutexW(NULL, FALSE, szName);
if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
return;
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
- if (!buffer) return;
-
+ if (!buffer)
+ {
+ CloseHandle(hMutex);
+ return;
+ }
end = lstrcpyW(buffer, wszCmd);
for (;;) {
ch = *end;
@@ -399,10 +409,10 @@
end++;
}
while ((ptr = StrChrW(buffer, '"')))
- memmove(ptr, ptr+1, lstrlenW(ptr)*sizeof(WCHAR));
+ memmove((LPVOID)ptr, ptr+1, lstrlenW(ptr)*sizeof(WCHAR));
while ((ptr = StrChrW(extraPmts, '"')))
- memmove(ptr, ptr+1, lstrlenW(ptr)*sizeof(WCHAR));
+ memmove((LPVOID)ptr, ptr+1, lstrlenW(ptr)*sizeof(WCHAR));
TRACE("cmd %s, extra %s, sp %d\n", debugstr_w(buffer),
debugstr_w(extraPmts), sp);