Changeset 8003 for trunk/tools/common/kFileLX.h
- Timestamp:
- Feb 24, 2002, 3:47:28 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/common/kFileLX.h
r5531 r8003 1 /* $Id: kFileLX.h,v 1. 5 2001-04-17 00:26:11bird Exp $1 /* $Id: kFileLX.h,v 1.6 2002-02-24 02:47:26 bird Exp $ 2 2 * 3 3 * kFileLX - Linear Executable file reader. … … 12 12 #define _kFileLX_h_ 13 13 14 struct e32_exe; 15 struct o32_obj; 16 struct o32_map; 14 17 15 18 16 17 class kFileLX : public kFileFormatBase, public kExecutableI /*, public kPageI*/ 19 class kFileLX : public kFileFormatBase, public kExecutableI, public kPageI, public kRelocI 18 20 { 19 protected:20 PVOID pvBase; /* Pointer to filemapping. */21 ULONG cbFile; /* Size of filemapping. */22 ULONG offLXHdr; /* Offset of the LX header. */23 struct e32_exe * pe32; /* Pointer to the exe header within the filemapping. */24 struct o32_obj * paObject; /* Pointer to the objecttable. */25 struct o32_map * paMap; /* Pointer to page map table. */26 27 BOOL queryExportName(int iOrdinal, char *pszBuffer);28 29 21 public: 30 kFileLX(const char *pszFilename) throw ( int);31 kFileLX(kFile *pFile) throw ( int);22 kFileLX(const char *pszFilename) throw (kError); 23 kFileLX(kFile *pFile) throw (kError); 32 24 ~kFileLX(); 33 25 34 26 /** @cat Module information methods. */ 35 BOOLmoduleGetName(char *pszBuffer, int cchSize = 260);27 KBOOL moduleGetName(char *pszBuffer, int cchSize = 260); 36 28 37 /** @cat Export enumeration methods. */ 38 BOOL exportFindFirst(kExportEntry *pExport); 39 BOOL exportFindNext(kExportEntry *pExport); 40 void exportFindClose(kExportEntry *pExport); 41 42 /** @cat Export Lookup methods */ 43 BOOL exportLookup(unsigned long ulOrdinal, kExportEntry *pExport); 44 BOOL exportLookup(const char * pszName, kExportEntry *pExport); 45 46 virtual BOOL isLx() const {return TRUE;}; 29 /** @cat Misc */ 30 virtual KBOOL isLx() const {return TRUE;}; 47 31 48 32 struct o32_obj * getObject(int iObject); 49 33 int getObjectCount(); 50 34 51 #if 0 52 /** @cat Get and put page methods. (the first ones are generic) */ 53 BOOL getPage(char *pachPage, ULONG ulAddress); 54 BOOL getPage(char *pachPage, int iObject, int offObject); 55 BOOL putPage(const char *pachPage, ULONG ulAddress); 56 BOOL putPage(const char *pachPage, int iObject, int offObject); 35 /** @cat Export enumeration methods. */ 36 KBOOL exportFindFirst(kExportEntry *pExport); 37 KBOOL exportFindNext(kExportEntry *pExport); 38 void exportFindClose(kExportEntry *pExport); 57 39 58 BOOL getPageLX(char *pachPage, int iObject, int iPage); 59 BOOL getPageLX(char *pachPage, int iPage); 60 BOOL putPageLX(const char *pachPage, int iObject, int iPage); 61 BOOL putPageLX(const char *pachPage, int iPage); 40 /** @cat Export Lookup methods */ 41 KBOOL exportLookup(unsigned long ulOrdinal, kExportEntry *pExport); 42 KBOOL exportLookup(const char * pszName, kExportEntry *pExport); 43 44 /** @cat Get and put page methods. */ 45 int pageGet(char *pachPage, unsigned long ulAddress) const; 46 int pageGet(char *pachPage, int iObject, int offObject) const; 47 int pagePut(const char *pachPage, unsigned long ulAddress); 48 int pagePut(const char *pachPage, int iObject, int offObject); 49 int pageGetPageSize() const; 62 50 63 51 /** @cat Compression and expansion methods compatible with exepack:1 and exepack:2. */ 64 static BOOL expandPage1(char *pachPage, const char * pachSrcPage, int cchSrcPage); 65 static BOOL expandPage2(char *pachPage, const char * pachSrcPage, int cchSrcPage); 66 static int compressPage1(char *pachPage, const char * pachSrcPage); 67 static int compressPage2(char *pachPage, const char * pachSrcPage); 52 static int expandPage1(char *pachPage, int cchPage, const char * pachSrcPage, int cchSrcPage); 53 static int expandPage2(char *pachPage, int cchPage, const char * pachSrcPage, int cchSrcPage); 54 static int compressPage1(char *pachPage, const char * pachSrcPage, int cchSrcPage); 55 static int compressPage2(char *pachPage, const char * pachSrcPage, int cchSrcPage); 56 57 /** @cat Relocation methods */ 58 KBOOL relocFindFirst(unsigned long iSegment, unsigned long offObject, kRelocEntry *preloc); 59 KBOOL relocFindFirst(unsigned long ulAddress, kRelocEntry *preloc); 60 KBOOL relocFindNext(kRelocEntry *preloc); 61 void relocFindClose(kRelocEntry *preloc); 62 63 64 protected: 65 /** @cat Internal data */ 66 void * pvBase; /* Pointer to filemapping. */ 67 unsigned long cbFile; /* Size of filemapping. */ 68 unsigned long offLXHdr; /* Offset of the LX header. */ 69 struct e32_exe * pe32; /* Pointer to the exe header within the filemapping. */ 70 struct o32_obj * paObject; /* Pointer to the objecttable. */ 71 struct o32_map * paMap; /* Pointer to page map table. */ 72 unsigned long * paulFixupPageTable; /* Pointer to the fixup page table. */ 73 char * pchFixupRecs; /* Pointer to the fixup record table. */ 74 75 /** @cat Export and Module information worker. */ 76 KBOOL queryExportName(int iOrdinal, char *pszBuffer); 77 78 /** @cat Get and put page workers. */ 79 /* 80 int pageGetLX(char *pachPage, int iObject, int iPage) const; 81 int pageGetLX(char *pachPage, int iPage) const; 82 int pagePutLX(const char *pachPage, int iObject, int iPage); 83 int pagePutLX(const char *pachPage, int iPage); 84 */ 85 86 /** @cat Address mapping helpers. */ 87 unsigned long lxAddressToObjectOffset(unsigned long ulAddress, unsigned long * pulObject) const; 88 unsigned long lxSpecialSelectorToObjectOffset(unsigned long offObject, unsigned long * pulObject) const; 89 KBOOL lxValidateObjectOffset(unsigned long ulObject, unsigned long offOffset) const; 90 KBOOL lxValidateAddress(unsigned long ulAddress) const; 91 92 /** @cat Import Helpers */ 93 char * lxGetImportModuleName(unsigned long ordModule) const; 94 char * lxGetImportProcName(unsigned long offProc) const; 95 }; 96 68 97 #endif 69 };70 #endif
Note:
See TracChangeset
for help on using the changeset viewer.