IDA C++ SDK 9.2
Loading...
Searching...
No Matches
exehdr.h
Go to the documentation of this file.
1/*
2 * Interactive disassembler (IDA).
3 * Copyright (c) 1990-2025 Hex-Rays
4 * ALL RIGHTS RESERVED.
5 *
6 * EXE-file header layout
7 *
8 */
9
10#ifndef __EXEHDR_H
11#define __EXEHDR_H
12#pragma pack(push, 1)
13
14struct exehdr
15{
17#define EXE_ID 0x5A4D // 'MZ'
18#define EXE_ID2 0x4D5A // 'ZM' (DOS works with this also)
32/*
33 uint16 res[4]; // Reserved words
34 uint16 oemid; // OEM identifier (for e_oeminfo)
35 uint16 oeminfo; // OEM information; e_oemid specific
36 uint16 res2[10]; // Reserved words
37 uint32 lfanew; // File address of new exe header
38*/
40 {
41 int32 len = PageCnt * 512 - HdrSize * 16;
42 if ( PartPag != 0 )
43 len -= 512 - PartPag;
44 return len;
45 }
47 {
48 PartPag = uint16(len % 512);
49 PageCnt = uint16(len / 512);
50 if ( PartPag != 0 )
51 PageCnt++;
52 }
53};
54
56{
57 uint16 res[4]; // Reserved words
58 uint16 oemid; // OEM identifier (for e_oeminfo)
59 uint16 oeminfo; // OEM information; e_oemid specific
60 uint16 res2[10]; // Reserved words
61 uint32 lfanew; // File address of new exe header
62};
63
64#define PSPsize 0x100
65#define PE_PTROFF 0x3C
66#pragma pack(pop)
67#endif
idaman size_t len
Definition kernwin.hpp:1356
unsigned short uint16
unsigned 16 bit value
Definition pro.h:346
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
int int32
signed 32 bit value
Definition pro.h:347
Definition exehdr.h:56
uint16 oeminfo
Definition exehdr.h:59
uint16 res[4]
Definition exehdr.h:57
uint16 oemid
Definition exehdr.h:58
uint32 lfanew
Definition exehdr.h:61
uint16 res2[10]
Definition exehdr.h:60
Definition exehdr.h:15
uint16 ReloCS
Definition exehdr.h:29
uint16 ChkSum
Definition exehdr.h:27
uint16 exe_ident
Definition exehdr.h:16
uint16 ExeSP
Definition exehdr.h:26
uint16 PageCnt
Definition exehdr.h:20
uint16 PartPag
Definition exehdr.h:19
uint16 HdrSize
Definition exehdr.h:22
uint16 ReloCnt
Definition exehdr.h:21
void CalcEXE_Pages(int32 len)
Definition exehdr.h:46
int32 CalcEXE_Length(void)
Definition exehdr.h:39
uint16 ReloSS
Definition exehdr.h:25
uint16 ExeIP
Definition exehdr.h:28
uint16 MinMem
Definition exehdr.h:23
uint16 Overlay
Definition exehdr.h:31
uint16 MaxMem
Definition exehdr.h:24
uint16 TablOff
Definition exehdr.h:30