From 72d7445528df6dba764a84f8e84e4aa40c5c448a Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 24 Aug 2008 08:37:25 +0000 Subject: [PATCH] - Use the name of the cpl as the mutex name - The mutex name is a unicode buffer, pass it to CreateMutexW function - fixes bug 3489 svn path=/trunk/; revision=35591 --- reactos/dll/win32/shell32/control.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/shell32/control.c b/reactos/dll/win32/shell32/control.c index cd3241b7d7b..34bae718d72 100644 --- a/reactos/dll/win32/shell32/control.c +++ b/reactos/dll/win32/shell32/control.c @@ -348,21 +348,34 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd) LPWSTR beg = NULL; LPWSTR end; WCHAR ch; - LPWSTR ptr; + LPWSTR ptr, ptr2; + WCHAR szName[MAX_PATH]; unsigned sp = 0; LPWSTR extraPmts = NULL; int quoted = 0; BOOL spSet = FALSE; - HANDLE hMutex; + HANDLE hMutex; + UINT Length; + + ptr = wcsrchr(wszCmd, L'\\'); + ptr2 = wcsrchr(wszCmd, L','); + if (!ptr || !ptr2) + return; + + Length = (ptr2 - ptr - 1); + if (Length >= MAX_PATH) + return; + + memcpy(szName, ptr + 1, Length * sizeof(WCHAR)); + szName[Length] = L'\0'; + hMutex = CreateMutexW(NULL, FALSE, szName); - hMutex = CreateMutex(NULL, FALSE, (LPCTSTR) wszCmd); if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS)) return; buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd)); if (!buffer) return; end = lstrcpyW(buffer, wszCmd); - for (;;) { ch = *end; if (ch == '"') quoted = !quoted;