mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
dll: FspFileSystemRegister: handle the case where service already exists better
This commit is contained in:
parent
3f7ebe7996
commit
a99e8ac9d2
20
src/dll/fs.c
20
src/dll/fs.c
@ -411,18 +411,16 @@ NTSTATUS FspFileSystemRegister(VOID)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
SvcHandle = OpenServiceW(ScmHandle, DriverName, DELETE);
|
||||
SvcHandle = OpenServiceW(ScmHandle, DriverName, SERVICE_CHANGE_CONFIG);
|
||||
if (0 != SvcHandle)
|
||||
{
|
||||
DeleteService(SvcHandle);
|
||||
CloseServiceHandle(SvcHandle);
|
||||
SvcHandle = 0;
|
||||
}
|
||||
|
||||
SvcHandle = CreateServiceW(ScmHandle, DriverName, DriverName,
|
||||
SERVICE_CHANGE_CONFIG,
|
||||
SERVICE_FILE_SYSTEM_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, DriverPath,
|
||||
0, 0, 0, 0, 0);
|
||||
ChangeServiceConfigW(SvcHandle,
|
||||
SERVICE_FILE_SYSTEM_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, DriverPath,
|
||||
0, 0, 0, 0, 0, DriverName);
|
||||
else
|
||||
SvcHandle = CreateServiceW(ScmHandle, DriverName, DriverName,
|
||||
SERVICE_CHANGE_CONFIG,
|
||||
SERVICE_FILE_SYSTEM_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, DriverPath,
|
||||
0, 0, 0, 0, 0);
|
||||
if (0 == SvcHandle)
|
||||
{
|
||||
Result = FspNtStatusFromWin32(GetLastError());
|
||||
|
Loading…
x
Reference in New Issue
Block a user