[ros-diffs] [cfinck] 33492: 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)

cfinck at svn.reactos.org cfinck at svn.reactos.org
Tue May 13 10:56:24 CEST 2008


Author: cfinck
Date: Tue May 13 03:56:23 2008
New Revision: 33492

URL: http://svn.reactos.org/svn/reactos?rev=33492&view=rev
Log:
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)

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?rev=33492&r1=33491&r2=33492&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/control.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/control.c [iso-8859-1] Tue May 13 03:56:23 2008
@@ -353,7 +353,11 @@
     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 @@
        }
        Control_UnloadApplet(applet);
     }
+	ReleaseMutex(hMutex);
     HeapFree(GetProcessHeap(), 0, buffer);
 }
 



More information about the Ros-diffs mailing list