Ignore:
Timestamp:
Jul 17, 2000, 12:43:41 AM (25 years ago)
Author:
bird
Message:

Checkin of current code in the Grace brance for backup purpose.

Location:
branches/GRACE/src/win32k/include
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/GRACE/src/win32k/include/LdrCalls.h

    r2501 r3834  
    1 /* $Id: LdrCalls.h,v 1.3 2000-01-22 18:21:00 bird Exp $
     1/* $Id: LdrCalls.h,v 1.3.4.1 2000-07-16 22:43:30 bird Exp $
    22 *
    33 * Prototypes for the loader overrided function.
     
    3535 */
    3636extern ULONG LDRCALL ldrOpen(   /* retd  0x0c */
    37     PSFN p1,                    /* ebp + 0x08 */
    38     PCHAR p2,                   /* ebp + 0x0c */
    39     ULONG p3                    /* ebp + 0x10 */
    40     );
    41 
    42 ULONG LDRCALL myldrOpen(PSFN,PCHAR,ULONG);
     37    PSFN    p1,                 /* ebp + 0x08 */
     38    PCHAR   p2,                 /* ebp + 0x0c */
     39    PULONG  p3                  /* ebp + 0x10 */
     40    );
     41
     42ULONG LDRCALL myldrOpen(PSFN phFile, PSZ pszFilename, PULONG pfl);
    4343
    4444
     
    4747 */
    4848extern ULONG LDRCALL ldrRead(   /* retd  0x18 */
    49     SFN p1,                     /* ebp + 0x08 */
    50     ULONG p2,                   /* ebp + 0x0c */
    51     PVOID p3,                   /* ebp + 0x10 */
    52     ULONG p4,                   /* ebp + 0x14 */
    53     ULONG p5,                   /* ebp + 0x18 */
    54     PMTE p6                     /* ebp + 0x1c */
     49    SFN     hFile,              /* ebp + 0x08 */
     50    ULONG   ulOffset,           /* ebp + 0x0c */
     51    PVOID   pvBuffer,           /* ebp + 0x10 */
     52    ULONG   fpBuffer,           /* ebp + 0x14 */
     53    ULONG   cbToRead,           /* ebp + 0x18 */
     54    PMTE    pMTE                /* ebp + 0x1c */
    5555    );
    5656
    5757ULONG LDRCALL myldrRead(
    58     SFN   hFile,
    59     ULONG ulOffset,
    60     PVOID pBuffer,
    61     ULONG ulFlags ,
    62     ULONG ulBytesToRead,
    63     PMTE  pMTE
     58    SFN     hFile,
     59    ULONG   ulOffset,
     60    PVOID   pvBuffer,
     61    ULONG   fpBuffer,
     62    ULONG   cbToRead,
     63    PMTE    pMTE
    6464    );
    6565
     
    9999
    100100
    101 #if 0
    102 /****************************************/
    103 /* _LDRLoadExe                          */
    104 /****************************************/
    105 extern int LDRCALL _LDRLoadExe(     /* retd  0x08 */
    106         PCHAR pExeName,             /* ebp + 0x08 */
    107         PULONG param2               /* ebp + 0x0c */
    108     );
    109 
    110 int LDRCALL myLDRLoadExe(PCHAR,PULONG);
    111 
    112 
    113 
    114 /****************************************/
    115 /* _ldrGetResource                      */
    116 /****************************************/
    117 extern int LDRCALL _ldrGetResource( /* retd 0x14 - 20d */
    118         USHORT idType,              /* ebp + 0x08 */
    119         ULONG  idName,              /* ebp + 0x0c */
    120         USHORT hMod,                /* ebp + 0x10 */
    121         PPVOID ppRes,               /* ebp + 0x14 */
    122         ULONG ulP5                  /* ebp + 0x18 */
    123     );
    124 
    125 int LDRCALL myldrGetResource(USHORT,ULONG,USHORT,PPVOID,ULONG);
    126 
    127 
    128 
    129 /****************************************/
    130 /* _ldrOpenNewExe                       */
    131 /****************************************/
    132 extern int LDRCALL _ldrOpenNewExe(  /* retd 0x10 - 16d */
    133         PCHAR  pszName,             /* ebp + 0x08 */
    134         USHORT lenName,             /* ebp + 0x0c */
    135         ULONG  ulP3,                /* ebp + 0x10 */
    136         ULONG  ulP4                 /* ebp + 0x14 */
    137     );
    138 
    139 int LDRCALL myldrOpenNewExe(PCHAR,USHORT,ULONG,ULONG);
    140 
    141 
    142 
    143 /****************************************/
    144 /* _ldrCreateMte                        */
    145 /****************************************/
    146 extern int LDRCALL  _ldrCreateMte(  /* retd  0x08 */
    147         ULONG p1,                   /* ebp + 0x08 */
    148         ULONG p2                    /* ebp + 0x0c */
    149     );
    150 
    151 int LDRCALL myldrCreateMte(ULONG,ULONG);
    152 
    153 
    154 
    155 /****************************************/
    156 /* _ldrGetMte                           */
    157 /****************************************/
    158 extern int LDRCALL  _ldrGetMte(     /* retd 0x14 - 20d */
    159         ULONG  p1,                  /* ebp + 0x08 */
    160         ULONG  p2,                  /* ebp + 0x0c */
    161         ULONG  p3,                  /* ebp + 0x10 */
    162         ULONG  p4,                  /* ebp + 0x14 */
    163         ULONG  p5                   /* ebp + 0x18 */
    164     );
    165 
    166 int LDRCALL myldrGetMte(ULONG,ULONG,ULONG,ULONG,ULONG);
    167 
    168 #endif
     101
     102/**
     103 * Loader local variables from KERNEL.SDF.
     104 */
     105typedef struct ldrlv_s /* #memb 12 size 39 (0x027) */
     106{
     107    PMTE        lv_pmte;                /* Pointer to mte. (ldrCreateMte/ldrXXX) */
     108    ULONG       lv_lbufaddr;
     109    ULONG       lv_sbufaddr;
     110    ULONG       lv_lrecbufaddr;
     111    ULONG       lv_srecbufaddr;
     112    ULONG       lv_new_exe_off;
     113    USHORT      lv_sfn;                 /* Handle to the module being loaded */
     114    USHORT      lv_hobmte;
     115    ULONG       lv_objnum;
     116    ULONG       lv_csmte;               /* size of the swappable mte heap block. (ldrCreateMte) */
     117    USHORT      lv_class;               /* Object class CLASS_* defines in OS2Krnl (mteflags1) it seems. */
     118                                        /* CLASS_PROGRAM    Program class. */
     119                                        /* CLASS_GLOBAL     Global class. */
     120                                        /* CLASS_SPECIFIC   Specific class, as against global. */
     121                                        /* CLASS_ALL (0)    Nonspecific class  all modules. */
     122                                        /* CLASS_MASK       Class mask. */
     123    UCHAR       lv_type;                /* Type of executable image expected loaded. */
     124} ldrlv_t;
     125
     126
     127/*
     128 * Values of the lv_type byte. (Qualified guesses.)
     129 */
     130#define LVTYPE_EXE      0               /* Executable program. */
     131#define LVTYPE_DLL      1               /* Dynamic Link Library. */
     132#define LVTYPE_DD       2               /* Device Driver. */
     133#define LVTYPE_IFS      3               /* Installable Filesystem. */
     134#define LVTYPE_VDD      4               /* Virtual Device Driver (for VDMs). */
     135
     136
     137
     138/**
     139 * ldrOpenPath
     140 * @returns   OS2 return code.
     141 *            pLdrLv->lv_sfn  is set to filename handle.
     142 * @param     pachModname   Pointer to modulename. Not zero terminated!
     143 * @param     cchModname    Modulename length.
     144 * @param     pLdrLv        Loader local variables? (Struct from KERNEL.SDF)
     145 * @param     pfl           Pointer to flags which are passed on to ldrOpen.
     146 * @sketch
     147 *  if !CLASS_GLOBAL or miniifs then
     148 *      ldrOpen(pachModName)
     149 *  else
     150 *      loop until no more libpath elements
     151 *          get next libpath element and add it to the modname.
     152 *          try open the modname
     153 *          if successfull then break the loop.
     154 *      endloop
     155 *  endif
     156 */
     157extern ULONG LDRCALL ldrOpenPath(   /* retd  0x10 */
     158    PCHAR       pachFilename,       /* ebp + 0x08 */
     159    USHORT      cchFilename,        /* ebp + 0x0c */
     160    ldrlv_t *   plv,                /* ebp + 0x10 */
     161    PULONG      pful                /* ebp + 0x14 */
     162    );
     163
     164ULONG LDRCALL myldrOpenPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful);
     165
     166
     167
     168/**
     169 * LDRClearSem - Clears the loader semaphore.
     170 * (It does some garbage collection on release.)
     171 * @returns   NO_ERROR on sucess.
     172 *            OS/2 error on failure. (ERROR_INTERRUPT?)
     173 */
     174extern ULONG LDRCALL LDRClearSem(void);
     175
     176
     177/**
     178 * LDRGetSem - Requests the loader semaphore..
     179 * @returns   NO_ERROR if succesfully.
     180 *            OS2 errorcode on failure. (ERROR_INTERRUPT?)
     181 */
     182#define LDRGetSem()   KSEMRequestMutex(*pLdrSem, (ULONG)-1)
     183
     184
     185/*
     186 * Pointer to the loader semaphore.
     187 */
     188#ifdef _OS2KSEM_h_
     189extern HKMTX *  pLdrSem;
     190#endif
     191
     192
     193/**
     194 * Validates an hMTE and gets the MTE pointer.
     195 * @returns   Pointer to MTE on success.
     196 *            NULL on error.
     197 * @param     hMTE  MTE handle.
     198 * @remark    If you wan't to this faster:
     199 *              Use the hMTE as a HOB and get the HOB address (by using VMGetHandleInfo).
     200 */
     201extern PMTE LDRCALL ldrValidateMteHandle(HMTE hMTE);
     202
     203
    169204
    170205#ifdef __cplusplus
  • branches/GRACE/src/win32k/include/OS2KVM.h

    r3411 r3834  
    1 /* $Id: OS2KVM.h,v 1.4 2000-04-17 01:56:49 bird Exp $
     1/* $Id: OS2KVM.h,v 1.4.4.1 2000-07-16 22:43:27 bird Exp $
    22 *
    33 * OS/2 kernel VM functions.
     
    8282
    8383
    84 typedef USHORT HMTE, *PHMTE;
    85 typedef USHORT HPTDA, *PHPTDA;
    86 
    8784/*******************************************************************************
    8885*   Exported Functions                                                         *
  • branches/GRACE/src/win32k/include/env.h

    r3412 r3834  
    1 /* $Id: env.h,v 1.2 2000-04-17 02:26:04 bird Exp $
     1/* $Id: env.h,v 1.2.4.1 2000-07-16 22:43:29 bird Exp $
    22 *
    33 * Environment access functions
     
    2121*******************************************************************************/
    2222const char *ScanEnv(const char *paszEnv, const char *pszVar);
    23 const char *GetEnv(void);
     23const char *GetEnv(BOOL fExecChild);
    2424
    2525
  • branches/GRACE/src/win32k/include/ldr.h

    r2501 r3834  
    1 /* $Id: ldr.h,v 1.5 2000-01-22 18:20:59 bird Exp $
    2  *
    3  * ldr - loader header file.
    4  *
    5  * Copyright (c)  1999 knut  St.  osmundsen
     1/* $Id: ldr.h,v 1.5.4.1 2000-07-16 22:43:29 bird Exp $
     2 *
     3 * ldr - Our loader "subsystem" public header file.
     4 *
     5 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
    66 *
    77 * Project Odin Software License can be found in LICENSE.TXT
     
    1212#ifndef _ldr_h_
    1313#define _ldr_h_
    14     #ifndef LDR_INCL_INITONLY
    15         /* state variable */
    16         extern BOOL fQAppType;
    17 
    18         /*
    19          * handle state - Array of handle states. Eight state per byte!
    20          */
    21         #define MAX_FILE_HANDLES 0x10000
    22 
    23         extern unsigned char achHandleStates[MAX_FILE_HANDLES/8];
    24 
    25         #define HSTATE_UNUSED       0x00    /* Handle not used (or OS/2). */
    26         #define HSTATE_OS2          0x00    /* OS/2 module filehandle. */
    27         #define HSTATE_OUR          0x01    /* Our module filehandle. */
    28         #define HSTATE_MASK         0xFE
    29         #define HSTATE_UMASK        0x01
    30 
    31         #define GetState(a)         (HSTATE_UMASK & (achHandleStates[(a)/8] >> ((a)%8)))
    32         #define SetState(a,b)       (achHandleStates[(a)/8] = (achHandleStates[(a)/8] & (HSTATE_MASK << ((a)%8) | HSTATE_MASK >> 8-((a)%8)) | ((b) & 0x1) << ((a)%8)))
    33 
    34 
    35         /*
    36          * Module struct.
    37          */
    38         typedef struct _Module
    39         {
    40             AVLNODECORE     coreKey;    /* Key is hFile. */
    41             AVLNODECORE     coreMTE;    /* Key is pMTE. */
    42 
    43             SFN             hFile;      /* System file number or file handle if you prefer that. */
    44             PMTE            pMTE;       /* Pointer to MTE if we got one - NULL is allowed. */
    45 
    46             ULONG           fFlags;     /* Flags. Flags if coreMte is in use and what Data contains. */
    47             union
    48             {
    49                 ModuleBase *pModule;    /* Pointer to a Pe2Lx object. (Win32 executables) */
    50                 #if defined(_PE2LX_H_)
    51                 Pe2Lx *     pPe2Lx;     /* Pointer to a Pe2Lx object. (Win32 executables) */
    52                 #endif
    53                 #if defined(_ELF2LX_H_)
    54                 Elf2Lx *    pElf2Lx;    /* Pointer to a Elf2Lx object. (ELF executables) */
    55                 #endif
    56                 #if defined(_SCRIPT_H_)
    57                 Script *    pScript;    /* Pointer to a Script object. (Shell scripts) */
    58                 #endif
    59                 #if defined(_PE_H_)
    60                 Pe *        pPe;        /* Pointer to a Pe object. (Ring3 loader) */
    61                 #endif
    62             } Data;                     /* Pointer to data. Currently it's allways a Pe2Lx object! */
    63         } MODULE, *PMODULE;
    64 
    65         #define MOD_FLAGS_IN_MTETREE    0x00000010UL /* The node is present in the MTE-tree. */
    66         #define MOD_TYPE_MASK           0x0000000FUL /* Type mask. */
    67         #define MOD_TYPE_PE2LX          0x00000001UL /* Pe2Lx module. */
    68         #define MOD_TYPE_ELF2LX         0x00000002UL /* Elf2Lx module. */
    69         #define MOD_TYPE_SCRIPT         0x00000003UL /* Script module. */
    70         #define MOD_TYPE_PE             0x00000004UL /* Pe module. */
    71 
    72 
    73         /*
    74          * Modules operations.
    75          */
    76         PMODULE     getModuleBySFN(SFN hFile);
    77         PMODULE     getModuleByMTE(PMTE pMTE);
    78         PMODULE     getModuleByFilename(PCSZ pszFilename);
    79 
    80         ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, ModuleBase *pModObj);
    81         ULONG       removeModule(SFN hFile);
    82 
    83     #endif
    84 
    85     /*************/
    86     /* functions */
    87     /*************/
    88     #ifdef __cplusplus
    89     extern "C" {
    90     #endif
    91 
    92     ULONG ldrInit(void);
    93 
    94     #ifdef __cplusplus
     14
     15#ifdef __cplusplus
     16extern "C" {
     17#endif
     18
     19
     20#ifndef LDR_INCL_INITONLY
     21
     22/*
     23 * Fail if dependent header files is missing
     24 */
     25#ifndef _AVL_H_
     26#error "You'll have to include avl.h before ldr.h!"
     27#endif
     28
     29
     30/** @design
     31 * Loader State.
     32 *
     33 * Used to determin behaviour in different cases.
     34 * Use the isLdrState<State> macros to query current state.
     35 * IMPORTANT! Don't change this variable if you don't really mean it!
     36 *            And only change it thru the setLdrState* macros!
     37 *
     38 * The state is changing as follows:
     39 *    1) Load a new program
     40 *      mytkExecPgm will set the state to LDRSTATE_TKEXECPGM on successful overloading.
     41 *          myldrOpenPath will set the type part of the loaderbits. (EXE,DLL or UNSUPPORTED)
     42 *          (NB! myldrOpenPath is called several times. First for the EXE then for imported modules.)
     43 *              IF executable THEN myLdrOpen might set the LDRSTATE_OUR flag.
     44 *          myldrOpenPath will reset the type part of the loaderbits upon return.
     45 *      mytkExecPgm resets the state to LDRSTATE_UNKNOWN upon return.
     46 *
     47 *    2) Query program type.
     48 *      myLDRQAppType will set the state to LDRSTATE_LDRQAPPTYPE on entry.
     49 *          myldrOpenPath will set the type part of the loaderbits. (EXE,DLL or UNSUPPORTED)
     50 *          (NB! myldrOpenPath may be called several times.)
     51 *              IF executable THEN myLdrOpen might set the LDRSTATE_OUR flag.
     52 *          myldrOpenPath will reset the type part of the loaderbits upon return.
     53 *      myLDRQAppType resets the state to LDRSTATE_UNKNOWN upon return.
     54 *
     55 *    3) Unknown invocation - probably DosLoadModule. Base state is LDRSTATE_UNKNOWN.
     56 *          myldrOpenPath will set the type part of the loaderbits. (EXE,DLL or UNSUPPORTED)
     57 *          (NB! myldrOpenPath is probably called several times. Import modules.)
     58 *          myldrOpenPath will reset the type part of the loaderbits upon return.
     59 *
     60 */
     61extern ULONG    ulLdrState;
     62
     63#define LDRSTATE_UNKNOWN        0       /* Default state - undertermined. */
     64#define LDRSTATE_TKEXECPGM      1       /* A program is being loaded. */
     65#define LDRSTATE_LDRQAPPTYPE    2       /* Loader called from LDRQAPPTYPE */
     66/*#define LDRSTATE_LOADMODULE     3 */  /* A module is being loaded by DosLoadModule. Not implemented! */
     67#define LDRSTATE_MASK           0x00FF  /* State mask. */
     68
     69/*
     70 * The following flags are only valid when myldrOpenPath is on the stack!, ie. in ldrOpen.
     71 * These flags is the "loading-bits".
     72 */
     73#define LDRSTATE_EXE            0x0100  /* Flags telling that an executable is being opened. */
     74#define LDRSTATE_DLL            0x0200  /* Flags telling that an dll is being opened. */
     75#define LDRSTATE_UNSUPPORTED    0x0300  /* Flags telling to not override this open call. */
     76#define LDRSTATE_TYPE_MASK      0x0f00  /* Load Type Mask. */
     77/* The following flag will tell us if the executable which is loading is ours or not. */
     78#define LDRSTATE_OUREXE         0x1000
     79#define LDRSTATE_LOADERBITS     0xff00  /* Mask */
     80
     81
     82/*
     83 * Query macros.
     84 */
     85#define isLdrStateUnknown()             ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_UNKNOWN)
     86#define isLdrStateExecPgm()             ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_TKEXECPGM)
     87#define isLdrStateQAppType()            ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_LDRQAPPTYPE)
     88/*#define isLdrStateLoadModule()        ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_LOADMODULE)*/
     89
     90#define isLdrStateLoadingEXE()          ((ulLdrState & LDRSTATE_TYPE_MASK) == LDRSTATE_EXE)
     91#define isLdrStateLoadingDLL()          ((ulLdrState & LDRSTATE_TYPE_MASK) == LDRSTATE_DLL)
     92#define isLdrStateLoadingUnsupported()  ((ulLdrState & LDRSTATE_TYPE_MASK) == LDRSTATE_UNSUPPORTED)
     93
     94#define isLdrStateLoadingOurEXE()       (ulLdrState & LDRSTATE_OUREXE)
     95
     96
     97/*
     98 * Set macros.
     99 */
     100#define setLdrStateQAppType()           ulLdrState = LDRSTATE_LDRQAPPTYPE
     101#define setLdrStateUnknown()            ulLdrState = LDRSTATE_UNKNOWN
     102/*      setLdrStateExecPgm() isn't needed as this is in assembly source! */
     103/*#define setLdrStateLoadModule()         ulLdrState = LDRSTATE_LOADMODULE */
     104
     105#define setLdrStateLoadingEXE()         ulLdrState = (ulLdrState & (ULONG)(~LDRSTATE_TYPE_MASK)) | LDRSTATE_EXE
     106#define setLdrStateLoadingDLL()         ulLdrState = (ulLdrState & (ULONG)(~LDRSTATE_TYPE_MASK)) | LDRSTATE_DLL
     107#define setLdrStateLoadingUnsupported() ulLdrState = (ulLdrState & (ULONG)(~LDRSTATE_TYPE_MASK)) | LDRSTATE_UNSUPPORTED
     108#define setLdrStateClearLoadingType()   ulLdrState &= (ULONG)(~LDRSTATE_TYPE_MASK)
     109
     110#define setLdrStateLoadingOurEXE()      ulLdrState |= LDRSTATE_OUREXE
     111
     112
     113/*
     114 * Loader State assert macros.
     115 */
     116#define ASSERT_LdrStateUnknown(fn)      ASSERT_LdrState(fn, LDRSTATE_UNKNOWN)
     117#define ASSERT_LdrStateExecPgm(fn)      ASSERT_LdrState(fn, LDRSTATE_TKEXECPGM)
     118#define ASSERT_LdrStateQAppType(fn)     ASSERT_LdrState(fn, LDRSTATE_LDRQAPPTYPE)
     119
     120#define ASSERT_LdrState(fn, state) \
     121    {                              \
     122        if ((ulLdrState & LDRSTATE_MASK) != (state)) \
     123        {                          \
     124            kprintf((fn ": assertion incorrect loader state. ulLdrState (%d) != " #state "(%d)", \
     125                     ulLdrState, state)); \
     126        }                          \
    95127    }
    96     #endif
    97 
    98     #pragma pack()
    99 
    100 #endif
     128
     129
     130/*
     131 * handle state - Array of handle states. Eight state per byte!
     132 */
     133#define MAX_FILE_HANDLES 0x10000
     134
     135extern unsigned char achHandleStates[MAX_FILE_HANDLES/8];
     136
     137#define HSTATE_UNUSED       0x00    /* Handle not used (or OS/2). */
     138#define HSTATE_OS2          0x00    /* OS/2 module filehandle. */
     139#define HSTATE_OUR          0x01    /* Our module filehandle. */
     140#define HSTATE_MASK         0xFE
     141#define HSTATE_UMASK        0x01
     142
     143#define GetState(a)         (HSTATE_UMASK & (achHandleStates[(a)/8] >> ((a)%8)))
     144#define SetState(a,b)       (achHandleStates[(a)/8] = (achHandleStates[(a)/8] & (HSTATE_MASK << ((a)%8) | HSTATE_MASK >> 8-((a)%8)) | ((b) & 0x1) << ((a)%8)))
     145
     146
     147/*
     148 * Declare the module classes used below in case they aren't declared yet.
     149 */
     150class ModuleBase;
     151class Pe2Lx;
     152class Elf2Lx;
     153
     154
     155/*
     156 * Module struct.
     157 */
     158typedef struct _Module
     159{
     160    AVLNODECORE     coreKey;    /* Key is hFile. */
     161    AVLNODECORE     coreMTE;    /* Key is pMTE. */
     162
     163    SFN             hFile;      /* System file number or file handle if you prefer that. */
     164    PMTE            pMTE;       /* Pointer to MTE if we got one - NULL is allowed. */
     165
     166    ULONG           fFlags;     /* Flags. Flags if coreMte is in use and what Data contains. */
     167    union
     168    {
     169        ModuleBase *pModule;    /* Pointer to base module. */
     170        Pe2Lx *     pPe2Lx;     /* Pointer to a Pe2Lx object. (Win32 executables) */
     171        Elf2Lx *    pElf2Lx;    /* Pointer to a Elf2Lx object. (ELF executables) */
     172        #if 0
     173        Script *    pScript;    /* Pointer to a Script object. (Shell scripts) */
     174        Pe *        pPe;        /* Pointer to a Pe object. (Ring3 loader) */
     175        #endif
     176    } Data;                     /* Pointer to data. Currently it's allways a Pe2Lx object! */
     177} MODULE, *PMODULE;
     178
     179#define MOD_FLAGS_IN_MTETREE    0x00000010UL /* The node is present in the MTE-tree. */
     180#define MOD_TYPE_MASK           0x0000000FUL /* Type mask. */
     181#define MOD_TYPE_PE2LX          0x00000001UL /* Pe2Lx module. */
     182#define MOD_TYPE_ELF2LX         0x00000002UL /* Elf2Lx module. */
     183#define MOD_TYPE_SCRIPT         0x00000003UL /* Script module. */
     184#define MOD_TYPE_PE             0x00000004UL /* Pe module. */
     185
     186
     187/*
     188 * Pointer to the currently loading executable module.
     189 * Available at tkExecPgm time when loading a converted module.
     190 */
     191extern PMODULE pExeModule;
     192
     193
     194/*
     195 * Modules operations.
     196 */
     197PMODULE     getModuleBySFN(SFN hFile);
     198PMODULE     getModuleByMTE(PMTE pMTE);
     199PMODULE     getModuleByhMTE(HMTE hMTE);
     200PMODULE     getModuleByFilename(PCSZ pszFilename);
     201
     202ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, ModuleBase *pModObj);
     203ULONG       removeModule(SFN hFile);
     204
     205
     206
     207/*
     208 * mytkExecPgm variables and functions
     209 *
     210 * (See ldr\mytkExecPgm.asm for further info on these variabels and functions.)
     211 */
     212#define CCHFILENAME     261             /* This is defined in mytkExecPgm.asm too. */
     213#define CCHARGUMENTS   1536             /* This is defined in mytkExecPgm.asm too. */
     214extern const char   fTkExecPgm;
     215extern char         achTkExecPgmFilename[CCHFILENAME];
     216extern char         achTkExecPgmArguments[CCHARGUMENTS];
     217#endif
     218ULONG _Optlink  tkExecPgmEnvLength(void);
     219ULONG _Optlink  tkExecPgmCopyEnv(char *pachBuffer, unsigned cchBuffer);
     220
     221
     222
     223/*
     224 * functions
     225 */
     226ULONG ldrInit(void);
     227
     228#ifdef __cplusplus
     229}
     230#endif
     231
     232#pragma pack()
     233
     234#endif
  • branches/GRACE/src/win32k/include/myExecPgm.h

    r2828 r3834  
    1 /* $Id: myExecPgm.h,v 1.1 2000-02-19 08:41:10 bird Exp $
     1/* $Id: myExecPgm.h,v 1.1.4.1 2000-07-16 22:43:31 bird Exp $
    22 *
    33 * Desclarations for buffer.asm and mytkExecPgm.
     
    1212#define _myExecPgm_h_
    1313
    14 /*******************************************************************************
    15 *   Defined Constants And Macros                                               *
    16 *******************************************************************************/
    17 #define CB_BUFFER   1536                /* This is to be updated in the files buffer.asm and tkExecPgm too! */
    18 #define CCH_FILENAME 261                /* This is to be updated in the files buffer.asm and tkExecPgm too! */
    19 
    20 
    21 /*******************************************************************************
    22 *   Structures and Typedefs                                                    *
    23 *******************************************************************************/
    24 #pragma pack(1)
    25 typedef struct _EXECPGMBUFFER
    26 {
    27     char szFilename[CCH_FILENAME];          /* Executable filename. */
    28     char achArgs[CB_BUFFER - CCH_FILENAME]; /* collection of ASCIIZ which ends with an empty string */
    29 } EXECPGMBUFFER, *PEXECPGMBUFFER;
    30 #pragma pack()
    31 
    32 
    33 /*******************************************************************************
    34 *   Functions Prototypes                                                       *
    35 *******************************************************************************/
    36 PEXECPGMBUFFER _Optlink QueryBufferPointerFromFilename(const char *pszFilename);
     14/* obsolete */
    3715
    3816#endif
  • branches/GRACE/src/win32k/include/options.h

    r2898 r3834  
    1 /* $Id: options.h,v 1.10 2000-02-25 18:15:06 bird Exp $
     1/* $Id: options.h,v 1.10.4.1 2000-07-16 22:43:32 bird Exp $
    22 *
    33 * Options.
     
    1616*******************************************************************************/
    1717/* fKernel */
    18 #define KF_UNI              0x00000000UL
    19 #define KF_SMP              0x00000001UL
     18#define KF_UNI              0x0000
     19#define KF_SMP              0x0001
     20#define KF_W4               0x0002
     21#define KF_DEBUG            0x1000
     22#define KF_HAS_DEBUGTYPE    0x2000
     23#define KF_ALLSTRICT        0x3000
     24#define KF_HALFSTRICT       0x7000
    2025
    2126/* fPE */
     
    3338
    3439/* default heapsizes */
    35 #define CB_SWP_INIT         (1024*512)      /* 512KB */
    36 #define CB_SWP_MAX          (1024*1024*16)  /*  16MB  */
    37 #define CB_RES_INIT         (1024*256)      /* 256KB */
    38 #define CB_RES_MAX          (1024*1024*10)  /*  10MB  */
     40#define CB_SWP_INIT         ((unsigned long)1024*512)      /* 512KB */
     41#define CB_SWP_MAX          ((unsigned long)1024*1024*16)  /*  16MB  */
     42#define CB_RES_INIT         ((unsigned long)1024*256)      /* 256KB */
     43#define CB_RES_MAX          ((unsigned long)1024*1024*10)  /*  10MB  */
    3944
    4045/* default assignments */
     
    5055            INFOLEVEL_QUIET,        /* ulInfoLevel   */     \
    5156            FALSE,                  /* fElf          */     \
    52             TRUE,                   /* fScript       */     \
     57            TRUE,                   /* fUNIXScript   */     \
     58            TRUE,                   /* fREXXScript   */     \
     59            TRUE,                   /* fJava         */     \
    5360            FALSE,                  /* fNoLoader     */     \
    5461            CB_SWP_INIT,            /* cbSwpHeapInit */     \
     
    5764            CB_RES_MAX}             /* cbResHeapMax  */
    5865
     66#define isAnyLoaderEnabled()        (!options.fNoLoader && \
     67                                    (isPELoaderEnabled() || isELFEnabled() || isUNIXScriptEnabled() || isREXXScriptEnabled() || isJAVAEnabled()))
     68#define isPELoaderEnabled()         (options.fPE != FLAGS_PE_NOT)
     69#define isPELoaderDisabled()        (options.fPE == FLAGS_PE_NOT)
     70#define isPe2LxLoaderEnabled()      (options.fPE == FLAGS_PE_PE2LX)
     71#define isMixedPeLoaderEnabled()    (options.fPE == FLAGS_PE_MIXED)
     72
     73#define isELFDisabled()             (!options.fElf)
     74#define isELFEnabled()              (options.fElf)
     75#define isUNIXScriptDisabled()      (!options.fUNIXScript)
     76#define isUNIXScriptEnabled()       (options.fUNIXScript)
     77#define isREXXScriptDisabled()      (!options.fREXXScript)
     78#define isREXXScriptEnabled()       (options.fREXXScript)
     79#define isJAVADisabled()            (!options.fJava)
     80#define isJAVAEnabled()             (options.fJava)
     81
     82#define isSMPKernel()               (options.fKernel & KF_SMP)
     83#define isUNIKernel()               !(options.fKernel & KF_SMP)
    5984
    6085
     
    86111    ULONG       fElf;                   /* Elf flags. */
    87112
    88     /** @cat Options affecting the script executables */
    89     ULONG       fScript;                /* Script flags. */
     113    /** @cat Options affecting the UNIX script executables */
     114    ULONG       fUNIXScript;            /* UNIX script flags. */
    90115
    91     /** @cat Options affecting the script executables */
    92     ULONG       fNoLoader;              /* No loader stuff. */
     116    /** @cat Options affecting the REXX script executables */
     117    ULONG       fREXXScript;            /* REXX script flags. */
     118
     119    /** @cat Options affecting the JAVA executables */
     120    ULONG       fJava;                  /* Java flags. */
     121
     122    /** @cat Options affecting the  executables */
     123    ULONG       fNoLoader;              /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */
    93124
    94125    /** @cat Options affecting the heap. */
  • branches/GRACE/src/win32k/include/pe2lx.h

    r2925 r3834  
    1 /* $Id: pe2lx.h,v 1.9 2000-02-27 02:16:43 bird Exp $
     1/* $Id: pe2lx.h,v 1.9.4.1 2000-07-16 22:43:32 bird Exp $
    22 *
    33 * Pe2Lx class declarations. Ring 0 and Ring 3
     
    6666    ULONG  applyFixups(PMTE pMTE, ULONG iObject, ULONG iPageTable, PVOID pvPage,
    6767                       ULONG ulPageAddress, PVOID pvPTDA); /*(ldrEnum32bitRelRecs)*/
     68    ULONG  openPath(PCHAR pachModname, USHORT cchModname, ldrlv_t *pLdrLv, PULONG pfl); /* (ldrOpenPath) */
    6869    #ifndef RING0
    6970    ULONG  testApplyFixups();
    7071    ULONG  writeFile(PCSZ pszLXFilename);
    7172    #endif
     73
     74    /** @cat public query methods */
     75    BOOL    isExe();
     76    BOOL    isDll();
    7277
    7378    /** @cat public Helper methods */
     
    120125    /** @cat static helpers */
    121126    static PCSZ queryOdin32ModuleName(PCSZ pszWin32ModuleName);
     127    static BOOL initOdin32Path();
    122128
    123129    /** @cat static dump methods */
     
    195201        ULONG flFlags;                      /* equivalent object flags */
    196202    } paSecChars2Flags[];
     203
     204    static const char *     pszOdin32Path;  /* Odin32 base path. */
    197205};
    198206
  • branches/GRACE/src/win32k/include/probkrnl.h

    r3411 r3834  
    1 /* $Id: probkrnl.h,v 1.13 2000-04-17 01:56:49 bird Exp $
     1/* $Id: probkrnl.h,v 1.13.4.1 2000-07-16 22:43:33 bird Exp $
    22 *
    33 * Include file for ProbKrnl.
     
    1616*   Defined Constants And Macros                                               *
    1717*******************************************************************************/
    18 #define NBR_OF_KRNLIMPORTS      18      /* When this is changed make sure to   */
     18#define NBR_OF_KRNLIMPORTS      30      /* When this is changed make sure to   */
    1919                                        /* update the arrays in d32init.c and  */
    2020                                        /* probkrnl.c */
     
    2525#define EPT_PROCIMPORT          0x01    /* procedure 32bit - import only */
    2626#define EPT_VARIMPORT           0x02    /* variable/non-procedure 32bit - not implemented yet */
    27 #define EPT_32BIT               0x00    /* 16 bit entry-point  */
    28 #define EPT_16BIT               0x80    /* 32 bit entry-point */
     27#define EPT_32BIT               0x00    /* 32 bit entry-point  */
     28#define EPT_16BIT               0x80    /* 16 bit entry-point */
    2929#define EPT_BIT_MASK            0x80    /* Mask bit entry-point */
    3030#define EPT16BitEntry(a)    (((a).fType & EPT_BIT_MASK) == EPT_16BIT)
     
    4141#define EPT_VARIMPORT16         (EPT_VARIMPORT | EPT_16BIT)
    4242
    43 /* Kernel type: SMP/UNI/W4 */
    44 #define TYPE_UNI                0       /* Any UNI processor kernel except Warp 4 fp13 and above. */
    45 #define TYPE_SMP                1       /* SMP Warp3 Adv. or Warp 4.5 SMP */
    46 #define TYPE_W4                 2       /* Warp4 fp13 and above. */
     43
     44/* Kernel type: SMP/UNI/W4 (flags matches KF_* in options.h)  */
     45#if 0
     46#define TYPE_UNI                0x00     /* Any UNI processor kernel except Warp 4 fp13 and above. */
     47#define TYPE_SMP                0x01     /* SMP Warp3 Adv. or Warp 4.5 SMP */
     48#define TYPE_W4                 0x02     /* Warp4 fp13 and above. */
     49#endif
     50
     51/*
     52 * Probkrnl error codes. (They all begin with ERROR_PROB_.)
     53 *
     54 * NOTE! ERROR_PROB_KRNL_*  <  ERROR_PROB_SYM_*  <  ERROR_PROB_SYMDB_*
     55 */
     56#define ERROR_PROB_BASE                             10000
     57#define ERROR_PROB_KRNL_FIRST                       ERROR_PROB_KRNL_OPEN_FAILED
     58#define ERROR_PROB_KRNL_LAST                        ERROR_PROB_KRNL_OTE_READ
     59#define ERROR_PROB_KRNL_OPEN_FAILED                 (ERROR_PROB_BASE + 0)
     60#define ERROR_PROB_KRNL_SEEK_SIZE                   (ERROR_PROB_BASE + 2)
     61#define ERROR_PROB_KRNL_SEEK_FIRST                  (ERROR_PROB_BASE + 3)
     62#define ERROR_PROB_KRNL_READ_FIRST                  (ERROR_PROB_BASE + 4)
     63#define ERROR_PROB_KRNL_READ_NEXT                   (ERROR_PROB_BASE + 5)
     64#define ERROR_PROB_KRNL_TAG_NOT_FOUND               (ERROR_PROB_BASE + 6)
     65#define ERROR_PROB_KRNL_INV_SIGANTURE               (ERROR_PROB_BASE + 7)
     66#define ERROR_PROB_KRNL_INV_BUILD_NBR               (ERROR_PROB_BASE + 8)
     67#define ERROR_PROB_KRNL_BUILD_VERSION               (ERROR_PROB_BASE + 9)
     68#define ERROR_PROB_KRNL_MZ_SEEK                     (ERROR_PROB_BASE + 10)
     69#define ERROR_PROB_KRNL_MZ_READ                     (ERROR_PROB_BASE + 11)
     70#define ERROR_PROB_KRNL_NEOFF_INVALID               (ERROR_PROB_BASE + 12)
     71#define ERROR_PROB_KRNL_NEOFF_SEEK                  (ERROR_PROB_BASE + 13)
     72#define ERROR_PROB_KRNL_LX_READ                     (ERROR_PROB_BASE + 14)
     73#define ERROR_PROB_KRNL_LX_SIGNATURE                (ERROR_PROB_BASE + 15)
     74#define ERROR_PROB_KRNL_OBJECT_CNT                  (ERROR_PROB_BASE + 16)
     75#define ERROR_PROB_KRNL_OBJECT_CNR_10               (ERROR_PROB_BASE + 17)
     76#define ERROR_PROB_KRNL_OTE_SEEK                    (ERROR_PROB_BASE + 18)
     77#define ERROR_PROB_KRNL_OTE_READ                    (ERROR_PROB_BASE + 19)
     78#define ERROR_PROB_KRNL_OTE_SIZE_MIS                (ERROR_PROB_BASE + 20)
     79
     80#define ERROR_PROB_SYM_FIRST                        ERROR_PROB_SYM_FILE_NOT_FOUND
     81#define ERROR_PROB_SYM_LAST                         ERROR_PROB_SYM_IMPORTS_NOTFOUND
     82#define ERROR_PROB_SYM_FILE_NOT_FOUND               (ERROR_PROB_BASE + 30)
     83#define ERROR_PROB_SYM_READERROR                    (ERROR_PROB_BASE + 31)
     84#define ERROR_PROB_SYM_INVALID_MOD_NAME             (ERROR_PROB_BASE + 32)
     85#define ERROR_PROB_SYM_SEGS_NE_OBJS                 (ERROR_PROB_BASE + 33)
     86#define ERROR_PROB_SYM_SEG_DEF_SEEK                 (ERROR_PROB_BASE + 34)
     87#define ERROR_PROB_SYM_SEG_DEF_READ                 (ERROR_PROB_BASE + 35)
     88/* - reserved for future errors - *
     89#define ERROR_PROB_SYM_                             (ERROR_PROB_BASE + 36)
     90#define ERROR_PROB_SYM_                             (ERROR_PROB_BASE + 37)
     91#define ERROR_PROB_SYM_                             (ERROR_PROB_BASE + 38) */
     92#define ERROR_PROB_SYM_IMPORTS_NOTFOUND             (ERROR_PROB_BASE + 39)
     93
     94#define ERROR_PROB_SYMDB_KRNL_NOT_FOUND             (ERROR_PROB_BASE + 40)
     95
    4796
    4897
     
    73122{
    74123    unsigned short usBuild;             /* Build number */
    75     unsigned char  fchBldType;          /* R, H, A */
    76     unsigned char  fchType;             /* TYPE_SMP, TYPE_UNI, TYPE_W4 */
     124    unsigned short fKernel;             /* Kernel flag (KF_* defines in options.h). */
    77125    unsigned char  cObjects;            /* Count of objects */
    78126    struct
     
    92140*******************************************************************************/
    93141extern IMPORTKRNLSYM _aImportTab[NBR_OF_KRNLIMPORTS]; /* 'aImportTab' in PrbKrnl.c */
    94 extern unsigned short int _usBuild;     /* 'ulBuild'         in PrbKrnl.c */
    95 extern unsigned short int _usVerMajor;  /* 'usVerMajor'      in PrbKrnl.c */
    96 extern unsigned short int _usVerMinor;  /* 'usVerMinor'      in PrbKrnl.c */
    97 extern KRNLDBENTRY aKrnlSymDB[];        /* defined in symdb.c (for 16-bit usage) */
    98 extern KRNLDBENTRY _aKrnlSymDB[];       /* defined in symdb.c (for 32-bit usage) */
    99 
     142extern KRNLDBENTRY   aKrnlSymDB[];      /* defined in symdb.c (for 16-bit usage) */
     143extern KRNLDBENTRY   _aKrnlSymDB[];     /* defined in symdb.c (for 32-bit usage) */
    100144
    101145#if defined(INCL_16) && defined(MAX_DISKDD_CMD) /* 16-bit only */
Note: See TracChangeset for help on using the changeset viewer.