6.1.5 Message Processing

The VDD should process the system control messages as follows:

Message Action

Begin_Message_Mode Saves the video state of the focus virtual machine and puts the display adapter into a known text mode. If the message is received prior to the Sys_VM_Init message, the VDD can call the video BIOS to set up the correct mode.
Debug_Query Uses the Trace_Out macro to list the current focus virtual machine, the video state for each virtual machine, and other global data.
Destroy_VM Frees any memory allocated for the virtual machine, and ensures pointers to the freed memory cannot be used.
Device_Init Initializes the global video state, set up I/O and interrupt trapping, specify instance data, and set the display focus to the system virtual machine.
End_Message_Mode Restores the video state to that of the focus virtual machine.
Init_Complete Carries out consistency checks if needed. Most VDDs do not process this message.
Set_Device_Focus Assigns ownership (focus) of the display to the given virtual machine. If a virtual machine is running in a window, the Set_Device_Focus message specifies the system virtual machine instead of the actual virtual machine.
Sys_Critical_Exit Removes any hook procedures from V86 memory.
Sys_Critical_Init Allocates VDD-specific space in the control block, allocate V86 address space, allocate global memory needed, and initialize any pointers or other data that are required for the VDD to function. Remember that interrupts are disabled during this call, so keep it as short as possible.
Sys_VM_Init Initializes the control block for the system virtual machine and sets the display focus to the system virtual machine if not already set.
System_Exit Restores the display to the video state it had prior to starting Windows.
VM_Create Initializes the control block and allocates any other memory needed for the given virtual machine. If the allocation fails, the VDD must return with the carry flag set to terminate the virtual machine.
VM_Init Set the video state for the virtual machine. A VDD typically calls the video BIOS to set the state and its I/O traps automatically sets up a video state structure.
VM_Resume Locks any memory that was unlocked during a previous VM_Suspend message.
VM_Suspend Unlocks any memory associated with the virtual machine, such as the memory used to save and restore the video state.