mirror of
https://github.com/reactos/reactos.git
synced 2025-04-28 01:11:35 +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
1 changed files with 14 additions and 1 deletions
|
@ -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