Rizin
unix-like reverse engineering framework and cli tools
ne_specs.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2019 GustavoLCR <gugulcr@gmail.com>
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
#ifndef NE_SPECS_H
5
#define NE_SPECS_H
6
7
enum
{
8
LOBYTE
= 0,
9
SEL_16
= 2,
10
POI_32
= 3,
11
OFF_16
= 5,
12
POI_48
= 11,
13
OFF_32
= 13
14
};
15
16
enum
{
17
INTERNAL_REF
= 0,
18
IMPORTED_ORD
= 1,
19
IMPORTED_NAME
= 2,
20
OSFIXUP
= 3,
21
ADDITIVE
= 4
22
};
23
24
typedef
struct
_RELOC
{
25
ut8
type
;
26
ut8
flags
;
27
ut16
offset
;
28
union
{
29
ut16
index
;
30
struct
{
// internal_fixed
31
ut8
segnum
;
32
ut8
zero
;
33
ut16
segoff
;
34
};
35
struct
{
// internal_moveable
36
ut16
ignore
;
37
ut16
entry_ordinal
;
38
};
39
struct
{
// import_ordinal
40
ut16
align1
;
41
ut16
func_ord
;
42
};
43
struct
{
// import_name
44
ut16
align2
;
45
ut16
name_off
;
46
};
47
};
48
}
NE_image_reloc_item
;
49
50
enum
{
51
IS_DATA
= 1,
52
IS_MOVEABLE
= 0x10,
53
IS_SHAREABLE
= 0x20,
54
IS_PRELOAD
= 0x40,
55
RELOCINFO
= 0x100,
56
IS_RX
= 0x1000
57
};
58
59
enum
{
60
NOAUTODATA
= 0,
61
SINGLEDATA
= 1,
62
LINKERROR
= 0x2000,
63
LIBRARY
= 0x8000
64
};
65
66
typedef
struct
_SEGMENT
{
67
ut16
offset
;
// Specifies the offset, in sectors, to the segment data (relative to the beginning of the file). A value of zero means no data exists.
68
ut16
length
;
// Length of the segment in bytes. A value of zero indicates that the segment length is 64K, unless the selector offset is also zero.
69
ut16
flags
;
// NE_SEGMENT_FLAGS
70
ut16
minAllocSz
;
// A value of zero indicates that the minimum allocation size is 64K
71
}
NE_image_segment_entry
;
72
73
typedef
struct
_NAMEINFO
{
74
ut16
rnOffset
;
75
ut16
rnLength
;
76
ut16
rnFlags
;
77
ut16
rnID
;
78
ut16
rnHandle
;
79
ut16
rnUsage
;
80
}
NE_image_nameinfo_entry
;
81
82
typedef
struct
_TYPEINFO
{
83
ut16
rtTypeID
;
84
ut16
rtResourceCount
;
85
ut32
rtReserved
;
86
NE_image_nameinfo_entry
rtNameInfo
[];
87
}
NE_image_typeinfo_entry
;
88
89
typedef
struct
{
90
char
sig[2];
// "NE"
91
ut8
MajLinkerVersion
;
// The major linker version
92
ut8
MinLinkerVersion
;
// The minor linker version
93
ut16
EntryTableOffset
;
// Offset of entry table
94
ut16
EntryTableLength
;
// Length of entry table in bytes
95
ut32
FileLoadCRC
;
// 32-bit CRC of entire contents of file
96
ut8
ProgFlags
;
// Program flags, bitmapped
97
ut8
ApplFlags
;
// Application flags, bitmapped
98
ut8
AutoDataSegIndex
;
// The automatic data segment index
99
ut16
InitHeapSize
;
// The intial local heap size
100
ut16
InitStackSize
;
// The inital stack size
101
ut16
ipEntryPoint
;
// IP entry point offset
102
ut16
csEntryPoint
;
// CS entrypoint index into segment table (Start at 1)
103
ut32
InitStack
;
// SS:SP inital stack pointer, SS is index into segment table
104
ut16
SegCount
;
// Number of segments in segment table
105
ut16
ModRefs
;
// Number of module references (DLLs)
106
ut16
NoResNamesTabSiz
;
// Size of non-resident names table, in bytes
107
ut16
SegTableOffset
;
// Offset of Segment table
108
ut16
ResTableOffset
;
// Offset of resources table
109
ut16
ResidNamTable
;
// Offset of resident names table
110
ut16
ModRefTable
;
// Offset of module reference table
111
ut16
ImportNameTable
;
// Offset of imported names table (array of counted strings, terminated with string of length 00h)
112
ut32
OffStartNonResTab
;
// Offset from start of file to non-resident names table
113
ut16
MovEntryCount
;
// Count of moveable entry point listed in entry table
114
ut16
FileAlnSzShftCnt
;
// File alligbment size shift count (0=9(default 512 byte pages))
115
ut16
nResTabEntries
;
// Number of resource table entries
116
ut8
targOS
;
// Target OS
117
ut8
OS2EXEFlags
;
// Other OS/2 flags
118
ut16
retThunkOffset
;
// Offset to return thunks or start of gangload area - what is gangload?
119
ut16
segrefthunksoff
;
// Offset to segment reference thunks or size of gangload area
120
ut16
mincodeswap
;
// Minimum code swap area size
121
ut8
expctwinver[2];
// Expected windows version (minor first)
122
}
NE_image_header
;
123
124
#endif
ut16
uint16_t ut16
Definition:
demangler_util.h:30
ut32
uint32_t ut32
Definition:
demangler_util.h:31
ut8
uint8_t ut8
Definition:
lh5801.h:11
IS_PRELOAD
@ IS_PRELOAD
Definition:
ne_specs.h:54
IS_SHAREABLE
@ IS_SHAREABLE
Definition:
ne_specs.h:53
RELOCINFO
@ RELOCINFO
Definition:
ne_specs.h:55
IS_MOVEABLE
@ IS_MOVEABLE
Definition:
ne_specs.h:52
IS_RX
@ IS_RX
Definition:
ne_specs.h:56
IS_DATA
@ IS_DATA
Definition:
ne_specs.h:51
SEL_16
@ SEL_16
Definition:
ne_specs.h:9
POI_48
@ POI_48
Definition:
ne_specs.h:12
POI_32
@ POI_32
Definition:
ne_specs.h:10
OFF_16
@ OFF_16
Definition:
ne_specs.h:11
LOBYTE
@ LOBYTE
Definition:
ne_specs.h:8
OFF_32
@ OFF_32
Definition:
ne_specs.h:13
NE_image_typeinfo_entry
struct _TYPEINFO NE_image_typeinfo_entry
IMPORTED_ORD
@ IMPORTED_ORD
Definition:
ne_specs.h:18
INTERNAL_REF
@ INTERNAL_REF
Definition:
ne_specs.h:17
ADDITIVE
@ ADDITIVE
Definition:
ne_specs.h:21
OSFIXUP
@ OSFIXUP
Definition:
ne_specs.h:20
IMPORTED_NAME
@ IMPORTED_NAME
Definition:
ne_specs.h:19
NE_image_reloc_item
struct _RELOC NE_image_reloc_item
NE_image_segment_entry
struct _SEGMENT NE_image_segment_entry
NE_image_nameinfo_entry
struct _NAMEINFO NE_image_nameinfo_entry
LIBRARY
@ LIBRARY
Definition:
ne_specs.h:63
NOAUTODATA
@ NOAUTODATA
Definition:
ne_specs.h:60
SINGLEDATA
@ SINGLEDATA
Definition:
ne_specs.h:61
LINKERROR
@ LINKERROR
Definition:
ne_specs.h:62
NE_image_header
Definition:
ne_specs.h:89
NE_image_header::AutoDataSegIndex
ut8 AutoDataSegIndex
Definition:
ne_specs.h:98
NE_image_header::OffStartNonResTab
ut32 OffStartNonResTab
Definition:
ne_specs.h:112
NE_image_header::OS2EXEFlags
ut8 OS2EXEFlags
Definition:
ne_specs.h:117
NE_image_header::InitStackSize
ut16 InitStackSize
Definition:
ne_specs.h:100
NE_image_header::ApplFlags
ut8 ApplFlags
Definition:
ne_specs.h:97
NE_image_header::mincodeswap
ut16 mincodeswap
Definition:
ne_specs.h:120
NE_image_header::EntryTableLength
ut16 EntryTableLength
Definition:
ne_specs.h:94
NE_image_header::InitHeapSize
ut16 InitHeapSize
Definition:
ne_specs.h:99
NE_image_header::NoResNamesTabSiz
ut16 NoResNamesTabSiz
Definition:
ne_specs.h:106
NE_image_header::ModRefs
ut16 ModRefs
Definition:
ne_specs.h:105
NE_image_header::ModRefTable
ut16 ModRefTable
Definition:
ne_specs.h:110
NE_image_header::EntryTableOffset
ut16 EntryTableOffset
Definition:
ne_specs.h:93
NE_image_header::SegTableOffset
ut16 SegTableOffset
Definition:
ne_specs.h:107
NE_image_header::MajLinkerVersion
ut8 MajLinkerVersion
Definition:
ne_specs.h:91
NE_image_header::ResidNamTable
ut16 ResidNamTable
Definition:
ne_specs.h:109
NE_image_header::retThunkOffset
ut16 retThunkOffset
Definition:
ne_specs.h:118
NE_image_header::FileAlnSzShftCnt
ut16 FileAlnSzShftCnt
Definition:
ne_specs.h:114
NE_image_header::ResTableOffset
ut16 ResTableOffset
Definition:
ne_specs.h:108
NE_image_header::nResTabEntries
ut16 nResTabEntries
Definition:
ne_specs.h:115
NE_image_header::SegCount
ut16 SegCount
Definition:
ne_specs.h:104
NE_image_header::ipEntryPoint
ut16 ipEntryPoint
Definition:
ne_specs.h:101
NE_image_header::segrefthunksoff
ut16 segrefthunksoff
Definition:
ne_specs.h:119
NE_image_header::InitStack
ut32 InitStack
Definition:
ne_specs.h:103
NE_image_header::ProgFlags
ut8 ProgFlags
Definition:
ne_specs.h:96
NE_image_header::MovEntryCount
ut16 MovEntryCount
Definition:
ne_specs.h:113
NE_image_header::csEntryPoint
ut16 csEntryPoint
Definition:
ne_specs.h:102
NE_image_header::ImportNameTable
ut16 ImportNameTable
Definition:
ne_specs.h:111
NE_image_header::MinLinkerVersion
ut8 MinLinkerVersion
Definition:
ne_specs.h:92
NE_image_header::targOS
ut8 targOS
Definition:
ne_specs.h:116
NE_image_header::FileLoadCRC
ut32 FileLoadCRC
Definition:
ne_specs.h:95
_NAMEINFO
Definition:
ne_specs.h:73
_NAMEINFO::rnID
ut16 rnID
Definition:
ne_specs.h:77
_NAMEINFO::rnFlags
ut16 rnFlags
Definition:
ne_specs.h:76
_NAMEINFO::rnHandle
ut16 rnHandle
Definition:
ne_specs.h:78
_NAMEINFO::rnUsage
ut16 rnUsage
Definition:
ne_specs.h:79
_NAMEINFO::rnLength
ut16 rnLength
Definition:
ne_specs.h:75
_NAMEINFO::rnOffset
ut16 rnOffset
Definition:
ne_specs.h:74
_RELOC
Definition:
ne_specs.h:24
_RELOC::index
ut16 index
Definition:
ne_specs.h:29
_RELOC::func_ord
ut16 func_ord
Definition:
ne_specs.h:41
_RELOC::zero
ut8 zero
Definition:
ne_specs.h:32
_RELOC::segoff
ut16 segoff
Definition:
ne_specs.h:33
_RELOC::ignore
ut16 ignore
Definition:
ne_specs.h:36
_RELOC::align1
ut16 align1
Definition:
ne_specs.h:40
_RELOC::align2
ut16 align2
Definition:
ne_specs.h:44
_RELOC::flags
ut8 flags
Definition:
ne_specs.h:26
_RELOC::segnum
ut8 segnum
Definition:
ne_specs.h:31
_RELOC::offset
ut16 offset
Definition:
ne_specs.h:27
_RELOC::entry_ordinal
ut16 entry_ordinal
Definition:
ne_specs.h:37
_RELOC::type
ut8 type
Definition:
ne_specs.h:25
_RELOC::name_off
ut16 name_off
Definition:
ne_specs.h:45
_SEGMENT
Definition:
ne_specs.h:66
_SEGMENT::offset
ut16 offset
Definition:
ne_specs.h:67
_SEGMENT::minAllocSz
ut16 minAllocSz
Definition:
ne_specs.h:70
_SEGMENT::flags
ut16 flags
Definition:
ne_specs.h:69
_SEGMENT::length
ut16 length
Definition:
ne_specs.h:68
_TYPEINFO
Definition:
ne_specs.h:82
_TYPEINFO::rtReserved
ut32 rtReserved
Definition:
ne_specs.h:85
_TYPEINFO::rtTypeID
ut16 rtTypeID
Definition:
ne_specs.h:83
_TYPEINFO::rtResourceCount
ut16 rtResourceCount
Definition:
ne_specs.h:84
_TYPEINFO::rtNameInfo
NE_image_nameinfo_entry rtNameInfo[]
Definition:
ne_specs.h:86
librz
bin
format
ne
ne_specs.h
Generated by
1.9.1