Hi, I have a device driver that has many virtual devices that have been added
through PnP via the AddDevice DriverObject Function call via the PnP system.
I can have up to 255 of these devices for this driver. When I have created a
new version of this driver, I update it with the system call,
"UpdateDriverForPlugAndPlayDevices()". I was hoping that this call would
force a call to my driver to "REMOVE_DEVICE" one at a time until there are
no devices. At this time the PnP system would call my unload routine. Then
when the PnP system calls the AddDevice routine the new driver would be
loaded.
It does work this way if I only have one or two devices on the driver.
However, If I have more devices than this, then the PnP system sends the
"REMOVE_DEVICE" IOCTL for a few of them, then calls the AddDevice for the
devices that were just removed. Then it repeats this until all of the
devices have been removed and re-added. Consequently, the number of devices
never reaches zero and the unload routine is never called. At the end of the
driver update, a reboot is required, because the previous version of the
driver is still the running driver.
My question is this: Is there anyway to tell
UpdateDriversForPlugAndPlayDevices to remove all the devices before adding
them back?
Thanks in advance,
-David G