I have a case where I want to install a driver on a device instance, but
don’t want PnP to try and start the device until after a reboot.
The situation basically could be described as:
-
I have a running system using a boot storage adapter brand A
-
I would like my system to instead boot from a brand B storage
adapter -
I can’t physically insert both brand A and brand B storage adapters
at the same time, so while running on brand A, using the setup API’s, I
inject a phantom devnode for the brand B adapter (basically slightly
modified “devcon install” code), and update the drivers on it, since there
is no actual hardware, the driver instance fails to start, although it does
try with a PnP start irp failing (expected) -
I shutdown the system, switch the boot storage adapter from A to B
and it boots on the brand B adapter now, I am happy
So my problem is if I try this trick with a brand C storage adapter, it
turns out the brand C driver does not fail the PnP start, even though there
is no hardware. I believe it hangs in the PnP start irp, devcon update
eventually times out, and a kernel debuggers shows the devnode in state
DeviceNodeStartCompletion.
My question: is there a way to install a driver instance, but tell PnP not
to start it? I’ve tried setting the device to disabled before updating the
drivers on the phantom devnode, and it seems to still get enabled and
started.
To complicate matters, the devices are not simple storage adapters, they are
things like NIC cards that that have child devices and need rather more than
a simple entry in the critical device database to work, so really need to
let the class/device installers do whatever they do during driver
installation.
I also don’t own the brand C device, so this is basically a setup of another
companies device problem. I suppose that company never expected a driver
instance to be started when there was no hardware. Lots of drivers do some
validation on PnP start, and fail the start if the validation fails.
It would be viable to have a method where I boot WinPE on the new hardware,
and have it inject the correct boot storage adapter drivers into the offline
OS volume.
I assume this is similar to what must happen during OS install time. WinPE
applies the OS image, and then must inject boot critical device
instances/drivers into the image to make the initial OS boot work. OS setup
must somehow essentially run driver install, with the target registry and
file volume pointing to the OS being installed, not the current running OS.
Any suggestions? Or maybe this is just a normal Windows admin problem and I
am not looking at the corrects docs on how to do this?
Thanks in advance!
Jan