RE: [Q] What does DRVO_LEGACY_DRIVER mean?

From: “Jamey Kirby”
Sent: Friday, April 07, 2000 7:44 PM

> Do you create device objects in DriverEntry()? Just currious.

No, just during AddDevice().

To be specific, I actually create two device objects, one is the “real” FDO
layered directly (from my perspective) atop of the PDO. The other is an
“extra” device layered on top of my FDO – creating a three (at least)
device stack, two of which belong to my driver.

Do you think my driver’s extra device makes any difference? The Plug and
Play Manager doesn’t care what happens during AddDevice() does it? – so
long as the PDO’s stack is working properly as a whole, right?

As I say, I am only “worried” about the DRVO_LEGACY_DRIVER flag – it
doesn’t actually seem to be causing my driver to act strangely, except…

My driver is for a USB device and if I yank the cord so it receives
IRP_MN_SURPRISE_REMOVAL, the device stack shuts down correctly, but Windows
does not unload my driver. If I use the icon on the Taskbar to tell Windows
beforehand that I’m going to remove my device, it sends IRP_MJ_REMOVE_DEVICE
and unloads my driver completely. Is not unloading normal in the case of
surprise removal?

When my driver is left in memory after surprise removal, there doesn’t seem
to be anything referencing my driver except the Service Manager (the devices
are all gone and the DRIVER_OBJECT still has 3 references, yet “net stop” is
successful).

- Matt