xref: /reactos/sdk/lib/rossym_new/pe.h (revision 84ccccab)
1 #ifndef _LIBMACH_PE_H_
2 #define _LIBMACH_PE_H_
3 
4 #include "compat.h"
5 
6 struct DwarfBlock;
7 typedef struct _IMAGE_SECTION_HEADER PeSect;
8 
9 typedef struct _Pe {
10 	void *fd;
11 	u16int (*e2)(const unsigned char *data);
12 	u32int (*e4)(const unsigned char *data);
13 	u64int (*e8)(const unsigned char *data);
14 	ulong imagebase, imagesize, loadbase;
15     ulong codestart, datastart;
16 	int (*loadsection)(struct _Pe *pe, char *name, struct DwarfBlock *b);
17 	int nsections;
18 	struct _IMAGE_SECTION_HEADER *sect;
19 } Pe;
20 
21 Pe *peopen(const char *name);
22 int loaddisksection(struct _Pe *pe, char *name, struct DwarfBlock *b);
23 u16int peget2(const unsigned char *ptr);
24 u32int peget4(const unsigned char *ptr);
25 u64int peget8(const unsigned char *ptr);
26 void pefree(struct _Pe *pe);
27 ulong pefindrva(struct _IMAGE_SECTION_HEADER *SectionHeader, int NumberOfSections, ulong TargetPhysical);
28 int GetStrnlen(const char *string, int maxlen);
29 
30 #define ANSI_NAME_STRING(s) ((PANSI_STRING)((s)->Name))
31 
32 #endif/*_LIBMACH_PE_H_*/
33