By default, Windows 95 assumes that a Master Boot Record (MBR) that contains code that hooks INT 13h is unsafe. In such cases, Windows 95 prevents its protected mode drivers from taking over I/O operations for the device and instead uses the real mode mapper to pass I/O requests to the real mode code. This default behavior is intended to ensure that the extended functionality provided by the MBR INT 13h hook routine is still available after Windows 95 starts.
In some cases, this default behavior is not desirable. For example, if the extended functionality is also available in protected mode through a VSD, Windows 95 should not use the real mode mapper and instead should allow the protected mode driver to take over I/O operations. To prevent the default behavior, you can override it by installing safe MBR INT 13h hook routines. The first bytes of a safe routine have the following form:
SAFMBRSIG0 EQU 544e4924h ; reverse of $INT SAFMBRSIG1 EQU 46533331h ; reverse of 13SF SafeMBRHook STRUC smhjmp db 3 dup (?) ; 3 bytes for short jmp instruction smhsig db 8 dup (?) ; Safe ID string = '$INT13SF' smhid db 8 dup (?) ; Vendor ID string smhnext dd ? ; seg:off address of prev int13 ; handler smhflgs dd ? ; flags. SafeMBRHook ENDS
Although multiple INT 13h hook routines can be installed, all of the routines must be safe for Windows 95 to proceed with the loading and initializing the protected mode drivers for the device. During initialization and while processing of the SYS_DYNAMIC_DEVICE_INIT message, a VSD that is responsible for taking over the functionality of a hook routine must set the corresponding smhflgs field to 1. The VSD can check the smhid field to identify and verify the hook routine.
If the extended functionality provided by the real mode hook routine exceeds the capabilities of the protected mode port driver, the VSD is responsible for examining I/O requests made by the port driver during its initialization. To hook I/O before the port driver, the VSD can set the DRP_FC_NEED_PRELOAD value in the DRP_feature_code field of its DRP structure. In this case, the VSD receives the AEP_CONFIG_DCB function before the corresponding port driver and can process the DCB accordingly. The VSD can alternately use the DRP_FC_NEED_PRE_POST_LOAD value if necessary. This is the same as the DRP_FC_NEED_PRELOAD value except that the VSD receives two AEP_CONFIG_DCB calls for each DCB: one before the port driver and one after the layer drivers before the VSD's load group have been initialized. The VSD must take care not to insert twice into the same DCB.
See also DCB, DRP