VxD programming

VxD programming

1. Introduction to VxD

This article introduces the role of VxD. If the standard VxD provided by Windows 95 is for your hardware or
The software cannot provide 100% compatible support, you need to provide your hardware or software (including 16-bit
And 32-bit software) to create VxD. If you want Windows users to use your hardware or software
You can also create VxD for some new features.
This article describes how to write VxD, tells about the structure, process and call required to create VxD, and also gives
Steps to create and test VxD. VxD can be static or dynamically loaded, the following
Rong mainly talks about static VxD, but both the format and the functions are applicable.

Second, what is VxD

VxD is a 32-bit executable program that manages system resources such as hardware devices or installed software
Order, so that several applications can use these resources at the same time. Windows uses VxD to allow
Xu Windows-based applications implement multitasking. VxD in connection with Windows
Handle interrupts and execute for specific applications without affecting the execution of other applications
Line I / O operations.
Most VxD management hardware devices also have some VxD management or replacement related software, for example
Such as ROM BIOS routines. VxD can contain device-related code that must be executed on the corresponding device,
You can also rely on other software to perform these operations on the device. In any case, VxD will be
Each application keeps a record of the state of the device, ensuring that whenever an application continues
The implementation of the device is in the correct state.
Some VxDs only manage installed software, such as MS-DOS device drivers or TSR programs,
Such VxDs usually include emulation of these software or protection of these software for running applications
The code of the data of the program. VxD is sometimes used to improve the performance of installed software, Intel compatible CPU
Executing 32-bit VxD is better than executing 16-bit MS-DOS device drivers or TSR programs
High efficiency.

3. Standard VxD

Windows includes multiple VxDs to support common hardware devices and installable software. In certain situations
In some cases, VxD may need to be modified to provide new features or support non-standard hardware.
Windows provides many VxDs that are not ready to be modified, but can assist in supporting other VxDs. E.g:
Many VxDs use V86 memory manager (V86MMGR) and virtual programmable interrupt controller devices
(VPICD) provides functions to save V86 mode memory and allow hardware interrupt requests.
To get help developing VxDs, the Windows 95 Device Driver Development Kit (DDK) package
Includes source code for a large number of available device drivers.

Four, create VxD

You can create VxD by modifying the VxD sample program or creating it yourself. You can use currency
Write language to write VxD, you can also write part of VxD in high-level language (such as C language).
To create a VxD, the following steps are required:
1. Read the chapter describing the hardware VxD of this model in the hardware manual.
2. Write out the required control process, VxD service and API functions.
3. Create a module definition file that identifies the appropriate module name for VxD, and lead to the required device description
Piece.
4. Assembly connection VxD.
5. Test VxD with the debug version of Windows 95. For more information about debugging VxD, please
Refer to related materials (can be debugged with Soft-ICE-Translator's Note).
6. Create an installation file (INF file) for VxD and related files, by modifying the registration information and
Copy files from the SYSTEM directory of Windows and related directories to install VxD.
7. Establish the final software package.

5. How do you start

This article assumes that you are an experienced assembly language programmer and familiar with Intel compatible processors
Instruction set and system structure. In some special cases, you should also understand the following:

Protected mode and virtual 8086 (ie V86-Translator's Note) mode.
Flat memory mode
Interrupt 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 already familiar with the characteristics of specialized hardware and the corresponding ROM BIOS routines and
Other installable software.

Six, write a VxD

In many cases, write a VxD to replace a standard VxD provided by Windows 95. Ran
However, in most cases, writing a VxD is used to support new hardware devices or software.
In this case, it is usually easier to manually create a VxD than to modify an existing VxD because the reason is
Most VxDs are device-dependent. However, the existing VxD source code needs to be as small as possible
Detailed analysis, because they may contain common formats and structures, and explain how to use VMM
And VxD services to achieve useful functions.
Writing a VxD requires the following steps:
1. Build each segment containing VxD, VxD statement, device control process, process system control messages
VxD framework of the basic part of the process and the basic part of the API process.
2. Join the real mode initialization process (optional).
3. Complete the process of processing the initialization message. These processes should be able to initialize the control block, allocate
Global memory and installation interrupt, I / O capture and page fault callback process.
4. Complete the callback process for handling different interrupts and errors.
5. Add service table definition and declaration for the service (optional).
6. Complete the API process (optional)
7. Complete the process of processing system control messages to create and delete virtual machines.
In the process of writing a VxD, you can install the VxD and run it under the control of the debugger
Windows, set a breakpoint in the VxD to monitor the interrupts managed by the VxD, this can help you
Find out if the VxD is working correctly.

1. VxD segment

VxD can contain some combinations of the following 5 segments:
1. VxD_CODE section: Protection mode code section (required). This section contains the VxD system control process,
Callback process, service and API process. This section uses macros VxD_CODE_SEG and VxD_CODE_ENDS
Definition start and end, can also be named _LTEXT.
2. VxD_DATA section: the data section of the protection mode (required). This section includes the device description table and service table
And some VxD global data. This section is defined by macros VxD_DATA_SEG and VxD_DATA_ENDS
The beginning and end can also be named _LDATA.
3. VxD_ICODE section: protection mode initialization code section (optional). This paragraph generally includes only VxD
Processes and services used in the initialization process, VMM discards after the Init_Complete message occurs
This paragraph. This section uses macros VxD_ICODE_SEG and VxD_ICODE_ENDS to define the start and end
Can be named _ITEXT.
4. VxD_IDATA section: Initialize the data section in protection mode (optional). This section generally includes initialization
For data used by processes and services, VMM discards this segment after the Init_Complete message occurs. The
The segment macros VxD_IDATA_SEG and VxD_IDATA_ENDS define the start and end, and can also be named
_IDATA.
5. VxD_REAL_INIT section: real mode initialization section (optional). This section contains real mode initialization
Process and data, VMM calls this process before loading other parts of VxD, and discards after the process returns
This section is defined by the macros VxD_REAL_INIT_SEG and VxD_REAL_INIT_ENDS.
At the end, it can also be named _RTEXT.
Except for the real mode initialization section, all code and data sections are protected by the 32-bit flat memory mode
Protection mode segment, which means that the process and data defined in the protection mode segment are 32-bit offsets
the amount. When the VMM is loaded with VxD, all offsets are corrected according to the actual position of VxD in the memory.
Therefore, use the ordinary OFFSET command in the protected mode section (pseudo-operation, the same below-Translator's Note)
The OFFSET32 macro should be used, the offset defined by the OFFSET32 macro determines the correctness for the connector
The offset correction information.
VxD cannot change the CS, DS, ES and SS segment registers, VxD can use FS and GS segment registers
Device.

2. Protection mode instruction

The VxD source program file must start with the .386p command to inform the assembler that protected mode is allowed.
make. Although VxD works at 0 privilege level, you should not use protected mode instructions to modify the CPU
Run, for example, modify the global descriptor (selector-translator's note) or interrupt descriptor and modify
Task status segment or register. Doing so may adversely affect the operation of Windows. only
The exception is when the VxD is a virtual math coprocessor device driver (VMCPD), allowing modification
Change the 80387 bits in the CR0 register.

3. Include files

The include file defines the macros, structures, symbols, and service tables required by VxD and is used to declare sections and procedures
And use VMM and other VxD services. Below are the definitions of public services included in each include file,
Macro and symbol definition list:
1. VMM.INC: contains all VMM services and required macros and symbols, for example
Declare_Virtual_Device and VMMCall.
2. DEBUG.INC: Contains macros that output information and perform various data checks on the debugging terminal. This
The functions of these macros are implemented by the code generated by this file during assembly of the VxD that defines the debugging symbols.
3. VPICD.INC: contains all the definitions for the virtual programmable interrupt controller device (VPICD)
Services, macros and symbols. VPICD handles all interrupts, so many VxDs require VPICD services.
4. SHELL.INC: Contains the definition of public services provided by virtual shell devices. Virtual shell device
Provides calls to Windows functions such as MessageBox, which allows VxD to display
Dialog.

4. VxD statement

Each VxD must declare a name, a version number, an initialization sequence and a device
To control the process, many virtual device drivers also declare a device identification and some API processes.
VxD generally uses the Declare_Virtual_Device macro to implement these declarations, for example:
Declare_Virtual_Device VSAMPLED, 4, 0, VSAMPLED_Control, \
VSAMPLED_Device_ID, VSAMPLED_Init_Order, \
VSAMPLED_V86_API_Handler, \
VSAMPLED_PM_API_Handler
This example declares a VxD instance-VSAMPLED V4.0, which must be defined in the corresponding source file
The device control process named VSAMPLED_Control. The symbols VSAMPLED_Device_ID and
VSAMPLED_Init_Order describes the identification and initialization sequence of non-standard VxD, which is supported by VxD
V86 mode and protected mode API process.
VMM initializes VxD with the information defined by the macro and sends system control messages to VxD, and allows
MS-DOS application, device driver and TSR call VxD. In order for the VMM to access these letters
Information, the corresponding macro creates a device description block (DDB) and saves it in the protected mode data section
Medium (the format of DDB is the same as VxD_Desc_Block structure), the macro establishes a must for DDB
The label that is explicitly drawn when VxD is connected. In the above example, the name of DDB is VSAMPLED_DDB.

5. VxD identification (ID)

A VxD provides a VxD logo to distinguish it from other VxDs. VMM dynamic connection routine uses VxD
Identified as a suitable VxD connection service call, if VxD provides services or provides V86 mode and
VxD must have a unique identifier for protected mode API processes and other situations that require a unique identifier.
Although the standard VxD uses the predefined VxD logo (symbols are defined in the VMM.INC file), support
The VxD of the new equipment and the new software interface must all have a new logo. To prevent other new VxDs
Conflict, Microsoft requests and registers the logo to ensure that no other vendor uses its own VxD
Logo, Microsoft reserves all VxD logos between 0 and 01FFH for their own use. Not available
Services or API processes, or VxDs that do not require unique identification should be used
Undefined_Device_ID symbol to define VxD logo.

6. Initialization sequence

Each VxD has an initialization sequence value that specifies when the VMM should initialize the VxD,
The VMM initializes the virtual machine in this order from the smallest value to the largest value (VM—Translator's Note). If two or
If more than two VxDs have the same value, VMM will follow the order appearing in the SYSTEM.INI file
To initialize, but the specified order is not guaranteed.
For VxDs that need to call other VxD services or need to intercept interrupts before other VxDs, the initial
The order of initialization is very important. If a VxD needs to be initialized before or after the standard VxD,
Its initialization sequence value should pass the predefined initialization sequence symbol in the standard VxD (in
Defined in the VMM.INC file) to add or subtract a decimal value to create.
If a VxD does not need to initialize the order value, you should use the Undefined_Init_Order symbol
The number replaces the initialization sequence value.

7. Equipment control process

Each VxD has a device control process, VMM sends VxD to VxD by calling this process
System control messages. System control messages direct VxD to complete actions, such as initializing itself or communicating
Know the changes of the VxD virtual machine (for example, create a virtual machine), etc. Most VxDs are used by
Begin_Control_Dispatch, Control_Dispatch and End_Control_Dispatch
Macro to define the device control process, for example:
Begin_Control_Dispatch VSAMPLED
Control_Dispatch Sys_CriTIcal_Init, VSAMPLED_Crit_Init
Control_Dispatch Device_Init, VSAMPLED_Device_Init
Control_Dispatch Sys_CriTIcal_Exit, VSAMPLED_Crit_Exit
End_Control_Dispatch VSAMPLED
In the above example, the macro creates a device control process named VSAMPLED_Control, and generates
Became the check for Sys_CriTIcal_Init, Device_Init and Sys_CriTIcal_Exit messages
Instructions. When these messages are sent to the process, the process controls the corresponding process (for example
VSAMPLED_Crit_Init) to process messages, these message processing procedures must be defined in VxD.

Seven, system control messages

VMM sends system control messages to VxD to notify VxD of changes affecting the system and virtual machines. Big
Most VxDs need to track the creation and state of virtual machines, so whenever they are created, initialized or
When the virtual machine is terminated, VMM will send a message to VxD. VMM will also move to a virtual
When the virtual machine is moved or removed from a virtual machine, and the virtual shell device needs to display a message to the user
Send a message to VxD when the message box is closed.
The following is a list of public messages and how VxD should handle these messages:
Begin_Message_Mode message: when the virtual shell device needs to display a message box to the user but
VxD receives this message when the system virtual machine and Windows functions cannot be used. Virtual keyboard, mouse
And display device to save the current state, allow any message mode service and process initial for message mode
Corresponding equipment.
Create_VM message: This is the first message that VxD receives when a new virtual machine is created.
VxD should initialize the data related to the virtual machine, especially the control block.
Debug_Query message: VxD received this message from the WDEB386 debugger. VxD can display debugging
List and read user commands from the debugging terminal.
Destroy_VM message: This is the third virtual machine termination message received by VxD. Simulate_Int
And Exec_Int services are no longer valid for the virtual machine that got this message.
Device_Init message: This is the second message received by VxD. Allow interrupts, most VxDs
Assign and copy the initial state to the designated part of the device in the system virtual machine control block.
Call function and I / O protection exception and specified instance data. At this time, Simulate_Int and Exec_Int
The service becomes effective.
End_Message_Mode message: VxD receives when the virtual shell device no longer needs to display the message box
This message. The virtual keyboard, mouse, and display device are restored to the virtual machine that received this message
Status, prohibit any message mode service.
Init_Complete message: This is the third message received by VxD, and the last one is related to the system
Initialize related messages. Although most VxDs do not process this message, those using V86 memory
VxD should locate and apply for memory before this message returns. When VxD returns this message, VMM loses
Discard the initialization code and data segment of VxD.
Query_Destory message: When the virtual shell device needs to decide whether the virtual machine can be deleted VxD
Received this message. VxD can be returned by setting the carry flag (CF-Translator's Note) to prevent virtual
The virtual machine is deleted, in this case VxD should use the SHELL_Message service to notify the user
problem.
Reboot_Processor message: VxD received this message when the user tried to restart the computer.
You can restart the VxD of the computer, for example, the keyboard device should complete the work.
Set_Device_Focus message: When the execution focus moves from one virtual machine to another virtual machine
VxD received this message. VxD restores the hardware device to the state related to the virtual machine. If VxD makes
Use I / O to capture and manage virtual machines when there is no focus, VxD should remove as many as possible
I / O capture makes the virtual machine run as fast as possible.
Sys_Critical_Exit message: This is the last message received by VxD. Interrupts are prohibited,
Simualte_Int and Exec_Int services are no longer valid. VxD should reset the hardware associated with it
The device is guaranteed to return to real mode without problems.
Sys_Critical_Init message: This is the first message received by VxD. Interruption is still not allowed
Xu, so VxD should complete the task as quickly as possible. Most VxDs complete the following tasks:
Installation and initialization need to support hardware interrupts from the device and software from VMM or other VxD
Any function of the software interruption, providing the device with an application that requires the use of V86 mode memory pages separately
For example, the virtual display device applies for display memory.
Any data needed to initialize the VxD service, which usually includes reading the SYSTEM.INI file
Settings. When processing this message, the Simualte_Int and Exec_Int services must not be used.
Sys_VM_Init message: VxD received this message after the Init_Complete message. VxD should
This initializes the hardware and software status of the system virtual machine. If VxD sets the carry flag back, VMM
Terminate all processes and exit Windows.
Sys_VM_Terminate message: This is the first system virtual machine termination message received by VxD. VxD
You can start preparing for the termination of the virtual machine. Simulate_Int and Exec_Int services are effective
The traditional virtual machine is always the last virtual machine to be terminated.
System_Exit message: This is the first message received by VxD when the system is terminated. VMM is sending
Send this message after sending Sys_VM_Terminate message, interrupt is allowed, but Simualte_Int
And Exec_Int services are no longer valid. If this message comes from the result of a fatal error, VxD may
In order to restore the system state by modifying the memory of the system virtual machine, so that Windows can terminate and
Does not crash.
VM_Critical_Init message: This is when a new VxD (virtual machine-Translator's Note) is created
The second message received by VxD when it was built. VxD can be returned by setting the carry flag to prevent virtual
The machine is established. Interrupts are forbidden, and Simualte_Int and Exec_Int services are no longer valid.
VM_Init message: This is the third message received by VxD when a new VxD is created. VxD
The hardware and software status of the virtual machine should be initialized, for example, the virtual display device performs INT 10H function
The initial display mode can be set.
VM_Not_Execute message: This is the second virtual machine termination message received by VxD (if virtual
The machine has been deleted by the virtual shell device, this is the first message received). VxD can pass inspection
The flag in the EDX register to find out the reason for termination. Simulate_Int and Exec_Int service pair
The virtual machine that got this message is no longer valid.
VM_Resume message: VxD receives this message when the execution of the virtual machine is resumed, such as switching to
At the front desk. VxD should lock any resources and prepare the internal structure for the virtual machine to restart. in case
VxD sets the carry flag back, and VMM does not resume execution of the virtual machine.
VM_Suspend message: VxD receives this message when the virtual machine has been suspended, for example after switching to
Desk time. VxD should unlock any resources related to the virtual machine.
VM_Terminate message: This is the first virtual machine termination message received by VxD. VxD can be opened
Start preparing for the termination of the virtual machine. Simulate_Int and Exec_Int services are valid.

Eight, VxD initialization

The VMM does the following when initializing a VxD:
1. Load the real-mode initialization section and call the real-mode initialization process. The process can be completed to prevent
Load VxD, prevent Windows from starting, specify device instance data and select pages in memory to
Equipment-specific work.
2. Load other VxD segments into the protected mode memory in 32-bit flat memory mode, and discard the real mode
Initialize the segment.
3. Send Sys_Critical_Init message to the device control process. Disable hardware interrupts, so VxD
It should use as little time as possible to complete its initialization.
4. Send Device_Init message to the device control process. Allow hardware interrupts, so it must be accurate
Let VxD manage interrupts from the device.
5. Send the Init_Complete message to the device control process.
6. Discard the initialization code and data segment, and free up other used memory. VxD cannot be processed
The Init_Complete message later attempts to access the processes and data in these segments.
At any time during the initialization process, VxD can set the carry flag back to VMM to prevent
Mount VxD. Some VMM services, such as the initialization information service, are only valid during the initialization process.

Nine, real mode initialization

Any static device driver can provide real mode initialization process to switch to in Windows
Perform the initialization task before the protection mode. This process is called when the VMM loads the VxD, and the process is checked
Relevant Windows environment, including the relevant settings in the registry and initialization file to determine whether
The VxD should be loaded. This process can also return information to Windows for each virtual machine
Example specifies that physical memory pages are reserved for device-specific and data item addresses. To get an initial about real mode
For more information, please refer to the relevant information.

Ten, VxD service

VxD can provide service functions (functions or procedures-translator's note) for VMM and other VxD use.
These services allow other VxDs to directly access the characteristics of the VxD, allowing testing and modification of the VxD
Functions and capabilities.
VxD cannot export functions like Windows DLL. Instead, VMM provides it through INT 20H
Dynamic link to the VxD service, the interrupt handling process uses the service number to determine the support service
VxD, the interrupt handling process also uses the service number to query the service address in the VxD service table.
The following content describes how to define a service in VxD, declare a VxD service table and from a VxD
Introduce services to another VxD.

1. Define the service

VxD uses BeginProc and EndProc macros as well as Service and Async_Service options
Service. The macro marks the start and end of the service process code, and the option identifies that the process is a service.
The following example shows the definition of VSAMPLED_Get_Version service:
BeginProc VSAMPLED_Get_Version, Service
mov ax, 030Ah
clc
ret
EndProc VSAMPLED_Get_Version
The Async_Service option identifies that the service can be called asynchronously, which means that the interrupted service
Called during the process. Asynchronous services must be reentrant and cannot call VMM and are not asynchronous services
VxD services.
VMM and standard VxD use two calling conventions for services: register-based calling convention and
32-bit C language calling convention. These two calling conventions have different service name formats, and the parameters are passed
And return value method and register protection.
For register-based services, the service name should not start with an underscore (_), all parameters
Passed through the register, the result is also returned through the register, the service protects all not explicitly used for return
Value register.
For C-based services, the service name must start with an underscore (_), all parameters are
Pass the 32-bit value on the stack, and the result (if any) passes through the EAX register (32-bit value)
Or EAX and EDX registers (64-bit value) return, service protection EBX, ES, FS and GS send
Memory and ESI and EDI registers, only the flag register and EAX, EBX, EDX registers are
modify.

2. Declaration service

VxD uses the Begin_Service_Table and End_Service_Table macros to declare services. Macro
Note the start and end of the list containing the service name and optional segment name containing the service. Statement must be built
Standing in the VxD definition file (that is, including Declare_Virtual_Device
Macro file), and must first define the device designation symbol. The following example gives
An example VxD-VSAMPLED service table statement:
Create_VSAMPLED_Service_Table equ 1

Begin_Service_Table VSAMPLED
VSAMPELD_Service VSAMPLED_Get_Version, Local
VSAMPLED_Service VSAMPLED_Service_1
VSAMPLED_Service VSAMPLED_Service_2, VxD_ICODE
End_Service_Table VSAMPLED
In the above example, the Create_VSAMPLED_Service_Table symbol is set immediately before the service table declaration
Meaning, specify the Begin_Service_Table macro to create a service table for VSAMPLED. The statement begins with
After, the VSAMPLED_Service macro defines the actual service, this macro is Begin_Service_Table
The macro created is only valid in the service table declaration. Each service name must match the service definition name, that is
The name given by the BeginProc macro is fully consistent.
When declaring a service, if a service is defined in the file containing the declaration of the service table, it must be in the service
Use the LOCAL option after the service name, which means that if the LOCAL option is not used, the service table will automatically sound
It is clear that a service is an external service. In the above example, the VSAMPLED_Get_Version service is defined in
In the file declared in the service table.
Similarly, if a service is not defined in the VxD_CODE section, it must be noted after the service name
Ming section name. In the above example, the VSAMPLED_Service_2 service is defined in the VxD_ICODE section.
The order of service declarations is very important. The first service declared in VxD must be
Get_Version service (this service clears the carry flag and returns the VxD version in the AX register
No.), any new service added to VxD must be defined at the end of the service table (or defined in the service
In the space explicitly reserved in the table). Because VMM relies on the correct order of services in the service table to link
Service, inserting a new service in the middle of the service table requires all VxD services used by VxD to be rebuilt.
For convenience, the service table declaration should be placed in an include file so that other VxDs can pass
Including the file to introduce services without redeclaring.

3. Introduce services

A VxD can introduce another VxD service through the service table declaration containing another VxD,
In this case, the definition of the device-specific symbol cannot be declared before the service table (see the previous section
Narration). For example: The VSAMPLED.INC file contains the service table statement for the VSAMPLED service, one
A VxD containing this file can call these services. VxD uses VMMcall macro to call VMM server
Service, use the VxDcall macro to call the VxD service.
Due to different computer configurations, a VxD may fail to load when Windows starts, which says
VxDs that use services provided by other VxDs must verify that other VxD services before calling them
is it effective. In order to verify the service, the VxD calling the service must try to call the VxD providing the service
Get_Version function, if VxD is not loaded, VMM will set the carry flag and send in AX
0 is returned in the memory.

Eleven, VxD API process

A VxD provides V86 mode and protected mode API processes to allow running in a virtual machine
Applications and other software access the features of this VxD. If you want to make these optional processes effective,
VxD must define them as parameters of the Declare_Virtual_Device macro, if not defined,
VMM believes that the VxD has no API process.
Applications or other software running in a virtual machine can set the BX register to VxD
Identify and call the function of obtaining device entry address (INT 2FH 1684H function) to obtain specific virtual
The entry address of the API process of the pseudo-machine. The VMM returns this address so that the application can call it indirectly.
The API process.
When an application calls the entry address, the VMM saves the register of the application and calls
VxD corresponding API process, save the handle of the current virtual machine to the BX register and save
Client_Reg_Struc structure address to EBP register. API process must detect customer deposit
The value of the device (using the Client_Reg_Struc structure) to determine the running API call.
According to the convention, most API processes use the AH register to specify the main function number, and use the AL register
Specify the secondary function number, and other client registers are used for additional parameters. API process is sent by modifying customer
The memory returns the value. The API process can modify the EAX, EBX, ECX, EDX, ESI, and EDI registers.
The following example shows an example API process-VSAMPLED_API_Get_Version:
BeginProc VSAMPLED_API_Get_Version
movzx eax, [ebp.Client_AX]; Get function number
or eax, eax
jnz Undefined

Get_Version:
mov [ebp.Client_AX], 030AH; return value in client register AX
and [ebp.Client_Flags], NOT CF_Mask; clear carry flag
ret

Undefined:
or [ebp.Client_Flags], CF_Mask; set carry flag
ret
EndProc VSAMPLED_API_Get_Version

12. VxD INT 2FH function

VxD can provide INT 2FH functionality by interrupting the installation callback process for INT 2FH. INT 2FH
The function allows applications and other software running in a virtual machine to not provide APIs in VxD
VxD can be accessed in the case of process, for example, standard virtual display device support and Windows display driver
Set of INT 2FH functions for program communication.
Windows installs its own INT 2FH interrupt handler to support various functions to allow MS-DOS
Device driver and TSR perform specific actions during Windows startup or virtual machine operation
Make. For more information about these features, please refer to the relevant materials.

Thirteen, build a VxD

A VxD should be created by performing the following steps:
1. Create VxD source files and use the 32-bit flat mode assembler MASM.EXE (MASM 6.11 and above
——Translator's Note) Assemble the source files.
2. Create a module definition file (DEF file) and connect with the 32-bit flat mode connector LINK.EXE
Connect to the target file. According to convention, the resulting executable file should have the same file name as VxD.
The file extension is VXD.
3. Use MAPSYM.EXE to create debugging information for the executable file.
VxD is not compatible with Windows dynamic link libraries, and Windows-based applications cannot be directly
Loading and using VxD, however, Win32-based applications can be created by using CreateFile
Load the dynamically loaded VxD with DeviceIoControl function and interact with it. VxD module
The definition file has the following format:
LIBRARY VSAMPLED

DESCRIPTION 'VSAMPLED Device (Version 4.0)'

EXETYPE DEV386

SEGMENTS
_LTEXT PRELOAD NONDISCARDABLE
_LDATA PRELOAD NONDISCARDABLE
_ITEXT CLASS 'ICODE' DISCARDABLE
_IDATA CLASS 'ICODE' DISCARDABLE
_TEXT CLASS 'PCODE' NONDISCARDABLE
_DATA CLASS 'PCODE' NONDISCARDABLE

EXPORTS
VSAMPLED_DDB @ 1
The LIBRARY statement must specify a VxD name that is the same as in the known device description block (DDB),
The EXPORT statement must specify a DDB name. In any case, the DDB lead-out number is 1.

Manual Pulse Generator

A manual pulse generator (MPG) is a device normally associated with computer numerically controlled machinery or other devices involved in positioning. It usually consists of a rotating knob that generates electrical pulses that are sent to an equipment controller. The controller will then move the piece of equipment a predetermined distance for each pulse.
The CNC handheld controller MPG Pendant with x1, x10, x100 selectable. It is equipped with our popular machined MPG unit, 4,5,6 axis and scale selector, emergency stop and reset button.

Manual Pulse Generator,Handwheel MPG CNC,Electric Pulse Generator,Signal Pulse Generator

Jilin Lander Intelligent Technology Co., Ltd , https://www.jllandertech.com