Author: janderwald Date: Thu Sep 6 23:45:26 2007 New Revision: 28905
URL: http://svn.reactos.org/svn/reactos?rev=28905&view=rev Log: - there can be only one instance of the device manager
Modified: trunk/reactos/base/applications/mscutils/devmgmt/devmgmt.c
Modified: trunk/reactos/base/applications/mscutils/devmgmt/devmgmt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/... ============================================================================== --- trunk/reactos/base/applications/mscutils/devmgmt/devmgmt.c (original) +++ trunk/reactos/base/applications/mscutils/devmgmt/devmgmt.c Thu Sep 6 23:45:26 2007 @@ -11,6 +11,7 @@
HINSTANCE hInstance; HANDLE ProcessHeap; +HANDLE hMutex;
int WINAPI _tWinMain(HINSTANCE hThisInstance, @@ -23,6 +24,18 @@ MSG Msg; int Ret = 1; INITCOMMONCONTROLSEX icex; + + hMutex = CreateMutex(NULL, TRUE, _T("devmgmt_mutex")); + if (hMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS) + { + if (hMutex) + { + CloseHandle(hMutex); + } + return 0; + } + +
hInstance = hThisInstance; ProcessHeap = GetProcessHeap(); @@ -59,7 +72,7 @@ }
LocalFree((HLOCAL)lpAppName); - + CloseHandle(hMutex); return Ret; }