source: trunk/include/pefile.h@ 10010

Last change on this file since 10010 was 4439, checked in by sandervl, 25 years ago

header update

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