include vmm.inc
mov eax, Interrupt ; number of interrupt to hook
mov esi, OFFSET32 HookProc ; points to hook procedure
VMMCall Hook_V86_Int_Chain
jc not_installed ; carry flag set if procedure not installed
Installs a hook procedure that the system calls whenever the specified interrupt occurs. Virtual devices use this service to monitor software interrupts, and simulated hardware interrupts in V86 mode. Unlike Windows 3.1 in which this service was available only during initialization, Windows 95 allows V86 interrupt hooks to be installed after initialization is complete. Uses Flags.
The system calls the hook procedure whenever the corresponding interrupt occurs, a virtual device calls the Simulate_Int service, or the system simulates a hardware interrupt. This means a hook procedure must make no assumptions about the origin of the interrupt.
The system calls the procedure as follows:
mov eax, Interrupt ; number of interrupt hooked
mov ebx, VM ; current VM handle
mov ebp, OFFSET32 crs ; points to a Client_Reg_Struc
call [HookProc]
jc pass_to_next ; carry set if interrupt not serviced
The Interrupt parameter is the number of the current interrupt, the VM parameter is a handle identifying the current virtual machine, and the crs parameter points to a Client_Reg_Struc structure containing the register values of the current virtual machine. If the hook procedure services the interrupt, it must clear the carry flag to prevent the system from passing the interrupt to the next hook procedure.
Any number of virtual devices can install a hook procedure for a given interrupt. The system always calls the last hook procedure first. A hook procedure either services the interrupt or directs the system to pass the interrupt to the next hook procedure. If no hook procedure services the interrupt, the system reflects the interrupt to the virtual machine.
This service is recommended instead of hooking the V86 interrupt vector directly.
Set_V86_Int_Vector, Simulate_Int