Hubbry Logo
VxDVxDMain
Open search
VxD
Community hub
VxD
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
VxD
VxD
from Wikipedia

VxD is the device driver model used in Microsoft Windows/386 2.x, the 386 enhanced mode of Windows 3.x, Windows 9x, and to some extent also by the Novell DOS 7, OpenDOS 7.01, and DR-DOS 7.02 (and higher) multitasker (TASKMGR).[1] VxDs have access to the memory of the kernel and all running processes, as well as raw access to the hardware. Starting with Windows 98, Windows Driver Model was the recommended driver model to write drivers for, with the VxD driver model still being supported for backward compatibility, until Windows Me.

Name and design

[edit]

The name "VxD" is an abbreviation for "virtual xxx driver", where "xxx" is some class of hardware device. It derives from the fact that most drivers had filenames of the form vxxxd.386 in Windows 3.x. Some examples are vjoyd.386 (joystick) and vmm.386 (memory manager). VxDs under Windows 3.x usually have the filename extension .386, while those under Windows 9x have .vxd. Windows 9x VxDs are in Linear Executable format; its code can be 16-bit and 32-bit hybrid, or pure 32-bit.[2] VxDs written for Windows 3.x can be used under Windows 9x but not vice versa.

History

[edit]

Prior to the advent of Windows, DOS applications would either communicate directly with the various pieces of hardware (responding to interrupts, reading and writing device memory etc.) or go through a DOS device driver. As DOS was not multitasking, each application would have exclusive and complete control over the hardware while running. Though Windows applications don't often communicate directly with hardware, it was the only way for Windows drivers; and still is in the real and standard modes of Windows 3.x.

Windows/386 and onward allowed multiple DOS applications to execute concurrently by executing each within its own virtual machine. To share physical resources among these virtual machines, Microsoft introduced virtual device drivers. These drivers solved issues relating to conflicting usage of physical resources by intercepting calls to the hardware. Instead of a machine port representing an actual device, it would represent a "virtual" device, which could be managed by the operating system.

Obsolescence

[edit]

Although Windows 98 introduced the Windows Driver Model (WDM), VxD device drivers can be used under Windows 98 and Windows Me. Using VxD drivers instead of WDM drivers in Windows 9x may result in advanced ACPI states like hibernation being unavailable.

VxDs are not usable in Windows NT or its descendants. Windows NT-based operating systems from 3.1 to 4.0 must use drivers written specifically for them. These drivers are otherwise known as the Windows NT Driver Model. Starting with Windows 2000, Windows NT-based operating systems have adopted the Windows Driver Model from Windows 98.

VxDs should not be confused with the similarly named NTVDM-specific 'VDDs' (Virtual Device Drivers), which provide a method of emulating direct I/O under a Windows NT "DOS Box". NTVDM VDDs run as regular, 32-bit, user-mode DLLs, and must rely on the Win32 API (or another WDM driver) to emulate the desired I/O on behalf of the 16-bit program.

See also

[edit]

References

[edit]

Further reading

[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
A virtual device driver (VxD) is a kernel-mode software module in early Windows operating systems that runs at ring 0 privilege level within the Windows 386 Virtual Machine Manager (VMM) to simulate hardware devices, manage resource contention, and enable multitasking across multiple (VMs) in protected and real modes. Introduced in Windows/386 2.x in 1987 and significantly enhanced for Windows 3.1's 386 Enhanced Mode in 1992, VxDs formed the core of the modular driver architecture for handling in 32-bit flat memory models. They remained the standard driver model throughout the series, including (1995), (1998), and (2000), supporting a hybrid 16/32-bit environment that ran legacy applications alongside protected-mode programs. Key functionalities of VxDs include trapping I/O port accesses for , hooking and simulating interrupts (including IRQs and DMA channels), allocating and locking memory pages for VMs, and providing APIs for and system events like VM creation, suspension, and termination. These features allowed efficient sharing of physical hardware—such as COM ports, video adapters, and timers—among concurrent VMs, improving system stability and performance in preemptive multitasking scenarios without direct hardware access by user-mode applications. VxDs were event-driven, supporting both synchronous and asynchronous service calls through mechanisms like global event lists and nested execution, and included tools for development. However, with the transition to the kernel in , VxD architecture was not supported, as the new Windows Driver Model (WDM) provided a unified, more secure framework for device drivers across consumer and enterprise editions. Today, VxDs are legacy components, incompatible with modern Windows versions and preserved mainly for compatibility in emulated environments.

Naming and Fundamentals

Definition and Purpose

A VxD, short for virtual device driver (also known as virtual xxx driver, where "xxx" indicates the specific device class, such as virtual joystick driver for input devices), is a type of kernel-mode used in legacy Windows operating systems, particularly Windows 3.x and . VxDs operate as 32-bit components within the Windows kernel, providing low-level interaction with hardware and system resources. The primary purpose of a VxD is to deliver hardware abstraction and support multitasking by executing in ring 0, the highest privilege level of the CPU, where it can intercept and virtualize hardware calls originating from DOS applications running in virtual machines. This ring 0 operation grants unrestricted access to hardware, memory, and interrupts, allowing VxDs to manage device operations efficiently without the overhead of privilege level transitions. By virtualizing hardware interfaces, VxDs prevent direct conflicts and ensure safe resource sharing among applications. A key concept of VxDs is their role in enabling Windows to oversee multiple DOS sessions concurrently within , avoiding hardware conflicts through centralized control. This supports 32-bit execution on 386 and later processors, allowing the system to simulate isolated environments for legacy applications while maintaining overall stability. In Windows 3.x, VxDs integrate with the Virtual Machine Manager to handle these , facilitating seamless multitasking. VxDs were designed to overcome the limitations of by unifying the handling of I/O operations, , and processing in a single kernel environment, thereby extending the capabilities of early Windows for more robust hardware support. This approach provided a foundational layer for device management, ensuring compatibility and performance in pre-NT Windows architectures.

File Formats and Conventions

Virtual device drivers (VxDs) for Windows 3.x utilize the .386 file extension and are structured in the Linear Executable (LE) format, which supports a hybrid of 16-bit and 32-bit code segments to accommodate the 386 Enhanced mode environment. This format includes real-mode initialization code for early boot phases and protected-mode execution for runtime operations, with the LE signature identifiable at the file offset to distinguish Windows-specific executables. In contrast, VxDs developed for employ the .vxd extension and adhere to the Linear Executable (LE) format, enabling pure 32-bit or hybrid code in a flat memory model that enhances compatibility with the evolved Virtual Machine Manager (VMM). Naming conventions for VxDs follow a standardized pattern beginning with the prefix "v" (lowercase in filenames), followed by an abbreviation descriptive of the virtualized device or function, and ending with the suffix "d" to denote the driver nature. For instance, vjoyd.386 represents the joystick virtual device driver, while vmm.386 designates the core virtual memory manager. These filenames are placed in the Windows SYSTEM directory and directly reflect the hardware or system component being virtualized, facilitating identification during development and loading. Regarding compatibility, .386 files from Windows 3.x can be loaded and executed in environments, as the later system maintains backward support for the LE format through its VMM, though some services may require updates for full functionality. However, .vxd files from , reliant on the LE format, are incompatible with Windows 3.x due to the latter's inability to process the advanced linear structure. VxDs are loaded dynamically by the VMM kernel component during system initialization, with the filename serving as a key identifier for the specific device task.

Technical Architecture

Execution Environment

VxDs execute in ring 0 kernel mode, granting them unrestricted access to hardware resources and enabling direct management of interrupts, I/O ports, and , which circumvents the limitations inherent in the protected modes of DOS applications. This privileged execution level allows VxDs to operate within a 32-bit flat model, utilizing the full 4 GB provided by the x86 without the segmentation constraints of real-mode environments. The Manager (VMM), implemented as WIN386.EXE, serves as the core kernel component that loads and integrates VxDs into the system, facilitating the creation and control of (VMs) to run DOS applications in a virtualized V86 mode. VxDs collaborate with VMM to handle page faults on hooked memory pages—either by mapping physical memory or terminating the offending VM—and to emulate devices, simulating hardware behavior for compatibility while buffering requests to manage shared resources across VMs. This integration ensures that DOS applications perceive a dedicated hardware environment, even as VMM orchestrates the underlying to prevent direct conflicts. To support multitasking, VxDs enable concurrent hardware access by serializing calls through the VxD layer, utilizing mechanisms such as critical sections to enforce and avoid reentrant code execution that could lead to hardware contention. VMM's scheduling employs primary priority-based and secondary time-slice algorithms, allowing VxDs to boost VM priorities dynamically and coordinate device focus, thereby maintaining system stability during simultaneous operations from multiple VMs. VxDs rely on callbacks and control messages dispatched by VMM to respond to key system events, including initialization via Sys_Critical_Init and Device_Init, device open and close operations through services like Set_Device_Focus, and system shutdown with System_Exit or Sys_Critical_Exit. These mechanisms, often handled through control procedures in the VxD's Device Descriptor Block (DDB), enable event-driven processing and VM-specific notifications, such as VM_Init for startup or VM_Terminate for cleanup, ensuring orderly lifecycle management within the kernel.

Programming Model and APIs

VxDs employ a message-based , operating at ring 0 in a 32-bit flat memory model provided by the Virtual Machine Manager (VMM) to manage and virtual machines (VMs) within the environment. Developers implement VxDs to respond to control messages dispatched by the VMM, such as Device_Init for initialization and Sys_Critical_Init for early system setup, through a central dispatch mechanism that processes events asynchronously or synchronously based on priority. This model enables VxDs to handle interrupts and VM states while maintaining isolation between VMs. The core entry point for message handling is the DriverProc (or ControlProc), a procedure exported via the Device Descriptor Block (DDB) that receives messages in the EAX register, with VM handles in EBX or EDI, and processes them using dispatch tables or macros like Control_Dispatch. VxDs support and unloading without system reboot, facilitated by messages such as SYS_DYNAMIC_DEVICE_INIT for runtime attachment, enabling modular extension of system functionality. For inter-VxD communication, services like PostMessage queue , ensuring orderly processing across global and VM-specific event lists. VxDs run with kernel-mode privileges, granting direct access to hardware resources. Access to VMM services occurs primarily through the _VMMCall macro, which invokes over 200 functions via 20h for tasks like memory allocation (_HeapAllocate for small blocks, _PageAllocate for DMA buffers), simulation (Simulate_Int), and device I/O trapping (_Install_IO_Handler for port monitoring). These services pass parameters in registers (e.g., EAX for service ID, EBX for VM handle) and return results via flags or EAX, with no reliance on standard C/C++ libraries; instead, developers use custom wrappers like those in the DDK's VXDWRAPS.LIB or VToolsD for stack-based calls from C code. VxDs also export protected-mode (PM) and virtual-86 (V86) APIs via DDB fields, accessible from applications through DeviceIoControl or INT 2Fh, supporting Win32 and Win16 interactions. Development of VxDs typically involves assembly language (e.g., MASM 6.1) for low-level control and performance-critical sections, or C with inline assembly and thunking for higher-level logic, compiled using 16/32-bit tools from Microsoft's Device Driver Kit (DDK). The DDK provides include files (e.g., VMM.INC), partial libraries, and utilities like the Thunk Compiler for bridging C callbacks to VMM services, while debuggers such as SoftICE facilitate ring 0 testing. Pagelocked segments (_LTEXT, _LDATA) ensure interrupt-safe execution, with per-VM data allocated via _Allocate_Device_CB_Area to maintain state isolation.

Historical Context

Origins in Early Windows

VxDs first appeared with Windows/386 2.01, released in September 1987 as an extension of tailored for 80386 processors to enable enhanced mode operation. This version introduced a 32-bit protected-mode kernel that supported preemptive multitasking, marking Microsoft's initial foray into leveraging the 386's advanced features for a more robust DOS environment. The primary purpose of VxDs in this early implementation was to facilitate the concurrent execution of multiple DOS applications within isolated virtual machines, preventing interference and enabling efficient resource sharing. Central to this capability was the Virtual Machine Manager (VMM), the core VxD that handled memory allocation, task switching, and emulation of expanded memory standards like EMS across these virtual environments. Earlier Windows versions, constrained to on pre-386 hardware, encountered frequent crashes from direct hardware access conflicts when running multiple DOS sessions; Windows/386 resolved these issues through virtual device emulation, where VxDs intercepted and mediated hardware interactions to support stable, crash-free multitasking of DOS boxes. While limited to 386-compatible CPUs and initially bundled with select OEM systems like Compaq's, the VxD model achieved broad popularity with Windows 3.0's release in May 1990, which incorporated standard .386 VxDs for key system components including serial ports, timers, and disk controllers, thereby democratizing protected-mode features for mainstream users.

Evolution in Windows 9x

With the release of Windows 95 in 1995, VxDs underwent a major shift to the .vxd file format, emphasizing 32-bit protected-mode execution for improved performance and stability over the .386 drivers of earlier versions. This evolution enabled dynamic loading via the registry or standard paths, replacing static loading from SYSTEM.INI files in Windows 3.x, and supported a flat 32-bit memory model addressing up to 4 GB. The hybrid kernel architecture of Windows 95, blending real-mode and protected-mode elements, positioned VxDs at Ring 0 under the Virtual Machine Manager (VMM) to handle multiple execution environments, including Win32 applications indirectly through preemptive threading and services like _MapPhysToLinear for memory-mapped devices. VxDs became integral to Windows 95's (PnP) framework, with the Configuration Manager VxD enabling dynamic hardware enumeration, resource arbitration (e.g., I/O ports, IRQs), and support for emerging standards like basic USB in OSR2 releases via dedicated VxDs such as usb.vxd. This marked a departure from Windows 3.x's pure focus, where VxDs primarily virtualized hardware for DOS and Win16 sessions, to a more integrated model allowing VxDs to manage Win32 workloads through enhanced VMM services like 1 ms timer resolution and appy-time callbacks. Windows 98, released in 1998, built on this foundation with refinements to VxD stability, including improved error handling in the VMM and better fault isolation to reduce system crashes from faulty drivers. It introduced partial compatibility with the Windows Driver Model (WDM), allowing hybrid setups where VxDs coexisted with WDM kernel-streaming components for audio and USB, facilitating smoother transitions for developers while maintaining for existing 32-bit VxDs. The 2000 release of Windows Me finalized VxD evolution in the 9x series, incorporating multimedia optimizations such as enhanced integration and kernel-level streaming for better video and audio performance, often leveraging VxDs for low-latency hardware access. Despite increasing reliance on user-mode components for newer features like and universal plug-and-play, VxDs remained essential for legacy hardware support, ensuring compatibility with older peripherals through the hybrid real/protected-mode environment.

Practical Usage

Built-in System VxDs

Built-in system VxDs form the foundational layer of and system management in and 98, providing essential services for , , and device control. These Microsoft-supplied drivers, typically numbering around 26 in a standard installation, are bundled into the monolithic VMM32.VXD file located in the \Windows\System\VMM32 directory to optimize boot performance and memory usage by loading only necessary components during startup. They operate at ring 0 privilege level, enabling protected-mode execution while emulating real-mode environments for compatibility with applications. The Manager (VMM.386 or VMM.VXD) serves as the core orchestrator among built-in VxDs, responsible for creating and managing virtual machines (VMs), handling through dynamic page allocation, and facilitating task switching via its integrated scheduler. It traps processor exceptions, vectors interrupts to other VxDs like VPICD, and provides timing services with 1 ms resolution, ensuring multitasking across Win32, Win16, and DOS sessions. During the boot process, VMM initializes the system VM and coordinates the loading of other static VxDs from VMM32.VXD, replacing real-mode drivers with protected-mode equivalents for enhanced stability. Other critical built-in VxDs handle specific and system services. For instance, VPICD.386 (Virtual Programmable ) manages IRQ allocation and reflection to VMs, supporting resource arbitration by virtualizing the 8259/8259A controllers and issuing end-of- (EOI) commands. VTD.VXD (Virtual Timer Device) controls the 8254 , generating system ticks at 18.2 Hz for the foreground VM while preventing direct hardware reprogramming, and offers services for DOS idle detection. VJOYD.386 virtualizes inputs, relevant I/O ports to enable device support without conflicts in multi-VM environments. These VxDs are essential for device initialization during boot, ensuring seamless hardware detection and configuration via the integrated Configuration Manager. For storage and I/O, VCD.386 (Virtual COMM Device) emulates serial (COM) and parallel (LPT) ports, buffering data and reflecting interrupts to maintain VM isolation during suspend/resume operations. MMSYS.386 (Multimedia System) provides runtime services for audio, MIDI, and video devices, integrating with the multimedia architecture to support timing callbacks (e.g., timeSetEvent) and DMA contexts for sound output. Additional examples include VMOUSE.386 for mouse input polling, VKD.386 for keyboard handling, and VNETSUP.386 for basic network stack support, contributing to runtime functionalities like power management through idle detection and coordinated shutdown sequences. Collectively, these VxDs—covering ports, disks, interrupts, and peripherals—enable the core boot process, hardware abstraction, and ongoing system services in without relying on user intervention.
VxD NamePrimary RoleKey Functionality
VMM.VXDVirtual Machine ManagementVM creation, , task switching,
VPICD.386Interrupt ControlIRQ virtualization, EOI processing, arbitration
VTD.VXDTimer Management8254 timer trapping, system ticks, idle detection
VJOYD.386Joystick Input virtualization, input reflection to VMs
VCD.386CommunicationsSerial/parallel port emulation, buffering and reflection
MMSYS.386Multimedia ServicesAudio/ support, timing callbacks, DMA integration

Custom and Third-Party Development

Custom and third-party virtual device drivers (VxDs) extended functionality for specialized hardware and software, allowing developers to create protected-mode drivers that interacted directly with the kernel. Development typically involved the Windows Driver Development Kit (DDK), which supplied compilers, headers, and libraries for building 32-bit VxDs, often integrated with Visual C++ environments for code generation and linking. This process enabled the creation of device-specific drivers, such as those for adapters, which provided essential support for SCSI peripherals in systems lacking native integration. Notable third-party examples include audio drivers from Creative Labs for the Sound Blaster 16 series, which delivered 16-bit sound capabilities and support under . Similarly, network drivers leveraging the NDIS.VXD interface facilitated Ethernet connectivity for various adapters, allowing protected-mode operation alongside real-mode NDIS2 protocols for compatibility. Early antivirus solutions also employed VxDs for real-time monitoring, intercepting disk I/O at the kernel level to detect threats during access. Developing and testing custom VxDs presented significant challenges, particularly in debugging, where kernel-mode tools like SoftICE were essential for loading symbol files, setting breakpoints, and tracing execution without crashing the system. Distribution relied on INF files to automate installation, instructing to copy VXD binaries to the directory and register them via or setup routines. In the , VxDs gained popularity for game ports and utilities, as their ring-0 access enabled high-performance features like direct hardware manipulation for joysticks and custom I/O handlers. Microsoft's VxD SDK, distributed through the DDK, provided open specifications that encouraged community contributions, fostering a of shared driver code and extensions.

Transition and Legacy

Limitations and Challenges

VxDs operated in kernel mode without the isolation mechanisms found in modern driver architectures, making the entire system vulnerable to crashes from buggy drivers. A fault in a VxD, such as an invalid memory access or unhandled exception, could trigger a (BSOD), halting the operating system and requiring a full . For instance, flaws in the NDIS.VXD network driver were known to cause such system-wide failures on high-speed processors. The VxD model exhibited notable compatibility gaps with emerging hardware standards. Support for Advanced Configuration and Power Interface () power management was limited; hibernation (S4 state) functionality, for example, was incompatible with certain VxDs like audio drivers, necessitating their replacement with Windows Driver Model (WDM) equivalents to enable the feature. Additionally, the 16/32-bit hybrid architecture conflicted with 64-bit hardware, as lacked native instructions for x64 processors, leading to boot failures or instability on such systems. Scalability challenges stemmed from the VxD framework's origins in the mid-1990s hardware landscape. It struggled with high-speed peripherals like USB 2.0 controllers, which demanded 480 Mbps throughput and advanced interrupt handling beyond the capabilities of native USB 1.1 VxD support (limited to 12 Mbps). Similarly, modern GPUs with complex memory mapping and direct hardware access requirements often caused conflicts or performance degradation due to the model's constrained 32-bit addressing and lack of optimized APIs for accelerated . A key operational issue was the incomplete (PnP) integration for VxDs prior to . In , many VxDs required manual resource allocation via , including IRQ and I/O port assignments, as automatic detection was unreliable for non-compliant drivers. This led to frequent user intervention and configuration errors. Even in , legacy VxD PnP adherence relied on adherence to DDK guidelines, which did not fully resolve earlier shortcomings. Memory management posed another persistent challenge, with VxDs prone to leaks in prolonged sessions. The VCACHE.VXD component, responsible for disk caching, could allocate excessive physical memory—up to all available RAM if unconfigured—resulting in low-memory warnings and application failures. advised tuning VCACHE parameters in SYSTEM.INI to cap its usage and prevent such depletion.

Replacement by WDM and Modern Models

The Windows Driver Model (WDM) was introduced with in 1998 and , providing a unified framework for developing layered device drivers that could operate primarily in kernel mode while ensuring source-code compatibility across Windows platforms. This model aimed to standardize driver development, replacing the divergent VxD architecture used in earlier systems and the native NT kernel drivers in the Windows NT lineage, thereby phasing out VxDs for new implementations. In the Windows NT lineage, beginning with Windows NT and continuing through Windows 2000 and later versions, VxDs were fundamentally incompatible due to the NT kernel's design, which relied on native kernel-mode drivers rather than the virtualized 16-bit/32-bit protected-mode environment of VxDs. Backward compatibility in these systems was limited to the NT Virtual DOS Machine (NTVDM) for running 16-bit applications, but it did not extend to loading or executing VxD drivers, necessitating a complete rewrite of drivers to WDM or NT formats for functionality. Migration from VxDs to WDM was facilitated in transitional releases like (2000), where enhanced WDM support included compatibility layers and helper VxD modules to load certain WDM drivers on legacy hardware, though full compatibility often required developer rewrites rather than automated conversion. By in 2001, VxD support was entirely dropped, with mandating WDM-compliant drivers for certification and system integration, marking the obsolescence of VxDs in mainstream development. Windows 98 Second Edition and retained VxD support primarily for with existing hardware and software from prior 9x versions, allowing legacy VxDs to function alongside emerging WDM drivers. However, explicitly discouraged new VxD development after the 1998 introduction of WDM, directing developers toward the more robust, cross-platform WDM and, later, the (KMDF) and User-Mode Driver Framework (UMDF) introduced in as higher-level abstractions over WDM for simplified modern driver creation.

References

Add your contribution
Related Hubs
User Avatar
No comments yet.