mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-08 04:52:10 -05:00
dll: FspFsctlStartService:make thread safe
This commit is contained in:
parent
a372c6ee40
commit
2d5d058d2f
@ -254,6 +254,7 @@ FSP_API NTSTATUS FspFsctlPreflight(PWSTR DevicePath)
|
|||||||
|
|
||||||
static NTSTATUS FspFsctlStartService(VOID)
|
static NTSTATUS FspFsctlStartService(VOID)
|
||||||
{
|
{
|
||||||
|
static SRWLOCK Lock = SRWLOCK_INIT;
|
||||||
PWSTR DriverName = L"" FSP_FSCTL_DRIVER_NAME;
|
PWSTR DriverName = L"" FSP_FSCTL_DRIVER_NAME;
|
||||||
SC_HANDLE ScmHandle = 0;
|
SC_HANDLE ScmHandle = 0;
|
||||||
SC_HANDLE SvcHandle = 0;
|
SC_HANDLE SvcHandle = 0;
|
||||||
@ -261,6 +262,8 @@ static NTSTATUS FspFsctlStartService(VOID)
|
|||||||
DWORD LastError;
|
DWORD LastError;
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
|
||||||
|
AcquireSRWLockExclusive(&Lock);
|
||||||
|
|
||||||
/* Determine if we are running inside container.
|
/* Determine if we are running inside container.
|
||||||
*
|
*
|
||||||
* See https://github.com/microsoft/perfview/blob/V1.9.65/src/TraceEvent/TraceEventSession.cs#L525
|
* See https://github.com/microsoft/perfview/blob/V1.9.65/src/TraceEvent/TraceEventSession.cs#L525
|
||||||
@ -331,6 +334,8 @@ exit:
|
|||||||
if (0 != ScmHandle)
|
if (0 != ScmHandle)
|
||||||
CloseServiceHandle(ScmHandle);
|
CloseServiceHandle(ScmHandle);
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive(&Lock);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user