Using Windows virtual device driver (VxD) 1

Source: Internet
Author: User
Tags definition error handling exception handling table definition

A, VxD introduction

This article introduces the role of VxD. If the standard VxD provided by Windows 95 does not provide 100% compatible support for your hardware or software, you will need to create a VxD for your hardware or software (including 16-bit and 32-bit software). If you want Windows users to use some of the new features of your hardware or software, you can also create a VxD.

This article describes how to write a VxD, describes the structure, procedures, and calls needed to create a VxD, and gives you the steps to create and test a VxD. VXD can be static or dynamically loaded, and the following is mainly about static VxD, but both the format and functionality are applicable.

Second, what is a VxD

A VxD is a 32-bit executable that manages system resources such as hardware devices or installed software, enabling several applications to use these resources at the same time. Windows allows windows-based applications to multitask by using a VxD. A VxD handles interrupts in connection with Windows and performs I/O operations for specific applications without affecting the execution of other applications. Most VxD manages hardware devices, and some VxD manages or replaces software associated with it, such as ROM BIOS routines. A VxD can contain device-related code that must be executed on the appropriate device, or it can rely on other software to perform these operations on the device. In any case, the VxD retains a record of the device status for each application, ensuring that the device is in the correct state whenever an application continues to execute it.

Some VXD only manages installed software, such as MS-DOS device drivers or TSR programs, which typically contain code that simulates the software or protects the data used by the software for the running application. VXD is also sometimes used to improve the performance of installed software, and the Intel compliant CPU performs a 32-bit VxD that is more efficient than performing 16-bit MS-DOS device drivers or TSR programs.

Third, Standard VxD

Windows includes a variety of VxD to support common hardware devices and installable software. In some cases, you may need to modify the VxD to provide new features or to support non-standard hardware.

Windows provides many VxD that are not intended to be modified, but that can assist in supporting other VxD. For example, many VxD use the features provided by the V86 memory Manager (V86MMGR) and virtual programmable Interrupt Controller device (VPICD) to save V86 mode memory and allow hardware interrupt requests. To get help with developing a VxD, the Windows 95 device Driver Development Kit (DDK) includes the source code for a large number of available device drivers.

Four, create a VxD

You can create a VxD by modifying the VxD example program or by creating it yourself manually. You can write VxD in assembly language, or you can write a section of VxD in a high-level language (such as the C language).

To create a VxD, you need the following steps:

1. Read the chapters in the hardware manual about how to describe this type of hardware VxD.

2, write out the required control process, VxD service and API functions.

3, establishes the module definition file which identifies the appropriate module name for the VxD, and draws out the necessary equipment description block.

4, the Assembly connection VxD.

5, with the debug version of Windows 95 test VxD, for more information on debugging VxD, please refer to the relevant information (you can use Soft-ice debugging-translator note).

6. Create installation files (INF files) for VxD and related files, install VxD by modifying registration information and copying files to Windows system directory and related directories.

7, establish the final release package.

V. How do you want to start

This article assumes that you are an experienced assembly language programmer and familiar with the instruction set and system architecture of the Intel compliant processor. In some special situations, you should also know the following:

Protection mode and virtual 8086 (ie v86--translator) mode.

Flat memory Mode

Interrupts and exception handling

Protection and Privilege level

Segment and page memory management and error handling

Input and output protection and error handling

This article also assumes that you are familiar with the features of specialized hardware and the corresponding ROM BIOS routines and other installable software.

Six, write a VxD

In many cases, a VxD is written to replace a standard VxD provided by Windows 95. However, in most cases, writing a VxD is used to support new hardware devices or software that

, it is often easier to create a VxD by hand than to modify an existing VxD, because most VXD is device-related. However, the source code for the existing VxD needs to be as young as possible

Fine analysis because they may contain common formats and structures, as well as instructions on how to use VMM and VxD services to implement useful functionality.

Writing a VXD requires the following steps:

1. Establish a VxD framework that contains the various segments of the VXD, VxD declaration, device control process, the basic part of the system control message process and the basic part of the API process.

2, add real mode initialization process (optional).

3, the process of processing initialization messages. These procedures should be able to initialize the control block, allocate global memory, and install interrupts, I/O captures, and page fault callback procedures.

4, complete the processing of different interrupts and errors of the callback process.

5. Add Service table definition and declaration to service (optional).

6, complete the API process (optional)

7, complete the process of processing system control messages to establish and delete virtual machines.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.