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
14
struct
exehdr
15
{
16
uint16
exe_ident
;
17
#define EXE_ID 0x5A4D
// 'MZ'
18
#define EXE_ID2 0x4D5A
// 'ZM' (DOS works with this also)
19
uint16
PartPag
;
20
uint16
PageCnt
;
21
uint16
ReloCnt
;
22
uint16
HdrSize
;
23
uint16
MinMem
;
24
uint16
MaxMem
;
25
uint16
ReloSS
;
26
uint16
ExeSP
;
27
uint16
ChkSum
;
28
uint16
ExeIP
;
29
uint16
ReloCS
;
30
uint16
TablOff
;
31
uint16
Overlay
;
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
*/
39
int32
CalcEXE_Length
(
void
)
40
{
41
int32
len
=
PageCnt
* 512 -
HdrSize
* 16;
42
if
(
PartPag
!= 0 )
43
len
-= 512 -
PartPag
;
44
return
len
;
45
}
46
void
CalcEXE_Pages
(
int32
len
)
47
{
48
PartPag
=
uint16
(
len
% 512);
49
PageCnt
=
uint16
(
len
/ 512);
50
if
(
PartPag
!= 0 )
51
PageCnt
++;
52
}
53
};
54
55
struct
exehdr_full
:
exehdr
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
len
idaman size_t len
Definition
kernwin.hpp:1356
uint16
unsigned short uint16
unsigned 16 bit value
Definition
pro.h:346
uint32
unsigned int uint32
unsigned 32 bit value
Definition
pro.h:348
int32
int int32
signed 32 bit value
Definition
pro.h:347
exehdr_full
Definition
exehdr.h:56
exehdr_full::oeminfo
uint16 oeminfo
Definition
exehdr.h:59
exehdr_full::res
uint16 res[4]
Definition
exehdr.h:57
exehdr_full::oemid
uint16 oemid
Definition
exehdr.h:58
exehdr_full::lfanew
uint32 lfanew
Definition
exehdr.h:61
exehdr_full::res2
uint16 res2[10]
Definition
exehdr.h:60
exehdr
Definition
exehdr.h:15
exehdr::ReloCS
uint16 ReloCS
Definition
exehdr.h:29
exehdr::ChkSum
uint16 ChkSum
Definition
exehdr.h:27
exehdr::exe_ident
uint16 exe_ident
Definition
exehdr.h:16
exehdr::ExeSP
uint16 ExeSP
Definition
exehdr.h:26
exehdr::PageCnt
uint16 PageCnt
Definition
exehdr.h:20
exehdr::PartPag
uint16 PartPag
Definition
exehdr.h:19
exehdr::HdrSize
uint16 HdrSize
Definition
exehdr.h:22
exehdr::ReloCnt
uint16 ReloCnt
Definition
exehdr.h:21
exehdr::CalcEXE_Pages
void CalcEXE_Pages(int32 len)
Definition
exehdr.h:46
exehdr::CalcEXE_Length
int32 CalcEXE_Length(void)
Definition
exehdr.h:39
exehdr::ReloSS
uint16 ReloSS
Definition
exehdr.h:25
exehdr::ExeIP
uint16 ExeIP
Definition
exehdr.h:28
exehdr::MinMem
uint16 MinMem
Definition
exehdr.h:23
exehdr::Overlay
uint16 Overlay
Definition
exehdr.h:31
exehdr::MaxMem
uint16 MaxMem
Definition
exehdr.h:24
exehdr::TablOff
uint16 TablOff
Definition
exehdr.h:30
src
include
exehdr.h