| 1 | /* $Id: kFileFormatBase.h,v 1.4 2000-10-02 04:01:39 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * kFileFormatBase - Base class for kFile<format> classes. | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 1999-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 _kFileFormat_h_ | 
|---|
| 12 | #define _kFileFormat_h_ | 
|---|
| 13 |  | 
|---|
| 14 | /****************************************************************************** | 
|---|
| 15 | *   Defined Constants                                                         * | 
|---|
| 16 | ******************************************************************************/ | 
|---|
| 17 | #define MAXEXPORTNAME 256 | 
|---|
| 18 | #define ORD_START_INTERNAL_FUNCTIONS 1200 | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | /****************************************************************************** | 
|---|
| 22 | *   Structures and Typedefs                                                   * | 
|---|
| 23 | ******************************************************************************/ | 
|---|
| 24 | #pragma pack(4) | 
|---|
| 25 |  | 
|---|
| 26 | class kFile; | 
|---|
| 27 |  | 
|---|
| 28 | /** | 
|---|
| 29 | * ExportEntry used by the findFirstExport/findNextExport functions | 
|---|
| 30 | */ | 
|---|
| 31 | typedef struct _ExportEntry | 
|---|
| 32 | { | 
|---|
| 33 | unsigned long   ulOrdinal; | 
|---|
| 34 | char            achName[MAXEXPORTNAME]; | 
|---|
| 35 | char            achIntName[MAXEXPORTNAME]; /* not used by PEFile */ | 
|---|
| 36 |  | 
|---|
| 37 | /* these don't apply for .DEF files. (should have a flag for that...) */ | 
|---|
| 38 | unsigned long   offset; | 
|---|
| 39 | unsigned long   iObject; | 
|---|
| 40 |  | 
|---|
| 41 | /* internal - do not use! */ | 
|---|
| 42 | void          *pv; | 
|---|
| 43 | } EXPORTENTRY, *PEXPORTENTRY; | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 | /** | 
|---|
| 47 | * Base class for file formats. | 
|---|
| 48 | * @author      knut st. osmundsen | 
|---|
| 49 | */ | 
|---|
| 50 | class kFileFormatBase | 
|---|
| 51 | { | 
|---|
| 52 | public: | 
|---|
| 53 | virtual BOOL  queryModuleName(char *pszBuffer) = 0; | 
|---|
| 54 | virtual BOOL  findFirstExport(PEXPORTENTRY pExport) = 0; | 
|---|
| 55 | virtual BOOL  findNextExport(PEXPORTENTRY pExport)  = 0; | 
|---|
| 56 | virtual BOOL  isDef() const { return FALSE;} | 
|---|
| 57 | virtual BOOL  isPe() const  { return FALSE;} | 
|---|
| 58 | virtual BOOL  isLx() const  { return FALSE;} | 
|---|
| 59 |  | 
|---|
| 60 | static void * readfile(const char *pszFilename); | 
|---|
| 61 | virtual BOOL  dump(kFile *pOut); | 
|---|
| 62 | }; | 
|---|
| 63 |  | 
|---|
| 64 | #pragma pack() | 
|---|
| 65 |  | 
|---|
| 66 | #endif | 
|---|