DOSMGR_Begin_V86_App

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
 
VMHandle
VM that performed the int 21h.
HighLinearPSP
High linear address of the program segment prefix (PSP) of the application which is about to run.
AppPSP
Segment value of the PSP of the application which is about to be run.

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.