DDK Include Files
Sample VxD Code
This collection of programs demonstrates one way a VxD can cause a message to be posted to a Windows application. This example also shows a fairly useful implementation of real and protected mode APIs. Uses the following services: VMMCall _Allocate_Device_CB_Area VMMCall Fatal_Memory_Error VMMCall Get_Sys_VM_Handle VMMCall Test_Sys_VM_Handle VMMCall Get_Crit_Section_Status VMMCall Call_When_VM_Ints_Enabled VMMCall Call_Priority_VM_Event VMMCall Begin_Nest_Exec VMMCall Simulate_Push VMMCall Simulate_Far_Call VMMCall Resume_Exec VMMCall End_Nest_Exec
This VxD can be used to monitor the activity associated with a particular hardware interrupt (IRQ). Specifically, hardware interrupts, EOIs, IRETs, virtual interrupts, and mask changes associated with a particular IRQ will trigger debugging output on the secondary monitor of the system. Note that you must have a secondary monitor to use this VxD. Uses the following services: VMMCall Get_Profile_Decimal_Int VMMCall Clear_Mono_Screen VMMCall Set_Mono_Cur_Pos VMMCall Out_Mono_String VxDCall VPICD_Virtualize_IRQ VxDCall VPICD_Set_Int_Request VxDCall VPICD_Clear_Int_Request VxDCall VPICD_Phys_EOI
This VxD can be used to monitor the I/O traffic associated with a particular device. Specifically, IN's and OUT's to a single I/O port will trigger debugging output on the secondary monitor of the system. Note that you must have a secondary monitor to use this VxD. Uses the following services: VMMCall Install_IO_Handler VMMCall Get_Profile_Hex_Int VMMCall Clear_Mono_Screen VMMCall Set_Mono_Cur_Pos VMMCall Out_Mono_String
This VxD demonstrates how to use the Call_When_Idle function. Uses the following services: VMMCall Call_When_Idle
The purpose of this sample VxD is to demonstrate the basic use of the Install_IO_Handler and Shell_Resolve_Contention function calls. The Install_IO_Handler call enables this VxD to trap IN and OUT's to a port from any VM. The Shell_Resolve_Contention call is then used to display a dialog box when another VM attempts to use a port that is already assigned to another VM. This VxD also demonstrates the use of Enable_Local_Trapping and Disable_Local_Trapping to allow the owner of the port in question to freely do I/O to the port without overhead. Uses the following services: VMMCall Install_IO_Handler VMMCall Enable_Local_Trapping VMMCall Disable_Local_Trapping VxDCall Shell_Resolve_Contention
This VxD uses the Hook_PM_Fault to catch GP faults. When this VxD receives control because of a GP fault, it will execute an INT 1. If execution is continued, control is passed to the next handler in the fault handler chain. The "VxDStub" code for this VxD is an example in itself. The stub hooks INT 2Fh then terminates with stay resident. When Windows later loads, this TSR responds to the INT 2Fh, AX=1605h (Windows initialization) broadcast. The TSR returns a structure that will cause the VxD to be loaded. Thus, no "device=" line is required in the SYSTEM.INI file. Uses the following services: VMMCall Hook_PM_Fault
The basic structure of a VxD is illustrated by this VxD. As written, it can be loaded although it performs no function. This VxD can be used as a base set of source files to start a VxD project.
Documentation
Utilities