| 1 | /* $Id: kFileFormatBase.h,v 1.3 2000-08-31 03:00:13 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 | /**
|
|---|
| 27 | * ExportEntry used by the findFirstExport/findNextExport functions
|
|---|
| 28 | */
|
|---|
| 29 | typedef struct _ExportEntry
|
|---|
| 30 | {
|
|---|
| 31 | unsigned long ulOrdinal;
|
|---|
| 32 | char achName[MAXEXPORTNAME];
|
|---|
| 33 | char achIntName[MAXEXPORTNAME]; /* not used by PEFile */
|
|---|
| 34 |
|
|---|
| 35 | /* these don't apply for .DEF files. (should have a flag for that...) */
|
|---|
| 36 | unsigned long offset;
|
|---|
| 37 | unsigned long iObject;
|
|---|
| 38 |
|
|---|
| 39 | /* internal - do not use! */
|
|---|
| 40 | void *pv;
|
|---|
| 41 | } EXPORTENTRY, *PEXPORTENTRY;
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | /**
|
|---|
| 45 | * Base class for file formats.
|
|---|
| 46 | * @author knut st. osmundsen
|
|---|
| 47 | */
|
|---|
| 48 | class kFileFormatBase
|
|---|
| 49 | {
|
|---|
| 50 | public:
|
|---|
| 51 | virtual BOOL queryModuleName(char *pszBuffer) = 0;
|
|---|
| 52 | virtual BOOL findFirstExport(PEXPORTENTRY pExport) = 0;
|
|---|
| 53 | virtual BOOL findNextExport(PEXPORTENTRY pExport) = 0;
|
|---|
| 54 | virtual BOOL isDef() const { return FALSE;}
|
|---|
| 55 | virtual BOOL isPe() const { return FALSE;}
|
|---|
| 56 | virtual BOOL isLx() const { return FALSE;}
|
|---|
| 57 |
|
|---|
| 58 | static void * readfile(const char *pszFilename);
|
|---|
| 59 | };
|
|---|
| 60 |
|
|---|
| 61 | #pragma pack()
|
|---|
| 62 |
|
|---|
| 63 | #endif
|
|---|