ainDlg", 0, (FARPROC) MainDlgProc) ; BogusStop() ; } } else MessageBox(0, "Bogus device not found", "WinTest", MB_ICOMMAND|MB_OK|MB_APPLMODAL) ; } else MessageBox(0, "Another instance already running", "WinTest", MB_ICONEXCLAMATION|MB_OK|MB_APPLMODAL) ; return 0 ; } /* */ ______________________________________________________________________  5. wintest.c.   vxd2.asm ( 6 7) . , , , (Device Driver Kit - DDK) Windows Microsoft, .. 32- , DDK (MASM5). DDK- LINK386 ADDHDR. , (include files), DDK. , VxD , Declare _Virtual_Device, , Windows. , , - , VxD. , . , , . VxD , - . . _____________________________________________________________________ PAGE ,132 title VxD2B.ASM - #2b ;EM VxD2B - #2b ; ; Copyright 1992, Cherry Hill Software ; All rights reserved ; ; SUMMARY () ; . ; () : ; ; 0 - (Start) -. ; -. ; 1/10 . ; . ; ; 1 - EOI. ; " " (End- ; of-interrupt - EOI) ; . ; . ; : ; . ; ; : ; ; 0 - 1, ; , 1 , ; , ; . , ; 1, , ; . ; ; 1 - 1, ; , ; , ; . , , ; , ; 1, . ; ; : ; . ; ; WARNINGS () ; ; .386p .xlist include vmm.inc include debug.inc include v86mmgr.inc include vpicd.inc include ..\include\bogus.inc .list VM_Not_Executable equ VM_Not_Executeable ; acckk; subttl VxD Declaration/Definition page VxD2B_Init_Order equ VNETBIOS_Init_Order+100 ; VxD2B_Device_ID equ Bogus_Device_ID Declare_Virtual_Device VXD2, 1, 0, Vxd2B_Control, VxD2B_Device_ID, \ VxD2B_Init_Order VxD_DATA_SEG ; ; ; ; VPIDC_Virtualize_IRQ. ; , ; , , VPICD, ; VM VM ; . ; IRQD VPICD_IRQ_Descriptor hIRQ dd -1 ; IRQ hOwner dd -1 ; , VM hTimeout dd 0 ; - bFakeData dd 01111111b ; - VxD_DATA_ENDS subttl Dispatch VxD Control page VxD_LOCKED_CODE_SEG BeginProc CheckOwner, NO_LOG cmp ebx,hOwner jne short col ret ; , col: cmp hOwner,-1 jne short co2 ; , mov hOwner,ebx ; ret co2: mov al,-1 ret EndProc CheckOwner BeginProc TimeoutProc mov hTimeout,0 ; cmp edx,hOwner ; ? jne short tol ; , test bFakeData,FAKE_STAT_BUSY ; -? jnz short tol ; , cmp hOwner,-1 ; ? je short tol ; , mov eax,hIRQ mov ebx,hOwner VxDcall VPICD_Set_Int_Request ; mov al,bFakeData and al,NOT (FAKE_STAT_IRQ) ; or al,FAKE_STAT_BUSY ; , mov bFakeData,al tol: ret End Proc TimeoutProc ;IP Port_IO_Callback - FAKE_PORT ; ; ENTRY () ; EAX - ( ) ; EBX - VM ; ECX - - ; DS,ES - FLAT ; ; EXIT () ; EAX - ( ) ; ; WARNINGS () ; ; NOTES () ; , ; . ; ; . ; ; CALLS () BeginProc Port_IO_Callback, NO_LOG Dispatch_Byte_IO Fall_through,Port_Output_Callback Port_Input_Callback: call CheckOwner jc short ioexit mov al,bFakeData or bFakeData,FAKE_STAT_ERROR ; ioexit: ret Port_Output_Callback: call CheckOwner jc short ioexit ; -, test al,FAKE_CTL_START jnz short,poc1 ;, - test bFakeData,FAKE_START_BUSY jz short,poc1 ;, test bFakeData,FAKE_START_IRQ jz short,poc1 ;, IRQ push eax push edx and bFakeData,NOT (FAKE_STAT_ERROR) ; mov eax,100 ; 1/10 mov edx,hOwner ; mov esi,OFFSET32 TimeoutProc VMMcall Set_VM_Time_Out pop edx pop eax or esi,esi jz short,poc1 ;, and bFakeData,NOT (FAKE_STAT_BUSY) ; or bFakeData,FAKE_STAT_ERROR ; mov hTimeout,esi ; - poc1: test al,FAKE_CTL_EOI jnz short poc2 ; , EOI test bFakeData,FAKE_STAT_IRQ ; ? jnz short poc2 ; , or bFakeData,FAKE_STAT_IRQ ;, - push eax mov eax,hIRQ VxDcall VPICD_Clear_Int_Request pop eax poc2: ret EndProc Port_IO_Callback ; ECX == 0 if unmasking (enabling), ECX != 0 if masking (disabling). BeginProc VxD2_Mask_Change_Proc call CheckOwner jc short mcp9 ; , jcxz mcp9 ; , () ; ; . VM ; . ; mov hOwner,-1 ; mcp9: ret EndProc VxD2_Mask_Change_Proc ; , ISR BeginProc VxD2_VInt_Proc mov eax,High_Pri_Device_Boost VMMCall Adjust_Exec_Priority ; ret EndProc VxD2_VInt_Proc ; ISR (IRETs) BeginProc VxD2_IRET_Proc mov eax,-(High_Pri_Device_Boost) VMMCall Adjust_Exec_Priority ; ret EndProc VxD2_IRET_Proc ifdef DEBUG BeginProc VxD2B_Debug_Query Trace_Out "VxD2 has no debug command support." clc ret End Proc VxD2B_Debug_Query endif ; ; VxD2B_Control ; CtlDisp macro x Control_Dispatch x, VxD2B_&x endm Begin_Control_Dispatch VxD2B CtlDisp Device_Init ifdef DEBUG CtlDisp Debug_Query endif End_Control_Dispatch VxD2B VxD_LOCKED_CODE_ENDS VxD_CODE_SEG VxD_CODE_ENDS subttl VxD Initialization page VxD_ICODE_SEG page ; EP VxD2B_Device_Init - ; ; ENTRY () ; EBP - ; EBX - VM ; DS,ES - FLAT ; ; EXIT () ; SUCCESS () ; Carry clear (" ") ; FAILURE () ; Carry set (" ") ; ; ; WARNINGS () ; ; NOTES () ; ; CALLS () ; BeginProc VxD2B_Device_Init Debug_Out "VxD2B_Device_Init" mov edi,OFFSET32 IRQD VxDcall VPICD_Virtualize_IRQ ; jc short vdi1 ; , mov hIRQ,eax ; mov edx,FAKE_PORT mov esi,OFFSET32 Port_IO_Callback VMMCall Install_IO_Handler VMMCall Enable_Global_Trapping ; clc ; vdi1: ret EndProc VxD2B_Device_Init VxD_ICODE_ENDS VxD_REAL_INIT_SEG VxD2B_Real_Init LABEL FAR ; , Windows mov ax,Device_Load_OK ; VxD xor bx,bx ; (Exclude) EMM xor si,si ; ; edx ret VxD_REAL_INIT_ENDS END VxD2B_Real_Init ; _____________________________________________________________________  6. vxd2.asm _____________________________________________________________________ LIBRARY VXD2 DESCRIPTION 'Enhanced Windows VXD2(B) Device (Version 1.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 VXD2_DDB @1 _____________________________________________________________________  7. vxd2.def ,  , Windows , , VM , VxD , . , , Windows , VxD. VxD -------------------+-------------------------------------------------- Sys_Critical_Init | ; | . VxD | . -------------------+-------------------------------------------------- Device_Init | ; VxD - | ; | DOS. -------------------+-------------------------------------------------- Init_Complete | , VxD | Device_Init. -------------------+-------------------------------------------------- System_Exit | , Windows | DOS. | DOS , | Windows. -------------------+-------------------------------------------------- Sys_Critical_Exit | ; | . -------------------+-------------------------------------------------- Create_VM | | VM; VxD , | VM. -------------------+-------------------------------------------------- VM_Critical_Init | VM. -------------------+-------------------------------------------------- VM_Init | VM. Sys_VM_Init | VxD | VM. -------------------+-------------------------------------------------- Query_Destroy | VxD | | VM. -------------------+-------------------------------------------------- VM_Terminate | Sys_VM_Terminate | VM. | VM, , | , , | Windows. -------------------+-------------------------------------------------- VM_Not_Executeable | VM . | VM. -------------------+-------------------------------------------------- VxD Device_Init. - 11, . VxD - . VxD , . Install_IO_Handler , -. , - VM, Windows (Virtual Machine Manager - VMM) VxD , -. VPICD_Virtualize_IRQ , . , ( IRQ 11) . ""  - (141) VM ( , ), VxD Port_IO_Callback (. 6). Dispatch_Byte_IO - ( : byte, word, dword, string ..) : . . , . - , . , ( TimeoutProc) 1/10 BUSY. , VPICD_Clear_Int_ Request . TimeoutProc - VM VPICD_Clear_Int_Request . dostest wintest ( EOI) . VxD2_VInt_Proc VxD2_IRET _Proc. , VPICD_Virtualize_IRQ. VM. VM, . VxD VM, . ( , VM , VM.)  VxD VxD, Windows device= [386Enh] system.ini. Windows , VxD . , dostest wintest.  Windows , . , MIPS, Windows NT 80x86, MS-DOS.