Hi. I’ve worked in Linux kernel space for years but recently I’ve been tasked with porting one of our Linux drivers to Win2k8 R2. I’m still coming up to speed with WDM/WDF so please forgive if I’m asking a dumb question:
What’s the recommended way of loading a driver while in early development? When you have a critical bug in your DeviceAdd event callback or IRP_MN_START_DEVICE handler that results in a kernel crash, how does one typically proceed?
Here’s my situation: INF file specifies SERVICE_DEMAND_START, used devcon to load the driver. Bug in DeviceAdd caused a crash. Tell WinDBG to reboot the target machine. Unfortunately, the PnP manager on the target machine still sees the PCIe device so it proceeds to automatically load the device driver which results in the same crash again. Rinse and repeat.
So far, the only workaround I’ve found is to power-down the target machine, remove the PCIe device, boot the target machine (now the PnP manager won’t invoke the offending DeviceAdd routine), manually delete the driver, power-down the target machine, reinstall the PCIe device, boot the target machine and then install the fixed driver. Seems awfully tedious.
Is there a way to make the PnP manager *not* automatically load a device driver even if it sees a matching piece of hardware on the bus? I thought perhaps specifying SERVICE_DISABLED in the INF would allow me to manually start the driver (perhaps via ‘net use’ or CreateService/StartService API routines from userspace) but alas devcon refuses to even install such a driver.
So…What do seasoned Windows driver gurus do during early driver development when drivers are very crash-prone? Surely there’s a more efficient way than what I’m doing?
Thanks for any advice
J