The magic value isn’t in the registry - it’s in a data file on disk which you can’t access from the driver.
If the issue is just “how to get my system booting again” then the answer is probably to check whether the system is loading in safe mode and have your driver either (a) not start at all (if it’s a function or bus driver) or (b) not add itself to the device stack during AddDevice (if it’s a filter).
Or you boot to your safe build and go disable your driver.
-p
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jan Bottorff
Sent: Saturday, February 10, 2007 12:14 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent cyclic error/reset on an early boot driver
You could read the value from the registry that contained the boot.ini options. A magic value I believe shows up there if the system has failed boot before. This doesn’t say YOUR driver was the cause of the boot failure, just that a boot started and didn’t reach some milestone in the boot process.
For development use, I often make a driver test this registry value for a flag that means to fail my DriverEntry. Then if I make a build that crashes on boot, it’s easy to just select a boot entry that has the flag set and my driver is bypassed on this boot. I don’t know if all this maps into Vista/Longhorn but assume boot config parameters can somehow be accessible to drivers.
It’s MUCH nicer to do development on a non boot driver, as you can just use .kdfiles to automatically load your latest build. When your driver is getting really stable, you can then shift to uglier boot load driver start.
Of course the REAL answer is if your driver isn’t really stable it should not be a boot load driver (or even a non-boot load driver).
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of I?aki Castillo
Sent: Friday, February 09, 2007 8:59 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to prevent cyclic error/reset on an early boot driver
In non-boot drivers one can prevent a cyclic error to occur (say we get a fatal error that resets the machine) by means of setting a Registry variable.
Just by looking at the Registry variable status we can conclude that the previous start of the driver was successful or not.
However, in boot mode drivers writing in Registry variables may not be useful because writing in the Registry may not end in a write to disk. So when the machine restarts there is nothing in the Registry.
I wonder how people controls this type of problem. If you have a boot driver, that starts early in the boot process, how you protect the system agains a cyclic failure that might happen ?
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer