Fault Handling Logic Changed for Windows 95

ID: Q141203


The information in this article applies to:


SUMMARY

Windows 95 has modified the way VxD fault handlers should handle passing the fault on to the previous handler. Using fault handler logic from a Windows 3.10 VxD may cause problems in Windows 95.


MORE INFORMATION

In Windows 3.1x, the following code logic might have been used by a fault handler:


   pPrevFaultHandler dd ?

      mov     eax, fault_number
      mov     esi, offset32 FaultHandler
      VMMCall Hook_V86_Fault
      mov     pPrevFaultHandler, esi

   BeginProc FaultHandler
      ;;;
      ;;; handler code
      ;;;

      cmp     pPrevFaultHandler, 0
      jz     @F
      jmp     pPrevFaultHandler
   @@:   ret
   EndProc FaultHandler 


In Windows 95, this logic should be modified as follows:


   pPrevFaultHandler dd 0

      mov     eax, fault_number
      mov     esi, offset32 FaultHandler
      VMMCall Hook_V86_Fault
   ;   NOTE:  No "mov pPrevFaultHandler, esi" instruction
   ;   esi = 0 if this is the first fault handler
   ;   pPrevFaultHandler will *always* be nonzero.
   ;   if esi = 0, pPrevFaultHandler will be the address
   ;   of the default handler.

      ...
      mov     eax, fault_number
      mov     esi, offset32 FaultHandler
      VMMCall UnHook_V86_Fault

   BeginProc FaultHandler, HOOK_PROC, pPrevFaultHandler
      ;;;
      ;;; handler code
      ;;;

   ;   NOTE: No "cmp pPrevFaultHandler, 0" instruction
      jmp   pPrevFaultHandler
   EndProc FaultHandler 



Keywords          : kbcode 
Version           : 4.0
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: March 5, 1999