
ldrmte_s	STRUC
mte_flags2	DW	?
mte_handle	DW	?
mte_swapmte	DD	?
mte_link	DD	?
mte_flags1	DD	?
mte_impmodcnt	DD	?
mte_sfn	DW	?
mte_usecnt	DW	?
mte_modname	DB	8 DUP (?)
ldrmte_s	ENDS

ldrmte_t struc
db size ldrmte_s dup(?)
ldrmte_t ends


ldrsmte_s	STRUC
smte_mpages	DD	?
smte_startobj	DD	?
smte_eip	DD	?
smte_stackobj	DD	?
smte_esp	DD	?
smte_pageshift	DD	?
smte_fixupsize	DD	?
smte_objtab	DD	?
smte_objcnt	DD	?
smte_objmap	DD	?
smte_itermap	DD	?
smte_rsrctab	DD	?
smte_rsrccnt	DD	?
smte_restab	DD	?
smte_enttab	DD	?
smte_fpagetab	DD	?
smte_frectab	DD	?
smte_impmod	DD	?
smte_impproc	DD	?
smte_datapage	DD	?
smte_nrestab	DD	?
smte_cbnrestab	DD	?
smte_autods	DD	?
smte_debuginfo	DD	?
smte_debuglen	DD	?
smte_heapsize	DD	?
smte_path	DD	?
smte_semcount	DW	?
smte_semowner	DW	?
smte_pfilecache	DD	?
smte_stacksize	DD	?
smte_alignshift	DW	?
smte_NEexpver	DW	?
smte_pathlen	DW	?
smte_NEexetype	DW	?
smte_csegpack	DW	?
smte_major_os	DB	?
smte_minor_os	DB	?
ldrsmte_s	ENDS

ldrsmte_t struc
db size ldrsmte_s dup(?)
ldrsmte_t ends

smte_ssegpack	EQU	smte_frectab    
smte_spaddr	EQU	smte_itermap    
NOAUTODS	EQU	00000000H       
SOLO	EQU	00000001H       
INSTANCEDS	EQU	00000002H       
INSTLIBINIT	EQU	00000004H       
GINISETUP	EQU	00000008H       
NOINTERNFIXUPS	EQU	00000010H       
NOEXTERNFIXUPS	EQU	00000020H       
CLASS_PROGRAM	EQU	00000040H       
CLASS_GLOBAL	EQU	00000080H       
CLASS_SPECIFIC	EQU	000000C0H       
CLASS_ALL	EQU	00000000H       
CLASS_MASK	EQU	000000C0H 
MTEPROCESSED	EQU	00000100H       
USED	EQU	00000200H       
DOSLIB	EQU	00000400H       
DOSMOD	EQU	00000800H       
MTE_MEDIAFIXED	EQU	00001000H       
LDRINVALID	EQU	00002000H       
PROGRAMMOD	EQU	00000000H       
DEVDRVMOD	EQU	00004000H       
LIBRARYMOD	EQU	00008000H       
VDDMOD	EQU	00010000H       
MVDMMOD	EQU	00020000H       
INGRAPH	EQU	00040000H       
GINIDONE	EQU	00080000H       
MTEADDRALLOCED	EQU	00100000H       
FSDMOD	EQU	00200000H       
FSHMOD	EQU	00400000H       
MTELONGNAMES	EQU	00800000H       
MTE_MEDIACONTIG	EQU	01000000H       
MTE_MEDIA16M	EQU	02000000H       
MTESWAPONLOAD	EQU	04000000H       
MTEPORTHOLE	EQU	08000000H       
MTEMODPROT	EQU	10000000H       
MTENEWMOD	EQU	20000000H       
MTEDLLTERM	EQU	40000000H       
MTESYMLOADED	EQU	80000000H       
MTEVALID	EQU	(LDRINVALID)
AUTODS_MASK	EQU	(NOAUTODS OR SOLO OR INSTANCEDS)
MTE_INTNL_MASK	EQU	(DOSLIB OR DOSMOD OR MTEVALID OR MTEPROCESSED OR                          GINISETUP OR GINIDONE OR USED OR INGRAPH OR MTENEWMOD)
MTE_RING0	EQU	(DEVDRVMOD  OR  VDDMOD  OR  MVDMMOD  OR  FSDMOD  OR  FSHMOD)
SEARCH_BY_PATH	EQU	1                
MTEFORMATMASK	EQU	0003H        
MTEFORMATR1	EQU	0000H        
MTEFORMATNE	EQU	0001H        
MTEFORMATLX	EQU	0002H        
MTEFORMATR2	EQU	0003H        
MTESYSTEMDLL	EQU	0004H        
MTELOADORATTACH	EQU	0008H        
MTECIRCLEREF	EQU	0010H        
MTEFREEFIXUPS	EQU	0020H        
MTEPRELOADED	EQU	0040H        
MTEGETMTEDONE	EQU	0080H        
MTEPACKSEGDONE	EQU	0100H        
MTE20LIELIST	EQU	0200H        
MTESYSPROCESSED	EQU	0400H        

_oteres_s	STRUC
_ote_selector	DW	?
_ote_handle	DW	?
_oteres_s	ENDS

_oteres_u       STRUC
 _ote_res       DB      SIZE _oteres_s DUP (?)
_oteres_u       ENDS


ldrote_s	STRUC
ote_size	DD	?
ote_base	DD	?
ote_flags	DD	?
ote_pagemap	DD	?
ote_mapsize	DD	?
_ote_resu	DB	SIZE _oteres_u DUP (?)
ldrote_s	ENDS

ldrote_t struc
db size ldrote_s dup(?)
ldrote_t ends

ote_handle	EQU	_ote_resu._ote_res._ote_handle
ote_selector	EQU	_ote_resu._ote_res._ote_selector
ote_vddaddr     equ     <dword ptr _ote_resu>

OBJALLOC	EQU	80000000H      

ldrste_s	STRUC
ste_offset	DW	?
ste_size	DW	?
ste_flags	DW	?
ste_minsiz	DW	?
ste_seghdl	DW	?
ste_selector	DW	?
ste_fixups	DD	?
ldrste_s	ENDS

ldrste_t struc
db size ldrste_s dup(?)
ldrste_t ends

STE_TYPE_MASK	EQU	0001H  
STE_CODE	EQU	0000H  
STE_DATA	EQU	0001H  
STE_PACKED	EQU	0002H  
STE_SEMAPHORE	EQU	0004H  
STE_ITERATED	EQU	0008H  
STE_WAITING	EQU	0010H  
STE_SHARED	EQU	0020H  
STE_PRELOAD	EQU	0040H  
STE_ERONLY	EQU	0080H  
STE_RELOCINFO	EQU	0100H  
STE_CONFORM	EQU	0200H  
STE_RING_2	EQU	0800H  
STE_RING_3	EQU	0C00H  
STE_SEGDPL	EQU	0C00H  
STE_HUGE	EQU	1000H  
STE_PAGEABLE	EQU	2000H  
STE_PRESENT	EQU	2000H  
STE_SELALLOC	EQU	4000H  
STE_GDTSEG	EQU	8000H  
STE_HUGE_MASK	EQU	( STE_TYPE_MASK OR STE_SHARED OR STE_SEGDPL )
STE_RSRC_HUGE	EQU	( STE_HUGE_MASK  AND  ((NOT STE_TYPE_MASK) OR STE_PRELOAD) )
ISRSRC	EQU	1       
SFR_DATALEN	EQU	4 

sfr_s	STRUC
	sfr_s_fs	DW  ?
sfr_bytes	DB	SFR_DATALEN DUP (?)
sfr_s	ENDS

sfr_fchained	EQU	01h
sfr_fixsize	EQU	0eh
sfr_soff	EQU	0fff0h
sfr_t struc
db size sfr_s dup(?)
sfr_t ends

SFR_HEADSIZE	EQU	(SIZE   sfr_t -SFR_DATALEN)
PAGESPERSEGMENT	EQU	16 

sfir_s	STRUC
sfir_doffset	DD	?
sfir_soffset	DW	?
sfir_cbdata	DW	?
sfir_count	DW	?
sfir_s	ENDS

sfir_t struc
db size sfir_s dup(?)
sfir_t ends


ldrempty_s	STRUC
empty_count	DB	?
emtpy_type	DB	?
ldrempty_s	ENDS

ldrempty_t struc
db size ldrempty_s dup(?)
ldrempty_t ends


ldrlv_s	STRUC
lv_pmte	DD	?
lv_lbufaddr	DD	?
lv_sbufaddr	DD	?
lv_lrecbufaddr	DD	?
lv_srecbufaddr	DD	?
lv_new_exe_off	DD	?
lv_sfn	DW	?
lv_hobmte	DW	?
lv_objnum	DD	?
lv_csmte	DD	?
lv_class	DW	?
lv_type	DB	?
ldrlv_s	ENDS

ldrlv_t struc
db size ldrlv_s dup(?)
ldrlv_t ends


ldrrsrc16_s	STRUC
ldrrsrc16_type	DW	?
ldrrsrc16_name	DW	?
ldrrsrc16_s	ENDS

ldrrsrc16_t struc
db size ldrrsrc16_s dup(?)
ldrrsrc16_t ends


ldrrsrc32_s	STRUC
ldrrsrc32_type	DW	?
ldrrsrc32_name	DW	?
ldrrsrc32_cb	DD	?
ldrrsrc32_obj	DW	?
ldrrsrc32_off	DD	?
ldrrsrc32_s	ENDS

ldrrsrc32_t struc
db size ldrrsrc32_s dup(?)
ldrrsrc32_t ends


ldrrsrc_s	STRUC
rsrc_typeid	DD	?
rsrc_nameid	DD	?
rsrc_mte	DW	?
rsrc_refcount	DW	?
rsrc_localptr	DW	?
rsrc_globalptr	DW	?
ldrrsrc_s	ENDS

ldrrsrc_t struc
db size ldrrsrc_s dup(?)
ldrrsrc_t ends


ldrrrsrc_s	STRUC
ldrrrsrc_ptr	DB	SIZE ptr_t DUP (?)
ldrrrsrc_type	DD	?
ldrrrsrc_s	ENDS

ldrrrsrc_t struc
db size ldrrrsrc_s dup(?)
ldrrrsrc_t ends


ldrwhois_s	STRUC
whois_ssegnum	DW	?
whois_hmte	DW	?
whois_achname	DB	256 DUP (?)
ldrwhois_s	ENDS

ldrwhois_t struc
db size ldrwhois_s dup(?)
ldrwhois_t ends

DOSCALL1STRING	EQU	<"DOSCALL1">
SIZEDOSCALL1STR	EQU	8 
MAX_DEMAND_READ	EQU	8        
ifdef  RANGE
RANGEINVALID	EQU	(INVALID  OR  RANGE)
RANGEZEROED	EQU	(ZEROED  OR  RANGE)
endif
LOAD_PAGE	EQU	0        
LOAD_SEGMENT	EQU	1        
ALIGNMENT_SHIFT	EQU	512      
ENDMTETBL	EQU	0DEADH   
SKIPCOPY	EQU	-1 
MAX_NAME_LEN	EQU	8 
MAX_PROC_LEN	EQU	256      
EXT_PROGRAM	EQU	0        
EXT_LIBRARY	EQU	1        
EXT_DEVICE	EQU	2        
EXT_FSD	EQU	3        
EXT_VDD	EQU	4        
CHECK_ALL	EQU	1        
CHECK_WILDCARDS	EQU	2        
MIN_CHAR_VALUE	EQU	20H     
HEADER_EXEINFO	EQU	1        
HEADER_READRSRCTBL	EQU	2        
HEADER_READSECTOR	EQU	3        
HEADER_LIBPATHLEN	EQU	4        
HEADER_LIBPATH	EQU	5        
HEADER_FIXENTRY	EQU	6        
HEADER_STE	EQU	7        
HEADER_MAPSEL	EQU	8        
ifdef LDRSTRICT
LDR_DEBUG_OFF	EQU	00000000H 
LDR_INT3_BAD_GETPAGE	EQU	00000001H 
LDR_PRINT_BAD_GETPAGE	EQU	00000002H 
LDR_PRINT_ALL_GETPAGE	EQU	00000004H 
LDR_PRINT_ALL_DLM	EQU	00000008H 
LDR_PRINT_DLM_SEM	EQU	00000018H 
LDR_SETUP_DLL_INIT	EQU	00000020H 
LDR_EXTRA_GC_PANICS	EQU	00000040H 
LDR_PRINT_IMPORTS	EQU	00000080H 
LDR_PRINT_BROKEN_BASING	EQU	00000100H 
LDR_PRINT_TREE_WALKING	EQU	00000800H 
LDR_DEBUG_ON	EQU	0FFFFFFFFH 
endif









ldrSetupSrcErrTxt       macro   pmtereg
        mov     edx,_pTCBCur
        mov     ecx,[pmtereg].smte_restab
        movzx   eax, byte ptr [ecx]
        mov     [edx].TCB_SrcModNameBufL,ax
        inc     ecx
        mov     [edx].TCB_SrcModNameBuf,ecx
        endm










ldrInvSrcErrTxt macro   currtcbreg
        ifb <currtcbreg>
                mov     edx,_pTCBCur
                mov     [edx].TCB_SrcModNameBufL,0
        else
                mov     [currtcbreg].TCB_SrcModNameBufL,0
        endif
        endm










ldrSetupTgtErrTxt       macro   pmtereg
        mov     edx,_pTCBCur
        mov     ecx,[pmtereg].smte_restab
        movzx   eax, byte ptr [ecx]
        mov     [edx].TCB_TgtModNameBufL,ax
        inc     ecx
        mov     [edx].TCB_TgtModNameBuf,ecx
        endm










ldrInvTgtErrTxt macro   currtcbreg
        ifb <currtcbreg>
                mov     edx,_pTCBCur
                mov     [edx].TCB_TgtModNameBufL,0
        else
                mov     [currtcbreg].TCB_TgtModNameBufL,0
        endif
        endm











ldrInvErrTxt    macro   currtcbreg
        ifb <currtcbreg>
                mov     edx,_pTCBCur
                mov     [edx].TCB_SrcModNameBufL,0
                mov     [edx].TCB_TgtModNameBufL,0
        else
                mov     [currtcbreg].TCB_SrcModNameBufL,0
                mov     [currtcbreg].TCB_TgtModNameBufL,0
        endif
        endm






taddr_s         STRUC
taddr_toffl     dw      ?
taddr_toffh     dw      ?
taddr_tsel      dw      ?
taddr_tflags    db      ?
taddr_fflags    db      ?
taddr_cgsel     dw      ?
taddr_s         ENDS


dld_s           STRUC
dld_ptda        dw      ?
dld_mte         dw      ?
dld_cnt         db      ?
dld_s           ENDS


ri_s    STRUC
ri_stype        db      ?               
ri_flags        db      ?               
ri_source       dw      ?               
ri_target_seg   dw      ?               
ri_target_off   dw      ?               
ri_s    ENDS

ri_target_modnam EQU    ri_target_seg   
ri_target_impnam EQU    ri_target_off   

SOURCE_MASK     EQU     07h
BYTE_ADR        EQU     00h             
SEG_ADR         EQU     02h             
FAR_ADR         EQU     03h             
OFF_ADR         EQU     05h             
TARGET_MASK     EQU     03h
INTERNALREF     EQU     00h
IMPORTORDINAL   EQU     01h
IMPORTNAME      EQU     02h
ADDITIVE        EQU     04h

RELOCSPERBUF    EQU     8
RELOCBUFLEN     EQU     ((SIZE ri_s)*RELOCSPERBUF)



cte_s   STRUC
cte_flags       db      ?               
cte_inst        db      2 DUP(?)        
cte_seg         db      ?               
cte_off         dw      ?               
cte_s   ENDS

cte_sel         EQU (word ptr cte_inst) 



EF_EXPORT       EQU     01h             
EF_GDATA        EQU     02h             

BUF_LENGTH      EQU     64



ent_s   STRUC
ent_flags       db      ?               
ent_off         dw      ?               
ent_s   ENDS





TYPE_MASK       EQU     0003h           
CODE_TYPE       EQU     0000h           
DATA_TYPE       EQU     0001h           
ITERATED        EQU     0008h           
MOVABLE         EQU     0010h           
SHARED          EQU     0020h           
PRELOAD         EQU     0040h           
ERONLY          EQU     0080h           
RELOCINFO       EQU     0100h           
CONFORMING      EQU     0200h           
SEGDPL          EQU     0C00h           
RING_2          EQU     0800h           
RING_3          EQU     0c00h           
DISCARD         EQU     1000h           

SELALLOC        EQU     4000h           
OBJIOPL         EQU     8000h           
OBJCONFORM      EQU     4000h           
NRALIAS         EQU     10h



OBJTILE         equ     OBJPRELOAD
OBJNOFLAT       equ     OBJIOPL
OBJHIMEM        equ     OBJDISCARD



OBJREAD         equ     00000001h       
OBJWRITE        equ     00000002h       
OBJEXEC         equ     00000004h       
OBJRSRC         equ     00000008h       
OBJDISCARD      equ     00000010h       
OBJSHARED       equ     00000020h       
OBJPRELOAD      equ     00000040h       
OBJINVALID      equ     00000080h       
OBJZEROFIL      equ     00000100h       
OBJRESIDENT     equ     00000200h       
OBJALIAS16      equ     00001000h       
OBJBIGDEF       equ     00002000h       
OBJCONFORM      equ     00004000h       
OBJIOPL         equ     00008000h       


