mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
- 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:
parent
5ed0e9015c
commit
72d7445528
1 changed files with 17 additions and 4 deletions
|
@ -348,21 +348,34 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
|
||||||
LPWSTR beg = NULL;
|
LPWSTR beg = NULL;
|
||||||
LPWSTR end;
|
LPWSTR end;
|
||||||
WCHAR ch;
|
WCHAR ch;
|
||||||
LPWSTR ptr;
|
LPWSTR ptr, ptr2;
|
||||||
|
WCHAR szName[MAX_PATH];
|
||||||
unsigned sp = 0;
|
unsigned sp = 0;
|
||||||
LPWSTR extraPmts = NULL;
|
LPWSTR extraPmts = NULL;
|
||||||
int quoted = 0;
|
int quoted = 0;
|
||||||
BOOL spSet = FALSE;
|
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))
|
if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
|
||||||
return;
|
return;
|
||||||
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
|
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
|
||||||
if (!buffer) return;
|
if (!buffer) return;
|
||||||
|
|
||||||
end = lstrcpyW(buffer, wszCmd);
|
end = lstrcpyW(buffer, wszCmd);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ch = *end;
|
ch = *end;
|
||||||
if (ch == '"') quoted = !quoted;
|
if (ch == '"') quoted = !quoted;
|
||||||
|
|
Loading…
Reference in a new issue