mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
dll: FspFsctlStartService: fix bug in non-SxS mode
This commit is contained in:
parent
8e0f5b457c
commit
1723179430
@ -524,10 +524,9 @@ exit:
|
|||||||
|
|
||||||
static VOID FspFsctlStartService_EnumFn(PVOID Context, PWSTR ServiceName, BOOLEAN Running)
|
static VOID FspFsctlStartService_EnumFn(PVOID Context, PWSTR ServiceName, BOOLEAN Running)
|
||||||
{
|
{
|
||||||
PWSTR *PDriverName = Context;
|
PWSTR DriverName = Context;
|
||||||
if (0 == *PDriverName ||
|
if (0 > invariant_wcscmp(DriverName, ServiceName))
|
||||||
0 > invariant_wcscmp(*PDriverName, ServiceName))
|
lstrcpyW(DriverName, ServiceName);
|
||||||
*PDriverName = ServiceName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FSP_API NTSTATUS FspFsctlStartService(VOID)
|
FSP_API NTSTATUS FspFsctlStartService(VOID)
|
||||||
@ -549,17 +548,18 @@ FSP_API NTSTATUS FspFsctlStartService(VOID)
|
|||||||
/* non-SxS mode */
|
/* non-SxS mode */
|
||||||
|
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
PWSTR DriverName = 0;
|
WCHAR DriverName[256];
|
||||||
|
|
||||||
Result = FspFsctlStartServiceByName(L"" FSP_FSCTL_DRIVER_NAME);
|
Result = FspFsctlStartServiceByName(L"" FSP_FSCTL_DRIVER_NAME);
|
||||||
if (NT_SUCCESS(Result))
|
if (NT_SUCCESS(Result) || STATUS_NO_SUCH_DEVICE != Result)
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
/* DO NOT CLOBBER Result. We will return it if our best effort below fails. */
|
/* DO NOT CLOBBER Result. We will return it if our best effort below fails. */
|
||||||
|
|
||||||
FspFsctlEnumServices(FspFsctlStartService_EnumFn, &DriverName);
|
DriverName[0] = L'\0';
|
||||||
|
FspFsctlEnumServices(FspFsctlStartService_EnumFn, DriverName);
|
||||||
|
|
||||||
if (0 == DriverName || !NT_SUCCESS(FspFsctlStartServiceByName(DriverName)))
|
if (L'\0' == DriverName[0] || !NT_SUCCESS(FspFsctlStartServiceByName(DriverName)))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user