| 1 | /* $Id: kFileLX.h,v 1.5 2001-04-17 00:26:11 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * kFileLX - Linear Executable file reader.
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
|---|
| 6 | *
|
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | #ifndef _kFileLX_h_
|
|---|
| 12 | #define _kFileLX_h_
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | class kFileLX : public kFileFormatBase, public kExecutableI /*, public kPageI*/
|
|---|
| 18 | {
|
|---|
| 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 | public:
|
|---|
| 30 | kFileLX(const char *pszFilename) throw (int);
|
|---|
| 31 | kFileLX(kFile *pFile) throw (int);
|
|---|
| 32 | ~kFileLX();
|
|---|
| 33 |
|
|---|
| 34 | /** @cat Module information methods. */
|
|---|
| 35 | BOOL moduleGetName(char *pszBuffer, int cchSize = 260);
|
|---|
| 36 |
|
|---|
| 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;};
|
|---|
| 47 |
|
|---|
| 48 | struct o32_obj * getObject(int iObject);
|
|---|
| 49 | int getObjectCount();
|
|---|
| 50 |
|
|---|
| 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);
|
|---|
| 57 |
|
|---|
| 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);
|
|---|
| 62 |
|
|---|
| 63 | /** @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);
|
|---|
| 68 | #endif
|
|---|
| 69 | };
|
|---|
| 70 | #endif
|
|---|