source: trunk/include/pefile.h@ 689

Last change on this file since 689 was 10, checked in by phaller, 26 years ago

Experimental support vor EMX/GCC 0.9d as build environment. IBM VAC++ 3 remains default. (SET CCENV=VAC3 or EMX)

File size: 2.9 KB
Line 
1/* $Id: pefile.h,v 1.2 1999-05-27 15:17:58 phaller Exp $ */
2
3/*
4 *
5 * Project Odin Software License can be found in LICENSE.TXT
6 *
7 */
8#ifndef __PEFILE_H__
9#define __PEFILE_H__
10
11#ifndef _OS2WIN_H
12#include <os2.h>
13#include <win32type.h>
14#include <peexe.h>
15
16#ifndef max
17#define max(a,b) ((a>b) ? a : b)
18#endif
19
20#define LOWORD(a) (a & 0xFFFF)
21
22#define IDS_ERRBADFILENAME 1000
23#define IDR_CURSOR 1
24#define IDR_BITMAP 2
25#define IDR_ICON 3
26#define IDR_MENU 4
27#define IDR_DIALOG 5
28#define IDR_STRING 6
29#define IDR_FONTDIR 7
30#define IDR_FONT 8
31#define IDR_ACCELERATOR 9
32#define IDR_RCDATA 10
33#define IDR_MESSAGETABLE 11
34
35#endif
36
37 #define NTRT_NEWRESOURCE 0x2000
38 #define NTRT_ERROR 0x7fff
39 #define NTRT_CURSOR 1
40 #define NTRT_BITMAP 2
41 #define NTRT_ICON 3
42 #define NTRT_MENU 4
43 #define NTRT_DIALOG 5
44 #define NTRT_STRING 6
45 #define NTRT_FONTDIR 7
46 #define NTRT_FONT 8
47 #define NTRT_ACCELERATORS 9
48 #define NTRT_RCDATA 10
49 #define NTRT_MESSAGETABLE 11
50 #define NTRT_GROUP_CURSOR 12
51 #define NTRT_GROUP_ICON 14
52 #define NTRT_VERSION 16
53 #define NTRT_NEWBITMAP (NTRT_BITMAP|NTRT_NEWRESOURCE)
54 #define NTRT_NEWMENU (NTRT_MENU|NTRT_NEWRESOURCE)
55 #define NTRT_NEWDIALOG (NTRT_DIALOG|NTRT_NEWRESOURCE)
56
57#define SIZE_OF_NT_SIGNATURE sizeof (DWORD)
58#define MAXRESOURCENAME 13
59
60#define PEHEADEROFF(a) ((LPVOID)((BYTE *)a + \
61 ((IMAGE_DOS_HEADER*)a)->e_lfanew + \
62 SIZE_OF_NT_SIGNATURE))
63
64#define OPTHEADEROFF(a) ((LPVOID)((BYTE *)a + \
65 ((IMAGE_DOS_HEADER*)a)->e_lfanew + \
66 SIZE_OF_NT_SIGNATURE + \
67 sizeof (IMAGE_FILE_HEADER)))
68
69#define SECTIONHDROFF(a) ((LPVOID)((BYTE *)a + \
70 ((IMAGE_DOS_HEADER*)a)->e_lfanew + \
71 SIZE_OF_NT_SIGNATURE + \
72 sizeof (IMAGE_FILE_HEADER) + \
73 sizeof (IMAGE_OPTIONAL_HEADER)))
74
75#define NR_SECTIONS(a) ((int)((PIMAGE_FILE_HEADER)PEHEADEROFF (a))->NumberOfSections)
76
77BOOL GetPEFileHeader (LPVOID, PIMAGE_FILE_HEADER);
78BOOL GetPEOptionalHeader (LPVOID, PIMAGE_OPTIONAL_HEADER);
79LPVOID ImageDirectoryOffset (LPVOID, DWORD);
80BOOL IsImportSection(LPVOID lpFile, PIMAGE_SECTION_HEADER psh);
81BOOL GetSectionHdrByName (LPVOID, PIMAGE_SECTION_HEADER, char *);
82BOOL GetSectionHdrByType (LPVOID, PIMAGE_SECTION_HEADER, int);
83BOOL GetSectionHdrByImageDir (LPVOID, DWORD, PIMAGE_SECTION_HEADER);
84BOOL GetSectionHdrByRVA (LPVOID lpFile, IMAGE_SECTION_HEADER *sh, ULONG rva);
85
86int GetNumberOfResources (LPVOID);
87int GetListOfResourceTypes (LPVOID, char **);
88
89PIMAGE_IMPORT_MODULE_DIRECTORY GetImportFunctions (LPVOID lpFile, char *pszModule, char **szBase);
90
91#endif
Note: See TracBrowser for help on using the repository browser.