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
/programs/hd_load/meosload/AUTOEXEC.BAT
0,0 → 1,28
goto %config%
:dos1
rem c:\vc401\vc
lh keyrus
lh mmouse
lh C:\WINDOWS\COMMAND\mscdex /d:12345678
lh \dn\dn
bootgui=0
:dos2
rem essolo.com
lh keyrus
lh mmouse
lh \dn\dn
bootgui=0
:win
rem c:\essolo.com
set path=C:\WINDOWS;C:\WINDOWS\COMMAND;c:\;c:\windows\;c:\windows\comand\;c:\arc\;c:\dn\
C:\WINDOWS\COMMAND\DELTREE /y C:\WINDOWS\TEMP\*.*
mode con codepage prepare=((866) C:\WINDOWS\COMMAND\ega3.cpi)
mode con codepage select=866
keyb ru,,C:\WINDOWS\COMMAND\keybrd3.sys
goto continue
:meos
c:\kolibri\meosload.com
:l:\meosload.com
:continue
rem bootgui=1
 
/programs/hd_load/meosload/CONFIG.SYS
0,0 → 1,27
[menu]
menucolor=7
menuitem=win,Windows 98SE
menuitem=dos1,Dos Navigator+CD
menuitem=dos2,Dos Navigator
menuitem=kos,KolibriOS
menudefault=win,15
[dos1]
rem DEVICE=essolo.sys
DEVICE=C:\WINDOWS\himem.sys
device=C:\WINDOWS\COMMAND\display.sys con=(ega,,1)
DEVICE=C:\WINDOWS\emm386.exe noems
device=osi105p.sys
dos=high,umb
[dos2]
rem DEVICE=essolo.sys
DEVICE=C:\WINDOWS\himem.sys
device=C:\WINDOWS\COMMAND\display.sys con=(ega,,1)
DEVICE=C:\WINDOWS\emm386.exe noems
dos=high,umb
[win]
rem DEVICE=c:\essolo.sys
DEVICE=C:\WINDOWS\himem.sys
device=C:\WINDOWS\COMMAND\display.sys con=(ega,,1)
Country=007,866,C:\WINDOWS\COMMAND\country.sys
[kos]
[common]
/programs/hd_load/meosload/History.txt
0,0 → 1,9
14.02.2003
Version 1.0 - Base version
 
11.06.2003
Version 1.1 - Added support of loading from IMAGE-file.
(see of Ivan Poddubny kernel modification)
 
28.10.2006
menuet.img renamed to kolibri.img
/programs/hd_load/meosload/L_readme.txt
0,0 → 1,18
Š ª í⨬ ¯®«ì§®¢ âìáï?
‚ᥠ­¨¦¥¯¥à¥ç¨á«¥­­®¥  ªâã «ì­® ⮫쪮 ¤«ï â¥å, ã ª®£® ¨¬¥îâáï á«¥¤ãî騥 Ž‘:
MS-DOS, Windows95, Windows98 ¨«¨ ¨å ¬®¤¨ä¨ª æ¨¨. „«ï â¥å, ã ª®£® Windows2000
¨«¨ WindowsXP ­¥®¡å®¤¨¬® ¯®«ì§®¢ âìáï § £àã§ç¨ª®¬ mtldr ( ¢â®à Diamond),
â ª¦¥ ¢å®¤ï騬 ¢ ¤¨áâਡã⨢.
 
‘®§¤ ñ¬ ¯ ¯ªã ­  ¤¨áª¥:
C:\KOLIBRI ¨«¨ D:\KOLIBRI ¨«¨ E:\KOLIBRI ¨«¨ «î¡®© ¤à㣮© ¤¨áª, ­  ¢ è¥ ãᬮâ७¨¥.
®¬¥é ¥¬ ¢ íâã ¯ ¯ªã MeOSload.com, å®âï ¯® ¯à¥¦­¥¬ã ¬®¦­® ¥£® ®áâ ¢¨âì ¨ ¢
ª®à­¥ ⮣® ¤¨áª , ¢ ª®â®à®¬ ­ å®¤¨âìáï ¯ ¯ª  KOLIBRI.
®¬¥é ¥¬ KOLIBRI.IMG ¢ ¯ ¯ªã KOLIBRI, å®âï ­¨ªâ® ¢ ¬ ­¥ § ¯à¥é ¥â, ª ª ¨
à ­ìè¥, ®áâ ¢¨âì ¢áñ ¢ ª®à­¥ ¤¨áª .
” ©«ë Autoexec.bat ¨ Config.sys ¤®«¦­ë ¡ëâì ¤®à ¡®â ­ë ¤«ï ¢ë¡®à  § £à㧪¨
Š®«¨¡à¨. à¨¬¥à®¬ ¬®£ãâ á«ã¦¨âì ä ©«ë, ¢«®¦¥­­ë¥ ¢ âã ¦¥ ¯ ¯ªã, ¨§ ª®â®à®© ¢ë
®âªà뫨 íâã ¤®ªã¬¥­â æ¨î. …᫨ ¢®§­¨ª­ãâ ¢®¯à®áë, ®¡à é ©â¥áì ­  ä®àã¬
http://meos.sysbin.com
 
“¤ ç¨!
/programs/hd_load/meosload/L_readme_Win.txt
0,0 → 1,18
Êàê ýòèì ïîëüçîâàòüñÿ?
Âñå íèæåïåðå÷èñëåííîå àêòóàëüíî òîëüêî äëÿ òåõ, ó êîãî èìåþòñÿ ñëåäóþùèå ÎÑ:
MS-DOS, Windows95, Windows98 èëè èõ ìîäèôèêàöèè. Äëÿ òåõ, ó êîãî Windows2000
èëè WindowsXP íåîáõîäèìî ïîëüçîâàòüñÿ çàãðóç÷èêîì mtldr (àâòîð Diamond),
òàêæå âõîäÿùèì â äèñòðèáóòèâ.
 
Ñîçäà¸ì ïàïêó íà äèñêå:
C:\KOLIBRI èëè D:\KOLIBRI èëè E:\KOLIBRI èëè ëþáîé äðóãîé äèñê, íà âàøå óñìîòðåíèå.
Ïîìåùàåì â ýòó ïàïêó MeOSload.com, õîòÿ ïî ïðåæíåìó ìîæíî åãî îñòàâèòü è â
êîðíå òîãî äèñêà, â êîòîðîì íàõîäèòüñÿ ïàïêà KOLIBRI.
Ïîìåùàåì KOLIBRI.IMG â ïàïêó KOLIBRI, õîòÿ íèêòî âàì íå çàïðåùàåò, êàê è
ðàíüøå, îñòàâèòü âñ¸ â êîðíå äèñêà.
Ôàéëû Autoexec.bat è Config.sys äîëæíû áûòü äîðàáîòàíû äëÿ âûáîðà çàãðóçêè
Êîëèáðè. Ïðèìåðîì ìîãóò ñëóæèòü ôàéëû, âëîæåííûå â òó æå ïàïêó, èç êîòîðîé âû
îòêðûëè ýòó äîêóìåíòàöèþ. Åñëè âîçíèêíóò âîïðîñû, îáðàùàéòåñü íà ôîðóì
http://meos.sysbin.com
 
֏!
/programs/hd_load/meosload/MeOSload.asm
0,0 → 1,364
;
; MenuesOS Boot Loader
;
; Author: Trans
; Date: 14.02.03
; Version: 1.0
;
; Current Version: 1.1
; Date of modification: 11.06.03
;
; Compile with FASM
;
 
;--------Code------------
org 100h
start:
push cs
pop ds
mov ax,0003h
int 10h
 
mov dx,title
call print
mov dx,mes1
call print
 
mov dx,img0
call file_open
test ax,ax
jnz loader_continue
mov dx,img2
call file_open
test ax,ax
jne loader_continue
mov dx,img3
call file_open
test ax,ax
je loader_not_find_file
loader_continue:
mov [handle],ax
 
;---------Read boot-sector-----------
mov bx,ax
mov dx,buffer
mov cx,512
call file_read
 
;--------Read parametrs--------------
mov ax,[buffer+0bh]
mov [SectSize],ax
mov al,[buffer+0dh]
mov [ClustSect],al
mov ax,[buffer+0eh]
mov [ResSect],ax
add ax,[ResRgn]
mov [FATRgn],ax
mov al,[buffer+10h]
mov [FATCnt],al
xor bx,bx
mov bl,al
mov ax,[buffer+11h]
mov [RootEnt],ax
shr ax,4 ; ax=ax*32/512
mov [RootDirRgnSz],ax
mov ax,[buffer+16h]
mov [FATSect],ax
mul bx
mov [FATRgnSz],ax
add ax,[FATRgn]
mov [RootDirRgn],ax
add ax,[RootDirRgnSz]
mov [DataRgn],ax
 
;------Read FATs and RootDir---------
xor eax,eax
xor edx,edx
mov ax,[FATRgn]
mul [SectSize]
mov cx,dx
mov dx,ax
mov bx,[handle]
call file_offset
mov ax,[FATRgnSz]
mul [SectSize]
mov cx,ax
mov dx,buffer
mov bx,[handle]
call file_read
mov cx,[RootEnt]
shl cx,5
mov dx,Root
mov bx,[handle]
call file_read
 
;-------Search entry pointer in RootDir---------
push ds
pop es
mov cx,[RootEnt]
mov bx,Root
loader_loc_00:
push cx
mov cx,11
mov di,bx
mov si,kernel
repe cmpsb
jnz loader_notfound
pop cx
jmp loader_find
loader_notfound:
pop cx
add bx,32
loop loader_loc_00
loader_find:
 
mov ax,[bx+1ah]
mov [FirstClust],ax
mov eax,[bx+1ch]
mov [filesize],eax
 
;------Read Kernel----------------------
call read_kernel
 
;---------------------------------------
 
mov bx,[handle]
call file_close
;;;;;;;;;;;;;;;;;;;;;;
jmp loader_yes
;;;;;;;;;;;;;;;;;;;;;;
; mov dx,mes2
; call print
;loader_key:
; mov ah,00h
; int 16h
; cmp al,1bh ;ESC
; je loader_no
; cmp al,6eh ;'n'
; je loader_no
; cmp al,4eh ;'N'
; je loader_no
; cmp al,79h ;'y'
; je loader_yes
; cmp al,59h ;'Y'
; je loader_yes
; jmp loader_key
 
loader_not_find_file:
mov dx,mes4
call print
jmp loader_exit
 
loader_yes:
mov dx,yes
call print
mov ax,7000h
mov es,ax
mov si,move_kernel
xor di,di
mov cx,len_mk
rep movsb
jmp far 7000h:0000h
; jmp loader_exit
loader_no:
mov dx,no
call print
 
loader_exit:
mov dx,mes3
call print
retn
;----Subprogramms--------
 
print:
; in: dx - offset of ASCII string
; out:
mov ah,09h
int 21h
retn
 
file_open:
; in: ds:dx - offset of ASCIIZ filename string
; out: ax - file handle (ax=0 - not found)
mov ax,3d00h
int 21h
jnc fo_exit
xor ax,ax
fo_exit:
retn
 
file_close:
; in: bx - file handle
; out:
mov ah,3eh
int 21h
retn
 
file_read:
; in: bx - file handle
; ds:dx - buffer
; cx - numbers of bytes
; out:
mov ah,3fh
int 21h
retn
 
file_offset:
; in: bx - file handle
; cx:dx - offset in bytes (cx*65535+dx)
; out:
mov ax,4200h
int 21h
retn
 
sector_find:
; in: ax - No of Cluster
; out: ax - 1st sector of Cluster
dec ax
dec ax
push bx
xor bx,bx
mov bl,[ClustSect]
mul bx
pop bx
add ax,[DataRgn]
retn
 
read_cluster:
; in: ax - No of Cluster
; ds:dx - buffer
; out:
push dx
call sector_find
push ax
xor eax,eax
xor ebx,ebx
pop ax
mov bx,[SectSize]
mul ebx
mov dx,ax
shr eax,16
mov cx,ax
mov bx,[handle]
call file_offset
xor ax,ax
mov al,[ClustSect]
mul [SectSize]
mov cx,ax
mov bx,[handle]
pop dx
call file_read
retn
 
read_kernel:
; in:
; out:
mov ax,8000h
mov es,ax ;8000:0000 = 80000h - Temporal location of kernel
xor di,di ;
mov ax,[FirstClust]
mov bp,ax
rk_loc_00:
push es
mov dx,Root
call read_cluster
xor ax,ax ; Moving cluster to area of location kernel
mov al,[ClustSect] ;
mul [SectSize] ;
mov cx,ax ;
pop es ;
mov si,Root ;
rep movsb ;
cmp di,00h
jne rk_continue
mov ax,es
add ax,1000h
mov es,ax
rk_continue:
mov ax,bp
cmp ax,0ff8h
jae rk_done
shl ax,1 ; Val=Clustrer*1,5 //(Cluster*3)/2
add ax,bp ;
shr ax,1 ;
mov bx,ax
add bx,buffer
mov ax,[bx]
bt bp,0
jc rk_nechet
and ax,0fffh
jmp rk_chet
rk_nechet:
shr ax,4
rk_chet:
mov bp,ax
jmp rk_loc_00
rk_done:
retn
 
move_kernel:
; in:
; out:
mov ax,8000h
mov ds,ax
mov ax,1000h
mov es,ax
xor si,si
xor di,di
mov cx,8000h
rep movsb
mov cx,8000h
rep movsb
mov bx,es
add bx,1000h
mov es,bx
mov bx,ds
add bx,1000h
mov ds,bx
mov cx,8000h
rep movsb
mov cx,8000h
rep movsb
mov ax,1000h
mov ds,ax
mov es,ax
jmp far 1000h:0000h
retn
len_mk=$-move_kernel
 
;--------Data------------
title db 'MenuetOS/KolibriOS Boot Loader. Ver.1.1 Copyright(C) 2003, Trans.',0ah,0dh,0ah,0dh,'$'
mes1 db 'It is alternative of boot from floppy.',0ah,0dh
db 'You MUST select HD booting !!!',0ah,0dh,0ah,0dh,'$'
mes2 db 'Are you sure loading KolibriOS? (Y/N):','$'
yes db 'Y','$'
no db 'N','$'
mes3 db 0ah,0dh,0ah,0dh,'See you later ...',0ah,0dh,'$'
mes4 db 0ah,0dh,0ah,0dh,'Not Found: '
img0 db 'kolibri\kolibri.img',0,', '
img2 db 'kolibri.img',0,', '
img3 db 'menuet.img',0,' :($'
kernel db 'KERNEL MNT',0
handle dw ?
SectSize dw ? ; +0bh
ClustSect db ? ; +0dh
ResSect dw ? ; +0eh
FATCnt db ? ; +10h
RootEnt dw ? ; +11h
FATSect dw ? ; +16h
filesize dd ? ; +1ch
FirstClust dw ? ; +1ah
 
ResRgn dw 0 ; = VolumeStart
FATRgn dw ? ; = ResRgn+ResSect
RootDirRgn dw ? ; = FATRgn+(FATCnt*FATSect)
DataRgn dw ? ; = RootDirRgn+((RootEnt*32)/SectSize)
ResRgnSz dw ? ; = ResSect
FATRgnSz dw ? ; = FATCnt*FATSect
RootDirRgnSz dw ? ; = (RootEnt*32)/SectSize
;First sector of cluster N = DataRgn+((N-2)*ClustSect)
 
buffer:
org 3000h
Root:
 
/programs/hd_load/mtldr/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/mtldr/install.txt
0,0 → 1,101
“áâ ­®¢ª  ®áãé¥á⢫ï¥âáï á«¥¤ãî騬 ¯à®áâë¬ á¯®á®¡®¬:
˜ £ 1. ‘ª®¯¨àã©â¥ ä ©«ë mtldr ¨ kolibri.img ¢ C:\
(¥ ­à ¢¨âáï C:\? à®ç¨â ©â¥ § ¬¥ç ­¨ï ­¨¦¥.)
 
˜ £ 2 ) „«ï ¯®«ì§®¢ â¥«¥© NT-ᥬ¥©á⢠ ¤® Vista (NT/2k/XP/2003 Server (?)):
¤®¡ ¢ì⥠¢ boot.ini ¢ à §¤¥« [operating systems] áâபã
c:\mtldr="KolibriOS"
(«¨¡® ®âªàë¢ «î¡ë¬ ⥪áâ®¢ë¬ à¥¤ ªâ®à®¬ c:\boot.ini,
«¨¡® ç¥à¥§ Control Panel -> System -> Advanced -> Startup and Recovery
-> Edit).  §¢ ­¨¥ ¢ ª ¢ëçª å ¬®¦¥â¥ § ¬¥­¨âì ­  ¢áñ, çâ® ¢ ¬ ­à ¢¨âáï,
¯®¤ í⨬ ­ §¢ ­¨¥¬ á¨á⥬  ¡ã¤¥â ¯®ï¢«ïâìáï ¢ ᯨ᪥ § £à㧪¨.
’¥¯¥àì ¯à¨ § £à㧪¥ ¡ã¤¥â ¢ë¤ ¢ âìáï íªà ­ ¢ë¡®à  ®¯¥à æ¨®­­®© á¨á⥬ë.
 
˜ £ 2¡) „«ï ¯®«ì§®¢ â¥«¥© 9x-ᥬ¥©á⢠ (95/98)
(  ¬®¦¥â ¡ëâì, íâ® ¡ã¤¥â à ¡®â âì ¨ ¤«ï ­¥ª®â®àëå DOS):
¤®¡ ¢ì⥠¢ config.sys áâபã
install=c:\mtldr
¯¥à¢®© áâப®©, ¥á«¨ ã ¢ á ¯à®á⮩ «¨­¥©­ë© config.sys,
¯¥à¢®© áâப®© ¢ ᮮ⢥âáâ¢ãî饩 ᥪ樨, ¥á«¨ config.sys
à §¡¨â ­  ᥪ樨 (¨ ­ ç¨­ ¥âáï á [menu])
’¥¯¥àì ¯à¨ § £à㧪¥ mtldr ¡ã¤¥â á¯à è¨¢ âì: "Load KolibriOS? [y/n]: " ¨ ®¦¨¤ âì
­ ¦ â¨ï ®¤­®£® ¨§ 'y','Y','n','N'.
 
„«ï Windows Millenium íâ® ­¥ à ¡®â ¥â, â.ª. Me'è­ë© § £àã§ç¨ª ­¥
§ £à㦠¥â ¢­¥è­¥£® ª®¤  ¨§ config.sys. (‘¯ á¨¡® camper'ã §  㪠§ ­¨¥
­  íâ®â ¯à¨áª®à¡­ë© ä ªâ.) ˆá¯®«ì§ã©â¥ 9x2klbr.
 
˜ £ 2¢) „«ï ¯®«ì§®¢ â¥«¥© Vista:
®âªà®©â¥ ª®¬ ­¤­ãî áâபã á  ¤¬¨­¨áâà â®à᪨¬¨ ¯à¨¢¨«¥£¨ï¬¨
(¯ã­ªâ "Run as administrator" ¢ ª®­â¥ªáâ­®¬ ¬¥­î);
¥á«¨ ¢ë ­¥ ¯« ­¨àã¥â¥ ãáâ ­®¢ª¨ ­¥áª®«ìª¨å ¢ à¨ ­â®¢ Š®«¨¡à¨
ª ª ®¯¨á ­® ¢ § ¬¥ç ­¨ïå, ¯à®áâ® § ¯ãáâ¨â¥ ¯à¨« £ ¥¬ë© vista_install.bat;
¨­ ç¥ ¢ë¯®«­¨â¥ á«¥¤ãî騥 ª®¬ ­¤ë:
bcdedit /create /d "KolibriOS" /application BOOTSECTOR
( §¢ ­¨¥ ¢ ª ¢ëçª å ¬®¦¥â¥ § ¬¥­¨âì ­  ¢áñ, çâ® ¢ ¬ ­à ¢¨âáï,
¯®¤ í⨬ ­ §¢ ­¨¥¬ á¨á⥬  ¡ã¤¥â ¯®ï¢«ïâìáï ¢ ᯨ᪥ § £à㧪¨.)
„®«¦­® ¯®ï¢¨âìáï á®®¡é¥­¨¥ ⨯ 
"‡ ¯¨áì {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} ãᯥ譮 ᮧ¤ ­ ."
„ «¥¥ ¢ ª®¬ ­¤ å ¯®¤áâ ¢«ï©â¥ ¯®«ã祭­®¥ §­ ç¥­¨¥ (®­®, ¢®®¡é¥ £®¢®àï,
à §­®¥ ­  à §­ëå ª®¬¯ìîâ¥à å).
bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} DEVICE PARTITION=C:
bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} PATH \mtldr
bcdedit /displayorder {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} /addlast
 
“¤ «¥­¨¥ ¢ á«ãç ïå 2 ) ¨ 2¡) ®áãé¥á⢫ï¥âáï 㤠«¥­¨¥¬ ¢¢¥¤ñ­­ëå ¤ ­­ëå ¢
boot.ini ¨ config.sys ᮮ⢥âá⢥­­®. “¤ «¥­¨¥ ¢ á«ãç ¥ 2¢) ¤¥« ¥âáï â ª:
 
vista_remove.bat, ¥á«¨ ãáâ ­®¢ª  ¡ë«  ç¥à¥§ vista_install.bat;
bcdedit /delete {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} ¢ ®¡é¥¬ á«ãç ¥
 
…᫨ ¢ë ­¥ ¯®¬­¨â¥ ­ §­ ç¥­­ë© ¯à¨ ãáâ ­®¢ª¥ GUID (íâ® ­®à¬ «ì­®¥ ¥­¨¥),
⮠㧭 âì ¥£® ¬®¦­®, ¢ë¯®«­¨¢ ª®¬ ­¤ã bcdedit ¡¥§  à£ã¬¥­â®¢ ¨ ­ ©¤ï
¢ ¢ë¢¥¤¥­­®¬ ᯨ᪥ ᮮ⢥âáâ¢ãî騩 í«¥¬¥­â.
 
‚® ¢á¥å á«ãç ïå ¢ íªà ­¥ ¢ë¡®à  ¯ à ¬¥â஢ KolibriOS ¬®¦­® ­  ¢®¯à®á,
®âªã¤  £à㧨âì ®¡à § (¯ã­ªâ d, "®¡à § ¤¨áª¥âë"),
®â¢¥ç âì "3" (¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §).
 
‡ ¬¥ç ­¨ï:
 
1. ®ª  çâ® ¢áñ íâ® à ¡®â ¥â ¤«ï ä ©«®¢ëå á¨á⥬ NTFS ¨ FAT32, ¯®¤¤¥à¦ª  FAT16
­¥ ॠ«¨§®¢ ­  ¢ á¢ï§¨ á ¬®¨¬ £«ã¡®ª¨¬ ã¡¥¦¤¥­¨¥¬, ç⮠ᥩç á FAT16 - ®¡ê¥ªâ
ç¨áâ® ¨áâ®à¨ç¥áª¨©. …᫨ ¢ë ¨á¯®«ì§ã¥â¥ FAT16, ã ¢ á á⮨â Windows ¨ ¢ë ¯®
ª ª¨¬-â® ¯à¨ç¨­ ¬ ­¥ å®â¨â¥ ¯¥à¥å®¤¨âì ­  FAT32 - ­ ¯¨è¨â¥ ¬­¥
- ¬®¦¥â ¡ëâì, ¢ ¬ 㤠áâáï ¬¥­ï ¯¥à¥ã¡¥¤¨âì.
 
2. ‘ ¬ § £àã§ç¨ª mtldr ­¥®¡ï§ â¥«ì­® ¯®¬¥é âì ¢ C:\. ®¤ 9x ¨ Vista ®­ ¬®¦¥â
à §¬¥é âìáï £¤¥ 㣮¤­®, ¢ NT/2k/XP - ­  ¤¨áª¥ C:, ­® ­¥®¡ï§ â¥«ì­®
¢ ª®à­¥¢®© ¯ ¯ª¥. ( §ã¬¥¥âáï, ¯à¨ ãáâ ­®¢ª¥ ­ã¦­® 㪠§ë¢ âì ¢¬¥áâ®
c:\mtldr ॠ«ì­ë© ¯ãâì ¨ ॠ«ì­®¥ ¨¬ï ä ©« .)
 
3. Ž¡à § kolibri.img ⮦¥ ­¥®¡ï§ â¥«ì­® ¯®¬¥é âì ¢ C:\. Œ®¦­® ¡¥§ ¢á直å
¨§¬¥­¥­¨© ¢ ãáâ ­®¢ª¥ ¨á¯®«ì§®¢ âì ª®à­¥¢ãî ¯ ¯ªã «î¡®£® «®£¨ç¥áª®£® ¤¨áª ,
à §¬¥é î饣®áï ­  ¯¥à¢®¬ 䨧¨ç¥áª®¬.
 
4. …᫨ å®ç¥âáï ¨á¯®«ì§®¢ âì «®£¨ç¥áª¨© ¤¨áª ­  ¤à㣮¬ 䨧¨ç¥áª®¬ ¤¨áª¥?
‘£®¤¨âáï «î¡®© ¨§ á«¥¤ãîé¨å ¢ à¨ ­â®¢:
a) (…᫨ ¢ë 㬥¥â¥ à ¡®â âì á FASM'®¬) ‚ ¨á室­¨ª å (ª®â®àë¥ ¬®¦­® ᪠ç âì
­  http://diamondz.land.ru, â ¬ ¦¥, £¤¥ ¨ á ¬ § £àã§ç¨ª) ¯®¬¥­ï©â¥
ª®­áâ ­âã boot_drive (¢ ª®­æ¥ mtldr.asm) á 80h ­  ¨¤¥­â¨ä¨ª â®à ¤¨áª ,
80h ᮮ⢥âáâ¢ã¥â ¯¥à¢®¬ã, 81h - ¢â®à®¬ã ¨ â.¤. ¥à¥ª®¬¯¨«¨àã©â¥.
¡) (…᫨ ¢ë 㬥¥â¥ à ¡®â âì á hex-। ªâ®à®¬) ®¬¥­ï©â¥ ¡ ©â ¯® ᬥ饭¨î 0xD98
á 80h ­  ¨¤¥­â¨ä¨ª â®à ¤¨áª  (ª ª ¢ ¯ã­ªâ¥  ).
¢) ˆá¯®«ì§ã©â¥ ãáâ ­®¢é¨ª mtldr_install (᪠ç âì ¥£® ¬®¦­® â ¬ ¦¥).
Ž­ ­ áâந⠧ £àã§ç¨ª ¨ á ¬ ¦¥ ¥£® ¨ ãáâ ­®¢¨â.
 
5. …᫨ 祬-â® ­¥ ­à ¢¨âáï ª®à­¥¢ ï ¯ ¯ª ? ’ãâ ¯®ï¢«ïîâáï ¤¢  ¢ à¨ ­â :
 ) ‚ ¨á室­¨ª å ¯®¬¥­ï©â¥ áâபã kolibri_img_name (¢ ª®­æ¥ mtldr.asm)
­  ¯ãâì ª ä ©«ã.  ¯à¨¬¥à, ¤«ï C:\Program Files\kolibri\kolibri.img § ¯¨è¨â¥
'progra~1\kolibri\kolibri.img' (¯à¨ í⮬ ­ã¦­ë ¨¬¥­  8.3). ¥à¥ª®¬¯¨«¨àã©â¥.
¡) ˆá¯®«ì§ã©â¥ ãáâ ­®¢é¨ª mtldr_install.
 
6. …᫨ ¢®á¯®«ì§®¢ âìáï ४®¬¥­¤ æ¨ï¬¨ ¯ã­ªâ®¢ 2 ¨ 5 ¨ ¯®¢â®à¨âì ãáâ ­®¢ªã
­¥áª®«ìª® à § ¤«ï à §­ëå à á¯®«®¦¥­¨© á¢ï§ª¨ mtldr+kolibri.img,
¬®¦­® ¯®«ãç¨âì ¢ § £à㧮筮¬ ¬¥­î ­¥áª®«ìª® ¢å®¤®¢ ¤«ï à §­ëå ¢¥àᨩ
Š®«¨¡à¨ (¨«¨ ¤«ï ¢¥àᨩ á à §­ë¬¨ ­ áâனª ¬¨).
 
7. ®¦¥« ­¨ï, § ¬¥ç ­¨ï, ¯à¥¤«®¦¥­¨ï ¢ëáë« ©â¥ ­  ¬ë«®, 㪠§ ­­®¥ ­¨¦¥.
 
diamond
mailto: diamondz@land.ru
/programs/hd_load/mtldr/mtldr.asm
0,0 → 1,852
; KolibriOS bootloader
; this code has been written by diamond in 2005,2006,2008 specially for KolibriOS
 
; this code is loaded by ntldr to 0D00:0000
; and by io.sys from config.sys to xxxx:0100
; and by bootmgr in vista to 0000:7C00
format binary
use16
 
org 0xD000
; entry point for 9x and Vista booting
call @f
; db 'd' xor 'i' xor 'a' xor 'm' xor 'o' xor 'n' xor 'd'
db 'NTFS'
@@:
pop si
sub si, 3
cmp si, 7C00h
jz boot_vista
mov si, load_question + 100h - 0D000h
call out_string
; mov si, answer + 100h - 0D000h ; already is
xxy: mov ah, 0
int 16h
or al, 20h
mov [si], al
cmp al, 'y'
jz xxz
cmp al, 'n'
jnz xxy
; continue load Windows
; call out_string
; ret
out_string:
lodsb
test al, al
jz .xxx
mov ah, 0Eh
mov bx, 7
int 10h
jmp out_string
.xxx: ret
xxz:
; boot KolibriOS
call out_string
push 0
pop ds
mov word [4], new01handler + 100h - 0D000h
mov [6], cs
pushf
pop ax
or ah, 1
push ax
popf
; int 19h
; pushf ; there will be no iret
call far [19h*4]
xxt:
; TF has been cleared when entered new01handler
; pushf
; pop ax
; and ah, not 1
; push ax
; popf
xor di, di
mov ds, di
cmp word [8*4+2], 0F000h
jz @f
les bx, [8*4]
mov eax, [es:bx+1]
mov [8*4], eax
@@:
mov si, 100h
boot_vista:
push cs
pop ds
push 0D00h
pop es
mov cx, 2000h/2
rep movsw
jmp 0D00h:0256h
load_question db 'Load KolibriOS? [y/n]: ',0
answer db ?
db 13,10,0
 
new01handler:
; [sp]=ip, [sp+2]=cs, [sp+4]=flags
push bp
mov bp, sp
push bx
push ds
lds bx, [bp+2]
cmp word [bx], 19cdh
jz xxt
pop ds
pop bx
pop bp
iret
 
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 dx
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',13,10,0
part_msg db 'looking at partition '
part_char db '0' ; will be incremented before writing message
db ' ... ',0
errfs_msg db 'unknown filesystem',13,10,0
fat16_msg db 'FAT12/FAT16 - unsupported',13,10,0
fat32_msg db 'FAT32'
newline db 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
 
; init procedure - ntldr jmps here
repeat 0D256h - $
db 1
end repeat
start:
; cs=es=0D00, ds=07C0, ss=0
; esi=edi=ebp=0, esp=7C00
xor ax, ax
mov ds, ax
mov es, ax
; our stack is 4Kb-512b-2b!!! (0xDFE)
mov ss, ax
mov esp, 0FFFEh
 
; we are booting from hard disk identified by [boot_drive]
mov dl, [boot_drive]
cld
sti
; calculate drive size
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
; now read first sector to determine file system type
; first sector of disk is MBR sector
xor eax, eax
new_partition_ex:
mov cx, 1
mov bx, 0F000h
call read
new_partition:
mov bx, [cur_partition_ofs]
mov al, [bx+4] ; partition type
test al, al
jz next_partition
cmp al, 5
jz @f
cmp al, 0xF
jnz not_extended
@@:
; extended partition
mov eax, [bx+8] ; partition start
add eax, [extended_part_start]
mov [extended_part_cur], eax
next_partition:
add [cur_partition_ofs], 10h
cmp [cur_partition_ofs], 0xF1FE
jb new_partition
mov eax, [extended_part_cur]
test eax, eax
jz partitions_done
cmp [extended_part_start], 0
jnz @f
mov [extended_part_start], eax
@@:
mov [extended_parent], eax
and [extended_part_cur], 0
mov [cur_partition_ofs], 0xF1BE
jmp new_partition_ex
partitions_done:
mov si, total_kaput
call out_string
jmp $
not_extended:
mov eax, [bx+8]
add eax, [extended_parent]
mov [partition_start], eax
push ax
mov si, part_msg
inc [si+part_char-part_msg]
call out_string
pop ax
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
call out_string
jmp next_partition
fat1x:
mov si, fat16_msg
call out_string
jmp next_partition
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
mov eax, [52Ch] ; root_cluster
mov [cur_obj], root_string
.parsedir:
push ax
mov si, [imgnameofs]
push si
@@:
lodsb
cmp al, 0
jz @f
cmp al, '\'
jnz @b
dec si
mov [missing_slash], si
inc si
@@:
xchg ax, [esp+2]
mov byte [si-1], 0
mov [imgnameofs], si
call fat32_parse_dir
call restore_slash
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 kolibri.img
; parse image name
mov eax, 5 ; root cluster
mov [cur_obj], root_string
.parsedir:
push ax
mov si, [imgnameofs]
push si
@@:
lodsb
cmp al, 0
jz @f
cmp al, '\'
jnz @b
dec si
mov [missing_slash], si
inc si
@@:
xchg ax, [esp+2]
mov byte [si-1], 0
mov [imgnameofs], si
call ntfs_parse_dir
call restore_slash
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:
; kolibri.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 kolibri.img
push ax
dec ax
dec ax
movzx cx, byte [50Dh]
mul cx
add ax, [img_data_start]
; now ax is sector in kolibri.img
mov [kernel_mnt_in_img], ax
div [sect_per_clust]
; now ax is cluster in kolibri.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
mov si, newline
call out_string
or [fat_cur_sector], -1
mov [imgnameofs], kolibri_img_name
call restore_slash
mov sp, 0xFFFE
jmp next_partition
 
file_not_found:
mov si, [esp+2]
mov [cur_obj], si
push notfound_string
jmp find_error_sp
 
restore_slash:
mov si, [missing_slash]
test si, si
jz @f
and [missing_slash], 0
mov byte [si], '\'
@@: ret
 
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
imgnameofs dw kolibri_img_name
 
; -----------------------------------------------
; ------------------ Settings -------------------
; -----------------------------------------------
 
; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan
kernel_mnt_name db 'kernel.mnt',0
kolibri_img_name db 'kolibri.img',0
 
; change next variable if you want to boot from other physical drive
boot_drive db 80h
 
total_kaput db 13,10,'Fatal: image is not found.',13,10,0
missing_slash dw 0
align 2
 
cur_partition_ofs dw 0xF1BE
extended_part_start dd 0
extended_part_cur dd 0
extended_parent dd 0
 
; uninitialized data follows
drive_size dd ? ; in sectors
heads dw ?
sectors dw ?
cyls dw ?
partition_start dd ?
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 ?
; file must be 16 sectors long
 
repeat 0F000h - $
db 2
end repeat
/programs/hd_load/mtldr/ntfs.inc
0,0 → 1,531
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
jmp .resident
.aux_resident:
push di
popad
; resident attribute
.resident:
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
sub di, 4
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
pop di
mov di, dx
add di, [di+14h]
.2:
call find_attr.1
cmp byte [di+8], 0
jz .aux_resident
mov eax, [bx+8]
cmp eax, [di+10h]
jnz .2
mov si, di
mov di, [esp+1Eh]
call process_mcb_nonres
sub di, 4
mov [esp+1Eh], di
push 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
@@:
add bx, 4
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/mtldr/vista_install.bat
0,0 → 1,4
bcdedit /create {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} /d "KolibriOS" /application BOOTSECTOR
bcdedit /set {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} DEVICE PARTITION=C:
bcdedit /set {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} PATH \mtldr
bcdedit /displayorder {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} /addlast
/programs/hd_load/mtldr/vista_remove.bat
0,0 → 1,0
bcdedit /delete {AA48ABEF-FF35-4f09-874F-4CFF92467DC4}
/programs/hd_load/mtldr_install/compile.bat
0,0 → 1,0
fasm mtldr_install.asm
/programs/hd_load/mtldr_install/mtldr_code/compile.bat
0,0 → 1,0
fasm mtldr.asm ..\mtldr_for_installer
/programs/hd_load/mtldr_install/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/mtldr_install/mtldr_code/mtldr.asm
0,0 → 1,786
; KolibriOS bootloader
; this code has been written by diamond in 2005,2006 specially for KolibriOS
 
; this code is loaded by ntldr to 0D00:0000
; and by io.sys from config.sys to xxxx:0100
; and by bootmgr in vista to 0000:7C00
format binary
use16
 
org 0xD000
 
; entry point for 9x booting
call @f
; db 'd' xor 'i' xor 'a' xor 'm' xor 'o' xor 'n' xor 'd'
db 'NTFS'
 
; file offset +7
; may be changed by installator
boot_drive db 80h
partition_start dd -1
imgnameofs dw menuet_img_name
 
@@:
pop si
sub si, 3
cmp si, 7C00h
jz boot_vista
mov si, load_question + 100h - 0D000h
call out_string
mov si, answer + 100h - 0D000h
xxy: mov ah, 0
int 16h
or al, 20h
mov [si], al
cmp al, 'y'
jz xxz
cmp al, 'n'
jnz xxy
; continue load Windows
; call out_string
; ret
out_string:
lodsb
test al, al
jz .xxx
mov ah, 0Eh
mov bx, 7
int 10h
jmp out_string
.xxx: ret
xxz:
; boot KolibriOS
call out_string
push 0
pop ds
mov word [4], new01handler + 100h - 0D000h
mov [6], cs
pushf
pop ax
or ah, 1
push ax
popf
; int 19h
; pushf ; there will be no iret
call far [19h*4]
xxt:
; TF has been cleared when entered new01handler
; pushf
; pop ax
; and ah, not 1
; push ax
; popf
push 0
pop ds
cmp word [8*4+2], 0F000h
jz @f
les bx, [8*4]
mov eax, [es:bx+1]
mov [8*4], eax
@@:
mov si, 100h
boot_vista:
xor di, di
push cs
pop ds
push 0D00h
pop es
mov cx, 2000h/2
rep movsw
jmp 0D00h:0256h
 
new01handler:
; [sp]=ip, [sp+2]=cs, [sp+4]=flags
push bp
mov bp, sp
push bx
push ds
lds bx, [bp+2]
cmp word [bx], 19cdh
jz xxt
pop ds
pop bx
pop bp
iret
 
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
xor dx, dx
; new style - LBA, function 42
cmp [has_lba], dl
jz disk_error
; allocate disk address packet on the stack
; qword +8: absolute block number
push dx
push dx
; 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
push 1
; word +0: size of packet = 10h
push 10h
; 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
lea sp, [si+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
push eax
pop ax
pop dx
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 $
 
answer db ?
db 13,10
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
bad_cluster_string db 'bad cluster',0
exmem_string db 'extended memory error',0
 
load_question db 'Load KolibriOS? [y/n]: ',0
 
repeat 0D256h - $
db 1
end repeat
 
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
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
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
 
data_error_msg db 'data error',0
 
; -----------------------------------------------
; ------------------ Settings -------------------
; -----------------------------------------------
 
; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan
kernel_mnt_name db 'kernel.mnt',0
 
; will be initialized by installer
menuet_img_name rb 300
 
; 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 ?
/programs/hd_load/mtldr_install/mtldr_code/ntfs.inc
0,0 → 1,531
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
jmp .resident
.aux_resident:
push di
popad
; resident attribute
.resident:
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
sub di, 4
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
pop di
mov di, dx
add di, [di+14h]
.2:
call find_attr.1
cmp byte [di+8], 0
jz .aux_resident
mov eax, [bx+8]
cmp eax, [di+10h]
jnz .2
mov si, di
mov di, [esp+1Eh]
call process_mcb_nonres
sub di, 4
mov [esp+1Eh], di
push 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
@@:
add bx, 4
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/mtldr_install/mtldr_install.asm
0,0 → 1,1426
format PE GUI 4.0
section '.text' code readable executable
entry start
start:
xor ebx, ebx
push ofn
call [GetOpenFileNameA]
test eax, eax
jnz @f
push ebx
call [ExitProcess]
@@:
call [GetVersion]
test eax, eax
sets [b9x]
js install_9x
mov [img_name+2], bl
push ebx
push ebx
push 3
push ebx
push 3
push 80000000h
push dn
call [CreateFileA]
inc eax
jnz @f
norights:
push 10h
push ebx
push norightsmsg
mbx:
push ebx
call [MessageBoxA]
push ebx
call [ExitProcess]
@@:
lea esi, [eax-1]
push ebx
push tmp
push 12
push sdn
push ebx
push ebx
push 0x2D1080
push esi
call [DeviceIoControl]
test eax, eax
jnz @f
cnr:
push esi
call [CloseHandle]
jmp norights
@@:
push ebx
push tmp
push 20h
push pi
push ebx
push ebx
push 0x74004
push esi
call [DeviceIoControl]
test eax, eax
jz cnr
push esi
call [CloseHandle]
cmp [sdn], 7
jz @f
push 10h
push 0
push nohd
jmp mbx
@@:
mov al, byte [sdn+4]
or al, 80h
mov [mtldr_code+7], al
mov eax, [pi]
mov edx, [pi+4]
shrd eax, edx, 9
shr edx, 9
jz @f
m1e: push 10h
push ebx
push m1
jmp mbx
@@:
install_cmn:
mov [mtldr_code+8], eax
mov esi, img_name
mov edi, img_real_name
mov byte [esi+2], '\'
push 256
push edi
push esi
call [GetShortPathNameA]
cmp eax, 256
jb @f
push 10h
push ebx
push ptl
jmp mbx
@@:
test eax, eax
jnz @f
push esi edi
mov ecx, 256/4
rep movsd
pop edi esi
@@:
cmp byte [edi], 0
jz lcd
cmp byte [edi], 'A'
jb lcc
cmp byte [edi], 'Z'
ja lcc
add byte [edi], 20h
lcc:
inc edi
jmp @b
lcd:
mov esi, img_real_name
cmp [b9x], 0
jnz @f
cmp byte [esi], 'c'
jnz notc
@@:
push 256/4
pop ecx
lea edi, [esi+ecx*4]
rep movsd
mov edi, esi
xor eax, eax
or ecx, -1
repnz scasb
dec edi
std
mov al, '\'
repnz scasb
cld
inc edi
inc edi
mov eax, 'mtld'
stosd
mov al, 'r'
stosb
jmp cmn
notc:
mov dword [mtldr_name], 'C:\m'
mov dword [mtldr_name+4], 'tldr'
mov edi, mtldr_name+8
cmn:
and word [edi], 0
mf:
push mtldr_name
call [GetFileAttributesA]
inc eax
jnz @f
call [GetLastError]
cmp eax, 2
jz fo
@@:
cmp byte [edi], 0
jnz @f
mov byte [edi], '0'
jmp mf
@@:
cmp byte [edi], '9'
jae @f
mfi:
inc byte [edi]
jmp mf
@@:
ja @f
mov byte [edi], 'A'
jmp mf
@@:
cmp byte [edi], 'Z'
jb mfi
nomx: push 10h
push ebx
push nom
jmp mbx
fo:
cmp [b9x], 0
jnz install_9x_2
call write_mtldr1
push ecx
call [GetVersion]
pop ecx
cmp al, 6
jae install_vista
mov al, 2
mov edi, tmp_data
neg ecx
add ecx, 2000h - mtldr_code_size
push ebx
push tmp
push ecx
push edi
push esi
rep stosb
call [WriteFile]
push esi
call [CloseHandle]
push bootini
mov edi, systitle+1
mov esi, ostitle
mov byte [edi-1], '"'
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
mov word [edi], '"'
push bootini
call [GetFileAttributesA]
push eax
and al, not 1
push eax
push bootini
call [SetFileAttributesA]
push bootini
push systitle
push mtldr_name
push mtldr_name
push mtldr_name
call [CharToOemA]
push osstr
call [WritePrivateProfileStringA]
xchg eax, [esp]
push eax
push bootini
call [SetFileAttributesA]
pop eax
test eax, eax
jnz suci
; failed, delete written mtldr
call delete_mtldr
push 10h
push ebx
push insterr
jmp mbx
suci:
push 40h
push suct
push succ
jmp mbx
 
install_9x:
mov al, [img_name]
or al, 20h
sub al, 'a'-1
mov byte [regs], al
push ebx
push ebx
push 3
push ebx
push 3
push 80000000h
push vwin32
call [CreateFileA]
inc eax
jz norights
dec eax
xchg eax, esi
push ebx
push tmp
push 28
push regs
push 28
push regs
push 1
push esi
call [DeviceIoControl]
push eax
push esi
call [CloseHandle]
pop eax
test eax, eax
@@: jz norights
mov al, [diskinfobuf+3]
cmp al, 0xFF
jz @b
cmp al, 80h
jb norights
mov [mtldr_code+7], al
cmp dword [diskinfobuf+12], 0
jnz m1e
mov eax, [diskinfobuf+8]
jmp install_cmn
 
install_9x_2:
push ebx
push ebx
push 3
push ebx
push 1
push 80000000h
push config
call [CreateFileA]
inc eax
jnz @f
ie2:
push 10h
push ebx
push insterr2
jmp mbx
@@:
dec eax
xchg eax, esi
push ebx
push esi
call [GetFileSize]
inc eax
jz ie2
dec eax
xchg eax, ebp
push 4
push 1000h
push ebp
push ebx
call [VirtualAlloc]
xchg eax, edi
test edi, edi
jz ie2
push ebx
push tmp
push ebp
push edi
push esi
call [ReadFile]
push esi
call [CloseHandle]
push ebx
push 80h
push 2
push ebx
push ebx
push 40000000h
push config
call [CreateFileA]
inc eax
jz ie2
dec eax
xchg eax, esi
mov eax, dword [edi]
or eax, 0x20202000
cmp eax, '[men'
jz menu
push ostitle
call [lstrlenA]
cmp eax, 17
ja bt1
push esi edi
mov esi, ostitle
mov edi, mtldr_code+23Ah
mov ecx, eax
rep movsb
mov dword [edi], '? [y'
mov dword [edi+4], '/n]:'
mov word [edi+8], ' '
pop edi esi
jmp ct1
bt1:
push img_real_name+3
call [lstrlenA]
add eax, mtldr_code_size+1+100h
mov word [mtldr_code+0x19], ax
ct1:
push ebx
push tmp
push 8
push install
push esi
call [WriteFile]
cfgd:
mov eax, mtldr_name
push eax
push eax
push eax
call [CharToOemA]
call [lstrlenA]
push ebx
push tmp
push eax
push mtldr_name
push esi
call [WriteFile]
push ebx
push tmp
push 2
push newline
push esi
call [WriteFile]
push ebx
push tmp
push ebp
push edi
push esi
call [WriteFile]
push esi
call [CloseHandle]
call write_mtldr1
push ostitle
call [lstrlenA]
cmp eax, 11
jbe @f
push ebx
push tmp
push ld2sz
push ld2
push esi
push ebx
push tmp
push eax
push ostitle
push esi
push ebx
push tmp
push ld1sz
push ld1
push esi
call [WriteFile]
call [WriteFile]
call [WriteFile]
@@:
push esi
call [CloseHandle]
jmp suci
menu:
push edi
or ecx, -1
mes:
mov al, 0xA
repnz scasb
cmp byte [edi], '['
jz med
cmp dword [edi], 'menu'
jnz mes
cmp dword [edi+4], 'item'
jnz mes
cmp byte [edi+8], '='
jnz mes
mov eax, [edi+9]
or eax, ' '
cmp eax, 'koli'
jnz mes
mov eax, [edi+13]
and eax, 0xFFFFFF
or eax, ' '
cmp eax, 'bri'
jnz mes
movzx eax, byte [edi+16]
or al, 0x20
mov [menuitems+eax], 1
jmp mes
med:
cmp word [edi-4], 0x0A0D
jnz @f
dec edi
dec edi
jmp med
@@:
sub edi, [esp]
push ebx
push tmp
push edi
push dword [esp+12]
push esi
call [WriteFile]
add [esp], edi
sub ebp, edi
mov ecx, 7
cmp [menuitems+0x20], 0
jnz @f
cmp [menuitems+','], 0
jz mef
@@:
mov eax, '0'
mel1:
cmp [menuitems+eax], 0
jz med1
inc eax
cmp al, '9'+1
jb mel1
jnz @f
mov al, 'a'
jmp mel1
@@:
cmp al, 'z'
jbe mel1
push ebx
push tmp
push ebp
push dword [esp+12]
push esi
call [WriteFile]
push esi
call [CloseHandle]
jmp nomx
med1:
mov [menuitem+7], al
mov ecx, 8
mef:
push ebx
push tmp
push ecx
push menuitem
push esi
push ebx
push tmp
push ecx
push menuitem
push esi
push ebx
push tmp
push 9
push mis
push esi
call [WriteFile]
call [WriteFile]
push ebx
push tmp
push title9xsz
push title9x
push esi
call [WriteFile]
push ebx
push tmp
push ostitle
call [lstrlenA]
push eax
push ostitle
push esi
call [WriteFile]
push ebx
push tmp
push title9x2sz
push title9x2
push esi
call [WriteFile]
call [WriteFile]
push ebx
push tmp
push 11
push sec9x2
push esi
call [WriteFile]
mov byte [mtldr_code+1], 37h
pop edi
jmp cfgd
 
install_vista:
push esi
call [CloseHandle]
mov edi, sbn
call adjust_privilege
mov edi, srn
call adjust_privilege
push ebx
push ebx
call [CoInitializeEx]
test eax, eax
js we
push ebx
push ebx
push ebx
push 3
push ebx
push ebx
push ebx
push -1
push ebx
call [CoInitializeSecurity]
test eax, eax
jns @f
we2:
call [CoUninitialize]
we:
call delete_mtldr
push 10h
push ebx
push wmierr
jmp mbx
@@:
push ebx
push esp
push IID_IWbemLocator
push 1
push ebx
push CLSID_WbemLocator
call [CoCreateInstance]
pop edi
test eax, eax
js we2
push ebx
push esp
push ebx
push ebx
push ebx
push ebx
push ebx
push ebx
push ns
push edi
mov esi, [edi]
call dword [esi+12]
push eax
push edi
call dword [esi+8]
pop eax
pop edi
test eax, eax
js we2
push ebx
push ebx
push 3
push 3
push ebx
push ebx
push 10
push edi
call [CoSetProxyBlanket]
test eax, eax
jns @f
we3:
mov eax, [edi]
push edi
call dword [eax+8]
jmp we2
@@:
xor esi, esi
push osp
push osn
push bs
call call_method
test eax, eax
js we3
mov esi, guid
mov ebp, menuitems
push esi
call [CoCreateGuid]
push 2000h/2
push ebp
push esi
call [StringFromGUID2]
mov esi, [varout+8]
push con
push bs
call call_method
jns @f
wecei:
mov ebp, coerr
wece:
mov eax, [esi]
push esi
call dword [eax+8]
mov eax, [edi]
push edi
call dword [eax+8]
call [CoUninitialize]
call delete_mtldr
push 10h
push ebx
push ebp
jmp mbx
@@:
pop eax
push esi
push eax
mov ebp, tmp_data
mov dword [vartmpstr+8], ebp
mov dword [vari32+8], 0x12000004
push 2000h/2
push ebp
push -1
push ostitle
push ebx
push ebx
call [MultiByteToWideChar]
mov esi, [varout+8]
push ssen
push bo
call call_method
mov ebp, setproperr
js wece2
sub dword [esp], 24
mov byte [vari32+8], 2
push 2000h/2
push tmp_data
push -1
push mtldr_name+2
push ebx
push ebx
call [MultiByteToWideChar]
push ssen
push bo
call call_method
js wece2
mov dword [vari32+8], 0x11000001
mov ecx, tmp_data
mov dword [ecx], '\' + ('?' shl 16)
mov dword [ecx+4], '?' + ('\' shl 16)
xor eax, eax
mov dword [ecx+12], eax
mov al, [mtldr_name+1]
shl eax, 16
mov al, [mtldr_name]
mov dword [ecx+8], eax
push spden
push bo
call call_method
js wece2
mov eax, [esi]
push esi
call dword [eax+8]
pop eax
pop esi
push eax
push oon
push bs
call call_method
mov ebp, orerr
js wece3
pop eax
push esi
push eax
mov esi, [varout+8]
mov dword [vari32+8], 0x24000001
push gen
push bo
call call_method
js wece2
push esi
mov esi, [varout+8]
push ebx
push ebx
push varout
push ebx
push idsn
mov eax, [esi]
push esi
call dword [eax+16]
push eax
mov eax, [esi]
push esi
call dword [eax+8]
pop eax
pop esi
test eax, eax
js wece2
push esi
cmp word [varout], 2008h
jnz wece4
mov esi, [varout+8]
cmp word [esi], 1
jnz wece4
push dword [esi+20]
mov eax, [esi+16]
inc eax
push eax
push esp
push esi
call [SafeArrayRedim]
pop ecx
pop ecx
test eax, eax
js wece4
push menuitems
call [SysAllocString]
test eax, eax
jz wece4
push eax
mov ecx, [esi+16]
add ecx, [esi+20]
dec ecx
push ecx
mov ecx, esp
push eax
push ecx
push esi
call [SafeArrayPutElement]
pop ecx
call [SysFreeString]
pop esi
push solen
push bo
call call_method
js wece2
push varout
call [VariantClear]
mov eax, [esi]
push esi
call dword [eax+8]
pop eax
pop esi
mov eax, [esi]
push esi
call dword [eax+8]
mov eax, [edi]
push edi
call dword [eax+8]
call [CoUninitialize]
jmp suci
wece4:
pop esi
wece2:
mov eax, [esi]
push esi
call dword [eax+8]
pop eax
pop esi
push eax
wece3:
mov dword [vartmpstr+8], menuitems
pop eax
push dop
push don
push bs
call call_method
pop eax
jmp wece
 
write_mtldr1:
push ebx
push 80h
push 2
push ebx
push ebx
push 40000000h
push mtldr_name
call [CreateFileA]
inc eax
jnz @f
push 10h
push ebx
push noc
jmp mbx
@@:
dec eax
xchg eax, esi
push ebx
push tmp
push mtldr_code_size
push mtldr_code
push esi
call [WriteFile]
push img_real_name
push img_real_name
call [CharToOemA]
mov edi, img_real_name+3
push edi
call [lstrlenA]
inc eax
push eax
push ebx
push tmp
push eax
push edi
push esi
call [WriteFile]
pop ecx
ret
delete_mtldr:
push mtldr_name
push mtldr_name
push mtldr_name
call [OemToCharA]
call [DeleteFileA]
ret
 
adjust_privilege:
cmp [advapi32], 0
jnz @f
push advapi32_name
call [LoadLibraryA]
mov [advapi32], eax
mov esi, eax
test esi, esi
jz ape
push opts
push esi
call [GetProcAddress]
mov [OpenProcessToken], eax
test eax, eax
jz ape
push lpvs
push esi
call [GetProcAddress]
mov [LookupPrivilegeValueA], eax
test eax, eax
jz ape
push atps
push esi
call [GetProcAddress]
mov [AdjustTokenPrivileges], eax
test eax, eax
jz ape
@@:
push ebx
push esp
push 28h
call [GetCurrentProcess]
push eax
call [OpenProcessToken]
test eax, eax
pop esi
jz ape
push 2
push ebx
push ebx
mov eax, esp
push 1
push eax
push edi
push ebx
call [LookupPrivilegeValueA]
test eax, eax
jz ape2
mov eax, esp
push ebx
push ebx
push ebx
push eax
push ebx
push esi
call [AdjustTokenPrivileges]
test eax, eax
jz ape2
add esp, 10h
push esi
call [CloseHandle]
ret
ape2:
add esp, 10h
push esi
call [CloseHandle]
ape:
push 10h
push ebx
push apf
jmp mbx
 
call_method:
push ebx
mov eax, esp
push ebx
push eax
push ebx
push ebx
push dword [eax+8]
mov eax, [edi]
push edi
call dword [eax+24]
xchg edi, [esp]
test eax, eax
js r
push ebx
mov eax, esp
push ebx
push eax
push ebx
push dword [eax+16]
mov eax, [edi]
push edi
call dword [eax+76]
push eax
mov eax, [edi]
push edi
call dword [eax+8]
pop eax
pop edi
test eax, eax
js r
push ebx
push esp
push ebx
mov eax, [edi]
push edi
call dword [eax+60]
push eax
mov eax, [edi]
push edi
call dword [eax+8]
pop eax
pop edi
test eax, eax
js r
cml1:
mov eax, [esp+16]
add dword [esp+16], 8
cmp dword [eax], 0
jz cme1
push ebx
push dword [eax+4]
push ebx
push dword [eax]
mov eax, [edi]
push edi
call dword [eax+20]
test eax, eax
js r2
jmp cml1
cme1:
and dword [varout], 0
mov ecx, [esp+8]
test esi, esi
jz cms
push ebx
push ebx
push varout
push ebx
push rpn
mov eax, [esi]
push esi
call dword [eax+16]
test eax, eax
js r2
cmp word [varout], 8
jnz r2
mov ecx, [varout+8]
cms:
pop edx
push edx
push ebx
mov eax, esp
push ebx
push eax
push edi
push ebx
push ebx
push dword [eax+16]
push ecx
mov eax, [edx]
push edx
call dword [eax+96]
push eax
mov eax, [edi]
push edi
call dword [eax+8]
push varout
call [VariantClear]
pop eax
pop edi
test eax, eax
js r
push ebx
push ebx
push varout
push ebx
push retvaln
mov eax, [edi]
push edi
call dword [eax+16]
test eax, eax
js r2
mov eax, 80000000h
cmp word [varout], 11
jnz r2
cmp word [varout+8], 0
jz r2
mov eax, [esp+16]
mov eax, [eax-4]
test eax, eax
jz r2
push ebx
push ebx
push varout
push ebx
push eax
mov eax, [edi]
push edi
call dword [eax+16]
test eax, eax
js r2
cmp word [varout], 13
setnz al
shl eax, 31
r2:
push eax
mov eax, [edi]
push edi
call dword [eax+8]
pop eax
r:
pop edi
test eax, eax
ret 8
 
ofn_hook:
cmp dword [esp+8], 2
jnz @f
push 260
push ostitle
push 23
push dword [esp+12+4]
call [GetDlgItemTextA]
@@:
xor eax, eax
ret 10h
 
section '.data' data readable writable
data resource from 'rsrc.res'
end data
 
align 4
ofn:
dd 76
dd 0
dd ofn_title_template
dd filter
dd 0
dd 0
dd 0
dd img_name
dd 100h
dd 0
dd 0
dd 0
dd ofn_title
dd 818A4h
dd 0
dd aImg
dd 0
dd ofn_hook
dd 0
ofn_title_template:
dw 1,-1
dd 0
dd 0
dd 56000444h
dw 2
dw 0,0,275,28
dw 0,0,0
dw 8
dd 0
du 'MS Sans Serif',0
align 4
dd 0
dd 0
dd 50010000h
dw 5,12,45,9
dw -1
dw 0
dw -1,82h
du 'Title:',0
dw 0
align 4
dd 0
dd 204h
dd 50010080h
dw 54,10,218,12
dw 23
dw 0
dw -1,81h
du 'KolibriOS',0
dw 0
 
filter db 'Image files (*.img)',0,'*.img',0,'All files',0,'*.*',0,0
ofn_title db 'Select KolibriOS image file',0
aImg db 'img',0
norightsmsg db 'Cannot query drive info.',10
db 'Probably it is invalid drive or you are not administrator',0
nohd db 'Image must be on hard disk!',0
m1 db 'Please mail to diamondz@land.ru',0
nom db "Too many mtldr's found!",0
noc db 'Cannot create mtldr file!',0
osstr db 'operating systems',0
bootini db 'c:\boot.ini',0
insterr db 'Cannot write to boot.ini. Probably you are not administrator.',0
insterr2 db 'Cannot open config.sys',0
ptl db 'Path is too long',0
succ db 'Installation successful!',0
suct db 'Success',0
vwin32 db '\\.\vwin32',0
config db 'C:\config.sys',0
sec9x2 db ']',13,10
install db 'install='
newline db 13,10
menuitem db 'kolibri',0
mis db 'menuitem='
title9x db ',Load '
title9xsz = $ - title9x
title9x2 db 13,10,13,10,'['
title9x2sz = $ - title9x2
ld1 db 'Load '
ld1sz = $ - ld1
ld2 db '? [y/n]: ',0
ld2sz = $ - ld2
apf db 'Cannot adjust backup and restore privileges',0
opts db 'OpenProcessToken',0
lpvs db 'LookupPrivilegeValueA',0
atps db 'AdjustTokenPrivileges',0
sbn db 'SeBackupPrivilege',0
srn db 'SeRestorePrivilege',0
wmierr db 'BCD WMI API: initialization error',0
coerr db 'Cannot create BCD object for KolibriOS loader',0
setproperr db 'Cannot create BCD element in object for KolibriOS loader',0
orerr db 'Cannot add KolibriOS loader in BCD display list',0
ns du 'root\wmi',0
retvaln du 'ReturnValue'
emptystr du 0
rpn du '__Relpath',0
bs du 'BcdStore',0
bo du 'BcdObject',0
osn du 'OpenStore',0
con du 'CreateObject',0
don du 'DeleteObject',0
oon du 'OpenObject',0
ssen du 'SetStringElement',0
spden du 'SetPartitionDeviceElement',0
gen du 'GetElement',0
solen du 'SetObjectListElement',0
fn du 'File',0
storen du 'Store',0
idn du 'Id',0
idsn du 'Ids',0
tn du 'Type',0
obn du 'Object',0
sn du 'String',0
dtn du 'DeviceType',0
aon du 'AdditionalOptions',0
pn du 'Path',0
en du 'Element',0
bg du '{9dea862c-5cdd-4e70-acc1-f32b344d4795}',0
 
align 4
advapi32 dd 0
 
regs:
dd 0
dd diskinfobuf
dd 86Fh
dd 440Dh
dd 0
dd 0
dd 1
 
diskinfobuf:
db 10h,0,0,0FFh
times 0Ch db 0
 
IID_IWbemLocator:
dd 0DC12A687h
dw 737Fh
dw 11CFh
db 88h, 4Dh, 00h, 0AAh, 00h, 4Bh, 2Eh, 24h
CLSID_WbemLocator:
dd 4590F811h
dw 1D3Ah
dw 11D0h
db 89h, 1Fh, 00h, 0AAh, 00h, 4Bh, 2Eh, 24h
IID_IWbemClassObject:
dd 0DC12A681h
dw 737Fh
dw 11CFh
db 88h, 4Dh, 00h, 0AAh, 00h, 4Bh, 2Eh, 24h
varemptystr:
dd 8, 0, emptystr, 0
vartmpstr:
dd 8, 0, menuitems, 0
varbootmgr:
dd 8, 0, bg, 0
vari32:
dd 3, 0, 10400008h, 0
vari32_pd:
dd 3, 0, 2, 0
osp:
dd fn, varemptystr
dd 0, storen
dd idn, vartmpstr
dd tn, vari32
dd 0, obn
dd tn, vari32
dd sn, vartmpstr
dd 0, 0
dd tn, vari32
dd dtn, vari32_pd
dd aon, varemptystr
dd pn, vartmpstr
dd 0, 0
dd idn, varbootmgr
dd 0, obn
dd tn, vari32
dd 0, en
dd tn, vari32
dd idsn, varout
dd 0, 0
 
dop:
dd idn, vartmpstr
dd 0, 0
 
data import
macro thunk a
{a#_thunk:dw 0
db `a,0}
dd 0,0,0, rva kernel32_name, rva kernel32_thunks
dd 0,0,0, rva user32_name, rva user32_thunks
dd 0,0,0, rva comdlg32_name, rva comdlg32_thunks
dd 0,0,0, rva ole32_name, rva ole32_thunks
dd 0,0,0, rva oleaut32_name, rva oleaut32_thunks
dd 0,0,0,0,0
kernel32_name db 'kernel32.dll',0
user32_name db 'user32.dll',0
advapi32_name db 'advapi32.dll',0
comdlg32_name db 'comdlg32.dll',0
ole32_name db 'ole32.dll',0
oleaut32_name db 'oleaut32.dll',0
 
kernel32_thunks:
GetVersion dd rva GetVersion_thunk
CreateFileA dd rva CreateFileA_thunk
DeviceIoControl dd rva DeviceIoControl_thunk
CloseHandle dd rva CloseHandle_thunk
GetFileAttributesA dd rva GetFileAttributesA_thunk
SetFileAttributesA dd rva SetFileAttributesA_thunk
GetLastError dd rva GetLastError_thunk
ReadFile dd rva ReadFile_thunk
WriteFile dd rva WriteFile_thunk
ExitProcess dd rva ExitProcess_thunk
WritePrivateProfileStringA dd rva WritePrivateProfileStringA_thunk
GetShortPathNameA dd rva GetShortPathNameA_thunk
lstrlenA dd rva lstrlenA_thunk
VirtualAlloc dd rva VirtualAlloc_thunk
GetFileSize dd rva GetFileSize_thunk
DeleteFileA dd rva DeleteFileA_thunk
MultiByteToWideChar dd rva MultiByteToWideChar_thunk
GetCurrentProcess dd rva GetCurrentProcess_thunk
LoadLibraryA dd rva LoadLibraryA_thunk
GetProcAddress dd rva GetProcAddress_thunk
dw 0
thunk GetVersion
thunk CreateFileA
thunk DeviceIoControl
thunk CloseHandle
thunk GetFileAttributesA
thunk SetFileAttributesA
thunk GetLastError
thunk ReadFile
thunk WriteFile
thunk ExitProcess
thunk WritePrivateProfileStringA
thunk GetShortPathNameA
thunk lstrlenA
thunk VirtualAlloc
thunk GetFileSize
thunk DeleteFileA
thunk MultiByteToWideChar
thunk GetCurrentProcess
thunk LoadLibraryA
thunk GetProcAddress
 
user32_thunks:
MessageBoxA dd rva MessageBoxA_thunk
CharToOemA dd rva CharToOemA_thunk
OemToCharA dd rva OemToCharA_thunk
GetDlgItemTextA dd rva GetDlgItemTextA_thunk
dw 0
thunk MessageBoxA
thunk CharToOemA
thunk OemToCharA
thunk GetDlgItemTextA
 
comdlg32_thunks:
GetOpenFileNameA dd rva GetOpenFileNameA_thunk
dw 0
thunk GetOpenFileNameA
 
ole32_thunks:
CoInitializeEx dd rva CoInitializeEx_thunk
CoUninitialize dd rva CoUninitialize_thunk
CoInitializeSecurity dd rva CoInitializeSecurity_thunk
CoCreateInstance dd rva CoCreateInstance_thunk
CoSetProxyBlanket dd rva CoSetProxyBlanket_thunk
CoCreateGuid dd rva CoCreateGuid_thunk
StringFromGUID2 dd rva StringFromGUID2_thunk
dw 0
thunk CoInitializeEx
thunk CoUninitialize
thunk CoInitializeSecurity
thunk CoCreateInstance
thunk CoSetProxyBlanket
thunk CoCreateGuid
thunk StringFromGUID2
 
oleaut32_thunks:
VariantClear dd rva VariantClear_thunk
SafeArrayRedim dd rva SafeArrayRedim_thunk
SafeArrayPutElement dd rva SafeArrayPutElement_thunk
SysAllocString dd rva SysAllocString_thunk
SysFreeString dd rva SysFreeString_thunk
dw 0
thunk VariantClear
thunk SafeArrayRedim
thunk SafeArrayPutElement
thunk SysAllocString
thunk SysFreeString
end data
 
mtldr_code:
file 'mtldr_for_installer'
mtldr_code_size = $ - mtldr_code
 
dn db '\\.\'
img_name rb 256
img_real_name rb 256
mtldr_name rb 256
tmp_data rb 2000h
ostitle rb 260
systitle rb 262
 
align 4
OpenProcessToken dd ?
LookupPrivilegeValueA dd ?
AdjustTokenPrivileges dd ?
tmp dd ?
sdn rd 3
pi rd 8
varout rd 4
guid rd 4
b9x db ?
menuitems rb 100h
/programs/hd_load/mtldr_install/rsrc.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/usb_boot/BOOT_F32.ASM
0,0 → 1,183
; KolibriOS bootloader
; bootsector for loading from FAT32 flash (or hard) drive
; intended for use with mtldr_f file in root folder
; this code has been written by diamond in 2005,2006,2007 specially for KolibriOS
 
; this code is loaded by BIOS to 0000:7C00
org 0x7C00
jmp @f
nop
; times 57h db 0
file 'bt2.dat':3,57h
@@:
xor eax, eax
mov ds, ax
mov ss, ax
mov sp, 7C00h
mov [boot_drive], dl
cld
sti
push 800h
pop es
movzx ebx, word [7C0Eh] ; reserved_sect
mov [fat_start], ebx
mov al, byte [7C10h] ; num_fats
mul dword [7C24h] ; sect_fat
add eax, ebx
; cluster 2 begins from sector eax
movzx ebx, byte [7C0Dh] ; sects_per_clust
add bx, bx
sub eax, ebx
mov [data_start], eax
mov eax, [7C2Ch] ; root_cluster
and eax, 0FFFFFFFh
fat32_parse_dir:
xor bx, bx
mov di, bx
push eax
call read_cluster
movzx cx, byte [7C0Dh] ; sects_per_clust
shl cx, 4 ; *0x200/0x20
scan_cluster:
cmp byte [es:di], 0
jz file_not_found
push cx di
mov cx, 11
mov si, mtldr_f
repz cmpsb
pop di cx
jz file_found
add di, 20h
loop scan_cluster
pop eax
call next_cluster
jnc file_not_found
jc fat32_parse_dir
file_found:
pop eax
mov ax, [es:di+14h]
and ax, 0FFFh
shl eax, 10h
mov ax, [es:di+1Ah]
; eax contains first cluster
@@:
xor bx, bx
push eax
call read_cluster
mov ax, es
movzx cx, byte [7C0Dh]
shl cx, 5
add ax, cx
mov es, ax
pop eax
call next_cluster
jc @b
jmp 0:8000h
 
file_not_found:
mov si, file_not_found_msg
sayerr:
call out_string
jmp $
 
read_cluster:
; in: eax = cluster, bx->buffer
movzx ecx, byte [7C0Dh]
mul ecx
add eax, [data_start]
 
; read procedure
; in: eax = absolute sector
; cx = number of sectors
; es:bx -> buffer
read:
add eax, [7C1Ch] ; hidden sectors
push es
read_loop:
pushad
; allocate disk address packet on the stack
; qword +8: absolute block number
push 0
push 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, limited to 7Fh
sub cx, 7Fh
sbb ax, ax
and ax, cx
add ax, 7Fh
push ax
shl ax, 5
mov cx, es
add cx, ax
mov es, cx
; word +0: size of packet = 10h
push 10h
; now pair ss:sp contain address of disk address packet
mov ax, 4200h
mov dl, [boot_drive]
mov si, sp
int 13h
mov si, disk_read_err
jc sayerr
popaw
popad
add eax, 7Fh
sub cx, 7Fh
ja read_loop
pop es
ret
 
next_cluster:
push es
push ds
pop es
mov bx, 7E00h
; 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 read
@@:
pop eax
and eax, 7Fh
mov eax, [7E00h+eax*4]
and eax, 0FFFFFFFh
cmp eax, 0FFFFFF7h
mov si, bad_cluster
jz sayerr
pop es
ret
 
out_string:
lodsb
test al, al
jz .xxx
mov ah, 0Eh
mov bx, 7
int 10h
jmp out_string
.xxx: ret
 
file_not_found_msg db 'Cannot find file '
mtldr_f db 'MTLD_F32 '
db 13,10,0
disk_read_err db 'Disk read error',13,10,0
bad_cluster db 'Bad cluster',13,10,0
fat_cur_sector dd -1
 
times (7DFEh - $) db 0
db 55h, 0AAh
 
virtual at 7A00h
fat_start dd ?
data_start dd ?
boot_drive db ?
end virtual
/programs/hd_load/usb_boot/MBR
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/usb_boot/fat32.inc
0,0 → 1,83
fat32_parse_dir:
; in: eax=directory cluster
; out: eax=entry cluster
xor bx, bx
mov di, bx
push eax
call read_cluster
movzx cx, byte [7C0Dh]
shl cx, 4
.scan_cluster:
pop eax
cmp byte [es: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, [es:di+14h]
and ax, 0xFFF
shl eax, 10h
mov ax, [es: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 [es: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
/programs/hd_load/usb_boot/inst.asm
0,0 → 1,492
format PE GUI 4.0
section '.text' code readable executable
entry start
start:
xor ebx, ebx
mov esi, a2_src
mov edi, a2
movsd
movsd
movsd
movsd
movsd
push 1
call [SetErrorMode]
push ebx ; lpParam
push 400000h ; hInstance
push ebx ; hMenu
push ebx ; hWndParent
push 100 ; nHeight
push 200 ; nWidth
mov eax, 80000000h
push eax ; y
push eax ; x
push 10EF0140h ; dwStyle
push WndName
push ClassName
push 388h ; dwExStyle
call [CreateWindowExA]
xchg edi, eax
push 0Ah ; OEM_FIXED_FONT
call [GetStockObject]
push ebx
push eax
push 30h ; WM_SETFONT
call ListCommand
call CollectDrivesInfo
push MyWndProc
push -4 ; GWL_WNDPROC
push edi
call [SetWindowLongA]
mov [OldWndProc], eax
sub esp, 20h
mov esi, esp
@@:
push ebx
push ebx
push ebx
push esi
call [GetMessageA]
test eax, eax
jz @f
push esi
call [TranslateMessage]
push esi
call [DispatchMessageA]
jmp @b
@@:
add esp, 20h
ret
 
ListCommand:
pop eax
push edi
push eax
jmp [SendMessageA]
 
MyWndProc:
push edi ebx
xor ebx, ebx
mov edi, [esp+12]
cmp dword [esp+16], 2 ; WM_DESTROY
jnz @f
push ebx
call [PostQuitMessage]
@@:
cmp dword [esp+16], 219h ; WM_DEVICECHANGE
jnz w
cmp dword [esp+20], 8000h ; DBT_DEVICEARRIVAL
jz @f
cmp dword [esp+20], 8004h ; DBT_DEVICEREMOVECOMPLETE
jnz w
@@:
call UpdateDrivesInfo
w:
cmp dword [esp+16], 203h ; WM_LBUTTONDBLCLK
jnz @f
push ebx
push ebx
push 188h ; LB_GETCURSEL
call ListCommand
cmp eax, -1
jz @f
push n
push eax
push 189h ; LB_GETTEXT
call ListCommand
mov eax, n
mov byte [eax+2], bl
mov edx, [eax]
mov [mtldr_out], dl
mov dword [eax], '\\.\'
mov dword [eax+4], edx
call install
@@:
pop ebx edi
pop eax
push [OldWndProc]
push eax
jmp [CallWindowProcA]
 
UpdateDrivesInfo:
push ebx
push ebx
push 184h ; LB_RESETCONTENT
call ListCommand
 
CollectDrivesInfo:
push esi
call [GetLogicalDrives]
mov esi, eax
mov edx, a
mov byte [edx], 'A'
l:
shr esi, 1
jnc d
mov [edx+2], bl
push edx
call [GetDriveTypeA]
; Uncomment following lines to allow hard drives
; cmp eax, 3 ; DRIVE_FIXED
; jz @f
cmp eax, 2 ; DRIVE_REMOVABLE
jnz d
push ebx ; hTemplateFile
push ebx ; dwFlagsAndAttributes
push 3 ; dwCreationDisposition = OPEN_EXISTING
push ebx ; lpSecurityAttributes
push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE
push ebx ; dwDesiredAccess
push a2
call [CreateFileA]
cmp eax, -1
jz d
push eax
push ebx
mov ecx, esp
push ebx ; lpOverlapped
push ecx ; lpBytesReturned
push 1024 ; nOutBufferSize
push n ; lpOutBuffer
push ebx
push ebx
push 70C00h ; IOCTL_DISK_GET_MEDIA_TYPES
push eax
call [DeviceIoControl]
pop ecx
pop eax
push ecx
push eax
call [CloseHandle]
pop ecx
jecxz @f ; not supported => OK
cmp byte [n+8], 11
jnz d
@@:
mov eax, a
mov ecx, n
mov byte [eax+2], '\'
push ecx
push ebx ; nFileSystemNameSize
push ebx ; lpFileSystemNameBuffer
push ebx ; lpFileSystemFlags
push ebx ; lpMaximumComponentLength
push ebx ; lpVolumeSerialNumber
push 1024 ; nVolumeNameSize
mov edx, [eax]
mov [ecx], edx
mov word [ecx+3], ' ['
add ecx, 5
mov byte [ecx], bl
push ecx ; lpVolumeNameBuffer
push eax ; lpRootPathName
call [GetVolumeInformationA]
pop eax
push eax
cmp byte [eax+5], bl
jz nol
@@:
inc eax
cmp byte [eax-1], bl
jnz @b
mov word [eax-1], ']'
; jmp @f
nol:
mov byte [eax+3], bl
@@:
push ebx
push 180h ; LB_ADDSTRING
call ListCommand
d:
mov edx, a
inc byte [edx]
test esi, esi
jnz l
pop esi
ret
 
install:
push ebx ; hTemplateFile
push ebx ; dwFlagsAndAttributes
push 3 ; dwCreationDisposition = OPEN_EXISTING
push ebx ; lpSecurityAttributes
push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE
push 0C0000000h ; dwDesiredAccess = GENERIC_READ|GENERIC_WRITE
push eax
call [CreateFileA]
cmp eax, -1
jz deverre
push esi ebp
mov ebp, bootsect_dev
xchg esi, eax
push eax
mov eax, esp
push ebx
push eax
push 512
push ebp
push esi
call [ReadFile]
test eax, eax
jnz @f
deverrl:
push esi
call [CloseHandle]
pop eax
pop ebp esi
deverre:
push 10h
push ebx
push deverr
push edi
call [MessageBoxA]
ret
@@:
; make sure that this is FAT32 volume
cmp word [ebp+0Bh], 200h ; bytes per sector
jnz bootinv
cmp word [ebp+0Eh], bx ; reserved sectors
jz bootinv
cmp byte [ebp+10h], bl ; number of FATs
jz bootinv
cmp word [ebp+11h], bx ; root dir entries
jnz bootinv ; must be 0 for FAT32
cmp word [ebp+16h], bx ; length of one copy of FAT1x
jnz bootinv
cmp dword [ebp+20h], ebx ; length of one copy of FAT32
jz bootinv
cmp byte [ebp+42h], ')' ; magic value
jz @f
bootinv:
push 10h
push ebx
push nofat32
jmp re
@@:
; ok, this is really correct FAT32 volume, so start install
; copy file mtldr_f
push 80h
push mtldr_out
call [SetFileAttributesA]
push ebx ; bFailIfExists
push mtldr_out ; lpNewFileName
push mtldr_in ; lpExistingFileName
call [CopyFileA]
test eax, eax
jnz @f
push 10h
push ebx
push mterr
re:
push edi
call [MessageBoxA]
jmp r
@@:
push 7
push mtldr_out
call [SetFileAttributesA]
; load bootsector
push ebx ; hTemplateFile
push ebx ; dwFlagsAndAttributes
push 3 ; dwCreationDisposition = OPEN_EXISTING
push ebx ; lpSecurityAttributes
push 1 ; dwShareMode = FILE_SHARE_READ
push 80000000h ; dwDesiredAccess = GENERIC_READ
push btname
call [CreateFileA]
cmp eax, -1
jnz @f
bterrc:
push 40h
push ebx
push bterr
jmp re
@@:
mov ecx, esp
push eax
push ebx
push ecx
push 512
push bootsect_new
push eax
call [ReadFile]
pop ecx
push eax
push ecx
call [CloseHandle]
pop eax
test eax, eax
jz bterrc
cmp dword [esp], 512
jnz bterrc
; patch bootsector with real values
push esi edi
mov esi, bootsect_new
mov edi, bootsect_dev
movsb
movsb
movsb
add esi, 57h
add edi, 57h
mov ecx, 200h-5Ah
rep movsb
pop edi esi
; write bootsector
push ebx
push ebx
push ebx
push esi
call [SetFilePointer]
test eax, eax
jnz deverrl
mov eax, esp
push ebx
push eax
push 512
push ebp
push esi
call [WriteFile]
test eax, eax
jz deverrl
cmp dword [esp], 512
jnz deverrl
; Patch backup copy of boot sector, ignore errors
movzx eax, word [ebp+50]
test eax, eax
jz done_succ
; sanity check: it must be in the reserved area, not in data
cmp ax, word [ebp+14]
jae done_succ
shl eax, 9
push ebx
push ebx
push eax
push esi
call [SetFilePointer]
cmp eax, -1
jz done_succ
mov eax, esp
push ebx
push eax
push 512
push ebp
push esi
call [WriteFile]
; done!
done_succ:
push 40h
push ok
push succ
push edi
call [MessageBoxA]
push ebx
call [PostQuitMessage]
r:
pop eax
push esi
call [CloseHandle]
pop ebp esi
ret
 
section '.rdata' data readable
 
data resource from 'rsrc.res'
end data
 
ClassName db 'LISTBOX',0
WndName db 'Select drive',0
deverr db 'Cannot open physical device or device error (no administrator rights?)',0
nofat32 db 'Not FAT32 volume. Sorry, only FAT32 is supported at moment.',0
ok db 'Success',0
succ db 'Kolibri flash loader was successfully installed!',10
db 'Now you can copy the image kolibri.img and boot!',0
mterr db 'Cannot copy MTLD_F32',0
bterr db 'Cannot load '
btname db 'BOOT_F32.BIN',0
 
data import
macro thunk a
{a#_thunk:dw 0
db `a,0}
dd 0,0,0, rva kernel32_name, rva kernel32_thunks
dd 0,0,0, rva user32_name, rva user32_thunks
dd 0,0,0, rva gdi32_name, rva gdi32_thunks
dd 0,0,0,0,0
kernel32_name db 'kernel32.dll',0
user32_name db 'user32.dll',0
gdi32_name db 'gdi32.dll',0
kernel32_thunks:
GetLogicalDrives dd rva GetLogicalDrives_thunk
GetDriveTypeA dd rva GetDriveTypeA_thunk
GetVolumeInformationA dd rva GetVolumeInformationA_thunk
CreateFileA dd rva CreateFileA_thunk
ReadFile dd rva ReadFile_thunk
WriteFile dd rva WriteFile_thunk
SetFilePointer dd rva SetFilePointer_thunk
CloseHandle dd rva CloseHandle_thunk
SetErrorMode dd rva SetErrorMode_thunk
CopyFileA dd rva CopyFileA_thunk
SetFileAttributesA dd rva SetFileAttributesA_thunk
DeviceIoControl dd rva DeviceIoControl_thunk
dw 0
thunk GetLogicalDrives
thunk GetDriveTypeA
thunk GetVolumeInformationA
thunk CreateFileA
thunk ReadFile
thunk WriteFile
thunk SetFilePointer
thunk CloseHandle
thunk SetErrorMode
thunk CopyFileA
thunk SetFileAttributesA
thunk DeviceIoControl
user32_thunks:
CreateWindowExA dd rva CreateWindowExA_thunk
GetMessageA dd rva GetMessageA_thunk
TranslateMessage dd rva TranslateMessage_thunk
DispatchMessageA dd rva DispatchMessageA_thunk
PostQuitMessage dd rva PostQuitMessage_thunk
CallWindowProcA dd rva CallWindowProcA_thunk
SetWindowLongA dd rva SetWindowLongA_thunk
SendMessageA dd rva SendMessageA_thunk
MessageBoxA dd rva MessageBoxA_thunk
dw 0
thunk CreateWindowExA
thunk GetMessageA
thunk TranslateMessage
thunk DispatchMessageA
thunk PostQuitMessage
thunk CallWindowProcA
thunk SetWindowLongA
thunk SendMessageA
thunk MessageBoxA
gdi32_thunks:
GetStockObject dd rva GetStockObject_thunk
dw 0
thunk GetStockObject
end data
 
a2_src:
db '\\.\'
db '?:',0,0
db '?:\'
db 'MTLD_F32',0
 
section '.data' data readable writable
 
;a2 db '\\.\'
;a db '?:',0,0
;mtldr_out db '?:\'
;mtldr_in db 'MTLD_F32',0
a2 rb 4
a rb 4
mtldr_out rb 3
mtldr_in rb 9
 
align 4
OldWndProc dd ?
devpath rb 1024
n rb 1032
bootsect_dev rb 512
bootsect_new rb 512
/programs/hd_load/usb_boot/mtldr.asm
0,0 → 1,453
; KolibriOS bootloader
; this code has been written by diamond in 2005,2006,2007 specially for KolibriOS
 
; this code is loaded by our bootsector to 0000:8000
format binary
use16
 
out_string = 0x7DA2
read_cluster = 0x7D0A
relative_read = 0x7D18
next_cluster = 0x7D5C
 
org 0x8000
start:
; cs=ds=0, es undefined, ss=0, sp=7C00
movzx esp, sp
push 1000h
pop es
; say hi to user
mov si, start_msg
call out_string
; parse image name
mov eax, [7C2Ch] ; root_cluster
and eax, 0xFFFFFFF
mov [cur_obj], root_string
.parsedir:
push ax
mov si, [imgnameofs]
push si
@@:
lodsb
cmp al, 0
jz @f
cmp al, '\'
jnz @b
dec si
mov [missing_slash], si
inc si
@@:
xchg ax, [esp+2]
mov byte [si-1], 0
mov [imgnameofs], si
call fat32_parse_dir
call restore_slash
pop cx
test cl, cl
jz .end
test byte [es:di+0Bh], 10h
mov si, notdir_string
jz find_error_si
jmp .parsedir
.end:
test byte [es:di+0Bh], 10h
mov si, directory_string
jnz find_error_si
; parse FAT chunk
; runlist at 5000:0000
mov di, 4
push 5000h
pop es
mov dword [es:di-4], 1
stosd
.parsefat:
call next_cluster
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
read_img_file:
xor si, si
push es
pop fs
; yes! Now read file to 0x100000
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 esi, byte [7C0Dh]
mul esi
add eax, [7A04h]
push ax
mov ax, 0x200
div si
cmp cx, ax
jb @f
mov cx, ax
@@:
pop ax
add [esp+1Ch], ecx
sub [esp+18h], cx
imul cx, si
push cx
call relative_read
pop cx
; move it to extended memory
mov byte [sou_addr+2], 1
.move_loop:
push cx
cmp cx, 80h
jbe @f
mov cx, 80h
@@:
mov ah, 87h
xchg cl, ch
mov si, movedesc
push cx es
push ds
pop es
int 15h
pop es cx
test ah, ah
mov si, exmem_string
jnz find_error_si
add [dest_addr], ecx
add [dest_addr], ecx
inc byte [sou_addr+2]
mov al, ch
mov ah, cl
pop cx
sub cx, ax
jnz .move_loop
popad
test cx, cx
jnz .img_read_cluster
jmp .img_read_block
.img_read_done:
; kolibri.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 kolibri.img
push ax
dec ax
dec ax
movzx cx, byte [50Dh]
mul cx
add ax, [img_data_start]
; now ax is sector in kolibri.img
mov [kernel_mnt_in_img], ax
movzx cx, byte [7C0Dh]
div cx
; now ax is cluster in kolibri.img and
; dx is offset from the beginning of cluster
movzx eax, ax
push 5000h
pop ds
xor si, si
mov si, 1
.scani:
sub eax, [si]
jb .scanidone
; sanity check
cmp dword [si], 0
push data_error_msg
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, byte [7C0Dh]
push dx
mul ecx ; get sector
pop dx
movzx edx, dx
add eax, edx
add eax, [7A04h]
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
mov si, newline
call out_string
jmp $
 
file_not_found:
mov si, [esp+2]
mov [cur_obj], si
push notfound_string
jmp find_error_sp
 
restore_slash:
mov si, [missing_slash]
test si, si
jz @f
and [missing_slash], 0
mov byte [si], '\'
@@: ret
 
include 'fat32.inc'
 
if 0
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
else
write1st = 0
end if
 
loader_block:
db 1 ; version
dw 1 ; flags - image is loaded
dw write1st ; offset
dw 0 ; segment
 
imgnameofs dw kolibri_img_name
 
; -----------------------------------------------
; ------------------ Settings -------------------
; -----------------------------------------------
 
; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan
kernel_mnt_name db 'kernel.mnt',0
kolibri_img_name db 'kolibri.img',0
 
missing_slash dw 0
 
start_msg db 2,' KolibriOS bootloader, FAT32 flash version'
newline db 13,10,0
error_msg db 'Error'
colon db ': ',0
root_string db '\',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
exmem_string db 'extended memory error',0
bad_cluster_string db 'bad cluster',0
data_error_msg db 'data error',0
 
align 2
 
; uninitialized data follows
cur_obj dw ?
img_data_start dw ?
kernel_mnt_in_img dw ?
fat_start dw ?
kernel_mnt_1st dd ?
/programs/hd_load/usb_boot/readme.txt
0,0 → 1,48
 êîìïëåêò ïîñòàâêè âõîäÿò:
BOOT_F32.BIN - áóòñåêòîð äëÿ FAT32;
MTLD_F32 - âñïîìîãàòåëüíûé ôàéë çàãðóç÷èêà;
inst.exe - óñòàíîâùèê ïîä ëèíåéêó WinNT+;
setmbr.exe - óñòàíàâëèâàåò ñòàíäàðòíûé MBR (÷èòàéòå íèæå);
readme.txt - ýòîò ôàéë.
 
Äëÿ óñòàíîâêè íåîáõîäèìà ôëåøêà ñ ôàéëîâîé ñèñòåìîé FAT32, ñâîáîäíîãî ìåñòà
íà êîòîðîé äîñòàòî÷íî äëÿ ðàçìåùåíèÿ ôàéëà kolibri.img è ïëþñ åù¸ ïàðà Êá
íà çàãðóç÷èê.
 
Óñòàíîâêà äëÿ ïîëüçîâàòåëåé WinNT+:
Çàïóñêàåòå inst.exe, ïîÿâëÿåòñÿ ñïèñîê ïîäêëþ÷¸ííûõ ôëåøåê, âûáèðàåòå
òó, íà êîòîðóþ õîòèòå óñòàíîâèòü, è äâàæäû ù¸ëêàåòå ïî íåé. Îá óñïåõå ïðîãðàììà
ñîîáùèò. Î íåóñïåõå (íå óäàëîñü ïðî÷èòàòü/çàïèñàòü íà äèñê èëè äèñê íå
ÿâëÿåòñÿ FAT32-òîìîì) - òîæå.
Êîïèðóåòå íà ôëåøêó ôàéë kolibri.img ñ íóæíîé âàì âåðñèåé
äèñòðèáóòèâà. (Ýòè äâà äåéñòâèÿ ìîæíî îñóùåñòâëÿòü â ëþáîì ïîðÿäêå.)
Òåïåðü ñ ôëåøêè ìîæíî ãðóçèòüñÿ.
 
ß ñòîëêíóëñÿ ñ ñèòóàöèåé, êîãäà (íåäàâíî âûïóùåííàÿ) ôëåøêà îòêàçûâàåòñÿ
çàãðóæàòüñÿ, âûäàâàÿ ñîîáùåíèå "Pen drive Without Operating System.Remove
Pen Drive And Reboot." Åñëè âìåñòî çàãðóçêè ïîÿâëÿåòñÿ
òàêîå æå èëè ïîäîáíîå ñîîáùåíèå, ñêîðåå âñåãî, ïîìîæåò setmbr.exe.
Åãî íóæíî çàïóñêàòü ñ ïðàâàìè àäìèíèñòðàòîðà. Ïîñëå çàïóñêà â ïîÿâèâøåìñÿ
ñïèñêå íóæíî äâàæäû ù¸ëêíóòü ïî äèñêó, ñîîòâåòñòâóþùåìó âàøåé ôëåøêå.
Îá óñïåõå è íåóñïåõå ïðîãðàììà ñîîáùèò.
 
Óñòàíîâêà äëÿ ïîëüçîâàòåëåé äðóãèõ îïåðàöèîííûõ ñèñòåì:
àâòîìàòè÷åñêàÿ - ïîêà íå ïîääåðæèâàåòñÿ. Åñëè âû óìååòå ðàáîòàòü ñ ðåäàêòîðîì
äèñêîâ, âàì ïîìîãóò ñëåäóþùèå ñâåäåíèÿ: inst.exe ïðè óñòàíîâêå äåëàåò
ñëåäóþùåå:
- ñ÷èòûâàåò áóòñåêòîð, óáåæäàåòñÿ, ÷òî îí äåéñòâèòåëüíî FAT32;
- êîïèðóåò íà ôëåøêó ôàéë MTLD_F32, ïîïóòíî óñòàíàâëèâàÿ åìó àòðèáóòû
"ñêðûòûé","ñèñòåìíûé","òîëüêî äëÿ ÷òåíèÿ" (äëÿ ñàìîãî çàãðóç÷èêà àòðèáóòû
ðîëè íå èãðàþò, ýòî ÷òîáû ôàéë íå ëåç íà ãëàçà êîìó íå íàäî);
- ñ÷èòûâàåò ôàéë BOOT_F32.BIN; â ïðî÷èòàííûõ äàííûõ çàìåíÿåò ïàðàìåòðû
íà÷èíàÿ ñî ñìåùåíèÿ 3 è çàêàí÷èâàÿ 0x5A (0x57 áàéò) èç áóòñåêòîðà ôëåøêè;
- òî, ÷òî ïîëó÷èëîñü, çàïèñûâàåò íàçàä â áóòñåêòîð ôëåøêè,
à òàêæå â ðåçåðâíóþ êîïèþ áóòñåêòîðà, åñëè îíà åñòü (ïîëå ðàçìåðîì â 2 áàéòà
ñî ñìåùåíèåì 0x32) (ðåçåðâíóþ êîïèþ ìåíÿòü íà ñàìîì äåëå íåîáÿçàòåëüíî,
âñ¸ ðàâíî â ðåàëüíîé æèçíè îíà íå íóæíà).
 
Íàïðèìåð, ïîä Linux íîâûé áóòñåêòîð íà äèñê /dev/sdb1 (çàìåíèòå íà óñòðîéñòâî,
ñîîòâåòñòâóþùåå FAT32-òîìó) ìîæíî óñòàíîâèòü ïîñëåäîâàòåëüíîñòüþ èç äâóõ êîìàíä:
dd if=/dev/sdb1 of=BOOT_F32.BIN bs=1 skip=3 seek=3 count=87 conv=notrunc
dd if=BOOT_F32.BIN of=/dev/sdb1 bs=512 count=1 conv=notrunc
Êîïèðîâàíèå ôàéëîâ mtld_f32 è kolibri.img îñóùåñòâëÿåòñÿ îáû÷íûì ñïîñîáîì.
/programs/hd_load/usb_boot/rsrc.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/usb_boot/setmbr.asm
0,0 → 1,389
format PE GUI 4.0
section '.text' code readable executable
entry start
start:
xor ebx, ebx
push ebx ; lpParam
push 400000h ; hInstance
push ebx ; hMenu
push ebx ; hWndParent
push 100 ; nHeight
push 200 ; nWidth
mov eax, 80000000h
push eax ; y
push eax ; x
push 10EF0140h ; dwStyle
push WndName
push ClassName
push 388h ; dwExStyle
call [CreateWindowExA]
mov edi, eax
push 0Ah ; OEM_FIXED_FONT
call [GetStockObject]
push ebx
push eax
push 30h ; WM_SETFONT
push edi
call [SendMessageA]
call CollectDrivesInfo
push MyWndProc
push -4 ; GWL_WNDPROC
push edi
call [SetWindowLongA]
mov [OldWndProc], eax
sub esp, 20h
mov esi, esp
@@:
push ebx
push ebx
push ebx
push esi
call [GetMessageA]
test eax, eax
jz @f
push esi
call [TranslateMessage]
push esi
call [DispatchMessageA]
jmp @b
@@:
add esp, 20h
ret
 
MyWndProc:
push edi
mov edi, [esp+8]
cmp dword [esp+12], 2 ; WM_DESTROY
jnz @f
push 0
call [PostQuitMessage]
@@:
cmp dword [esp+12], 219h ; WM_DEVICECHANGE
jnz w
cmp dword [esp+16], 8000h ; DBT_DEVICEARRIVAL
jz @f
cmp dword [esp+16], 8004h ; DBT_DEVICEREMOVECOMPLETE
jnz w
@@:
call UpdateDrivesInfo
w:
cmp dword [esp+12], 203h ; WM_LBUTTONDBLCLK
jnz @f
push 0
push 0
push 188h ; LB_GETCURSEL
push edi
call [SendMessageA]
cmp eax, -1
jz @f
push n+4
push eax
push 189h ; LB_GETTEXT
push edi
call [SendMessageA]
mov dword [n], '\\.\'
mov byte [n+4+aPhysicalDrive.sz], 0
call install
@@:
pop edi
pop eax
push [OldWndProc]
push eax
jmp [CallWindowProcA]
 
UpdateDrivesInfo:
push 0
push 0
push 184h ; LB_RESETCONTENT
push edi
call [SendMessageA]
 
CollectDrivesInfo:
xor eax, eax
mov ecx, 32
push edi
mov edi, PhysicalDrives
rep stosd
pop edi
push esi
call [GetLogicalDrives]
mov esi, eax
mov [a], 'A'
l:
shr esi, 1
jnc d
mov [a+2], 0
push a
call [GetDriveTypeA]
; Uncomment following lines to allow hard drives
; cmp eax, 3 ; DRIVE_FIXED
; jz @f
cmp eax, 2 ; DRIVE_REMOVABLE
jnz d
@@:
push 0 ; hTemplateFile
push 0 ; dwFlagsAndAttributes
push 3 ; dwCreationDisposition = OPEN_EXISTING
push 0 ; lpSecurityAttributes
push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE
push 0 ; dwDesiredAccess
push a2
call [CreateFileA]
cmp eax, -1
jz d
push eax
push 0
mov ecx, esp
push 0 ; lpOverlapped
push ecx ; lpBytesReturned
push 12 ; nOutBufferSize
push sdn ; lpOutBuffer
push 0
push 0
push 2D1080h ; IOCTL_STORAGE_GET_DEVICE_NUMBER
push eax
call [DeviceIoControl]
pop ecx
pop edx
push eax
push edx
call [CloseHandle]
pop eax
test eax, eax
jz d ; probably it is floppy
mov eax, [sdn+4]
cmp eax, 32
jae d
movzx ecx, byte [a]
sub cl, 'A'
bts [PhysicalDrives+eax*4], ecx
d:
inc [a]
test esi, esi
jnz l
xor esi, esi
.physloop:
push esi
mov esi, [PhysicalDrives+esi*4]
test esi, esi
jz .physnext
push edi esi
mov esi, aPhysicalDrive
mov edi, n
@@:
lodsb
stosb
test al, al
jnz @b
pop esi
dec edi
mov eax, [esp+4]
cmp al, 10
jb .1dig
aam
add ah, '0'
mov byte [edi], ah
inc edi
.1dig:
add al, '0'
stosb
mov al, ':'
stosb
mov cl, 'A'-1
.logloop:
mov al, ' '
stosb
mov al, cl
stosb
@@:
inc byte [edi-1]
shr esi, 1
jnc @b
mov cl, [edi-1]
mov al, ':'
stosb
mov al, '\'
stosb
test esi, esi
jnz .logloop
mov al, 0
stosb
pop edi
push n
push 0
push 180h ; LB_ADDSTRING
push edi
call [SendMessageA]
.physnext:
pop esi
inc esi
cmp esi, 32
jb .physloop
pop esi
ret
 
install:
push 0 ; hTemplateFile
push 0 ; dwFlagsAndAttributes
push 3 ; dwCreationDisposition = OPEN_EXISTING
push 0 ; lpSecurityAttributes
push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE
push 0C0000000h ; dwDesiredAccess = GENERIC_READ|GENERIC_WRITE
push n
call [CreateFileA]
cmp eax, -1
jnz @f
deverre:
push 10h
push 0
push deverr
push edi
call [MessageBoxA]
ret
@@:
push esi
mov esi, eax
push eax
mov eax, esp
push 0
push eax
push 512
push mbr_dev
push esi
call [ReadFile]
test eax, eax
jnz @f
deverrl:
push esi
call [CloseHandle]
pop eax
pop esi
jmp deverre
@@:
push esi edi
mov esi, mbr_new
mov edi, mbr_dev
mov ecx, 1B8h
rep movsb
mov al, [edi+6]
or al, [edi+16h]
or al, [edi+26h]
or al, [edi+36h]
test al, al
js @f
or byte [edi+6], 80h
@@:
pop edi esi
push 0
push 0
push 0
push esi
call [SetFilePointer]
test eax, eax
jnz deverrl
mov eax, esp
push 0
push eax
push 512
push mbr_dev
push esi
call [WriteFile]
test eax, eax
jz deverrl
cmp dword [esp], 512
jnz deverrl
; done!
done_succ:
push 40h
push ok
push succ
push edi
call [MessageBoxA]
push 0
call [PostQuitMessage]
r:
pop eax
push esi
call [CloseHandle]
pop esi
ret
 
section '.data' data readable writable
data resource from 'rsrc.res'
end data
 
ClassName db 'LISTBOX',0
WndName db 'Select drive',0
deverr db 'Cannot open physical device or device error (no administrator rights?)',0
ok db 'Success',0
succ db 'Standard MBR has been installed',0
a2 db '\\.\'
a db '?:',0,0
aPhysicalDrive db 'PhysicalDrive',0
.sz = $ - aPhysicalDrive
 
data import
macro thunk a
{a#_thunk:dw 0
db `a,0}
dd 0,0,0, rva kernel32_name, rva kernel32_thunks
dd 0,0,0, rva user32_name, rva user32_thunks
dd 0,0,0, rva gdi32_name, rva gdi32_thunks
dd 0,0,0,0,0
kernel32_name db 'kernel32.dll',0
user32_name db 'user32.dll',0
gdi32_name db 'gdi32.dll',0
kernel32_thunks:
GetLogicalDrives dd rva GetLogicalDrives_thunk
GetDriveTypeA dd rva GetDriveTypeA_thunk
CreateFileA dd rva CreateFileA_thunk
ReadFile dd rva ReadFile_thunk
WriteFile dd rva WriteFile_thunk
SetFilePointer dd rva SetFilePointer_thunk
CloseHandle dd rva CloseHandle_thunk
DeviceIoControl dd rva DeviceIoControl_thunk
dw 0
thunk GetLogicalDrives
thunk GetDriveTypeA
thunk CreateFileA
thunk ReadFile
thunk WriteFile
thunk SetFilePointer
thunk CloseHandle
thunk DeviceIoControl
user32_thunks:
CreateWindowExA dd rva CreateWindowExA_thunk
GetMessageA dd rva GetMessageA_thunk
TranslateMessage dd rva TranslateMessage_thunk
DispatchMessageA dd rva DispatchMessageA_thunk
PostQuitMessage dd rva PostQuitMessage_thunk
CallWindowProcA dd rva CallWindowProcA_thunk
SetWindowLongA dd rva SetWindowLongA_thunk
SendMessageA dd rva SendMessageA_thunk
MessageBoxA dd rva MessageBoxA_thunk
dw 0
thunk CreateWindowExA
thunk GetMessageA
thunk TranslateMessage
thunk DispatchMessageA
thunk PostQuitMessage
thunk CallWindowProcA
thunk SetWindowLongA
thunk SendMessageA
thunk MessageBoxA
gdi32_thunks:
GetStockObject dd rva GetStockObject_thunk
dw 0
thunk GetStockObject
end data
 
align 4
mbr_new:
file 'mbr'
 
align 4
OldWndProc dd ?
PhysicalDrives rd 32
sdn rd 3
n rb 1024
mbr_dev rb 512
/programs/hd_load/usb_boot_old/MeOSload.asm
0,0 → 1,449
;
; MenuesOS Boot Loader
;
; Author: Trans
; Date: 14.02.03
; Version: 1.0
;
; Current Version: 1.1
; Date of modification: 11.06.03
;
; Compile with FASM
;
 
;--------Code------------
org 100h
 
start:
push cs
pop ds
mov ax,0003h
int 10h
 
mov dx,title
call print
mov dx,title_1
call print
; mov dx,mes1
; call print
 
;-------open Msetup.exe--------------
mov dx,img0
call file_open
cmp ax,00h
je loader_next_file_search_0
mov [handle],ax
mov [foffset],dword 00h
jmp loader_continue
loader_next_file_search_0:
mov dx,img1
call file_open
cmp ax,00h
je loader_next_file_search_00
mov [handle],ax
jmp loader_continue
loader_next_file_search_00:
mov dx,img2
call file_open
cmp ax,00h
je loader_next_file_search_01
mov [handle],ax
mov [foffset],dword 00h
jmp loader_continue
loader_next_file_search_01:
mov dx,img3
call file_open
cmp ax,00h
je loader_not_find_file
mov [handle],ax
mov [foffset],dword 00h
loader_continue:
 
;******* Load IMAGE in memory***************************************************
mov dx,start_img_read
call print
 
mov bx,ax
xor cx,cx ; cx:dx - offset in bytes (cx*65535+dx)
xor edx,edx
call file_offset
mov [image_counter],0
@@_1:
mov bx,[handle]
mov dx,buffer ;ds:dx - buffer
mov cx,512*96
call file_read
 
push fs
xor ax,ax ;AX = 0
mov fs,ax ;DS = AX = 0 ..Èñïîëüçóåò ËÈÍÅÉÍÎÅ ÀÄÐÅÑÎÂÀÍÈÅ!
mov ecx,512*96
mov si,buffer
movzx edi,[image_counter]
imul edi,48*1024
add edi,0x100000
@@:
mov al,[si]
mov [fs:edi],al
inc edi
inc esi
loop @b
pop fs
 
mov dx,progress_img_read
call print
 
inc [image_counter]
mov bx,[handle] ;ax
movzx edx,[image_counter]
imul edx,48*1024
mov ecx,edx
shr ecx,16
call file_offset
cmp [image_counter],30
jne @@_1
 
mov dx,end_img_read
call print
 
mov dx,start_kernel_read
call print
;*******************************************************************************
;-------Move pointer to boot-sector--
mov bx,[handle] ;ax
xor cx,cx
mov edx,[foffset]
call file_offset
 
;---------Read boot-sector-----------
mov bx,[handle]
mov dx,buffer
mov cx,512
call file_read
 
;--------Read parametrs--------------
mov ax,[buffer+0bh]
mov [SectSize],ax
mov al,[buffer+0dh]
mov [ClustSect],al
mov ax,[buffer+0eh]
mov [ResSect],ax
add ax,[ResRgn]
mov [FATRgn],ax
mov al,[buffer+10h]
mov [FATCnt],al
xor bx,bx
mov bl,al
mov ax,[buffer+11h]
mov [RootEnt],ax
shr ax,4 ; ax=ax*32/512
mov [RootDirRgnSz],ax
mov ax,[buffer+16h]
mov [FATSect],ax
mul bx
mov [FATRgnSz],ax
add ax,[FATRgn]
mov [RootDirRgn],ax
add ax,[RootDirRgnSz]
mov [DataRgn],ax
 
;------Read FATs and RootDir---------
xor eax,eax
xor edx,edx
mov ax,[FATRgn]
mul [SectSize]
add eax,[foffset]
mov cx,dx
mov dx,ax
mov bx,[handle]
call file_offset
mov ax,[FATRgnSz]
mul [SectSize]
mov cx,ax
mov dx,buffer
mov bx,[handle]
call file_read
mov cx,[RootEnt]
shl cx,5
mov dx,Root
mov bx,[handle]
call file_read
 
;-------Search entry pointer in RootDir---------
push ds
pop es
mov cx,[RootEnt]
mov bx,Root
loader_loc_00:
push cx
mov cx,11
mov di,bx
mov si,kernel
repe cmpsb
jnz loader_notfound
pop cx
jmp loader_find
loader_notfound:
pop cx
add bx,32
loop loader_loc_00
loader_find:
 
mov ax,[bx+1ah]
mov [FirstClust],ax
mov eax,[bx+1ch]
mov [filesize],eax
 
;------Read Kernel----------------------
call read_kernel
 
;---------------------------------------
 
mov bx,[handle]
call file_close
;;;;;;;;;;;;;;;;;;;;;;
jmp loader_yes
;;;;;;;;;;;;;;;;;;;;;;
; mov dx,mes2
; call print
;loader_key:
; mov ah,00h
; int 16h
; cmp al,1bh ;ESC
; je loader_no
; cmp al,6eh ;'n'
; je loader_no
; cmp al,4eh ;'N'
; je loader_no
; cmp al,79h ;'y'
; je loader_yes
; cmp al,59h ;'Y'
; je loader_yes
; jmp loader_key
 
loader_not_find_file:
mov dx,mes4
call print
jmp loader_exit
 
loader_yes:
mov dx,yes
call print
mov ax,7000h
mov es,ax
mov si,move_kernel
xor di,di
mov cx,len_mk
rep movsb
jmp far 7000h:0000h
; jmp loader_exit
loader_no:
mov dx,no
call print
 
loader_exit:
mov dx,mes3
call print
retn
;----Subprogramms--------
 
print:
; in: dx - offset of ASCII string
; out:
mov ah,09h
int 21h
retn
 
file_open:
; in: ds:dx - offset of ASCIIZ filename string
; out: ax - file handle (ax=0 - not found)
mov ax,3d00h
int 21h
jnc fo_exit
xor ax,ax
fo_exit:
retn
 
file_close:
; in: bx - file handle
; out:
mov ah,3eh
int 21h
retn
 
file_read:
; in: bx - file handle
; ds:dx - buffer
; cx - numbers of bytes
; out:
mov ah,3fh
int 21h
retn
 
file_offset:
; in: bx - file handle
; cx:dx - offset in bytes (cx*65535+dx)
; out:
mov ax,4200h
int 21h
retn
 
sector_find:
; in: ax - No of Cluster
; out: ax - 1st sector of Cluster
dec ax
dec ax
push bx
xor bx,bx
mov bl,[ClustSect]
mul bx
pop bx
add ax,[DataRgn]
retn
 
read_cluster:
; in: ax - No of Cluster
; ds:dx - buffer
; out:
push dx
call sector_find
push ax
xor eax,eax
xor ebx,ebx
pop ax
mov bx,[SectSize]
mul ebx
add eax,[foffset]
mov dx,ax
shr eax,16
mov cx,ax
mov bx,[handle]
call file_offset
xor ax,ax
mov al,[ClustSect]
mul [SectSize]
mov cx,ax
mov bx,[handle]
pop dx
call file_read
retn
 
read_kernel:
; in:
; out:
mov ax,8000h
mov es,ax ;8000:0000 = 80000h - Temporal location of kernel
xor di,di ;
mov ax,[FirstClust]
mov bp,ax
rk_loc_00:
push es
mov dx,Root
call read_cluster
xor ax,ax ; Moving cluster to area of location kernel
mov al,[ClustSect] ;
mul [SectSize] ;
mov cx,ax ;
pop es ;
mov si,Root ;
rep movsb ;
cmp di,00h
jne rk_continue
mov ax,es
add ax,1000h
mov es,ax
rk_continue:
mov ax,bp
cmp ax,0ff8h
jae rk_done
shl ax,1 ; Val=Clustrer*1,5 //(Cluster*3)/2
add ax,bp ;
shr ax,1 ;
mov bx,ax
add bx,buffer
mov ax,[bx]
bt bp,0
jc rk_nechet
and ax,0fffh
jmp rk_chet
rk_nechet:
shr ax,4
rk_chet:
mov bp,ax
jmp rk_loc_00
rk_done:
retn
 
move_kernel:
; in:
; out:
mov ax,8000h
mov ds,ax
mov ax,1000h
mov es,ax
xor si,si
xor di,di
mov cx,8000h
rep movsb
mov cx,8000h
rep movsb
mov bx,es
add bx,1000h
mov es,bx
mov bx,ds
add bx,1000h
mov ds,bx
mov cx,8000h
rep movsb
mov cx,8000h
rep movsb
mov ax,1000h
mov ds,ax
mov es,ax
jmp far 1000h:0000h
retn
len_mk=$-move_kernel
 
;--------Data------------
title db 'KolibriOS\MenuetOS Boot Loader. Ver.1.2 Copyright(C) 2003, Trans.',0ah,0dh,0ah,0dh,'$'
title_1 db 'Addition 2005-2006 by Mario79 - for boot Flash RAM.',0ah,0dh,0ah,0dh,'$'
;mes1 db 'It is alternative of boot from floppy.',0ah,0dh
; db 'You MUST select HD booting !!!',0ah,0dh,0ah,0dh,'$'
;mes2 db 'Are you sure loading MeOS? (Y/N):','$'
start_img_read db 'Read IMG file: ','$'
progress_img_read db '#','$'
end_img_read db 0ah,0dh,0ah,0dh,'$'
start_kernel_read db 'Start kernel read ','$'
yes db 'Y','$'
no db 'N','$'
mes3 db 0ah,0dh,0ah,0dh,'See you later ...',0ah,0dh,'$'
mes4 db 0ah,0dh,0ah,0dh,'Not Found: '
img0 db 'kolibri\kolibri.img',0,', '
img1 db 'msetup.exe',0,', '
img2 db 'menuet.img',0,', '
img3 db 'kolibri.img',0,' :($'
image_counter db 0
kernel db 'KERNEL MNT',0
handle dw ?
foffset dd 20480
SectSize dw ? ; +0bh
ClustSect db ? ; +0dh
ResSect dw ? ; +0eh
FATCnt db ? ; +10h
RootEnt dw ? ; +11h
FATSect dw ? ; +16h
filesize dd ? ; +1ch
FirstClust dw ? ; +1ah
 
ResRgn dw 0 ; = VolumeStart
FATRgn dw ? ; = ResRgn+ResSect
RootDirRgn dw ? ; = FATRgn+(FATCnt*FATSect)
DataRgn dw ? ; = RootDirRgn+((RootEnt*32)/SectSize)
ResRgnSz dw ? ; = ResSect
FATRgnSz dw ? ; = FATCnt*FATSect
RootDirRgnSz dw ? ; = (RootEnt*32)/SectSize
;First sector of cluster N = DataRgn+((N-2)*ClustSect)
buffer:
org 3000h
Root:
 
/programs/hd_load/usb_boot_old/enable.asm
0,0 → 1,74
format MZ
heap 0
stack 800h
entry main:start
 
segment main use16
 
use16
start:
 
mov ax,_data
mov ds, ax
mov es, ax
 
xor eax, eax
mov ax,ds
 
shl eax, 4
 
mov bx, gdt
add ebx, eax ; ebx - ëèíåéíûé àäðåñ gdt
 
mov word [gdtPtr], 2 * 8 -1 ; ïðåäåë gdt 2 äåñêðèïòîðà = 0x000f
mov dword [gdtPtr + 2], ebx
 
lgdt pword [gdtPtr]
 
in al, 0x70 ;çàïðåùàåì NMI
mov bl, al
or al, 0x80
out 70h , al
in al, 0x71 ;íåêîòîðûå RTC ïîñëå çàïèñè áàéòà â ïîðò 0õ70
;îæèäàþò îáðàùåíèÿ ê ïîðòó 0x71
 
cli
 
mov eax, cr0
or al, 01b
mov cr0, eax
 
mov dx, 0x08
mov gs, dx ;gs - ãëîáàëüíûé ñåãìåíò ñ áàçîé 0 è ïðåäåëîì 0xFFFFFFFF
mov fs, dx
 
and al, 0xFE
mov cr0, eax
 
sti
 
mov al, bl
out 70h , al
in al, 71h
 
mov dx,92h
in al,dx
or al,2
out dx,al
 
;òåïåðü ìîæíî ïîëó÷èòü äîñòóï êî âñåé ïàìÿòè
;íàïðèìåð
;mov eax, [gs:0xFFFFFFF0] ;
 
mov ah,4ch ;çàâåðøåíèå ÄÎÑ ïðîãðàììû
int 21h
 
segment _data use16
 
align 16
 
gdt dw 0, 0, 0, 0 ;0
_flat dw 0ffffh,0,0F200h,008fh ;08 ñåãìåíò äàííûõ DPL = 3
;áàçà 0, ïðåäåë 0xFFFFFFFF
 
gdtPtr dq ?
/programs/hd_load/usb_boot_old/usb_boot.rtf
0,0 → 1,61
{\rtf1\ansi\ansicpg1251\deff0\deflang1049\deflangfe1049\deftab708{\fonttbl {\f0\froman\fprq2\fcharset204{\*\fname Times New Roman;}Times New Roman CYR;}}
{\colortbl ;\red0\green0\blue255;\red0\green128\blue0;\red255\green0\blue0;}
\uc1\pard\ulnone\b\f0\'c0\'e2\'f2\'ee\'f0: Mario79 \par
xx.01.2006 - \'ed\'e0\'e1\'ee\'f0 \'f1\'f2\'e0\'f2\'fc\'e8 \par
20.03.2006 - \'ef\'f3\'e1\'eb\'e8\'ea\'e0\'f6\'e8\'ff \'f1\'f2\'e0\'f2\'fc\'e8 \par
23.03.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ec \'f4\'e0\'e9\'eb\'ee\'ec \'f1\'ee\'e4\'e5\'f0\'e6\'e0\'f2\'fc\'f1\'ff \'f3\'ef\'ee\'ec\'ff\'ed\'f3\'f2\'fb\'e5 \'e2 \'f2\'e5\'ea\'f1\'f2\'e5 \b enable.exe \b0\'e8 \lang1033\b meosload\lang1049 .\lang1033 com\lang1049\b0 \'e8 \'e8\'f5 \'e8\'f1\'f5\'ee\'e4\'ed\'fb\'e5 \'ea\'ee\'e4\'fb.\par
}
/programs/hd_load/usb_boot_old/usb_boot_1251.txt
0,0 → 1,57
Àâòîð: Mario79
xx.01.2006 - íàáîð ñòàòüè
20.03.2006 - ïóáëèêàöèÿ ñòàòüè
23.03.2006 - èñïðàâëåíèå è äîïîëíåíèå ñòàòüè
26.02.2007 - ïåðåðàáîòàíî è äîïîëíåíî â ñâÿçè ñ èçìåíèâøèìèñÿ ðåàëèÿìè
 
Çàãðóçêà ÎÑ Êîëèáðè ñ USB Flash Drive
Íà ñåãîäíÿøíèé äåíü ÎÑ Êîëèáðè íå èìååò ïîääåðæêè USB óñòðîéñòâ íà óðîâíå ñàìîé ñèñòåìû, ïî ýòîé ïðè÷èíå äëÿ çàïóñêà ñ USB Flash íàêîïèòåëåé ïðèõîäèòñÿ èäòè íà îïðåäåëåííûå õèòðîñòè.
Ñóùåñòâóåò 2 èçâåñòíûõ ñïîñîáà çàïóñòèòü ÎÑ Êîëèáðè ñ «ôëåøêè».
 
1) Ýìóëÿöèÿ ôëîïïè äèñêà â BIOS.
Ìåòîä ïðîñò äî òóïîñòè íà «ôëåøêó» çàïèñûâàåòñÿ IMG îáðàç, ñ ïîëíîé ýìóëÿöèåé, òî åñòü 0 ñåêòîð IMG îáðàçà ñòàíîâèòñÿ 0 ñåêòîðîì «ôëåøêè», è òàê äàëåå ïîêà âñå ñåêòîðà îáðàçà íå áóäóò ñêîïèðîâàíû íà íàêîïèòåëü. Èç íåäîñòàòêîâ ýòîãî ñïîñîáà ñðàçó ìîæíî çàìåòèòü ïîòåðþ ðàáî÷åãî ïðîñòðàíñòâà âûøå 1,44 Ìá. Îñîáåííî îáèäíûì ýòî ÿâëÿåòñÿ äëÿ íàêîïèòåëåé, åìêîñòü êîòîðûõ íàìíîãî ïðåâûøàåò ýòîò ðàçìåð.
Êàê ïðîèçâîäèòñÿ òàêàÿ «óñòàíîâêà» ñèñòåìû â ðàçíûõ îñ:
à) ÎÑ Linux îïèñàíèå ìîæíî ïîëó÷èòü, ââåäÿ â êîíñîëè êîìàíäó man dd
á) ÎÑ Windows çàïèñü ìîæíî ïðîèçâåñòè ñ ïîìîùüþ ïðîãðàììû WinHex (èëè àíàëîãè÷íîé), êîïèðîâàíèåì 2880 ñåêòîðîâ ñ äèñêà A (floppy disk) íà äèñê, êîòîðûé ÿâëÿåòñÿ Flash íàêîïèòåëåì, íà÷èíàÿ ñ 0 ñåêòîðà.
â) DOS ìîæíî ïðîñòî îòôîðìàòèðîâàòü ýìóëèðóåìîå óñòðîéñòâî, ðàçóìååòñÿ, åñëè ýòî ïîçâîëÿåò BIOS ìàòåðèíñêîé ïëàòû êîìïüþòåðà.
 
2) Ýìóëÿöèÿ Flash íàêîïèòåëÿ êàê æåñòêîãî äèñêà â BIOS.
Çäåñü íàäî ñäåëàòü ïîÿñíåíèå: äàæå åñëè âàø BIOS ýìóëèðóåò «ôëåøêó» êàê ôëîïïè äèñê ýòî ñîâñåì íå îçíà÷àåò, ÷òî âû îãðàíè÷åíû ðàçìåðàìè ôàéëîâîé ñèñòåìû FAT12, êîòîðàÿ â îñíîâíîì ïðèìåíÿåòñÿ íà ôëîïïè äèñêàõ è èìååò îãðàíè÷åíèå íà ðàçìåð îêîëî 4 Ìá.
Íà ïðàêòèêå ýòî îçíà÷àåò, ÷òî îòôîðìàòèðîâàííûé â FAT16 íàêîïèòåëü áóäåò çàìå÷àòåëüíî âèäåòüñÿ êàê ôëîïïè äèñê ñ ðàçìåðîì äî 2 Ãá. Ê ñîæàëåíèþ, âñå ìîè ïîïûòêè çàãðóçèòüñÿ ñ ïðèìåíåíèåì ôàéëîâîé ñèñòåìû FAT32, êîòîðàÿ ïîçâîëèëà áû íà ïîëíûé ðàçìåð èñïîëüçîâàòü USB Flash íàêîïèòåëè ðàçìåðîì áîëåå 2 Ãá, íå óâåí÷àëèñü óñïåøíî.
 
Âåðíåìñÿ íåïîñðåäñòâåííî ê çàãðóçêå.
Ïîñêîëüêó íà äàííûé ìîìåíò Êîëèáðè íå ÿâëÿåòñÿ ïîëíîñòüþ ñàìîñòîÿòåëüíîé ÎÑ, òî ïîâñåìåñòíî îíà ïðèìåíÿåòñÿ ïàðàëëåëüíî ñ äðóãèìè ÎÑ. Ýòà ñèòóàöèÿ ïðèâåëà ê òîìó, ÷òî ñîáñòâåííîãî íåçàâèñèìîãî çàãðóç÷èêà (åñëè íå ñ÷èòàòü ôëîïïè äèñêè) ó Êîëèáðè ôàêòè÷åñêè íåò.
Íà ñåãîäíÿøíèé äåíü îñòàëèñü àêòóàëüíûìè òîëüêî 2 çàãðóç÷èêà: meosload.com è mtldr.
Îáà ìîãóò çàïóñêàòüñÿ èç ñðåäû DOS.
Óñòàíîâêà Êîëèáðè íà ôëåøêó â ìîåì âàðèàíòå íà÷èíàåòñÿ ñ óñòàíîâêè DOS íà ôëåøêó, êàê ïåðâè÷íîé ñèñòåìîé, èç-ïîä êîòîðîé áóäóò çàïóùåíû çàãðóç÷èêè Êîëèáðè. Êîíå÷íî, â ýòîì ñëó÷àå ñ òî÷êè çðåíèÿ ëèöåíçèè ëó÷øå èñïîëüçîâàòü ïîëíûå àíàëîãè DOS, êîòîðûå èìåþò ñâîáîäíóþ ëèöåíçèþ íà èñïîëüçîâàíèå, íî íå â ýòîì ñóòü, òàê ÷òî íå áóäåì îòâëåêàòüñÿ íà ìåëî÷è.
 
Óñòàíîâèòü DOS íà «ôëåøêó» ìîæíî íåñêîëüêèìè ñïîñîáàìè:
à) ÎÑ Windows ïðè ôîðìàòèðîâàíèè ôëåøêè âûáðàòü ïóíêò ñêîïèðîâàòü ñèñòåìíûå ôàéëû, â îáùåì, òî æå ñàìîå ÷òî è äëÿ ôëîïïè äèñêåòû. Ê ñîæàëåíèþ, ýòîò ìåòîä ïîäõîäèò òîëüêî äëÿ ëèíåéêè 9õ, íà 2Ê íå ïðîâåðÿë, íî â ÕÐ ýòîò ïóíêò íåäîñòóïåí.
á) DOS ïðè íàëè÷èè ýìóëÿöèè «ôëåøêè» êàê ãèáêîãî èëè æåñòêîãî äèñêà ìîæåò ñäåëàòü äèñê çàãðóçî÷íûì. Äëÿ ýòîãî íóæíî ââåñòè êîìàíäó sys X: ãäå Õ çàìåíèòü íà áóêâó, ïîä êîòîðîé ó âàñ çíà÷èòñÿ ýìóëèðóåìûé Flash íàêîïèòåëü (Áóäüòå îñòîðîæíû, åñëè âû óêàæèòå íå òîò äèñê, òî ìîæåòå óáèòü çàãðóç÷èê óñòàíîâëåííîé íà âàø æåñòêèé äèñê ÎÑ). Ïðè ýòîì DOS, ìîæåò, è áóäåò ðóãàòüñÿ, íî íå îáðàùàéòå íà ýòî âíèìàíèå è âûáåðèòå F (ïðîäîëæèòü), ãëàâíîå ÷òîáû â çàãðóçî÷íûé ñåêòîð íàêîïèòåëÿ áûë çàïèñàí çàãðóç÷èê, êîòîðûé è áóäåò çàïóñêàòü DOS ñ «ôëåøêè».
 ðåçóëüòàòå ìû áóäåì èìåòü USB Flash íàêîïèòåëü ñ óñòàíîâëåííûì DOS.
 
Èç âñåõ ôàéëîâ, êîòîðûå áóäóò íàõîäèòüñÿ íà «ôëåøêå» íåîáõîäèìû òîëüêî Command.com, Io.sys, Msdos.sys - îñòàëüíûå ìîæíî óäàëèòü, äëÿ íàøèõ öåëåé îíè íå íóæíû. Åñëè ïî êàêîé ëèáî ïðè÷èíå ýòè òðè ôàéëà íå ñêîïèðîâàëèñü íà íàêîïèòåëü, òî ñêîïèðóéòå èõ âðó÷íóþ. Äàëåå æåëàòåëüíî ïåðåçàãðóçèòü êîìïüþòåð è ïðîâåðèòü çàãðóçêó DOS ñ ôëåøêè. Åñëè âñå ïðîéäåò íîðìàëüíî, òî âû ïîëó÷èòå ïðèãëàøåíèå êîìàíäíîé ñòðîêè DOS, â ïðîòèâíîì ñëó÷àå íóæíî ïîïûòàòüñÿ óñòàíîâèòü ñíîâà.
 äîïîëíåíèå ê ýòèì òðåì ôàéëàì ïîòðåáóåòñÿ â ðó÷íóþ ñîçäàòü åùå ïàðó ïóñòûõ ôàéëîâ: Config.sys, Autoexec.bat - ýòî íåîáõîäèìî, äëÿ òîãî ÷òîáû ñäåëàòü âïîñëåäñòâèè ïîëíîñòüþ àâòîìàòè÷åñêóþ çàãðóçêó Êîëèáðè, à íå ñòàðòîâàòü çàãðóç÷èê èç êîìàíäíîé ñòðîêè êàæäûé ðàç.
 
Íó, âîò ïîëîâèíà ðàáîòû ñäåëàíà. Äàëåå âîçíèêàþò íåêîòîðûå òðóäíîñòè, êîòîðûå ìû óñïåøíî ðàçðåøèì (äëÿ òîãî ÿ è ïèñàë ýòó ñòàòüþ).
Òðóäíîñòè çàêëþ÷àþòñÿ â òîì, ÷òî â ñòàíäàðòíîì âàðèàíòå íè îäèí çàãðóç÷èêè íå çàãðóæàåò IMG îáðàç â ïàìÿòü (çàãðóæàåòñÿ è çàïóñêàåòñÿ òîëüêî ÿäðî), ïîñêîëüêó ïîäðàçóìåâàåòñÿ, ÷òî îáðàç áóäåò çàãðóæåí ÿäðîì. Íî êàê âû, íàâåðíîå, óæå äîãàäàëèñü îáðàç ÿäðó ãðóçèòü ïðîñòî íå îòêóäà, òàê êàê ñ USB óñòðîéñòâàìè Êîëèáðè ïîêà íå äðóæèò.
 
Îòñþäà îñòàåòñÿ îäèí âûõîä - ñäåëàòü òàê ÷òîáû çàãðóç÷èê çàãðóçèë íå òîëüêî ÿäðî, íî è îáðàç ïî íóæíîìó ìåñòó â ïàìÿòè. ÍÎ! (Îïÿòü ýòî íî!) Çàãðóç÷èê çàïóùåí â DOS, êîòîðûé ðàáîòàåò â ðåàëüíîì (Real mode) ðåæèìå ïðîöåññîðà, ñ îãðàíè÷åíèåì íà àäðåñàöèþ ïàìÿòè â 1 Ìá, à îáðàç â àäðåñíîì ïðîñòðàíñòâå Êîëèáðè êàê ðàç äîëæåí ðàñïîëàãàòüñÿ, àêêóðàò íà÷èíàÿ ñ ïåðâîãî ìåãàáàéòà è äàëåå â ïàìÿòè.
Êàê æå áûòü? Ýâðèêà! DOS âåäü ìîæåò îáðàùàòüñÿ ÷åðåç äîïîëíèòåëüíûå äðàéâåðû ê ïàìÿòè âûøå ïåðâîãî ìåãàáàéòà (êñòàòè òàê è ïîñòóïàåò ÿäðî ïðè çàãðóçêå îáðàçà ñ ôëîïïè), íî ðåàëèçîâàíî ýòî òàê êîðÿâî, ÷òî ïîëüçîâàòüñÿ ýòèì íå õî÷åòñÿ ñîâñåì. (Êîíå÷íî ýòî ìîå ñóáúåêòèâíîå ìíåíèå).
 
Îäíîâðåìåííî ñ ýòèì åñòü äðóãîé ñïîñîá îáðàòèòüñÿ ê ïàìÿòè âûøå ïåðâîãî ìåãàáàéòà.  ïðîöåññîðàõ õ86 ñóùåñòâóåò âîçìîæíîñòü óñòàíîâèòü íåäîêóìåíòèðîâàííûé, íî ñ÷èòàþùèéñÿ ïðàêòè÷åñêè ñòàíäàðòíûì «íåðåàëüíûé» (Unreal mode) ðåæèì ðàáîòû.
Êîíå÷íî, ïðÿìàÿ àäðåñàöèÿ â òàêîì ðåæèìå íåâîçìîæíà, íî ìîæíî îáðàùàòüñÿ ê ïàìÿòè êîñâåííî ÷åðåç ðåãèñòðû, ó êîòîðûõ áûëè èçìåíåíû ëèìèòû àäðåñàöèè.
 ðåçóëüòàòå ïîëó÷àåì ñðàâíèòåëüíî ïðîñòîé ñïîñîá äîñòóïà ê ïàìÿòè âïëîòü äî 4 Ãá, íàõîäÿñü ôàêòè÷åñêè â ðåàëüíîì ðåæèìå ðàáîòû ïðîöåññîðà.
 
 ðåçóëüòàòå ÿ äîðàáîòàë çàãðóç÷èê meosload.com (ïîñêîëüêó â åãî êîäå ìíå îêàçàëîñü ïðîùå ðàçîáðàòüñÿ), òåïåðü îí çàãðóæàåò è ÿäðî è îáðàç, à çàòåì ñòàðòóåò ÎÑ.
Äëÿ âêëþ÷åíèÿ «íåðåàëüíîãî» ðåìà ðàáîòû ïðîöåññîðà ÿ èçíà÷àëüíî èñïîëüçîâàë êîä, âçÿòûé ñ <http://www.wasm.ru> êîòîðûé ÿ ïåðåðàáîòàë â ïðîãðàììó enable.exe
Ïîçæå êîä áûë ïåðåïèñàí íà ñèíòàêñèñ FASM (îðèãèíàë áûë äëÿ TASM), òîâàðèùåì Serge, çà ÷òî åìó îãðîìíîå ñïàñèáî, ïîñêîëüêó ó ìåíÿ íå õâàòèëî óìà è òåðïåíèÿ ñäåëàòü ýòî ñàìîìó.
 
Èòàê, ýòî áûëî äëèííîå îòñòóïëåíèå, íî áåç íåãî âû áû íå ïîíÿëè âñþ èäåþ ïðåäëîæåííîãî ìíîé ñïîñîáà çàãðóçêè.
Îñòàëîñü ëèøü ñêîïèðîâàòü íà «ôëåøêó» ôàéëû enable.exe è meosload.com, à òàêæå ïðîïèñàòü â Autoexec.bat èõ çàãðóçêó (Autoexec.bat ìîæíî ðåäàêòèðîâàòü ëþáûì òåêñòîâûì ðåäàêòîðîì) è, ðàçóìååòñÿ, íà «ôëåøêå» â êîðíå äèñêà äîëæåí íàõîäèòüñÿ ñàì ôàéë îáðàçà kolibri.img.
 
Âîò â ïðèíöèïå è âñå. Îñòàëîñü ïåðåçàãðóçèòü êîìïüþòåð è âûáðàòü çàãðóçêó ñ USB Flash íàêîïèòåëÿ.  ñèíåì îêíå çàãðóçêè â êà÷åñòâå çàãðóçî÷íîãî óñòðîéñòâà íóæíî âûáðàòü ïóíêò 3-èñïîëüçîâàòü óæå çàãðóæåííûé îáðàç.
 
P.S.
1) Õî÷ó âûðàçèòü áîëüøóþ ïðèçíàòåëüíîñòü çà ïîìîùü â ïîäãîòîâêå ìàòåðèàëà Àíäðåþ (NoName), Ýäóàðäó (DoomEdArchangel) è Ñåðãåþ (Serge).
2) Â àðõèâå ñ ýòèì ôàéëîì ñîäåðæàòüñÿ óïîìÿíóòûå â òåêñòå enable.exe è meosload.com è èõ èñõîäíûå êîäû.
/programs/hd_load/usb_boot_old/usb_boot_866.txt
0,0 → 1,57
€¢â®à: Mario79
xx.01.2006 - ­ ¡®à áâ âì¨
20.03.2006 - ¯ã¡«¨ª æ¨ï áâ âì¨
23.03.2006 - ¨á¯à ¢«¥­¨¥ ¨ ¤®¯®«­¥­¨¥ áâ âì¨
26.02.2007 - ¯¥à¥à ¡®â ­® ¨ ¤®¯®«­¥­® ¢ á¢ï§¨ á ¨§¬¥­¨¢è¨¬¨áï ॠ«¨ï¬¨
 
‡ £à㧪  Ž‘ Š®«¨¡à¨ á USB Flash Drive
  ᥣ®¤­ïè­¨© ¤¥­ì Ž‘ Š®«¨¡à¨ ­¥ ¨¬¥¥â ¯®¤¤¥à¦ª¨ USB ãáâனá⢠­  ã஢­¥ á ¬®© á¨á⥬ë, ¯® í⮩ ¯à¨ç¨­¥ ¤«ï § ¯ã᪠ á USB Flash ­ ª®¯¨â¥«¥© ¯à¨å®¤¨âáï ¨¤â¨ ­  ®¯à¥¤¥«¥­­ë¥ å¨âà®áâ¨.
‘ãé¥áâ¢ã¥â 2 ¨§¢¥áâ­ëå ᯮᮡ  § ¯ãáâ¨âì Ž‘ Š®«¨¡à¨ á «ä«¥èª¨».
 
1) ¬ã«ïæ¨ï ä«®¯¯¨ ¤¨áª  ¢ BIOS.
Œ¥â®¤ ¯à®áâ ¤® â㯮á⨠­  «ä«¥èªã» § ¯¨á뢠¥âáï IMG ®¡à §, á ¯®«­®© í¬ã«ï樥©, â® ¥áâì 0 ᥪâ®à IMG ®¡à §  áâ ­®¢¨âáï 0 ᥪâ®à®¬ «ä«¥èª¨», ¨ â ª ¤ «¥¥ ¯®ª  ¢á¥ ᥪâ®à  ®¡à §  ­¥ ¡ã¤ãâ ᪮¯¨à®¢ ­ë ­  ­ ª®¯¨â¥«ì. ˆ§ ­¥¤®áâ âª®¢ í⮣® ᯮᮡ  áࠧ㠬®¦­® § ¬¥â¨âì ¯®â¥àî à ¡®ç¥£® ¯à®áâà ­á⢠ ¢ëè¥ 1,44 Œ¡. Žá®¡¥­­® ®¡¨¤­ë¬ í⮠ï¥âáï ¤«ï ­ ª®¯¨â¥«¥©, ¥¬ª®áâì ª®â®àëå ­ ¬­®£® ¯à¥¢ëè ¥â íâ®â à §¬¥à.
Š ª ¯à®¨§¢®¤¨âáï â ª ï «ãáâ ­®¢ª » á¨áâ¥¬ë ¢ à §­ëå ®á:
 ) Ž‘ Linux ®¯¨á ­¨¥ ¬®¦­® ¯®«ãç¨âì, ¢¢¥¤ï ¢ ª®­á®«¨ ª®¬ ­¤ã man dd
¡) Ž‘ Windows § ¯¨áì ¬®¦­® ¯à®¨§¢¥áâ¨ á ¯®¬®éìî ¯à®£à ¬¬ë WinHex (¨«¨  ­ «®£¨ç­®©), ª®¯¨à®¢ ­¨¥¬ 2880 ᥪâ®à®¢ á ¤¨áª  A (floppy disk) ­  ¤¨áª, ª®â®àë© ï¢«ï¥âáï Flash ­ ª®¯¨â¥«¥¬, ­ ç¨­ ï á 0 ᥪâ®à .
¢) DOS ¬®¦­® ¯à®áâ® ®âä®à¬ â¨à®¢ âì í¬ã«¨à㥬®¥ ãáâனá⢮, ࠧ㬥¥âáï, ¥á«¨ íâ® ¯®§¢®«ï¥â BIOS ¬ â¥à¨­áª®© ¯« âë ª®¬¯ìîâ¥à .
 
2) ¬ã«ïæ¨ï Flash ­ ª®¯¨â¥«ï ª ª ¦¥á⪮£® ¤¨áª  ¢ BIOS.
‡¤¥áì ­ ¤® ᤥ« âì ¯®ïá­¥­¨¥: ¤ ¦¥ ¥á«¨ ¢ è BIOS í¬ã«¨àã¥â «ä«¥èªã» ª ª ä«®¯¯¨ ¤¨áª í⮠ᮢᥬ ­¥ ®§­ ç ¥â, çâ® ¢ë ®£à ­¨ç¥­ë à §¬¥à ¬¨ ä ©«®¢®© á¨á⥬ë FAT12, ª®â®à ï ¢ ®á­®¢­®¬ ¯à¨¬¥­ï¥âáï ­  ä«®¯¯¨ ¤¨áª å ¨ ¨¬¥¥â ®£à ­¨ç¥­¨¥ ­  à §¬¥à ®ª®«® 4 Œ¡.
  ¯à ªâ¨ª¥ íâ® ®§­ ç ¥â, çâ® ®âä®à¬ â¨à®¢ ­­ë© ¢ FAT16 ­ ª®¯¨â¥«ì ¡ã¤¥â § ¬¥ç â¥«ì­® ¢¨¤¥âìáï ª ª ä«®¯¯¨ ¤¨áª á à §¬¥à®¬ ¤® 2 ƒ¡. Š ᮦ «¥­¨î, ¢á¥ ¬®¨ ¯®¯ë⪨ § £à㧨âìáï á ¯à¨¬¥­¥­¨¥¬ ä ©«®¢®© á¨á⥬ë FAT32, ª®â®à ï ¯®§¢®«¨«  ¡ë ­  ¯®«­ë© à §¬¥à ¨á¯®«ì§®¢ âì USB Flash ­ ª®¯¨â¥«¨ à §¬¥à®¬ ¡®«¥¥ 2 ƒ¡, ­¥ 㢥­ç «¨áì ãᯥ譮.
 
‚¥à­¥¬áï ­¥¯®á।á⢥­­® ª § £à㧪¥.
®áª®«ìªã ­  ¤ ­­ë© ¬®¬¥­â Š®«¨¡à¨ ­¥ ï¥âáï ¯®«­®áâìî á ¬®áâ®ï⥫쭮© Ž‘, â® ¯®¢á¥¬¥áâ­® ®­  ¯à¨¬¥­ï¥âáï ¯ à ««¥«ì­® á ¤à㣨¬¨ Ž‘. â  á¨âã æ¨ï ¯à¨¢¥«  ª ⮬ã, ç⮠ᮡá⢥­­®£® ­¥§ ¢¨á¨¬®£® § £àã§ç¨ª  (¥á«¨ ­¥ áç¨â âì ä«®¯¯¨ ¤¨áª¨) 㠊®«¨¡à¨ ä ªâ¨ç¥áª¨ ­¥â.
  ᥣ®¤­ïè­¨© ¤¥­ì ®áâ «¨áì  ªâã «ì­ë¬¨ ⮫쪮 2 § £àã§ç¨ª : meosload.com ¨ mtldr.
Ž¡  ¬®£ãâ § ¯ã᪠âìáï ¨§ á।ë DOS.
“áâ ­®¢ª  Š®«¨¡à¨ ­  ä«¥èªã ¢ ¬®¥¬ ¢ à¨ ­â¥ ­ ç¨­ ¥âáï á ãáâ ­®¢ª¨ DOS ­  ä«¥èªã, ª ª ¯¥à¢¨ç­®© á¨á⥬®©, ¨§-¯®¤ ª®â®à®© ¡ã¤ãâ § ¯ãé¥­ë § £àã§ç¨ª¨ Š®«¨¡à¨. Š®­¥ç­®, ¢ í⮬ á«ãç ¥ á â®çª¨ §à¥­¨ï «¨æ¥­§¨¨ «ãçè¥ ¨á¯®«ì§®¢ âì ¯®«­ë¥  ­ «®£¨ DOS, ª®â®àë¥ ¨¬¥îâ ᢮¡®¤­ãî «¨æ¥­§¨î ­  ¨á¯®«ì§®¢ ­¨¥, ­® ­¥ ¢ í⮬ áãâì, â ª çâ® ­¥ ¡ã¤¥¬ ®â¢«¥ª âìáï ­  ¬¥«®ç¨.
 
“áâ ­®¢¨âì DOS ­  «ä«¥èªã» ¬®¦­® ­¥áª®«ìª¨¬¨ ᯮᮡ ¬¨:
 ) Ž‘ Windows ¯à¨ ä®à¬ â¨à®¢ ­¨¨ 䫥誨 ¢ë¡à âì ¯ã­ªâ ᪮¯¨à®¢ âì á¨á⥬­ë¥ ä ©«ë, ¢ ®¡é¥¬, â® ¦¥ á ¬®¥ çâ® ¨ ¤«ï ä«®¯¯¨ ¤¨áª¥âë. Š ᮦ «¥­¨î, íâ®â ¬¥â®¤ ¯®¤å®¤¨â ⮫쪮 ¤«ï «¨­¥©ª¨ 9å, ­  2Š ­¥ ¯à®¢¥àï«, ­® ¢ • íâ®â ¯ã­ªâ ­¥¤®áâ㯥­.
¡) DOS ¯à¨ ­ «¨ç¨¨ í¬ã«ï樨 «ä«¥èª¨» ª ª £¨¡ª®£® ¨«¨ ¦¥á⪮£® ¤¨áª  ¬®¦¥â ᤥ« âì ¤¨áª § £à㧮ç­ë¬. „«ï í⮣® ­ã¦­® ¢¢¥á⨠ª®¬ ­¤ã sys X: £¤¥ • § ¬¥­¨âì ­  ¡ãª¢ã, ¯®¤ ª®â®à®© ã ¢ á §­ ç¨âáï í¬ã«¨àã¥¬ë© Flash ­ ª®¯¨â¥«ì (ã¤ì⥠®áâ®à®¦­ë, ¥á«¨ ¢ë 㪠¦¨â¥ ­¥ â®â ¤¨áª, â® ¬®¦¥â¥ 㡨âì § £àã§ç¨ª ãáâ ­®¢«¥­­®© ­  ¢ è ¦¥á⪨© ¤¨áª Ž‘). à¨ í⮬ DOS, ¬®¦¥â, ¨ ¡ã¤¥â à㣠âìáï, ­® ­¥ ®¡à é ©â¥ ­  íâ® ¢­¨¬ ­¨¥ ¨ ¢ë¡¥à¨â¥ F (¯à®¤®«¦¨âì), £« ¢­®¥ çâ®¡ë ¢ § £à㧮ç­ë© ᥪâ®à ­ ª®¯¨â¥«ï ¡ë« § ¯¨á ­ § £àã§ç¨ª, ª®â®àë© ¨ ¡ã¤¥â § ¯ã᪠âì DOS á «ä«¥èª¨».
‚ १ã«ìâ â¥ ¬ë ¡ã¤¥¬ ¨¬¥âì USB Flash ­ ª®¯¨â¥«ì á ãáâ ­®¢«¥­­ë¬ DOS.
 
ˆ§ ¢á¥å ä ©«®¢, ª®â®àë¥ ¡ã¤ãâ ­ å®¤¨âìáï ­  «ä«¥èª¥» ­¥®¡å®¤¨¬ë ⮫쪮 Command.com, Io.sys, Msdos.sys - ®áâ «ì­ë¥ ¬®¦­® 㤠«¨âì, ¤«ï ­ è¨å 楫¥© ®­¨ ­¥ ­ã¦­ë. …᫨ ¯® ª ª®© «¨¡® ¯à¨ç¨­¥ í⨠âਠ䠩«  ­¥ ᪮¯¨à®¢ «¨áì ­  ­ ª®¯¨â¥«ì, ⮠᪮¯¨àã©â¥ ¨å ¢àãç­ãî. „ «¥¥ ¦¥« â¥«ì­® ¯¥à¥§ £à㧨âì ª®¬¯ìîâ¥à ¨ ¯à®¢¥à¨âì § £à㧪ã DOS á 䫥誨. …᫨ ¢á¥ ¯à®©¤¥â ­®à¬ «ì­®, â® ¢ë ¯®«ãç¨â¥ ¯à¨£« è¥­¨¥ ª®¬ ­¤­®© áâப¨ DOS, ¢ ¯à®â¨¢­®¬ á«ãç ¥ ­ã¦­® ¯®¯ëâ âìáï ãáâ ­®¢¨âì á­®¢ .
‚ ¤®¯®«­¥­¨¥ ª í⨬ â६ ä ©« ¬ ¯®âॡã¥âáï ¢ àãç­ãî ᮧ¤ âì ¥é¥ ¯ àã ¯ãáâëå ä ©«®¢: Config.sys, Autoexec.bat - íâ® ­¥®¡å®¤¨¬®, ¤«ï ⮣® ç⮡ë ᤥ« âì ¢¯®á«¥¤á⢨¨ ¯®«­®áâìî  ¢â®¬ â¨ç¥áªãî § £à㧪㠊®«¨¡à¨,   ­¥ áâ à⮢ âì § £àã§ç¨ª ¨§ ª®¬ ­¤­®© áâப¨ ª ¦¤ë© à §.
 
ã, ¢®â ¯®«®¢¨­  à ¡®âë ᤥ« ­ . „ «¥¥ ¢®§­¨ª îâ ­¥ª®â®àë¥ âà㤭®áâ¨, ª®â®àë¥ ¬ë ãᯥ譮 à §à¥è¨¬ (¤«ï ⮣® ï ¨ ¯¨á « íâã áâ âìî).
’à㤭®á⨠§ ª«îç îâáï ¢ ⮬, çâ® ¢ áâ ­¤ àâ­®¬ ¢ à¨ ­â¥ ­¨ ®¤¨­ § £àã§ç¨ª¨ ­¥ § £à㦠¥â IMG ®¡à § ¢ ¯ ¬ïâì (§ £à㦠¥âáï ¨ § ¯ã᪠¥âáï ⮫쪮 ï¤à®), ¯®áª®«ìªã ¯®¤à §ã¬¥¢ ¥âáï, çâ® ®¡à § ¡ã¤¥â § £à㦥­ ï¤à®¬. ® ª ª ¢ë, ­ ¢¥à­®¥, 㦥 ¤®£ ¤ «¨áì ®¡à § ï¤àã £à㧨âì ¯à®áâ® ­¥ ®âªã¤ , â ª ª ª á USB ãáâனá⢠¬¨ Š®«¨¡à¨ ¯®ª  ­¥ ¤à㦨â.
 
Žâá ®áâ ¥âáï ®¤¨­ ¢ë室 - ᤥ« âì â ª çâ®¡ë § £àã§ç¨ª § £à㧨« ­¥ ⮫쪮 ï¤à®, ­® ¨ ®¡à § ¯® ­ã¦­®¬ã ¬¥áâã ¢ ¯ ¬ïâ¨. Ž! (Ž¯ïâì íâ® ­®!) ‡ £àã§ç¨ª § ¯ã饭 ¢ DOS, ª®â®àë© à ¡®â ¥â ¢ ॠ«ì­®¬ (Real mode) ०¨¬¥ ¯à®æ¥áá®à , á ®£à ­¨ç¥­¨¥¬ ­   ¤à¥á æ¨î ¯ ¬ï⨠¢ 1 Œ¡,   ®¡à § ¢  ¤à¥á­®¬ ¯à®áâà ­á⢥ Š®«¨¡à¨ ª ª à § ¤®«¦¥­ à á¯®« £ âìáï,  ªªãà â ­ ç¨­ ï á ¯¥à¢®£® ¬¥£ ¡ ©â  ¨ ¤ «¥¥ ¢ ¯ ¬ïâ¨.
Š ª ¦¥ ¡ëâì? ¢à¨ª ! DOS ¢¥¤ì ¬®¦¥â ®¡à é âìáï ç¥à¥§ ¤®¯®«­¨â¥«ì­ë¥ ¤à ©¢¥àë ª ¯ ¬ï⨠¢ëè¥ ¯¥à¢®£® ¬¥£ ¡ ©â  (ªáâ â¨ â ª ¨ ¯®áâ㯠¥â ï¤à® ¯à¨ § £à㧪¥ ®¡à §  á ä«®¯¯¨), ­® ॠ«¨§®¢ ­® íâ® â ª ª®à, çâ® ¯®«ì§®¢ âìáï í⨬ ­¥ å®ç¥âáï ᮢᥬ. (Š®­¥ç­® íâ® ¬®¥ áã¡ê¥ªâ¨¢­®¥ ¬­¥­¨¥).
 
Ž¤­®¢à¥¬¥­­® á í⨬ ¥áâì ¤à㣮© ᯮᮡ ®¡à â¨âìáï ª ¯ ¬ï⨠¢ëè¥ ¯¥à¢®£® ¬¥£ ¡ ©â . ‚ ¯à®æ¥áá®à å å86 áãé¥áâ¢ã¥â ¢®§¬®¦­®áâì ãáâ ­®¢¨âì ­¥¤®ªã¬¥­â¨à®¢ ­­ë©, ­® áç¨â î騩áï ¯à ªâ¨ç¥áª¨ áâ ­¤ àâ­ë¬ «­¥à¥ «ì­ë©» (Unreal mode) ०¨¬ à ¡®âë.
Š®­¥ç­®, ¯àï¬ ï  ¤à¥á æ¨ï ¢ â ª®¬ ०¨¬¥ ­¥¢®§¬®¦­ , ­® ¬®¦­® ®¡à é âìáï ª ¯ ¬ï⨠ª®á¢¥­­® ç¥à¥§ ॣ¨áâàë, ã ª®â®àëå ¡ë«¨ ¨§¬¥­¥­ë «¨¬¨âë  ¤à¥á æ¨¨.
‚ १ã«ìâ â¥ ¯®«ãç ¥¬ áà ¢­¨â¥«ì­® ¯à®á⮩ ᯮᮡ ¤®áâ㯠 ª ¯ ¬ï⨠¢¯«®âì ¤® 4 ƒ¡, ­ å®¤ïáì ä ªâ¨ç¥áª¨ ¢ ॠ«ì­®¬ ०¨¬¥ à ¡®âë ¯à®æ¥áá®à .
 
‚ १ã«ìâ â¥ ï ¤®à ¡®â « § £àã§ç¨ª meosload.com (¯®áª®«ìªã ¢ ¥£® ª®¤¥ ¬­¥ ®ª § «®áì ¯à®é¥ à §®¡à âìáï), ⥯¥àì ®­ § £à㦠¥â ¨ ï¤à® ¨ ®¡à §,   § â¥¬ áâ àâã¥â Ž‘.
„«ï ¢ª«î祭¨ï «­¥à¥ «ì­®£®» ६  à ¡®âë ¯à®æ¥áá®à  ï ¨§­ ç «ì­® ¨á¯®«ì§®¢ « ª®¤, ¢§ïâë© á <http://www.wasm.ru> ª®â®àë© ï ¯¥à¥à ¡®â « ¢ ¯à®£à ¬¬ã enable.exe
®§¦¥ ª®¤ ¡ë« ¯¥à¥¯¨á ­ ­  ᨭ⠪á¨á FASM (®à¨£¨­ « ¡ë« ¤«ï TASM), ⮢ à¨é¥¬ Serge, §  çâ® ¥¬ã ®£à®¬­®¥ ᯠᨡ®, ¯®áª®«ìªã ã ¬¥­ï ­¥ 墠⨫® 㬠 ¨ â¥à¯¥­¨ï ᤥ« âì íâ® á ¬®¬ã.
 
ˆâ ª, íâ® ¡ë«® ¤«¨­­®¥ ®âáâ㯫¥­¨¥, ­® ¡¥§ ­¥£® ¢ë ¡ë ­¥ ¯®­ï«¨ ¢áî ¨¤¥î ¯à¥¤«®¦¥­­®£® ¬­®© ᯮᮡ  § £à㧪¨.
Žáâ «®áì «¨èì ᪮¯¨à®¢ âì ­  «ä«¥èªã» ä ©«ë enable.exe ¨ meosload.com,   â ª¦¥ ¯à®¯¨á âì ¢ Autoexec.bat ¨å § £à㧪ã (Autoexec.bat ¬®¦­® । ªâ¨à®¢ âì «î¡ë¬ ⥪áâ®¢ë¬ à¥¤ ªâ®à®¬) ¨, ࠧ㬥¥âáï, ­  «ä«¥èª¥» ¢ ª®à­¥ ¤¨áª  ¤®«¦¥­ ­ å®¤¨âìáï á ¬ ä ©« ®¡à §  kolibri.img.
 
‚®â ¢ ¯à¨­æ¨¯¥ ¨ ¢á¥. Žáâ «®áì ¯¥à¥§ £à㧨âì ª®¬¯ìîâ¥à ¨ ¢ë¡à âì § £à㧪ã á USB Flash ­ ª®¯¨â¥«ï. ‚ ᨭ¥¬ ®ª­¥ § £à㧪¨ ¢ ª ç¥á⢥ § £à㧮筮£® ãáâனá⢠ ­ã¦­® ¢ë¡à âì ¯ã­ªâ 3-¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §.
 
P.S.
1) •®çã ¢ëà §¨âì ¡®«ìèãî ¯à¨§­ â¥«ì­®áâì §  ¯®¬®éì ¢ ¯®¤£®â®¢ª¥ ¬ â¥à¨ «  €­¤à¥î (NoName), ¤ã à¤ã (DoomEdArchangel) ¨ ‘¥à£¥î (Serge).
2) ‚  à娢¥ á í⨬ ä ©«®¬ ᮤ¥à¦ âìáï 㯮¬ï­ãâë¥ ¢ ⥪á⥠enable.exe ¨ meosload.com ¨ ¨å ¨á室­ë¥ ª®¤ë.