VXD entry tutorial
The webmaster has contacted Dingkai many times, but the email is returned, and his mailbox cannot be used.
1. Background knowledge In order to understand the examples given this article, it requires C, compiling and Windows device drivers. 2. Development tools require Microsoft Visual C 2.0 or more, MASM 6.11c, and Windows 95 DDK (following VC 6.0 as an example) 3. Purpose with the development tools listed above, write a dynamically loaded VXD, using this VXD The interrupt vector table at the memory address 0 can be read. 4. Start the first step: Create a new project with VC , name MINIVXD, type WIN32 App or Console App due to VC does not provide directly generating VXD APP Wizard, so I have to select one in the above two APPs, then then Make a manual modification, only one thing you need to modify, that is, on the line command line plus one option / vxd Step 2: New an empty file, enter the following code: Title minivxd - by ding kai .386p include Vmm.inc minivxd_dynamic EQU 1; Defines the device driver block DDB, since it is dynamically loaded, so the device ID and the order sequence can take an undefined value. Declare_virtual_device minivxd, 1, 0, msgdispatch, / undefined_Device_id, undefined_init_order, 0, 0 VXD_LOCKED_CODE_SEG; defined message dispatch table, the present embodiment requires only one message, i.e. w32_deviceIoControl, for use from the Win32 App; DeviceIoControl API function to communicate with the present VxD BeginProc MsgDispatch Control_Dispatch w32_DEVICEIOCONTROL, W32DeviceIoControl, sCall,
Take the file, the file name is VxDSTub.ASM, then compile this file with the following command: aml -coff -w2 -dbld_coff -dis_32 -c -cx -dmasm6 -i / 95ddk / inc32 vxdstub.asm this will generate vxdstub.obj To add this OBJ file into the project file. Step 3: Create a C language file, the file name is minivxd.c, enter the following code in the file: #Define Win40Services #pragma Warning (Disable: 4229) #include
Add this document to the project file. Step 4: Create a module definition file, this file will define the segment property of the finally generated VXD file and output the device driver block, enter the following code, and save the file as Minivxd. def, while adding it to the project file. VXD MINIVXD DYNAMIC DESCRIPTION 'Written by Ding Kai' SEGMENTS _LTEXT CLASS 'LCODE' PRELOAD NONDISCARDABLE _LDATA CLASS 'LCODE' PRELOAD NONDISCARDABLE _TLS CLASS 'LCODE' PRELOAD NONDISCARDABLE _BSS CLASS 'LCODE' PRELOAD NONDISCARDABLE _ITEXT CLASS 'ICODE' DISCARDABLE _IDATA CLASS 'ICODE' DISCARDABLE _PTEXT CLASS 'PCODE' NONDISCARDABLE _PDATA CLASS 'PDATA' NONDISCARDABLE SHARED HEAPSIZE 10240 STACKSIZE 40960 EXPORTS MINIVXD_DDB @ 1 of course, some of this segment does not exist in the program, to be listed here Want to do this file as a template for later use. Step 5: Join the last one of the project files, vxdwarps.clb, this file is DDK's lib directory. Step 6: The four files needed to be completed, they are: vxdstub.obj minivxd.c MINIVXD.DEF VXDWARPS.CLB Checks the file path before making Make, and must include the Inc32 directory in the DDK directory in Include. After confirming, press the F7 key to make Make. The result will generate a minivxd.vxd file in the debug directory or release directory (depending on the settings of the project file). At this point, a small VXD file is generated, and can communicate with this VXD with the following code in the program. Byte Buffer [1024]; DeviceioControl (HVXD, 1, NULL, NULL, BUFFER, 1024, NULL, 0); As a result, the current interrupt vector table will appear in the buffer array.
This article no longer provides a complete test program. If you need, please contact the author 5. Small junction This article describes how to write a dynamically installed VXD in Windows 95, this method and Vxd written in this method WINDOWS 98 is equally applicable. However, in Windows NT, this method cannot be used. Interested friends, please pay attention to this Latest update or contact me.
Dikai's Book on May 16, 1999