mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
dll: FspFileSystemRegister: now will correctly recreate the WinFsp service if it already exists
This commit is contained in:
parent
500db7b1cd
commit
690e7662d6
15
src/dll/fs.c
15
src/dll/fs.c
@ -383,7 +383,6 @@ NTSTATUS FspFileSystemRegister(VOID)
|
|||||||
SC_HANDLE SvcHandle = 0;
|
SC_HANDLE SvcHandle = 0;
|
||||||
PVOID VersionInfo = 0;
|
PVOID VersionInfo = 0;
|
||||||
SERVICE_DESCRIPTION ServiceDescription;
|
SERVICE_DESCRIPTION ServiceDescription;
|
||||||
DWORD LastError;
|
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
|
||||||
if (0 == GetModuleFileNameW(DllInstance, DriverPath, MAX_PATH))
|
if (0 == GetModuleFileNameW(DllInstance, DriverPath, MAX_PATH))
|
||||||
@ -412,17 +411,21 @@ NTSTATUS FspFileSystemRegister(VOID)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SvcHandle = OpenServiceW(ScmHandle, DriverName, DELETE);
|
||||||
|
if (0 != SvcHandle)
|
||||||
|
{
|
||||||
|
DeleteService(SvcHandle);
|
||||||
|
CloseServiceHandle(SvcHandle);
|
||||||
|
SvcHandle = 0;
|
||||||
|
}
|
||||||
|
|
||||||
SvcHandle = CreateServiceW(ScmHandle, DriverName, DriverName,
|
SvcHandle = CreateServiceW(ScmHandle, DriverName, DriverName,
|
||||||
SERVICE_CHANGE_CONFIG,
|
SERVICE_CHANGE_CONFIG,
|
||||||
SERVICE_FILE_SYSTEM_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, DriverPath,
|
SERVICE_FILE_SYSTEM_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, DriverPath,
|
||||||
0, 0, 0, 0, 0);
|
0, 0, 0, 0, 0);
|
||||||
if (0 == SvcHandle)
|
if (0 == SvcHandle)
|
||||||
{
|
{
|
||||||
LastError = GetLastError();
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
if (ERROR_SERVICE_EXISTS != LastError && ERROR_DUPLICATE_SERVICE_NAME != LastError)
|
|
||||||
Result = FspNtStatusFromWin32(LastError);
|
|
||||||
else
|
|
||||||
Result = STATUS_SUCCESS;
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user