dll: FspFileSystemRegister: handle the case where service already exists better

This commit is contained in:
Bill Zissimopoulos 2016-05-03 22:53:51 -07:00
parent 3f7ebe7996
commit a99e8ac9d2

View File

@ -411,14 +411,12 @@ NTSTATUS FspFileSystemRegister(VOID)
goto exit; goto exit;
} }
SvcHandle = OpenServiceW(ScmHandle, DriverName, DELETE); SvcHandle = OpenServiceW(ScmHandle, DriverName, SERVICE_CHANGE_CONFIG);
if (0 != SvcHandle) if (0 != SvcHandle)
{ ChangeServiceConfigW(SvcHandle,
DeleteService(SvcHandle); SERVICE_FILE_SYSTEM_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, DriverPath,
CloseServiceHandle(SvcHandle); 0, 0, 0, 0, 0, DriverName);
SvcHandle = 0; else
}
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,