Panoptes
1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
src
service
src
mutex.cpp
Go to the documentation of this file.
1
#include "
mutex.hpp
"
2
3
HANDLE
g_mutex
;
4
5
ERRORCODE
SetEnvironmentMutex
() {
6
g_mutex
= CreateMutexA(
7
NULL,
8
FALSE,
9
SERVICE_MUTEX
10
);
11
if
(
g_mutex
== NULL)
12
{
13
return
INVALID_INPUT
;
14
}
15
16
return
PANO_SUCCESS
;
17
}
18
19
ERRORCODE
MutexExist
() {
20
g_mutex
= OpenMutexA(
21
SYNCHRONIZE,
// Request full access
22
FALSE,
// Do not inherit handle
23
SERVICE_MUTEX
// Name of the mutex
24
);
25
if
(
g_mutex
== NULL)
26
{
27
return
MUTEX_NOT_SET
;
28
}
29
30
return
PANO_SUCCESS
;
31
}
32
33
ERRORCODE
DestroyMutex
() {
34
if
(!ReleaseMutex(
g_mutex
))
35
return
CLEAN_HANDLE
;
36
37
return
PANO_SUCCESS
;
38
}
PANO_SUCCESS
#define PANO_SUCCESS
Definition
ResourceCore.h:11
INVALID_INPUT
#define INVALID_INPUT
Definition
ResourceCore.h:14
CLEAN_HANDLE
#define CLEAN_HANDLE
Definition
ResourceCore.h:32
MUTEX_NOT_SET
#define MUTEX_NOT_SET
Definition
ResourceCore.h:15
DestroyMutex
ERRORCODE DestroyMutex()
Definition
mutex.cpp:33
g_mutex
HANDLE g_mutex
Definition
mutex.cpp:3
SetEnvironmentMutex
ERRORCODE SetEnvironmentMutex()
Definition
mutex.cpp:5
MutexExist
ERRORCODE MutexExist()
Definition
mutex.cpp:19
mutex.hpp
ERRORCODE
#define ERRORCODE
Definition
service_constants.h:25
SERVICE_MUTEX
#define SERVICE_MUTEX
Definition
service_constants.h:10
Generated by
1.9.8