| [1843] | 1 | /* $Id: winimagepe2lx.h,v 1.4 1999-11-26 00:04:33 sandervl Exp $ */ | 
|---|
| [953] | 2 |  | 
|---|
|  | 3 | /* | 
|---|
|  | 4 | * Win32 PE2LX Image base class | 
|---|
|  | 5 | * | 
|---|
|  | 6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| [1274] | 7 | * Copyright 1999 knut st. osmundsen (knut.stange.osmundsen@pmsc.no) | 
|---|
| [953] | 8 | * | 
|---|
|  | 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
|  | 10 | * | 
|---|
|  | 11 | */ | 
|---|
|  | 12 | #ifndef __WINIMAGEPE2LX_H__ | 
|---|
|  | 13 | #define __WINIMAGEPE2LX_H__ | 
|---|
|  | 14 |  | 
|---|
|  | 15 | #include <winimagebase.h> | 
|---|
|  | 16 |  | 
|---|
|  | 17 |  | 
|---|
| [1274] | 18 | /** | 
|---|
|  | 19 | * Section struct - used to translate RVAs to pointers. | 
|---|
|  | 20 | */ | 
|---|
|  | 21 | typedef struct _Section | 
|---|
|  | 22 | { | 
|---|
|  | 23 | ULONG ulRVA;            /* RVA of section. If not a PE section ~0UL. */ | 
|---|
|  | 24 | ULONG cbVirtual;        /* Virtual size (the larger of the physical and virtual) of the section. */ | 
|---|
|  | 25 | ULONG ulAddress;        /* Current load address of the section. */ | 
|---|
|  | 26 | } SECTION, *PSECTION; | 
|---|
| [953] | 27 |  | 
|---|
|  | 28 |  | 
|---|
| [1274] | 29 |  | 
|---|
|  | 30 | /** | 
|---|
|  | 31 | * Base class for Pe2lx (and Win32k) dlls. There is currently no difference between | 
|---|
|  | 32 | * Pe2Lx and Win32k images, though the image on disk is different... | 
|---|
|  | 33 | * @shortdesc   Pe2Lx and Win32k base image class. | 
|---|
|  | 34 | * @author      knut st. osmundsen, Sander van Leeuwen | 
|---|
|  | 35 | * @approval    - | 
|---|
|  | 36 | */ | 
|---|
| [953] | 37 | class Win32Pe2LxImage : public virtual Win32ImageBase | 
|---|
|  | 38 | { | 
|---|
|  | 39 | public: | 
|---|
| [1274] | 40 | /** @cat constructor and destructor */ | 
|---|
| [1327] | 41 | Win32Pe2LxImage(HINSTANCE hinstance, BOOL fWin32k); | 
|---|
| [1274] | 42 | virtual ~Win32Pe2LxImage(); | 
|---|
| [1327] | 43 | virtual BOOL init(); | 
|---|
| [953] | 44 |  | 
|---|
| [1843] | 45 | /** @cat Exports */ | 
|---|
|  | 46 | virtual ULONG getApi(char *name); | 
|---|
|  | 47 | virtual ULONG getApi(int ordinal); | 
|---|
|  | 48 |  | 
|---|
| [1274] | 49 | private: | 
|---|
|  | 50 | /** @cat constructor helpers */ | 
|---|
|  | 51 | ULONG    getSections(); | 
|---|
|  | 52 | ULONG    setSectionRVAs(); | 
|---|
|  | 53 | VOID     cleanup(); | 
|---|
| [953] | 54 |  | 
|---|
|  | 55 | protected: | 
|---|
| [1274] | 56 | /** @cat RVA -> pointer */ | 
|---|
|  | 57 | /* this should be moved to winimagebase some day... */ | 
|---|
|  | 58 | PVOID    getPointerFromRVA(ULONG ulRVA); | 
|---|
| [953] | 59 |  | 
|---|
| [1274] | 60 | PSECTION            paSections; /* Used by getPointerFromRVA and created by getSections and | 
|---|
|  | 61 | * setSectionRVAs. */ | 
|---|
|  | 62 | WORD                cSections;  /* Count of entires in the section array (paSection) */ | 
|---|
| [953] | 63 |  | 
|---|
| [1274] | 64 | /** @cat Misc */ | 
|---|
|  | 65 | PIMAGE_NT_HEADERS   pNtHdrs;    /* Pointer to NT headers. */ | 
|---|
|  | 66 | BOOL                fWin32k;    /* flag which indicates wether this is a Win32k loaded | 
|---|
|  | 67 | * module (TRUE) or and Pe2Lx module (FALSE). */ | 
|---|
|  | 68 | }; | 
|---|
| [953] | 69 |  | 
|---|
|  | 70 |  | 
|---|
|  | 71 | #endif //__WINIMAGEPE2LX_H__ | 
|---|
|  | 72 |  | 
|---|