Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 2782 → Rev 2783

/programs/hd_load/9x2klbr/9x2klbr.asm
0,0 → 1,202
format PE GUI 4.0
section '.text' code readable executable
entry start
start:
push ebp
mov ebp, info
xor ebx, ebx
; set current directory to exe dir
push 300
push ebp
push ebx
call [GetModuleFileNameA]
lea edi, [ebp+eax]
xchg eax, ecx
mov al, '\'
std
repnz scasb
cld
jz @f
pop ebp
ret
@@:
mov byte [edi+1], bl
push ebp
call [SetCurrentDirectoryA]
; parse command line
call [GetCommandLineA]
xchg eax, esi
; skip leading spaces
@@:
lodsb
cmp al, 0
jz cmdlineend
cmp al, ' '
jbe @b
cmp al, '"'
jz p
; skip EXE name
@@:
lodsb
cmp al, ' '
ja @b
dec esi
jmp q
p:
lodsb
cmp al, 0
jz cmdlineend
cmp al, '"'
jnz p
q:
; skip leading spaces
lodsb
cmp al, 0
jz cmdlineend
cmp al, ' '
jbe q
dec esi
; now esi points to 1st argument
jmp @f
cmdlineend:
mov esi, def
@@:
mov al, 'c'
cmp byte [esi+1], ':'
jnz @f
lodsb
inc esi
@@:
mov [ebp], al
lodsb
cmp al, '\'
jz paramsok
usage:
mov esi, usagemsg
jmp failmsg
paramsok:
cmp byte [esi], '\'
jz usage
mov edi, esi
mov al, 0
xor ecx, ecx
dec ecx
repnz scasb
not ecx
cmp ecx, 290
jae usage
lea edi, [ebp+1]
cmp ecx, 1
rep movsb
jz copydefname
cmp byte [edi-2], '\'
jnz namegiven
copydefname:
dec edi
mov ecx, defnamesz
mov esi, defname
rep movsb
namegiven:
push ebx ; hTemplateFile
; push 0x04000000 ; dwFlagsAndAttributes = FILE_FLAG_DELETE_ON_CLOSE
push ebx
push ebx ; dwCreationDisposition
push ebx ; lpSecurityAttributes
push ebx ; dwShareMode
push ebx ; dwDesiredAccess
push name ; lpFileName
call [CreateFileA]
inc eax
mov esi, errmsg
jz failmsg
dec eax
push ebx
push ebx
push ebx
push ebx
sub edi, ebp
push edi
push ebp
push 0Fh
push eax
call [DeviceIoControl]
test eax, eax
mov esi, errmsg2
jz failmsg
push ebx
push 2 ; EWX_REBOOT
call [ExitWindowsEx]
pop ebp
ret
failmsg:
push ebx
push ebx
push esi
push ebx
call [MessageBoxA]
pop ebp
ret
 
align 4
data import
dd 0,0,0
dd rva kernel32_name
dd rva kernel32_thunks
dd 0,0,0
dd rva user32_name
dd rva user32_thunks
dd 0,0,0,0,0
kernel32_thunks:
CreateFileA dd rva CreateFileA_thunk
CloseHandle dd rva CloseHandle_thunk
DeviceIoControl dd rva DeviceIoControl_thunk
GetCommandLineA dd rva GetCommandLineA_thunk
SetCurrentDirectoryA dd rva SetCurrentDirectoryA_thunk
GetModuleFileNameA dd rva GetModuleFileNameA_thunk
dd 0
user32_thunks:
MessageBoxA dd rva MessageBoxA_thunk
ExitWindowsEx dd rva ExitWindowsEx_thunk
dw 0
CreateFileA_thunk:
dw 0
db 'CreateFileA'
CloseHandle_thunk:
dw 0
db 'CloseHandle'
DeviceIoControl_thunk:
dw 0
db 'DeviceIoControl'
GetCommandLineA_thunk:
dw 0
db 'GetCommandLineA'
SetCurrentDirectoryA_thunk:
dw 0
db 'SetCurrentDirectoryA'
GetModuleFileNameA_thunk:
dw 0
db 'GetModuleFileNameA'
MessageBoxA_thunk:
dw 0
db 'MessageBoxA'
ExitWindowsEx_thunk:
dw 0
db 'ExitWindowsEx',0
kernel32_name db 'kernel32.dll',0
user32_name db 'user32.dll',0
end data
 
section '.data' data readable writable
data resource from 'klbrico.res'
end data
 
name db '\\.\'
vxdfilename db 'ldklbr.vxd',0
errmsg db 'Cannot load driver',0
errmsg2 db 'Invalid parameter',0
usagemsg db 'Usage: 9x2klbr [[drive:]\[path\][imagename]]',0
def db '\'
defname db 'kolibri.img',0
defnamesz = $ - defname
 
info rb 300
/programs/hd_load/9x2klbr/DEFFILE.DEF
0,0 → 1,23
VXD LDKLBR DYNAMIC
 
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
_16ICODE CLASS '16ICODE' PRELOAD DISCARDABLE
_RCODE CLASS 'RCODE'
 
EXPORTS
 
LDKLBR_DDB @1
/programs/hd_load/9x2klbr/Klbrico.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/hd_load/9x2klbr/V86MMGR.INC
0,0 → 1,178
;******************************************************************************
;
; (C) Copyright MICROSOFT Corp., 1988-1990
;
; Title: V86MMGR.Inc - Public services for V86MMGR
;
; Version: 2.00
;
; Date: 29-Nov-88
;
; Author: ARR
;
;------------------------------------------------------------------------------
;
; Change log:
;
; DATE REV DESCRIPTION
; ----------- --- -----------------------------------------------------------
; 29-Nov-1988 ARR Original
; 26-Apr-1989 RAL New mapper services
;
;==============================================================================
 
Begin_Service_Table V86MMGR
 
V86MMGR_Service V86MMGR_Get_Version, LOCAL
V86MMGR_Service V86MMGR_Allocate_V86_Pages, LOCAL
V86MMGR_Service V86MMGR_Set_EMS_XMS_Limits, LOCAL
V86MMGR_Service V86MMGR_Get_EMS_XMS_Limits, LOCAL
;
; Services used for API mapping.
;
V86MMGR_Service V86MMGR_Set_Mapping_Info, VxD_ICODE
V86MMGR_Service V86MMGR_Get_Mapping_Info
V86MMGR_Service V86MMGR_Xlat_API
V86MMGR_Service V86MMGR_Load_Client_Ptr
V86MMGR_Service V86MMGR_Allocate_Buffer
V86MMGR_Service V86MMGR_Free_Buffer
V86MMGR_Service V86MMGR_Get_Xlat_Buff_State
V86MMGR_Service V86MMGR_Set_Xlat_Buff_State
V86MMGR_Service V86MMGR_Get_VM_Flat_Sel
V86MMGR_Service V86MMGR_Map_Pages
V86MMGR_Service V86MMGR_Free_Page_Map_Region
;***********************************************************
; END OF 3.00 level services
;
V86MMGR_Service V86MMGR_LocalGlobalReg
V86MMGR_Service V86MMGR_GetPgStatus, LOCAL
V86MMGR_Service V86MMGR_SetLocalA20, VxD_ICODE
V86MMGR_Service V86MMGR_ResetBasePages, LOCAL
V86MMGR_Service V86MMGR_SetAvailMapPgs, VxD_ICODE
V86MMGR_Service V86MMGR_NoUMBInitCalls, VxD_ICODE
 
IFNDEF WIN31COMPAT
 
; Services added post Win 3.1
V86MMGR_Service V86MMGR_Get_EMS_XMS_Avail, LOCAL
V86MMGR_Service V86MMGR_Toggle_HMA
V86MMGR_Service V86MMGR_Dev_Init, LOCAL
V86MMGR_Service V86MMGR_Alloc_UM_Page, LOCAL
 
ENDIF ; WIN31COMPAT
 
ifdef NEC_98
;;V86MMGR_Service V86MMGR_EMM_B0Bank_CHK
V86MMGR_Service V86MMGR_Check_NHSupport, LOCAL
endif
 
End_Service_Table V86MMGR
 
;
; BITS of returned EAX flags for V86MMGR_GetPgStatus
;
V86PS_ROM equ 0000000000000001b ; Page contains global ROM
V86PS_RAM equ 0000000000000010b ; Page contains global RAM
V86PS_EMM equ 0000000010000000b ; Page belongs to EMM driver
V86PS_XMS equ 0000000100000000b ; Page belongs to XMS driver
V86PS_MAP equ 0000001000000000b ; Page belongs to mapper
V86PS_UMB equ 0001000000000000b ; Page contains imported UMB
; (Note that V86PS_XMS is not
; necessarily set)
 
;
; BITS of ECX flags for V86MMGR_Allocate_V86_Pages
;
AV86PLocked EQU 00000000000000000000000000000001B
AV86PLockedBit EQU 0 ; VM memory is to be
; ALWAYS LOCKED regardless of
; pager type or whether VM
; is suspended.
;
; BITS of ECX flags for V86MMGR_Set_EMS_XMS_Limits
;
; NOTE: If neither Limit_DisableHMA or Limit_EnableHMA is set, the HMA
; state is not altered.
;
EMS_XMS_Limit_DisableHMA EQU 00000000000000000000000000000001B
EMS_XMS_Limit_DisableHMABit EQU 0
EMS_XMS_Limit_EnableHMA EQU 00000000000000000000000000000010B
EMS_XMS_Limit_EnableHMABit EQU 1
EMS_XMS_Limit_XMS_Is_Locked EQU 00000000000000000000000000000100B
EMS_XMS_Limit_XMS_Is_LockedBit EQU 2
EMS_XMS_Limit_EMS_Is_Locked EQU 00000000000000000000000000001000B
EMS_XMS_Limit_EMS_Is_LockedBit EQU 3
 
 
 
;
; API mapper equates and macros
;
 
Xlat_Exec_Int EQU 000h
Xlat_Fixed_Len EQU 001h
Xlat_Var_Len EQU 002h
Xlat_Calc_Len EQU 003h
Xlat_ASCIIZ EQU 004h
Xlat_Jmp_To_Proc EQU 005h
Xlat_Return_Ptr EQU 006h
Xlat_Return_Seg EQU 007h
Xlat_ASCIIZ_InOut EQU 008h
 
 
Xlat_API_Exec_Int MACRO Int_Number
db Xlat_Exec_Int
db Int_Number
ENDM
 
Xlat_API_Fixed_Len MACRO Ptr_Seg, Ptr_Off, Length
db Xlat_Fixed_Len
dw Length
dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off
ENDM
 
Xlat_API_Var_Len MACRO Ptr_Seg, Ptr_Off, Len_Reg
db Xlat_Var_Len
db Client_&Len_Reg
dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off
ENDM
 
Xlat_API_Calc_Len MACRO Ptr_Seg, Ptr_Off, Calc_Proc_Addr
db Xlat_Calc_Len
dd OFFSET32 Calc_Proc_Addr
dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off
ENDM
 
Xlat_API_ASCIIZ MACRO Ptr_Seg, Ptr_Off
db Xlat_ASCIIZ
dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off
ENDM
 
Xlat_API_ASCIIZ_InOut MACRO Ptr_Seg, Ptr_Off
db Xlat_ASCIIZ_InOut
dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off
ENDM
 
Xlat_API_Jmp_To_Proc MACRO Proc_Name
db Xlat_Jmp_To_Proc
dd OFFSET32 Proc_Name
ENDM
 
 
Xlat_API_Return_Ptr MACRO Ptr_Seg, Ptr_Off
db Xlat_Return_Ptr
dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off
ENDM
 
Xlat_API_Return_Seg MACRO Ptr_Seg
db Xlat_Return_Seg
db Client_&Ptr_Seg
ENDM
 
;
; The V86MMGR does W386_Device_Broadcast call outs. The 'subfunction' number
; for these call outs is contained in the CX register. These are the equates
; for the subfunction numbers.
;
V86CallOut_LclA20forGlblHMA equ 0 ; Should A20 state be local
; even if HMA is GLOBAL?
/programs/hd_load/9x2klbr/VMM.INC
0,0 → 1,4522
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
WIN403SERVICES EQU 1
endif
ifndef WIN40COMPAT
WIN41SERVICES EQU 1
endif
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
 
 
 
 
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
DDS_DEVICE_ID EQU 0004AH
NTKERN_DEVICE_ID EQU 0004BH
VDOSKEYD_DEVICE_ID EQU 0004BH
ACPI_DEVICE_ID EQU 0004CH
UDF_DEVICE_ID EQU 0004DH
SMCLIB_DEVICE_ID EQU 0004EH
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
VWIN32_INIT_ORDER EQU 014100000H
VXDLDR_INIT_ORDER EQU 016000000H
NTKERN_INIT_ORDER EQU 016200000H
CONFIGMG_INIT_ORDER EQU 016400000H
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
ACPI_INIT_ORDER EQU ENUMERATOR_INIT_ORDER+2
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
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 <L0CKABLE_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_L0CKABLE_BEGIN_CODE_SEG
IFB <private>
PUBLIC name
ENDIF
name LABEL NEAR
ifdef BLD_COFF
DD ?
endif
VxD_L0CKABLE_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
ifdef BLD_COFF
DD ?
endif
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
 
 
_DB0START SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DB0START ENDS
 
 
_DB1CODE SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DB1CODE ENDS
 
 
_DB2DATA SEGMENT DWORD PUBLIC _FLAT 'DBOCODE'
_DB2DATA 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 _DB0START, _DB1CODE, _DB2DATA
IF DEBLEVEL
_PGROUP GROUP _PATHSTART, _PATHDATA, _PATHEND
ENDIF
ENDIF
 
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, StdCallBytes, fastcall
LOCAL $$&Procedure, extrnproc, tableproc
 
extrnproc MACRO
IFNB <fastcall>
IFB <StdCallBytes>
.err
ENDIF
EXTRN @&&Procedure&&@&&StdCallBytes:NEAR
ELSE
IFNB <StdCallBytes>
EXTRN _&&Procedure&&@&&StdCallBytes:NEAR
ELSE
EXTRN Procedure:NEAR
ENDIF
ENDIF
ENDM
 
tableproc MACRO
IFNB <fastcall>
dd OFFSET32 @&&Procedure&&@&&StdCallBytes
ELSE
IFNB <StdCallBytes>
dd OFFSET32 _&&Procedure&&@&&StdCallBytes
ELSE
dd OFFSET32 Procedure
ENDIF
ENDIF
ENDM
 
IFNB <Condition>
$$&&Procedure MACRO extern
IFDEF &Condition
IFNB <extern>
extrnproc
ELSE
tableproc
ENDIF
ELSE
IFB <extern>
dd 0
ENDIF
ENDIF
ENDM
ENDIF
 
IFDIFI <Procedure>, <RESERVED>
PUBLIC _&&Procedure
IF1
_&&Procedure LABEL DWORD
IFNB <fastcall>
PUBLIC __&&Procedure
__&&Procedure LABEL DWORD
ENDIF
ENDIF
IFDIFI <Local_Seg>, <LOCAL>
IFNB <Local_Seg>
Local_Seg&&_SEG
ELSE
Def_Segment&_CODE_SEG
ENDIF
IFNB <Condition>
$$&&Procedure extern
ELSE
extrnproc
ENDIF
IFNB <Local_Seg>
Local_Seg&&_ENDS
ELSE
Def_Segment&_CODE_ENDS
ENDIF
ENDIF
IFNB <Condition>
$$&&Procedure
ELSE
tableproc
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
Purge extrnproc
Purge tableproc
ENDM
 
Device_Name&_StdCall_Service MACRO Procedure, Args, Local_Seg, Condition
Device_Name&_Service Procedure, Local_Seg, Condition, %Args*4
??_standardccall&&_Procedure = Args
ENDM
 
Device_Name&_FastCall_Service MACRO Procedure, Args, Local_Seg, Condition
Device_Name&_Service Procedure, Local_Seg, Condition, %Args*4, TRUE
??_fastcall&&_Procedure = Args
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
 
Device_Name&_StdCall_Service MACRO Procedure, Args, Local_Seg, Condition
Device_Name&_Service Procedure, Local_Seg, Condition
??_standardccall_&&Procedure = Args
ENDM
 
Device_Name&_FastCall_Service MACRO Procedure, Args, Local_Seg, Condition
Device_Name&_Service Procedure, Local_Seg, Condition
??_fastcall_&&Procedure = Args
ENDM
 
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_ASYNC_THREAD_BIT EQU 1FH
THFLAG_ASYNC_THREAD EQU (1 SHL THFLAG_ASYNC_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
HEAPALIGN_SHIFT EQU 16
HEAPALIGN_MASK EQU 000F0000H
HEAPALIGN_4 EQU 00000000H
HEAPALIGN_8 EQU 00000000H
HEAPALIGN_16 EQU 00000000H
HEAPALIGN_32 EQU 00010000H
HEAPALIGN_64 EQU 00020000H
HEAPALIGN_128 EQU 00030000H
HEAPALIGN_256 EQU 00040000H
HEAPALIGN_512 EQU 00050000H
HEAPALIGN_1K EQU 00060000H
HEAPALIGN_2K EQU 00070000H
HEAPALIGN_4K EQU 00080000H
HEAPALIGN_8K EQU 00090000H
HEAPALIGN_16K EQU 000A0000H
HEAPALIGN_32K EQU 000B0000H
HEAPALIGN_64K EQU 000C0000H
HEAPALIGN_128K EQU 000D0000H
HEAPTYPESHIFT EQU 8
HEAPTYPEMASK EQU 00000700H
HEAPLOCKEDHIGH EQU 00000000H
HEAPLOCKEDIFDP EQU 00000100H
HEAPSWAP EQU 00000200H
HEAPINIT EQU 00000400H
HEAPCLEAN EQU 00000800H
HEAPCONTIG EQU 00001000H
HEAPFORGET EQU 00002000H
HEAPLOCKEDLOW EQU 00000300H
HEAPSYSVM EQU 00000500H
HEAPPREEMPT EQU 00000600H
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
PAGEPHYSONLY EQU 04000000H
PAGENOMOVE EQU 10000000H
PAGEMAPGLOBAL EQU 40000000H
PAGEMARKDIRTY EQU 80000000H
MAPV86_IGNOREWRAP EQU 00000001H
MPL_NonCached EQU 00000000H
MPL_HardwareCoherentCached EQU 00000001H
MPL_FrameBufferCached EQU 00000002H
MPL_Cached EQU 00000004H
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
ALLOCFROMEND EQU 40000000H
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_Service _Free_Temp_V86_Data_Area
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)
GMIF_80586_BIT EQU 15H
GMIF_80586 EQU (1 SHL GMIF_80586_BIT)
GMIF_4MEGPG_BIT EQU 16H
GMIF_4MEGPG EQU (1 SHL GMIF_4MEGPG_BIT)
GMIF_RDTSC_BIT EQU 17H
GMIF_RDTSC EQU (1 SHL GMIF_RDTSC_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)
DFS_WIMP_DEBUG EQU (DFS_RARE_SERVICES+2)
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_IS_ASCIIZ EQU 00000002H
ASSERT_RANGE_IS_NOT_ASCIIZ EQU 00000000H
ASSERT_RANGE_NO_DEBUG EQU 80000000H
ASSERT_RANGE_BITS EQU 80000003H
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
ifdef WIN403SERVICES
VMM_Service _PageOutPages
PAGEOUT_PRIVATE EQU 00000001H
PAGEOUT_SHARED EQU 00000002H
PAGEOUT_SYSTEM EQU 00000004H
PAGEOUT_REGION EQU 00000008H
PAGEOUT_ALL EQU (PAGEOUT_PRIVATE OR PAGEOUT_SHARED OR PAGEOUT_SYSTEM)
VMM_Service _Call_On_My_Not_Flat_Stack
VMM_Service _LinRegionLock
VMM_Service _LinRegionUnLock
VMM_Service _AttemptingSomethingDangerous
VMM_Service _Vsprintf
VMM_Service _Vsprintfw
VMM_Service Load_FS_Service
VMM_Service Assert_FS_Service
VMM_StdCall_Service ObsoleteRtlUnwind, 4
VMM_StdCall_Service ObsoleteRtlRaiseException, 1
VMM_StdCall_Service ObsoleteRtlRaiseStatus, 1
VMM_StdCall_Service ObsoleteKeGetCurrentIrql, 0
VMM_FastCall_Service ObsoleteKfRaiseIrql, 1
VMM_FastCall_Service ObsoleteKfLowerIrql, 1
VMM_Service _Begin_Preemptable_Code
VMM_Service _End_Preemptable_Code
VMM_FastCall_Service Set_Preemptable_Count, 1
VMM_StdCall_Service ObsoleteKeInitializeDpc, 3
VMM_StdCall_Service ObsoleteKeInsertQueueDpc, 3
VMM_StdCall_Service ObsoleteKeRemoveQueueDpc, 1
VMM_StdCall_Service HeapAllocateEx, 4
VMM_StdCall_Service HeapReAllocateEx, 5
VMM_StdCall_Service HeapGetSizeEx, 2
VMM_StdCall_Service HeapFreeEx, 2
VMM_Service _Get_CPUID_Flags
VMM_StdCall_Service KeCheckDivideByZeroTrap, 1
endif
ifdef WIN41SERVICES
VMM_Service _RegisterGARTHandler
VMM_Service _GARTReserve
VMM_Service _GARTCommit
VMM_Service _GARTUnCommit
VMM_Service _GARTFree
VMM_Service _GARTMemAttributes
VMM_StdCall_Service KfRaiseIrqlToDpcLevel, 0
VMM_Service VMMCreateThreadEx
VMM_Service _FlushCaches
PG_UNCACHED EQU 00000001H
PG_WRITECOMBINED EQU 00000002H
FLUSHCACHES_NORMAL EQU 00000000H
FLUSHCACHES_GET_CACHE_LINE_PTR EQU 00000001H
FLUSHCACHES_GET_CACHE_SIZE_PTR EQU 00000002H
FLUSHCACHES_TAKE_OVER EQU 00000003H
FLUSHCACHES_FORCE_PAGES_OUT EQU 00000004H
FLUSHCACHES_LOCK_LOCKABLE EQU 00000005H
FLUSHCACHES_UNLOCK_LOCKABLE EQU 00000006H
VMM_Service Set_Thread_Win32_Pri_NoYield
VMM_Service _FlushMappedCacheBlock
VMM_Service _ReleaseMappedCacheBlock
VMM_Service Run_Preemptable_Events
VMM_Service _MMPreSystemExit
VMM_Service _MMPageFileShutDown
VMM_Service _Set_Global_Time_Out_Ex
VMM_Service Query_Thread_Priority
endif
End_Service_Table VMM, VMM
COMNFS_FLAT EQU 0FFFFFFFFH
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
PC_CACHEDIS EQU 00100000H
PC_CACHEWT EQU 00080000H
PC_PAGEFLUSH EQU 00008000H
ifdef WRITE_WATCH
PC_WRITE_WATCH EQU 00200000H
endif
PCC_ZEROINIT EQU 00000001H
PCC_NOLIN EQU 10000000H
MTRR_UC EQU 0
MTRR_WC EQU 1
MTRR_WT EQU 4
MTRR_WP EQU 5
MTRR_WB EQU 6
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
 
ASD_MAX_REF_DATA EQU 256
 
_vmmguid STRUC
Data1 DD ?
Data2 DW ?
Data3 DW ?
Data4 DB 8 DUP (?)
_vmmguid ENDS
ASD_ERROR_NONE EQU 00000000H
ASD_CHECK_FAIL EQU 00000001H
ASD_CHECK_SUCCESS EQU 00000002H
ASD_CHECK_UNKNOWN EQU 00000003H
ASD_ERROR_BAD_TIME EQU 00000004H
ASD_REGISTRY_ERROR EQU 00000005H
ASD_CLEAN_BOOT EQU 00000006H
ASD_OUT_OF_MEMORY EQU 00000007H
ASD_FILE_ERROR EQU 00000008H
ASD_ALREADY_SET EQU 00000009H
ASD_MISSING_CHECK EQU 0000000AH
ASD_BAD_PARAMETER EQU 0000000BH
ASD_OP_CHECK_AND_WRITE_FAIL_IF_UNKNOWN EQU 00000000H
ASD_OP_CHECK_AND_ALWAYS_WRITE_FAIL EQU 00000001H
ASD_OP_CHECK EQU 00000002H
ASD_OP_DONE_AND_SET_SUCCESS EQU 00000003H
ASD_OP_SET_FAIL EQU 00000004H
ASD_OP_SET_SUCCESS EQU 00000005H
ASD_OP_SET_UNKNOWN EQU 00000006H
ASD_OP_DONE EQU 00000007H
ASD_FLAG_STRING EQU 00000001H
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
CREATE_PROCESS EQU 0033H
DESTROY_PROCESS EQU 0034H
ifndef WIN40COMPAT
SYS_DYNAMIC_DEVICE_REINIT EQU 0035H
endif
SYS_POWER_DOWN EQU 0036H
MAX_SYSTEM_CONTROL EQU 0036H
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
??_taframe = 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
??_fastcall = 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 or ??_fastcall
 
 
??_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 or ??_fastcall
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
 
 
 
ife ??_scall or ??_fastcall
?_BeginProc_Debug_Prologue
endif
 
 
 
endm
 
?_BeginProc_Debug_Prologue MACRO
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
 
?FASTCALL_BeginProc macro
??_fastcall = 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
?arg <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
a = ??_taframe
??_aframe = ??_aframe + 4
??_taframe = ??_taframe + 4
ifidni <length>,<BYTE>
?setname <name>, <byte ptr [??_basereg+??_initaframe+a]>, <used>
elseifidni <length>,<WORD>
?setname <name>, <word ptr [??_basereg+??_initaframe+a]>, <used>
elseifidni <length>,<DWORD>
?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
??_aframe = ??_aframe - 4 + ((length + 3)/4)*4
??_taframe = ??_taframe - 4 + ((length + 3)/4)*4
?setname <name>, <[??_basereg+??_initaframe+a]>, <used>
endif
endm
 
?arg macro name,length,used
if ??_fastcall
if ??_numargs le 2
if length gt 4
.err <First 2 parameters are dwords (ecx,edx) for fastcall functions>
endif
??_aframe = ??_aframe + 4
if ??_numargs eq 1
?merge ecx_,name,,,equ,ecx
else
?merge edx_,name,,,equ,edx
endif
else
?argvar name, length, used
endif
else
?argvar name, length, 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
?_BeginProc_Debug_Prologue
endif
if ??_fastcall
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
?_BeginProc_Debug_Prologue
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 (??_taframe 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 (??_taframe LT 8)
ret 8
else
ret ??_taframe
endif
else
ret
endif
??_procflags = ??_procflags OR ??_pf_Returned
endm
 
 
 
 
EndProc macro Name, Flag
Name endp
if ??_w32svc
if ??_taframe lt 8
cparm&Name equ 0
else
cparm&Name equ (??_taframe/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
ifdef ??_nonstandardccall_&name
PushCParams <arglst>, <FAST>
else
PushCParams <arglst>, <flags>
endif
call name
ifdef ??_nonstandardccall_&name
ClearCParams PRESERVE_FLAGS
else
ClearCParams <flags>
endif
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fCall macro name, arglst, flags
local ??saved
??saved = ??_pushed
ife .TYPE name
CondExtern name, near
endif
PushCParams <arglst>, <FASTCALL>
?scall @, name, %(??_argc * 4)
ifdef ??_nonstandardccall_&name
ClearCParams PRESERVE_FLAGS
else
ClearCParams <flags>
endif
??_pushed = ??saved
endm
.xcref fCall
 
 
 
 
 
iCall equ <sCall>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
IFNDEF STANDARD_CCALL
NONSTANDARD_CCALL = 1
ENDIF
 
PushCParams macro arglst, flags
LOCAL ??_pushedargs
 
??_argc = 0
IFDEF NONSTANDARD_CCALL
??_popargs = 0
ELSE
??_popargs = ??_align EQ 0
ENDIF
ifidni <flags>, <SMALL>
??_popargs = 1
elseifidni <flags>, <FAST>
??_popargs = 0
elseifidni <flags>, <FASTCALL>
??_popargs = 0
endif
 
irp x,<arglst>
??_argc = ??_argc + 1
ifidni <flags>, <FASTCALL>
if ??_argc eq 1
ifdifi <x>, <ecx>
.err <first parameter must be ECX for fastcall functions>
endif
elseif ??_argc eq 2
ifdifi <x>, <edx>
.err <first parameter must be EDX for fastcall functions>
endif
else
?marg <x>,%??_argc
endif
else
?marg <x>,%??_argc
endif
endm
?count = ??_argc
ifidni <flags>, <FASTCALL>
??_pushedargs = ??_argc-2
else
??_pushedargs = ??_argc
endif
if ??_pushedargs GT 0
rept ??_argc
?invprg <?AM>,%?count
?count = ?count - 1
endm
endif
endm
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ClearCParams macro fPreserveFlags
if ??_argc ne 0
if (??_popargs) AND (??_argc LE 2)
rept ??_argc
pop ecx
endm
elseifidni <fPreserveFlags>, <PRESERVE_FLAGS>
lea esp, [esp][??_argc * 4]
else
add esp,??_argc * 4
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 prefix, name1, name2
CondExtern prefix&name1&@&name2, near
call prefix&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_PREEMPTABLE_BIT EQU 14
PEF_WAIT_PREEMPTABLE EQU (1 SHL PEF_WAIT_PREEMPTABLE_BIT)
PEF_WAIT_FOR_PASSIVE_BIT EQU 15
PEF_WAIT_FOR_PASSIVE EQU (1 SHL PEF_WAIT_FOR_PASSIVE_BIT)
PEF_WAIT_FOR_APPY_BIT EQU 16
PEF_WAIT_FOR_APPY EQU (1 SHL PEF_WAIT_FOR_APPY_BIT)
PEF_WAIT_FOR_WORKER_BIT EQU 17
PEF_WAIT_FOR_WORKER EQU (1 SHL PEF_WAIT_FOR_WORKER_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
PEF_WAIT_FOR_CONFIGMG_CALLABLE EQU PEF_WAIT_FOR_WORKER
PEF_WAIT_FOR_CONFIGMG_QUICK EQU PEF_WAIT_FOR_APPY
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_res2 DW ?
Client_ES DW ?
Client_res3 DW ?
Client_DS DW ?
Client_res4 DW ?
Client_FS DW ?
Client_res5 DW ?
Client_GS DW ?
Client_res6 DW ?
Client_Alt_EIP DD ?
Client_Alt_CS DW ?
Client_res7 DW ?
Client_Alt_EFlags DD ?
Client_Alt_ESP DD ?
Client_Alt_SS DW ?
Client_res8 DW ?
Client_Alt_ES DW ?
Client_res9 DW ?
Client_Alt_DS DW ?
Client_res10 DW ?
Client_Alt_FS DW ?
Client_res11 DW ?
Client_Alt_GS DW ?
Client_res12 DW ?
Client_Reg_Struc ENDS
 
Client_Word_Reg_Struc STRUC
Client_DI DW ?
Client_res13 DW ?
Client_SI DW ?
Client_res14 DW ?
Client_BP DW ?
Client_res15 DW ?
Client_res16 DD ?
Client_BX DW ?
Client_res17 DW ?
Client_DX DW ?
Client_res18 DW ?
Client_CX DW ?
Client_res19 DW ?
Client_AX DW ?
Client_res20 DW ?
Client_res21 DD ?
Client_IP DW ?
Client_res22 DW ?
Client_res23 DD ?
Client_Flags DW ?
Client_res24 DW ?
Client_SP DW ?
Client_res25 DW ?
Client_res26 DD 5 DUP (?)
Client_Alt_IP DW ?
Client_res27 DW ?
Client_res28 DD ?
Client_Alt_Flags DW ?
Client_res29 DW ?
Client_Alt_SP DW ?
Client_Word_Reg_Struc ENDS
 
Client_Byte_Reg_Struc STRUC
Client_res30 DD 4 DUP (?)
Client_BL DB ?
Client_BH DB ?
Client_res31 DW ?
Client_DL DB ?
Client_DH DB ?
Client_res32 DW ?
Client_CL DB ?
Client_CH DB ?
Client_res33 DW ?
Client_AL DB ?
Client_AH DB ?
Client_Byte_Reg_Struc ENDS
?UnionSize = 0
if size Client_Reg_Struc gt ?UnionSize
?UnionSize = size Client_Reg_Struc
endif
CRS equ <(byte ptr 0)>
 
if size Client_Word_Reg_Struc gt ?UnionSize
?UnionSize = size Client_Word_Reg_Struc
endif
CWRS equ <(byte ptr 0)>
 
if size Client_Byte_Reg_Struc gt ?UnionSize
?UnionSize = size Client_Byte_Reg_Struc
endif
CBRS equ <(byte ptr 0)>
 
 
tagCLIENT_STRUC STRUC
DB ?UnionSize dup(?)
tagCLIENT_STRUC ENDS
 
IF 0
.ERRNZ Client_SP - Client_ESP
.ERRNZ Client_AL - Client_EAX
 
endif
DYNA_LINK_INT EQU 20H
 
 
 
 
 
 
 
 
 
 
 
 
DeclareNonstandardCcallService macro arglst
irp x,<arglst>
??_nonstandardccall_&&x = 1
endm
endm
 
 
 
 
 
 
DeclareNonstandardCcallService <_BlockOnID, _LocalizeSprintf>
DeclareNonstandardCcallService <_SetLastV86Page>
 
BeginDoc
 
 
 
 
 
 
 
 
 
 
 
 
 
EndDoc
 
 
BeginDoc
 
 
 
 
 
 
 
 
EndDoc
 
DefTable MACRO vt, vn
vt EQU <vn>
ENDM
 
GenDD2 MACRO vt, sn, jf
dd OFFSET32 vt[sn+jf]
ENDM
 
GenDD MACRO P, vid, snum, jflag
LOCAL vtable
IFDEF @@VxDName&vid
Deftable vtable, %@@VxDName&vid
EXTRN vtable:DWORD
GenDD2 %vtable, snum, jflag
ELSE
dd @@&P+jflag
ENDIF
 
ENDM
 
 
VxDCall MACRO P, Param, flags
??_vxdid = (@@&P SHR 16)
??_servicenum = (@@&P AND 0FFFFh)
 
ifdef ??_standardccall_&P
PushCParams <Param>, <FAST>
.errnz ??_argc ne ??_standardccall_&P, <wrong # of parameters passed to &P&>
else
ifdef ??_fastcall_&P
PushCParams <Param>, <FASTCALL>
.errnz ??_argc ne (??_fastcall_&P), <wrong # of parameters passed to fastcall function &P&>
else
ifdef ??_nonstandardccall_&P
PushCParams <Param>, <flags>
else
PushCParams <Param>, <FAST>
endif
endif
endif
int Dyna_Link_Int
GenDD P, %??_vxdid, %??_servicenum, 0
ifndef ??_standardccall_&P
ifndef ??_fastcall_&P
ifdef ??_nonstandardccall_&P
ClearCParams PRESERVE_FLAGS
else
ClearCParams
endif
else
if(??_argc gt 2)
??_pushed = ??_pushed - ((??_argc - 2) * 4)
endif
endif
else
??_pushed = ??_pushed - (??_argc * 4)
endif
ENDM
 
VxDJmp MACRO P, Param
??_vxdid = (@@&P SHR 16)
??_servicenum = (@@&P AND 0FFFFh)
ifdef ??_fastcall_&P
PushCParams <Param>, <FASTCALL>
.errnz ??_argc gt 2, <More than 2 parameters may not be passed to fastcall functions thru VxDJmp>
else
.errnb <Param>, <Parameters may not be passed to VxDJmp or VMMJmp>
endif
int Dyna_Link_Int
GenDD P, %??_vxdid, %??_servicenum, DL_Jmp_Mask
ENDM
 
DL_Jmp_Mask EQU 8000h
DL_Jmp_Bit EQU 0Fh
 
VMMCall MACRO P, Param
.ERRNZ (@@&P SHR 16) - VMM_DEVICE_ID
VxDCall <P>, <Param>
ENDM
 
VMMJmp MACRO P, Param
.ERRNZ (@@&P SHR 16) - VMM_DEVICE_ID
VxDJmp <P>, <Param>
ENDM
 
WDMCall MACRO P, Param, flags
ifdef ??_standardccall_&P
PushCParams <Param>, <FAST>
.errnz ??_argc ne ??_standardccall_&P, <wrong # of parameters passed to &P&>
else
ifdef ??_fastcall_&P
PushCParams <Param>, <FASTCALL>
.errnz ??_argc ne (??_fastcall_&P), <wrong # of parameters passed to fastcall function &P&>
else
ifdef ??_nonstandardccall_&P
PushCParams <Param>, <flags>
else
PushCParams <Param>, <FAST>
endif
endif
endif
mov eax,WDM@@&P
int WDM_DynaLink_Int
nop
nop
nop
ifndef ??_standardccall_&P
ifndef ??_fastcall_&P
ifdef ??_nonstandardccall_&P
ClearCParams PRESERVE_FLAGS
else
ClearCParams
endif
else
if(??_argc gt 2)
??_pushed = ??_pushed - ((??_argc - 2) * 4)
endif
endif
else
??_pushed = ??_pushed - (??_argc * 4)
endif
ENDM
 
WDMJmp MACRO P, Param
ifdef ??_fastcall_&P
PushCParams <Param>, <FASTCALL>
.errnz ??_argc gt 2, <More than 2 parameters may not be passed to fastcall functions thru VxDJmp>
else
.errnb <Param>, <Parameters may not be passed to WDMJmp>
endif
mov eax, WDM@@&P+WDM_DL_Jmp_Mask
int WDM_DynaLink_Int
nop
nop
nop
ENDM
 
WDM_DL_Jmp_Mask EQU 80000000h
WDM_DL_Jmp_Bit EQU 31
 
BeginDoc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
EndDoc
 
 
 
 
VxD_CODE_SEG EQU <VxD_LOCKED_CODE_SEG>
VxD_CODE_ENDS EQU <VxD_LOCKED_CODE_ENDS>
 
 
VxD_LOCKED_CODE_SEG MACRO
_LTEXT SEGMENT
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_LCODE
ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
 
ENDM
 
VxD_LOCKED_CODE_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
_LTEXT ENDS
ENDM
 
 
 
 
VxD_PAGEABLE_CODE_SEG MACRO
_PTEXT SEGMENT
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_PCODE
ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
 
ENDM
 
VxD_PAGEABLE_CODE_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
_PTEXT ENDS
ENDM
 
 
 
 
VxD_DEBUG_ONLY_CODE_SEG MACRO
_DB1CODE SEGMENT
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_DBOCODE
ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
ENDM
 
VxD_DEBUG_ONLY_CODE_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
_DB1CODE ENDS
ENDM
 
 
 
 
VxD_INIT_CODE_SEG MACRO
_ITEXT SEGMENT
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_ICODE
ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
ENDM
 
VxD_INIT_CODE_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
_ITEXT ENDS
ENDM
 
VxD_ICODE_SEG equ VxD_INIT_CODE_SEG
VxD_ICODE_ENDS equ VxD_INIT_CODE_ENDS
 
 
 
 
VxD_DATA_SEG EQU <VxD_LOCKED_DATA_SEG>
VxD_DATA_ENDS EQU <VxD_LOCKED_DATA_ENDS>
 
VxD_LOCKED_DATA_SEG MACRO NO_ALIGN
_LDATA SEGMENT
IFB <NO_ALIGN>
ALIGN 4
ENDIF
ENDM
 
VxD_LOCKED_DATA_ENDS MACRO
_LDATA ENDS
ENDM
 
 
 
 
VxD_IDATA_SEG MACRO
_IDATA SEGMENT
ENDM
VxD_IDATA_ENDS MACRO
_IDATA ENDS
ENDM
 
 
 
 
VxD_PAGEABLE_DATA_SEG MACRO NO_ALIGN
_PDATA SEGMENT
IFB <NO_ALIGN>
ALIGN 4
ENDIF
ENDM
 
VxD_PAGEABLE_DATA_ENDS MACRO
_PDATA ENDS
ENDM
 
 
 
 
VxD_STATIC_CODE_SEG MACRO
_STEXT SEGMENT
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_SCODE
ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
 
ENDM
 
VxD_STATIC_CODE_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
_STEXT ENDS
ENDM
 
 
 
 
VxD_STATIC_DATA_SEG MACRO NO_ALIGN
_SDATA SEGMENT
IFB <NO_ALIGN>
ALIGN 4
ENDIF
ENDM
 
VxD_STATIC_DATA_ENDS MACRO
_SDATA ENDS
ENDM
 
 
 
VxD_DEBUG_ONLY_DATA_SEG MACRO NO_ALIGN
_DB2DATA SEGMENT
IFB <NO_ALIGN>
ALIGN 4
ENDIF
ENDM
 
VxD_DEBUG_ONLY_DATA_ENDS MACRO
_DB2DATA ENDS
ENDM
 
 
 
 
VxD_16BIT_INIT_SEG MACRO
_16ICODE SEGMENT
ASSUME CS:_16ICODE, DS:NOTHING, ES:NOTHING, SS:NOTHING
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_16ICODE
ENDM
 
VxD_16BIT_INIT_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
_16ICODE ENDS
ENDM
 
 
 
VxD_REAL_INIT_SEG MACRO
_RCODE SEGMENT
ASSUME CS:_RCODE, DS:_RCODE, ES:_RCODE, SS:_RCODE
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_RCODE
ENDM
 
VxD_REAL_INIT_ENDS MACRO
??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4
_RCODE ENDS
ENDM
 
endif
ifndef DDK_VERSION
ifdef WIN31COMPAT
DDK_VERSION EQU 30AH
else
ifdef WIN40COMPAT
DDK_VERSION EQU 400H
else
DDK_VERSION EQU 40AH
endif
endif
endif
 
VxD_Desc_Block STRUC
DDB_Next DD ?
DDB_SDK_Version DW DDK_VERSION
DDB_Req_Device_Number DW UNDEFINED_DEVICE_ID
DDB_Dev_Major_Version DB 0
DDB_Dev_Minor_Version DB 0
DDB_Flags DW 0
DDB_Name DB " "
DDB_Init_Order DD UNDEFINED_INIT_ORDER
DDB_Control_Proc DD ?
DDB_V86_API_Proc DD 0
DDB_PM_API_Proc DD 0
DDB_V86_API_CSIP DD 0
DDB_PM_API_CSIP DD 0
DDB_Reference_Data DD ?
DDB_Service_Table_Ptr DD 0
DDB_Service_Table_Size DD 0
DDB_Win32_Service_Table DD 0
DDB_Prev DD 'Prev'
DDB_Size DD SIZE(VxD_Desc_Block)
DDB_Reserved1 DD 'Rsv1'
DDB_Reserved2 DD 'Rsv2'
DDB_Reserved3 DD 'Rsv3'
VxD_Desc_Block ENDS
ifndef Not_VxD
DDB_SYS_CRIT_INIT_DONE_BIT EQU 0
DDB_SYS_CRIT_INIT_DONE EQU (1 SHL DDB_SYS_CRIT_INIT_DONE_BIT)
DDB_DEVICE_INIT_DONE_BIT EQU 1
DDB_DEVICE_INIT_DONE EQU (1 SHL DDB_DEVICE_INIT_DONE_BIT)
DDB_HAS_WIN32_SVCS_BIT EQU 14
DDB_HAS_WIN32_SVCS EQU (1 SHL DDB_HAS_WIN32_SVCS_BIT)
DDB_DYNAMIC_VXD_BIT EQU 15
DDB_DYNAMIC_VXD EQU (1 SHL DDB_DYNAMIC_VXD_BIT)
DDB_DEVICE_DYNALINKED_BIT EQU 13
DDB_DEVICE_DYNALINKED EQU (1 SHL DDB_DEVICE_DYNALINKED_BIT)
BeginDoc
 
 
 
 
 
 
 
EndDoc
Declare_Virtual_Device MACRO Name, Major_Ver, Minor_Ver, Ctrl_Proc, Device_Num, Init_Order, V86_Proc, PM_Proc, Reference_Data
LOCAL V86_API_Offset, PM_API_Offset, Serv_Tab_Offset, Serv_Tab_Len, Ref_Data_Offset
 
dev_id_err MACRO
 
IFNDEF Name&_Name_Based
.err <Device ID required when providing services>
ENDIF
ENDM
 
IFB <V86_Proc>
V86_API_Offset EQU 0
ELSE
IFB <Device_Num>
dev_id_err
ENDIF
V86_API_Offset EQU <OFFSET32 V86_Proc>
ENDIF
 
IFB <PM_Proc>
PM_API_Offset EQU 0
ELSE
IFB <Device_Num>
dev_id_err
ENDIF
PM_API_Offset EQU <OFFSET32 PM_Proc>
ENDIF
 
IFDEF Name&_Service_Table
IFB <Device_Num>
dev_id_err
ELSE
IFE Device_Num - UNDEFINED_DEVICE_ID
dev_id_err
ENDIF
ENDIF
Serv_Tab_Offset EQU <OFFSET32 Name&_Service_Table>
Serv_Tab_Len EQU Num_&Name&_Services
ELSE
Serv_Tab_Offset EQU 0
Serv_Tab_Len EQU 0
ENDIF
 
IFNB <Device_Num>
.erre (Device_Num LT BASEID_FOR_NAMEBASEDVXD), <Device ID must be less than BASEID_FOR_NAMEBASEDVXD>
ENDIF
 
IFB <Reference_Data>
Ref_Data_Offset EQU 0
ELSE
Ref_Data_Offset EQU <OFFSET32 Reference_Data>
ENDIF
 
IFDEF DEBUG
VxD_IDATA_SEG
db 0dh, 0ah, 'D_E_B_U_G===>'
db "&Name", '<===', 0dh, 0ah
VxD_IDATA_ENDS
ENDIF
 
VxD_LOCKED_DATA_SEG
 
PUBLIC Name&_DDB
Name&_DDB VxD_Desc_Block <,,Device_Num,Major_Ver,Minor_Ver,,"&Name",Init_Order,\
OFFSET32 Ctrl_Proc, V86_API_Offset, PM_API_Offset, \
,,Ref_Data_Offset,Serv_Tab_Offset, Serv_Tab_Len>
 
VxD_LOCKED_DATA_ENDS
 
ENDM
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Begin_Control_Dispatch MACRO VxD_Name, p1, p2
??_cd_low = 0FFFFFFFFh
??_cd_high = 0
 
BeginProc VxD_Name&_Control, p1, p2, LOCKED
ENDM
 
End_Control_Dispatch MACRO VxD_Name
LOCAL ignore, table
 
procoff MACRO num
IFDEF ??_cd_&&num
dd OFFSET32 ??_cd_&&num
ELSE
dd OFFSET32 ignore
ENDIF
ENDM
 
IF ??_cd_low EQ ??_cd_high
cmp eax, ??_cd_low
?merge <jz>,,,,,<??_cd_>, %(??_cd_low)
clc
ret
ELSE
IF ??_cd_low GT 0
sub eax, ??_cd_low
ENDIF
cmp eax, ??_cd_high - ??_cd_low + 1
jae short ignore
jmp [eax*4+table]
ignore:
clc
ret
 
table label dword
REPT ??_cd_high - ??_cd_low + 1
procoff %(??_cd_low)
??_cd_low = ??_cd_low + 1
ENDM
ENDIF
 
EndProc VxD_Name&_Control
 
PURGE procoff
PURGE Begin_Control_Dispatch
PURGE Control_Dispatch
PURGE End_Control_Dispatch
ENDM
 
BeginDoc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
EndDoc
Control_Dispatch MACRO Service, Procedure, callc, arglst
LOCAL Skip_Interseg_Jump
 
.errnz ?_LCODE, <Control_Dispatch must be in VxD_LOCKED_CODE_SEG.>
 
IFB <callc>
 
IFDEF ??_cd_low
Equate_Service MACRO Serv
??_cd_&&Serv equ Procedure
ENDM
 
Equate_Service %(Service)
 
IF Service LT ??_cd_low
??_cd_low = Service
ENDIF
IF Service GT ??_cd_high
??_cd_high = Service
ENDIF
 
PURGE Equate_Service
 
ELSE
cmp eax, Service
jz Procedure
ENDIF
 
ELSE
 
cmp eax, Service
jne SHORT Skip_Interseg_Jump
callc Procedure, <arglst>
IF Service EQ PNP_NEW_DEVNODE
stc
ELSE
cmp eax,1
ENDIF
ret
Skip_Interseg_Jump:
 
ENDIF
 
ENDM
 
BYTE_INPUT EQU 000H
BYTE_OUTPUT EQU 004H
WORD_INPUT EQU 008H
WORD_OUTPUT EQU 00CH
DWORD_INPUT EQU 010H
DWORD_OUTPUT EQU 014H
OUTPUT_BIT EQU 2
OUTPUT EQU (1 SHL OUTPUT_BIT)
WORD_IO_BIT EQU 3
WORD_IO EQU (1 SHL WORD_IO_BIT)
DWORD_IO_BIT EQU 4
DWORD_IO EQU (1 SHL DWORD_IO_BIT)
STRING_IO_BIT EQU 5
STRING_IO EQU (1 SHL STRING_IO_BIT)
REP_IO_BIT EQU 6
REP_IO EQU (1 SHL REP_IO_BIT)
ADDR_32_IO_BIT EQU 7
ADDR_32_IO EQU (1 SHL ADDR_32_IO_BIT)
REVERSE_IO_BIT EQU 8
REVERSE_IO EQU (1 SHL REVERSE_IO_BIT)
IO_SEG_MASK EQU 0FFFF0000H
IO_SEG_SHIFT EQU 10H
BeginDoc
 
 
 
 
 
 
EndDoc
Dispatch_Byte_IO MACRO In_Proc, Out_Proc
LOCAL Byte_IO
cmp ecx, Byte_Output
jbe SHORT Byte_IO
VMMJmp Simulate_IO
Byte_IO:
IFIDNI <In_Proc>, <Fall_Through>
je Out_Proc
ELSE
IFIDNI <Out_Proc>, <Fall_Through>
jb In_Proc
ELSE
je Out_Proc
jmp In_Proc
ENDIF
ENDIF
ENDM
 
BeginDoc
 
 
 
 
 
 
 
EndDoc
Emulate_Non_Byte_IO MACRO
LOCAL Byte_IO
cmp ecx, Byte_Output
jbe SHORT Byte_IO
VMMJmp Simulate_IO
Byte_IO:
ENDM
 
BeginDoc
 
 
 
 
 
 
 
 
EndDoc
 
 
VxD_IOT_Hdr STRUC
VxD_IO_Ports DW ?
VxD_IOT_Hdr ENDS
 
VxD_IO_Struc STRUC
VxD_IO_Port DW ?
VxD_IO_Proc DD ?
VxD_IO_Struc ENDS
.ERRNZ SIZE VxD_IOT_Hdr - 2
Begin_VxD_IO_Table MACRO Table_Name
PUBLIC Table_Name
Table_Name LABEL WORD
 
ifndef MASM6
IF2
IFNDEF Table_Name&_Entries
.err <No End_VxD_IO_Table for &Table_Name>
ENDIF
dw Table_Name&_Entries
ELSE
dw ?
ENDIF
ELSE
dw Table_Name&_Entries
ENDIF
 
ENDM
 
.ERRNZ SIZE VxD_IO_Struc - 6
VxD_IO MACRO Port, Proc_Name
dw Port
dd OFFSET32 Proc_Name
ENDM
 
End_VxD_IO_Table MACRO Table_Name
 
IFNDEF Table_Name
.err <No Begin_VxD_IO_Table for &Table_Name>
ELSE
Table_Name&_Entries EQU (($-Table_Name)-2) / (SIZE VxD_IO_Struc)
IF Table_Name&_Entries LE 0
.err <Invalid number of port traps in &Table_Name>
ENDIF
ENDIF
ENDM
 
 
 
 
 
 
 
 
 
 
 
 
 
Push_Client_State MACRO Can_Trash_EDI
sub esp, SIZE Client_Reg_Struc
??_pushed = ??_pushed + SIZE Client_Reg_Struc
ifidni <Can_Trash_EDI>, <USES_EDI>
mov edi, esp
VMMCall Save_Client_State
else
push edi
lea edi, [esp+4]
VMMCall Save_Client_State
pop edi
endif
ENDM
 
Pop_Client_State MACRO Can_Trash_ESI
ifdifi <Can_Trash_ESI>, <USES_ESI>
push esi
lea esi, [esp+4]
VMMCall Restore_Client_State
pop esi
else
mov esi, esp
VMMCall Restore_Client_State
endif
add esp, SIZE Client_Reg_Struc
??_pushed = ??_pushed - SIZE Client_Reg_Struc
ENDM
 
BeginDoc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
EndDoc
 
CallRet MACRO P1, P2
IFDEF DEBUG
IFIDNI <P1>, <SHORT>
call P2
ELSE
call P1
ENDIF
ret
ELSE
jmp P1 P2
ENDIF
ENDM
 
BeginDoc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
EndDoc
 
CallJmp MACRO Function_Name, Return_Label
IFDEF DEBUG
call Function_Name
jmp Return_Label
ELSE
push Return_Label
jmp Function_Name
ENDIF
ENDM
 
 
BeginDoc
 
 
 
 
 
 
EndDoc
 
IFDEF DEBUG
 
VxDCallRet macro p:req
VxDCall p
ret
endm
 
VMMCallRet macro p:req
VMMCall p
ret
endm
 
ELSE
 
VxDCallRet equ <VxDJmp>
VMMCallRet equ <VMMJmp>
 
ENDIF
 
 
 
PClient_DS equ WORD PTR -4
PClient_ES equ WORD PTR -8
PClient_FS equ WORD PTR -12
PClient_GS equ WORD PTR -16
 
 
 
 
 
 
 
 
 
 
 
Client_Ptr_Flat MACRO Reg_32, Cli_Seg, Cli_Off, Can_Trash_EAX
 
IFDIFI <Reg_32>, <EAX>
IFDIFI <Can_Trash_EAX>, <USES_EAX>
xchg Reg_32, eax
ENDIF
ENDIF
IFB <Cli_Off>
mov ax, (Client_&Cli_Seg * 100h) + 0FFh
ELSE
mov ax, (Client_&Cli_Seg * 100h) + Client_&Cli_Off
ENDIF
VMMCall Map_Flat
 
IFDIFI <Reg_32>, <EAX>
xchg Reg_32, eax
ENDIF
 
ENDM
 
 
 
VxDint MACRO Int_Number
if (OPATTR Int_Number) AND 4
push Int_Number
else
push DWORD PTR Int_Number
endif
VMMCall Exec_VxD_Int
ENDM
 
VxDintMustComplete MACRO Int_Number
if (OPATTR Int_Number) AND 4
push Int_Number
else
push DWORD PTR Int_Number
endif
VMMCall _ExecVxDIntMustComplete
ENDM
 
Load_FS macro
VMMCall Load_FS_Service
endm
 
endif
DUPLICATE_DEVICE_ID_BIT EQU 0
DUPLICATE_DEVICE_ID EQU (1 SHL DUPLICATE_DEVICE_ID_BIT)
DUPLICATE_FROM_INT2F_BIT EQU 1
DUPLICATE_FROM_INT2F EQU (1 SHL DUPLICATE_FROM_INT2F_BIT)
LOADING_FROM_INT2F_BIT EQU 2
LOADING_FROM_INT2F EQU (1 SHL LOADING_FROM_INT2F_BIT)
DEVICE_LOAD_OK EQU 0
ABORT_DEVICE_LOAD EQU 1
ABORT_WIN386_LOAD EQU 2
DEVICE_NOT_NEEDED EQU 3
NO_FAIL_MESSAGE_BIT EQU 15
NO_FAIL_MESSAGE EQU (1 SHL NO_FAIL_MESSAGE_BIT)
LDRSRV_GET_PROFILE_STRING EQU 0
LDRSRV_GET_NEXT_PROFILE_STRING EQU 1
LDRSRV_RESERVED EQU 2
LDRSRV_GET_PROFILE_BOOLEAN EQU 3
LDRSRV_GET_PROFILE_DECIMAL_INT EQU 4
LDRSRV_GET_PROFILE_HEX_INT EQU 5
LDRSRV_COPY_EXTENDED_MEMORY EQU 6
LDRSRV_GET_MEMORY_INFO EQU 7
LDRSRV_RegOpenKey EQU 100H
LDRSRV_RegCreateKey EQU 101H
LDRSRV_RegCloseKey EQU 102H
LDRSRV_RegDeleteKey EQU 103H
LDRSRV_RegSetValue EQU 104H
LDRSRV_RegQueryValue EQU 105H
LDRSRV_RegEnumKey EQU 106H
LDRSRV_RegDeleteValue EQU 107H
LDRSRV_RegEnumValue EQU 108H
LDRSRV_RegQueryValueEx EQU 109H
LDRSRV_RegSetValueEx EQU 10AH
LDRSRV_RegFlushKey EQU 10BH
LDRSRV_COPY_INIT EQU 1
LDRSRV_COPY_LOCKED EQU 2
LDRSRV_COPY_PAGEABLE EQU 3
RCODE_OBJ EQU -1
LCODE_OBJ EQU 01H
LDATA_OBJ EQU 02H
PCODE_OBJ EQU 03H
PDATA_OBJ EQU 04H
SCODE_OBJ EQU 05H
SDATA_OBJ EQU 06H
CODE16_OBJ EQU 07H
LMSG_OBJ EQU 08H
PMSG_OBJ EQU 09H
DBOC_OBJ EQU 0BH
DBOD_OBJ EQU 0CH
PLCODE_OBJ EQU 0DH
PPCODE_OBJ EQU 0FH
ICODE_OBJ EQU 11H
IDATA_OBJ EQU 12H
ICODE16_OBJ EQU 13H
IMSG_OBJ EQU 14H
 
ObjectLocation STRUC
OL_LinearAddr DD ?
OL_Size DD ?
OL_ObjType DB ?
ObjectLocation ENDS
MAXOBJECTS EQU 25
 
Device_Location_List STRUC
DLL_DDB DD ?
DLL_NumObjects DB ?
DLL_ObjLocation DB SIZE ObjectLocation * 1 DUP (?)
Device_Location_List ENDS
PE_BIT EQU 0
PE_MASK EQU (1 SHL PE_BIT)
MP_BIT EQU 1
MP_MASK EQU (1 SHL MP_BIT)
EM_BIT EQU 2
EM_MASK EQU (1 SHL EM_BIT)
TS_BIT EQU 3
TS_MASK EQU (1 SHL TS_BIT)
ET_BIT EQU 4
ET_MASK EQU (1 SHL ET_BIT)
PG_BIT EQU 31
PG_MASK EQU (1 SHL PG_BIT)
CF_BIT EQU 0
CF_MASK EQU (1 SHL CF_BIT)
PF_BIT EQU 2
PF_MASK EQU (1 SHL PF_BIT)
AF_BIT EQU 4
AF_MASK EQU (1 SHL AF_BIT)
ZF_BIT EQU 6
ZF_MASK EQU (1 SHL ZF_BIT)
SF_BIT EQU 7
SF_MASK EQU (1 SHL SF_BIT)
TF_BIT EQU 8
TF_MASK EQU (1 SHL TF_BIT)
IF_BIT EQU 9
IF_MASK EQU (1 SHL IF_BIT)
DF_BIT EQU 10
DF_MASK EQU (1 SHL DF_BIT)
OF_BIT EQU 11
OF_MASK EQU (1 SHL OF_BIT)
IOPL_MASK EQU 3000H
IOPL_BIT0 EQU 12
IOPL_BIT1 EQU 13
NT_BIT EQU 14
NT_MASK EQU (1 SHL NT_BIT)
RF_BIT EQU 16
RF_MASK EQU (1 SHL RF_BIT)
VM_BIT EQU 17
VM_MASK EQU (1 SHL VM_BIT)
AC_BIT EQU 18
AC_MASK EQU (1 SHL AC_BIT)
VIF_BIT EQU 19
VIF_MASK EQU (1 SHL VIF_BIT)
VIP_BIT EQU 20
VIP_MASK EQU (1 SHL VIP_BIT)
 
 
 
 
 
 
IFDEF MASM6
loopde EQU <looped>
loopdne EQU <loopned>
loopdz EQU <loopzd>
loopdnz EQU <loopnzd>
ELSE
loopd EQU <loop>
loopde EQU <loope>
loopdne EQU <loopne>
loopdz EQU <loopz>
loopdnz EQU <loopnz>
ENDIF
 
P_SIZE EQU 1000H
P_PRESBIT EQU 0
P_PRES EQU (1 SHL P_PRESBIT)
P_WRITEBIT EQU 1
P_WRITE EQU (1 SHL P_WRITEBIT)
P_USERBIT EQU 2
P_USER EQU (1 SHL P_USERBIT)
P_ACCBIT EQU 5
P_ACC EQU (1 SHL P_ACCBIT)
P_DIRTYBIT EQU 6
P_DIRTY EQU (1 SHL P_DIRTYBIT)
P_AVAIL EQU (P_PRES+P_WRITE+P_USER)
PG_VM EQU 0
PG_SYS EQU 1
PG_RESERVED1 EQU 2
PG_PRIVATE EQU 3
PG_RESERVED2 EQU 4
PG_RELOCK EQU 5
PG_INSTANCE EQU 6
PG_HOOKED EQU 7
PG_IGNORE EQU 0FFFFFFFFH
D_PRES EQU 080H
D_NOTPRES EQU 0
D_DPL0 EQU 0
D_DPL1 EQU 020H
D_DPL2 EQU 040H
D_DPL3 EQU 060H
D_SEG EQU 010H
D_CTRL EQU 0
D_GRAN_BYTE EQU 000H
D_GRAN_PAGE EQU 080H
D_DEF16 EQU 000H
D_DEF32 EQU 040H
D_CODE EQU 08H
D_DATA EQU 0
D_X EQU 0
D_RX EQU 02H
D_C EQU 04H
D_R EQU 0
D_W EQU 02H
D_ED EQU 04H
D_ACCESSED EQU 1
RW_DATA_TYPE EQU (D_PRES+D_SEG+D_DATA+D_W)
R_DATA_TYPE EQU (D_PRES+D_SEG+D_DATA+D_R)
CODE_TYPE EQU (D_PRES+D_SEG+D_CODE+D_RX)
D_PAGE32 EQU (D_GRAN_PAGE+D_DEF32)
SELECTOR_MASK EQU 0FFF8H
SEL_LOW_MASK EQU 0F8H
TABLE_MASK EQU 04H
RPL_MASK EQU 03H
RPL_CLR EQU (NOT RPL_MASK)
IVT_ROM_DATA_SIZE EQU 500H
endif
/programs/hd_load/9x2klbr/comp_ldr.bat
0,0 → 1,0
fasm 9x2klbr.asm 9x2klbr.exe
/programs/hd_load/9x2klbr/compile.txt
0,0 → 1,12
Èçìåíåíèå êîäà mtldr òðåáóåò ïåðåêîìïèëÿöèè VxD.
Èçìåíåíèå êîäà VxD òðåáóåò ïåðåêîìïèëÿöèè VxD.
Èçìåíåíèå êîäà exe-øíèêà îòðàæàåòñÿ òîëüêî íà exe-øíèêå.
Ïîñëå êîìïèëÿöèè mtldr òðåáóåòñÿ ïåðåãíàòü áèíàðíèê mtldr â inc-ôàéë,
ïîíÿòíûé masm'ó. Ýòî äåëàåòñÿ ÷åðåç bintodb (âçÿòîãî èç ïàêåòà masm):
File->Open->mtldr, ïîäðåäàêòèðîâàòü ïî ñóùåñòâóþùåìó îáðàçöó,
File->Save->mtldr.inc.
Äëÿ êîìïèëÿöèè mtldr è 9x2klbr.exe òðåáóåòñÿ fasm, äëÿ êîìïèëÿöèè ldklbr.vxd
òðåáóåòñÿ ïàêåò masm.
Êîìïèëèðóþùèå bat-íèêè ïðèëàãàþòñÿ.
diamond
mailto: diamondz@land.ru
/programs/hd_load/9x2klbr/make_vxd.bat
0,0 → 1,2
ml /coff /c /Cx /DMASM6 /DBLD_COFF /DIS_32 vxd.asm
link /vxd /stub:masmstub /def:deffile.def vxd.obj
/programs/hd_load/9x2klbr/masmstub
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/hd_load/9x2klbr/mtldr
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/hd_load/9x2klbr/mtldr.inc
0,0 → 1,204
mtldr_size = 3224
mtldr:
db 255,255,255,255,128,208,12,250,176,17,230,32,227,0,230,160
db 227,0,176,8,230,33,227,0,176,112,230,161,227,0,176,4
db 230,33,227,0,176,2,230,161,227,0,176,1,230,33,227,0
db 230,161,227,0,176,0,230,33,227,0,230,161,227,0,184,3
db 0,205,16,176,52,230,67,227,0,176,255,230,64,227,0,230
db 64,227,0,184,1,194,205,21,233,184,1,172,132,192,116,9
db 180,14,187,7,0,205,16,235,242,195,102,3,6,0,208,102
db 96,102,59,6,152,220,114,55,128,62,228,208,0,116,93,102
db 104,0,0,0,0,102,80,6,83,102,104,16,0,1,0,184
db 0,66,138,22,4,208,137,230,30,22,31,205,19,31,131,196
db 16,102,97,114,55,129,195,0,2,102,64,73,117,193,195,102
db 49,210,102,15,183,14,158,220,102,247,241,254,194,136,209,102
db 15,164,194,16,247,54,156,220,136,214,136,197,192,228,6,8
db 225,184,1,2,138,22,4,208,205,19,235,197,190,229,208,232
db 121,255,235,254,0,68,105,115,107,32,114,101,97,100,32,101
db 114,114,111,114,33,0,2,32,75,111,108,105,98,114,105,79
db 83,32,98,111,111,116,108,111,97,100,101,114,44,32,114,117
db 110,110,105,110,103,32,111,110,32,0,117,110,107,110,111,119
db 110,32,102,105,108,101,115,121,115,116,101,109,44,32,99,97
db 110,110,111,116,32,99,111,110,116,105,110,117,101,0,70,65
db 84,49,50,47,70,65,84,49,54,32,45,32,117,110,115,117
db 112,112,111,114,116,101,100,13,10,0,70,65,84,51,50,13
db 10,0,78,84,70,83,13,10,0,69,114,114,111,114,58,32
db 0,77,70,84,0,92,0,36,73,78,68,69,88,95,82,79
db 79,84,32,110,111,116,32,102,111,117,110,100,0,99,97,110
db 110,111,116,32,114,101,97,100,32,97,116,116,114,105,98,117
db 116,101,0,36,68,65,84,65,32,110,111,116,32,102,111,117
db 110,100,0,105,115,32,97,32,100,105,114,101,99,116,111,114
db 121,0,110,111,116,32,97,32,100,105,114,101,99,116,111,114
db 121,0,116,111,111,32,102,114,97,103,109,101,110,116,101,100
db 32,102,105,108,101,0,101,120,116,101,110,100,101,100,32,109
db 101,109,111,114,121,32,101,114,114,111,114,0,98,97,100,32
db 99,108,117,115,116,101,114,0,100,97,116,97,32,101,114,114
db 111,114,0,49,192,142,216,142,192,142,208,102,188,254,255,0
db 0,252,251,138,22,4,208,180,8,205,19,115,5,185,255,255
db 136,206,15,182,198,64,163,156,220,136,202,131,226,63,137,22
db 158,220,247,226,134,205,192,237,6,65,137,14,160,220,247,225
db 163,152,220,137,22,154,220,138,22,4,208,180,65,187,170,85
db 205,19,114,15,129,251,85,170,117,9,246,193,1,116,4,254
db 6,228,208,190,246,208,232,226,253,102,161,0,208,102,131,248
db 255,117,20,102,49,192,185,1,0,187,0,5,232,224,253,102
db 161,198,6,102,163,0,208,185,1,0,187,0,5,232,207,253
db 15,182,6,13,5,163,172,220,102,129,62,54,5,70,65,84
db 49,116,29,102,129,62,82,5,70,65,84,51,116,26,102,129
db 62,3,5,78,84,70,83,15,132,231,0,232,141,253,235,254
db 190,62,209,232,133,253,235,254,190,90,209,232,125,253,102,15
db 183,6,11,5,102,15,182,30,13,5,102,247,227,102,163,180
db 220,102,15,183,30,14,5,102,137,30,200,220,102,15,182,6
db 16,5,102,247,38,36,5,102,1,216,102,15,182,30,13,5
db 102,41,216,102,41,216,102,163,166,220,129,6,5,208,0,208
db 102,161,44,5,199,6,164,220,117,209,80,139,54,5,208,86
db 172,60,92,116,4,60,0,117,247,103,135,68,36,2,198,68
db 255,0,137,54,5,208,232,114,3,89,132,201,116,13,246,69
db 11,16,190,194,209,15,132,58,3,235,207,246,69,11,16,190
db 179,209,15,133,45,3,191,5,0,104,0,32,7,38,198,69
db 251,1,38,102,199,69,252,1,0,0,0,102,171,6,30,7
db 232,242,3,7,115,36,38,102,139,77,248,38,102,3,77,252
db 102,57,200,116,14,38,102,199,5,1,0,0,0,102,175,102
db 171,235,218,38,102,255,69,248,235,211,102,49,192,102,171,233
db 184,0,190,98,209,232,163,252,102,15,183,6,11,5,102,80
db 102,15,182,30,13,5,102,247,227,102,163,180,220,102,199,6
db 166,220,0,0,0,0,102,139,14,64,5,128,249,0,127,12
db 246,217,102,49,192,102,64,102,211,224,235,3,102,247,225,102
db 163,184,220,102,91,102,49,210,102,247,243,163,188,220,199,6
db 164,220,113,209,102,15,182,6,13,5,102,247,38,48,5,139
db 14,188,220,187,0,64,137,223,83,232,78,252,232,152,3,95
db 184,128,0,187,0,7,232,39,4,190,163,209,15,130,99,2
db 137,30,162,220,129,6,5,208,0,208,102,184,5,0,0,0
db 199,6,164,220,117,209,80,139,54,5,208,86,172,60,92,116
db 4,60,0,117,247,103,135,68,36,2,198,68,255,0,137,54
db 5,208,232,121,6,89,132,201,117,220,49,246,6,15,161,100
db 172,60,0,190,141,209,15,132,25,2,190,1,0,102,49,255
db 104,0,16,7,49,219,100,102,173,102,145,103,227,66,100,102
db 173,102,96,102,15,182,14,13,5,102,247,225,102,3,6,166
db 220,232,198,251,180,135,102,139,14,180,220,102,81,209,233,190
db 83,214,6,30,7,205,21,7,132,228,190,230,209,15,133,210
db 1,102,89,102,1,14,109,214,102,97,102,64,226,195,235,182
db 30,7,199,6,164,220,141,220,102,49,192,187,0,5,185,1
db 0,232,46,1,161,14,5,3,6,28,5,163,200,220,147,15
db 182,6,16,5,247,38,22,5,1,216,187,0,7,139,14,17
db 5,131,193,15,193,233,4,232,8,1,1,200,163,170,220,193
db 225,9,137,223,1,203,198,7,0,128,61,0,190,169,209,15
db 132,112,1,190,141,220,232,237,1,116,8,131,231,224,131,199
db 32,235,230,131,231,224,190,179,209,246,69,11,16,15,133,82
db 1,139,69,26,80,72,72,15,182,14,13,5,247,225,3,6
db 170,220,163,174,220,247,54,172,220,102,15,183,192,104,0,32
db 31,190,1,0,102,43,4,114,17,102,131,60,0,104,141,209
db 15,132,32,1,89,131,198,8,235,234,102,3,4,102,3,68
db 4,106,0,31,102,15,183,14,172,220,82,102,247,225,90,102
db 15,183,210,102,1,208,102,3,6,166,220,102,163,176,220,88
db 104,0,16,7,80,49,219,232,87,0,193,225,5,140,192,1
db 200,142,192,88,232,13,0,114,235,184,75,76,190,130,220,234
db 0,0,0,16,187,0,7,80,209,232,103,3,4,36,137,194
db 193,232,9,3,6,200,220,185,2,0,6,30,7,232,50,0
db 7,129,226,255,1,1,211,139,7,89,247,193,1,0,116,3
db 193,232,4,37,255,15,190,252,209,61,247,15,15,132,147,0
db 195,72,72,15,182,14,13,5,247,225,3,6,170,220,102,15
db 183,192,102,96,102,15,183,219,190,83,214,102,193,224,9,102
db 5,0,0,16,147,102,137,68,18,102,184,0,0,48,9,140
db 192,102,193,224,4,102,1,216,102,137,68,26,180,135,193,225
db 8,6,106,0,7,205,21,7,128,252,0,190,230,209,117,67
db 102,97,195,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,255,255,0,0,1,147,0,0,255,255,0,0,16
db 147,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,86,190,105,209,232,193,249,139,54,164,220,232,186
db 249,190,110,209,232,180,249,94,232,176,249,235,254,103,139,116
db 36,2,137,54,164,220,104,169,209,235,217,187,0,9,137,223
db 102,80,232,153,0,139,14,180,220,193,233,5,102,88,128,61
db 0,116,218,103,139,116,36,2,102,80,232,57,0,116,17,131
db 231,224,131,199,32,226,229,102,88,232,137,0,115,191,114,203
db 102,88,103,139,116,36,2,137,54,164,220,131,231,224,190,179
db 209,139,69,20,102,193,224,16,139,69,26,102,133,192,190,163
db 209,116,128,194,2,0,81,185,9,0,172,60,46,116,21,60
db 0,116,35,60,97,114,7,60,122,119,3,128,13,32,174,225
db 233,65,89,195,176,32,73,243,174,117,246,247,199,1,0,117
db 240,185,4,0,235,212,176,32,73,243,174,117,228,247,199,1
db 0,117,7,185,3,0,243,174,117,215,49,201,89,195,102,37
db 255,255,255,15,102,15,182,14,13,5,102,247,225,102,3,6
db 166,220,233,245,248,187,0,7,102,80,102,193,232,7,102,59
db 6,137,220,116,15,102,163,137,220,102,3,6,200,220,185,1
db 0,232,214,248,102,88,102,131,224,127,103,102,139,4,133,0
db 7,0,0,102,37,255,255,255,15,102,61,247,255,255,15,190
db 252,209,15,132,221,254,195,139,93,4,139,77,6,67,1,251
db 67,129,199,254,1,73,139,7,171,67,67,129,199,254,1,226
db 245,195,3,125,20,131,61,255,116,20,57,5,117,11,61,128
db 0,117,13,128,125,9,0,116,7,3,125,4,235,231,49,255
db 195,3,116,32,102,49,219,172,132,192,116,78,104,141,209,15
db 182,200,193,233,4,15,132,139,254,146,131,226,15,15,132,131
db 254,1,206,1,214,88,86,78,102,15,190,4,73,116,9,78
db 102,193,224,8,138,4,226,247,102,149,78,102,15,190,4,137
db 209,73,116,9,78,102,193,224,8,138,4,226,247,94,102,1
db 235,102,171,102,137,216,102,171,235,173,102,49,192,102,171,195
db 87,80,38,198,7,1,67,83,137,30,196,220,3,125,20,232
db 115,255,133,255,116,42,128,125,8,0,117,22,137,254,95,79
db 176,0,170,139,68,16,171,145,3,116,20,243,164,137,251,88
db 95,195,102,131,125,16,0,117,214,137,254,95,232,98,255,87
db 103,131,124,36,2,32,15,132,173,0,103,139,124,36,4,184
db 32,0,232,45,255,133,255,15,132,156,0,6,187,0,192,103
db 139,124,36,6,83,255,54,196,220,30,7,232,146,255,143,6
db 196,220,94,187,0,128,83,86,232,136,0,94,91,1,218,103
db 139,68,36,4,7,57,7,117,103,61,128,0,117,6,128,127
db 6,0,117,92,102,131,127,16,0,116,85,102,131,127,8,0
db 117,13,80,103,139,68,36,2,59,6,196,220,88,117,65,102
db 96,102,139,71,16,137,211,255,54,196,220,6,30,7,232,142
db 0,7,143,6,196,220,102,97,102,96,137,215,3,125,20,232
db 179,254,102,139,71,8,102,59,69,16,117,243,137,254,103,139
db 124,36,32,131,239,4,232,184,254,103,137,124,36,32,102,97
db 3,95,4,57,211,114,142,91,88,95,59,30,196,220,117,2
db 75,249,195,172,60,0,117,11,173,102,15,183,208,145,137,223
db 243,164,195,102,49,210,102,173,102,145,103,227,47,102,173,102
db 151,102,81,102,139,14,180,220,102,137,248,102,247,225,83,232
db 232,246,91,102,89,102,71,102,161,180,220,102,1,194,102,193
db 232,4,140,197,1,197,142,197,226,215,235,202,142,193,195,190
db 0,7,102,139,14,184,220,102,247,225,83,255,54,164,220,199
db 6,164,220,113,209,232,9,0,143,6,164,220,95,232,247,253
db 195,104,141,209,128,60,0,117,53,102,133,210,15,133,196,252
db 102,61,0,0,1,0,15,131,186,252,102,129,249,0,0,1
db 0,15,131,175,252,59,68,2,15,131,168,252,59,76,2,15
db 135,161,252,131,198,3,1,198,137,223,243,164,88,195,102,139
db 62,180,220,102,247,247,137,22,196,220,1,209,102,80,102,145
db 102,49,210,102,72,102,247,247,102,64,102,145,102,88,131,198
db 1,102,49,210,83,102,139,28,102,133,219,15,132,169,0,102
db 1,218,131,198,8,102,57,208,115,235,102,139,124,252,102,82
db 102,87,102,41,194,102,1,223,102,41,215,102,57,202,114,3
db 102,137,202,131,62,196,220,0,117,47,102,96,102,15,182,30
db 13,5,146,247,227,145,102,151,102,247,227,103,139,92,36,40
db 232,247,245,103,137,92,36,40,102,97,102,1,208,102,41,209
db 102,95,102,90,117,159,91,88,195,102,81,102,15,182,14,13
db 5,102,137,248,102,82,102,247,225,104,0,16,7,49,219,232
db 200,245,137,217,86,87,139,54,196,220,103,139,124,36,20,41
db 241,30,6,31,7,243,164,103,137,124,36,20,6,31,95,94
db 102,90,102,89,102,71,199,6,196,220,0,0,102,64,102,73
db 116,174,102,74,117,132,235,162,190,141,209,233,181,251,139,30
db 162,220,137,30,198,220,83,232,181,254,161,184,220,1,6,162
db 220,95,184,144,0,87,139,30,162,220,137,30,192,220,232,79
db 253,190,119,209,15,130,139,251,137,30,162,220,95,184,160,0
db 139,30,162,220,137,30,194,220,232,53,253,115,6,199,6,194
db 220,0,0,137,30,162,220,139,54,192,220,139,30,162,220,232
db 33,254,102,139,111,8,131,195,16,3,31,246,71,12,2,117
db 44,103,139,116,36,2,15,182,79,80,141,127,82,49,192,172
db 60,97,114,7,60,122,119,3,128,13,32,175,225,241,114,13
db 119,6,103,128,62,0,116,64,3,95,8,235,206,246,71,12
db 1,15,132,56,251,131,62,194,220,0,15,132,47,251,3,95
db 8,102,139,71,248,102,247,38,180,220,139,54,194,220,102,137
db 233,139,30,162,220,232,41,254,139,62,162,220,232,24,252,139
db 30,162,220,131,195,24,235,145,103,139,116,36,2,137,54,164
db 220,103,128,124,36,4,0,116,25,190,194,209,246,71,75,16
db 15,132,207,250,102,139,7,139,30,198,220,137,30,162,220,194
db 2,0,190,179,209,246,71,75,16,15,133,182,250,102,139,7
db 139,30,198,220,137,30,162,220,187,0,64,83,232,176,253,95
db 184,128,0,104,0,32,7,49,219,232,84,252,190,163,209,15
db 132,144,250,137,30,162,220,194,2,0,14,31,14,7,187,0
db 5,137,222,185,1,0,81,102,161,176,220,102,80,232,74,244
db 104,0,16,7,49,255,185,8,0,243,167,190,8,210,15,133
db 97,250,128,14,145,208,1,128,14,211,208,1,49,219,102,88
db 89,232,38,244,128,38,144,208,254,128,38,211,208,253,102,199
db 6,101,214,0,0,1,147,102,15,183,6,174,220,102,193,224
db 9,102,5,0,0,16,147,102,163,109,214,190,83,214,30,7
db 180,135,185,0,1,205,21,128,252,0,190,230,209,15,133,18
db 250,203,1,1,0,10,220,0,0,255,255,255,255,107,101,114
db 110,101,108,46,109,110,116,0
/programs/hd_load/9x2klbr/mtldr_code/compile.bat
0,0 → 1,4
fasm mtldr.asm ..\mtldr
cd ..
bintodb
cd mtldr_code
/programs/hd_load/9x2klbr/mtldr_code/fat32.inc
0,0 → 1,112
fat32_parse_dir:
; in: eax=directory cluster
; out: eax=entry cluster
mov bx, 900h
mov di, bx
push eax
call read_cluster
mov cx, word [cluster_size]
shr cx, 5 ; div 20h
.scan_cluster:
pop eax
cmp byte [di], 0
jz file_not_found
mov si, [esp+2]
push eax
call fat_compare_name
jz .file_found
and di, not 1Fh
add di, 20h
loop .scan_cluster
pop eax
call next_cluster
jnc file_not_found
jc fat32_parse_dir
.file_found:
pop eax
mov si, [esp+2]
mov [cur_obj], si
and di, not 1Fh
mov si, directory_string
mov ax, [di+14h]
shl eax, 10h
mov ax, [di+1Ah]
test eax, eax
mov si, nodata_string
jz find_error_si
ret 2
 
fat_compare_name:
push cx
mov cx, 9
.scan:
lodsb
cmp al, '.'
jz .ext
cmp al, 0
jz .nameend
cmp al, 'a'
jb .notletter
cmp al, 'z'
ja .notletter
or byte [di], 20h
.notletter:
scasb
loopz .scan
.notfound:
inc cx ; to clear ZF flag
pop cx
ret
.ext:
mov al, ' '
dec cx
repz scasb
jnz .notfound
test di, 1
jnz .notfound
mov cx, 4
jmp .scan
.nameend:
mov al, ' '
dec cx
repz scasb
jnz .notfound
test di, 1
jnz .file_found
mov cx, 3
repz scasb
jnz .notfound
.file_found:
xor cx, cx ; to set ZF flag
pop cx
ret
 
read_cluster:
; in: eax=cluster,bx->buffer
and eax, 0FFFFFFFh
movzx ecx, byte [50Dh] ; sects_per_clust
mul ecx
add eax, [data_start]
; call read
; ret
jmp relative_read
next_cluster:
mov bx, 700h
; sector is 200h bytes long, one entry in FAT occupies 4 bytes => 80h entries in sector
push eax
shr eax, 7 ; div 80h
cmp eax, [fat_cur_sector]
jz @f
mov [fat_cur_sector], eax
add eax, [fat_start]
mov cx, 1
call relative_read
@@:
pop eax
and eax, 7Fh
mov eax, [700h+eax*4]
and eax, 0FFFFFFFh
cmp eax, 0FFFFFF7h
mov si, bad_cluster_string
jz find_error_si
ret
/programs/hd_load/9x2klbr/mtldr_code/mtldr.asm
0,0 → 1,733
; KolibriOS bootloader
; this code has been written by diamond in 2005,2006 specially for KolibriOS
 
format binary
use16
 
org 0xD000
 
; may be changed from ldklbr.vxd
partition_start dd -1
boot_drive db 80h
imgnameofs dw menuet_img_name - 0xD000
 
macro out_delay port
{
out port, al
jcxz $+2
}
 
cli
; reprogram IRQs
mov al, 11h
out_delay 20h
out_delay 0A0h
mov al, 8
out_delay 21h
mov al, 70h
out_delay 0A1h
mov al, 4
out_delay 21h
mov al, 2
out_delay 0A1h
mov al, 1
out_delay 21h
out_delay 0A1h
 
mov al, 0
out_delay 21h
out_delay 0A1h
; set videomode
mov ax, 3
int 10h
; reprogram timer
mov al, 00110100b
out_delay 43h
mov al, 0FFh
out_delay 40h
out_delay 40h
 
; reset mouse
mov ax, 0C201h
int 15h
 
jmp start
 
out_string:
lodsb
test al, al
jz .xxx
mov ah, 0Eh
mov bx, 7
int 10h
jmp out_string
.xxx: ret
 
relative_read:
add eax, [partition_start]
 
; read from hard disk
; drive_size must be already initialized
; in: eax = absolute sector
; cx = number of sectors
; es:bx -> buffer
read:
pushad
cmp eax, [drive_size]
jb .old_style
; new style - LBA, function 42
cmp [has_lba], 0
jz disk_error
; allocate disk address packet on the stack
; qword +8: absolute block number
push dword 0 ; dword +C is high dword
push eax ; dword +8 is low dword
; dword +4: buffer address
push es ; word +6 is segment
push bx ; word +4 is offset
; word +2: number of blocks = 1
; word +0: size of packet = 10h
push dword 10010h
; now pair ss:sp contain address of disk address packet
.patch1:
mov ax, 4200h
mov dl, [boot_drive]
mov si, sp
push ds
push ss
pop ds
int 13h
pop ds
add sp, 10h
.end:
popad
jc disk_error
add bx, 200h
inc eax
dec cx
jnz read
ret
.old_style:
; old style - CHS, function 2
; convert absolute sector in eax to cylinder-head-sector coordinates
; calculate sector
xor edx, edx
movzx ecx, [sectors]
div ecx
; sectors are counted from 1
inc dl
mov cl, dl ; low 6 bits of cl = sector number
; calculate head number
shld edx, eax, 10h ; convert eax to dx:ax
div [heads]
mov dh, dl ; dh = head
mov ch, al ; ch = low 8 bits of cylinder
shl ah, 6
or cl, ah ; high 2 bits of cl = high 2 bits of cylinder
.patch2:
mov ax, 201h ; function 2, al=1 - number of sectors
mov dl, [boot_drive]
int 13h
jmp .end
 
disk_error:
mov si, disk_error_msg
call out_string
jmp $
 
has_lba db 0
 
disk_error_msg db 'Disk read error!',0
start_msg db 2,' KolibriOS bootloader, running on ',0
errfs_msg db 'unknown filesystem, cannot continue',0
fat16_msg db 'FAT12/FAT16 - unsupported',13,10,0
fat32_msg db 'FAT32',13,10,0
ntfs_msg db 'NTFS',13,10,0
error_msg db 'Error'
colon db ': ',0
mft_string db 'MFT',0
root_string db '\',0
noindex_string db '$INDEX_ROOT not found',0
invalid_read_request_string db 'cannot read attribute',0
nodata_string db '$DATA '
notfound_string db 'not found',0
directory_string db 'is a directory',0
notdir_string db 'not a directory',0
fragmented_string db 'too fragmented file',0
exmem_string db 'extended memory error',0
bad_cluster_string db 'bad cluster',0
data_error_msg db 'data error',0
 
start:
xor ax, ax
mov ds, ax
mov es, ax
; our stack is 4Kb-2b!!! (0xFFE)
mov ss, ax
mov esp, 0FFFEh
cld
sti
; calculate drive size
mov dl, [boot_drive]
mov ah, 8 ; 8 = get drive parameters
int 13h
; now: CF is set on error;
; ch = low 8 bits of maximum cylinder number
; cl : low 6 bits makes maximum sector number, high 2 bits are high 2 bits of maximum cylinder number
; dh = maximum head number
jnc @f
mov cx, -1
mov dh, cl
@@:
movzx ax, dh
inc ax
; ax = number of heads
mov [heads], ax
mov dl, cl
and dx, 3Fh
; dx = number of sectors
; (note that sectors are counted from 1, and maximum sector number = number of sectors)
mov [sectors], dx
mul dx
xchg cl, ch
shr ch, 6
inc cx
; cx = number of cylinders
mov [cyls], cx
mul cx
mov word [drive_size], ax
mov word [drive_size+2], dx
; this drive supports LBA?
mov dl, [boot_drive]
mov ah, 41h
mov bx, 55AAh
int 13h
jc .no_lba
cmp bx, 0AA55h
jnz .no_lba
test cl, 1
jz .no_lba
inc [has_lba]
.no_lba:
; say hi to user
mov si, start_msg
call out_string
mov eax, [partition_start]
cmp eax, -1
jnz @f
; now read first sector to determine file system type
; first sector of disk is MBR sector
xor eax, eax
mov cx, 1
mov bx, 500h
call read
mov eax, [6C6h] ; first disk
mov [partition_start], eax
@@:
mov cx, 1
mov bx, 500h
call read
movzx ax, byte [50Dh]
mov [sect_per_clust], ax
; determine file system
cmp dword [536h], 'FAT1'
jz fat1x
cmp dword [552h], 'FAT3'
jz fat32
cmp dword [503h], 'NTFS'
jz ntfs
; mov si, errfs_msg ; already is
call out_string
jmp $
fat1x:
mov si, fat16_msg
call out_string
jmp $
fat32:
mov si, fat32_msg
call out_string
movzx eax, word [50Bh] ; bytes_per_sect
movzx ebx, byte [50Dh] ; sects_per_clust
mul ebx
mov [cluster_size], eax
movzx ebx, word [50Eh] ; reserved_sect
mov [fat_start], ebx
movzx eax, byte [510h] ; num_fats
mul dword [524h] ; sect_fat
add eax, ebx
; cluster 2 begins from sector eax
movzx ebx, byte [50Dh] ; sects_per_clust
sub eax, ebx
sub eax, ebx
mov [data_start], eax
; parse image name
add [imgnameofs], 0xD000
mov eax, [52Ch] ; root_cluster
mov [cur_obj], root_string
.parsedir:
push ax
mov si, [imgnameofs]
push si
@@:
lodsb
cmp al, '\'
jz @f
cmp al, 0
jnz @b
@@:
xchg ax, [esp+2]
mov byte [si-1], 0
mov [imgnameofs], si
call fat32_parse_dir
pop cx
test cl, cl
jz .end
test byte [di+0Bh], 10h
mov si, notdir_string
jz find_error_si
jmp .parsedir
.end:
test byte [di+0Bh], 10h
mov si, directory_string
jnz find_error_si
; parse FAT chunk
; runlist at 2000:0000
mov di, 5
push 2000h
pop es
mov byte [es:di-5], 1 ; of course, non-resident
mov dword [es:di-4], 1
stosd
.parsefat:
push es
push ds
pop es
call next_cluster
pop es
jnc .done
mov ecx, [es:di-8]
add ecx, [es:di-4]
cmp eax, ecx
jz .contc
mov dword [es:di], 1
scasd
stosd
jmp .parsefat
.contc:
inc dword [es:di-8]
jmp .parsefat
.done:
xor eax, eax
stosd
jmp read_img_file
 
ntfs:
mov si, ntfs_msg
call out_string
movzx eax, word [50Bh] ; bpb_bytes_per_sect
push eax
movzx ebx, byte [50Dh] ; bpb_sects_per_clust
mul ebx
mov [cluster_size], eax
mov [data_start], 0
mov ecx, [540h] ; frs_size
cmp cl, 0
jg .1
neg cl
xor eax, eax
inc eax
shl eax, cl
jmp .2
.1:
mul ecx
.2:
mov [frs_size], eax
pop ebx
xor edx, edx
div ebx
mov [frs_sectors], ax
; read first MFT record - description of MFT itself
mov [cur_obj], mft_string
movzx eax, byte [50Dh] ; bpb_sects_per_clust
mul dword [530h] ; mft_cluster
mov cx, [frs_sectors]
mov bx, 4000h
mov di, bx
push bx
call relative_read
call restore_usa
; scan for unnamed $DATA attribute
pop di
mov ax, 80h ; $DATA
mov bx, 700h
call load_attr
mov si, nodata_string
jc find_error_si
mov [free], bx
; load menuet.img
; parse image name
add [imgnameofs], 0xD000
mov eax, 5 ; root cluster
mov [cur_obj], root_string
.parsedir:
push ax
mov si, [imgnameofs]
push si
@@:
lodsb
cmp al, '\'
jz @f
cmp al, 0
jnz @b
@@:
xchg ax, [esp+2]
mov byte [si-1], 0
mov [imgnameofs], si
call ntfs_parse_dir
pop cx
test cl, cl
jnz .parsedir
read_img_file:
xor si, si
push es
pop fs
; yes! Now read file to 0x100000
lods byte [fs:si]
cmp al, 0 ; assume nonresident attr
mov si, invalid_read_request_string
jz find_error_si
mov si, 1
xor edi, edi
; read buffer to 1000:0000 and move it to extended memory
push 1000h
pop es
xor bx, bx
.img_read_block:
lods dword [fs:si] ; eax=length
xchg eax, ecx
jecxz .img_read_done
lods dword [fs:si] ; eax=disk cluster
.img_read_cluster:
pushad
; read part of file
movzx ecx, byte [50Dh]
mul ecx
add eax, [data_start]
call relative_read
; move it to extended memory
mov ah, 87h
mov ecx, [cluster_size]
push ecx
shr cx, 1
mov si, movedesc
push es
push ds
pop es
int 15h
pop es
test ah, ah
mov si, exmem_string
jnz find_error_si
pop ecx
add [dest_addr], ecx
popad
inc eax
loop .img_read_cluster
jmp .img_read_block
.img_read_done:
; menuet.img loaded; now load kernel.mnt
load_kernel:
push ds
pop es
mov [cur_obj], kernel_mnt_name
; read boot sector
xor eax, eax
mov bx, 500h
mov cx, 1
call read_img
; init vars
mov ax, [50Eh] ; reserved_sect
add ax, [51Ch] ; hidden
mov word [fat_start], ax
xchg ax, bx
movzx ax, byte [510h] ; num_fats
mul word [516h] ; fat_length
add ax, bx
; read root dir
mov bx, 700h
mov cx, [511h] ; dir_entries
add cx, 0Fh
shr cx, 4
call read_img
add ax, cx
mov [img_data_start], ax
shl cx, 9
mov di, bx
add bx, cx
mov byte [bx], 0
.scan_loop:
cmp byte [di], 0
mov si, notfound_string
jz find_error_si
mov si, kernel_mnt_name
call fat_compare_name
jz .found
and di, not 1Fh
add di, 20h
jmp .scan_loop
.found:
and di, not 1Fh
mov si, directory_string
test byte [di+0Bh], 10h
jnz find_error_si
; found, now load it to 1000h:0000h
mov ax, [di+1Ah]
; first cluster of kernel.mnt in ax
; translate it to sector on disk in menuet.img
push ax
dec ax
dec ax
movzx cx, byte [50Dh]
mul cx
add ax, [img_data_start]
; now ax is sector in menuet.img
mov [kernel_mnt_in_img], ax
div [sect_per_clust]
; now ax is cluster in menuet.img and
; dx is offset from the beginning of cluster
movzx eax, ax
push 2000h
pop ds
mov si, 1
.scani:
sub eax, [si]
jb .scanidone
; sanity check
cmp dword [si], 0
push invalid_read_request_string
jz find_error_sp
pop cx
; next chunk
add si, 8
jmp .scani
.scanidone:
add eax, [si] ; undo last subtract
add eax, [si+4] ; get cluster
push 0
pop ds
movzx ecx, [sect_per_clust]
push dx
mul ecx ; get sector
pop dx
movzx edx, dx
add eax, edx
add eax, [data_start]
mov [kernel_mnt_1st], eax
pop ax
push 1000h
pop es
.read_loop:
push ax
xor bx, bx
call img_read_cluster
shl cx, 9-4
mov ax, es
add ax, cx
mov es, ax
pop ax
call img_next_cluster
jc .read_loop
mov ax, 'KL'
mov si, loader_block
jmp 1000h:0000h
 
img_next_cluster:
mov bx, 700h
push ax
shr ax, 1
add ax, [esp]
mov dx, ax
shr ax, 9
add ax, word [fat_start]
mov cx, 2
push es
push ds
pop es
call read_img
pop es
and dx, 1FFh
add bx, dx
mov ax, [bx]
pop cx
test cx, 1
jz .1
shr ax, 4
.1:
and ax, 0FFFh
mov si, bad_cluster_string
cmp ax, 0FF7h
jz find_error_si
ret
img_read_cluster:
dec ax
dec ax
movzx cx, byte [50Dh] ; sects_per_clust
mul cx
add ax, [img_data_start]
movzx eax, ax
; call read_img
; ret
read_img:
; in: ax = sector, es:bx->buffer, cx=length in sectors
pushad
movzx ebx, bx
mov si, movedesc
shl eax, 9
add eax, 93100000h
mov dword [si+sou_addr-movedesc], eax
mov eax, 9300000h
mov ax, es
shl eax, 4
add eax, ebx
mov [si+dest_addr-movedesc], eax
mov ah, 87h
shl cx, 8 ; mul 200h/2
push es
push 0
pop es
int 15h
pop es
cmp ah, 0
mov si, exmem_string
jnz find_error_si
popad
ret
 
movedesc:
times 16 db 0
; source
dw 0xFFFF ; segment length
sou_addr dw 0000h ; linear address
db 1 ; linear address
db 93h ; access rights
dw 0
; destination
dw 0xFFFF ; segment length
dest_addr dd 93100000h ; high byte contains access rights
; three low bytes contains linear address (updated when reading)
dw 0
times 32 db 0
 
find_error_si:
push si
find_error_sp:
mov si, error_msg
call out_string
mov si, [cur_obj]
call out_string
mov si, colon
call out_string
pop si
call out_string
jmp $
 
file_not_found:
mov si, [esp+2]
mov [cur_obj], si
push notfound_string
jmp find_error_sp
 
include 'fat32.inc'
include 'ntfs.inc'
 
write1st:
; callback from kernel.mnt
; write first sector of kernel.mnt from 1000:0000 back to disk
push cs
pop ds
push cs
pop es
; sanity check
mov bx, 500h
mov si, bx
mov cx, 1
push cx
mov eax, [kernel_mnt_1st]
push eax
call relative_read
push 1000h
pop es
xor di, di
mov cx, 8
repz cmpsw
mov si, data_error_msg
jnz find_error_si
; ok, now write back to disk
or byte [read.patch1+2], 1
or byte [read.patch2+2], 1
xor bx, bx
pop eax
pop cx
call relative_read
and byte [read.patch1+1], not 1
and byte [read.patch2+2], not 2
; and to image in memory (probably this may be done by kernel.mnt itself?)
mov dword [sou_addr], 93010000h
movzx eax, [kernel_mnt_in_img]
shl eax, 9
add eax, 93100000h
mov dword [dest_addr], eax
mov si, movedesc
push ds
pop es
mov ah, 87h
mov cx, 100h
int 15h
cmp ah, 0
mov si, exmem_string
jnz find_error_si
retf
 
loader_block:
db 1 ; version
dw 1 ; flags - image is loaded
dw write1st ; offset
dw 0 ; segment
 
fat_cur_sector dd -1
 
; -----------------------------------------------
; ------------------ Settings -------------------
; -----------------------------------------------
 
; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan
kernel_mnt_name db 'kernel.mnt',0
 
; uninitialized data follows
drive_size dd ? ; in sectors
heads dw ?
sectors dw ?
cyls dw ?
free dw ?
cur_obj dw ?
data_start dd ?
img_data_start dw ?
sect_per_clust dw ?
kernel_mnt_in_img dw ?
kernel_mnt_1st dd ?
; NTFS data
cluster_size dd ? ; in bytes
frs_size dd ? ; in bytes
frs_sectors dw ? ; in sectors
mft_data_attr dw ?
index_root dw ?
index_alloc dw ?
ofs dw ?
dir dw ?
; FAT32 data
fat_start dd ?
cur_cluster dd ?
 
; will be initialized by ldklbr.vxd
menuet_img_name rb 300
/programs/hd_load/9x2klbr/mtldr_code/ntfs.inc
0,0 → 1,519
restore_usa:
; Update Sequence Array restore
mov bx, [di+4]
mov cx, [di+6]
inc bx
add bx, di
inc bx
add di, 1feh
dec cx
@@:
mov ax, [bx]
stosw
inc bx
inc bx
add di, 1feh
loop @b
ret
 
find_attr:
; in: di->file record, ax=attribute
; out: di->attribute or di=0 if not found
add di, [di+14h]
.1:
; attributes codes are formally dwords, but all they fit in word
cmp word [di], -1
jz .notfound
cmp word [di], ax
jnz .continue
; for $DATA attribute, scan only unnamed
cmp ax, 80h
jnz .found
cmp byte [di+9], 0
jz .found
.continue:
add di, [di+4]
jmp .1
.notfound:
xor di, di
.found:
ret
 
process_mcb_nonres:
; in: si->attribute, es:di->buffer
; out: di->buffer end
add si, [si+20h]
xor ebx, ebx
.loop:
lodsb
test al, al
jz .done
push invalid_read_request_string
movzx cx, al
shr cx, 4
jz find_error_sp
xchg ax, dx
and dx, 0Fh
jz find_error_sp
add si, cx
add si, dx
pop ax
push si
dec si
movsx eax, byte [si]
dec cx
jz .l1e
.l1:
dec si
shl eax, 8
mov al, [si]
loop .l1
.l1e:
xchg ebp, eax
dec si
movsx eax, byte [si]
mov cx, dx
dec cx
jz .l2e
.l2:
dec si
shl eax, 8
mov al, byte [si]
loop .l2
.l2e:
pop si
add ebx, ebp
; eax=length, ebx=disk block
stosd
mov eax, ebx
stosd
jmp .loop
.done:
xor eax, eax
stosd
ret
 
load_attr:
; in: ax=attribute, es:bx->buffer, di->base record
; out: bx->buffer end; CF set if not found
push di
push ax
mov byte [es:bx], 1
inc bx
push bx
mov [ofs], bx
; scan for attrubute
add di, [di+14h]
@@:
call find_attr.1
test di, di
jz .notfound1
cmp byte [di+8], 0
jnz .nonresident
; resident attribute
mov si, di
pop di
dec di
mov al, 0
stosb
mov ax, [si+10h]
stosw
xchg ax, cx
add si, [si+14h]
rep movsb
mov bx, di
pop ax
pop di
ret
.nonresident:
; nonresident attribute
cmp dword [di+10h], 0
jnz @b
; read start of data
mov si, di
pop di
call process_mcb_nonres
push di
.notfound1:
; $ATTRIBUTE_LIST is always in base file record
cmp word [esp+2], 20h
jz .nofragmented
; scan for $ATTRIBUTE_LIST = 20h
mov di, [esp+4]
mov ax, 20h
call find_attr
test di, di
jz .nofragmented
; load $ATTRIBUTE_LIST itself
push es
mov bx, 0C000h
mov di, [esp+6]
push bx
push [ofs]
push ds
pop es
call load_attr
pop [ofs]
pop si
mov bx, 8000h
push bx
push si
call read_attr_full
pop si
pop bx
add dx, bx
mov ax, [esp+4]
pop es
.1:
cmp [bx], ax
jnz .continue1
; only unnamed $DATA attributes!
cmp ax, 80h
jnz @f
cmp byte [bx+6], 0
jnz .continue1
@@:
cmp dword [bx+10h], 0
jz .continue1
cmp dword [bx+8], 0
jnz @f
push ax
mov ax, [esp+2]
cmp ax, [ofs]
pop ax
jnz .continue1
@@:
pushad
mov eax, [bx+10h]
mov bx, dx
push [ofs]
push es
push ds
pop es
call read_file_record
pop es
pop [ofs]
popad
pushad
mov di, dx
add di, [di+14h]
.2:
call find_attr.1
mov eax, [bx+8]
cmp eax, [di+10h]
jnz .2
mov si, di
mov di, [esp+20h]
sub di, 4
call process_mcb_nonres
mov [esp+20h], di
popad
.continue1:
add bx, [bx+4]
cmp bx, dx
jb .1
.nofragmented:
pop bx
pop ax
pop di
cmp bx, [ofs]
jnz @f
dec bx
stc
@@:
ret
 
read_attr_full:
; in: si->decoded attribute data, bx->buffer
; out: edx=length in bytes
lodsb
cmp al, 0
jnz .nonresident
; resident
lodsw
movzx edx, ax
xchg ax, cx
mov di, bx
rep movsb
ret
.nonresident:
; nonresident :-)
xor edx, edx
.loop:
lodsd
xchg ecx, eax
jecxz .loopend
lodsd
xchg edi, eax
; read ecx clusters from cluster edi to es:bx
.intloop:
push ecx
; read 1 cluster from physical cluster edi to es:bx
mov ecx, [cluster_size]
mov eax, edi
mul ecx
push bx
call relative_read
pop bx
pop ecx
inc edi
mov eax, [cluster_size]
add edx, eax
shr eax, 4
mov bp, es
add bp, ax
mov es, bp
loop .intloop
jmp .loop
.loopend:
mov es, cx
ret
 
read_file_record:
; in: eax=index of record, bx=buffer
mov si, 700h
mov ecx, [frs_size]
mul ecx
push bx
push [cur_obj]
mov [cur_obj], mft_string
call read_attr
pop [cur_obj]
pop di
call restore_usa
ret
read_attr:
; in: edx:eax=offset in bytes, ecx=size in bytes, bx=buffer, si=attribute
push invalid_read_request_string
cmp byte [si], 0
jnz .nonresident
test edx, edx
jnz find_error_sp
cmp eax, 10000h
jae find_error_sp
cmp ecx, 10000h
jae find_error_sp
cmp ax, [si+2]
jae find_error_sp
cmp cx, [si+2]
ja find_error_sp
add si, 3
add si, ax
mov di, bx
rep movsb
pop ax
ret
.nonresident:
mov edi, [cluster_size]
div edi
mov [ofs], dx
add cx, dx
push eax
xchg eax, ecx
xor edx, edx
dec eax
div edi
inc eax
xchg eax, ecx
pop eax
add si, 1
xor edx, edx
push bx
; eax=offset in clusters, ecx=size in clusters
.scan:
mov ebx, [si]
test ebx, ebx
jz .notfound
add edx, ebx
add si, 8
cmp eax, edx
jae .scan
mov edi, [si-4]
; now edx=end of block, ebx=length of block, edi=start of block on disk
; eax=required offset, ecx=required length
push edx
push edi
sub edx, eax
add edi, ebx
sub edi, edx
cmp edx, ecx
jb @f
mov edx, ecx
@@:
; read (edx) clusters from (edi=disk offset in clusters) to ([esp+8])
cmp [ofs], 0
jnz .ofs_read
.cont:
pushad
movzx ebx, byte [50Dh]
; xchg eax, edx
; mul ebx
xchg ax, dx
mul bx
xchg cx, ax
xchg eax, edi
mul ebx
mov bx, [esp+8+20h]
call relative_read
mov [esp+8+20h], bx
popad
.cont2:
add eax, edx
sub ecx, edx
.cont3:
pop edi
pop edx
jnz .scan
pop bx
pop ax
ret
.ofs_read:
push ecx
movzx ecx, byte [50Dh] ; bpb_sects_per_clust
mov eax, edi
push edx
mul ecx
push 1000h
pop es
xor bx, bx
call relative_read
mov cx, bx
push si
push di
mov si, [ofs]
mov di, [esp+8+12]
sub cx, si
push ds
push es
pop ds
pop es
rep movsb
mov [esp+8+12], di
push es
pop ds
pop di
pop si
pop edx
pop ecx
inc edi
mov [ofs], 0
inc eax
dec ecx
jz .cont3
dec edx
jnz .cont
jmp .cont2
.notfound:
mov si, invalid_read_request_string
jmp find_error_si
 
ntfs_parse_dir:
; in: eax=directory iRecord, [word sp+2]=filename
; out: si=$DATA attribute of file
mov bx, [free]
mov [dir], bx
push bx
call read_file_record
mov ax, word [frs_size]
add [free], ax
pop di
; find attributes $INDEX_ROOT, $INDEX_ALLOCATION, $BITMAP
mov ax, 90h ; $INDEX_ROOT
push di
mov bx, [free]
mov [index_root], bx
call load_attr
mov si, noindex_string
jc find_error_si
mov [free], bx
pop di
mov ax, 0A0h ; $INDEX_ALLOCATION
mov bx, [free]
mov [index_alloc], bx
call load_attr
jnc @f
mov [index_alloc], 0
@@:
mov [free], bx
; search for entry
mov si, [index_root]
mov bx, [free]
call read_attr_full
mov ebp, [bx+8] ; subnode_size
add bx, 10h
.scan_record:
add bx, [bx]
.scan:
test byte [bx+0Ch], 2
jnz .not_found
mov si, [esp+2]
movzx cx, byte [bx+50h] ; namelen
lea di, [bx+52h] ; name
xor ax, ax
@@:
lodsb
cmp al, 'a'
jb .notletter
cmp al, 'z'
ja .notletter
or byte [di], 20h
.notletter:
scasw
loopz @b
jb .not_found
ja @f
cmp byte [esi], 0
jz .file_found
@@:
add bx, [bx+8]
jmp .scan
.not_found:
test byte [bx+0Ch], 1
jz file_not_found
cmp [index_alloc], 0
jz file_not_found
add bx, [bx+8]
mov eax, [bx-8]
mul [cluster_size]
mov si, [index_alloc]
mov ecx, ebp
mov bx, [free]
call read_attr
mov di, [free]
call restore_usa
mov bx, [free]
add bx, 18h
jmp .scan_record
.file_found:
mov si, [esp+2]
mov [cur_obj], si
cmp byte [esp+4], 0
jz .need_file
mov si, notdir_string
test byte [bx+48h+3], 10h
jz find_error_si
mov eax, [bx]
mov bx, [dir]
mov [free], bx
ret 2
.need_file:
mov si, directory_string
test byte [bx+48h+3], 10h ; directory?
jnz find_error_si
; read entry
mov eax, [bx]
mov bx, [dir]
mov [free], bx
mov bx, 4000h
push bx
call read_file_record
pop di
mov ax, 80h
push 2000h
pop es
xor bx, bx
call load_attr
mov si, nodata_string
jz find_error_si
mov [free], bx
ret 2
/programs/hd_load/9x2klbr/readme_dos.txt
0,0 → 1,33
 §­ ç¥­¨¥: ¯à¨ § ¯ã᪥ (¯®¤ Win95/98/ME) (ª®à४⭮) ¢ë£à㦠¥â Windows ¨
¢¬¥áâ® ­¥ñ § £à㦠¥â KolibriOS.
 
“áâ ­®¢ª  ­¥ âॡã¥âáï.
 
‡ ¯ãáª:
9x2klbr [[¤¨áª:]\[¯ãâì\][¨¬ï_®¡à § ]]
” ©« ®¡à §  ¤®«¦¥­ à á¯®« £ âìáï ­  ¦ñá⪮¬ ¤¨áª¥.
‡­ ç¥­¨ï ¯® 㬮«ç ­¨î: ¤¨áª C:, ª â «®£ ª®à­¥¢®©, ®¡à § kolibri.img
‚ ¯ã⨠¨ ¢ ¨¬¥­¨ ®¡à §  ¤®«¦­ë ¡ëâì ⮫쪮 ᨬ¢®«ë ¨§ ¯¥à¢®© ¯®«®¢¨­ë
ASCII-â ¡«¨æë. ‚ ç áâ­®áâ¨, ­¥ ¤®«¦­® ¡ëâì àãááª¨å ¡ãª¢.
 
FAT: à¨­¨¬ îâáï ⮫쪮 ª®à®âª¨¥ ¨¬¥­  ¯ ¯®ª ¨ ä ©« , â.¥. progra~1 ¢¬¥áâ®
Program Files; ¤«ï ¨¬ñ­ ⨯  kolibri ¨ menuet.075 (­¥ ¡®«¥¥ 8 ¡ãª¢ ¢ ¨¬¥­¨,
­¥ ¡®«¥¥ 3 ¡ãª¢ ¢ à áè¨à¥­¨¨, ­¥â ᯥ樠«ì­ëå ᨬ¢®«®¢) íâ® ¢ë¯®«­¥­®
 ¢â®¬ â¨ç¥áª¨, ¢ ®¡é¥¬ á«ãç ¥ ª®à®âª®¥ ¨¬ï ¬®¦­® 㧭 âì, ­ ¯à¨¬¥à,
¢ Explorer'®¢áª®¬ ¤¨ «®£¥ "Properties" (¯®¤ § £®«®¢ª®¬ "MS-DOS name").
 
‚¯à®ç¥¬, ¥á«¨ í⨠âॡ®¢ ­¨ï ­¥ ¡ã¤ã⠢믮«­¥­ë, § £àã§ç¨ª ­¥ áâ ­¥â
ä®à¬ â¨à®¢ âì ¤¨áª :-),   ¯à®áâ® á®®¡é¨â, çâ®, ¬®«, 'not found'.
 
à¨¬¥àë:
9x2klbr d:\download\kolibri\kolibri1.img
9x2klbr c:\progra~1\kolibri\
9x2klbr \progra~1\kolibri\
(¡ã¤¥â £à㧨âì ¨§ kolibri.img)
9x2klbr e:\
(íª¢¨¢ «¥­â­® 9x2klbr e:\kolibri.img)
9x2klbr
(¡¥§ ¯ à ¬¥â஢; íª¢¨¢ «¥­â­® 9x2klbr c:\kolibri.img)
 
diamond
mailto: diamondz@land.ru
/programs/hd_load/9x2klbr/readme_win.txt
0,0 → 1,33
Íàçíà÷åíèå: ïðè çàïóñêå (ïîä Win95/98/ME) (êîððåêòíî) âûãðóæàåò Windows è
âìåñòî íå¸ çàãðóæàåò KolibriOS.
 
Óñòàíîâêà íå òðåáóåòñÿ.
 
Çàïóñê:
9x2klbr [[äèñê:]\[ïóòü\][èìÿ_îáðàçà]]
Ôàéë îáðàçà äîëæåí ðàñïîëàãàòüñÿ íà æ¸ñòêîì äèñêå.
Çíà÷åíèÿ ïî óìîë÷àíèþ: äèñê C:, êàòàëîã êîðíåâîé, îáðàç kolibri.img
 ïóòè è â èìåíè îáðàçà äîëæíû áûòü òîëüêî ñèìâîëû èç ïåðâîé ïîëîâèíû
ASCII-òàáëèöû.  ÷àñòíîñòè, íå äîëæíî áûòü ðóññêèõ áóêâ.
 
FAT: Ïðèíèìàþòñÿ òîëüêî êîðîòêèå èìåíà ïàïîê è ôàéëà, ò.å. progra~1 âìåñòî
Program Files; äëÿ èì¸í òèïà kolibri è menuet.075 (íå áîëåå 8 áóêâ â èìåíè,
íå áîëåå 3 áóêâ â ðàñøèðåíèè, íåò ñïåöèàëüíûõ ñèìâîëîâ) ýòî âûïîëíåíî
àâòîìàòè÷åñêè, â îáùåì ñëó÷àå êîðîòêîå èìÿ ìîæíî óçíàòü, íàïðèìåð,
â Explorer'îâñêîì äèàëîãå "Properties" (ïîä çàãîëîâêîì "MS-DOS name").
 
Âïðî÷åì, åñëè ýòè òðåáîâàíèÿ íå áóäóò âûïîëíåíû, çàãðóç÷èê íå ñòàíåò
ôîðìàòèðîâàòü äèñê :-), à ïðîñòî ñîîáùèò, ÷òî, ìîë, 'not found'.
 
Ïðèìåðû:
9x2klbr d:\download\kolibri\kolibri1.img
9x2klbr c:\progra~1\kolibri\
9x2klbr \progra~1\kolibri\
(áóäåò ãðóçèòü èç kolibri.img)
9x2klbr e:\
(ýêâèâàëåíòíî 9x2klbr e:\kolibri.img)
9x2klbr
(áåç ïàðàìåòðîâ; ýêâèâàëåíòíî 9x2klbr c:\kolibri.img)
 
diamond
mailto: diamondz@land.ru
/programs/hd_load/9x2klbr/vxd.asm
0,0 → 1,234
.386p
WIN40COMPAT = 1
include vmm.inc
include v86mmgr.inc
DECLARE_VIRTUAL_DEVICE LDKLBR,1,0,LDKLBR_Control,UNDEFINED_DEVICE_ID,1
;Begin_control_dispatch LDKLBR
;Control_Dispatch w32_DeviceIoControl, OnDeviceIoControl
;Control_Dispatch Sys_Dynamic_Device_Exit, OnExit
;End_control_dispatch LDKLBR
 
VxD_LOCKED_DATA_SEG
VkdControlProc dd 0
vkdddb dd 0
diskinfobuf:
db 10h,0,0,0FFh
db 0Ch dup (0)
 
oldidt label fword
dw 03FFh
dd 0
 
include mtldr.inc
 
imgname dd 0
 
VxD_LOCKED_DATA_ENDS
 
VxD_LOCKED_CODE_SEG
 
BeginProc NewControlProc
cmp eax, Reboot_Processor
jz short MyReboot
jmp [VkdControlProc]
EndProc NewControlProc
 
BeginProc MyReboot
VMMCall _MapPhysToLinear,<0D000h,2000h,0>
push eax
VMMCall _MapPhysToLinear,<0,1000h,0>
xchg eax, ebx
cli
lea esi, [ebx+53Ch]
lodsd
mov [ebx+413h], ax
shr eax, 10h
mov [ebx+40Eh], ax
; restore BIOS IDT - vectors 00..1F
mov edi, ebx
mov ecx, 20h
rep movsd
; int 19
mov eax, [ebx+810h]
mov [ebx+64h], eax
; vectors 40,41,42,43,46,4B,4F
lea edi, [ebx+40h*4]
movsd
movsd
movsd
movsd
scasd
scasd
movsd
add edi, 10h
movsd
add edi, 0Ch
movsd
; vectors 70..77
; lea esi, [ebx+5DCh]
lea edi, [ebx+70h*4]
mov ecx, 8
rep movsd
 
; reboot to mtldr
mov dword ptr [ebx+467h], 0D000007h ; 0D00:0007
mov al, 0Fh
out 70h, al
jecxz $+2
jecxz $+2
mov al, 5
out 71h, al
; copy mtldr code
mov esi, offset mtldr
; mov edi, 0D000h
pop edi
push edi
mov ecx, mtldr_size
rep movsb
; copy mtldr parameters
mov esi, [imgname]
mov edi, esi
mov al, 0
xor ecx, ecx
dec ecx
repnz scasb
pop edi
not ecx
movzx eax, word ptr [edi+5]
add edi, eax
rep movsb
; load old IDT
lidt [oldidt]
; reboot
mov al, 0FEh
out 64h, al
hlt
EndProc MyReboot
 
BeginProc LDKLBR_Control
cmp eax, w32_DeviceIoControl
jz short OnDeviceIoControl
cmp eax, Sys_Dynamic_Device_Exit
jz short OnExit
cmp eax, Reboot_Processor
jz MyReboot
clc
ret
 
OnExit:
; allow unload if and only if we are not hooking
cmp [VkdControlProc], 1
cmc
ret
 
OnDeviceIoControl:
cmp dword ptr [esi+12], DIOC_Open
jz @@open
cmp dword ptr [esi+12], 0Fh
jnz _exit
; request to set path of image
mov ecx, [esi+20] ; cbInBuffer
cmp ecx, 300
ja short @@paramerr
test ecx, ecx
jnz short @@param1ok
@@paramerr:
xor eax, eax
inc eax
@@errret:
mov ecx, [vkdddb]
mov edx, [VkdControlProc]
mov [ecx + VxD_Desc_Block.DDB_Control_Proc], edx
mov [VkdControlProc], 0
ret
@@param1ok:
mov eax, [esi+16] ; lpvInBuffer
; set drive
mov dl, [eax]
or dl, 20h
sub dl, 60h
jz short @@paramerr
cmp dl, 'z'-60h
ja short @@paramerr
push esi
Push_Client_State Uses_edi
mov ecx, 10h
stc
push ds
pop fs
mov esi, offset diskinfobuf
VMMCall Get_Cur_VM_Handle
VxDCall V86MMGR_Allocate_Buffer
VMMCall Begin_Nest_V86_Exec
assume ebp:ptr Client_Reg_Struc
mov [ebp.Client_AX], 440Dh
mov [ebp.Client_BL], dl
mov [ebp.Client_CX], 086Fh
mov [ebp.Client_DX], di
mov eax, edi
shr eax, 10h
mov [ebp.Client_DS], ax
mov eax, 21h
VMMCall Exec_Int
VMMCall End_Nest_Exec
mov ecx, 10h
stc
push ds
pop fs
VxDCall V86MMGR_Free_Buffer
Pop_Client_State Uses_esi
pop esi
mov al, byte ptr [diskinfobuf+3]
cmp al, 0FFh
jz @@errret
cmp al, 80h
jb @@paramerr
mov byte ptr [mtldr+4], al
mov eax, dword ptr [diskinfobuf+8]
mov dword ptr [mtldr], eax
; set path
mov ecx, [imgname]
jecxz @f
VMMCall _HeapFree, <ecx,0>
@@:
mov ecx, [esi+20]
dec ecx
push ecx
VMMCall _HeapAllocate, <ecx,0>
pop ecx
mov [imgname], eax
xchg edi, eax
mov esi, [esi+16]
inc esi
@@1:
lodsb
cmp al, 'A'
jb short @f
cmp al, 'Z'
ja short @f
or al, 20h
@@:
stosb
loop @@1
xor eax, eax
ret
@@open:
; don't hook if already hooked
cmp [VkdControlProc], 0
jnz short @f
mov eax, 0Dh
VMMCall Get_DDB
mov [vkdddb], ecx
mov eax, [ecx + VxD_Desc_Block.DDB_Control_Proc]
mov [VkdControlProc], eax
mov [ecx + VxD_Desc_Block.DDB_Control_Proc], NewControlProc
@@:
xor eax, eax
_exit:
ret
EndProc LDKLBR_Control
 
VxD_LOCKED_CODE_ENDS
 
end