mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -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 SRWLOCK Lock = SRWLOCK_INIT;
|
||||
PWSTR DriverName = L"" FSP_FSCTL_DRIVER_NAME;
|
||||
SC_HANDLE ScmHandle = 0;
|
||||
SC_HANDLE SvcHandle = 0;
|
||||
@ -261,6 +262,8 @@ static NTSTATUS FspFsctlStartService(VOID)
|
||||
DWORD LastError;
|
||||
NTSTATUS Result;
|
||||
|
||||
AcquireSRWLockExclusive(&Lock);
|
||||
|
||||
/* Determine if we are running inside container.
|
||||
*
|
||||
* See https://github.com/microsoft/perfview/blob/V1.9.65/src/TraceEvent/TraceEventSession.cs#L525
|
||||
@ -331,6 +334,8 @@ exit:
|
||||
if (0 != ScmHandle)
|
||||
CloseServiceHandle(ScmHandle);
|
||||
|
||||
ReleaseSRWLockExclusive(&Lock);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user