Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
4.8 KiB

  1. // LELDR.H
  2. //
  3. // (C) Copyright Microsoft Corp., 1988-1994
  4. //
  5. // Header file for the PE Loader
  6. //
  7. // Origin: Dos Extender
  8. //
  9. // Change history:
  10. //
  11. // Date Who Description
  12. // --------- --------- -------------------------------------------------
  13. // 3-Dec-90 GeneA Created
  14. // 15-Feb-94 JonT Code cleanup and precompiled headers
  15. /************************************************************************/
  16. /* ------------------------------------------------------------ */
  17. /* Loader Data Structures */
  18. /* ------------------------------------------------------------ */
  19. /* Module table flag definitions.
  20. */
  21. #define fModInUse 0x80000000
  22. //#define fModImports 0x00000001 /* module imports have been done */
  23. #define fModReloc 0x00000002 /* module not at default RVA */
  24. #define fModMaster 0x00000004 /* has clone data in another MTE */
  25. #define fTellGDI 0x00000008 /* notify GDI when it goes away */
  26. #define fModPreload 0x00000010 /* loaded from floppy, preload it */
  27. #define fModNoClone 0x00000020 /* we have renamed this running module, don't clone in other process */
  28. typedef struct _tagMTE {
  29. WORD flFlags; // module status flags
  30. WORD usageShared; // number of copies in 16 bit/global mem arena
  31. LEH * plehMod; // pointer to LE Header for this module
  32. /*
  33. * CFH_ID struc in object.h
  34. */
  35. CFH_ID cfhid; // cfhid.szFilename and cfhid.fsAccessDos
  36. char * szName; // module name string (within szFileName)
  37. WORD iFileNameLen; // fast filename search
  38. WORD iNameLen; // fast name search
  39. DFH dfhFile; // handle of open file for paging
  40. DWORD NumberOfSections;// count of sections in object
  41. DWORD ** ppObjReloc; // pointer to table of pointers
  42. DWORD ImageBase; // desired image base
  43. WORD hModuleK16; // Kernel16 dummy hModule for this module
  44. WORD usage; // Number of processes module used in
  45. MODREF * plstPdb; // List of PDBs using this module
  46. char * szFileName83; // short name equ. of cfhid.lpFileName
  47. WORD iFileNameLen83; // "" length
  48. char * szName83; // short name w/o path
  49. WORD iNameLen83; // its length for quick exclusionary tests
  50. } MTE;
  51. extern MTE ** pmteModTable;
  52. extern IMTE imteMax;
  53. /* Error location structure. This is used by FMapErrorLoc to return
  54. ** information about the module in which a fault occured.
  55. */
  56. typedef struct _tagELS {
  57. WORD imte;
  58. DWORD iote;
  59. char * szFileName;
  60. DWORD offError;
  61. } ELS;
  62. #define SHARED_BASE_ADDRESS MINSHAREDLADDR /* Start of shared heap */
  63. /* ------------------------------------------------------------ */
  64. /* Procedure Declarations */
  65. /* ------------------------------------------------------------ */
  66. GLOBAL BOOL KERNENTRY FNotifyProgram(void);
  67. GLOBAL BOOL KERNENTRY ReserveStaticTLS(void);
  68. GLOBAL VOID KERNENTRY FreeUnusedModules(LST *plstProc);
  69. GLOBAL LEH * KERNENTRY PlehFromImte (IMTE imte);
  70. GLOBAL LEH * KERNENTRY PlehFromHLib(HANDLE hLib);
  71. GLOBAL WORD KERNENTRY GetHModK16FromHModK32(HANDLE hmod);
  72. GLOBAL VOID * KERNENTRY PvExportFromOrdinal (LEH *pleh, DWORD ord);
  73. GLOBAL VOID * KERNENTRY PvExportFromName (LEH *pleh, DWORD ipchHint,
  74. char *szName);
  75. GLOBAL VOID KERNENTRY NotifyThreadAttach(void);
  76. GLOBAL VOID KERNENTRY NotifyThreadDetach(void);
  77. GLOBAL VOID KERNENTRY DetachProcessModules(PDB *ppdb);
  78. GLOBAL VOID KERNENTRY RecycleProcessModules(PDB *ppdb);
  79. GLOBAL BOOL KERNENTRY FMapErrorLoc(VOID *pvErr, ELS *pels);
  80. GLOBAL VOID KERNENTRY DumpStackFrames(DWORD dwErrLoc, DWORD dwFrame);
  81. GLOBAL VOID KERNENTRY LogStackDump(DWORD dwErrLoc, DWORD dwFrame);
  82. #if DEBUG
  83. #define GrabDll() EnterSysLevel(&GetCurrentPdb()->crstLoadLock);
  84. #define GrabMod() EnterSysLevel(Krn32Lock);
  85. GLOBAL void KERNENTRY CheckDll(void);
  86. #define CheckMod() ConfirmSysLevel(Krn32Lock);
  87. #define CheckNotMod() CheckNotSysLevel(Krn32Lock);
  88. GLOBAL void KERNENTRY CheckDllOrMod(void);
  89. #else
  90. #define GrabDll() EnterSysLevel(&GetCurrentPdb()->crstLoadLock);
  91. #define GrabMod() EnterSysLevel(Krn32Lock);
  92. #define CheckDll()
  93. #define CheckMod()
  94. #define CheckNotMod()
  95. #define CheckDllOrMod()
  96. #endif
  97. #define ReleaseDll() LeaveSysLevel(&GetCurrentPdb()->crstLoadLock);
  98. #define ReleaseMod() LeaveSysLevel(Krn32Lock);
  99. /* ------------------------------------------------------------ */
  100. /* ------------------------------------------------------------ */
  101. /* ------------------------------------------------------------ */
  102. /* ------------------------------------------------------------ */
  103. /* ------------------------------------------------------------ */
  104. /* ------------------------------------------------------------ */
  105. /* ------------------------------------------------------------ */
  106. /* ------------------------------------------------------------ */
  107. /************************************************************************/