Registry Tip #65: Registry Construction Steps |
Hits: Failed to execute CGI : Win32 Error Code = 3
|
The PC boot sequence starts when power-on self-test (POST) loads the BIOS in memory. BIOS reads the MBR, the first physical (the master boot) sector on the hard disk. BIOS executes the MBR bootstrap code which finds the active partition, the root directory and loads NTLDR which
If you check the HKEY_LOCAL_MACHINE\SYSTEM subtree, you will see a set of subtrees such as ControlSet001, ControlSet002, ControlSet003, CurrentControlSet and Select. The Select key records the selection process - which subtree was used to control the current boot (ControlSet001 or ControlSet002 or ...). Select has values Current, Default, Failed, and LastKnownGood. Current will either match Default or LastKnownGood depending on whether you chose to boot using the LastKnownGood controlset. If you selected LastKnowGood, the Failed value will indicate which controlset had been the default controlset and was declared "failed" by your selection of LastKnownGood. If its a normal boot, Default and Current point to the same controlset (lets say 0x1) and LastKnownGood is controlset 0x2. The controlset subtree used during the boot is made accessible via the name CurrentControlSet for our convenience. At this point, the controlset pointed to as LastKnownGood is copied into the newly created Clone controlset. Thus a copy of the controlset used to boot is kept isolated and unchanged. When you successfully logon, the booting controlset is considered "good" and the Clone controlset becomes the controlset pointed to as LastKnownGood. It is declared good by the fact that the logon process succeeded. If there were non-fatal errors which you ignored or were unaware of, or if automatic or manual drivers fail after the logon, the LastKnownGood may not be very "good". The criterion for the creation of the LastKnowGood control set is fairly early and somewhat superficial.
Error control for drivers: if a service or driver encounters an error, the kernel will act depending on the drivers ErrorControl value. The kernel will ignore the error if ErrorControl=0; the kernel will generate a warning of the error and continue loading if ErrorControl=1; the kernel will panic if ErrorControl=2 and switch to LastKnownGood or ignore the error if control set is already LastKnownGood; and the kernel will mark controlset as failed if ErrorControl=3 and switch to LastKnownGood or if its already LastKnownGood, kernel will generate a diagnostic (BSOD).
The Service Controller makes a pass through the SYSTEM\CurrentControlSet\Services looking for services with Start=2 (automatic). Thus NTLDR handled drivers with Start=0 and the Kernel handled those with Start=1 and the Win32 subsystem handles those with Start=2. The Win32 subsystem is kicked off when you start the logon process. Thats why its during or just after the logon process that you get messages about failed services. Services loading is more complex than driver loading since Services are loaded according to the DependOnGroup and DependOnService values in parallel (meaning that dependencies must be completed prior to starting a service) whereas the drivers initialized by the kernel were loaded in serial order.