| 1 | /* $Id: kFileLX.h,v 1.3 2000-12-04 08:48:09 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 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);
|
|---|
| 31 | ~kFileLX();
|
|---|
| 32 |
|
|---|
| 33 | virtual BOOL queryModuleName(char *pszBuffer);
|
|---|
| 34 | virtual BOOL findFirstExport(PEXPORTENTRY pExport);
|
|---|
| 35 | virtual BOOL findNextExport(PEXPORTENTRY pExport);
|
|---|
| 36 | virtual BOOL isLx() const {return TRUE;};
|
|---|
| 37 |
|
|---|
| 38 | struct o32_obj * getObject(int iObject);
|
|---|
| 39 | int getObjectCount();
|
|---|
| 40 |
|
|---|
| 41 | #if 0
|
|---|
| 42 | /** @cat Get and put page methods. (the first ones are generic) */
|
|---|
| 43 | BOOL getPage(char *pachPage, ULONG ulAddress);
|
|---|
| 44 | BOOL getPage(char *pachPage, int iObject, int offObject);
|
|---|
| 45 | BOOL putPage(const char *pachPage, ULONG ulAddress);
|
|---|
| 46 | BOOL putPage(const char *pachPage, int iObject, int offObject);
|
|---|
| 47 |
|
|---|
| 48 | BOOL getPageLX(char *pachPage, int iObject, int iPage);
|
|---|
| 49 | BOOL getPageLX(char *pachPage, int iPage);
|
|---|
| 50 | BOOL putPageLX(const char *pachPage, int iObject, int iPage);
|
|---|
| 51 | BOOL putPageLX(const char *pachPage, int iPage);
|
|---|
| 52 |
|
|---|
| 53 | /** @cat Compression and expansion methods compatible with exepack:1 and exepack:2. */
|
|---|
| 54 | static BOOL expandPage1(char *pachPage, const char * pachSrcPage, int cchSrcPage);
|
|---|
| 55 | static BOOL expandPage2(char *pachPage, const char * pachSrcPage, int cchSrcPage);
|
|---|
| 56 | static int compressPage1(char *pachPage, const char * pachSrcPage);
|
|---|
| 57 | static int compressPage2(char *pachPage, const char * pachSrcPage);
|
|---|
| 58 | #endif
|
|---|
| 59 | };
|
|---|
| 60 | #endif
|
|---|