This section describes the samples included in the Base\Samples subdirectory. These samples show a wide variety of techniques that you can use in your own virtual device drivers. To find samples specific to your hardware device, see the subdirectory that contains your device class' files.
The ASYNCW32 sample demonstrates how to communicate asynchronously with a VxD from WIN32, using the DeviceIoControl interface.
This sample is comprised of the following files:
CON_AW32.C | Application front end that will dynamically load the C VxD sample, call it, and display data returned from the C VxD. |
ASYNCW32.C | Sample VxD written in C. This VxD supports the WIN32 DeviceIoControl interface, which is used by WIN32 to communicate with VxDs. This VxD can be loaded both dynamically and statically. The VxD will communicate asynchronously with CON_AW32.EXE |
SYSCTRL.ASM | Part of sample VxD that contains the real-mode INIT segment (which is 16-bit) and the System_Control message dispatcher. |
MAKEFILE | Makefile for building the C VxD sample. This sample was built using the latest Microsoft Visual C++ tools as well as Microsoft MASM version 6.11c. The MSVC linker will display several LNK4078 warnings during linking; these are expected and can be ignored. |
WRAPPERS.ASM | Wrapper for VWIN32_DIOCCompletionRoutine. |
MYLOCAL.INC | Private version of Local.inc (found in Base\Vxdwraps), which is used to build the created wrapper for linking with C VxD object. |
The BIOSXLAT sample installs protected-mode handlers for interrupts 10h, 13h, 15h, and 1Ch.
ThCVXD32 sample demonstrates how to perform the following tasks:
This sample is comprised of the following files:
CON_SAMP.C | Application front end that will dynamically load the C VxD sample, call it, and display data returned from the C VxD. |
CVXDSAMP.C | Sample VxD written in C. This VxD supports the WIN32 DeviceIoControl interface which is used by WIN32 to communicate with VxDs. This VxD can be loaded both dynamically and statically. |
CVXDCTRL.ASM | Part of the sample VxD that contains the real-Mode INIT segment (which is 16-bit) and the System_Control message dispatcher. |
MAKEFILE | Makefile for building the C VxD sample using both the Microsoft Visual C++ version 2.0 Linker and Link386. |
CVXDSAMP.DEF | Module-definition file used by both the Microsoft Visual C++ version 2.0 Linker and Link386. The MSVC20 linker will display warnings during linking; these are expected and can be ignored for this sample. |
CVXDSAMP.LNK | Link file used by Link386. |
VKDGKO.ASM | Wrapper for VKD_Get_Kbd_Owner. |
MYVKD.H | Private conversion of the Vkd.inc file to a C include file. |
MYLOCAL.INC | Private version of Local.inc (found in Base\Vxdwraps) which is used to build the created wrapper for linking with the C VxD object. |
VKDWRAPS.H | Include file that defines the VKD wrappers interface. This file is included by the CVXDSAMP.C file. |
The DYNAPAGE sample is the source code for the pagefile device (DYNAPAGE.VXD).
The EATPAGES VxD demonstrates the use of the linked list services, as well as the system page allocator functions. The VxD simply allocates half of the free physical pages at boot time and frees them at system exit. This can be useful to simulate low memory conditions.
The sample uses the following services:
The EBIOS sample is source code for the EBIOS (Extended BIOS) virtual device driver. This device driver is for use on machines that have EBIOS, such as the PS/2. (Extended BIOS should not be confused with Enhanced BIOS, which provides support for IDE hard disks greater than 504 MB.)
The basic structure of a VxD is illustrated by the GENERIC sample. As written, it can be loaded, although it performs no function. This VxD can be used to create a base set of source files for starting a VxD project.
The GPTRAP sample uses Hook_PM_Fault to catch GP faults. When this VxD receives control because of a GP fault, it executes an INT 1 call. 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 and 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 causes the VxD to be loaded, so no "device=" line is required in the SYSTEM.INI file.
The sample uses the following service:
The VDIALOG sample is to demonstrate the basic use of the Install_IO_Handler and SHELL_Resolve_Contention function calls. The Install_IO_Handler call enables the VxD to trap IN and OUT instructions to a port from any VM. The SHELL_Resolve_Contention call is then used to display a dialog box when a 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 input and output to the port without overhead.
Uses the following services:
The VDMAD sample is source code for the virtual DMA virtual device driver.
The VFINTD sample has been provided to demonstrate the technique of handling the virtualization of a particular IRQ.
The sample uses the following services:
The VHOOK86D sample is a simple VxD that will hook the V86 INT chain by using the Hook_V86_Int_Chain service.
Caution
This VxD, by default, will hook INT 2Fh. This VxD may impair system performance. It is intended only to be a demonstration.
The VIDLED VxD demonstrates how to use the Call_When_Idle function.
The sample uses the following service:
The VITD sample provides a simulation of a hardware interval timer for virtual machines. To install it, build VITD.VXD, place the final VITD.VXD in the Windows System directory, add a "device=VITD.VXD" line in the [386Enh] section of the SYSTEM.INI, and restart Windows.
The sample uses the following services:
The VMIOD sample can be used to monitor the I/O traffic associated with a particular device. Specifically, INs and OUTs 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.
The sample uses the following services:
The VMIRQD sample can be used to monitor the activity associated with a particular hardware 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.
The sample uses the following services:
The VMPAGES VxD demonstrates how to export a VxD service (in this case GetVMPgCount) to an application.
The sample uses the following service:
The VNMID VxD shows how to hook the NMI (non-maskable interrupt). It currently does not actually do anything with the NMI, except to chain to the previous handler.
The sample uses the following services:
The VPOSTD sample demonstrates one way a VxD can cause a message to be posted to a Windows application. It also shows a fairly useful implementation of real and protected mode functions.
The sample uses the following services:
The VWATCHD sample is a virtual device that demonstrates the basic structure of a VxD. This VxD issues a Trace_Out (sends messages to the COMx: port) at its entry points. By watching the messages it displays, you can study the situations that cause the various VxD entry points to be called.
This sample shows all major entry points, very simple function calls (separate for V86 mode as well as PM mode), and a "debug_dump" section.
The sample uses the following services:
The VWFD sample, when installed on a system running Windows in enhanced mode, allows Microsoft® MS-DOS® applications to determine if they are running in a window or full-screen. TSTWF.ASM is a sample MS-DOS program that uses the exposed VWFD API.
The sample uses the following services: