mirror of
https://github.com/reactos/reactos.git
synced 2024-09-06 02:37:06 +00:00
- there can be only one instance of the device manager
svn path=/trunk/; revision=28905
This commit is contained in:
parent
ac5a5581cd
commit
58f165a052
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue