穷摇
普通会员
普通会员
  • 铜币0枚
  • 威望0点
  • 贡献值0点
阅读:733回复:11

[求助]谁有冲击波源文件

楼主#
更多 发布于:2004-03-06 18:38
工作需要,想想见识一下。 -------------------- 沉舟侧畔千帆过,病树前头万木春.
    沉舟侧畔千帆过,病树前头万木春.
        沉舟侧畔千帆过,病树前头万木春.
[color=#00a010]沉舟侧畔千帆过,病树前头万木春. 沉舟侧畔千帆过,病树前头万木春. 沉舟侧畔千帆过,病树前头万木春. [/color]
纷花雪月
著名写手
著名写手
  • 铜币19枚
  • 威望0点
  • 贡献值0点
  • 社区居民
1C#
发布于:2004-03-08 14:12
Re:[求助]谁有冲击波源文件
强 -------------------- 春来秋去
花开花落
逝水年年`
年年似水
http://ecardfile.tencent.com/flash//ts/02/ts0232.swf 乐得嘴合不上咯,嘿嘿
slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
2C#
发布于:2004-03-07 08:21
Re:[求助]谁有冲击波源文件

slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
3C#
发布于:2004-03-07 08:17
Re:[求助]谁有冲击波源文件
;vwin32.inc****************************************************************************
;                                                                           *
; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY     *
; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE       *
; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR     *
; PURPOSE.                                                                  *
;                                                                           *
; Copyright (C) 1993-95  Microsoft Corporation.  All Rights Reserved.       *
;                                                                           *
;****************************************************************************

ifndef Not_VxD
Begin_Service_Table VWIN32
VWIN32_Service VWIN32_Get_Version, LOCAL
VWIN32_Service VWIN32_DIOCCompletionRoutine, LOCAL
VWIN32_Service _VWIN32_QueueUserApc
VWIN32_Service _VWIN32_Get_Thread_Context
VWIN32_Service _VWIN32_Set_Thread_Context
VWIN32_Service _VWIN32_CopyMem, LOCAL
VWIN32_Service _VWIN32_Npx_Exception
VWIN32_Service _VWIN32_Emulate_Npx
VWIN32_Service _VWIN32_CheckDelayedNpxTrap
VWIN32_Service VWIN32_EnterCrstR0
VWIN32_Service VWIN32_LeaveCrstR0
VWIN32_Service _VWIN32_FaultPopup
VWIN32_Service VWIN32_GetContextHandle
VWIN32_Service VWIN32_GetCurrentProcessHandle, LOCAL
VWIN32_Service _VWIN32_SetWin32Event
VWIN32_Service _VWIN32_PulseWin32Event
VWIN32_Service _VWIN32_ResetWin32Event
VWIN32_Service _VWIN32_WaitSingleObject
VWIN32_Service _VWIN32_WaitMultipleObjects
VWIN32_Service _VWIN32_CreateRing0Thread
VWIN32_Service _VWIN32_CloseVxDHandle
VWIN32_Service VWIN32_ActiveTimeBiasSet, LOCAL
VWIN32_Service VWIN32_GetCurrentDirectory, LOCAL
VWIN32_Service VWIN32_BlueScreenPopup
VWIN32_Service VWIN32_TerminateApp
VWIN32_Service _VWIN32_QueueKernelAPC
VWIN32_Service VWIN32_SysErrorBox
VWIN32_Service _VWIN32_IsClientWin32
VWIN32_Service VWIN32_IFSRIPWhenLev2Taken, LOCAL
End_Service_Table VWIN32
endif

vseb_s STRUC
vseb_resp DD ?
vseb_b3 DW ?
vseb_b2 DW ?
vseb_b1 DW ?
vseb_pszCaption DD ?
vseb_pszText DD ?
vseb_s ENDS
KERNEL_APC_IGNORE_MC EQU 00000001H
KERNEL_APC_STATIC EQU 00000002H
KERNEL_APC_WAKE EQU 00000004H

DIOCParams STRUC
Internal1 DD ?
VMHandle DD ?
Internal2 DD ?
dwIoControlCode DD ?
lpvInBuffer DD ?
cbInBuffer DD ?
lpvOutBuffer DD ?
cbOutBuffer DD ?
lpcbBytesReturned DD ?
lpoOverlapped DD ?
hDevice DD ?
tagProcess DD ?
DIOCParams ENDS
VWIN32_DIOC_GETVERSION EQU <DIOC_GETVERSION>
VWIN32_DIOC_DOS_IOCTL EQU 1
VWIN32_DIOC_DOS_INT25 EQU 2
VWIN32_DIOC_DOS_INT26 EQU 3
VWIN32_DIOC_DOS_INT13 EQU 4
VWIN32_DIOC_SIMCTRLC EQU 5
VWIN32_DIOC_CLOSEHANDLE EQU <DIOC_CLOSEHANDLE>

DIOCRegs STRUC
reg_EBX DD ?
reg_EDX DD ?
reg_ECX DD ?
reg_EAX DD ?
reg_EDI DD ?
reg_ESI DD ?
reg_Flags DD ?
DIOCRegs ENDS
ifndef FILE_FLAG_OVERLAPPED

_OVERLAPPED STRUC
O_Internal DD ?
O_InternalHigh DD ?
O_Offset DD ?
O_OffsetHigh DD ?
O_hEvent DD ?
_OVERLAPPED ENDS
endif
slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
4C#
发布于:2004-03-07 08:16
Re:[求助]谁有冲击波源文件
;vmm.inc****************************************************************************
;                                                                           *
; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY     *
; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE       *
; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR     *
; PURPOSE.                                                                  *
;                                                                           *
; Copyright (C) 1993-95  Microsoft Corporation.  All Rights Reserved.       *
;                                                                           *
;****************************************************************************

ifdef __BORLANDC__ ;; Vireo
 if ??version LT 500h ;; Vireo
extern equ extrn ;; Vireo
 endif ;; Vireo
endif ;; Vireo

ifndef _VMM_
_VMM_ EQU 1
FALSE EQU 0
VMM_TRUE EQU (NOT FALSE)
DEBLEVELRETAIL EQU 0
DEBLEVELNORMAL EQU 1
DEBLEVELMAX EQU 2
ifndef DEBLEVEL
ifdef DEBUG
DEBLEVEL EQU DEBLEVELNORMAL
else
DEBLEVEL EQU DEBLEVELRETAIL
endif
endif
ifndef WIN31COMPAT
WIN40SERVICES EQU 1
endif

ifndef __BORLANDC__ ;; Vireo

ifdef MASM6
ifndef NO_MASM6_OPTIONS
    option oldmacros
ifndef  NEWSTRUCTS
    option oldstructs
endif
    option noscoped
    option segment:flat
    option offset:flat
    option proc:private
endif
endif

endif ;; Vireo


IFDEF MASM6
BeginDoc MACRO
     ENDM
EndDoc MACRO
       ENDM

BeginMsg MACRO
     ENDM
EndMsg MACRO
       ENDM
ELSE
BeginDoc EQU <>
EndDoc EQU <>

BeginMsg EQU <>
EndMsg EQU <>
ENDIF

UNDEFINED_DEVICE_ID EQU 00000H
VMM_DEVICE_ID EQU 00001H
DEBUG_DEVICE_ID EQU 00002H
VPICD_DEVICE_ID EQU 00003H
VDMAD_DEVICE_ID EQU 00004H
VTD_DEVICE_ID EQU 00005H
V86MMGR_DEVICE_ID EQU 00006H
PAGESWAP_DEVICE_ID EQU 00007H
PARITY_DEVICE_ID EQU 00008H
REBOOT_DEVICE_ID EQU 00009H
VDD_DEVICE_ID EQU 0000AH
VSD_DEVICE_ID EQU 0000BH
VMD_DEVICE_ID EQU 0000CH
VKD_DEVICE_ID EQU 0000DH
VCD_DEVICE_ID EQU 0000EH
VPD_DEVICE_ID EQU 0000FH
BLOCKDEV_DEVICE_ID EQU 00010H
VMCPD_DEVICE_ID EQU 00011H
EBIOS_DEVICE_ID EQU 00012H
BIOSXLAT_DEVICE_ID EQU 00013H
VNETBIOS_DEVICE_ID EQU 00014H
DOSMGR_DEVICE_ID EQU 00015H
WINLOAD_DEVICE_ID EQU 00016H
SHELL_DEVICE_ID EQU 00017H
VMPOLL_DEVICE_ID EQU 00018H
VPROD_DEVICE_ID EQU 00019H
DOSNET_DEVICE_ID EQU 0001AH
VFD_DEVICE_ID EQU 0001BH
VDD2_DEVICE_ID EQU 0001CH
WINDEBUG_DEVICE_ID EQU 0001DH
TSRLOAD_DEVICE_ID EQU 0001EH
BIOSHOOK_DEVICE_ID EQU 0001FH
INT13_DEVICE_ID EQU 00020H
PAGEFILE_DEVICE_ID EQU 00021H
SCSI_DEVICE_ID EQU 00022H
MCA_POS_DEVICE_ID EQU 00023H
SCSIFD_DEVICE_ID EQU 00024H
VPEND_DEVICE_ID EQU 00025H
APM_DEVICE_ID EQU 00026H
VPOWERD_DEVICE_ID EQU APM_DEVICE_ID
VXDLDR_DEVICE_ID EQU 00027H
NDIS_DEVICE_ID EQU 00028H
BIOS_EXT_DEVICE_ID EQU 00029H
VWIN32_DEVICE_ID EQU 0002AH
VCOMM_DEVICE_ID EQU 0002BH
SPOOLER_DEVICE_ID EQU 0002CH
WIN32S_DEVICE_ID EQU 0002DH
DEBUGCMD_DEVICE_ID EQU 0002EH
CONFIGMG_DEVICE_ID EQU 00033H
DWCFGMG_DEVICE_ID EQU 00034H
SCSIPORT_DEVICE_ID EQU 00035H
VFBACKUP_DEVICE_ID EQU 00036H
ENABLE_DEVICE_ID EQU 00037H
VCOND_DEVICE_ID EQU 00038H
ISAPNP_DEVICE_ID EQU 0003CH
BIOS_DEVICE_ID EQU 0003DH
IFSMgr_Device_ID EQU 00040H
VCDFSD_DEVICE_ID EQU 00041H
MRCI2_DEVICE_ID EQU 00042H
PCI_DEVICE_ID EQU 00043H
PELOADER_DEVICE_ID EQU 00044H
EISA_DEVICE_ID EQU 00045H
DRAGCLI_DEVICE_ID EQU 00046H
DRAGSRV_DEVICE_ID EQU 00047H
PERF_DEVICE_ID EQU 00048H
AWREDIR_DEVICE_ID EQU 00049H
ETEN_Device_ID EQU 00060H
CHBIOS_Device_ID EQU 00061H
VMSGD_Device_ID EQU 00062H
VPPID_Device_ID EQU 00063H
VIME_Device_ID EQU 00064H
VHBIOSD_Device_ID EQU 00065H
BASEID_FOR_NAMEBASEDVXD EQU 0f000H
BASEID_FOR_NAMEBASEDVXD_MASK EQU 0fffH
VMM_INIT_ORDER EQU 000000000H
DEBUG_INIT_ORDER EQU 000000000H
DEBUGCMD_INIT_ORDER EQU 000000000H
PERF_INIT_ORDER EQU 000900000H
APM_INIT_ORDER EQU 001000000H
VPOWERD_INIT_ORDER EQU APM_INIT_ORDER
BIOSHOOK_INIT_ORDER EQU 006000000H
VPROD_INIT_ORDER EQU 008000000H
VPICD_INIT_ORDER EQU 00C000000H
VTD_INIT_ORDER EQU 014000000H
VXDLDR_INIT_ORDER EQU 016000000H
ENUMERATOR_INIT_ORDER EQU 016800000H
ISAPNP_INIT_ORDER EQU ENUMERATOR_INIT_ORDER
EISA_INIT_ORDER EQU ENUMERATOR_INIT_ORDER
PCI_INIT_ORDER EQU ENUMERATOR_INIT_ORDER
BIOS_INIT_ORDER EQU ENUMERATOR_INIT_ORDER+1
CONFIGMG_INIT_ORDER EQU ENUMERATOR_INIT_ORDER+0FFFFH
VCDFSD_INIT_ORDER EQU 016F00000H
IOS_INIT_ORDER EQU 017000000H
PAGEFILE_INIT_ORDER EQU 018000000H
PAGESWAP_INIT_ORDER EQU 01C000000H
PARITY_INIT_ORDER EQU 020000000H
REBOOT_INIT_ORDER EQU 024000000H
EBIOS_INIT_ORDER EQU 026000000H
VDD_INIT_ORDER EQU 028000000H
VSD_INIT_ORDER EQU 02C000000H
VCD_INIT_ORDER EQU 030000000H
COMMDRVR_INIT_ORDER EQU (VCD_INIT_ORDER-1)
PRTCL_INIT_ORDER EQU (COMMDRVR_INIT_ORDER-2)
MODEM_INIT_ORDER EQU (COMMDRVR_INIT_ORDER-3)
PORT_INIT_ORDER EQU (COMMDRVR_INIT_ORDER-4)
VMD_INIT_ORDER EQU 034000000H
VKD_INIT_ORDER EQU 038000000H
VPD_INIT_ORDER EQU 03C000000H
BLOCKDEV_INIT_ORDER EQU 040000000H
MCA_POS_INIT_ORDER EQU 041000000H
SCSIFD_INIT_ORDER EQU 041400000H
SCSIMASTER_INIT_ORDER EQU 041800000H
INT13_INIT_ORDER EQU 042000000H
VMCPD_INIT_ORDER EQU 048000000H
BIOSXLAT_INIT_ORDER EQU 050000000H
VNETBIOS_INIT_ORDER EQU 054000000H
DOSMGR_INIT_ORDER EQU 058000000H
DOSNET_INIT_ORDER EQU 05C000000H
WINLOAD_INIT_ORDER EQU 060000000H
VMPOLL_INIT_ORDER EQU 064000000H
UNDEFINED_INIT_ORDER EQU 080000000H
WIN32_INIT_ORDER EQU UNDEFINED_INIT_ORDER
VCOND_INIT_ORDER EQU UNDEFINED_INIT_ORDER
WINDEBUG_INIT_ORDER EQU 081000000H
VDMAD_INIT_ORDER EQU 090000000H
V86MMGR_INIT_ORDER EQU 0A0000000H
IFSMgr_Init_Order EQU 10000H+V86MMGR_Init_Order
FSD_Init_Order EQU 00100H+IFSMgr_Init_Order
VFD_INIT_ORDER EQU 50000H+IFSMgr_Init_Order
UNDEF_TOUCH_MEM_INIT_ORDER EQU 0A8000000H
SHELL_INIT_ORDER EQU 0B0000000H






IO_Delay    macro
jmp $+2
ENDM

VXD_FAILURE EQU 0
VXD_SUCCESS EQU 1

Pushad_Struc STRUC
Pushad_EDI DD ?
Pushad_ESI DD ?
Pushad_EBP DD ?
Pushad_ESP DD ?
Pushad_EBX DD ?
Pushad_EDX DD ?
Pushad_ECX DD ?
Pushad_EAX DD ?
Pushad_Struc ENDS
ifndef Not_VxD
??_CUR_CODE_SEG = 0

??_LCODE    =   1
??_ICODE    =   2
??_PCODE    =   3
??_SCODE    =   4
??_DBOCODE  =   5
??_16ICODE  =   6
??_RCODE    =   7
??_LOCKABLECODE =   8

?_LCODE     equ <(??_CUR_CODE_SEG MOD 16) - ??_LCODE>
?_ICODE     equ <(??_CUR_CODE_SEG MOD 16) - ??_ICODE>
?_PCODE     equ <(??_CUR_CODE_SEG MOD 16) - ??_PCODE>
?_SCODE     equ <(??_CUR_CODE_SEG MOD 16) - ??_SCODE>
?_DBOCODE   equ <(??_CUR_CODE_SEG MOD 16) - ??_DBOCODE>
?_16ICODE   equ <(??_CUR_CODE_SEG MOD 16) - ??_16ICODE>
?_RCODE     equ <(??_CUR_CODE_SEG MOD 16) - ??_RCODE>
?_LOCKABLECODE  equ <(??_CUR_CODE_SEG MOD 16) - ??_LOCKABLECODE>

ifndef NO_SEGMENTS

IFDEF   MASM6
_FLAT   EQU FLAT
ELSE
_FLAT   EQU USE32
ENDIF


_LTEXT      SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_LTEXT      ENDS

_TEXT       SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_TEXT       ENDS


_PTEXT      SEGMENT DWORD PUBLIC _FLAT 'PCODE'
_PTEXT      ENDS



MakeCodeSeg MACRO seglist, classname, grpname, iseg

    IRP segname,<seglist>

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

    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 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 MACRO name, private
VxD_LOCKABLE_END_CODE_SEG
IFB <private>
    PUBLIC  name
ENDIF
name    LABEL   NEAR
VxD_LOCKABLE_END_CODE_ENDS
    ENDM





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 MACRO
ifndef WIN31COMPAT
if DEBLEVEL
ifdef ??_debug_flags
    pushfd
    and ??_debug_flags,NOT DFS_TEST_BLOCK
    popfd
endif
endif
endif
    ENDM






MarkCodeUnlocked MACRO
ifndef WIN31COMPAT
if DEBLEVEL
ifdef ??_debug_flags
    pushfd
    or  ??_debug_flags,DFS_TEST_BLOCK
    popfd
endif
endif
endif
    ENDM



_ITEXT      SEGMENT DWORD PUBLIC _FLAT 'ICODE'
_ITEXT      ENDS


_LDATA      SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_LDATA      ENDS

_DATA       SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_DATA       ENDS


_PDATA      SEGMENT DWORD PUBLIC _FLAT 'PDATA'
_PDATA      ENDS


_IDATA      SEGMENT DWORD PUBLIC _FLAT 'ICODE'
_IDATA      ENDS


_BSS        SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_BSS        ENDS

CONST       SEGMENT DWORD PUBLIC _FLAT 'LCODE'
CONST       ENDS

_TLS        SEGMENT DWORD PUBLIC _FLAT 'LCODE'
_TLS        ENDS


_STEXT      SEGMENT DWORD PUBLIC _FLAT 'SCODE'
_STEXT      ENDS


_SDATA      SEGMENT DWORD PUBLIC _FLAT 'SCODE'
_SDATA      ENDS


_DBOSTART   SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DBOSTART   ENDS


_DBOCODE    SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DBOCODE    ENDS


_DBODATA    SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DBODATA    ENDS

if DEBLEVEL

_PATHSTART  SEGMENT DWORD PUBLIC  _FLAT 'LCODE'
_PATHSTART  ENDS


_PATHDATA   SEGMENT DWORD PUBLIC  _FLAT 'LCODE'
_PATHDATA   ENDS


_PATHEND    SEGMENT DWORD PUBLIC  _FLAT 'LCODE'
_PATHEND    ENDS
endif


_16ICODE    SEGMENT WORD USE16 PUBLIC '16ICODE'
_16ICODE    ENDS


_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

ifdef __BORLANDC__
.model FLAT
endif

    ASSUME CS:FLAT, DS:FLAT, ES:FLAT, SS:FLAT

OFFSET32 EQU <OFFSET FLAT:>


BeginDoc
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



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

IFB <Def_Segment>
VxD_LOCKED_DATA_ENDS
ELSE
Def_Segment&_LOCKED_DATA_ENDS
ENDIF

ENDIF

    ENDM

GetVxDServiceOrdinal    macro   reg,service
    mov reg,@@&service
    endm

GetVxDServiceAddress    macro   reg,service
    mov reg,OFFSET32 service
    endm


















Begin_Win32_Services MACRO VxDName
ifndef Create_Win32_Services
    Create_Win32_Services = 0
endif
    .errb <VxDName>, <VxD name missing>
    ??w32svcno = 0
if Create_Win32_Services
VxDName&_Win32_Services label dword
    dd  csvc&VxDName, 0
endif
    ??inw32svc = 1

    VxDName&_Win32_Service MACRO Name
        .erre ??inw32svc, <Missing Begin_Win32_Services>
    if Create_Win32_Services
        dd  OFFSET32 Name,cparm&&Name
    endif
        @32&&Name equ   ((VxDName&_Device_ID SHL 16) + ??w32svcno)
        ??w32svcno = ??w32svcno + 1
        ENDM
    ENDM










End_Win32_Services MACRO VxDName
    .errb <VxDName>, <VxD name misssing>
if Create_Win32_Services
    csvc&VxDName    equ ($ - VxDName&_Win32_Services)/8 - 1
endif
    ??inw32svc = 0
    PURGE VxDName&_Win32_Service
    ENDM











Declare_Win32_Service MACRO Name, cParms
ifndef Create_Win32_Services
    Create_Win32_Services = 0
endif
if Create_Win32_Services
    ?merge  <Name>,,,,<EQU>,<_>,<Name>,<@>,%(cParms*4 + 8)
    ?merge  <cparm>,<Name>,,,<EQU>,<cParms>
VxD_CODE_SEG
    ?merge  <EXTRN>,,,,,<_>,<Name>,<@>,%(cParms*4 + 8),<:NEAR>
VxD_CODE_ENDS
endif
    ENDM












Win32call MACRO Service, CallBack
ifndef Create_Win32_Services
    Create_Win32_Services = 0
endif
ife Create_Win32_Services
    mov eax,@32&Service
ifdef IS_16
    movzx   esp,sp
endif
    call    fword ptr [CallBack]
ifdef DEBUG
    int 3
endif
endif
    ENDM







Dword_Align MACRO Seg_Name
    LOCAL segn
IFDEF MASM6
    align 4
ELSE
IFNB <Seg_Name>
    segn equ Seg_Name
ELSE
IFE ?_LCODE
    segn equ <_LTEXT>
ELSE
IFE ?_ICODE
    segn equ <_ITEXT>
ELSE
IFE ?_PCODE
    segn equ <_PTEXT>
ELSE
IFE ?_SCODE
    segn equ <_STEXT>
ELSE
.err <Dword_Align not supported>
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
IF (($-OFFSET segn:0) MOD 4)
db 4 - (($-OFFSET segn:0) MOD 4) DUP (90h)
ENDIF
ENDIF
        ENDM


BeginDoc

















EndDoc

Fatal_Error MACRO Msg_Ptr, Exit_Flags
    pushad
IFB <Msg_Ptr>
    xor esi, esi
ELSE
    mov esi, Msg_Ptr
IFB <Exit_Flags>
    xor eax, eax
ELSE
    mov eax, Exit_Flags
ENDIF
ENDIF
    VMMCall Fatal_Error_Handler
    ENDM

EF_Hang_On_Exit     EQU     1h


cb_s STRUC
CB_VM_Status DD ?
CB_High_Linear DD ?
CB_Client_Pointer DD ?
CB_VMID DD ?
CB_Signature DD ?
cb_s ENDS
VMCB_ID EQU 62634D56H
VMSTAT_EXCLUSIVE_BIT EQU 00H
VMSTAT_EXCLUSIVE EQU (1 SHL VMSTAT_EXCLUSIVE_BIT)
VMSTAT_BACKGROUND_BIT EQU 01H
VMSTAT_BACKGROUND EQU (1 SHL VMSTAT_BACKGROUND_BIT)
VMSTAT_CREATING_BIT EQU 02H
VMSTAT_CREATING EQU (1 SHL VMSTAT_CREATING_BIT)
VMSTAT_SUSPENDED_BIT EQU 03H
VMSTAT_SUSPENDED EQU (1 SHL VMSTAT_SUSPENDED_BIT)
VMSTAT_NOT_EXECUTEABLE_BIT EQU 04H
VMSTAT_NOT_EXECUTEABLE EQU (1 SHL VMSTAT_NOT_EXECUTEABLE_BIT)
VMSTAT_PM_EXEC_BIT EQU 05H
VMSTAT_PM_EXEC EQU (1 SHL VMSTAT_PM_EXEC_BIT)
VMSTAT_PM_APP_BIT EQU 06H
VMSTAT_PM_APP EQU (1 SHL VMSTAT_PM_APP_BIT)
VMSTAT_PM_USE32_BIT EQU 07H
VMSTAT_PM_USE32 EQU (1 SHL VMSTAT_PM_USE32_BIT)
VMSTAT_VXD_EXEC_BIT EQU 08H
VMSTAT_VXD_EXEC EQU (1 SHL VMSTAT_VXD_EXEC_BIT)
VMSTAT_HIGH_PRI_BACK_BIT EQU 09H
VMSTAT_HIGH_PRI_BACK EQU (1 SHL VMSTAT_HIGH_PRI_BACK_BIT)
VMSTAT_BLOCKED_BIT EQU 0AH
VMSTAT_BLOCKED EQU (1 SHL VMSTAT_BLOCKED_BIT)
VMSTAT_AWAKENING_BIT EQU 0BH
VMSTAT_AWAKENING EQU (1 SHL VMSTAT_AWAKENING_BIT)
VMSTAT_PAGEABLEV86BIT EQU 0CH
VMSTAT_PAGEABLEV86_BIT EQU VMSTAT_PAGEABLEV86BIT
VMSTAT_PAGEABLEV86 EQU (1 SHL VMSTAT_PAGEABLEV86BIT)
VMSTAT_V86INTSLOCKEDBIT EQU 0DH
VMSTAT_V86INTSLOCKED_BIT EQU VMSTAT_V86INTSLOCKEDBIT
VMSTAT_V86INTSLOCKED EQU (1 SHL VMSTAT_V86INTSLOCKEDBIT)
VMSTAT_IDLE_TIMEOUT_BIT EQU 0EH
VMSTAT_IDLE_TIMEOUT EQU (1 SHL VMSTAT_IDLE_TIMEOUT_BIT)
VMSTAT_IDLE_BIT EQU 0FH
VMSTAT_IDLE EQU (1 SHL VMSTAT_IDLE_BIT)
VMSTAT_CLOSING_BIT EQU 10H
VMSTAT_CLOSING EQU (1 SHL VMSTAT_CLOSING_BIT)
VMSTAT_TS_SUSPENDED_BIT EQU 11H
VMSTAT_TS_SUSPENDED EQU (1 SHL VMSTAT_TS_SUSPENDED_BIT)
VMSTAT_TS_MAXPRI_BIT EQU 12H
VMSTAT_TS_MAXPRI EQU (1 SHL VMSTAT_TS_MAXPRI_BIT)
VMSTAT_USE32_MASK EQU (VMSTAT_PM_USE32 OR VMSTAT_VXD_EXEC)

tcb_s STRUC
TCB_Flags DD ?
TCB_Reserved1 DD ?
TCB_Reserved2 DD ?
TCB_Signature DD ?
TCB_ClientPtr DD ?
TCB_VMHandle DD ?
TCB_ThreadId DW ?
TCB_PMLockOrigSS DW ?
TCB_PMLockOrigESP DD ?
TCB_PMLockOrigEIP DD ?
TCB_PMLockStackCount DD ?
TCB_PMLockOrigCS DW ?
TCB_PMPSPSelector DW ?
TCB_ThreadType DD ?
TCB_pad1 DW ?
TCB_pad2 DB ?
TCB_extErrLocus DB ?
TCB_extErr DW ?
TCB_extErrAction DB ?
TCB_extErrClass DB ?
TCB_extErrPtr DD ?
tcb_s ENDS
SCHED_OBJ_ID_THREAD EQU 42434854H
THFLAG_SUSPENDED_BIT EQU 03H
THFLAG_SUSPENDED EQU (1 SHL THFLAG_SUSPENDED_BIT)
THFLAG_NOT_EXECUTEABLE_BIT EQU 04H
THFLAG_NOT_EXECUTEABLE EQU (1 SHL THFLAG_NOT_EXECUTEABLE_BIT)
THFLAG_THREAD_CREATION_BIT EQU 08H
THFLAG_THREAD_CREATION EQU (1 SHL THFLAG_THREAD_CREATION_BIT)
THFLAG_THREAD_BLOCKED_BIT EQU 0AH
THFLAG_THREAD_BLOCKED EQU (1 SHL THFLAG_THREAD_BLOCKED_BIT)
THFLAG_RING0_THREAD_BIT EQU 1CH
THFLAG_RING0_THREAD EQU (1 SHL THFLAG_RING0_THREAD_BIT)
THFLAG_CHARSET_BITS EQU 10H
THFLAG_CHARSET_MASK EQU (3 SHL THFLAG_CHARSET_BITS)
THFLAG_ANSI EQU (0 SHL THFLAG_CHARSET_BITS)
THFLAG_OEM EQU (1 SHL THFLAG_CHARSET_BITS)
THFLAG_UNICODE EQU (2 SHL THFLAG_CHARSET_BITS)
THFLAG_RESERVED EQU (3 SHL THFLAG_CHARSET_BITS)
THFLAG_EXTENDED_HANDLES_BIT EQU 12H
THFLAG_EXTENDED_HANDLES EQU (1 SHL THFLAG_EXTENDED_HANDLES_BIT)
THFLAG_OPEN_AS_IMMOVABLE_FILE_BIT EQU 13H
THFLAG_OPEN_AS_IMMOVABLE_FILE EQU (1 SHL THFLAG_OPEN_AS_IMMOVABLE_FILE_BIT)

pmcb_s STRUC
PMCB_Flags DD ?
PMCB_Parent DD ?
pmcb_s ENDS

VMFaultInfo STRUC
VMFI_EIP DD ?
VMFI_CS DW ?
VMFI_Ints DW ?
VMFaultInfo ENDS
Begin_Service_Table VMM, VMM
VMM_Service  Get_VMM_Version, LOCAL
VMM_Service  Get_Cur_VM_Handle
VMM_Service  Test_Cur_VM_Handle
VMM_Service  Get_Sys_VM_Handle
VMM_Service  Test_Sys_VM_Handle
VMM_Service  Validate_VM_Handle
VMM_Service  Get_VMM_Reenter_Count
VMM_Service  Begin_Reentrant_Execution
VMM_Service  End_Reentrant_Execution
VMM_Service  Install_V86_Break_Point
VMM_Service  Remove_V86_Break_Point
VMM_Service  Allocate_V86_Call_Back
VMM_Service  Allocate_PM_Call_Back
VMM_Service  Call_When_VM_Returns
VMM_Service  Schedule_Global_Event
VMM_Service  Schedule_VM_Event
VMM_Service  Call_Global_Event
VMM_Service  Call_VM_Event
VMM_Service  Cancel_Global_Event
VMM_Service  Cancel_VM_Event
VMM_Service  Call_Priority_VM_Event
VMM_Service  Cancel_Priority_VM_Event
VMM_Service  Get_NMI_Handler_Addr
VMM_Service  Set_NMI_Handler_Addr
VMM_Service  Hook_NMI_Event
VMM_Service  Call_When_VM_Ints_Enabled
VMM_Service  Enable_VM_Ints
VMM_Service  Disable_VM_Ints
VMM_Service  Map_Flat
VMM_Service  Map_Lin_To_VM_Addr
VMM_Service  Adjust_Exec_Priority
VMM_Service  Begin_Critical_Section
VMM_Service  End_Critical_Section
VMM_Service  End_Crit_And_Suspend
VMM_Service  Claim_Critical_Section
VMM_Service  Release_Critical_Section
VMM_Service  Call_When_Not_Critical
VMM_Service  Create_Semaphore
VMM_Service  Destroy_Semaphore
VMM_Service  Wait_Semaphore
VMM_Service  Signal_Semaphore
VMM_Service  Get_Crit_Section_Status
VMM_Service  Call_When_Task_Switched
VMM_Service  Suspend_VM
VMM_Service  Resume_VM
VMM_Service  No_Fail_Resume_VM
VMM_Service  Nuke_VM
VMM_Service  Crash_Cur_VM
VMM_Service  Get_Execution_Focus
VMM_Service  Set_Execution_Focus
VMM_Service  Get_Time_Slice_Priority
VMM_Service  Set_Time_Slice_Priority
VMM_Service  Get_Time_Slice_Granularity
VMM_Service  Set_Time_Slice_Granularity
VMM_Service  Get_Time_Slice_Info
VMM_Service  Adjust_Execution_Time
VMM_Service  Release_Time_Slice
VMM_Service  Wake_Up_VM
VMM_Service  Call_When_Idle
VMM_Service  Get_Next_VM_Handle
VMM_Service  Set_Global_Time_Out
VMM_Service  Set_VM_Time_Out
VMM_Service  Cancel_Time_Out
VMM_Service  Get_System_Time
VMM_Service  Get_VM_Exec_Time
VMM_Service  Hook_V86_Int_Chain
VMM_Service  Get_V86_Int_Vector
VMM_Service  Set_V86_Int_Vector
VMM_Service  Get_PM_Int_Vector
VMM_Service  Set_PM_Int_Vector
VMM_Service  Simulate_Int
VMM_Service  Simulate_Iret
VMM_Service  Simulate_Far_Call
VMM_Service  Simulate_Far_Jmp
VMM_Service  Simulate_Far_Ret
VMM_Service  Simulate_Far_Ret_N
VMM_Service  Build_Int_Stack_Frame
VMM_Service  Simulate_Push
VMM_Service  Simulate_Pop
VMM_Service  _HeapAllocate
VMM_Service  _HeapReAllocate
VMM_Service  _HeapFree
VMM_Service  _HeapGetSize
HEAPZEROINIT EQU 00000001H
HEAPZEROREINIT EQU 00000002H
HEAPNOCOPY EQU 00000004H
HEAPLOCKEDIFDP EQU 00000100H
HEAPSWAP EQU 00000200H
HEAPINIT EQU 00000400H
HEAPCLEAN EQU 00000800H
VMM_Service  _PageAllocate
VMM_Service  _PageReAllocate
VMM_Service  _PageFree
VMM_Service  _PageLock
VMM_Service  _PageUnLock
VMM_Service  _PageGetSizeAddr
VMM_Service  _PageGetAllocInfo
VMM_Service  _GetFreePageCount
VMM_Service  _GetSysPageCount
VMM_Service  _GetVMPgCount
VMM_Service  _MapIntoV86
VMM_Service  _PhysIntoV86
VMM_Service  _TestGlobalV86Mem
VMM_Service  _ModifyPageBits
VMM_Service  _CopyPageTable
VMM_Service  _LinMapIntoV86
VMM_Service  _LinPageLock
VMM_Service  _LinPageUnLock
VMM_Service  _SetResetV86Pageable
VMM_Service  _GetV86PageableArray
VMM_Service  _PageCheckLinRange
VMM_Service  _PageOutDirtyPages
VMM_Service  _PageDiscardPages
PAGEZEROINIT EQU 00000001H
PAGEUSEALIGN EQU 00000002H
PAGECONTIG EQU 00000004H
PAGEFIXED EQU 00000008H
PAGEDEBUGNULFAULT EQU 00000010H
PAGEZEROREINIT EQU 00000020H
PAGENOCOPY EQU 00000040H
PAGELOCKED EQU 00000080H
PAGELOCKEDIFDP EQU 00000100H
PAGESETV86PAGEABLE EQU 00000200H
PAGECLEARV86PAGEABLE EQU 00000400H
PAGESETV86INTSLOCKED EQU 00000800H
PAGECLEARV86INTSLOCKED EQU 00001000H
PAGEMARKPAGEOUT EQU 00002000H
PAGEPDPSETBASE EQU 00004000H
PAGEPDPCLEARBASE EQU 00008000H
PAGEDISCARD EQU 00010000H
PAGEPDPQUERYDIRTY EQU 00020000H
PAGEMAPFREEPHYSREG EQU 00040000H
PAGENOMOVE EQU 10000000H
PAGEMAPGLOBAL EQU 40000000H
PAGEMARKDIRTY EQU 80000000H
MAPV86_IGNOREWRAP EQU 00000001H
VMM_Service  _GetNulPageHandle
VMM_Service  _GetFirstV86Page
VMM_Service  _MapPhysToLinear
VMM_Service  _GetAppFlatDSAlias
VMM_Service  _SelectorMapFlat
VMM_Service  _GetDemandPageInfo
VMM_Service  _GetSetPageOutCount
GSPOC_F_GET EQU 00000001H
VMM_Service  Hook_V86_Page
VMM_Service  _Assign_Device_V86_Pages
VMM_Service  _DeAssign_Device_V86_Pages
VMM_Service  _Get_Device_V86_Pages_Array
VMM_Service  MMGR_SetNULPageAddr
VMM_Service  _Allocate_GDT_Selector
VMM_Service  _Free_GDT_Selector
VMM_Service  _Allocate_LDT_Selector
VMM_Service  _Free_LDT_Selector
VMM_Service  _BuildDescriptorDWORDs
VMM_Service  _GetDescriptor
VMM_Service  _SetDescriptor
BDDEXPLICITDPL EQU 00000001H
ALDTSPECSEL EQU 00000001H
VMM_Service  _MMGR_Toggle_HMA
MMGRHMAPHYSICAL EQU 00000001H
MMGRHMAENABLE EQU 00000002H
MMGRHMADISABLE EQU 00000004H
MMGRHMAQUERY EQU 00000008H
VMM_Service  Get_Fault_Hook_Addrs
VMM_Service  Hook_V86_Fault
VMM_Service  Hook_PM_Fault
VMM_Service  Hook_VMM_Fault
VMM_Service  Begin_Nest_V86_Exec
VMM_Service  Begin_Nest_Exec
VMM_Service  Exec_Int
VMM_Service  Resume_Exec
VMM_Service  End_Nest_Exec
VMM_Service  Allocate_PM_App_CB_Area, VMM_ICODE
VMM_Service  Get_Cur_PM_App_CB
VMM_Service  Set_V86_Exec_Mode
VMM_Service  Set_PM_Exec_Mode
VMM_Service  Begin_Use_Locked_PM_Stack
VMM_Service  End_Use_Locked_PM_Stack
VMM_Service  Save_Client_State
VMM_Service  Restore_Client_State
VMM_Service  Exec_VxD_Int
VMM_Service  Hook_Device_Service
VMM_Service  Hook_Device_V86_API
VMM_Service  Hook_Device_PM_API
VMM_Service  System_Control
VMM_Service  Simulate_IO
VMM_Service  Install_Mult_IO_Handlers
VMM_Service  Install_IO_Handler
VMM_Service  Enable_Global_Trapping
VMM_Service  Enable_Local_Trapping
VMM_Service  Disable_Global_Trapping
VMM_Service  Disable_Local_Trapping
VMM_Service  List_Create
VMM_Service  List_Destroy
VMM_Service  List_Allocate
VMM_Service  List_Attach
VMM_Service  List_Attach_Tail
VMM_Service  List_Insert
VMM_Service  List_Remove
VMM_Service  List_Deallocate
VMM_Service  List_Get_First
VMM_Service  List_Get_Next
VMM_Service  List_Remove_First
LF_ASYNC_BIT EQU 0
LF_ASYNC EQU (1 SHL LF_ASYNC_BIT)
LF_USE_HEAP_BIT EQU 1
LF_USE_HEAP EQU (1 SHL LF_USE_HEAP_BIT)
LF_ALLOC_ERROR_BIT EQU 2
LF_ALLOC_ERROR EQU (1 SHL LF_ALLOC_ERROR_BIT)
LF_SWAP EQU (LF_USE_HEAP+(1 SHL 3))
VMM_Service  _AddInstanceItem
VMM_Service  _Allocate_Device_CB_Area
VMM_Service  _Allocate_Global_V86_Data_Area, VMM_ICODE
VMM_Service  _Allocate_Temp_V86_Data_Area, VMM_ICODE
VMM_Service  _Free_Temp_V86_Data_Area, VMM_ICODE
GVDAWordAlign EQU 00000001H
GVDADWordAlign EQU 00000002H
GVDAParaAlign EQU 00000004H
GVDAPageAlign EQU 00000008H
GVDAInstance EQU 00000100H
GVDAZeroInit EQU 00000200H
GVDAReclaim EQU 00000400H
GVDAInquire EQU 00000800H
GVDAHighSysCritOK EQU 00001000H
GVDAOptInstance EQU 00002000H
GVDAForceLow EQU 00004000H
TVDANeedTilInitComplete EQU 00000001H
VMM_Service  Get_Profile_Decimal_Int, VMM_ICODE
VMM_Service  Convert_Decimal_String, VMM_ICODE
VMM_Service  Get_Profile_Fixed_Point, VMM_ICODE
VMM_Service  Convert_Fixed_Point_String, VMM_ICODE
VMM_Service  Get_Profile_Hex_Int, VMM_ICODE
VMM_Service  Convert_Hex_String, VMM_ICODE
VMM_Service  Get_Profile_Boolean, VMM_ICODE
VMM_Service  Convert_Boolean_String, VMM_ICODE
VMM_Service  Get_Profile_String, VMM_ICODE
VMM_Service  Get_Next_Profile_String, VMM_ICODE
VMM_Service  Get_Environment_String, VMM_ICODE
VMM_Service  Get_Exec_Path, VMM_ICODE
VMM_Service  Get_Config_Directory, VMM_ICODE
VMM_Service  OpenFile, VMM_ICODE
VMM_OPENFILE_BUF_SIZE EQU 260
VMM_Service  Get_PSP_Segment, VMM_ICODE
VMM_Service  GetDOSVectors, VMM_ICODE
VMM_Service  Get_Machine_Info
GMIF_80486_BIT EQU 10H
GMIF_80486 EQU (1 SHL GMIF_80486_BIT)
GMIF_PCXT_BIT EQU 11H
GMIF_PCXT EQU (1 SHL GMIF_PCXT_BIT)
GMIF_MCA_BIT EQU 12H
GMIF_MCA EQU (1 SHL GMIF_MCA_BIT)
GMIF_EISA_BIT EQU 13H
GMIF_EISA EQU (1 SHL GMIF_EISA_BIT)
GMIF_CPUID_BIT EQU 14H
GMIF_CPUID EQU (1 SHL GMIF_CPUID_BIT)
VMM_Service  GetSet_HMA_Info
VMM_Service  Set_System_Exit_Code
VMM_Service  Fatal_Error_Handler
VMM_Service  Fatal_Memory_Error
VMM_Service  Update_System_Clock
VMM_Service  Test_Debug_Installed
VMM_Service  Out_Debug_String
VMM_Service  Out_Debug_Chr
VMM_Service  In_Debug_Chr
VMM_Service  Debug_Convert_Hex_Binary
VMM_Service  Debug_Convert_Hex_Decimal
VMM_Service  Debug_Test_Valid_Handle
VMM_Service  Validate_Client_Ptr
VMM_Service  Test_Reenter
VMM_Service  Queue_Debug_String
VMM_Service  Log_Proc_Call
VMM_Service  Debug_Test_Cur_VM
VMM_Service  Get_PM_Int_Type
VMM_Service  Set_PM_Int_Type
VMM_Service  Get_Last_Updated_System_Time
VMM_Service  Get_Last_Updated_VM_Exec_Time
VMM_Service  Test_DBCS_Lead_Byte
.errnz  @@Test_DBCS_Lead_Byte - 100D1h

VMM_Service  _AddFreePhysPage, VMM_ICODE
VMM_Service  _PageResetHandlePAddr
VMM_Service  _SetLastV86Page, VMM_ICODE
VMM_Service  _GetLastV86Page
VMM_Service  _MapFreePhysReg
VMM_Service  _UnmapFreePhysReg
VMM_Service  _XchgFreePhysReg
VMM_Service  _SetFreePhysRegCalBk, VMM_ICODE
VMM_Service  Get_Next_Arena, VMM_ICODE
VMM_Service  Get_Name_Of_Ugly_TSR, VMM_ICODE
VMM_Service  Get_Debug_Options, VMM_ICODE
AFPP_SWAPOUT EQU 0001H
PCP_CHANGEPAGER EQU 1H
PCP_CHANGEPAGERDATA EQU 2H
PCP_VIRGINONLY EQU 4H
GNA_HIDOSLINKED EQU 0002H
GNA_ISHIGHDOS EQU 0004H
VMM_Service  Set_Physical_HMA_Alias, VMM_ICODE
VMM_Service  _GetGlblRng0V86IntBase, VMM_ICODE
VMM_Service  _Add_Global_V86_Data_Area, VMM_ICODE
VMM_Service  GetSetDetailedVMError
GSDVME_PRIVINST EQU 00010001H
GSDVME_INVALINST EQU 00010002H
GSDVME_INVALPGFLT EQU 00010003H
GSDVME_INVALGPFLT EQU 00010004H
GSDVME_INVALFLT EQU 00010005H
GSDVME_USERNUKE EQU 00010006H
GSDVME_DEVNUKE EQU 00010007H
GSDVME_DEVNUKEHDWR EQU 00010008H
GSDVME_NUKENOMSG EQU 00010009H
GSDVME_OKNUKEMASK EQU 80000000H
GSDVME_INSMEMV86 EQU 00020001H
GSDVME_INSV86SPACE EQU 00020002H
GSDVME_INSMEMXMS EQU 00020003H
GSDVME_INSMEMEMS EQU 00020004H
GSDVME_INSMEMV86HI EQU 00020005H
GSDVME_INSMEMVID EQU 00020006H
GSDVME_INSMEMVM EQU 00020007H
GSDVME_INSMEMDEV EQU 00020008H
GSDVME_CRTNOMSG EQU 00020009H
VMM_Service  Is_Debug_Chr
VMM_Service  Clear_Mono_Screen
VMM_Service  Out_Mono_Chr
VMM_Service  Out_Mono_String
VMM_Service  Set_Mono_Cur_Pos
VMM_Service  Get_Mono_Cur_Pos
VMM_Service  Get_Mono_Chr
VMM_Service  Locate_Byte_In_ROM, VMM_ICODE
VMM_Service  Hook_Invalid_Page_Fault
VMM_Service  Unhook_Invalid_Page_Fault
IPF_PGDIR EQU 00000001H
IPF_V86PG EQU 00000002H
IPF_V86PGH EQU 00000004H
IPF_INVTYP EQU 00000008H
IPF_PGERR EQU 00000010H
IPF_REFLT EQU 00000020H
IPF_VMM EQU 00000040H
IPF_PM EQU 00000080H
IPF_V86 EQU 00000100H
VMM_Service  Set_Delete_On_Exit_File
VMM_Service  Close_VM
CVF_CONTINUE_EXEC_BIT EQU 0
CVF_CONTINUE_EXEC EQU (1 SHL CVF_CONTINUE_EXEC_BIT)
VMM_Service  Enable_Touch_1st_Meg
VMM_Service  Disable_Touch_1st_Meg
VMM_Service  Install_Exception_Handler
VMM_Service  Remove_Exception_Handler
VMM_Service  Get_Crit_Status_No_Block

.errnz   @@Get_Crit_Status_No_Block - 100F1h

ifdef WIN40SERVICES
VMM_Service  _GetLastUpdatedThreadExecTime
VMM_Service  _Trace_Out_Service
VMM_Service  _Debug_Out_Service
VMM_Service  _Debug_Flags_Service
endif
DFS_LOG_BIT EQU 0
DFS_LOG EQU (1 SHL DFS_LOG_BIT)
DFS_PROFILE_BIT EQU 1
DFS_PROFILE EQU (1 SHL DFS_PROFILE_BIT)
DFS_TEST_CLD_BIT EQU 2
DFS_TEST_CLD EQU (1 SHL DFS_TEST_CLD_BIT)
DFS_NEVER_REENTER_BIT EQU 3
DFS_NEVER_REENTER EQU (1 SHL DFS_NEVER_REENTER_BIT)
DFS_TEST_REENTER_BIT EQU 4
DFS_TEST_REENTER EQU (1 SHL DFS_TEST_REENTER_BIT)
DFS_NOT_SWAPPING_BIT EQU 5
DFS_NOT_SWAPPING EQU (1 SHL DFS_NOT_SWAPPING_BIT)
DFS_TEST_BLOCK_BIT EQU 6
DFS_TEST_BLOCK EQU (1 SHL DFS_TEST_BLOCK_BIT)
DFS_RARE_SERVICES EQU 0FFFFFF80H
DFS_EXIT_NOBLOCK EQU (DFS_RARE_SERVICES+0)
DFS_ENTER_NOBLOCK EQU (DFS_RARE_SERVICES+DFS_TEST_BLOCK)
DFS_TEST_NEST_EXEC EQU (DFS_RARE_SERVICES+1)
ifdef WIN40SERVICES
VMM_Service  VMMAddImportModuleName
VMM_Service  VMM_Add_DDB
VMM_Service  VMM_Remove_DDB
VMM_Service  Test_VM_Ints_Enabled
VMM_Service  _BlockOnID
VMM_Service  Schedule_Thread_Event
VMM_Service  Cancel_Thread_Event
VMM_Service  Set_Thread_Time_Out
VMM_Service  Set_Async_Time_Out
VMM_Service  _AllocateThreadDataSlot
VMM_Service  _FreeThreadDataSlot
MUTEX_MUST_COMPLETE EQU 1
MUTEX_NO_CLEANUP_THREAD_STATE EQU 2
VMM_Service  _CreateMutex
VMM_Service  _DestroyMutex
VMM_Service  _GetMutexOwner
VMM_Service  Call_When_Thread_Switched
VMM_Service  VMMCreateThread
VMM_Service  _GetThreadExecTime
VMM_Service  VMMTerminateThread
VMM_Service  Get_Cur_Thread_Handle
VMM_Service  Test_Cur_Thread_Handle
VMM_Service  Get_Sys_Thread_Handle
VMM_Service  Test_Sys_Thread_Handle
VMM_Service  Validate_Thread_Handle
VMM_Service  Get_Initial_Thread_Handle
VMM_Service  Test_Initial_Thread_Handle
VMM_Service  Debug_Test_Valid_Thread_Handle
VMM_Service  Debug_Test_Cur_Thread
VMM_Service  VMM_GetSystemInitState
VMM_Service  Cancel_Call_When_Thread_Switched
VMM_Service  Get_Next_Thread_Handle
VMM_Service  Adjust_Thread_Exec_Priority
VMM_Service  _Deallocate_Device_CB_Area
VMM_Service  Remove_IO_Handler
VMM_Service  Remove_Mult_IO_Handlers
VMM_Service  Unhook_V86_Int_Chain
VMM_Service  Unhook_V86_Fault
VMM_Service  Unhook_PM_Fault
VMM_Service  Unhook_VMM_Fault
VMM_Service  Unhook_Device_Service
VMM_Service  _PageReserve
VMM_Service  _PageCommit
VMM_Service  _PageDecommit
VMM_Service  _PagerRegister
VMM_Service  _PagerQuery
VMM_Service  _PagerDeregister
VMM_Service  _ContextCreate
VMM_Service  _ContextDestroy
VMM_Service  _PageAttach
VMM_Service  _PageFlush
VMM_Service  _SignalID
VMM_Service  _PageCommitPhys
VMM_Service  _Register_Win32_Services
VMM_Service  Cancel_Call_When_Not_Critical
VMM_Service  Cancel_Call_When_Idle
VMM_Service  Cancel_Call_When_Task_Switched
VMM_Service  _Debug_Printf_Service
VMM_Service  _EnterMutex
VMM_Service  _LeaveMutex
VMM_Service  Simulate_VM_IO
VMM_Service  Signal_Semaphore_No_Switch
VMM_Service  _ContextSwitch
VMM_Service  _PageModifyPermissions
VMM_Service  _PageQuery
VMM_Service  _EnterMustComplete
VMM_Service  _LeaveMustComplete
VMM_Service  _ResumeExecMustComplete
THREAD_TERM_STATUS_CRASH_PEND EQU 1
THREAD_TERM_STATUS_NUKE_PEND EQU 2
THREAD_TERM_STATUS_SUSPEND_PEND EQU 4
VMM_Service  _GetThreadTerminationStatus
VMM_Service  _GetInstanceInfo
INSTINFO_NONE EQU 0
INSTINFO_SOME EQU 1
INSTINFO_ALL EQU 2
VMM_Service  _ExecIntMustComplete
VMM_Service  _ExecVxDIntMustComplete
VMM_Service  Begin_V86_Serialization
VMM_Service  Unhook_V86_Page
VMM_Service  VMM_GetVxDLocationList
VMM_Service  VMM_GetDDBList
VMM_Service  Unhook_NMI_Event
VMM_Service  Get_Instanced_V86_Int_Vector
VMM_Service  Get_Set_Real_DOS_PSP
GSRDP_Set EQU 0001H
VMM_Service  Call_Priority_Thread_Event
VMM_Service  Get_System_Time_Address
VMM_Service  Get_Crit_Status_Thread
VMM_Service  Get_DDB
VMM_Service  Directed_Sys_Control
VMM_Service  _RegOpenKey
VMM_Service  _RegCloseKey
VMM_Service  _RegCreateKey
VMM_Service  _RegDeleteKey
VMM_Service  _RegEnumKey
VMM_Service  _RegQueryValue
VMM_Service  _RegSetValue
VMM_Service  _RegDeleteValue
VMM_Service  _RegEnumValue
VMM_Service  _RegQueryValueEx
VMM_Service  _RegSetValueEx
ifndef REG_SZ
REG_SZ EQU 0001H
REG_BINARY EQU 0003H
endif
ifndef HKEY_LOCAL_MACHINE
HKEY_CLASSES_ROOT EQU 80000000H
HKEY_CURRENT_USER EQU 80000001H
HKEY_LOCAL_MACHINE EQU 80000002H
HKEY_USERS EQU 80000003H
HKEY_PERFORMANCE_DATA EQU 80000004H
HKEY_CURRENT_CONFIG EQU 80000005H
HKEY_DYN_DATA EQU 80000006H
endif
VMM_Service  _CallRing3
VMM_Service  Exec_PM_Int
VMM_Service  _RegFlushKey
VMM_Service  _PageCommitContig
VMM_Service  _GetCurrentContext
VMM_Service  _LocalizeSprintf
VMM_Service  _LocalizeStackSprintf
VMM_Service  Call_Restricted_Event
VMM_Service  Cancel_Restricted_Event
VMM_Service  Register_PEF_Provider, VMM_ICODE
VMM_Service  _GetPhysPageInfo
VMM_Service  _RegQueryInfoKey
VMM_Service  MemArb_Reserve_Pages
PHYSINFO_NONE EQU 0
PHYSINFO_SOME EQU 1
PHYSINFO_ALL EQU 2
VMM_Service  Time_Slice_Sys_VM_Idle
VMM_Service  Time_Slice_Sleep
VMM_Service  Boost_With_Decay
VMM_Service  Set_Inversion_Pri
VMM_Service  Reset_Inversion_Pri
VMM_Service  Release_Inversion_Pri
VMM_Service  Get_Thread_Win32_Pri
VMM_Service  Set_Thread_Win32_Pri
VMM_Service  Set_Thread_Static_Boost
VMM_Service  Set_VM_Static_Boost
VMM_Service  Release_Inversion_Pri_ID
VMM_Service  Attach_Thread_To_Group
VMM_Service  Detach_Thread_From_Group
VMM_Service  Set_Group_Static_Boost
VMM_Service  _GetRegistryPath, VMM_ICODE
VMM_Service  _GetRegistryKey
REGTYPE_ENUM EQU 0
REGTYPE_CLASS EQU 1
REGTYPE_VXD EQU 2
REGKEY_OPEN EQU 0
REGKEY_CREATE_IFNOTEXIST EQU 1
ASSERT_RANGE_NULL_BAD EQU 00000000H
ASSERT_RANGE_NULL_OK EQU 00000001H
ASSERT_RANGE_NO_DEBUG EQU 80000000H
ASSERT_RANGE_BITS EQU 80000001H
VMM_Service  Cleanup_Thread_State
VMM_Service  _RegRemapPreDefKey
VMM_Service  End_V86_Serialization
VMM_Service  _Assert_Range
VMM_Service  _Sprintf
VMM_Service  _PageChangePager
VMM_Service  _RegCreateDynKey
VMM_Service  _RegQueryMultipleValues
VMM_Service  Boost_Thread_With_VM
BOOT_CLEAN EQU 00000001H
BOOT_DOSCLEAN EQU 00000002H
BOOT_NETCLEAN EQU 00000004H
BOOT_INTERACTIVE EQU 00000008H
VMM_Service  Get_Boot_Flags
VMM_Service  Set_Boot_Flags
VMM_Service  _lstrcpyn
VMM_Service  _lstrlen
VMM_Service  _lmemcpy
VMM_Service  _GetVxDName
VMM_Service  Force_Mutexes_Free
VMM_Service  Restore_Forced_Mutexes
VMM_Service  _AddReclaimableItem
VMM_Service  _SetReclaimableItem
VMM_Service  _EnumReclaimableItem
VMM_Service  Time_Slice_Wake_Sys_VM
VMM_Service  VMM_Replace_Global_Environment
VMM_Service  Begin_Non_Serial_Nest_V86_Exec
VMM_Service  Get_Nest_Exec_Status
VMM_Service  Open_Boot_Log
VMM_Service  Write_Boot_Log
VMM_Service  Close_Boot_Log
VMM_Service  EnableDisable_Boot_Log
VMM_Service  _Call_On_My_Stack
VMM_Service  Get_Inst_V86_Int_Vec_Base
VMM_Service  _lstrcmpi
VMM_Service  _strupr
VMM_Service  Log_Fault_Call_Out
VMM_Service  _AtEventTime
endif
End_Service_Table VMM, VMM
RS_RECLAIM EQU 00000001H
RS_RESTORE EQU 00000002H
RS_DOSARENA EQU 00000004H

ReclaimStruc STRUC
RS_Linear DD ?
RS_Bytes DD ?
RS_CallBack DD ?
RS_RefData DD ?
RS_HookTable DD ?
RS_Flags DD ?
ReclaimStruc ENDS

frmtx STRUC
frmtx_pfrmtxNext DD ?
frmtx_hmutex DD ?
frmtx_cEnterCount DD ?
frmtx_pthcbOwner DD ?
frmtx_htimeout DD ?
frmtx ENDS

vmmfrinfo STRUC
vmmfrinfo_frmtxDOS DB SIZE frmtx DUP (?)
vmmfrinfo_frmtxV86 DB SIZE frmtx DUP (?)
vmmfrinfo_frmtxOther DB SIZE frmtx DUP (?)
vmmfrinfo ENDS

DemandInfoStruc STRUC
DILin_Total_Count DD ?
DIPhys_Count DD ?
DIFree_Count DD ?
DIUnlock_Count DD ?
DILinear_Base_Addr DD ?
DILin_Total_Free DD ?
DIPage_Faults DD ?
DIPage_Ins DD ?
DIPage_Outs DD ?
DIPage_Discards DD ?
DIInstance_Faults DD ?
DIPagingFileMax DD ?
DIPagingFileInUse DD ?
DICommit_Count DD ?
DIReserved DD 2 DUP (?)
DemandInfoStruc ENDS

InstDataStruc STRUC
InstLinkF DD 0
InstLinkB DD 0
InstLinAddr DD ?
InstSize DD ?
InstType DD ?
InstDataStruc ENDS
INDOS_FIELD EQU 100H
ALWAYS_FIELD EQU 200H
OPTIONAL_FIELD EQU 400H

IPF_Data STRUC
IPF_LinAddr DD ?
IPF_MapPageNum DD ?
IPF_PTEEntry DD ?
IPF_FaultingVM DD ?
IPF_Flags DD ?
IPF_Data ENDS

Exception_Handler_Struc STRUC
EH_Reserved DD ?
EH_Start_EIP DD ?
EH_End_EIP DD ?
EH_Handler DD ?
Exception_Handler_Struc ENDS
PR_PRIVATE EQU 80000400H
PR_SHARED EQU 80060000H
PR_SYSTEM EQU 80080000H
PR_FIXED EQU 00000008H
PR_4MEG EQU 00000001H
PR_STATIC EQU 00000010H
PD_ZEROINIT EQU 00000001H
PD_NOINIT EQU 00000002H
PD_FIXEDZERO EQU 00000003H
PD_FIXED EQU 00000004H
PC_FIXED EQU 00000008H
PC_LOCKED EQU 00000080H
PC_LOCKEDIFDP EQU 00000100H
PC_WRITEABLE EQU 00020000H
PC_USER EQU 00040000H
PC_INCR EQU 40000000H
PC_PRESENT EQU 80000000H
PC_STATIC EQU 20000000H
PC_DIRTY EQU 08000000H
PCC_ZEROINIT EQU 00000001H
PCC_NOLIN EQU 10000000H
ifndef _WINNT_

_MEMORY_BASIC_INFORMATION STRUC
mbi_BaseAddress DD ?
mbi_AllocationBase DD ?
mbi_AllocationProtect DD ?
mbi_RegionSize DD ?
mbi_State DD ?
mbi_Protect DD ?
mbi_Type DD ?
_MEMORY_BASIC_INFORMATION ENDS
PAGE_NOACCESS EQU 01H
PAGE_READONLY EQU 02H
PAGE_READWRITE EQU 04H
MEM_COMMIT EQU 1000H
MEM_RESERVE EQU 2000H
MEM_FREE EQU 10000H
MEM_PRIVATE EQU 20000H
endif

pd_s STRUC
pd_virginin DD ?
pd_taintedin DD ?
pd_cleanout DD ?
pd_dirtyout DD ?
pd_virginfree DD ?
pd_taintedfree DD ?
pd_dirty DD ?
pd_type DD ?
pd_s ENDS
PD_SWAPPER EQU 0
PD_PAGERONLY EQU 1
PD_NESTEXEC EQU 2
endif
PAGESHIFT EQU 12
PAGESIZE EQU (1 SHL PAGESHIFT)
PAGEMASK EQU (PAGESIZE-1)
MAXSYSTEMLADDR EQU (0ffbfffffH)
MINSYSTEMLADDR EQU (0c0000000H)
MAXSHAREDLADDR EQU (0bfffffffH)
MINSHAREDLADDR EQU (80000000H)
MAXPRIVATELADDR EQU (7fffffffH)
MINPRIVATELADDR EQU (00400000H)
MAXDOSLADDR EQU (003fffffH)
MINDOSLADDR EQU (00000000H)
MAXSYSTEMPAGE EQU (MAXSYSTEMLADDR SHR PAGESHIFT)
MINSYSTEMPAGE EQU (MINSYSTEMLADDR SHR PAGESHIFT)
MAXSHAREDPAGE EQU (MAXSHAREDLADDR SHR PAGESHIFT)
MINSHAREDPAGE EQU (MINSHAREDLADDR SHR PAGESHIFT)
MAXPRIVATEPAGE EQU (MAXPRIVATELADDR SHR PAGESHIFT)
MINPRIVATEPAGE EQU (MINPRIVATELADDR SHR PAGESHIFT)
MAXDOSPAGE EQU (MAXDOSLADDR SHR PAGESHIFT)
MINDOSPAGE EQU (MINDOSLADDR SHR PAGESHIFT)
CBPRIVATE EQU (1+MAXPRIVATELADDR-MINPRIVATELADDR)
CBSHARED EQU (1+MAXSHAREDLADDR-MINSHAREDLADDR)
CBSYSTEM EQU (1+MAXSYSTEMLADDR-MINSYSTEMLADDR)
CBDOS EQU (1+MAXDOSLADDR-MINDOSLADDR)
CPGPRIVATE EQU (1+MAXPRIVATEPAGE-MINPRIVATEPAGE)
CPGSHARED EQU (1+MAXSHAREDPAGE-MINSHAREDPAGE)
CPGSYSTEM EQU (1+MAXSYSTEMPAGE-MINSYSTEMPAGE)
CPGDOS EQU (1+MAXDOSPAGE-MINDOSPAGE)
IFDEF DEBUG
DebFar  EQU NEAR PTR
ELSE
DebFar  EQU SHORT
ENDIF

ifndef Not_VxD
SYS_CRITICAL_INIT EQU 0000H
DEVICE_INIT EQU 0001H
INIT_COMPLETE EQU 0002H
SYS_VM_INIT EQU 0003H
SYS_VM_TERMINATE EQU 0004H
SYSTEM_EXIT EQU 0005H
SYS_CRITICAL_EXIT EQU 0006H
CREATE_VM EQU 0007H
VM_CRITICAL_INIT EQU 0008H
VM_INIT EQU 0009H
VM_TERMINATE EQU 000AH
VM_NOT_EXECUTEABLE EQU 000BH
DESTROY_VM EQU 000CH
VNE_CRASHED_BIT EQU 00H
VNE_CRASHED EQU (1 SHL VNE_CRASHED_BIT)
VNE_NUKED_BIT EQU 01H
VNE_NUKED EQU (1 SHL VNE_NUKED_BIT)
VNE_CREATEFAIL_BIT EQU 02H
VNE_CREATEFAIL EQU (1 SHL VNE_CREATEFAIL_BIT)
VNE_CRINITFAIL_BIT EQU 03H
VNE_CRINITFAIL EQU (1 SHL VNE_CRINITFAIL_BIT)
VNE_INITFAIL_BIT EQU 04H
VNE_INITFAIL EQU (1 SHL VNE_INITFAIL_BIT)
VNE_CLOSED_BIT EQU 05H
VNE_CLOSED EQU (1 SHL VNE_CLOSED_BIT)
VM_SUSPEND EQU 000DH
VM_RESUME EQU 000EH
SET_DEVICE_FOCUS EQU 000FH
BEGIN_MESSAGE_MODE EQU 0010H
END_MESSAGE_MODE EQU 0011H
REBOOT_PROCESSOR EQU 0012H
QUERY_DESTROY EQU 0013H
DEBUG_QUERY EQU 0014H
BEGIN_PM_APP EQU 0015H
BPA_32_BIT EQU 01H
BPA_32_BIT_FLAG EQU 1
END_PM_APP EQU 0016H
DEVICE_REBOOT_NOTIFY EQU 0017H
CRIT_REBOOT_NOTIFY EQU 0018H
CLOSE_VM_NOTIFY EQU 0019H
CVNF_CRIT_CLOSE_BIT EQU 0
CVNF_CRIT_CLOSE EQU (1 SHL CVNF_CRIT_CLOSE_BIT)
POWER_EVENT EQU 001AH
SYS_DYNAMIC_DEVICE_INIT EQU 001BH
SYS_DYNAMIC_DEVICE_EXIT EQU 001CH
CREATE_THREAD EQU 001DH
THREAD_INIT EQU 001EH
TERMINATE_THREAD EQU 001FH
THREAD_Not_Executeable EQU 0020H
DESTROY_THREAD EQU 0021H
PNP_NEW_DEVNODE EQU 0022H
W32_DEVICEIOCONTROL EQU 0023H
DIOC_GETVERSION EQU 0H
DIOC_OPEN EQU DIOC_GETVERSION
DIOC_CLOSEHANDLE EQU -1
SYS_VM_TERMINATE2 EQU 0024H
SYSTEM_EXIT2 EQU 0025H
SYS_CRITICAL_EXIT2 EQU 0026H
VM_TERMINATE2 EQU 0027H
VM_NOT_EXECUTEABLE2 EQU 0028H
DESTROY_VM2 EQU 0029H
VM_SUSPEND2 EQU 002AH
END_MESSAGE_MODE2 EQU 002BH
END_PM_APP2 EQU 002CH
DEVICE_REBOOT_NOTIFY2 EQU 002DH
CRIT_REBOOT_NOTIFY2 EQU 002EH
CLOSE_VM_NOTIFY2 EQU 002FH
GET_CONTENTION_HANDLER EQU 0030H
KERNEL32_INITIALIZED EQU 0031H
KERNEL32_SHUTDOWN EQU 0032H
MAX_SYSTEM_CONTROL EQU 0032H
BEGIN_RESERVED_PRIVATE_SYSTEM_CONTROL EQU 70000000H
END_RESERVED_PRIVATE_SYSTEM_CONTROL EQU 7FFFFFFFH
endif
SYSSTATE_PRESYSCRITINIT EQU 00000000H
SYSSTATE_PREDEVICEINIT EQU 10000000H
SYSSTATE_PREINITCOMPLETE EQU 20000000H
SYSSTATE_VXDINITCOMPLETED EQU 40000000H
SYSSTATE_KERNEL32INITED EQU 50000000H
SYSSTATE_KERNEL32TERMINATED EQU 0A0000000H
SYSSTATE_PRESYSVMTERMINATE EQU 0B0000000H
SYSSTATE_PRESYSTEMEXIT EQU 0E0000000H
SYSSTATE_PRESYSTEMEXIT2 EQU 0E4000000H
SYSSTATE_PRESYSCRITEXIT EQU 0F0000000H
SYSSTATE_PRESYSCRITEXIT2 EQU 0F4000000H
SYSSTATE_POSTSYSCRITEXIT2 EQU 0FFF00000H
SYSSTATE_PREDEVICEREBOOT EQU 0FFFF0000H
SYSSTATE_PRECRITREBOOT EQU 0FFFFF000H
SYSSTATE_PREREBOOTCPU EQU 0FFFFFF00H
BeginDoc

EndDoc

??_pf_Check equ 1
??_pf_ArgsUsed  equ 2
??_pf_Entered   equ 4
??_pf_Left  equ 8
??_pf_Returned  equ    16

??_pushed       =       0
??_align    =   0
??_ends     equ <>

BeginProc macro Name, P1, P2, P3, P4, P5, P6, P7, LastArg
    local   Profile_Data, prelabeldata, ??_hookvar
    ??_frame = 0
    ??_aframe = 0
    ??_initaframe = 0
    ??_numargs = 0
    ??_numlocals = 0
    ??_numlocalsymbols = 0
    ??_procflags = 0
    ??_esp = 0
    ??_pushed = 0
    ??_align = 0
    ??_hook = 0
    ??_hookarg = 0
    ??_service = 0
    ??_async_service = 0
IF DEBLEVEL GT DEBLEVELNORMAL
    ??_log = DFS_LOG
    ??_profile = DFS_PROFILE
    ??_test_cld = DFS_TEST_CLD
ELSE
    ??_log = 0
IFDEF DEBUG
IFDEF profileall
IF ?_ICODE
    ??_profile = DFS_PROFILE
ELSE
    ??_profile = 0
ENDIF
ELSE
    ??_profile = 0
ENDIF
ELSE
    ??_profile = 0
ENDIF
    ??_test_cld = 0
ENDIF
    ??_might_block = 0
    ??_test_reenter = 0
    ??_never_reenter = 0
    ??_not_swapping = 0
    ??_prolog_disabled = 0
    ??_public = 1
    ??_cleanoff = 0
    ??_ccall = 0
    ??_pcall = 0
    ??_scall = 0
    ??_w32svc = 0
    ??_fleave = FALSE

    ??_name equ <Name>

    .errnb ??_ends, <Cannot nest functions with named segments>
    .errnb <LastArg>, <Too many arguments to BeginProc>


    irp arg, <P1, P2, P3, P4, P5, P6, P7>
        if ??_hookarg
        ??_hookarg = 0
        ??_hookvar equ <arg>
        elseifdef ?&&arg&&_BeginProc
            ?&&arg&&_BeginProc
        elseifdef VxD_&&arg&&_CODE_SEG
        ??_ends textequ <VxD_&&arg&&_CODE_ENDS>
        VxD_&&arg&&_CODE_SEG
        else
        .err <Bad param "&arg" to BeginProc>
        endif
    endm


    ifndef Not_VxD
ife ??_service
   ifndef profileall
     ??_profile = 0
   endif
   ifdef VMMSYS
??_prolog_disabled = 1
   endif
else
   ??_test_cld = DFS_TEST_CLD
endif

ife ?_16ICODE
   ??_prolog_disabled = 1
else
ife ?_RCODE
   ??_prolog_disabled = 1
else
   ife ?_PCODE
??_might_block = DFS_TEST_BLOCK
   endif
   if ??_service
ife ??_async_service
   ??_test_reenter = DFS_TEST_REENTER
endif
   endif
    endif
    endif
    endif

    if ??_esp

??_basereg equ <esp+??_pushed>
??_initaframe = 4
    else

??_basereg equ <ebp>
??_initaframe = 8
    endif
    @Caller equ <dword ptr [??_basereg+??_initaframe-4]>

    ??_cleanoff = ??_pcall or ??_scall


    ??_dfs = ??_never_reenter + ??_test_reenter + ??_not_swapping +          ??_log + ??_profile + ??_test_cld + ??_might_block

    if ??_prolog_disabled
        ??_dfs = 0
    endif



    ifndef Not_VxD

if ??_hook
   if ??_align
   Dword_Align
   endif
   prelabeldata:
   ifndef ??_hookvar
   .err <HOOK_PROC requires next arg to be name of dword location>
   endif
   jmp short Name
   jmp [??_hookvar]
   ifdef DEBUG
   Profile_Data dd  0
   endif
   if ??_align
   .errnz ($ - prelabeldata) mod 4
   endif
endif

ifdef DEBUG
   ?prolog_&Name label near
   if (??_service OR ??_profile) AND (??_hook EQ 0)
   jmp short Name
   if ??_align
Dword_Align
   endif

   IF ?_ICODE
   ifdef profileall
     ?ProfileHeader_BeginProc Profile_Data, %@filename
   else
     Profile_Data dd 0
   endif
   ELSE
     Profile_Data dd 0
   ENDIF

   endif
endif

if ??_align
   Dword_Align
endif

    endif

    Name proc near



    ife ??_pcall or ??_ccall or ??_scall
        if ??_public
            public Name
        else
            ifdef DEBUG
                % ?merge @FileName,$,Name,:
                % ?merge public,,,,,@FileName,$,Name
            endif
        endif
    endif
    if ??_ccall
        if ??_public
            _&Name equ Name
   ifdef Not_VxD
public C Name
   else
                 public _&Name
   endif
        endif
    endif
    if ??_pcall
        if ??_public
            ?toupper Name
            ?merge  public,,,,%?upper
        endif
    endif


    ifndef Not_VxD
ifdef DEBUG
   if ??_dfs EQ DFS_LOG
VMMCall Log_Proc_Call
   else
   if ??_dfs EQ DFS_TEST_REENTER
VMMCall Test_Reenter
   else
   if ??_dfs or ?_LOCKABLECODE eq 0
ifdef WIN31COMPAT
   if ??_dfs AND DFS_LOG
VMMCall Log_Proc_Call
   endif
   if ??_dfs AND DFS_TEST_REENTER
VMMCall Test_Reenter
   endif
else
   ife ?_LOCKABLECODE
   ifdef ??_debug_flags
push    ??_debug_flags
if ??_dfs
pushfd
or  dword ptr [esp+4],??_dfs
popfd
endif
VMMCall _Debug_Flags_Service
   elseif ??_dfs
push    ??_dfs
VMMCall _Debug_Flags_Service
   endif
   else
   push    ??_dfs
   VMMCall _Debug_Flags_Service
   endif
endif
   else
     ifdef profileall
IncProfileCount
     endif
   endif
   endif
   endif
endif
    endif



endm






?_BeginProc macro
endm

?PUBLIC_BeginProc macro
    ??_public = 1
endm

?LOCAL_BeginProc macro
    ??_public = 0
endm

?HIGH_FREQ_BeginProc macro
    ??_align = 1
endm

?HOOK_PROC_BeginProc macro
    ??_hook = 1
    ??_hookarg = 1
endm

?SERVICE_BeginProc macro
    ??_service = 1
    .erre ?_16ICODE, <SERVICEs must be in 32 bit code>
    .erre ?_RCODE, <SERVICEs must be in 32 bit code>
endm

?ASYNC_SERVICE_BeginProc macro
    ??_service = 1
    ??_async_service = 1
    .errnz ?_LCODE, <ASYNC_SERVICE's must be in LOCKED code>
endm

?NO_LOG_BeginProc macro
    ??_log = 0
endm

?NO_PROFILE_BeginProc macro
    ??_profile = 0
endm

?NO_TEST_CLD_BeginProc macro
    ??_test_cld = 0
endm

?TEST_BLOCK_BeginProc macro
    ??_might_block = DFS_TEST_BLOCK
endm

?TEST_REENTER_BeginProc macro
    ??_test_reenter = DFS_TEST_REENTER
endm

?NEVER_REENTER_BeginProc macro
    ??_never_reenter = DFS_NEVER_REENTER
endm

?NOT_SWAPPING_BeginProc macro
    ??_not_swapping = DFS_NOT_SWAPPING
endm

?NO_PROLOG_BeginProc macro
    ??_prolog_disabled = 1
endm

?ESP_BeginProc macro
    ??_esp = VMM_TRUE
    ifndef Not_VxD
.erre ?_16ICODE, <Beginproc ESP attribute invalid in 16 bit seg.>
.erre ?_RCODE, <Beginproc ESP attribute invalid in real-mode seg.>
    endif
endm

?CCALL_BeginProc macro
    ??_ccall = 1
endm

?PCALL_BeginProc macro
    ??_pcall = 1
endm

?SCALL_BeginProc macro
    ??_scall = 1
endm

?ICALL_BeginProc macro
    ??_scall = 1
endm

?W32SVC_BeginProc macro
    ??_scall = 1
    ??_w32svc = 1
endm

ifdef DEBUG
ifdef profileall
?ProfileHeader_BeginProc macro PL, filename
ifndef _&filename&__proc_list
  _&filename&__proc_list = 0
  PUBLIC _&filename&__proc_list
endif
    dd OFFSET32 _&filename&__proc_list
PL  dd 0
_&filename&__proc_list = PL
endm
endif

IncProfileCount macro
    if ??_service OR ??_profile
        inc dword ptr [??_name-4]
    else
        ifndef profileall
        .err <IncProfileCount can be used only in services.>
        endif
    endif
endm
else
IncProfileCount macro
endm
endif
















ArgVar  macro   name,length,used
    ??_numargs = ??_numargs + 1
    if ??_pcall
        ?mkarg  <name>, <length>, <used>, %??_numargs
    else
        ?argvar <name>, <length>, <used>
    endif
    ??_procflags = ??_procflags OR ??_pf_Check
    endm

?mkarg  macro   name, length, used, num
    .xcref  ?MKA&num
    ?deflocal <name>
    ?MKA&num &macro
        ?argvar <name>, <length>, <used>
        &endm
    ??_aframe = ??_aframe + 4
    endm
    .xcref  ?mkarg

?argvar macro   name,length,used
    local   a
    ifidni  <length>,<BYTE>
        a = ??_aframe
        ??_aframe =  ??_aframe + 4
        ?setname <name>, <byte ptr [??_basereg+??_initaframe+a]>, <used>
    elseifidni <length>,<WORD>
        a = ??_aframe
        ??_aframe =  ??_aframe + 4
        ?setname <name>, <word ptr [??_basereg+??_initaframe+a]>, <used>
    elseifidni <length>,<DWORD>
        a = ??_aframe
        ??_aframe =  ??_aframe + 4
        ?setname <name>,  <dword ptr [??_basereg+??_initaframe+a]>, <used>
        ?setname <name&l>,<word ptr [??_basereg+??_initaframe+a]>, <used>
        ?setname <name&ll>,<byte ptr [??_basereg+??_initaframe+a]>, <used>
        ?setname <name&lh>,<byte ptr [??_basereg+??_initaframe+a+1]>, <used>
        ?setname <name&h>,<word ptr [??_basereg+??_initaframe+a+2]>, <used>
        ?setname <name&hl>,<byte ptr [??_basereg+??_initaframe+a+2]>, <used>
        ?setname <name&hh>,<byte ptr [??_basereg+??_initaframe+a+3]>, <used>
    else
        a = ??_aframe
        ??_aframe =  ??_aframe + ((length + 3)/4)*4
        ?setname <name>, <[??_basereg+??_initaframe+a]>, <used>
    endif
endm






?setname macro name, value, used
    ?deflocal <name>
    ifidni <used>, <NOTUSED>
        name equ _inaccessible_NOTUSED_
    else
        name equ value
        ??_procflags = ??_procflags OR ??_pf_ArgsUsed OR ??_pf_Check
    endif
endm



















LocalVar    macro   name,length,flag
    local   a
    ??_numlocals = ??_numlocals + 1
    ??_pad = 1
    ifidni <flag>, <PACK>
        ??_pad = 0
    endif
    ifidni  <length>,<BYTE>
        ??_frame = ??_frame + 1 + 3 * ??_pad
        a = ??_frame
        ?deflocal <name>
        name equ byte ptr [??_basereg-a]
    elseifidni <length>,<WORD>
        ??_frame =  ??_frame + 2 + 2 * ??_pad
        a = ??_frame
        ?deflocal <name>
        name equ word ptr [??_basereg-a]
    elseifidni <length>,<DWORD>
        ??_frame = ??_frame + 4
        a = ??_frame
        ?deflocal <name, name&l, name&ll, name&lh, name&h, name&hl, name&hh>
        name equ dword ptr [??_basereg-a]
        name&l equ word ptr [??_basereg-a]
        name&ll equ byte ptr [??_basereg-a]
        name&lh equ byte ptr [??_basereg-a+1]
        name&h equ word ptr [??_basereg-a+2]
        name&hl equ byte ptr [??_basereg-a+2]
        name&hh equ byte ptr [??_basereg-a+3]
    else
        ??_frame =  ??_frame + ((length + 3)/4)*4
        a = ??_frame
        ?deflocal <name>
        name equ [??_basereg-a]
    endif
    ??_procflags = ??_procflags OR ??_pf_Check
endm

?deflocal macro name
    irp nm, <name>
        ??_numlocalsymbols = ??_numlocalsymbols + 1
        ?dodeflocal <nm>, %(??_numlocalsymbols)
    endm
endm
    .xcref  ?deflocal

?dodeflocal macro name, num
    .xcref  ?LOC&num
    ?LOC&num &macro
        name    equ <__inaccessible__NOTINSCOPE__>
        &endm
    endm
    .xcref  ?dodeflocal



EnterProc macro
    .errnz ??_frame and 3, <Total size of local variables not a multiple of 4.>
    if ??_scall
        if ??_public
   ifdef Not_VxD
                ?merge  %??_name,@,%(??_aframe),,label,near
                ?merge  public,,,,C,%??_name,@,%(??_aframe)
   else
                ?merge  _,%??_name,@,%(??_aframe),label,near
                ?merge  public,,,,,_,%??_name,@,%(??_aframe)
   endif
        endif
    endif
    if ??_pcall
        ??_aframe = 0
        ?count = ??_numargs
        rept    ??_numargs
            ?invprg <?MKA>,%?count
            ?count = ?count - 1
        endm
    endif
    ??_fleave = FALSE
    if ??_esp
        if  ??_frame
            sub esp, ??_frame
            ??_pushed = ??_pushed + ??_frame
            ??_fleave = VMM_TRUE
        endif
    else
        if  ??_frame eq 0
            if (??_aframe eq 0) OR ((??_procflags AND ??_pf_ArgsUsed) EQ 0)
                ifdef DEBUG
                    push    ebp
                    mov ebp,esp
                    ??_fleave = VMM_TRUE
                endif
            else
                push    ebp
                mov ebp,esp
                ??_fleave = VMM_TRUE
            endif
        else
            enter   ??_frame, 0
            ??_fleave = VMM_TRUE
        endif
    endif
    ??_procflags = ??_procflags OR ??_pf_Entered
endm















LeaveProc macro flags
    if ??_fleave
        if ??_esp
            ifidni <flags>,<PRESERVE_FLAGS>
                lea esp,[esp + ??_frame]
            else
                add esp,??_frame
            endif
        else
            leave
        endif
    endif
    ??_procflags = ??_procflags OR ??_pf_Left
endm







Return  macro
    if  ??_cleanoff OR ??_w32svc
        if  ??_w32svc AND (??_aframe LT 8)
            ret 8
        else
            ret ??_aframe
        endif
    else
        ret
    endif
    ??_procflags = ??_procflags OR ??_pf_Returned
    endm




EndProc macro Name, Flag
    Name endp
if ??_w32svc
    if ??_aframe lt 8
        cparm&Name equ 0
    else
        cparm&Name equ (??_aframe/4 - 2)
    endif
endif
if ??_procflags AND ??_pf_Left
if ??_fleave
if ??_esp
    ??_pushed = ??_pushed - ??_frame
endif
endif
endif
ifdifi  <Flag>,<NOCHECK>
    if ??_pushed ne 0
        %out Warning: stack not balanced in Name
    endif
    if ??_procflags AND ??_pf_Check
        ife ??_procflags AND ??_pf_Entered
            %out Warning: ArgVar/LocalVar without EnterProc in Name
        endif
        ife ??_procflags AND ??_pf_Left
            %out Warning: ArgVar/LocalVar without LeaveProc in Name
        endif
        ife ??_procflags AND ??_pf_Returned
            %out Warning: ArgVar/LocalVar without Return in Name
        endif
    endif
endif
ifdifi  <Flag>,<KEEPFRAMEVARS>
    ?count = 0
    rept    ??_numlocalsymbols
        ?count = ?count + 1
        ?invprg <?LOC>,%?count
    endm
endif
    ??_ends
    ??_ends equ <>
    endm







cCall   macro   name, arglst, flags
    ife .TYPE name
       CondExtern name, near
    endif
    PushCParams <arglst>, <flags>
    call    name
    ClearCParams
    endm
    .xcref  cCall






pCall   macro   name, arglst
    local   ??saved
    ife .TYPE name
        ?toupper name
    else
        ?upper equ <name>
    endif
    CondExtern %?upper, near
    ??saved = ??_pushed
    irp x,<arglst>
        push    x
        ??_pushed = ??_pushed + 4
    endm
    call    ?upper
    ??_pushed = ??saved
    endm
    .xcref  pCall







sCall   macro   name, arglst
    local   ??saved
    ??saved = ??_pushed
    PushCParams <arglst>
    ?scall  name, %(??_argc * 4)
    ??_pushed = ??saved
    endm
    .xcref  sCall





iCall   equ <sCall>














IFNDEF  STANDARD_CCALL
NONSTANDARD_CCALL = 1
ENDIF

PushCParams macro arglst, flags
    ??_argc = 0
IFDEF   NONSTANDARD_CCALL
    ??_popargs = 0
ELSE
    ??_popargs = ??_align EQ 0
ENDIF
    ifidni  <flags>, <SMALL>
        ??_popargs = 1
    elseifidni <flags>, <FAST>
        ??_popargs = 0
    endif

    irp x,<arglst>
        ??_argc = ??_argc + 1
        ?marg   <x>,%??_argc
    endm
    ?count = ??_argc
    rept    ??_argc
        ?invprg <?AM>,%?count
        ?count = ?count - 1
    endm
    endm
















ClearCParams macro fPreserveFlags
if ??_argc ne 0
   if (??_popargs) AND (??_argc LE 2)
     rept ??_argc
pop ecx
     endm
   else
     ifidni <fPreserveFlags>, <PRESERVE_FLAGS>
lea esp, [esp][??_argc * 4]
     else
add esp,??_argc * 4
     endif
   endif
endif
??_pushed = ??_pushed - (??_argc * 4)
endm



?marg   macro   name, num
    .xcref
    .xcref  ?AM&num
    .cref
    ?AM&num &macro
        push    name
        ??_pushed = ??_pushed + 4
        &endm
    endm
    .xcref  ?marg



?invprg macro   name1, name2
    name1&name2
    purge   name1&name2
    endm
    .xcref  ?invprg



?scall  macro   name1, name2
    CondExtern _&name1&@&name2, near
    call    _&name1&@&name2
    endm
    .xcref  ?scall



?merge  macro   l1, l2, l3, l4, op, r1, r2, r3, r4, r5, r6, r7, r8, r9
    l1&l2&l3&l4 op r1&r2&r3&r4&r5&r6&r7&r8&r9
    endm



?toupper macro s
      ?upper equ <>
      irpc x,<s>
        if '&x' GE 'a'
          if '&x' LE 'z'
        ?t1 substr <ABCDEFGHIJKLMNOPQRSTUVWXYZ>,'&x'-'a'+1,1
        ?upper catstr ?upper,?t1
          else
        ?upper catstr ?upper,<&x>
          endif
        else
          ?upper catstr ?upper,<&x>
        endif
      endm
    endm
    .xcref






CondExtern macro name,dist
    ifdef MASM6
        ifndef name
        externdef name:dist
        endif
    else
        if2
        ifndef name
            extrn name:dist
        endif
        endif
    endif
endm



SaveReg macro   reglist
    irp reg,<reglist>
        ifidni <reg>, <fd>
            pushfd
            ??_pushed = ??_pushed + 4
        else
        ifidni <reg>, <ad>
            pushad
            ??_pushed = ??_pushed + SIZE Pushad_Struc
        else
            push    reg
            ??_pushed = ??_pushed + 4
        endif
        endif
    endm
endm







RestoreReg macro     reglist
    irp reg,<reglist>
        ifidni <reg>, <fd>
            popfd
            ??_pushed = ??_pushed - 4
        else
        ifidni <reg>, <ad>
            popad
            ??_pushed = ??_pushed - SIZE Pushad_Struc
        else
            pop reg
            ??_pushed = ??_pushed - 4
        endif
        endif
    endm
endm

ifdef DEBUG
Begin_Profile_List macro devname
ifdef profileall
VxD_DATA_SEG
    db  'PROCLIST'
PUBLIC devname&_Proc_Profile_List
devname&_Proc_Profile_List label dword
endif
endm

Profile_Link macro modname
ifdef profileall
ifdifi <modname>,@filename
EXTRN _&modname&__proc_list:near
endif
    dd  OFFSET32 _&modname&__proc_list
endif
endm

End_Profile_List macro
ifdef profileall
    dd  0
VxD_DATA_ENDS
endif
endm


endif
ifndef Not_VxD
RESERVED_LOW_BOOST EQU 00000001H
CUR_RUN_VM_BOOST EQU 00000004H
LOW_PRI_DEVICE_BOOST EQU 00000010H
HIGH_PRI_DEVICE_BOOST EQU 00001000H
CRITICAL_SECTION_BOOST EQU 00100000H
TIME_CRITICAL_BOOST EQU 00400000H
RESERVED_HIGH_BOOST EQU 40000000H
PEF_WAIT_FOR_STI_BIT EQU 0
PEF_WAIT_FOR_STI EQU (1 SHL PEF_WAIT_FOR_STI_BIT)
PEF_WAIT_NOT_CRIT_BIT EQU 1
PEF_WAIT_NOT_CRIT EQU (1 SHL PEF_WAIT_NOT_CRIT_BIT)
PEF_DONT_UNBOOST_BIT EQU 2
PEF_DONT_UNBOOST EQU (1 SHL PEF_DONT_UNBOOST_BIT)
PEF_ALWAYS_SCHED_BIT EQU 3
PEF_ALWAYS_SCHED EQU (1 SHL PEF_ALWAYS_SCHED_BIT)
PEF_TIME_OUT_BIT EQU 4
PEF_TIME_OUT EQU (1 SHL PEF_TIME_OUT_BIT)
PEF_WAIT_NOT_HW_INT_BIT EQU 5
PEF_WAIT_NOT_HW_INT EQU (1 SHL PEF_WAIT_NOT_HW_INT_BIT)
PEF_WAIT_NOT_NESTED_EXEC_BIT EQU 6
PEF_WAIT_NOT_NESTED_EXEC EQU (1 SHL PEF_WAIT_NOT_NESTED_EXEC_BIT)
PEF_WAIT_IN_PM_BIT EQU 7
PEF_WAIT_IN_PM EQU (1 SHL PEF_WAIT_IN_PM_BIT)
PEF_THREAD_EVENT_BIT EQU 8
PEF_THREAD_EVENT EQU (1 SHL PEF_THREAD_EVENT_BIT)
PEF_WAIT_FOR_THREAD_STI_BIT EQU 9
PEF_WAIT_FOR_THREAD_STI EQU (1 SHL PEF_WAIT_FOR_THREAD_STI_BIT)
PEF_RING0_EVENT_BIT EQU 10
PEF_RING0_EVENT EQU (1 SHL PEF_RING0_EVENT_BIT)
PEF_WAIT_CRIT_BIT EQU 11
PEF_WAIT_CRIT EQU (1 SHL PEF_WAIT_CRIT_BIT)
PEF_WAIT_CRIT_VM_BIT EQU 12
PEF_WAIT_CRIT_VM EQU (1 SHL PEF_WAIT_CRIT_VM_BIT)
PEF_PROCESS_LAST_BIT EQU 13
PEF_PROCESS_LAST EQU (1 SHL PEF_PROCESS_LAST_BIT)
PEF_WAIT_NOT_TIME_CRIT_BIT EQU PEF_WAIT_NOT_HW_INT_BIT
PEF_WAIT_NOT_TIME_CRIT EQU PEF_WAIT_NOT_HW_INT
PEF_WAIT_NOT_PM_LOCKED_STACK_BIT EQU PEF_WAIT_NOT_NESTED_EXEC_BIT
PEF_WAIT_NOT_PM_LOCKED_STACK EQU PEF_WAIT_NOT_NESTED_EXEC
BLOCK_SVC_INTS_BIT EQU 0
BLOCK_SVC_INTS EQU (1 SHL BLOCK_SVC_INTS_BIT)
BLOCK_SVC_IF_INTS_LOCKED_BIT EQU 1
BLOCK_SVC_IF_INTS_LOCKED EQU (1 SHL BLOCK_SVC_IF_INTS_LOCKED_BIT)
BLOCK_ENABLE_INTS_BIT EQU 2
BLOCK_ENABLE_INTS EQU (1 SHL BLOCK_ENABLE_INTS_BIT)
BLOCK_POLL_BIT EQU 3
BLOCK_POLL EQU (1 SHL BLOCK_POLL_BIT)
BLOCK_THREAD_IDLE_BIT EQU 4
BLOCK_THREAD_IDLE EQU (1 SHL BLOCK_THREAD_IDLE_BIT)
BLOCK_FORCE_SVC_INTS_BIT EQU 5
BLOCK_FORCE_SVC_INTS EQU (1 SHL BLOCK_FORCE_SVC_INTS_BIT)

Client_Reg_Struc STRUC
Client_EDI DD ?
Client_ESI DD ?
Client_EBP DD ?
Client_res0 DD ?
Client_EBX DD ?
Client_EDX DD ?
Client_ECX DD ?
Client_EAX DD ?
Client_Error DD ?
Client_EIP DD ?
Client_CS DW ?
Client_res1 DW ?
Client_EFlags DD ?
Client_ESP DD ?
Client_SS DW ?
Client
slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
5C#
发布于:2004-03-07 08:14
Re:[求助]谁有冲击波源文件
; TRACKIT.ASM

YES EQU 1
NO  EQU 0
SET_BP_CODE   EQU 1
CLEAR_BP_CODE EQU 2
Enter_OP_CODE EQU 3

;============================================================================
;Title TRACKIT.ASM
;============================================================================
;ddk中的nmake.exe 编译
;============================================================================
;                                 I N C L U D E S
;============================================================================

    .486p          
    .xlist
    MASM=1

    include    vmm.inc
    include    vwin32.inc
    include    shell.inc
    include    ifsmgr.inc
    include    ifs.inc

    .list
;============================================================================
;     D E V I C E   I N I T I A L I Z A T I O N   C O D E
;============================================================================
;----------------------------------------------------------------------------
; Hook interrupts 30
;----------------------------------------------------------------------------

VXD_Icode_Seg

BeginProc      TRACKIT_Device_Init

      mov      eax, 30h
      mov      esi, OFFSET32 Hookint30
      VMMCall  Hook_VMM_Fault

      mov      eax, 30h
      mov      esi, OFFSET32 Hookint30
      VMMCall  Hook_PM_Fault

      clc
      ret
EndProc     TRACKIT_Device_Init

VXD_Icode_Ends


;============================================================================
;             D E V I C E   D E C L A R A T I O N
;============================================================================

VXD_Locked_Code_Seg


Declare_Virtual_Device    TRACKIT,0,0,TRACKIT_Control,Undefined_Device_ID,                           Undefined_Init_Order,,


;----------------------------------------------------------------------------
; Device control procedure for the VxD.
;----------------------------------------------------------------------------

BeginProc   TRACKIT_Control

      Control_Dispatch SYS_DYNAMIC_DEVICE_INIT, TRACKIT_Device_Init
      Control_Dispatch SYS_DYNAMIC_DEVICE_EXIT, TRACKIT_Device_Exit
      Control_Dispatch W32_DEVICEIOCONTROL,     TRACKIT_ioctl
      clc
      ret

TRACKIT_Control  ENDP



;----------------------------------------------------------------------------
; Get IOcontrol code
;----------------------------------------------------------------------------

BeginProc      TRACKIT_ioctl

      mov      ecx,[esi].dwIoControlCode
      cmp      ecx,SET_BP_CODE            ;设置 HOOK_API
      jz       Set_bpoint

      cmp      ecx,CLEAR_BP_CODE
      jz       Clear_bpoint               ;清除 HOOK_API
      
      cmp      ecx,Enter_OP_CODE
      jz       Enter_OP                   ;OP 查询

      xor      eax, eax
      clc
      ret
EndProc        TRACKIT_ioctl


;-----------------------------------------------------------------------------
; Save the code which will be restored
;-----------------------------------------------------------------------------

BeginProc       Set_bpoint
pushad

mov eax,[esi].lpvInBuffer
        mov     eax,[eax]
        mov     bpoint_addr1,eax
        mov     bx,30cdh
        xchg    bx,[eax]
        mov     hook_api1_code,bx            ;HOOK 第1个API

        mov     eax,[esi].lpvInBuffer
        mov     eax,[eax+4]
        mov     bpoint_addr2,eax
        mov     bx,30cdh
        xchg    bx,[eax]
        mov     hook_api2_code,bx            ;HOOK 第2个API

        mov     eax,[esi].lpvInBuffer
        mov     eax,[eax+8]
        mov     bpoint_addr3,eax
        mov     bx,30cdh
        xchg    bx,[eax]
        mov     hook_api3_code,bx            ;HOOK 第3个API


                                            
popad
xor      eax, eax
       clc
ret
EndProc         Set_bpoint


BeginProc       Clear_bpoint
pushad

        mov     eax,bpoint_addr1
        mov     bx,hook_api1_code
        mov     [eax],bx                     ;恢复 第1个API代码

        mov     eax,bpoint_addr2
        mov     bx,hook_api2_code
        mov     [eax],bx                     ;恢复 第2个API代码

        mov     eax,bpoint_addr3
        mov     bx,hook_api3_code
        mov     [eax],bx                     ;恢复 第3个API代码


popad
xor      eax, eax
       clc
ret
EndProc         Clear_bpoint


BeginProc Enter_OP
pushad

mov eax,[esi].lpvOutBuffer
mov ebx,enter_eip
mov     [eax],ebx                    ;放入enter_eip
        mov     [esi].cbOutBuffer,4          ;放入out buff size

popad
xor      eax, eax
       clc
ret
EndProc   Enter_OP


;----------------------------------------------------------------------------
; UnHook all interrupts and services hooked
;----------------------------------------------------------------------------

BeginProc      TRACKIT_Device_Exit

      mov      eax, 30h
      mov      esi, OFFSET32 Hookint30
      VMMCall  UnHook_VMM_Fault
      mov      eax, 30h
      mov      esi, OFFSET32 Hookint30
      VMMCall  UnHook_PM_Fault                   ;解除  hook
      clc
      ret

EndProc     TRACKIT_Device_Exit
                              


;============================================================================
;                            V A R I A B L E S
;============================================================================

     hook_api1_code  dw 0
     hook_api2_code  dw 0
     hook_api3_code  dw 0

     call_ret_code   dw 0
     bpoint_addr1    dd 0
     bpoint_addr2    dd 0
     bpoint_addr3    dd 0

     call_inapi      db NO
     enter_eip       dd 0h

;============================================================================
;                          M A I N   C O D E
;============================================================================

;----------------------------------------------------------------------------
; Hook int30
;----------------------------------------------------------------------------

BeginProc Hookint30

      ;int 3

      .if    call_inapi==NO

              pushad

              mov     esi,[ebp.Client_EIP]
              sub     esi,2
              mov     [ebp.Client_EIP],esi    

              mov     esi,[ebp.Client_ESP]
              mov     esi,[esi]
              mov     bx,30cdh
              xchg    bx,[esi]
              mov     call_ret_code,bx       ;在返回处设置 int 30

              mov     eax,bpoint_addr1
              mov     bx,hook_api1_code
              mov     [eax],bx               ;恢复 第1个API代码

              mov     eax,bpoint_addr2
              mov     bx,hook_api2_code
              mov     [eax],bx               ;恢复 第2个API代码

              mov     eax,bpoint_addr3
              mov     bx,hook_api3_code
              mov     [eax],bx               ;恢复 第3个API代码

              mov     call_inapi,YES         ;设置 标志
      
              popad
              clc                            ;
              ret

      .else

              pushad

              mov     esi,[ebp.Client_EIP]
              sub     esi,2
              mov     [ebp.Client_EIP],esi              
              mov     bx,call_ret_code
              mov     [esi],bx              ;恢复 返回 代码



              ;----------------------------------------------------  
              mov     eax,[esi-27h]           ;BCB 5.0 4.0   (hand)
              .if     eax==626610ebh
                      mov       enter_eip,esi
                      sub       enter_eip,27h
              .endif

              ;----------------------------------------------------
              mov     eax,[esi-35h]           ;BC  1996   (hand)
              .if     eax==0a302e0c1h
                      mov       enter_eip,esi
                      sub       enter_eip,35h
                      sub       enter_eip,5h
              .endif

              ;----------------------------------------------------
              mov     eax,[esi-29h]           ;BC  1998   (hand)   ;cgichack
              .if     eax==0a302e0c1h
                      mov       enter_eip,esi
                      sub       enter_eip,29h
                      sub       enter_eip,5h
              .endif


              ;----------------------------------------------------
              mov     eax,[esi-5Dh]            ;BC  1996   (hand)  ;dbd32.exe
              .if     eax==0a302e0c1h
                      mov       enter_eip,esi  
                      sub       enter_eip,5Dh
                      sub       enter_eip,5h      
              .endif


              ;----------------------------------------------------
              mov     eax,[esi-0fh]           ;WatCom C ?     (hand)
              and     eax,00ffffffh
              .if     eax==00e80a6ah
                      mov       enter_eip,esi
                      sub       enter_eip,0fh
              .endif



              ;----------------------------------------------------
              ;DELPHI             ;AATOOLS,

              mov     eax,[esi-8]                    
              cmp     eax,0e8006a50h
              jnz     DELPHI1_END

              mov     ax,[esi-0ah]
              .if     ah==0c3h || al==0c3h
                      mov     ebx,[ebp.Client_ESP]    ;get esp
                      mov     ebx,[ebx+4]

                      mov     esi,0ah
                      sub     ebx,esi

                      .while  esi !=30h                    ;(0ch,10h,11h,12h,16h,18h)
                              mov     eax,[ebx]    
                              .if     eax==83ec8b55h || eax==0b9ec8b55h
                                      mov       enter_eip,ebx
                                      .break
                              .endif
                              inc     esi
                              dec     ebx
                      .endw
               .endif

  DELPHI1_END:
              ;------------------------------------------------
              ;DELPHI             ;ASPACK

              mov     eax,[esi-0Fh]  
              cmp     eax,0e800408dh
              jnz     DELPHI2_END

              mov     ax,[esi-11h]
              .if     ah==0c3h || al==0c3h
                      mov     ebx,[ebp.Client_ESP]    ;get esp
                      mov     ebx,[ebx]

                      mov     esi,0ah
                      sub     ebx,esi

                      .while  esi !=30h                 ; (0bh,0eh,16h)
                              mov     eax,[ebx]    
                              .if     eax==83ec8b55h
                                      mov       enter_eip,ebx
                                      .break
                              .endif
                              inc     esi
                              dec     ebx
                      .endw
               .endif
  DELPHI2_END:

            
              ;----------------------------------------------------  
              mov     ax,[esi]
              .if     ax==0f08bh
              mov     eax,[esi-0dh]          ;VC ?    notepad     (line)
              .if     eax==83ec8b55h
                      mov       enter_eip,esi
                      sub       enter_eip,0dh
              .endif
              .endif


              ;----------------------------------------------------  
              mov     ax,[esi]
              .if     ax==0f08bh
                      mov     eax,[esi-2ch]          ;VC ?    word     (line)
                      .if     eax==6aec8b55h
                              mov       enter_eip,esi
                              sub       enter_eip,2ch
                      .endif
              .endif



              ;----------------------------------------------------  
              mov     eax,[esi]
              .if     eax==0d48ad233h
                      mov     eax,[esi-2ch]    ;VC 5,6   MMBUILDER,OPERA   (ver)
                      .if     eax==6aec8b55h
                              mov       enter_eip,esi
                              sub       enter_eip,2ch
                      .endif  
              .endif

              ;----------------------------------------------------  
              mov     al,[esi]
              .if     al==0a3h
                      mov     eax,[esi-26h]    ;VC 6   REGSHOT   (ver)
                      .if     eax==6aec8b55h
                              mov       enter_eip,esi
                              sub       enter_eip,26h
                              sub       enter_eip,6h
                      .endif  
              .endif



              ;----------------------------------------------------
              mov     ax,[esi]
              .if     ax==0e850h
                      mov     eax,[esi-150h]     ;VC 5.0(MFC) CALC,icq   (hand)
                      .if     eax==6aec8b55h
                              mov       enter_eip,esi
                              sub       enter_eip,150h
                      .endif
              .endif

              ;----------------------------------------------------
              mov     ax,[esi]
              .if     ax==0e850h
                      mov     eax,[esi-12eh]     ;VC 6.0(MFC)  CREATECD  (hand)
                      .if     eax==6aec8b55h
                              mov       enter_eip,esi
                              sub       enter_eip,12eh
                      .endif
              .endif

  ;---------------------------------------------------------------

              mov     eax,bpoint_addr1
              mov     bx,30cdh
              xchg    bx,[eax]
              mov     hook_api1_code,bx      ;HOOK 第1个API
        
              mov     eax,bpoint_addr2
              mov     bx,30cdh
              xchg    bx,[eax]
              mov     hook_api2_code,bx      ;HOOK 第2个API

              mov     eax,bpoint_addr3
              mov     bx,30cdh
              xchg    bx,[eax]
              mov     hook_api3_code,bx      ;HOOK 第3个API


              mov     call_inapi,NO          ;设置标志

              popad
              clc                            ;
              ret
        .endif
EndProc        Hookint30


VXD_LOCKED_CODE_ENDS

end
slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
6C#
发布于:2004-03-07 08:14
Re:[求助]谁有冲击波源文件
;SHELLFSC.Inc******************************************************************************
;
;   (C) Copyright MICROSOFT Corp., 1988-1990
;
;   Title: SHELLFSC.Inc - EQUATES related to the File Sys Change stuff
;
;   Version: 1.00
;
;   Date: 19-Sep-1988
;
;   Author: ARR
;
;------------------------------------------------------------------------------
;
;   Change log:
;
;      DATE REV    DESCRIPTION
;   ----------- --- -----------------------------------------------------------
;   19-Sep-1988 ARR Original
;
;==============================================================================

VDA_FileSysChange EQU 0400H+20+11

;
; On VDA_FileSysChange, wParam is not used
;   Particular VMDOSAPP instance which gets the message is the VM that has
;   changed the file system
;
; NOTE THERE MUST BE A CALL BACK ON THIS EVENT.
;
; The reference data MUST BE A pointer to a structure of the following type:
;
; It is the responsibility of the caller to "FREE" this structure (if needed)
;   on the call back.
;
; Caller can extend this structure if needed by tacking extra info on the end.
;
MAXFSCINFOSIZE EQU 256

VMDA_FileSysChng  STRUC
VMDA_FSC_Func dw ?
VMDA_FSC_Buffer db MAXFSCINFOSIZE DUP(?)
VMDA_FileSysChng  ENDS

;
; equates for VMDA_FSC_Func
;
VMDA_FSC_CREATE EQU 0
VMDA_FSC_DELETE EQU 1
VMDA_FSC_RENAME EQU 2
VMDA_FSC_ATTRIBUTES EQU 3
VMDA_FSC_NETCONNECT EQU 4
VMDA_FSC_NETDISCONNECT EQU 5
VMDA_FSC_REFRESH EQU 6
VMDA_FSC_MKDIR EQU 7
VMDA_FSC_RMDIR EQU 8
slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
7C#
发布于:2004-03-07 08:13
Re:[求助]谁有冲击波源文件
;shell.inc******************************************************************************
;
;   (C) Copyright MICROSOFT Corp., 1988-1990
;
;   Title: SHELL.Inc - Public services for SHELL
;
;   Version: 1.00
;
;   Date: 30-Nov-1988
;
;   Author: ARR
;
;------------------------------------------------------------------------------
;
;   Change log:
;
;      DATE REV    DESCRIPTION
;   ----------- --- -----------------------------------------------------------
;   19-Sep-1988 RAL Original
;   12-Oct-1988 RAL Converted to use VxD_Service macros
;   29-Nov-1988 ARR Redo split from VMCTRL
;
;==============================================================================

Begin_Service_Table SHELL

SHELL_Service  SHELL_Get_Version, LOCAL
SHELL_Service  SHELL_Resolve_Contention
SHELL_Service  SHELL_Event,LOCAL
SHELL_Service  SHELL_SYSMODAL_Message,LOCAL
SHELL_Service  SHELL_Message,LOCAL
;
; Following specific to SHELL version >= 3.10
;
SHELL_Service  SHELL_GetVMInfo, LOCAL
;
ifdef WIN40
SHELL_Service   _SHELL_PostMessage, LOCAL
SHELL_Service   _SHELL_ShellExecute, LOCAL
SHELL_Service   _SHELL_PostShellMessage
SHELL_Service   SHELL_DispatchRing0AppyEvents, LOCAL
SHELL_Service   SHELL_Hook_Properties, LOCAL
SHELL_Service   SHELL_Unhook_Properties, LOCAL
SHELL_Service   SHELL_Update_User_Activity, LOCAL
SHELL_Service _SHELL_QueryAppyTimeAvailable, LOCAL
SHELL_Service   _SHELL_CallAtAppyTime, LOCAL
SHELL_Service   _SHELL_CancelAppyTimeEvent, LOCAL
SHELL_Service   _SHELL_BroadcastSystemMessage, LOCAL
SHELL_Service   _SHELL_HookSystemBroadcast, LOCAL
SHELL_Service   _SHELL_UnhookSystemBroadcast, LOCAL
SHELL_Service _SHELL_LocalAllocEx, LOCAL
SHELL_Service _SHELL_LocalFree, LOCAL
SHELL_Service _SHELL_LoadLibrary, LOCAL
SHELL_Service _SHELL_FreeLibrary, LOCAL
SHELL_Service _SHELL_GetProcAddress, LOCAL
SHELL_Service _SHELL_CallDll, LOCAL
SHELL_Service   _SHELL_Install_Taskman_Hooks, LOCAL
endif

End_Service_Table SHELL

BeginDoc
;
;   Windows Message Box Flags used on SHELL_SYSMODAL_Message and
; SHELL_Message services
;
MB_OK EQU    00H
MB_OKCANCEL EQU    01H
MB_ABORTRETRYIGNORE EQU    02H
MB_YESNOCANCEL EQU    03H
MB_YESNO EQU    04H
MB_RETRYCANCEL EQU    05H
MB_ICONHAND EQU    010H
MB_ICONEXCLAMATION EQU    030H
MB_ICONASTERISK EQU    040H
MB_DEFBUTTON1 EQU    00H
MB_DEFBUTTON2 EQU    0100H
MB_DEFBUTTON3 EQU    0200H
MB_APPLMODAL EQU    00H
MB_SYSTEMMODAL EQU    01000H
MB_NOFOCUS EQU    08000H
;
; Following bits are WIN386 SHELL extensions
;
MB_ASAP EQU    080000000H ; Message is timely, put
;   up as soon as possible
;
; The following flag bits are 3.10 extensions.
;
MB_NOWINDOW EQU    040000000H ; DO NOT switch to Windows
;   to do this message, do it
;   in full screen mode always.
;   ONLY FOR SHELL_SYSMODAL_Message

MB_HANGSYS EQU    020000000H ; Hang with ints disabled.
;   This is for especially
;   severe errors (like parity
;   errors).
;   ONLY FOR SHELL_SYSMODAL_Message

;
;   Windows Message Box Return codes used on SHELL_SYSMODAL_Message and
; SHELL_Message services
;
IDOK                     EQU 1
IDCANCEL                 EQU 2
IDABORT                  EQU 3
IDRETRY                  EQU 4
IDIGNORE                 EQU 5
IDYES                    EQU 6
IDNO                     EQU 7

EndDoc

;
; On SHELL_Event, the wParam in EAX occupies the low 16 bits of EAX. The High 16
; bits contain extra flags
;
SE_WP_SetFocusBoost equ 00000000000000010000000000000000b
SE_WP_SetFocusBoostBit equ 16 ; Boost the SYS VM till a
; Set_Focus call
SE_WP_SwitcherBoost equ 00000000000000100000000000000000b
SE_WP_SwitcherBoostBit equ 17 ; Boost the SYS VM on Switcher
;  screen
SE_WP_FilSysChgBoost equ 00000000000001000000000000000000b
SE_WP_FilSysChgBoostBit equ 18 ; Boost the SYS VM till response
;  to VDA_FileSysChange
SE_WP_ClipAPIBoost equ 00000000000010000000000000000000b
SE_WP_ClipAPIBoostBit equ 19 ; Boost the SYS VM during clipbrd
;  API
SE_WP_PrtScBoost equ 00000000000100000000000000000000b
SE_WP_PrtScBoostBit equ 20 ; Boost the SYS VM during Print screen

SE_WP_DispUpdBoost equ 00000000001000000000000000000000b
SE_WP_DispUpdBoostBit equ 21 ; Boost the SYS VM during updates

include shellfsc.inc

BeginDoc
;
; Bits of returned EAX flags for SHELL_GetVMInfo service
;
SGVMI_Windowed  equ 00000000000000000000000000000100B ; Is Windowed
SGVMI_ALTTABdis   equ 00000000000000000000000000100000b ; Alt+Tab is reserved
SGVMI_ALTESCdis   equ 00000000000000000000000001000000b ; Alt+Esc is reserved
SGVMI_ALTSPACEdis equ 00000000000000000000000010000000b ; Alt+Space is reserved
SGVMI_ALTENTERdis equ 00000000000000000000000100000000b ; Alt+Enter is reserved
SGVMI_ALTPRTSCdis equ 00000000000000000000001000000000b ; Alt+PrtSc is reserved
SGVMI_PRTSCdis  equ 00000000000000000000010000000000b ; PrtSc is reserved
SGVMI_CTRLESCdis  equ 00000000000000000000100000000000b ; Ctrl+Esc is reserved
SGVMI_HasHotKey   equ 00000000000000000100000000000000b ; Has a shortcut key
SGVMI_Polling  equ 00000000000000000001000000000000b ; Polling detection Enab
SGVMI_FastPaste   equ 00000000000000100000000000000000b ; Allow Fast paste Enab
SGVMI_NoHMA  equ 00000000000000000010000000000000b ; No HMA
SGVMI_XMS_Lock  equ 00000000000000010000000000000000b ; XMS Hands Locked
SGVMI_EMS_Lock  equ 00000000000000001000000000000000b ; EMS Hands Locked
SGVMI_V86_Lock  equ 00000000000001000000000000000000b ; V86 Memory Locked
SGVMI_ClsExit  equ 01000000000000000000000000000000b ; Close on Exit Enab

;
; Bits of returned ECX flags for SHELL_GetVMInfo service
; Currently no bits defined.
;

EndDoc

slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
8C#
发布于:2004-03-07 08:12
Re:[求助]谁有冲击波源文件
# MAKEFILE please compile with Microsoft DDK 98.

PATHMASM=e:\bin
PATH = $(PATHVC);$(PATHMASM);$(PATH)

DEVICE        = TRACKIT
OBJS          = TRACKIT.obj
DDB_NAME      = TRACKIT_DDB
DESCRIPTION   = $(DEVICE) Virtual Device (Version 4.0)
LFLAGS        = /DEBUG /debugtype:map
AFLAGS        = -DSTANDARD_CCALL -DIS_32 -coff -DBLD_COFF -W3 -Zd -c -Cx -DMASM6 -Sg -DDEBLEVEL=1 -DDEBUG
BASECOPYRIGHT = 1998

default: $(DEVICE).vxd

.asm.obj:
        ml $(AFLAGS) $<
.cpp.obj:
cl /c /Zd $<

$(DEVICE).vxd: $(OBJS)
        link @<<$(DEVICE).lnk /def:<<$(DEVICE).def
$(LFLAGS) /vxd
/out:$(DEVICE).vxd
/map:$(DEVICE).map
$(OBJS)
<<
VXD $(DEVICE) dynamic
DESCRIPTION '$(DESCRIPTION)'
SEGMENTS
    _LPTEXT     CLASS 'LCODE'   PRELOAD NONDISCARDABLE
    _LTEXT      CLASS 'LCODE'   PRELOAD NONDISCARDABLE
    _LDATA      CLASS 'LCODE'   PRELOAD NONDISCARDABLE
    _TEXT       CLASS 'LCODE'   PRELOAD NONDISCARDABLE
    _DATA       CLASS 'LCODE'   PRELOAD NONDISCARDABLE
    CONST       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
    _STEXT      CLASS 'SCODE'   RESIDENT
    _SDATA      CLASS 'SCODE'   RESIDENT
;    _DBOSTART   CLASS 'DBOCODE' PRELOAD NONDISCARDABLE CONFORMING
;    _DBOCODE    CLASS 'DBOCODE' PRELOAD NONDISCARDABLE CONFORMING
;    _DBODATA    CLASS 'DBOCODE' PRELOAD NONDISCARDABLE CONFORMING
    _16ICODE    CLASS '16ICODE' PRELOAD DISCARDABLE
    _RCODE      CLASS 'RCODE'
EXPORTS
    $(DDB_NAME) @1
<<
slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
9C#
发布于:2004-03-07 08:11
Re:[求助]谁有冲击波源文件
;ifsmgr.inc****************************************************************************
;                                                                           *
; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY     *
; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE       *
; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR     *
; PURPOSE.                                                                  *
;                                                                           *
; Copyright (C) 1993-95  Microsoft Corporation.  All Rights Reserved.       *
;                                                                           *
;****************************************************************************

;***    IFSMgr service definitions

ifndef  IFSMgr_Device_ID
  IFSMgr_Device_ID equ 00040h
else
  .errnz IFSMgr_Device_ID - 00040h
endif

Begin_Service_Table IFSMgr

IFSMgr_Service  IFSMgr_Get_Version
IFSMgr_Service  IFSMgr_RegisterMount
IFSMgr_Service  IFSMgr_RegisterNet
IFSMgr_Service  IFSMgr_RegisterMailSlot
IFSMgr_Service  IFSMgr_Attach
IFSMgr_Service  IFSMgr_Detach
IFSMgr_Service  IFSMgr_Get_NetTime
IFSMgr_Service  IFSMgr_Get_DOSTime
IFSMgr_Service  IFSMgr_SetupConnection
IFSMgr_Service  IFSMgr_DerefConnection
IFSMgr_Service  IFSMgr_ServerDOSCall
IFSMgr_Service  IFSMgr_CompleteAsync
IFSMgr_Service  IFSMgr_RegisterHeap
IFSMgr_Service  IFSMgr_GetHeap
IFSMgr_Service  IFSMgr_RetHeap
IFSMgr_Service  IFSMgr_CheckHeap
IFSMgr_Service  IFSMgr_CheckHeapItem
IFSMgr_Service  IFSMgr_FillHeapSpare
IFSMgr_Service  IFSMgr_Block
IFSMgr_Service  IFSMgr_Wakeup
IFSMgr_Service  IFSMgr_Yield
IFSMgr_Service  IFSMgr_SchedEvent
IFSMgr_Service  IFSMgr_QueueEvent
IFSMgr_Service  IFSMgr_KillEvent
IFSMgr_Service  IFSMgr_FreeIOReq
IFSMgr_Service  IFSMgr_MakeMailSlot
IFSMgr_Service  IFSMgr_DeleteMailSlot
IFSMgr_Service  IFSMgr_WriteMailSlot
IFSMgr_Service  IFSMgr_PopUp
IFSMgr_Service  IFSMgr_printf
IFSMgr_Service  IFSMgr_AssertFailed
IFSMgr_Service  IFSMgr_LogEntry
IFSMgr_Service  IFSMgr_DebugMenu
IFSMgr_Service  IFSMgr_DebugVars
IFSMgr_Service  IFSMgr_GetDebugString
IFSMgr_Service  IFSMgr_GetDebugHexNum
IFSMgr_Service  IFSMgr_NetFunction
IFSMgr_Service  IFSMgr_DoDelAllUses
IFSMgr_Service  IFSMgr_SetErrString
IFSMgr_Service  IFSMgr_GetErrString
IFSMgr_Service  IFSMgr_SetReqHook
IFSMgr_Service  IFSMgr_SetPathHook
IFSMgr_Service  IFSMgr_UseAdd
IFSMgr_Service  IFSMgr_UseDel
IFSMgr_Service  IFSMgr_InitUseAdd
IFSMgr_Service  IFSMgr_ChangeDir
IFSMgr_Service  IFSMgr_DelAllUses
IFSMgr_Service  IFSMgr_CDROM_Attach
IFSMgr_Service  IFSMgr_CDROM_Detach
IFSMgr_Service  IFSMgr_Win32DupHandle
IFSMgr_Service  IFSMgr_Ring0_FileIO
IFSMgr_Service  IFSMgr_Win32_Get_Ring0_Handle
IFSMgr_Service  IFSMgr_Get_Drive_Info
IFSMgr_Service  IFSMgr_Ring0GetDriveInfo
IFSMgr_Service  IFSMgr_BlockNoEvents
IFSMgr_Service  IFSMgr_NetToDosTime
IFSMgr_Service  IFSMgr_DosToNetTime
IFSMgr_Service  IFSMgr_DosToWin32Time
IFSMgr_Service  IFSMgr_Win32ToDosTime
IFSMgr_Service  IFSMgr_NetToWin32Time
IFSMgr_Service  IFSMgr_Win32ToNetTime
IFSMgr_Service  IFSMgr_MetaMatch
IFSMgr_Service  IFSMgr_TransMatch
IFSMgr_Service  IFSMgr_CallProvider
IFSMgr_Service  UniToBCS
IFSMgr_Service  UniToBCSPath
IFSMgr_Service  BCSToUni
IFSMgr_Service  UniToUpper
IFSMgr_Service  UniCharToOEM
IFSMgr_Service  CreateBasis
IFSMgr_Service  MatchBasisName
IFSMgr_Service  AppendBasisTail
IFSMgr_Service  FcbToShort
IFSMgr_Service  ShortToFcb
IFSMgr_Service  IFSMgr_ParsePath
IFSMgr_Service  Query_PhysLock
IFSMgr_Service  _VolFlush
IFSMgr_Service  NotifyVolumeArrival
IFSMgr_Service  NotifyVolumeRemoval
IFSMgr_Service  QueryVolumeRemoval
IFSMgr_Service  IFSMgr_FSDUnmountCFSD
IFSMgr_Service  IFSMgr_GetConversionTablePtrs
IFSMgr_Service  IFSMgr_CheckAccessConflict
IFSMgr_Service  IFSMgr_LockFile
IFSMgr_Service  IFSMgr_UnlockFile
IFSMgr_Service  IFSMgr_RemoveLocks
IFSMgr_Service  IFSMgr_CheckLocks
IFSMgr_Service  IFSMgr_CountLocks
IFSMgr_Service  IFSMgr_ReassignLockFileInst
IFSMgr_Service  IFSMgr_UnassignLockList
IFSMgr_Service  IFSMgr_MountChildVolume
IFSMgr_Service  IFSMgr_UnmountChildVolume
IFSMgr_Service  IFSMgr_SwapDrives
IFSMgr_Service  IFSMgr_FSDMapFHtoIOREQ
IFSMgr_Service  IFSMgr_FSDParsePath
IFSMgr_Service  IFSMgr_FSDAttachSFT
IFSMgr_Service  IFSMgr_GetTimeZoneBias
IFSMgr_Service  IFSMgr_PNPEvent
IFSMgr_Service  IFSMgr_RegisterCFSD
IFSMgr_Service  IFSMgr_Win32MapExtendedHandleToSFT
IFSMgr_Service  IFSMgr_DbgSetFileHandleLimit
IFSMgr_Service  IFSMgr_Win32MapSFTToExtendedHandle
IFSMgr_Service  IFSMgr_FSDGetCurrentDrive
IFSMgr_Service  IFSMgr_InstallFileSystemApiHook
IFSMgr_Service  IFSMgr_RemoveFileSystemApiHook
IFSMgr_Service  IFSMgr_RunScheduledEvents
IFSMgr_Service IFSMgr_CheckDelResource
IFSMgr_Service IFSMgr_Win32GetVMCurdir
IFSMgr_Service IFSMgr_SetupFailedConnection
IFSMgr_Service _GetMappedErr
IFSMgr_Service ShortToLossyFcb
IFSMgr_Service IFSMgr_GetLockState
IFSMgr_Service BcsToBcs
IFSMgr_Service IFSMgr_SetLoopback
IFSMgr_Service IFSMgr_ClearLoopback
IFSMgr_Service IFSMgr_ParseOneElement
IFSMgr_Service BcsToBcsUpper
End_Service_Table IFSMgr


;**     IFSMgr_Get_Version - Get version number
;
;       This service is always valid.
;
; Entry None
; Exit  EAX = version number (3.10 for this release)
;       'C' clear
; Uses  EAX, Flags


IFSMGRVERSION   equ     022h

;**     IFSMgr_RegisterMount - register a filesystem provider
;
;       A filesystem provider calls this service to register a mount
;       routine with the redirector.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS = Entrypoint for providers mount routine
;       TOS + 4 = Version of IFSMGR provider was built for
;       TOS + 8 = 1 if default FSD is requesting mount
;               = 0 if normal FSD is requesting mount
; Exit  EAX = Provider ID (-1 if error)
;       caller clears argument from stack
; Uses  C Registers


;**     MountFS - filesystem provider mount routine
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS = pointer to IOReq
;       ir_flags - 0 (indicates MOUNT)
;       ir_gi.g_ptr - flat address of BDD (from BlockDev)
;       ir_pos - first sector (physical sector # of logical sector 0)
;       ir_drv - drive to mount (0=A:, 1=B:, ...)
;
; Exit  EAX = 0 if success, non-zero if error
;       if success,
;               ir_pr = pointer to provider specific information
;               ir_gi = flat address of entry point table
;                       dword   number of entries in table
;                       dword   NetDelete
;                       dword   NetDir
;                       dword   NetFileAttributes
;                       dword   NetFileInfo
;                       dword   NetFlush
;                       dword   NetGetDiskInfo
;                       dword   NetOpen
;                       dword   NetRename
;                       dword   NetSearch
;                       dword   ShutDown
;
; Uses  C Registers  (EAX, ECX, EDX may be stomped)


;**     IFSMgr_RegisterNet - register a network provider
;
;       A filesystem provider calls this service to register a
;       connect routine with the redirector.
;
;       Versioning:
;       The FSD should first call IFSMgr_Get_Version.  If the
;       version returned by the IFS Manager is older than the
;       FSD is prepared to handle, the FSD should no come up.
;
;       The version number the FSD uses when calling IFSMgr_RegisterNet
;       should be IFSMGRVERSION for the newest version of the IFS Manager
;       that the FSD knows how to handle.  If the IFS Manager does not
;       support that version, it will return an error for this call.
;
; Entry TOS     = Entrypoint for providers connect routine
;       TOS + 4 = FSD version number
; Exit  EAX = Provider ID (-1 if error)
;       caller clears argument from stack
; Uses  C Registers


;l IFSMgr_Get_Version.  If the
;       version returned by the IFS Manager is older than the
;       FSD is prepared to handle, the FSD should no come up.
;
;       The version number the FSD uses when calling IFSMgr_RegisterNet
;       should be IFSMGRVERSION for the newest version of the IFS Manager
;       that the FSD knows how to handle.  If the IFS Manager does not
;       support that version, it will return an error for this call.
;
; Entry TOS     = Entrypoint for providers mailslot handling routine
;       TOS + 4 = FSD version number
; Exit  EAX = Provider ID (-1 if error)
;       caller clears argument from stack
; Uses  C Registers

;**     MailSlotFunction - Handle a mailslot request
;
; Entry TOS     - pointer to IOReq
;                 ir_flags = 0 - Mailslot just openned
;                   ir_options - number of mailslots now openned
;                 ir_flags = 1 - Mailslot closed
;                   ir_options - number of mailslots still openned
;                 ir_flags = 2 - Write remote 2nd class mailslot
;                   ir_ppath - Unicode string containing \MAILSLOT\<path>
;                   ir_ppath2 - 16 character remote server name
;                   ir_length - length of users buffer
;                   ir_options - priority of message
;                   ir_timeout - timeout

;**     Connect - network provider connect routine
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS = pointer to IOReq


;**     IFSMgr_Attach
;**     IFSMgr_Detach

;**     IFSMgr_InitUseAdd
;**     IFSMgr_UseAdd
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       The use_info_2 structure is of the form:
;
;       typedef struct _LM_GUID {
;               unsigned short  guid_uid;         /* LM10 style user id */
;               unsigned long   guid_serial;      /* user record serial number */
;               unsigned char   guid_rsvd[10];    /* pad out to 16 bytes for now */
;       } LM_GUID;
;
;       struct use_info_2 {
; -->           char            ui2_local[DEVLEN+1];
;               char            ui2_pad_1;
; -->           char FAR *      ui2_remote;
; -->           char FAR *      ui2_password;
;               unsigned short  ui2_status;
; -->           short           ui2_asg_type;
;               unsigned short  ui2_refcount;
;               unsigned short  ui2_usecount;
; -->           unsigned short  ui2_res_type;
;               uar FAR *       ui2_remote;
; -->           char FAR *      ui2_password;
;               unsigned short  ui2_status;
; -->           short           ui2_asg_type;
;               unsigned short  ui2_refcount;
;               unsigned short  ui2_usecount;
; -->           unsigned short  ui2_res_type;
;               unsigned short  ui2_flags;
;               unsigned short  ui2_usrclass;
;               void FAR *      ui2_dirname;
;               struct _LM_GUID ui2_dfs_id;
;       };      /* use_info_2 */
;
;       This is the netuse_info form:
;
;       netuse_info {
;               void            *nu_data;
;               int             nu_info;
;               unsigned long   nu_flags;
;               unsigned long   nu_rsvd;        
;       };      /* netuse_info */

;
; The fields marked with --> should be filled in. All other fields should
; be set to zero except ui2_res_type which should be set to USE_RES_UNC
;
; For IFSMgr_InitUseAdd (connection will be set up disconnected)
; Entry TOS     = pointer to use_info_2 structure (pointers must be flat)
;       TOS + 4 = Provider ID (may be -1 for all providers)
; Exit  EAX     = error code (0 for success)
;
;       The FSD may call this api with a NULL ptr for the IOReq, in this
;       case a ptr to a filled in netuse_info struct must be passed as
;       the third parameter.
;
; For IFSMgr_UseAdd
; Entry TOS     = pointer to IOReq
;           ir_data = pointer to use_info_2 structure (pointers must be flat)
;           ir_flags = 1 if connection should be set up disconnected, 0 otherwise
;       TOS + 4 = Provider ID (may be -1 for all providers)
;       TOS + 8 = ptr to netuse_info struct if ptr to IOReq is null otherwise pass null.
; Exit  ir_error set properly (0 for success)
;

;**     IFSMgr_UseDel
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       The FSD may call this api with a NULL ptr for the IOReq, in this
;       case a ptr to a filled in netuse_info struct must be passed as
;       the third parameter.
;
; Entry TOS     = pointer to IOReq
;           ir_data = pointer to name (A:, B:, ..., LPT1, ..., \\server\share, ...)
;           ir_flags =force level (0-3)
;       TOS + 4 = Provider ID (may be -1 for all providers)
;       TOS + 8 = ptr to netuse_info struct if ptr to IOReq is null otherwise pass null.
; Exit  ir_error = error code (0 for success)


;**     IFSMgr_Get_NetTime - Get current time in net format
;
;       This service is not valid until IFSMgr performs VNSInitComplete.
;
; Entry None
; Exit  EAX = nunber of seconds since 1/1/70
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_Get_DOSTime - Get current time in DOS format
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       Returns date/time in DOS format.
;       dos format:
;               ___________________________
;               | hours | minutes | seconds|
;               | 5 bit |  6 bits | 5 bits+|
;               |__________________________|
;               ___________________________
;               | years*|  months |  days  |
;               | 7 bit |  4 bits | 5 bits |
;               |__________________________|
;
;       (*) years from 1980
;       (+) 2 seconds units
;
; Entry none
; Exit  eax = high word is date word in dos format
;             low word is time word in dos format
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_SetupConnection
;**     IFSMgr_DerefConnection

;**     IFSMgr_ServerDOSCall
;
;       This routine checks to see if a server DOS call is being directed
;       to a drive/handle which is being managed by the redir.  Due to the
;       variety of DOS calls that can be routed through this interface, the
;       client register state is saved and the the DPL info is loaded into
;       the client register structure and the call is routed through the
;       preamble for the requested function.  If the call is not to be
;       intercepted, then the client register state is restored and the
;       call is passed on.  If the call is intercepted, the saved client
;       state is discarded and the call is processed through the normal
;       code paths.
;
;       Entry   ebx = handle of current VM
;               ecx = function number
;               esi = pointer to DPL32 structure
;               ebp = pointer to client registers
;       Exit    'C' clear if request taken
;               'C' set if not.
;       Uses    eax, ebx, ecx, edx, edi, esi, flags


;*      DPL - DOS Parameter List
;
;       Parameter list structure for the "Server DOS Call".

DPL32   STRUC
DPL32_EAX       DD      ?       ; EAX register
DPL32_EBX       DD      ?       ; EBX register
DPL32_ECX       DD      ?       ; ECX register
DPL32_EDX       DD      ?       ; EDX register
DPL32_ESI       DD      ?       ; ESI register
DPL32_EDI       DD      ?       ; EDI register
DPL32_EBP       DD      ?       ; EBP register
DPL32_UID       DW      ?       ; User (Machine) ID (0 = local macine)
DPL32_PID       DW      ?       ; Process ID (0 = local user PID)
DPL32_DTA       DD      ?       ; Flat pointer to DTA (instead of CurDTA)
DPL32_FLAGS     DB      ?       ; Control flags
DPL32_PAD       DB 3 DUP (?)    ; pad to dword boundry
DPL32   ENDS

DPL32W  STRUC
DPL32_AX        DW      ?       ; AX register
                DW      ?
DPL32_BX        DW      ?       ; BX register
                DW      ?
DPL32_CX        DW      ?       ; CX register
                DW      ?
DPL32_DX        DW      ?       ; DX register
                DW      ?
DPL32_SI        DW      ?       ; SI register
                DW      ?
DPL32_DI        DW      ?       ; DI register
                DW      ?
DPL32_BP        DW      ?       ; BP register
                DW      ?
DPL32_PID32     DD      ?       ; 32-bit process ID
DPL32W  ENDS

DPL32B  STRUC
DPL32_AL        DB      ?       ; AL register
DPL32_AH        DB      ?       ; AH register
                DW      ?
DPL32_BL        DB      ?       ; BL register
DPL32_BH        DB      ?       ; BH register
                DW      ?
DPL32_CL        DB      ?       ; CL register
DPL32_CH        DB      ?       ; CH register
                DW      ?
DPL32_DL        DB      ?       ; DL register
DPL32_DH        DB      ?       ; DH register
DPL32B  ENDS

;low 2 bits of DPL32_FLAGS specify character set as follows:

DPL32_USE_ANSI equ 0
DPL32_USE_OEM equ 1
DPL32_USE_UNICODE       equ     2

DPL32_8_3_MATCHING      equ     4

;**     IFSMgr_CompleteAsync

;**     IFSMgr_RegisterHeap - Register as a user of the net heap
;
;       This service is not valid until IFSMgr performs SysCriticalInit.
;
;       This call allows a user of the net heap to register a
;       scavenger routine for use by the heap manager.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS     - address of scavenger routine (0 if none)
;       TOS+4   - debug flag.  (0 if VNetSup_RetHeap called to free heap)
; Exit  None
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_GetHeap - Allocate a chunk of the net heap
;
;       This service is not valid until IFSMgr performs SysCriticalInit.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS - Size required
; Exit  EAX - address of heap chunk.  0 if failure
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_RetHeap - Free a chunk of net heap
;
;       This service is not valid until IFSMgr performs SysCriticalInit.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS - address of heap chunk
; Exit  None
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_CheckHeap - check heap consistancy
;
;       This service is not valid until IFSMgr performs SysCriticalInit.
;
;       This routine uses the C6 386 _cdecl calling convention
;
;       NOTE:   On a non-debug build this routine will return 0 without
;               doing anything.
;
; Entry TOS   - DWORD pointer to heap item (0 for none)
;       TOS+4 - DWORD pointer to ASCIIZ filename
;       TOS+8 - DWORD line number
; Exit  0 if no error found, non-zero if problem hit.
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_CheckHeapItem - check heap item consistancy
;
;       This service is not valid until IFSMgr performs SysCriticalInit.
;
;       This routine uses the C6 386 _cdecl calling convention
;
;       NOTE:   On a non-debug build this routine will return 0 without
;               doing anything.
;
;       NOTE:   This call is not valid on freed heap items if
;               VNetSup_RetHeap is not used to free the heap item.
;
; Entry TOS   - DWORD pointer to heap item
;       TOS+4 - DWORD pointer to ASCIIZ filename
;       TOS+8 - DWORD line number
;       TOS+12- DWORD   0 if item is expected to be free
;                       1 if item is expected to be busy
;                       2 if don't know
; Exit  0 if no error found, non-zero if problem hit.
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_FillHeapSpare
;**     IFSMgr_Block
;**     IFSMgr_Wakeup
;**     IFSMgr_Yield
;**     IFSMgr_SchedEvent
;**     IFSMgr_QueueEvent
;**     IFSMgr_KillEvent
;**     IFSMgr_FreeIOReq

;**     IFSMgr_MakeMailSlot - Make a MailSlot
;
;       A VxD calls this service to make a MailSlot.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       The read procedure is declared as follows:
;               int _cdecl ReadProc(void *pdata, uint len, uchar lana);
;
; Entry TOS   = Procedure to be called for mailslot reads
;       TOS+4 = pointer ASCIIZ mailslot name (without the "\MAILSLOT\")
;       TOS+8 = pointer to INT to receive the mailslot handle
; Exit  EAX = error code, 0 for success
;       caller clears argument from stack
; Uses  C Registers


;**     IFSMgr_DeleteMailSlot - Delete a MailSlot
;
;       A VxD calls this service to delete a MailSlot.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS   = mailslot handle received from IFSMgr_MakeMailSlot
; Exit  EAX = error code, 0 for success
;       caller clears argument from stack
; Uses  C Registers

;**     IFSMgr_WriteMailslot
;
;       A VxD calls this service to delete a MailSlot.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS     = pointer to ASCIIZ name (without the "\MAILSLOT\"
;       TOS+4   = pointer to data
;       TOS+8   = length of data
;       TOS+12  = network number
;       TOS+16  = pointer to remote name data was received from (or 0 if local)
;                 immediately followed by local name.  both names are 16 bytes long
;       TOS+17  = pointer to transport dependant info
; Exit  none
; Uses  C Registers

;**     IFSMgr_PopUp
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       This service is called to put up a popup.
;
; Entry TOS     - VMHandle
;       TOS+4   - Message Box Flags (MB_SystemModal will be set by VNetSup)
;       TOS+8   - Message number
;       TOS+12  - Device ID
; Exit  EAX     - return from SHELL_SYSMODAL_Message
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_printf - printf to the debug console
;
;       This service is not valid until IFSMgr performs DeviceInit.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       NOTE:   On a non-debug build this routine will return without
;               doing anything.
;
; Entry TOS   - DWORD pointer to ASCIIZ format string
;       TOS+n - parameters as required
; Exit  None
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_AssertFailed - Print an AssertFailed message
;
;       This service is not valid until IFSMgr performs DeviceInit.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       NOTE:   On a non-debug build this routine will return without
;               doing anything.
;
; Entry TOS   - DWORD pointer to ASCIIZ message
;       TOS+4 - DWORD pointer to ASCIIZ filename
;       TOS+8 - DWORD line number
; Exit  None
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_LogEntry - Make a log entry in the net trace log
;
;       This service is not valid until IFSMgr performs SysCriticalInit.
;
;       This procedure uses the C6 _cdecl calling sequence
;
;       NOTE:   On a non-debug build this routine will return without
;               doing anything.
;
; Entry TOS    - DWORD Pointer to string of 4 chars to put in log
;       TOS+4  - DWORD Info1 (first dword stored in log)
;       TOS+8  - DWORD Info2 (second dword stored in log)
;       TOS+12 - DWORD Stack Depth for return address (number of procedures)
;       TOS+16 - DWORD Mask (only low word is significant)
; Exit  None
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_DebugMenu - print a menu and return addr of handler routine
;
;       This service is not valid until IFSMgr performs SysCriticalInit.
;
;       This routine uses the C6 386 _cdecl calling convention
;
;       NOTE:   On a non-debug build this routine will return 0 without
;               doing anything.
;
;       For 'C' declarations, include vnsmenu.h
;
; Entry TOS   - DWORD pointer to menu table with last item set to 0.
; Exit  EAX   - address of debug routine to call (0 if exit requested)
; Uses  C registers  (eax, ecx, edx, flags)

;**     DebugRoutine - handle a debug display request
;
;       This routine uses the C6 386 _cdecl calling convention
;
;       For 'C' declarations, include vnsmenu.h
;
; Entry TOS   - DWORD pointer to remainder of command line (or 0)
; Exit  EAX   - 0 if debug should continue, non-zero for immediate exit
;               to debugger.
; Uses  C registers  (eax, ecx, edx, flags)

IFSDbgMenu      struc
        IFSM_string     dd ?    ; menu string
        IFSMM_pmh       dd ?    ; address of handler routine
IFSDbgMenu ends


;**     IFSMgr_DebugVars
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       This service is called to get the address of IFSMgr debug vars
;
; Entry none
; Exit  EAX     - 0 if non debug build
;                 pointer to VNSDebugVars if debug
; Uses  C registers  (eax, ecx, edx, flags)

;**     IFSMgr_GetDebugString
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       NOTE:   On a non-debug build this routine will return without
;               doing anything.
;
; Entry TOS     - pointer to prompt string (without CR/LF)
;       TOS+4   - pointer to buffer
;       TOS+8   - length of buffer
; Exit  EAX     - exit code: 0 if ESC hit
;                            1 if string put in buffer
; Uses  C registers  (eax, ecx, edx, flags)

;**     IFSMgr_GetDebugHexNum
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       NOTE:   On a non-debug build this routine will return without
;               doing anything.
;
; Entry TOS     - pointer to prompt string (without CR/LF)
;               - pointer to dword to receive hex value
; Exit  EAX     - exit code: 0 if ESC hit
;                            1 if string put in buffer
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_NetFunction
;
;       This routine is used by the ifsmgr to export int21 func 5f calls
;       and int2f function 11 calls that are not supported directly by the
;       ifsmgr.  To handle these calls, an FSD should hook this service
;       and process the requests.  If the FSD doesn't understand a request
;       it should pass the call on to the original address.
;       A FSD gets a hook ID by calling IFSMgr_GetReqHookID.  A custom preamble
;       (set by calling IFSMgr_SetReqHook) puts the hook ID in ESI.  This hook
;       ID is then passed to NetFunction.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS     - ptr to ioreq structure
;       TOS + 4 - ptr to user register structure
;       TOS + 8 - hook ID (0 for all FSDs)
; Exit  none
;
; Uses  C registers  (eax, ecx, edx, flags)

;**     IFSMgr_DoDelAllUses
;
;       This service is called by a net FSD to remove all redirections to
;       drives managed by that FSD.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS     - ptr to ioreq structure
; Exit  none
;
; Uses  C registers  (eax, ecx, edx, flags)

;**     IFSMgr_SetErrString
;
;       This routine accepts error strings from VxDs and stores
;       them for use when handling Int2F function 5 (GetErrorText).
;       It also handle strings for use with IFSMgr_Popup
;
;       NOTE:   The memory containing the error message must be left
;               in memory.  The IFS Manager keeps pointers to the
;               strings rather than copying them.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS     - ptr to ASCIIZ error message
;       TOS + 4 - Error code (only the low word used)
;       TOS + 8 - table indicator, 0 = error code table, 1 = device name table
; Exit  EAX     - error code
;                       NOTICE: ERROR_ACCESS_DENIED means the error code
;                               is already in the table)


;**     IFSMgr_GetErrString
;
;       Given an error code, this routine will return a pointer to
;       an error message if it is in the table.
;
; Entry TOS     - Error code (only the low word used)
;       TOS + 4 - table indicator, 0 = error code table, 1 = device name table
; Exit  EAX     - pointer to error message (0 if not available)


;**     IFSMgr_SetReqHook - Set a custom preamble on the IFSManager Int21 Hook
;
;       FSDs that need to handle Int21 Functions not normally handled by
;       the IFSManager can use IFSMgr_SetReqHook to hook those functions.
;       The FSD supplies a function number and the address of a preamble
;       routine.  When the IFSManager detects an Int21 with the given function
;       number, it will route it to the preamble to see if the request should
;       be hooked.
;
;       This service returns the address of the old preamble.  If the preamble
;       does not hook the request, it must jump the old preamble.
;
;       The entry/exit conditions for preambles are:
;       Entry   EBX     - Handle of VM
;               ECX     - Function (value of users AH)
;               EBP     - Client register structure
;               ESI     - 0
;       Exit if request is to be hooked
;               Carry Clear
;               EBX     - Handle of VM
;               EBP     - Client register structure
;               ESI     - 0 or FSD ID
;       Exit if request is not to be hooked
;               jump to the old preamble with the entry conditions preserved
;       Only EBX and EBP need to be preserved, ESI must be set properly
;
; Entry TOS     - High word = Interrupt level (must be 21h)
;                 Low word = Function number (value to look for in AH)
;       TOS + 4 - Entry point of preamble
; Exit  EAX     - 0 if error
;                 Previous preamble routine (preambles must chain) if success

;**     IFSMgr_SetPathHook - Set a hook to identify custom path prefixs
;
;       FSDs that look for special path prefixs to locate remote resources
;       can use IFSMgr_SetPathHook to give IFSMgr the entrypoint of a routine
;       that can identify a special path prefix.
;
;       The entry/exit conditions for the path checker are:
;       Entry   ESI     - ASCIIZ path   (NOTE: ESI must be preserved)
;       Exit    Path recognized - return with:
;                       'C' clear - Path recognized
;                       EAX - length of portion of path that is specific to FSD
;                       EDX - Provider ID of FSD claiming path
;                       'Z' - Set if device check should be skipped in preamble
;                             Clear if device check should be performed in preamble
;               Path not recognized - pass request it on next path checker.
;       Uses    EAX, EBC, ECX, EDX, EDI
;
; Entry TOS     - Entry point of path checker
; Exit  EAX     - 0 if error
;                 Previous path checker (path checkers must chain) if success


;**     IFSMgr_ChangeDir - Change Directory
;
;       FSDs that need to cause a change the current path on a given drive
;
;       Entry   TOS - Pointer to IOReq
;                       ir_data - pointer to ASCIIZ path string
;                       ir_drv - set to default drive (needed if path string
;                                does not contain drive letter)
;               TOS+4 - VM to change directory for.  0 for current VM.
;       Exit    ir_error set appropriately


;**     IFSMgr_CDROM_Attach - Special service for CDFS to force a mount on a
;       drive that is passed in. The VRP for the volume that is mounted on
;       the drive is returned to the caller of the service. The caller can
;       use this VRP to pass i/o requests down to the IO subsystem. The CDFS
;       needs to handle direct ioctls from DOS applications on driveletters
;       for which it has no volume parameters at all. If a volume is already
;       mounted on the drive, the IFS manager returns the VRP for that volume
;       without forcing a mount. Each call to attach increments the drive
;       useage count.
;
;       NOTE: This service works only under Chicago. It just returns success
;       under Snowball.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       The entry/exit conditions for this service are:
; Entry TOS     - Driveletter (0-based)
;       TOS + 4 - Pointer to dword to contain the VRP pointer
;
; Exit  EAX     - 0 if success. VRP pointer updated in variable.
;               - Errorcode if failure.
;
; Uses  C registers  (eax, ecx, edx, flags)


;**     IFSMgr_CDROM_Detach - Special service provided to the CDFS to indicate
;       that it does not need to use the drive anymore. The drive useage count
;       is decremented for every detach operation. If the drive useage count
;       goes down to zero, the volume resource associated with the drive is
;       automatically freed.
;
;       NOTE: This service works only under Chicago.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       The entry/exit conditions for this service are:
; Entry TOS     - Driveletter (0-based)
;       TOS + 4 - VRP pointer of drive returned on IFSMgr_CDROM_Attach
;
; Exit  None
;
; Uses  C registers  (eax, ecx, edx, flags)

;**     IFSMgr_Win32DupHandle - This service is provided for the Win32 VxD
;       to do an inter-process dup. This service works for both extended
;       handles and normal DOS handles.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; int Win32DupHandle(pid_t srcpid, pid_t duppid, ulong *phandle,
; uchar flag,ulong *fReturnFlags )
;
; Entry TOS     = process id of process issuing dup (must be current process)
;       TOS+4   = process id of process handle is to be dup'ed into
;       TOS+8   = ptr handle to be dup'ed (returns dup'ed handle)
;       TOS+12  = flag to indicate kind of dup - normal or for memory-mapping
; TOS+16 = global Netware handle if running on real-mode NETX
; TOS+20 = ptr to variable to contain return flags (defined below)
;
; Exit  EAX     = 0 if success
; TOS+8 contains new handle
; TOS+16 contains return flags
;               = errorcode if failure
;
; Uses  C registers  (eax, ecx, edx, flags)

; Return flag values for Win32DupHandle

WDUP_RMM_DRIVE equ 0001h ; file handle mapped to RMM drive
WDUP_NETWARE_HANDLE equ 0002h ; file handle belongs to Netware


;**     IFSMgr_Get_Drive_Info - this service returns information about a
;       given volume.
;
; Entry
;       al      = volume (A=0)
;
; Exit
;   (carry clear)
;       eax     = flags
;               FDRV_INT13      ; volume lives on an int13 drive
;               FDRV_FASTDISK   ; volume is on a drive for which a
;                               ; fastdisk driver is present
;               FDRV_COMP       ; compression driver detected on this volume
;               FDRV_RMM        ; volume can be accessed through RMM
;               FDRV_USE_RMM    ; volume must be accessed through RMM
;               FDRV_DOS        ; DBP exists for this volume... DOS
;                               ; knows about it
;               FDRV_COMPHOST   ; host volume for compression driver (dblspace)
;               FDRV_N

;**     Query_PhysLock - service to determined if current process has the
;                        int13 physical lock.
;
; Entry
;       eax     = int 13 unit number (0-7) or (80h-87h)
;
; Exit
;       NC if the current process has the int 13 lock
;       CY if the current process does not have the int 13 lock
;
; Uses ALL except ebx, edi
;

;**     _VolFlush - volume based flush/invalidate
;
; Entry TOS     = logical unit number to flush/invalidate
;       TOS+4   = flags
;                 0                     ; just flush the cache
;                 VOL_DISCARD_CACHE     ; flush and invalidate the cache
;                 VOL_REMOUNT           ; flush and invalidate the cache
; ; & remount the vol (recompute
; ; the FAT "geometry" variables)
;
; Exit  (eax) = non-zero if error on flush/invalidate
;
; Uses  C registers  (eax, ecx, edx, flags)
;

;**     NotifyVolumeArrival - called when a new volume appears in the system.
;       Updates the CDSs in all the VMs and updates IFSMGR data structs to
;       indicate this is a new supported volume
;
; Entry TOS = logical unit number for new volume
;
; Exit  None
;
; Uses  eax, ecx, edx, flags
;

;**     NotifyVolumeRemoval - called when a new volume is removed.
;       Updates the CDSs in all the VMs and updates IFSMGR data structs to
;       indicate this is no longer a supported volume
;
; Entry TOS = logical unit number for new volume
;
; Exit  None
;
; Uses  eax, ecx, edx, flags
;

;**     QueryVolumeRemoval - called when a new volume is to be removed.
;       Checks if there are any open files on he volume. If yes closes them
;       after querying the user. Then unmounts the FSD.
;
; Entry TOS = logical unit number for new volume
;
; Exit  (eax) = 0 if successfull non-zero otherwise
;
; Uses  eax, ecx, edx, flags
;

;**     IFSMgr_FSDUnmountCFSD - called by a CFSD to unmount its resource. The
;       CFSD passes in the volume handle previously passed to it on its mount
;       and is called back to do the actual unmount operation.
;
; Entry TOS = IFS manager volume handle
;
; Exit  (eax) = 0 if successfull non-zero otherwise
;
; Uses  C registers (eax, ecx, edx, flags)


;**     IFSMgr_GetConversionTablePtrs - called to obtain a ptr to a table
;       of conversion tables ptrs within the IFSmgr.  The ptrs reference
;       AVL-tree-based run-length encoded structs for converting
;               UNICODE->ANSI
;               UNICODE->OEM
;               ANSI->UNICODE
;               OEM->UNICODE
;               UNICODE->UPPER (delta table)
;               UNICODE->UPPER (conversion table)
;       These tables are referenced by the routines MapUniToBCS and
;       MapBCSToUni UniToUpper implemented in unicode.asm.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry nothing
;
; Exit  ptr to following structure
;               dword   count of ptrs in following table
;               dword   flat-ptr to UniToWinAnsiTable (ring-0 data)
;               dword   flat-ptr to UniToOemTable (ring-0 data)
;               dword   flat-ptr WinAnsiToUniTable (ring-0 data)
;               dword   flat-ptr to OemToUniTable (ring-0 data)
;               dword   flat-ptr to UniToUpperDelta (ring-0 data)
;               dword   flat-ptr to UniToUpperTable (ring-0 data)
; Uses  eax
;


;;* See Ifs.h for function prototypes for:
;
;       IFSMgr_NetToDosTime
;       IFSMgr_DosToNetTime
;       IFSMgr_DosToWin32Time
;       IFSMgr_Win32ToDosTime
;       IFSMgr_NetToWin32Time
;       IFSMgr_Win32ToNetTime
;       IFSMgr_MetaMatch
;       IFSMgr_TransMatch
;       UniToBCS
;       UniToBCSPath
;       BCSToUni
;       UniToUpper


;**     IFSMgr_CheckAccessConflict - check if desired access can be granted
;
;       This function validates the desired access mode and
;       determines if the desired access to the file can be
;       granted.
;
;       int IFSMgr_CheckAccessConflict (fSoftCompatDisable, pf, pfn, cookie)
;
;       PARAMETERS
;               softCompatDisable
;                       - IN boolean which defeats "soft" share
;                         semantics if they are enabled.  The "soft"
;                         share semantics are in effect IFF the
;                         fSoftCompat flag is TRUE.
;                         Non-zero specifies "hard" share rules.
;               pf      - IN pointer to file mode descriptor
;                         specifying desired access
;               pfn     - IN pointer to enumeration function
;               cookie  - IN cookie for enumeration function
;       RETURN
;               0       - desired mode is compatable
;               (other) - error code


;**     IFSMgr_LockFile - lock a range of bytes in a file
;
;       This function is called to lock a range of bytes in
;       a file.  Locks may not overlap; a lock may not be of
;       of zero length.
;
;       int IFSMgr_LockFile (pp, offmin, cb, owner, fileinst)
;
;       PARAMETERS
;               pp                      - IN pointer to file cookie
;               offmin          - IN starting file offset of the lock
;               cb                      - IN length of the locked region
;               owner           - IN owner of the lock
;               fileinst        - IN open instance to which lock belongs
;               pp                      - OUT file cookie filled in
;       RETURN
;               0                       - Success
;               (other)         - error code


;**     IFSMgr_UnlockFile - unlock a range of bytes in a file
;
;       This function is called to unlock a range of bytes in
;       a file.  Locks may not overlap; a lock may not be of
;       of zero length; a lock may not extend beyond the
;       maximum file size; an unlock must match a lock exactly.
;
;       int IFSMgr_UnlockFile (pp, offmin, cb, owner, fileinst)
;
;       PARAMETERS
;               pp                      - IN pointer to file cookie
;               offmin          - IN starting file offset of the lock
;               cb                      - IN length of the locked region
;               owner           - IN owner of the lock
;               fileinst        - IN open file instance
;               pp                      - OUT file cookie possibly set to NULL
;       RETURN
;               0                       - Success
;               (other)         - error code


;**     IFSMgr_RemoveLocks - remove all locks for a given owner
;
;       This function is called to remove all locks from a file
;       for a specified owner.
;
;       If the special owner id 0 is passed in, then all locks on
;       the file are removed.
;
;       If the file instance is NULL, then locks are removed for
;       all instances.  So, to remove all locks, pass in owner 0
;       and file instance NULL.
;      
;       void IFSMgr_RemoveLocks (pp, owner, fileinst)
;
;       PARAMETERS
;               pp                      - IN pointer to file cookie
;               owner           - IN owner of the lock
;               fileinst        - IN open file instance
;               pp                      - OUT file cookie possibly set to NULL
;       RETURN
;               NONE


;**     IFSMgr_CheckLocks - check if an i/o operation violates a lock
;
;       This function is called to check if i/o over a
;       specified range would violate any locks on the file.
;       A range length of zero is interpreted to mean the
;       file is going to be truncated at the given offset;
;       any locks at or above the given offset will result in a
;       lock violation.
;
;       int IFSMgr_CheckLocks (p, offmin, cb, owner, fileinst)
;
;       PARAMETERS
;               p                       - file cookie
;               offmin          - starting file offset of the lock
;               cb                      - length of the locked region
;               owner           - owner of the lock
;               fileinst        - open file instance
;       RETURN
;               0                       - Success
;               (other)         - error code


;**     IFSMgr_CountLocks - count locks for a given file instance
;
;       This function is called to count all locks on a file
;       for a specified instance.
;
;       int IFSMgr_CountLocks (p, fileinst)
;
;       PARAMETERS
;               p                       - IN file cookie
;               fileinst        - IN open file instance
;       RETURN
;               int                     - count of locks for instance


;**     IFSMgr_ReassignLockInst - reassign file instances for existing lock list
;
;       This function is called to replace existing 'file instance' fields
;       in the lock list with a new 'file instance'.  This is done upon exit
;       from a level 4 exclusive lock when the IFS manager re-opens existing
;       files.  Typically, the FSD (at least VFAT) will create a new 'file
;       instance' (i.e. SFT) upon opening a file.  The IFS has saved the
;       'file instance' that was previously associated with the file and
;       passes it to the FSD when the open is done.  The FSD, after
;       obtaining the new file instance value, calls this service to
;       replace old file instances in the lock list with the new file
;       instance.  The owner of the lock must be marked as 'inactive' before
;       this substitution will occur.  After the substitution is made, the
;       'inactive' mark is removed from the owner.  This prevents erroneous
;       substitution is cases where the old file instance may happen to match
;       a new file instance that was previously substituted into the lock list.
;
;       int IFSMgr_ReassignLockFileInst (plkList, oldFileInst, newFileInst)
;
;       PARAMETERS
;               plkList         - IN pointer to lock list
;               oldFileInst     - IN previous open file instance
;               newFileInst     - IN new open file instance
;       RETURN
;               0                       - Success


;**     IFSMgr_UnassignLockList - mark all owners in this list 'inactive'
;
;       int IFSMgr_UnassignLockFileInst (plkList)
;
;       PARAMETERS
;               plkList         - IN pointer to lock list
;       RETURN
;               0                       - Success


;**     IFSMgr_MountChildVolume - mount a child volume
;
;       A child volume is a volume that is physically related to
;       some other volume, known as the parent.  For example, some
;       on-the-fly data compression schemes represent the compressed
;       volume as a file on an uncompressed volume.  In this example,
;       the uncompressed volume is the parent, and the compressed
;       volume is the child.
;
;       int IFSMgr_MountChildVolume (pvrp, driveno)
;
;       PARAMETERS
;               pvrp            - IN child volume VRP pointer
;               driveno         - IN child volume drive number (0 = A:, ...)
;       RETURN
;               0                       - Success
;               (other)         - error code


;**     IFSMgr_UnmountChildVolume - unmount a child volume
;
;       This service is provided to allow the unmounting of a child
;       volume on a specified drive.
;
;       We unmount the specified volume on the specified drive and
;       destroy the resource.  Why do we go to all this trouble?
;       For removable child volumes which are mounted automatically,
;       it is important to make the set of related volumes (i.e.,
;       the parent and its children) behave as a unit so that the
;       physical media volume tracks properly.  Thus, under normal
;       circumstances, the notification that a volume is going away
;       causes all of its relations to disappear as well.  This is
;       exactly what we *don't* want to happen in the case where
;       the user wishes to destroy one volume in a set.  By killing
;       the target here, before the volume removal notication is
;       received, we insure that there will be no way for the
;       volume removal to affect the other related volumes.  Sounds
;       complicated?  You bet it is!
;
;       int IFSMgr_UnmountChildVolume (pvrp, driveno)
;
;       PARAMETERS
;               pvrp            - IN child volume VRP pointer
;               driveno         - IN child volume drive number (0 = A:, ...)
;       RETURN
;               0                       - Success
;               (other)         - error code


;**     IFSMgr_SwapDrives - swap a parent and child drive
;
;       This service is provided to allow the drive letter
;       of a child volume and its parent to be swapped.
;
;       int IFSMgr_SwapDrives (pvrp, drive1, drive2)
;
;       PARAMETERS
;               pvrp            - IN VRP pointer
;               drive1          - IN first drive number (0 = A:, ...)
;               drive2          - IN second drive number (0 = A:, ...)
;       RETURN
;               0                       - Success
;               (other)         - error code


;**     IFSMgr_PNPEvent - report PNP events
;
;       int IFSMgr_PNPEvent( dword msg, dword res, dword flags )
;
;       PARAMETERS
;               msg             - IN one of:
;                                       DBT_DEVICEARRIVAL
;                                       DBT_DEVICEQUERYREMOVE
;                                       DBT_DEVICEQUERYREMOVEFAILED
;                                       DBT_DEVICEREMOVEPENDING
;                                       DBT_DEVICEREMOVECOMPLETE
;                                       DBT_DEVICETYPESPECIFIC
;                                       DBT_DEVICEDEVNODESCHANGED
;
;               volid           - IN Volume ID (A=0) r resource handle
;               flags           - IN
;                                   one of PNPT_x to specify type:
;                                       PNPT_VOLUME
;                                       PNPT_NET
;                                   'or'd with 0 or more:
;                                       (if PNPT_VOLUME)
;                                       DBTF_MEDIA
;                                       DBTF_NET
;                                       (if PNPT_NET)
;                                       DBTF_RESOURCE
;                                       DBTF_XPORT
;                                      
;       RETURN
;               one of PNPE_x

;**     IFSMgr_RegisterCFSD - register a mountable filesystem provider
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; Entry TOS     = Entrypoint for providers mount routine
;       TOS + 4 = Version of IFSMGR provider was built for
;       TOS + 8 = pointer to device name strings( in unicode) registered
;
; Exit  Provider ID (-1 if error)
;
; Uses  C Registers

;**     IFSMgr_Win32MapExtendedHandleToSFT - map an extended handle to a SFT
;
;       This service allocates a free SFT and maps an extended handle to this
;       SFT. It returns the index to the SFT back to the caller. This api is
;       for the purpose of redirection for Win32 apps when they spawn DOS apps.
;       The SFT and the extended handle track one another from this point on.
;       This service MUST be called in the context of the DOS VM the SFT is
;       going to be in.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       int IFSMgr_Win32MapExtendedHandleToSFT( ulong ExtHandle, ushort *psfn );
;
; Entry TOS     = Extended handle to be mapped
;       TOS + 4 = PSP extended handle is on
;       TOS + 8 = Pointer to variable to contain the SFN
;
; Exit  EAX = 0 if no error, *psfn contains the SFN
;       EAX = non-zero errorcode if error
;
; Uses  C Registers

;**     IFSMgr_DbgSetFileHandleLimit - set limit for extended handles.
;
;       This procedure sets the maximum number of extended handles available
;       in the system. The limit is rounded up to the nearest multiple of 256.
;       This is a debug-only service and is provided mainly for testing
;       purposes to exhaust the available handles quicker. On a retail build,
;       it returns without doing anything.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       int IFSMgr_DbgSetFileHandleLimit( unsigned long MaxHandles );
;
; Entry TOS     = Handle limit to be set
;
; Exit  EAX = -1 if the limit passed in was invalid
;           = 0 if the limit was successfully set
;
; Uses  C Registers

;**     IFSMgr_Win32MapSFTToExtendedHandle - map a SFT to an extended handle
;
;       This service maps an already existing SFT handle to an extended
;       handle. This service will work only for SFT handles that are on
;       drives supported by the IFS manager.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       int IFSMgr_Win32MapSFTToExtendedHandle( ushort DOSHandle, ulong *pExtHandle );
;
; Entry TOS     = DOS handle to be mapped
;       TOS + 4 = Pointer to variable to contain the extended handle
;
; Exit  EAX = 0 if no error, *pExtHandle contains the extended handle
;       EAX = non-zero errorcode if error
;
; Uses  C Registers

;**     IFSMgr_InstallFileSystemApiHook - install a filesystem api hook
;
;       This service installs a filesystem api hook for the caller. This
;       hook is between the IFS manager and a FSD. So, the hooker gets to see
;       any calls that the IFS manager makes to FSDs.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       ppIFSFileHookFunc IFSMgr_InstallFileSystemApiHook( pIFSFileHookFunc HookFunc )
;
; Entry TOS     = Address of function that is to be installed as the hook
;
; Exit  EAX = Pointer to variable containing the address of the previous
;               hooker in this chain.
;
; Uses  C registers

;**     IFSMgr_RemoveFileSystemApiHook - remove previously installed api hook
;
;       This service removes a previously installed filesystem api hook. The
;       hook can be removed dynamically at any time even if there have been
;       other hookers installed on top of this hook.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
;       int IFSMgr_RemoveFileSystemApiHook( pIFSFileHookFunc HookFunc )
;
; Entry TOS     = Address of function that is to be installed as the hook
;
; Exit  EAX = 0 if success, non-zero for failure (invalid hook function)
;
; Uses  C registers

;**     IFSMgr_RunScheduledEvents - run events if any have been scheduled
;
;       Checks to see if any scheduled global events are waiting and performs
;       a nested ResumeExec if so.
;
; Entry nothing
;
; Exit  carry set if no events were found, clear otherwise
;

;** IFSMgr_CheckDelResource - check/delete all connections for resource.
;
; This service deletes all active connections on the requested shell
; resource. A force level is passed in so that the appropriate checks are
; made before blowing the resource away. The FSD is called via its
; disconnect entry point to disconnect the resource. There is also a flag
; passed in so that this service can be called only to check if the
; resource can be successfully deleted without really deleting it.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; int IFSMgr_CheckDelResource( pshres psr, int force, int fDelFlag );
;
; Entry TOS = pointer to IFS resource handle passed in on connect
; TOS+4 = force level to use (0-4)
; TOS+8 = delete flag
; non-zero = delete resource
; 0 = just check for deletion
;
; Exit Returns 0 if success, errorcode if failure

;** IFSMgr_Win32GetVMCurdir - return current directory for given drive
;
; This service returns the current directory path for a given drive in the
; current VM context. If the drive is owned by the IFS, we use our IfsCDS
; structure for the current directory. Otherwise, we look in the real-mode
; CDS and extract the current directory for the drive.
;
;       This procedure uses the C6 386 _cdecl calling sequence
;
; int IFSMgr_Win32GetVMCurdir( int wDrive, void far *pCurdirBuf );
;
; Entry TOS = 0-based drive number
; TOS+4 = ptr to buffer to contain curdir
;
; Exit EAX = 0 if successful
;  pCurdirBuf contains curdir. Note that the path returned does not have
;  "D:\" i.e. a curdir of root will be a null path. The path is always
;  returned in the OEM character set for DOS consistency reasons.
; EAX = errorcode, if failure

;** IFSMgr_SetupFailedConnection - api call out on the connect operation
;
; This service is used by the ifs manager to export a connect operation
; when it has been failed by all registered net providers. Any VxD can
; hook this service and then establish a fake connection.
;
; This procedure uses the C6 386 _cdecl calling sequence
;
; int IFSMgr_SetupFailedConnection( pioreq pir, unsigned long *ProId );
;
; Entry TOS = pointer to ioreq structure(filled in for connect operation)
; TOS+4 = pointer to variable to contain provider id if connection done
;
; Exit EAX = 0 if successful, errorcode if failure.

;**     _GetMappedErr - returns the mapped error from the ext. error
;
; Entry TOS     = int21 function number
;       TOS+4   = Extended Error Code
;
; Exit  (eax) = Mapped error code
;
; Uses  C registers  (eax, ecx, edx, flags)
;


;*** IFSMgr_GetLockState - get lock state for specified drive
;
; This service is provided to allow file system clients
; (e.g., Compressed Volume Managers) to query if the
; specified drive is locked.
;
; This service uses the C calling convention.
;
; ENTRY driveno - volume drive number (0 = A:, ...)
; pdwtype - pointer to DWORD in which to return type
; pdwflags - pointer to DWORD in which to return flags
; pdwowner - pointer to DWORD in which to return owning thread
;
; NULL may be passed in for any of the above pointer
; values if the caller does not wish to see the
; corresponding return value.
;
; RETURN int - error code (0 if successful)
;
; USES EAX, ECX, EDX, Flags

;** IFSMgr_Win32_Get_Ring0_Handle
;
; This routine returns a ring 0 handle for a given extended handle. There
; are certain conditions under which the ring 0 handle is not returned
; because we must get an int 21h to send the i/o request down as follows:
; 1. This handle is not an extended handle.
; 2. We are in Win31 filesystem mode.
; 3. There is an app in the VM that has hooked int 21h.
; If none of these conditions are triggered, the ring 0 handle is
; returned for the next read/write operation. This service also returns
; the current position of the file since the caller does not have any
; idea of the current file position.
;
; Entry EBX = extended handle
;
; Exit CY clear --> handle mapped successfully,
; EBX = ring 0 handle
; EDX = current file position
; CY set --> handle was not mapped
; EBX is preserved in this case
;
; Uses EAX, ECX

;** IFSMgr_SetLoopback
;
; This routine is intended to be called by a server to add a loopback
; path to ifsmgr's loopback path list.
;
; This routine uses the __cdecl calling convention.
;
; ENTRY pszUNCPath   - ansi string of the form \\<server>\<share>
; pszLocalPath - ansi string of the form <drive>:<path>
;
; RETURN nothing
;
; USES EAX, ECX, EDX, Flags

;** IFSMgr_ClearLoopback
;
; This routine is intended to be called by a server to remove a
; loopback path from ifsmgr's loopback path list.
;
; This routine uses the __cdecl calling convention.
;
; ENTRY pszUNCPath   - ansi string of the form \\<server>\<share>
;
; RETURN nothing

;** IFSMgr_ParseOneElement
;
; This routine is intended to be called on a single path element i.e
; a filename or directory name, path separators are not allowed. It
; parses this name and returns the parse flags for it in the
; FILE_FLAG_* format defined in ifs.h. Callers can use this service to
; determine whether the name passed in is a shortname or LFN.
;
; This routine uses the __cdecl calling convention
;
; int IFSMgr_ParseOneElement( string_t pstr );
;
; Entry pstr = ptr to path element in unicode format
;
; Exit EAX = parse flags, if no error the following flags are returned:
; FILE_FLAG_IS_LFN = path element is LFN
; FILE_FLAG_HAS_STAR = path element contains '*' wildcard
; FILE_FLAG_WILDCARDS = path element contains wildcards
; FILE_FLAG_HAS_DOT = path element contains a dot char
; EAX = -1 if there was a parse error
;
; Uses C registers

slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
10C#
发布于:2004-03-07 08:10
Re:[求助]谁有冲击波源文件
;ifs.inc****************************************************************************
;                                                                           *
; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY     *
; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE       *
; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR     *
; PURPOSE.                                                                  *
;                                                                           *
; Copyright (C) 1993-95  Microsoft Corporation.  All Rights Reserved.       *
;                                                                           *
;****************************************************************************

;NOINC
;#ifndef IFS_INC
;#define IFS_INC 1
;INC

;* Define these flags if they are not already defined. This way, anyone who
; directly includes this file will not have to bother defining them.
;
 
ifndef DOS_VXD
DOS_VXD equ 1
endif

ifndef WIN32_APIS
WIN32_APIS equ 1
endif


;** ifs.h - Installable File System definitions
;
; This file contains the C function prototypes, structure declarations,
; type names, and constants which define the DOS installable file system
; interface.
;
; All of these routines take a pointer to an IO request structure that
; is filled in with the parameters relevant for the request. The routines
; return some result info in the IO request struct. The particulars
; for each routine are given below the function prototype. All of the
; requests use ir_pid as the ID of the requesting process and return
; success/failure info in ir_error.
;

;NOINC
;#ifndef FAR
; #if defined(M_I386) || _M_IX86 >= 300
; #define FAR
; #else
; #define FAR _far
; #endif
;#endif
;INC

ifndef IFSMgr_Device_ID

IFSMgr_Device_ID   equ 000040h ; Installable File System Manager

IFSMgr_Init_Order   equ 010000h + V86MMGR_Init_Order
FSD_Init_Order     equ 000100h + IFSMgr_Init_Order

else

ifdef MASM
.errnz IFSMgr_Device_ID - 0040h
endif

endif

ifdef MASM
;* Equ's for types that h2inc script cannot convert.

ubuffer_t equ <dd>
pos_t equ <dd>
uid_t equ <db>
sfn_t equ <dw>
$F equ <dd>

if DOS_VXD eq 0
path_t equ <dd>
string_t equ <dw>
pid_t equ <dw>
rh_t equ <dw>
fh_t equ <dw>
vfunc_t equ <dw>
$P equ <dw>
$I equ <dw>
fsdwork struc
dw 16 dup (?)
fsdwork ends

else ; 32bit
path_t equ <dd>
string_t equ <dd>
pid_t equ <dd>
rh_t equ <dd>
fh_t equ <dd>
vfunc_t equ <dd>
$P equ <dd>
$I equ <dd>
fsdwork struc
dd 16 dup (?)
fsdwork ends

endif ; @WordSize

endif

ifdef WIN32_APIS
IFS_VERSION equ 0030Ah
IFS_REVISION equ 010h
else
IFS_VERSION equ 00314h
IFS_REVISION equ 020h
endif

;* Maximum path length - excluding nul

MAX_PATH equ 260 ; Maximum path length - including nul

; Maximum length for a LFN name element - excluding nul
LFNMAXNAMELEN equ 255


MAXIMUM_USERID equ 2 ; max. # of users that can be logged
; on at the same time.  Ir_user must
; always be less than MAXIMUM_USERID.
NULL_USER_ID equ 0 ; special user id for operations when
; not logged on.

; Status indications returned as errors:

STATUS_PENDING equ -1 ; request is pending
STATUS_RAWLOCK equ -2 ; rawlock active on session
; (only returned for async requests,
;  sync requests will wait for the raw
;  lock to be released)
STATUS_BUSY equ -3 ; request can't be started because of
; serialization.

;* ANYPROID - Any Provider ID
;
ANYPROID equ -1


;* Common function defintions for NetFunction
NF_PROCEXIT equ 0111Dh ; Process Exit sent (ID = ANYPROID)
NF_DRIVEUSE equ 00001h ; Drive Use Created (ID = ID of owner FSD)
NF_DRIVEUNUSE equ 00002h ; Drive Use Broken (ID = ID of owner FSD)
NF_GETPRINTJOBID equ 00003h ; Get Print Job ID
; ir_fh - ptr to master file info
; ir_data - ptr to data buffer
; ir_length - IN: buffer size
;  OUT: amount transfered
; ir_SFN - SFN of file handle
NF_PRINTERUSE equ 00004h ; Printer Use Created (ID = ID of owner FSD)
NF_PRINTERUNUSE equ 00005h ; Printer Use Broken (ID = ID of owner FSD)
NF_NetSetUserName equ 01181h

;* Flags passed to NetFunction
WIN32_CALLFLAG equ 004h ; call is Win32 api


;NOINC
;
; Macros for handling status indications when returned as errors
; *
; * REAL_ERROR - returns TRUE if there is a real error
; * returns FALSE for NO_ERROR or STATUS_????
; * STATUS_ERROR - returns TRUE if error is actually a status indication
;
;
;#define REAL_ERROR(err) ((err) > 0)
;#define STATUS_ERROR(err) ((err) < 0)
;
;
;
; * The types for resource handles (rh_t), file handles (fh_t),
; * and the file system driver work space (fsdwork_t) can be defined
; * by the FSD.  The FSD's version of the type must be exactly the
; * same size as the types defined below.  To declare your own
; * version of these types: define a macros of the same name as
; * any of the three types before including ifs.h.
;
;
;#ifndef rh_t
; typedef void *rh_t; ; resource handle
;#endif
;#ifndef fh_t
; typedef void *fh_t; ; file handle
;#endif
;#ifndef fsdwork_t
; typedef int fsdwork_t[16]; ; provider work space
;#endif
;
;INC

;typedef unsigned short *string_t; ; character string
;typedef unsigned short sfn_t; ; system file number
;typedef unsigned long pos_t; ; file position
;typedef unsigned int pid_t; ; process ID of requesting task
;typedef void FAR *ubuffer_t; ; ptr to user data buffer
;typedef unsigned char uid_t; ; user ID for this request

; Parsed path structures are defined later in this file.
;typedef struct PathElement PathElement;
;typedef struct ParsedPath ParsedPath;
;typedef ParsedPath *path_t;

;typedef struct ioreq ioreq, *pioreq;

;* dos_time - DOS time & date format

;typedef struct dos_time dos_time;
dos_time struc
dt_time dw ?
dt_date dw ?
dos_time ends

;typedef struct volfunc volfunc, *vfunc_t;
;typedef struct hndlfunc hndlfunc, *hfunc_t;


;NOINC
;typedef union {
; ubuffer_t aux_buf;
; unsigned long aux_ul;
; dos_time aux_dt;
; vfunc_t aux_vf;
; hfunc_t aux_hf;
; void *aux_ptr;
; string_t aux_str;
; path_t aux_pp;
; unsigned int aux_ui;
;} aux_t;
;INC

ifdef MASM

aux_data struc
  aux_dword dd ?
aux_data ends

if @Version ge 600
aux_ul textequ <aux_data.aux_dword>
aux_ui textequ <aux_data.aux_dword>
aux_vf textequ <aux_data.aux_dword>
aux_hf textequ <aux_data.aux_dword>
aux_ptr textequ <aux_data.aux_dword>
aux_str textequ <aux_data.aux_dword>
aux_pp textequ <aux_data.aux_dword>
aux_buf textequ <aux_data.aux_dword>
aux_dt textequ <aux_data.aux_dword>
else
aux_ul equ aux_dword
aux_ui equ aux_dword
aux_vf equ aux_dword
aux_hf equ aux_dword
aux_ptr equ aux_dword
aux_str equ aux_dword
aux_pp equ aux_dword
aux_buf equ aux_dword
aux_dt equ aux_dword
endif

endif ; MASM


;typedef struct event event, *pevent;

ifdef MASM ; vireo
ioreq struc
% ir_length $I ? ; length of user buffer (eCX)
ir_flags db ? ; misc. status flags (AL)
% ir_user uid_t ? ; user ID for this request
% ir_sfn sfn_t ? ; System File Number of file handle
% ir_pid pid_t ? ; process ID of requesting task
% ir_ppath path_t ? ; unicode pathname
ir_aux1 dd ? ; secondary user data buffer (CurDTA)
% ir_data ubuffer_t ? ; ptr to user data buffer (DS:eDX)
ir_options dw ? ; request handling options
ir_error dw ? ; error code (0 if OK)
% ir_rh rh_t ? ; resource handle
% ir_fh fh_t ? ; file (or find) handle
% ir_pos pos_t ? ; file position for request
ir_aux2 dd ? ; misc. extra API parameters
ir_aux3 dd ? ; misc. extra API parameters
% ir_pev $P ? ; ptr to IFSMgr event for async requests
ir_fsd db (size fsdwork) dup (?); ; Provider work space
ioreq ends
endif ; vireo

; misc. fields overlayed with other ioreq members:

ir_size equ ir_pos
ir_conflags equ ir_pos ; flags for connect
ir_attr2 equ ir_pos ; destination attributes for Rename
ir_attr equ ir_length ; DOS file attribute info
ir_pathSkip equ ir_length ; # of path elements consumed by Connect
ir_lananum equ ir_sfn ; LanA to Connect on (0xFF for any net)
ir_tuna equ ir_sfn ; Mount: FSD authorises IFSMGR tunneling
ir_ptuninfo equ ir_data ; Rename/Create: advisory tunneling info ptr


; Fields overlayed with ir_options:

ir_namelen equ ir_options
ir_sectors equ ir_options ; sectors per cluster
ir_status equ ir_options ; named pipe status


; Fields overlayed with ir_aux1:

ir_data2 equ <ir_aux1.aux_buf> ; secondary data buffer
ir_vfunc equ <ir_aux1.aux_vf> ; volume function vector
ir_hfunc equ <ir_aux1.aux_hf> ; file handle function vector
ir_ppath2 equ <ir_aux1.aux_pp> ; second pathname for Rename
ir_volh equ <ir_aux1.aux_ul> ; VRP address for Mount


; Fields overlayed with ir_aux2:

ir_numfree equ <ir_aux2.aux_ul> ; number of free clusters
ir_locklen equ <ir_aux2.aux_ul> ; length of lock region
ir_msglen equ <ir_aux2.aux_ui> ; length of current message (peek pipe)
; next msg length for mailslots
ir_dostime equ <ir_aux2.aux_dt> ; DOS file date & time stamp
ir_timeout equ <ir_aux2.aux_ul> ; timeout value in milliseconds
ir_password equ <ir_aux2.aux_ptr> ; password for Connect
ir_drvh equ <ir_aux2.aux_ptr> ; drive handle for Mount
ir_prtlen equ <ir_aux2.aux_dt.dt_time> ; length of printer setup string
ir_prtflag equ <ir_aux2.aux_dt.dt_date> ; printer flags
ir_firstclus equ <ir_aux2.aux_ui> ; First cluster of file
ir_mntdrv equ <ir_aux2.aux_ul> ; driveletter for Mount
ir_cregptr equ <ir_aux2.aux_ptr> ; pointer to client registers
ir_uFName equ <ir_aux2.aux_str> ; case preserved filename

; Fields overlayed with ir_aux3:

ir_upath equ <ir_aux3.aux_str> ; pointer to unparsed pathname
ir_scratch equ <ir_aux3.aux_ptr> ; scratch buffer for NetFunction calls

; Fields overlayed with ir_user:

ir_drivenum equ ir_user ; Logical drive # (when mounting)


;NOINC
; IFSFunc - general IFS functions
;
;typedef int _cdecl IFSFunc(pioreq pir);
;typedef IFSFunc *pIFSFunc;
;INC

;* hndlfunc - I/O functions for file handles
;

ifdef WIN32_APIS
NUM_HNDLMISC equ 8
else
NUM_HNDLMISC equ 8
endif

;NOINC
; IFSFileHookFunc - IFS file hook function
;
;typedef int _cdecl IFSFileHookFunc( pIFSFunc pfn, int fn, int Drive, int ResType, int CodePage, pioreq pir );
;typedef IFSFileHookFunc *pIFSFileHookFunc;
;typedef pIFSFileHookFunc *ppIFSFileHookFunc;
;INC

;typedef struct hndlmisc hndlmisc;

ifdef MASM ; vireo
hndlfunc struc
% hf_read $P ? ; file read handler function
% hf_write $P ? ; file write handler function
% hf_misc $P ? ; ptr to misc. function vector
hndlfunc ends


hndlmisc struc
hm_version dw ? ; IFS version #
hm_revision db ? ; IFS interface revision #
hm_size db ? ; # of entries in table
% hm_func $P NUM_HNDLMISC dup (?)
hndlmisc ends
endif ; vireo

HM_SEEK equ 0 ; Seek file handle
HM_CLOSE equ 1 ; close handle
HM_COMMIT equ 2 ; commit buffered data for handle
HM_FILELOCKS equ 3 ; lock/unlock byte range
HM_FILETIMES equ 4 ; get/set file modification time
HM_PIPEREQUEST equ 5 ; named pipe operations
HM_HANDLEINFO equ 6 ; get/set file information
HM_ENUMHANDLE equ 7 ; enum filename from handle, lock info

;* volfunc - volume based api fucntions
;

ifdef WIN32_APIS
NUM_VOLFUNC equ 15
else
NUM_VOLFUNC equ 13
endif

ifdef MASM ; vireo
volfunc struc
vfn_version dw ? ; IFS version #
vfn_revision db ? ; IFS interface revision #
vfn_size db ? ; # of entries in table
% vfn_func $P NUM_VOLFUNC dup (?); volume base function handlers
volfunc ends
endif ; vireo

VFN_DELETE equ 0 ; file delete
VFN_DIR equ 1 ; directory manipulation
VFN_FILEATTRIB equ 2 ; DOS file attribute manipulation
VFN_FLUSH equ 3 ; flush volume
VFN_GETDISKINFO equ 4 ; query volume free space
VFN_OPEN equ 5 ; open file
VFN_RENAME equ 6 ; rename path
VFN_SEARCH equ 7 ; search for names
VFN_QUERY equ 8 ; query resource info (network only)
VFN_DISCONNECT equ 9 ; disconnect from resource (net only)
VFN_UNCPIPEREQ equ 10 ; UNC path based named pipe operations
VFN_IOCTL16DRIVE equ 11 ; drive based 16 bit IOCTL requests
VFN_GETDISKPARMS equ 12 ; get DPB
VFN_FINDOPEN equ 13 ; open an LFN file search
VFN_DASDIO equ 14 ; direct volume access


;* IFS Function IDs passed to IFSMgr_CallProvider

IFSFN_READ equ 0 ; read a file
IFSFN_WRITE equ 1 ; write a file
IFSFN_FINDNEXT equ 2 ; LFN handle based Find Next
IFSFN_FCNNEXT equ 3 ; Find Next Change Notify

IFSFN_SEEK equ 10 ; Seek file handle
IFSFN_CLOSE equ 11 ; close handle
IFSFN_COMMIT equ 12 ; commit buffered data for handle
IFSFN_FILELOCKS equ 13 ; lock/unlock byte range
IFSFN_FILETIMES equ 14 ; get/set file modification time
IFSFN_PIPEREQUEST equ 15 ; named pipe operations
IFSFN_HANDLEINFO equ 16 ; get/set file information
IFSFN_ENUMHANDLE equ 17 ; enum file handle information
IFSFN_FINDCLOSE equ 18 ; LFN find close
IFSFN_FCNCLOSE equ 19 ; Find Change Notify Close

IFSFN_CONNECT equ 30 ; connect or mount a resource
IFSFN_DELETE equ 31 ; file delete
IFSFN_DIR equ 32 ; directory manipulation
IFSFN_FILEATTRIB equ 33 ; DOS file attribute manipulation
IFSFN_FLUSH equ 34 ; flush volume
IFSFN_GETDISKINFO equ 35 ; query volume free space
IFSFN_OPEN equ 36 ; open file
IFSFN_RENAME equ 37 ; rename path
IFSFN_SEARCH equ 38 ; search for names
IFSFN_QUERY equ 39 ; query resource info (network only)
IFSFN_DISCONNECT equ 40 ; disconnect from resource (net only)
IFSFN_UNCPIPEREQ equ 41 ; UNC path based named pipe operations
IFSFN_IOCTL16DRIVE equ 42 ; drive based 16 bit IOCTL requests
IFSFN_GETDISKPARMS equ 43 ; get DPB
IFSFN_FINDOPEN equ 44 ; open an LFN file search
IFSFN_DASDIO equ 45 ; direct volume access

;* Resource types passed in on the File Hook:
IFSFH_RES_UNC equ 001h ; UNC resource
IFSFH_RES_NETWORK equ 008h ; Network drive connection
IFSFH_RES_LOCAL equ 010h ; Local drive
IFSFH_RES_CFSD equ 080h ; Character FSD

;* values for ir_options to Connect:
; Note that only one of RESOPT_UNC_REQUEST, RESOPT_DEV_ATTACH, and
; RESOPT_UNC_CONNECT may be set at once.
;

RESOPT_UNC_REQUEST equ 001h ; UNC-style path based request
RESOPT_DEV_ATTACH equ 002h ; explicit redirection of a device
RESOPT_UNC_CONNECT equ 004h ; explicit UNC-style use
RESOPT_DISCONNECTED equ 008h ; Set up connection disconnected
; (Don't touch net)
RESOPT_NO_CREATE equ 010h ; don't create a new resource
RESOPT_STATIC equ 020h ; don't allow ui to remove

;* values for ir_flags to Connect:
RESTYPE_WILD equ 0 ; wild card service type
RESTYPE_DISK equ 1 ; disk resource
RESTYPE_SPOOL equ 2 ; spooled printer
RESTYPE_CHARDEV equ 3 ; character device
RESTYPE_IPC equ 4 ; interprocess communication

FIRST_RESTYPE equ RESTYPE_DISK
LAST_RESTYPE equ RESTYPE_IPC

;* values for ir_options to Close *

RESOPT_NO_IO equ 001h     ; no I/O allowed during the operation

;* values for ir_flags for FSD operations

IR_FSD_MOUNT equ 0 ; mount volume
;OBSOLETE: #define IR_FSD_DISMOUNT 1 ; dismount volume
IR_FSD_VERIFY equ 2 ; verify volume
IR_FSD_UNLOAD equ 3 ; unload volume
IR_FSD_MOUNT_CHILD equ 4 ; mount child volume
IR_FSD_MAP_DRIVE equ 5 ; change drive mapping
IR_FSD_UNMAP_DRIVE equ 6 ; reset drive mapping


;* Value for ir_error from IR_FSD_MOUNT if volume exists *
ERROR_IFSVOL_EXISTS equ 284 ; mounted volume already exists

;* Values returned in ir_tuna from IR_FSD_MOUNT (default IR_TUNA_NOTUNNEL)
IR_TUNA_NOTUNNEL equ 0 ; Disable IFSMGR tunneling on volume
IR_TUNA_FSDTUNNEL equ 0 ; FSD implements tunneling itself
IR_TUNA_IFSTUNNEL equ 1 ; FSD requests IFSMGR tunneling support

;* Values for IFSMgr_PNPVolumeEvent
PNPE_SUCCESS equ 000h
PNPE_QUERY_ACCEPTED equ 000h
PNPE_QUERY_REFUSED equ 001h
PNPE_BAD_ARGS equ 002h
PNPE_UNDEFINED equ 0FFh

;* Type values for IFSMgr_PNPEvent
PNPT_VOLUME equ 010000000h
PNPT_NET equ 020000000h
PNPT_MASK       equ 0F0000000h

;* Values for ir_options returned from QueryResource:
RESSTAT_OK equ 0 ; connection to resource is valid
RESSTAT_PAUSED equ 1 ; paused by workstation
RESSTAT_DISCONN equ 2 ; disconnected
RESSTAT_ERROR equ 3 ; cannot be reconnected
RESSTAT_CONN equ 4 ; first connection in progress
RESSTAT_RECONN equ 5 ; reconnection in progress



;* Values for ir_flags to HM_CLOSE:

CLOSE_HANDLE equ 0 ; only closing a handle
CLOSE_FOR_PROCESS equ 1 ; last close of SFN for this process
CLOSE_FINAL equ 2 ; final close of SFN for system

;* Values for ir_options to HM_CLOSE, HM_COMMIT, hf_read, hf_write:
FILE_NO_LAST_ACCESS_DATE equ 001h ; do not update last access date
FILE_CLOSE_FOR_LEVEL4_LOCK equ 002h ; special close on a level 4 lock
FILE_COMMIT_ASYNC equ 004h ; commit async instead of sync

FILE_FIND_RESTART equ 040h ; set for findnext w/key
IOOPT_PRT_SPEC equ 080h ; ir_options flag for int17 writes

;* Values for ir_flags to VFN_DIR:

CREATE_DIR equ 0
DELETE_DIR equ 1
CHECK_DIR equ 2
QUERY83_DIR equ 3
QUERYLONG_DIR equ 4


;* ir_flags values for HM_FILELOCKS:

LOCK_REGION equ 0 ; lock specified file region
UNLOCK_REGION equ 1 ; unlock region

; Note: these values are also used by the sharing services
;* ir_options values for HM_FILELOCKS:

LOCKF_MASK_RDWR equ 001h ; Read / write lock flag
LOCKF_WR equ 000h ; bit 0 clear - write lock
LOCKF_RD equ 001h ; bit 0 set - read lock(NW only)

LOCKF_MASK_DOS_NW equ 002h ; DOS/Netware style lock flag
LOCKF_DOS equ 000h ; bit 1 clear - DOS-style lock
LOCKF_NW equ 002h ; bit 1 set - Netware-style lock

;* These values are used internally by the IFS manager only:
LOCKF_MASK_INACTIVE equ 080h ; lock active/inactive flag
LOCKF_ACTIVE equ 000h ; bit 7 clear - lock active
LOCKF_INACTIVE equ 080h ; bit 7 set - lock inactive

;* Values for ir_flags to VFN_PIPEREQUEST and HM_PIPEREQUEST:
; (NOTE: these values have been chosen to agree with the opcodes used
; by the TRANSACTION SMB for the matching operation.)
;

PIPE_QHandState equ 021h
PIPE_SetHandState equ 001h
PIPE_QInfo equ 022h
PIPE_Peek equ 023h
PIPE_RawRead equ 011h
PIPE_RawWrite equ 031h
PIPE_Wait equ 053h
PIPE_Call equ 054h
PIPE_Transact equ 026h


;* Values for ir_flags for HM_HANDLEINFO call:

HINFO_GET equ 0 ; retrieve current buffering info
HINFO_SETALL equ 1 ; set info (all parms)
HINFO_SETCHARTIME equ 2 ; set handle buffer timeout
HINFO_SETCHARCOUNT equ 3 ; set handle max buffer count

;* Values for ir_flags for HM_ENUMHANDLE call:
ENUMH_GETFILEINFO equ 0 ; get fileinfo by handle
ENUMH_GETFILENAME equ 1 ; get filename associated with handle
ENUMH_GETFINDINFO equ 2 ; get info for resuming
ENUMH_RESUMEFIND equ 3 ; resume find operation
ENUMH_RESYNCFILEDIR equ 4 ; resync dir entry info for file

;* Values for ir_options for the ENUMH_RESYNCFILEDIR call:
RESYNC_INVALIDATEMETACACHE equ 001h ; invalidate meta cache on resync

;* Values for ir_flags for VFN_FILEATTRIB:  
;*  
;* Note: All functions that modify the volume MUST be odd.
;*       Callers rely on this & test the low order bit.  

GET_ATTRIBUTES equ 0 ; get attributes of file/dir
SET_ATTRIBUTES equ 1 ; set attributes of file/dir

GET_ATTRIB_COMP_FILESIZE equ 2 ; get compressed size of file

SET_ATTRIB_MODIFY_DATETIME equ 3 ; set date last written of file/dir
GET_ATTRIB_MODIFY_DATETIME equ 4 ; get date last written of file/dir
SET_ATTRIB_LAST_ACCESS_DATETIME equ 5 ; set date last accessed of file/dir
GET_ATTRIB_LAST_ACCESS_DATETIME equ 6 ; get date last accessed of file/dir
SET_ATTRIB_CREATION_DATETIME equ 7 ; set create date of file/dir
GET_ATTRIB_CREATION_DATETIME equ 8 ; get create date of file/dir

GET_ATTRIB_FIRST_CLUST equ 9 ; get first cluster of a file

;* Values for ir_flags for VFN_FLUSH:
GDF_NORMAL equ 000h ; walk disk, if needed, to get free space
GDF_NO_DISK_HIT equ 001h ; return current "hint", don't walk disk

;* Values for ir_flags for HM_FILETIMES:

GET_MODIFY_DATETIME equ 0 ; get last modification date/time
SET_MODIFY_DATETIME equ 1 ; set last modification date/time
GET_LAST_ACCESS_DATETIME equ 4 ; get last access date/time
SET_LAST_ACCESS_DATETIME equ 5 ; set last access date/time
GET_CREATION_DATETIME equ 6 ; get creation date/time
SET_CREATION_DATETIME equ 7 ; set creation date/time

;* Values for ir_flags for HM_SEEK:

FILE_BEGIN equ 0 ; absolute posn from file beginning
FILE_END equ 2 ; signed posn from file end

;* Values for ir_flags for VFN_OPEN:

ACCESS_MODE_MASK equ 00007h ; Mask for access mode bits
ACCESS_READONLY equ 00000h ; open for read-only access
ACCESS_WRITEONLY equ 00001h ; open for write-only access
ACCESS_READWRITE equ 00002h ; open for read and write access
ACCESS_EXECUTE equ 00003h ; open for execute access

SHARE_MODE_MASK equ 00070h ; Mask for share mode bits
SHARE_COMPATIBILITY equ 00000h ; open in compatability mode
SHARE_DENYREADWRITE equ 00010h ; open for exclusive access
SHARE_DENYWRITE equ 00020h ; open allowing read-only access
SHARE_DENYREAD equ 00030h ; open allowing write-only access
SHARE_DENYNONE equ 00040h ; open allowing other processes access
SHARE_FCB equ 00070h ; FCB mode open

;* Values for ir_options for VFN_OPEN:

ACTION_MASK equ 0ffh ; Open Actions Mask
ACTION_OPENEXISTING equ 001h ; open an existing file
ACTION_REPLACEEXISTING equ 002h ; open existing file and set length
ACTION_CREATENEW equ 010h ; create a new file, fail if exists
ACTION_OPENALWAYS equ 011h ; open file, create if does not exist
ACTION_CREATEALWAYS equ 012h ; create a new file, even if it exists

;* Alternate method: bit assignments for the above values:

ACTION_EXISTS_OPEN equ 001h ; BIT: If file exists, open file
ACTION_TRUNCATE equ 002h ; BIT: Truncate file
ACTION_NEXISTS_CREATE equ 010h ; BIT: If file does not exist, create

; these mode flags are passed in via ifs_options to VFN_OPEN

OPEN_FLAGS_NOINHERIT equ 00080h
OPEN_FLAGS_NO_CACHE equ R0_NO_CACHE ; 0x0100
OPEN_FLAGS_NO_COMPRESS equ 00200h
OPEN_FLAGS_ALIAS_HINT equ 00400h
OPEN_FLAGS_NOCRITERR equ 02000h
OPEN_FLAGS_COMMIT equ 04000h
OPEN_FLAGS_REOPEN equ 00800h ; file is being reopened on vol lock

;* Values returned by VFN_OPEN for action taken:
ACTION_OPENED equ 1 ; existing file has been opened
ACTION_CREATED equ 2 ; new file has been created
ACTION_REPLACED equ 3 ; existing file has been replaced

;* Values for ir_flags for VFN_SEARCH:
SEARCH_FIRST equ 0 ; findfirst operation
SEARCH_NEXT equ 1 ; findnext operation

;* Values for ir_flags for VFN_DISCONNECT:
DISCONNECT_NORMAL equ 0 ; normal disconnect
DISCONNECT_NO_IO equ 1 ; no i/o can happen at this time
DISCONNECT_SINGLE equ 2 ; disconnect this drive only

;* Values for ir_options for VFN_FLUSH:
VOL_DISCARD_CACHE equ 1
VOL_REMOUNT equ 2

;* Values for ir_options for VFN_IOCTL16DRIVE:
IOCTL_PKT_V86_ADDRESS equ 0 ; V86 pkt address in user DS:DX
IOCTL_PKT_LINEAR_ADDRESS equ 1 ; Linear address to packet in ir_data

;* Values for ir_flags for VFN_DASDIO:
DIO_ABS_READ_SECTORS equ 0 ; Absolute disk read
DIO_ABS_WRITE_SECTORS equ 1 ; Absolute disk write
DIO_SET_LOCK_CACHE_STATE equ 2 ; Set cache state during volume lock

;* Values for ir_options for DIO_SET_LOCK_CACHE_STATE:
DLC_LEVEL4LOCK_TAKEN equ 001h ; cache writethru, discard name cache
DLC_LEVEL4LOCK_RELEASED equ 002h ; revert to normal cache state
DLC_LEVEL1LOCK_TAKEN equ 004h ; cache writethru, discard name cache
DLC_LEVEL1LOCK_RELEASED equ 008h ; revert to normal cache state

; These values for ir_options are used only on ring 0 apis
R0_NO_CACHE equ 00100h ; must not cache reads/writes
R0_SWAPPER_CALL equ 01000h ; called by the swapper
R0_MM_READ_WRITE equ 08000h ; indicates this is a MMF R0 i/o
R0_SPLOPT_MASK equ 0FF00h ; mask for ring 0 special options


;* Values for ir_attr for different file attributes:

FILE_ATTRIBUTE_READONLY equ 001h ; read-only file
FILE_ATTRIBUTE_HIDDEN equ 002h ; hidden file
FILE_ATTRIBUTE_SYSTEM equ 004h ; system file
FILE_ATTRIBUTE_LABEL equ 008h ; volume label
FILE_ATTRIBUTE_DIRECTORY equ 010h ; subdirectory
FILE_ATTRIBUTE_ARCHIVE equ 020h ; archived file/directory
FILE_ATTRIBUTE_DEVICE equ 040h ; device

; The second byte of ir_attr is a mask of attributes which "must match"
; on a SEARCH or FINDOPEN call.  If an attribute bit is set in the
; "must match" mask, then the file must also have that attribute set
; to match the search/find.
;
FILE_ATTRIBUTE_MUSTMATCH equ 000003F00h ; 00ADVSHR Must Match
FILE_ATTRIBUTE_EVERYTHING equ 00000003Fh ; 00ADVSHR Find Everything
FILE_ATTRIBUTE_INTERESTING equ 00000001Eh ; 000DVSH0 Search bits

;   Auto-generation flags returned from CreateBasis()
;
BASIS_TRUNC equ 001h ; original name was truncated
BASIS_LOSS equ 002h ; char translation loss occurred
BASIS_UPCASE equ 004h ; char in basis was upcased
BASIS_EXT equ 020h ; char in basis is extended ASCII

;   Flags that SHOULD associated with detecting 'collisions' in the basis name
;   and the numeric tail of a basis name.  They are defined here so that routines
;   who need to flag these conditions use these values in a way that does not
;   conflict with the previous three 'basis' flags.
;
BASIS_NAME_COLL equ 008h ; collision in the basis name component
BASIS_NUM_TAIL_COLL equ 010h ; collision in the numeric-tail component

; Flags returned by long-name FindOpen/Findnext calls.  The flags
; indicate whether a mapping from UNICODE to BCS of the primary and
; altername names in the find buffer have lost information.  This
; occurs whenever a UNICODE char cannot be mapped into an OEM/ANSI
; char in the codepage specified.
;

FIND_FLAG_PRI_NAME_LOSS equ 00001h
FIND_FLAG_ALT_NAME_LOSS equ 00002h

; Flags returned by UNIToBCS, BCSToUni, UniToBCSPath, MapUniToBCS
;  MapBCSToUni.  The flags indicate whether a mapping from UNICODE
;  to BCS, or BCS to UNICODE have lost information.  This occurs
; whenever a char cannot be mapped.
;

MAP_FLAG_LOSS equ 00001h
MAP_FLAG_TRUNCATE equ 00002h


;NOINC
;#define TestMustMatch(pir, attr) (((((pir)->ir_attr & (attr)<<8) ; ^ (pir)->ir_attr) ; & FILE_ATTRIBUTE_MUSTMATCH) == 0)
;INC

; These bits are also set in ir_attr for specific properties of the
; pathname/filename.
;
; A filename is 8.3 compatible if it contains at most 8 characters before
; a DOT or the end of the name, at most 3 chars after a DOT, at most one
; DOT, and no new LFN only characters.  The new LFN characters are:
; , + = [ ] ;
;
; If a name does not meet all of the 8.3 rules above then it is considered
; to be a "long file name", LFN.
;
FILE_FLAG_WILDCARDS equ 080000000h ; set if wildcards in name
FILE_FLAG_HAS_STAR equ 040000000h ; set if *'s in name (PARSE_WILD also set)
FILE_FLAG_LONG_PATH equ 020000000h ; set if any path element is not 8.3
FILE_FLAG_KEEP_CASE equ 010000000h ; set if FSD should use ir_uFName
FILE_FLAG_HAS_DOT equ 008000000h ; set if last path element contains .'s
FILE_FLAG_IS_LFN equ 004000000h ; set if last element is LFN

; Function definitions on the ring 0 apis function list:
; NOTE: Most functions are context independent unless explicitly stated
; i.e. they do not use the current thread context. R0_LOCKFILE is the only
; exception - it always uses the current thread context.
;
R0_OPENCREATFILE equ 0D500h ; Open/Create a file
R0_OPENCREAT_IN_CONTEXT equ 0D501h ; Open/Create file in current context
R0_READFILE equ 0D600h ; Read a file, no context
R0_WRITEFILE equ 0D601h ; Write to a file, no context
R0_READFILE_IN_CONTEXT equ 0D602h ; Read a file, in thread context
R0_WRITEFILE_IN_CONTEXT equ 0D603h ; Write to a file, in thread context
R0_CLOSEFILE equ 0D700h ; Close a file
R0_GETFILESIZE equ 0D800h ; Get size of a file
R0_FINDFIRSTFILE equ 04E00h ; Do a LFN FindFirst operation
R0_FINDNEXTFILE equ 04F00h ; Do a LFN FindNext operation
R0_FINDCLOSEFILE equ 0DC00h ; Do a LFN FindClose operation
R0_FILEATTRIBUTES equ 04300h ; Get/Set Attributes of a file
R0_RENAMEFILE equ 05600h ; Rename a file
R0_DELETEFILE equ 04100h ; Delete a file
R0_LOCKFILE equ 05C00h ; Lock/Unlock a region in a file
R0_GETDISKFREESPACE equ 03600h ; Get disk free space
R0_READABSOLUTEDISK equ 0DD00h ; Absolute disk read
R0_WRITEABSOLUTEDISK equ 0DE00h ; Absolute disk write

; Special definitions for ring 0 apis for drive information flags

IFS_DRV_RMM equ 00001h ; drive is managed by RMM
IFS_DRV_DOS_DISK_INFO equ 00002h ; drive needs DOS


;NOINC
;
; SetHandleFunc - set up routing info for a file handle.
; *
; *NOTE: the do {} while(0) construction below is necessary to obtain proper
; * behavior when this macro is used in if statement body. Do not
; * add a ; to the while (0) line!
; *
; * Entry (pir) = ptr to IOReq structure for request
; * (read) = ptr to IO Function for reading from file
; * (write) = ptr to IO Function for writting to file
; * (table) = ptr to table of misc. IO Functions
;
;
;#define SetHandleFunc(pir, read, write, table) ; do { ; hfunc_t phf = (pir)->ir_hfunc; ; phf->hf_read = (read); ; phf->hf_write = (write); ; phf->hf_misc = (table); ; } while (0)
;
;
; SetVolumeFunc - set up routing info for a volume
; *
; * Entry (pir) = ptr to ioreq struct
; * (table) = ptr to table of provider Functions
;
;
;#define SetVolumeFunc(pir, table) ((pir)->ir_vfunc = (table))
;
;INC


;* search - Search record structure
;
; This strucure defines the result buffer format for search returns
; for int21h based file searches: 11H/12H FCB Find First/Next
; and 4eH/4fH path based Find First/Next
;
; There are two areas in the search_record reserved for use by file system
; drivers. One is to be used by local file systems such as FAT or CDROM
; and the other is to be used by network file systems such as an SMB or
; NCP client. The reason for the split is because many network file
; systems send and receive the search key directly on the net.
;

;typedef struct srch_key srch_key;
srch_key struc
sk_drive db ? ; Drive specifier (set by IFS MGR)
sk_pattern db 11 dup (?) ; Reserved (pattern sought)
sk_attr db ? ; Reserved (attribute sought)
sk_localFSD db 4 dup (?) ; available for use local FSDs
sk_netFSD db 2 dup (?) ; available for use by network FSDs
sk_ifsmgr db 2 dup (?) ; reserved for use by IFS MGR
srch_key ends


;typedef struct srch_entry srch_entry;
srch_entry struc
se_key db  (size srch_key) dup (?) ; resume key
se_attrib db ? ; file attribute
se_time dw ? ; time of last modification to file
se_date dw ? ; date of last modification to file
se_size dd ? ; size of file
se_name db 13 dup (?) ; ASCIIZ name with dot included
srch_entry ends


;* Win32 Date Time structure
; This structure defines the new Win32 format structure for returning the
; date and time
;

;typedef struct _FILETIME _FILETIME;
_FILETIME struc
dwLowDateTime dd ?
dwHighDateTime dd ?
_FILETIME ends

;* Win32 Find Structure
;  This structure defines the contents of the result buffer on a
; Win32 FindFirst / FindNext. These calls are accessed by the new
; LFN find apis
;

;typedef struct _WIN32_FIND_DATA _WIN32_FIND_DATA;
_WIN32_FIND_DATA struc
dwFileAttributes dd ?
ftCreationTime db  (size _FILETIME) dup (?)
ftLastAccessTime db  (size _FILETIME) dup (?)
ftLastWriteTime db  (size _FILETIME) dup (?)
nFileSizeHigh dd ?
nFileSizeLow dd ?
dwReserved0 dd ?
dwReserved1 dd ?
cFileName dw MAX_PATH dup (?) ; includes NUL
cAlternateFileName dw 14 dup (?) ; includes NUL
_WIN32_FIND_DATA ends


;* Win32 File Info By Handle Structure
;  This structure defines the contents of the result buffer on a
;  Win32 FileInfoByHandle. These calls are accessed by the new
;  LFN find apis
;

;typedef struct _BY_HANDLE_FILE_INFORMATION _BY_HANDLE_FILE_INFORMATION;
_BY_HANDLE_FILE_INFORMATION struc ; bhfi
bhfi_dwFileAttributes dd ?
bhfi_ftCreationTime db  (size _FILETIME) dup (?)
    bhfi_ftLastAccessTime db  (size _FILETIME) dup (?)
bhfi_ftLastWriteTime db  (size _FILETIME) dup (?)
bhfi_dwVolumeSerialNumber dd ?
bhfi_nFileSizeHigh dd ?
bhfi_nFileSizeLow dd ?
bhfi_nNumberOfLinks dd ?
bhfi_nFileIndexHigh dd ?
bhfi_nFileIndexLow dd ?
_BY_HANDLE_FILE_INFORMATION ends


; these are win32 defined flags for GetVolInfo

FS_CASE_IS_PRESERVED equ 000000002h
FS_UNICODE_STORED_ON_DISK equ 000000004h

; these flags for GetVolInfo are NOT defined

FS_VOL_IS_COMPRESSED equ 000008000h
FS_VOL_SUPPORTS_LONG_NAMES equ 000004000h


; these flags are returned by IFSMgr_Get_Drive_Info

FDRV_INT13 equ 001h
FDRV_FASTDISK equ 002h
FDRV_COMP equ 004h
FDRV_RMM equ 008h
FDRV_DOS equ 010h
FDRV_USE_RMM equ 020h
FDRV_COMPHOST equ 040h
FDRV_NO_LAZY equ 080h


;* TUNINFO - Tunneling Information
; This structure defines the information passed into the FSD on
; a Create or Rename operation if tunneling was detected.  This
; gives a set of advisory information to create the new file with.
; if ir_ptuninfo is NULL on Create or Rename, none of this information
; is available.  All of this information is advisory.  tuni_bfContents
; defines what pieces of tunneling information are available.
;

;typedef struct TUNINFO TUNINFO;
ifdef MASM ; vireo
TUNINFO struc
tuni_bfContents dd ?
% tuni_pAltName $P ?
tuni_ftCreationTime db  (size _FILETIME) dup (?)
tuni_ftLastAccessTime db  (size _FILETIME) dup (?)
tuni_ftLastWriteTime db  (size _FILETIME) dup (?)
TUNINFO ends
endif ; vireo

TUNI_CONTAINS_ALTNAME equ 000000001h ; pAltName available
TUNI_CONTAINS_CREATIONT equ 000000002h ; ftCreationTime available
TUNI_CONTAINS_LASTACCESST equ 000000004h ; ftLastAccessTime available
TUNI_CONTAINS_LASTWRITET equ 000000008h ; ftLastWriteTime available


;* _QWORD - 64-bit data type
;  A struct used to return 64-bit data types to C callers
;  from the qwUniToBCS & qwUniToBCS rotuines.  These
;  'routines' are just alias' for UntoToBCS & UniToBCSPath
;  routines and do not exist as separate entities.  Both
;  routines always return a 64-bit result.  The lower
;  32-bits are a length.  The upper 32-bits are flags.
;  Typically, the flag returned indicates whether a mapping
;  resulted in a loss on information in the UNICODE to BCS
;  translation (i.e. a unicode char was converted to an '_').
;

;typedef struct _QWORD _QWORD;
_QWORD struc
ddLower dd ?
ddUpper dd ?
_QWORD ends


;* ParsedPath - structure of an IFSMgr parsed pathname

PathElement struc
pe_length dw ?
pe_unichars dw 1 dup (?)
PathElement ends

ParsedPath struc
pp_totalLength dw ?
pp_prefixLength dw ?
pp_elements db  (1*size PathElement) dup (?)
ParsedPath ends


;* Macros to mainipulate parsed pathnames receieved from IFSMgr

;NOINC
;#define IFSPathSize(ppath) ((ppath)->pp_totalLength + sizeof(short))
;#define IFSPathLength(ppath) ((ppath)->pp_totalLength - sizeof(short)*2)
;#define IFSLastElement(ppath) ((PathElement *)((char *)(ppath) + (ppath)->pp_prefixLength))
;#define IFSNextElement(pel) ((PathElement *)((char *)(pel) + (pel)->pe_length))
;#define IFSIsRoot(ppath) ((ppath)->pp_totalLength == 4)
;INC

;* Function prototypes for IFSMgr services

; Values for charSet passed to character conversion routines
BCS_WANSI equ 0 ; use Windows ANSI set
BCS_OEM equ 1 ; use current OEM character set
BCS_UNI equ 2 ; use UNICODE character set


;   Matching semantics flags passed to MetaMatchUni()
UFLG_META equ 001h
UFLG_NT equ 002h
UFLG_NT_DOS equ 004h
UFLG_DOS equ 000h

; define the utb and btu ptr table structures

;typedef struct CPPtrs CPPtrs;
CPPtrs struc
AnsiPtr dd ?
OEMPtr dd ?
CPPtrs ends


;typedef struct UnitoUpperTab UnitoUpperTab;
UnitoUpperTab struc
delta dd ?
TabPtr dd ?
UnitoUpperTab ends

;typedef struct CPTablePtrs CPTablePtrs;
CPTablePtrs struc
CPT_Length dd ?
utbPtrTab db  (size CPPtrs) dup (?)
btuPtrTab db  (size CPPtrs) dup (?)
UnitoUpperPtr db  (size UnitoUpperTab) dup (?)
CPTablePtrs ends


;NOINC
;unsigned int  _cdecl UniToBCS(
; unsigned char *pStr,
; string_t pUni,
; unsigned int length,
; unsigned int maxLength,
; unsigned int charSet);
;
;
;unsigned int UniToBCSPath(
; unsigned char *pStr,
; PathElement *pPth,
; unsigned int maxLength,
; int charSet);
;
;
;_QWORD qwUniToBCS(
; unsigned char *pStr,
; string_t pUni,
; unsigned int length,
; unsigned int maxLength,
; unsigned int charSet);
;
;
;_QWORD qwUniToBCSPath(
; unsigned char *pStr,
; PathElement *pPth,
; unsigned int maxLength,
; int charSet);
;
;
;unsigned int  _cdecl BCSToUni(
; string_t pUni,
; unsigned char *pStr,
; unsigned int length,
; int charSet);
;
;
;unsigned int UniToUpper(
; string_t pUniUp,
; string_t pUni,
; unsigned int length);
;
;
;unsigned int BCSToBCS (unsigned char *pDst,
;                       unsigned char *pSrc,
;                       unsigned int  dstCharSet,
;                       unsigned int  srcCharSet,
;                       unsigned int  maxLen);
;
;
;unsigned int BCSToBCSUpper (unsigned char *pDst,
;                      unsigned char *pSrc,
;                      unsigned int  dstCharSet,
;                      unsigned int  srcCharSet,
;                      unsigned int  maxLen);
;
;
; Map a single Unicode character to OEM
; * Entry (uniChar) - character to map
; *
; * Returns (oemChar) - character in OEM set
; *  (if oemChar > 255, then DBCS character with
; * lead byte in LSB and trail byte in next byte)
;
;unsigned int  _cdecl UniCharToOEM(unsigned short uniChar);
;
;
;unsigned int IFSMgr_MetaMatch(
; string_t pUniPat,
; string_t pUni,
; int MatchSem);
;
; IFSMgr_TransMatch - translate and match
; *
; * The routine converts a DOS format 43 bytes search buffer into
; * _WIN32_FIND_DATA format and will optionally perform attribute and
; * pattern matching on the entry.
; *
; * Entry (pir) - ptr to ioreq structure
; *  ir_attr - attribute value from FINDOPEN call.
; * (pse) - ptr to DOS format search buffer
; * (pattern) - ptr to Unicode pattern string (0 terminated)
; * (pwf) - ptr to _WIN32_FIND_DATA structure to fill in
; * Exit != 0 if match
; *  ir_pos - value from sk_localFSD.
; * (used for restarting finds)
; * 0 if no match
;
;int IFSMgr_TransMatch(
; pioreq pir,
; srch_entry *pse,
; string_t pattern,
; _WIN32_FIND_DATA *pwf);
;
;
; Time format conversion routines
; *
; * These routines will convert from time/date information between
; * the various formats used and required by IFSMgr and FSDs.
;
;
;;extern _FILETIME  _cdecl IFSMgr_DosToWin32Time(dos_time dt);
;
;;extern _FILETIME IFSMgr_NetToWin32Time(unsigned long time);
;
;;extern dos_time IFSMgr_Win32ToDosTime(_FILETIME ft);
;
;;extern dos_time IFSMgr_NetToDosTime(unsigned long time);
;
;;extern unsigned long IFSMgr_DosToNetTime(dos_time dt);
;
;;extern unsigned long IFSMgr_Win32ToNetTime(_FILETIME ft);
;
;
; IFSMgr_CallProvider - call file system provider
; *
; * The IFSMgr makes all calls to file system providers via this
; * service.  It is possible for a VxD to hook this service to monitor
; * file system operations.
; *
; * Entry (pir) - ptr to ioreq structure
; * (fnID) - function ID (see IFSFN_* above)
; * (ifn) - provider function being called
; * Exit return code from provider
;
;int IFSMgr_CallProvider(pioreq pir, int fnID, pIFSFunc ifn);
;
; These definitions are used by MSNET32 for
; making DeviceIOControl calls to ifsmgr
;
;#define IFS_IOCTL_21 100
;#define IFS_IOCTL_2F 101
;#define IFS_IOCTL_GET_RES 102
;#define IFS_IOCTL_GET_NETPRO_NAME_A 103
;
;struct win32apireq {
; unsigned long ar_proid;
; unsigned long   ar_eax;
; unsigned long   ar_ebx;
; unsigned long   ar_ecx;
; unsigned long   ar_edx;
; unsigned long   ar_esi;
; unsigned long   ar_edi;
; unsigned long   ar_ebp;
; unsigned short ar_error;
; unsigned short  ar_pad;
;}; ; win32apireq
;
; This structure is passed to IFSMgr_UseAdd and
; IFSMgr_UseDel
;
;typedef struct netuse_info netuse_info;
;struct netuse_info {
; void *nu_data;
; int nu_info; ; del use only
; unsigned long nu_flags;
; unsigned long nu_rsvd;
;}; ; netuse_info
;
; values for nu_flags
;
;#define FSD_NETAPI_USEOEM 0x00000001 ; strings are OEM
;#define FSD_NETAPI_STATIC 0x00000002 ; drive redirection can
; ; only be removed at shutdown
;#define FSD_NETAPI_USELFN 0x00000004      ; treat remote name as lfn
;INC

ifdef MASM ; vireo
fmode_t struc ; File mode information
    fm_uid dd ? ; User ID
% fm_cookie0 $P ? ; Caller-supplied cookie
% fm_cookie1 $P ? ; Caller-supplied cookie
    fm_mode dw ? ; File sharing mode and access
    fm_attr dw ? ; File attributes
fmode_t ends
endif ; vireo

;typedef struct fmode_t fmode_t; ; Type definition

;
; These flags are used on the Win32 service to duplicate an extended handle
;
;

DUP_NORMAL_HANDLE equ 000h ; dup handle for normal file io
DUP_MEMORY_MAPPED equ 001h ; dup handle for memory-mapping
DUP_MEM_MAPPED_WRITE equ 002h ; mem mapping is for write if set,
; is for read if clear.
;
; These constants for the different subfunctions on NameTrans (7160h)
;
;
 
NAMTRN_NORMALQUERY equ 000h ; normal LFN NameTrans operation
NAMTRN_DO83QUERY equ 001h ; NameTrans to return full 8.3 name
NAMTRN_DOLFNQUERY equ 002h ; NameTrans to return full LFN name

;
; These constants are used for the different subfunctions on Get List Of
; Open Files (440dh, 086Dh)
;
;

ENUM_ALL_FILES equ 000h ; enumerate all open files
ENUM_UNMOVEABLE_FILES equ 001h ; enumerate only unmoveable files

;* Structure for the open file information from DOS to take over open files.
;

;typedef struct SFTOpenInfo SFTOpenInfo;
;typedef struct SFTOpenInfo *pSFTOpenInfo;
SFTOpenInfo struc
soi_dirclus dw ? ; cluster # for directory
soi_dirind dw ? ; directory index of dir entry
soi_dirname db 11 dup (?) ; directory entry name
soi_pad db ? ; pad out for dword boundary
SFTOpenInfo ends

;NOINC
;
; Win32DupHandle service and associated constants.
;
;
;;;extern int _cdecl Win32DupHandle( pid_t srcpid,
;;    pid_t duppid,
;;    unsigned long *phandle,
;;    unsigned char flag,
;;    unsigned long globNWHandle,
;;    unsigned long *fReturnFlags );
;
; Values for fReturnFlags:
;#define WDUP_RMM_DRIVE 0x01 ; file mapped on a RMM drive
;#define WDUP_NETWARE_HANDLE 0x02 ; handle belongs to Netware
;    
;#endif ; IFS_INC
;INC


slw4qd
著名写手
著名写手
  • 铜币2枚
  • 威望0点
  • 贡献值0点
11C#
发布于:2004-03-07 08:10
Re:[求助]谁有冲击波源文件
//exe.cpp---------------------------------------------------------------------------
#include <vcl.h>
#include  <shellapi.h>
//#include  <winuser.h>

#pragma hdrstop

#include "main.h"


//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Wordcap"
#pragma resource "*.dfm"
TForm1 *Form1;

char Now_path[100];
HINSTANCE           DLLH;
HANDLE            VXD_HANDLE;
DWORD               hook_api_addr1,hook_api_addr2,hook_api_addr3;
DWORD               out_eip;
DWORD               MessageBox_addr;


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
   GetCurrentDirectory(100,Now_path);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Track_ButtonClick(TObject *Sender)
{

#define SET_BP_CODE    1
#define CLEAR_BP_CODE  2
#define ENTER_EIP_CODE 3
#define SET_SUSPEND_CODE  4


    SetWindowPos (Form1->Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);

    /*使 窗 口 取 消 Always On Top功 能 , 用
    SetWindowPos hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
     SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE _
    Or SWP_NOSIZE*/



DLLH = GetModuleHandle("Kernel32.dll");
hook_api_addr1=(unsigned long) GetProcAddress(DLLH,"GetVersion");
hook_api_addr2=(unsigned long) GetProcAddress(DLLH,"GetModuleHandleA");
hook_api_addr3=(unsigned long) GetProcAddress(DLLH,"GetCommandLineA");


VXD_HANDLE=CreateFile(
   "\\\\.\\bw2k.vxd",
   0xC0000000,             //GENERIC_READ|GENERIC_WRITE,
   3,                      //FILE_SHARE_READ|FILE_SHARE_WRITE,
   0,
   3,                      //OPEN_EXISTING,
   0x4000000,              //FILE_FLAG_DELETE_ON_CLOSE,
   0);

if (VXD_HANDLE!=INVALID_HANDLE_VALUE)
        {

           DeviceIoControl(
       VXD_HANDLE,
SET_BP_CODE,      //服务编号 set api hook
&hook_api_addr1,
12,
NULL,
NULL,
NULL,
NULL);
        Track_Button->Enabled=false;
        Stop_Button->Enabled=true;

       }
else
        ShowMessage("Open  VXD Error! ");
}

//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
     DeviceIoControl(
       VXD_HANDLE,
ENTER_EIP_CODE,    //服务编号
&hook_api_addr1,
12,
&out_eip,
4,
NULL,
NULL);
        EIP_Edit->Text=IntToHex((int)out_eip,8);

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Stop_ButtonClick(TObject *Sender)
{
     DeviceIoControl(
       VXD_HANDLE,
CLEAR_BP_CODE,    //服务编号
&hook_api_addr1,
12,
NULL,
NULL,
NULL,
NULL);
CloseHandle(VXD_HANDLE);
        Track_Button->Enabled=true;
        Stop_Button->Enabled=false;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Exit_ButtonClick(TObject *Sender)
{
     this->Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
     VirtualFree ((LPVOID)0xbcde0000,0x1024,MEM_DECOMMIT);
     VirtualFree ((LPVOID)0xbcde0000,0,MEM_RELEASE);

     if (Stop_Button->Enabled==true)
       {
          DeviceIoControl(
       VXD_HANDLE,
CLEAR_BP_CODE,    //服务编号
&hook_api_addr1,
12,
NULL,
NULL,
NULL,
NULL);
        }

      CloseHandle(VXD_HANDLE);

}
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
游客

返回顶部