mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-31 12:23:31 +00:00
- there can be only one instance of the device manager
svn path=/trunk/; revision=28905
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user