diff options
Diffstat (limited to 'api/namespace.c')
-rw-r--r-- | api/namespace.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/api/namespace.c b/api/namespace.c index 9258b53..7f6959b 100644 --- a/api/namespace.c +++ b/api/namespace.c @@ -102,7 +102,7 @@ cleanupLeaveCriticalSection: _Check_return_ HANDLE -NamespaceTakeMutex(_In_z_ const WCHAR *Pool) +NamespaceTakePoolMutex(_In_z_ const WCHAR *Pool) { HANDLE Mutex = NULL; @@ -147,6 +147,30 @@ cleanupSha256: return Mutex; } +_Check_return_ +HANDLE +NamespaceTakeDriverInstallationMutex(void) +{ + HANDLE Mutex = NULL; + + if (NamespaceRuntimeInit() != ERROR_SUCCESS) + return NULL; + Mutex = CreateMutexW(&SecurityAttributes, FALSE, L"Wintun\\Wintun-Driver-Installation-Mutex"); + if (!Mutex) + return NULL; + switch (WaitForSingleObject(Mutex, INFINITE)) + { + case WAIT_OBJECT_0: + case WAIT_ABANDONED: + goto out; + } + + CloseHandle(Mutex); + Mutex = NULL; +out: + return Mutex; +} + void NamespaceReleaseMutex(_In_ HANDLE Mutex) { |