All interfaces of the C + + language VxD and the outside communication

Source: Internet
Author: User
Tags require requires thread

One, what is a VxD

From the multitasking operating system Windows 3.1, any physical device x in your computer can be used simultaneously by multiple processes based on DOS or Windows, a one-to-many relationship called device virtualization, where processes access physical device x through a VxD (virtual X device driver) running at the core layer. The software service provided to the user by the operating system can also be implemented with VxD. Other resources on the computer, such as CPUs, memory, and so on, can also be used by multiple processes, and processes access such resources in a system-supplied virtual machine (VM) environment.

VXD can be created by Virtual Machine Manager (VMM) in the core layer (called static loading, that is, the VxD in the C:\Windows\System directory, in the C:\Windows\System.ini file, the section [386ENH] plus one line "device= This VXD file name "), or loaded in real time by the application (called dynamic Loading), then the processes can access the VxD data area locked in memory to control the behavior of the VxD in real time, and the internal structure of the VxD prevents two processes from simultaneously accessing its data area. A VXD interacts with the outside world by responding to events sent to it by VMM.

In Windows 95, each process based on DOS runs in a separate VM (said to run in V86 mode), can be run in a DOS single process in 640k low memory (said in real mode), and can take advantage of the multi-process environment, run throughout the memory (said to run in protected mode), Access memory high-end Windows graphics environment through a 95 DPMI interface. Other 16-bit or 32-bit applications are running in the same system VM.

Only the VXD under 95 environments is discussed below.

Second, the creation of VxD

1. Create VxD from assembly language: Install Microsoft's Win32 SDK and DDK.

2. Create a VxD from C or C + +: Install VC2.0 or BC4.0, and Vireo software company's VTOOLSD package.

VTOOLSD contains 3 utilities: A Quickvxd that can create a VxD frame, a VxD Loader that can dynamically load and unload a VxD, and a VxD Viewer that displays the memory VxD feature.

Quickvxd contains 7 dialog pages:

(1) Device Parameters page

Include a VxD name of up to 8 characters, unique identification number (ID), relative to the load order of the other VxD (the VxD Viewer displays the Mount order value of a VxD, and the new VxD will be loaded before this VXD if the specified new VxD is in a less than this init order) , the implementation of language (C or C + +) static, dynamic loading mode.

(2) VxD Services page

An interface (called a VxD service) that can be accessed by another VxD requires the id>0 of this VxD and does not conflict with the ID value of each VxD in memory.

This ID can be applied to Microsoft Company, or the Vireo company's vireo_test_id (3180h) can be used. This class ID is called the interface ID.

(3) API page

Can be used by the application in real mode/v86 mode, protection mode, DPMI real mode/v86 mode, DPMI protection mode access to the interface (collectively, the Application Interface), the first two require this VxD provide interface ID, the latter two only require this VxD to provide a 0-terminated unique identifier string; You must first load this VxD statically or dynamically (the 4th requires static loading).

1th, 3 can be accessed by the General Assembly program, 2nd, 4 can be in the BC Windows 3-x (16) platform generated by Windows program Access.

(4) Control Messages page

The response to messages that appear in Windows 3.1 and Windows 95, such as static-loaded dtnamic_init messages.

(5) Windows95 Control Messages page

Responses to messages that appear only in Windows 95, such as sys_dynamic_init messages that are dynamically loaded.

(6) Classes page when using C + + to implement VxD

A class name derived from the virtual device driver class, such as Mydevice, vdevice a member function of this class to receive most of the messages that appear in (4) and (5) pages.

Class names derived from the VM instance class Vvirtualmachine (such as MYVM), which receive messages that run through the lifetime of the VM, such as the initial message sys_vm_init of the system VM;

A class name (such as Mythread) derived from the thread instance class Vthread. The member functions of this class receive messages that run through the thread life, such as the new line Cheng message thread_init.

(7) Output Files page

The directory location where 3 vxd files (. h,.c or. cpp,.mak) will be stored that reflect the above content.

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.