📄 vmm.h
字号:
_PTEXT ENDS
MakeCodeSeg MACRO seglist, classname, grpname, iseg
IRP segname,<seglist> ;; For each name in the list
IFNB <classname>
segname SEGMENT DWORD PUBLIC _FLAT "&classname&CODE"
ELSE
segname SEGMENT DWORD PUBLIC _FLAT "&segname&CODE"
ENDIF
IFB <iseg>
VxD_&&segname&&_CODE_SEG MACRO
segname SEGMENT
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_PCODE
ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
ENDM
ELSE
VxD_&&segname&&_CODE_SEG MACRO
segname SEGMENT
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + iseg
ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
ENDM
ENDIF
VxD_&&segname&&_CODE_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
segname ENDS
ENDM
segname ENDS
IFNDEF BLD_COFF
IFNB <grpname>
_&grpname GROUP segname
ELSE
_&&segname GROUP segname
ENDIF
ENDIF
ENDM ;; End for each segment
ENDM
MakeCodeSeg <LOCKABLE_BEGIN, LOCKABLE, LOCKABLE_END>, \
LOCKABLE, LOCKABLE, ??_LOCKABLECODE
MakeCodeSeg INT21
MakeCodeSeg SYSEXIT
MakeCodeSeg RARE
MakeCodeSeg W16
MakeCodeSeg W32
MakeCodeSeg VMCREATE
MakeCodeSeg VMDESTROY
MakeCodeSeg THCREATE
MakeCodeSeg THDESTROY
MakeCodeSeg VMSUSPEND
MakeCodeSeg VMRESUME
MakeCodeSeg PNP
MakeCodeSeg DOSVM
;*** DefLockableCodeBegin - define beginning of lockable code
;
; Defines a label with the given name to mark the beginning
; of the lockable code area for this VxD. In the debug version,
; also defines a DWORD containing DFS_TEST_BLOCK so that
; procedures in the lockable code segment defined with
; BeginProc may call _Debug_Flags_Service with flags appropriate
; to the code's current state.
DefLockableCodeBegin MACRO name, private
VxD_LOCKABLE_BEGIN_CODE_SEG
IFB <private>
PUBLIC name
ENDIF
name LABEL NEAR
VxD_LOCKABLE_BEGIN_CODE_ENDS
ifndef WIN31COMPAT
if DEBLEVEL
VxD_LOCKED_DATA_SEG
PUBLIC name&_Debug_Flags
name&_Debug_Flags DD DFS_TEST_BLOCK
VxD_LOCKED_DATA_ENDS
??_debug_flags equ <name&_Debug_Flags>
endif
endif
ENDM
;*** DefLockableCodeEnd - define end of lockable code
;
; Defines a label with the given name to mark the end
; of the lockable code area for this VxD. By subtracting
; the offset of the beginning label from the offset of
; the ending label, the VxD may determine how many bytes
; of memory to lock or unlock.
DefLockableCodeEnd MACRO name, private
VxD_LOCKABLE_END_CODE_SEG
IFB <private>
PUBLIC name
ENDIF
name LABEL NEAR
VxD_LOCKABLE_END_CODE_ENDS
ENDM
;*** CodeLockFlags - declare locked code debug flags
;
; This macro declares the locked code debug flags.
CodeLockFlags MACRO name
ifndef WIN31COMPAT
if DEBLEVEL
ifndef name&_Debug_Flags
VxD_LOCKED_DATA_SEG
extrn name&_Debug_Flags:dword
VxD_LOCKED_DATA_ENDS
??_debug_flags equ <name&_Debug_Flags>
endif
endif
endif
ENDM
;*** MarkCodeLocked - signify that lockable code is locked
;
; This macro clears DFS_TEST_BLOCK in the debug flags
; DWORD.
MarkCodeLocked MACRO
ifndef WIN31COMPAT
if DEBLEVEL
ifdef ??_debug_flags
pushfd
and ??_debug_flags,NOT DFS_TEST_BLOCK
popfd
endif
endif
endif
ENDM
;*** MarkCodeUnlocked - signify that lockable code is unlocked
;
; This macro sets DFS_TEST_BLOCK in the debug flags
; DWORD.
MarkCodeUnlocked MACRO
ifndef WIN31COMPAT
if DEBLEVEL
ifdef ??_debug_flags
pushfd
or ??_debug_flags,DFS_TEST_BLOCK
popfd
endif
endif
endif
ENDM
;* 32 bit initialization code
_ITEXT SEGMENT DWORD PUBLIC _FLAT 'ICODE'
_ITEXT ENDS
;* 32 bit locked data
_LDATA SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_LDATA ENDS
_DATA SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_DATA ENDS
;* 32 bit pageable data
_PDATA SEGMENT DWORD PUBLIC _FLAT 'PDATA'
_PDATA ENDS
;* 32 Bit initialization data
_IDATA SEGMENT DWORD PUBLIC _FLAT 'ICODE'
_IDATA ENDS
;* Created by C8
_BSS SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_BSS ENDS
CONST SEGMENT DWORD PUBLIC _FLAT 'LCODE'
CONST ENDS
_TLS SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_TLS ENDS
;* 32 Bit static code for DL-VxDs
_STEXT SEGMENT DWORD PUBLIC _FLAT 'SCODE'
_STEXT ENDS
;* 32 Bit static data for DL-VxDs
_SDATA SEGMENT DWORD PUBLIC _FLAT 'SCODE'
_SDATA ENDS
;* dummy segment for IsDebugOnlyLoaded
_DBOSTART SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DBOSTART ENDS
;* 32 bit debug only code; loaded only if debugger is present
_DBOCODE SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DBOCODE ENDS
;* 32 bit debug only data; loaded only if debugger is present
_DBODATA SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DBODATA ENDS
if DEBLEVEL
;* Start of 32 bit path coverage data
_PATHSTART SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_PATHSTART ENDS
;* 32 bit path coverage data
_PATHDATA SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_PATHDATA ENDS
;* End of 32 bit path coverage data
_PATHEND SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_PATHEND ENDS
endif
;* 16 bit code/data that is put into IGROUP automaticly
_16ICODE SEGMENT WORD USE16 PUBLIC '16ICODE'
_16ICODE ENDS
;* Real Mode initialization code/data for devices
_RCODE SEGMENT WORD USE16 PUBLIC 'RCODE'
_RCODE ENDS
IFNDEF BLD_COFF
_LGROUP GROUP _LTEXT, _TEXT, _LDATA, _DATA, _BSS, CONST, _TLS
_IGROUP GROUP _ITEXT, _IDATA
_SGROUP GROUP _STEXT, _SDATA
_DBOGROUP GROUP _DBOSTART, _DBOCODE, _DBODATA
IF DEBLEVEL
_PGROUP GROUP _PATHSTART, _PATHDATA, _PATHEND
ENDIF
ENDIF
endif ; NO_SEGMENTS
ASSUME CS:FLAT, DS:FLAT, ES:FLAT, SS:FLAT
OFFSET32 EQU <OFFSET FLAT:>
BeginDoc
;==============================================================================
; The following macros are used in defining the routines
; in a VxD which are going to be registered with VMM as callable entry
; points. Once registered, the entry points can be called by any other
; devices via the "VxDCall" macro, defined below. In the comments below,
; replace "VxD" with the appropriate device name.
;
;*******
; In the VxD.INC file, put the following lines, replacing <function_name>
; with an appropriate name describing the function of the routine.
;
; Begin_Service_Table VxD[,<segname>]
; VxD_Service <function_name>[,<local segname>]
; VxD_Service <function_name>[,<local segname>]
; . . .
; VxD_Service <function_name>[,<local segname>]
; End_Service_Table VxD[,<segname>]
;
; Note that <segname> is an optional argument and, if specified, the
; table is put in the segment defined by the macro "yyy_Data_Seg",
; where yyy=segname. Otherwise the segment is defined by the
; "VxD_Data_Seg" macro, defined below.
; Note that <local segname> is an optional argument and, if specified,
; the procedure's segment is defined by the macro "zzz_Code_Seg",
; where zzz=segname. Otherwise the segment is defined by the
; "VxD_Code_Seg" macro, defined below.
;
;*******
; One VxD module should have the following in order to define the entry points:
;Create_VxD_Service_Table = 1 ; Only in module where table is
; INCLUDE VxD.INC ; Include the table definition
;
;*******
; All modules that want to call the services defined in the table should include
; VxD.INC, but not define the label "Create_VxD_Service_Table". This
; will define the service names to be used with the VxDCall macro.
;
EndDoc
Begin_Service_Table MACRO Device_Name, Def_Segment
IFDEF Device_Name&_Name_Based
IFNDEF @@NextInternalID
@@NextInternalID = 0
ENDIF
@@NextInternalID = (@@NextInternalID + 1)
Device_Name&_Internal_ID = @@NextInternalID + BASEID_FOR_NAMEBASEDVXD
DefineVxDName Device_Name, %Device_Name&_Internal_ID
ENDIF
IFB <Def_Segment>
BST2 Device_Name, VxD
ELSE
BST2 Device_Name, Def_Segment
ENDIF
ENDM
DefineVxDName MACRO Device_Name, InternalID
@@VxDName&InternalID EQU <___&Device_Name&STable>
ENDM
BST2 MACRO Device_Name, Def_Segment
Num_&Device_Name&_Services = 0
IFDEF Create_&Device_Name&_Service_Table
Def_Segment&_LOCKED_DATA_SEG
Device_Name&_Service_Table LABEL DWORD
Device_Name&_Service MACRO Procedure, Local_Seg, Condition
LOCAL $$&Procedure
IFNB <Condition>
$$&&Procedure MACRO extern
IFDEF &Condition
IFNB <extern>
EXTRN Procedure:NEAR
ELSE
dd OFFSET32 Procedure
ENDIF
ELSE
IFB <extern>
dd 0
ENDIF
ENDIF
ENDM
ENDIF
IFDIFI <Procedure>, <RESERVED>
PUBLIC _&&Procedure
IF1
_&&Procedure LABEL DWORD
ENDIF
IFDIFI <Local_Seg>, <LOCAL>
IFNB <Local_Seg>
Local_Seg&&_SEG
ELSE
Def_Segment&_CODE_SEG
ENDIF
IFNB <Condition>
$$&&Procedure extern
ELSE
EXTRN Procedure:NEAR
ENDIF
IFNB <Local_Seg>
Local_Seg&&_ENDS
ELSE
Def_Segment&_CODE_ENDS
ENDIF
ENDIF
IFNB <Condition>
$$&&Procedure
ELSE
dd OFFSET32 Procedure
ENDIF
IFDEF Device_Name&_Name_Based
@@&&Procedure = (Device_Name&_Internal_ID SHL 16) + Num_&Device_Name&_Services
ELSE
@@&&Procedure = (Device_Name&_Device_ID SHL 16) + Num_&Device_Name&_Services
ENDIF
ELSE
dd 0
ENDIF
Num_&Device_Name&_Services = Num_&Device_Name&_Services + 1
IFNB <Condition>
Purge $$&&Procedure
ENDIF
ENDM
ELSE
; Local_Seg and Condition are placeholders only in this form
IFDEF Device_Name&_Name_Based
Device_Name&_Service MACRO Procedure, Local_Seg, Condition
IFDIFI <Procedure>, <RESERVED>
@@&&Procedure = (Device_Name&_Internal_ID SHL 16) + Num_&Device_Name&_Services
ENDIF
Num_&Device_Name&_Services = Num_&Device_Name&_Services + 1
ENDM
ELSE
Device_Name&_Service MACRO Procedure, Local_Seg, Condition
IFDIFI <Procedure>, <RESERVED>
@@&&Procedure = (Device_Name&_Device_ID SHL 16) + Num_&Device_Name&_Services
ENDIF
Num_&Device_Name&_Services = Num_&Device_Name&_Services + 1
ENDM
ENDIF
ENDIF
ENDM
;------------------------------------------------------------------------------
End_Service_Table MACRO Device_Name, Def_Segment
PURGE Device_Name&_Service
IFDEF Create_&Device_Name&_Service_Table
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -