;       SCCSID = @(#)ldrdata.asm        6.5 91/11/13
SCCSID equ "@(#)ldrdata.asm     6.5 91/11/13"

TITLE   LDRDATA - Loader Data Definitions for OS/2.

;***    Loader Data Definitions for OS/2.
;
;       LoadData contains all of the initial data definitions for the
;       DOSCALLS module table entry.
;
;       Copyright (C) 1988,1990 Microsoft Corporation
;
; HISTORY
;
; 72417   MLM  11/27/95  - moved find.inc after tkexport.inc since most dirent
;                            defines are now in tkexport.inc
;147968   RJM  5/11/96     Change FSD and DD system owners to use HMTEs


.xlist
include dosseg.inc
include basemaca.inc
include fnomem.inc
include osmaca.inc
include osconst.inc
include mi.inc
include curdir.inc
include dirent.inc
include dossymc.inc
include except.inc
include ldrvars.inc
include pgexport.inc
include screen.inc
include sem.inc
include sigdef.inc
include vmexport.inc
include tkexport.inc
include find.inc                                ;72417 moved after tkexport.inc
include infoseg.inc
include tkptda.inc
include kmode.inc
include sysentry.inc
include ordinals.inc
include protmode.inc
include vmowner.inc
.list

        CpuMode 386
        ModName ldrdata, FNO_LDRDATA_ASM

ifdef PMDEBUG
        extrn   _KDPEnableCVK:near
endif

        ReferGDT GDT_SAS,WORD


;       DOSCALLS module table entry

;;;;;;; Run time initialization required ;;;;;;;

;;      1. Compute segment address of module table entry.
;;      2. Link module table entry into module list.
;;      3. Set handles in OTEs
;;      4. Compute and setup length of entry table (thunk block).


DOSMTE segment

DMInit macro field, size, value
    .errnz (($ - _DosModMte) - offset field)
    size  value
endm

DMSInit macro field, size, value
    .errnz (($ - _DosModMteSwappable) - offset field)
    size  value
endm

;***    START OF MTE HEADER DEFINITIONS

        public  _DosModMte
_DosModMte label byte

DMInit  mte_flags2      dw      <MTEFORMATLX>
DMInit  mte_handle      dw      0
DMInit  mte_swapmte     dd      <offset FLAT:_DosModMteSwappable>
DMInit  mte_link        dd      0

DMInit  mte_flags1      dd      <NOAUTODS+DOSMOD+LIBRARYMOD+MTEVALID+CLASS_GLOBAL+MTE_MEDIAFIXED>
DMInit  mte_impmodcnt   dd      0
DMInit  mte_sfn         dw      0
DMInit  mte_usecnt      dw      1
DMInit  mte_modname     db      'DOSCALLS'

        public  _DosModMteSwappable
_DosModMteSwappable label byte

DMSInit smte_mpages     dd      0
DMSInit smte_startobj   dd      0
DMSInit smte_eip        dd      0
DMSInit smte_stackobj   dd      0

DMSInit smte_esp        dd      0
DMSInit smte_pageshift  dd      0 ; not used
DMSInit smte_fixupsize  dd      0
DMSInit smte_objtab     dd      <offset FLAT:dcm_ote_start>

DMSInit smte_objcnt     dd      <SN_MAX>
DMSInit smte_objmap     dd      0
DMSInit smte_itermap    dd      0
DMSInit smte_rsrctab    dd      0

DMSInit smte_rsrccnt    dd      0
DMSInit smte_restab     dd      <offset FLAT:dcm_resnamtbl>
DMSInit smte_enttab     dd      <offset FLAT:dcm_entrytblstart>
DMSInit smte_fpagetab   dd      0

DMSInit smte_frectab    dd      0
DMSInit smte_impmod     dd      0
DMSInit smte_impproc    dd      0
DMSInit smte_datapage   dd      0

DMSInit smte_nrestab    dd      0
DMSInit smte_cbnrestab  dd      0
DMSInit smte_autods     dd      0
DMSInit smte_debuginfo  dd      0

DMSInit smte_debuglen   dd      0
DMSInit smte_heapsize   dd      0
DMSInit smte_path       dd      <offset FLAT:dcm_path>
                        db      (size ldrsmte_s - ($ - _DosModMteSwappable)) dup(0)

;***    END OF MTE HEADER DEFINITIONS

        public dcm_ote_start
dcm_ote_start   label   byte
        db      SN_MAX * size ldrote_s dup(?)

;       DOSCALLS Pathname String

dcm_path        db      'DOSCALLS.DLL',0; pathname is not needed
dcm_resnamtbl   label   byte
                db      8,'DOSCALLS'
                dw      ?               ; filled in at init time
DOSMTE ends

DOSMTENAME segment                      ; resident names filled in here
DOSMTENAME ends

DOSMTEMID segment
                db      0               ; end of resident name table
        public dcm_entrytblstart, dcm_length
dcm_entrytblstart label byte
dcm_length      dw      0
DOSMTEMID ends

DOSMTEENTRY segment                     ; entry table filled in here
DOSMTEENTRY ends


;       Entries for LANMAN and HPFS "dirty hooks"

GenEntryTbl <>,ORD_PTDA_LANMAN_SEC,IS_ABSOLUTE,<TKOPTDA+ptda_lanman_sec>
GenEntryTbl <>,ORD_SAS_SEL,IS_ABSOLUTE,<GSEL GDT_SAS>
GenEntryTbl <>,ORD_TCB_OPCOOKIE,IS_ABSOLUTE,TCBOpCookie
GenEntryTbl <>,ORD_TCB_OPFLAGS,IS_ABSOLUTE,TCBOpFlags
GenEntryTbl <>,ORD_TCB_NEWFLAGS,IS_ABSOLUTE,TCBNewFlags
GenEntryTbl <>,ORD_TCB_USER_ID,IS_ABSOLUTE,TCBUser_ID
GenEntryTbl <>,ORD_TCB_PROC_ID,IS_ABSOLUTE,TCBProc_ID
GenEntryTbl <>,ORD_TCB_FSHARING,IS_ABSOLUTE,TCBfSharing
GenEntryTbl <>,ORD_TCB_SRVATTRIB,IS_ABSOLUTE,TCBSrvAttrib
GenEntryTbl <>,ORD_TCB_ALLOWED,IS_ABSOLUTE,TCBAllowed
GenEntryTbl <>,ORD_TCB_PRTCB,IS_ABSOLUTE,TCBpRTCB
GenEntryTbl <>,ORD_TCB_NUMBER,IS_ABSOLUTE,TCBNumber
GenEntryTbl <>,ORD_TCB_THISSFT,IS_ABSOLUTE,TCBThisSFT
GenEntryTbl <>,ORD_TCB_THISCDS,IS_ABSOLUTE,TCBThisCDS
GenEntryTbl <>,ORD_TKOPTDA,IS_ABSOLUTE,TKOPTDA
GenEntryTbl <>,ORD_PTDA_CRITSEC,IS_ABSOLUTE,<TKOPTDA+ptda_cCritSec>
GenEntryTbl <>,ORD_PTDA_HOLDSIGCNT,IS_ABSOLUTE,<TKOPTDA+HoldSigCnt>
GenEntryTbl <>,ORD_PTDA_PPTDAPARENT,IS_ABSOLUTE,<TKOPTDA+pPTDAParent>
GenEntryTbl <>,ORD_PTDA_PGDATA,IS_ABSOLUTE,<TKOPTDA+ptda_pgdata>
GenEntryTbl <>,ORD_PTDA_HANDLE,IS_ABSOLUTE,<TKOPTDA+ptda_handle>
GenEntryTbl <>,ORD_PTDA_MODULE,IS_ABSOLUTE,<TKOPTDA+ptda_module>
GenEntryTbl <>,ORD_PTDA_LDTHANDLE,IS_ABSOLUTE,<TKOPTDA+ptda_ldthandle>
GenEntryTbl <>,ORD_PTDA_CODEPAGE_TAG,IS_ABSOLUTE,<TKOPTDA+codepage_tag>
GenEntryTbl <>,ORD_PTDA_JFN_LENGTH,IS_ABSOLUTE,<TKOPTDA+JFN_Length>
GenEntryTbl <>,ORD_PTDA_JFN_PTABLE,IS_ABSOLUTE,<TKOPTDA+JFN_pTable>
GenEntryTbl <>,ORD_PTDA_JFN_FLG_PTR,IS_ABSOLUTE,<TKOPTDA+JFN_Flg_Ptr>
GenEntryTbl <>,ORD_PTDA_EXTERR_LOCUS,IS_ABSOLUTE,<TKOPTDA+ExtErr_Locus>
GenEntryTbl <>,ORD_PTDA_EXTERR,IS_ABSOLUTE,<TKOPTDA+ExtErr>
GenEntryTbl <>,ORD_PTDA_EXTERR_ACTION,IS_ABSOLUTE,<TKOPTDA+ExtErr_Action>
GenEntryTbl <>,ORD_PTDA_EXTERR_CLASS,IS_ABSOLUTE,<TKOPTDA+ExtErr_Class>
GenEntryTbl <>,ORD_PTDA_PID,IS_ABSOLUTE,<TKOPTDA+ptda_infoseg+LIS_CurProcID>
GenEntryTbl <>,ORD_PTDA_PPID,IS_ABSOLUTE,<TKOPTDA+ptda_infoseg+LIS_ParProcID>
GenEntryTbl <>,ORD_PTDA_PROCTYPE,IS_ABSOLUTE,<TKOPTDA+ptda_infoseg+LIS_ProcType>
GenEntryTbl <>,ORD_PTDA_CURRTCB,IS_ABSOLUTE,<TKOPTDA+CurrTCB>
GenEntryTbl <>,ORD_PTDA_CURRTSD,IS_ABSOLUTE,<TKOPTDA+CurrTSD>
GenEntryTbl <>,ORD_PTDA_SIGNATURE,IS_ABSOLUTE,<TKOPTDA+ptda_signature>


;       FSHELPER module table entry

;;;;;;; Run time initialization required ;;;;;;;

;;      1. Compute segment address of module table entry.
;;      2. Link module table entry into module list.
;;      3. Compute and setup length of entry table (thunk block).

FSHMTE segment

FSInit macro field, size, value
    .errnz (($ - _FSHModMte) - offset field)
    size  value
endm

FSSInit macro field, size, value
    .errnz (($ - FSHModMteSwappable) - offset field)
    size  value
endm

;;;;;;; Run time initialization required ;;;;;;;

;;      1. Compute segment address of module table entry.
;;      2. Compute and setup segment address of entry table.

;       FSHELPER Module Table Entry
;***    START OF MTE HEADER DEFINITIONS

        public  _FSHModMte
_FSHModMte label byte

FSInit  mte_flags2      dw      <MTEFORMATLX>
FSInit  mte_handle      dw      0
FSInit  mte_swapmte     dd      <offset FLAT:FSHModMteSwappable>
FSInit  mte_link        dd      0

FSInit  mte_flags1      dd      <NOAUTODS+FSHMOD+LIBRARYMOD+MTEVALID+CLASS_GLOBAL+MTE_MEDIAFIXED>
FSInit  mte_impmodcnt   dd      1
FSInit  mte_sfn         dw      0
FSInit  mte_usecnt      dw      1
FSInit  mte_modname     db      'FSHELPER'

        public  FSHModMteSwappable
FSHModMteSwappable label byte

FSSInit smte_mpages     dd      0
FSSInit smte_startobj   dd      0
FSSInit smte_eip        dd      0
FSSInit smte_stackobj   dd      0

FSSInit smte_esp        dd      0
FSSInit smte_pageshift  dd      0   ; not needed
FSSInit smte_fixupsize  dd      0
FSSInit smte_objtab     dd      0

FSSInit smte_objcnt     dd      0
FSSInit smte_objmap     dd      0
FSSInit smte_itermap    dd      0
FSSInit smte_rsrctab    dd      0

FSSInit smte_rsrccnt    dd      0
FSSInit smte_restab     dd      <offset FLAT:fsh_resnamtbl>
FSSInit smte_enttab     dd      <offset FLAT:fsh_entrytblstart>
FSSInit smte_fpagetab   dd      0

FSSInit smte_frectab    dd      0
FSSInit smte_impmod     dd      0
FSSInit smte_impproc    dd      0
FSSInit smte_datapage   dd      0

FSSInit smte_nrestab    dd      0
FSSInit smte_cbnrestab  dd      0
FSSInit smte_autods     dd      0
FSSInit smte_debuginfo  dd      0

FSSInit smte_debuglen   dd      0
FSSInit smte_heapsize   dd      0
FSSInit smte_path       dd      <offset FLAT:fsh_path>
                        db      (size ldrsmte_s - ($ - FSHModMteSwappable)) dup(0)

;       FSHELPER Pathname String

fsh_path        db      'FSHELPER.DLL',0        ; pathname is not needed
fsh_resnamtbl   label   byte
                db      8,'FSHELPER'
                dw      ?               ; filled in at init time
FSHMTE ends


FSHMTENAME segment                      ; resident names filled in here
FSHMTENAME ends


FSHMTEMID segment

                db      0               ; end of resident name table
        public fsh_entrytblstart
fsh_entrytblstart label byte

FSHMTEMID ends


FSHMTEENTRY segment                     ; entry table filled in here
FSHMTEENTRY ends


VDDMTE segment


VDSInit macro field, size, value
    .errnz (($ - VDDModMteSwappable) - offset field)
    size  value
endm

; Moved to sdata.asm for System Anchor Block - f122427
        extrn   _VDDModMte:byte
 
;***    START OF MTE HEADER DEFINITIONS

        public  VDDModMteSwappable
VDDModMteSwappable label byte

VDSInit smte_mpages     dd      0
VDSInit smte_startobj   dd      0
VDSInit smte_eip        dd      0
VDSInit smte_stackobj   dd      0

VDSInit smte_esp        dd      0
VDSInit smte_pageshift  dd      0   ; not needed - not loaded
VDSInit smte_fixupsize  dd      0
VDSInit smte_objtab     dd      0

VDSInit smte_objcnt     dd      0
VDSInit smte_objmap     dd      0
VDSInit smte_itermap    dd      0
VDSInit smte_rsrctab    dd      0

VDSInit smte_rsrccnt    dd      0
VDSInit smte_restab     dd      <offset FLAT:vdd_resnamtbl>
VDSInit smte_enttab     dd      <offset FLAT:vdd_entrytblstart>
VDSInit smte_fpagetab   dd      0

VDSInit smte_frectab    dd      0
VDSInit smte_impmod     dd      0
VDSInit smte_impproc    dd      0
VDSInit smte_datapage   dd      0

VDSInit smte_nrestab    dd      0
VDSInit smte_cbnrestab  dd      0
VDSInit smte_autods     dd      0
VDSInit smte_debuginfo  dd      0

VDSInit smte_debuglen   dd      0
VDSInit smte_heapsize   dd      0
VDSInit smte_path       dd      <offset FLAT:vdd_path>
                        db      (size ldrsmte_s - ($ - VDDModMteSwappable)) dup(0)

;***    END OF MTE HEADER DEFINITIONS

;       _VDDModMte Pathname String

vdd_path        db      'MVDM.DLL',0    ; pathname is not needed
vdd_resnamtbl   label   byte
                db      4,'MVDM'
                dw      ?               ; filled in at init time

VDDMTE ends



VDDMTENAME segment                      ; resident names filled in here
VDDMTENAME ends



VDDMTEMID segment

                db      0               ; end of resident name table
        public vdd_entrytblstart, vdd_length
vdd_entrytblstart label byte
vdd_length      dw      0

VDDMTEMID ends



VDDMTEENTRY segment                     ; entry table filled in here
VDDMTEENTRY ends



_DATA   segment

        public  _pDosModMte
_pDosModMte     dd offset FLAT:_DosModMte ; pointer to kernel mte

        public  _pPHMtePath
        public  _pPHMteResNam
        public  _pPHMteObjTab
_pPHMtePath     db      "_PORTHOLE.DLL",0
_pPHMteResNam   db      9,"_PORTHOLE"
                dw      ?
_pPHMteObjTab   ldrote_s <0, 0, 0, 0, 0>

; Moved to sdata.asm for System Anchor Block - f122427

        extrn  _pPortHoleMte:dword
        extrn  _BasicHWConfig:word

_DATA   ends


;147968 LDRDDOwner and LDRFSDOwner are redundant. They are referenced in ldrxport.h
;       and should be removed from here and ldrxport.h when ldrxport.h is next modified.
DATA segment

        public  _LDRDDOwner
    _LDRDDOwner  dw  DD1OWNER

        public  _LDRFSDOwner
    _LDRFSDOwner dw  FSD1OWNER

DATA ends



        FARCODE HIGH32
CINIT_TEXT segment


;***EP  _LDREnableCVK - initialize DosCalls OTE flags from arenainfo
;
;       _LDREnableCVK makes a call to enable CVK symbolic debugging.  This
;       routine is here because this file must already be assembled separately
;       for PMDEBUG to add two OTE entries to the DOSCALLS module for the
;       debugger's code and data segments.
;
;       ENTRY   NONE
;       EXIT    NONE
;       USES    Flags

Procedure _LDREnableCVK
ifdef PMDEBUG
        CCALL32 _KDPEnableCVK
endif
        RETC
EndProc _LDREnableCVK

CINIT_TEXT ends
        end
