BOOLEAN VgaIsPresent( PHW_DEVICE_EXTENSION HwDeviceExtension ); Routine Description: This routine returns TRUE if a VGA is present. Determining whether a VGA is present is a two-step process. First, this routine walks bits through the Bit Mask register, to establish that there are readable indexed registers (EGAs normally don't have readable registers, and other adapters are unlikely to have indexed registers). This test is done first because it's a non-destructive EGA rejection test (correctly rejects EGAs, but doesn't potentially mess up the screen or the accessibility of display memory). Normally, this would be an adequate test, but some EGAs have readable registers, so next, we check for the existence of the Chain4 bit in the Memory Mode register; this bit doesn't exist in EGAs. It's conceivable that there are EGAs with readable registers and a register bit where Chain4 is stored, although I don't know of any; if a better test yet is needed, memory could be written to in Chain4 mode, and then examined plane by plane in non-Chain4 mode to make sure the Chain4 bit did what it's supposed to do. However, the current test should be adequate to eliminate just about all EGAs, and 100% of everything else. If this function fails to find a VGA, it attempts to undo any damage it may have inadvertently done while testing. The underlying assumption for the damage control is that if there's any non-VGA adapter at the tested ports, it's an EGA or an enhanced EGA, because: a) I don't know of any other adapters that use 3C4/5 or 3CE/F, and b), if there are other adapters, I certainly don't know how to restore their original states. So all error recovery is oriented toward putting an EGA back in a writable state, so that error messages are visible. The EGA's state on entry is assumed to be text mode, so the Memory Mode register is restored to the default state for text mode. If a VGA is found, the VGA is returned to its original state after testing is finished. Arguments: None. Return Value: TRUE if a VGA is present, FALSE if not.