From f952d12c8da9fa92e9dfc03b3499f537ef4a93a0 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Tue, 13 May 2008 08:56:23 +0000 Subject: [PATCH] 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 --- reactos/dll/win32/shell32/control.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/dll/win32/shell32/control.c b/reactos/dll/win32/shell32/control.c index b495f86403c..293259a2ee3 100644 --- a/reactos/dll/win32/shell32/control.c +++ b/reactos/dll/win32/shell32/control.c @@ -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); } -- 2.17.1