Author: janderwald Date: Sun Aug 24 03:37:25 2008 New Revision: 35591
URL: http://svn.reactos.org/svn/reactos?rev=35591&view=rev Log: - 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
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.c... ============================================================================== --- trunk/reactos/dll/win32/shell32/control.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/control.c [iso-8859-1] Sun Aug 24 03:37:25 2008 @@ -348,21 +348,34 @@ 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; - - hMutex = CreateMutex(NULL, FALSE, (LPCTSTR) wszCmd); + 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); + 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;