From 58f165a05217e8712d19e2197e24eeaebda693e7 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Thu, 6 Sep 2007 19:45:26 +0000 Subject: [PATCH] - there can be only one instance of the device manager svn path=/trunk/; revision=28905 --- .../base/applications/mscutils/devmgmt/devmgmt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/reactos/base/applications/mscutils/devmgmt/devmgmt.c b/reactos/base/applications/mscutils/devmgmt/devmgmt.c index e1b6e7ff959..96424dcaafd 100644 --- a/reactos/base/applications/mscutils/devmgmt/devmgmt.c +++ b/reactos/base/applications/mscutils/devmgmt/devmgmt.c @@ -11,6 +11,7 @@ HINSTANCE hInstance; HANDLE ProcessHeap; +HANDLE hMutex; int WINAPI _tWinMain(HINSTANCE hThisInstance, @@ -24,6 +25,18 @@ _tWinMain(HINSTANCE hThisInstance, 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 @@ _tWinMain(HINSTANCE hThisInstance, } LocalFree((HLOCAL)lpAppName); - + CloseHandle(hMutex); return Ret; }