- 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
This commit is contained in:
Johannes Anderwald 2008-08-24 08:37:25 +00:00
parent 5ed0e9015c
commit 72d7445528

View file

@ -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;