FsRtlRegisterUncProvider() prevents unloading the driver

Hi everybody,

when I register my device as network redirector by calling FsRtlRegisterUncProvider(), I can’t unload the driver until I call FsRtlDeregisterUncProvider() - I originally thought I’ll unregister the device in DriverUnload(), but it doesn’t seem like an option, since DriverUnload() isn’t called until all handles are closed. As of now, I use my own IOCTL to unregister my redirector from user space, but I need to register the device during startup (it works) and unregister when the driver stops without intervention from the outside. System shutdown isn’t a problem, I register for shutdown notification. My driver isn’t PNP.