include vmm.inc
include dosmgr.inc
; Install a hook procedure
GetVxDServiceOrdinal eax, DOSMGR_Begin_V86_App
mov esi, OFFSET32 HookProc
VMMcall Hook_Device_Service
jc error
This service is called internally by DOSMGR when a V86-mode application is about to begin execution. The application has been loaded and relocated, but its code has not yet been run. VxDs which wish to be notified of this activity must hook this service. VxDs must not call this service directly. The hook procedure must be a 4.0 Hook_Proc style procedure.
VxDs which monitor resources may wish to hook this service (and the corresponding DOSMGR_End_V86_App) in order to allocate and free resources for each MS-DOS-based application. To monitor Windows-based applications, VxDs should monitor the system control calls related to threads.
The system calls the hook procedure as follows:
mov ebx, VMHandle
mov esi, HighLinearPSP
mov dx, AppPSP
call HookProc
Any VxD which hooks this service must pass the call down to the previously-installed hook, preserving all registers (except Flags), even registers reserved for future use.
Do not assume that the high word of the EDX register will be zero.