1.1 --- a/GateKeeper.cpp Sat Nov 12 21:44:02 2016 +0100
1.2 +++ b/GateKeeper.cpp Sat Nov 12 21:52:41 2016 +0100
1.3 @@ -381,10 +381,15 @@
1.4 {
1.5 {
1.6 HANDLE hSemaphore = CreateSemaphore(NULL, 0, 2, _T("PEPINSTALLERSEMAPHORE"));
1.7 - if (GetLastError() != ERROR_SUCCESS)
1.8 + DWORD le = GetLastError();
1.9 + if (hSemaphore) {
1.10 + CloseHandle(hSemaphore);
1.11 + if (le == ERROR_ALREADY_EXISTS)
1.12 + return;
1.13 + }
1.14 + else {
1.15 return;
1.16 - else if (hSemaphore)
1.17 - CloseHandle(hSemaphore);
1.18 + }
1.19 }
1.20
1.21 BCRYPT_KEY_HANDLE dk = delivery_key();