mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-12 23:12:09 -05:00
sys: call IoRegisterFileSystem from DriverEntry
This commit is contained in:
parent
138a10d232
commit
140e567fdc
@ -289,9 +289,13 @@ VOID FspFsctlDeviceVolumeCreated(PDEVICE_OBJECT DeviceObject)
|
|||||||
ASSERT(FspFsctlDeviceExtensionKind == FspDeviceExtension(DeviceObject)->Kind);
|
ASSERT(FspFsctlDeviceExtensionKind == FspDeviceExtension(DeviceObject)->Kind);
|
||||||
ASSERT(ExIsResourceAcquiredExclusiveLite(&FspDeviceExtension(DeviceObject)->Resource));
|
ASSERT(ExIsResourceAcquiredExclusiveLite(&FspDeviceExtension(DeviceObject)->Resource));
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount++;
|
||||||
|
#else
|
||||||
ULONG FsvrtDeviceObjectCount = FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount++;
|
ULONG FsvrtDeviceObjectCount = FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount++;
|
||||||
if (0 == FsvrtDeviceObjectCount)
|
if (0 == FsvrtDeviceObjectCount)
|
||||||
IoRegisterFileSystem(DeviceObject);
|
IoRegisterFileSystem(DeviceObject);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FspFsctlDeviceVolumeDeleted(PDEVICE_OBJECT DeviceObject)
|
VOID FspFsctlDeviceVolumeDeleted(PDEVICE_OBJECT DeviceObject)
|
||||||
@ -301,9 +305,13 @@ VOID FspFsctlDeviceVolumeDeleted(PDEVICE_OBJECT DeviceObject)
|
|||||||
ASSERT(FspFsctlDeviceExtensionKind == FspDeviceExtension(DeviceObject)->Kind);
|
ASSERT(FspFsctlDeviceExtensionKind == FspDeviceExtension(DeviceObject)->Kind);
|
||||||
ASSERT(ExIsResourceAcquiredExclusiveLite(&FspDeviceExtension(DeviceObject)->Resource));
|
ASSERT(ExIsResourceAcquiredExclusiveLite(&FspDeviceExtension(DeviceObject)->Resource));
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
--FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount;
|
||||||
|
#else
|
||||||
ULONG FsvrtDeviceObjectCount = --FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount;
|
ULONG FsvrtDeviceObjectCount = --FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount;
|
||||||
if (0 == FsvrtDeviceObjectCount)
|
if (0 == FsvrtDeviceObjectCount)
|
||||||
IoUnregisterFileSystem(DeviceObject);
|
IoUnregisterFileSystem(DeviceObject);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier)
|
PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier)
|
||||||
|
@ -121,6 +121,20 @@ NTSTATUS DriverEntry(
|
|||||||
#pragma prefast(suppress:28175, "We are a filesystem: ok to access FastIoDispatch")
|
#pragma prefast(suppress:28175, "We are a filesystem: ok to access FastIoDispatch")
|
||||||
DriverObject->FastIoDispatch = &FspFastIoDispatch;
|
DriverObject->FastIoDispatch = &FspFastIoDispatch;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register our devices as file systems. We do this here to simplify file system
|
||||||
|
* registration/unregistration, although this makes our driver unloadable from the
|
||||||
|
* get go.
|
||||||
|
*
|
||||||
|
* Unfortunately a call to IoRegisterFileSystem(), even if followed by a call to
|
||||||
|
* IoUnregistreFileSystem(), makes the driver unloadable. We attempted to move
|
||||||
|
* the register/unregister calls to FspFsctlDeviceVolume{Created,Deleted}, but it
|
||||||
|
* did not make any difference with regards to making the driver unloadable. Hence
|
||||||
|
* we stick to the simpler scheme of doing registration here.
|
||||||
|
*/
|
||||||
|
IoRegisterFileSystem(FspFsctlDiskDeviceObject);
|
||||||
|
IoRegisterFileSystem(FspFsctlNetDeviceObject);
|
||||||
|
|
||||||
#pragma prefast(suppress:28175, "We are in DriverEntry: ok to access DriverName")
|
#pragma prefast(suppress:28175, "We are in DriverEntry: ok to access DriverName")
|
||||||
FSP_LEAVE("DriverName=\"%wZ\", RegistryPath=\"%wZ\"",
|
FSP_LEAVE("DriverName=\"%wZ\", RegistryPath=\"%wZ\"",
|
||||||
&DriverObject->DriverName, RegistryPath);
|
&DriverObject->DriverName, RegistryPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user