Use a Mutex, so that CPL applets cannot be launched multiple times.

Fixes bug #781 partly, we still need a fix in "control.exe" (see my comment in the bug report)

svn path=/trunk/; revision=33492
This commit is contained in:
Colin Finck 2008-05-13 08:56:23 +00:00
parent 7bcc8fccde
commit f952d12c8d

View file

@ -353,7 +353,11 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
LPWSTR extraPmts = NULL;
int quoted = 0;
BOOL spSet = FALSE;
HANDLE hMutex;
hMutex = CreateMutex(NULL, FALSE, (LPCTSTR) wszCmd);
if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
return NULL;
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
if (!buffer) return;
@ -412,6 +416,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
}
Control_UnloadApplet(applet);
}
ReleaseMutex(hMutex);
HeapFree(GetProcessHeap(), 0, buffer);
}