mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 17:32:29 -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(ExIsResourceAcquiredExclusiveLite(&FspDeviceExtension(DeviceObject)->Resource));
|
||||
|
||||
#if 1
|
||||
FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount++;
|
||||
#else
|
||||
ULONG FsvrtDeviceObjectCount = FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount++;
|
||||
if (0 == FsvrtDeviceObjectCount)
|
||||
IoRegisterFileSystem(DeviceObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID FspFsctlDeviceVolumeDeleted(PDEVICE_OBJECT DeviceObject)
|
||||
@ -301,9 +305,13 @@ VOID FspFsctlDeviceVolumeDeleted(PDEVICE_OBJECT DeviceObject)
|
||||
ASSERT(FspFsctlDeviceExtensionKind == FspDeviceExtension(DeviceObject)->Kind);
|
||||
ASSERT(ExIsResourceAcquiredExclusiveLite(&FspDeviceExtension(DeviceObject)->Resource));
|
||||
|
||||
#if 1
|
||||
--FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount;
|
||||
#else
|
||||
ULONG FsvrtDeviceObjectCount = --FspFsctlDeviceExtension(DeviceObject)->FsvrtDeviceObjectCount;
|
||||
if (0 == FsvrtDeviceObjectCount)
|
||||
IoUnregisterFileSystem(DeviceObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
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")
|
||||
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")
|
||||
FSP_LEAVE("DriverName=\"%wZ\", RegistryPath=\"%wZ\"",
|
||||
&DriverObject->DriverName, RegistryPath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user