Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
180a088b
Commit
180a088b
authored
Apr 18, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved PE header definitions to winnt.h where they belong.
parent
4bdf4af1
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1013 additions
and
1026 deletions
+1013
-1026
dbgmain.c
debugger/dbgmain.c
+0
-1
module.c
debugger/module.c
+0
-1
msc.c
debugger/msc.c
+1
-18
types.c
debugger/types.c
+0
-1
iconcache.c
dlls/shell32/iconcache.c
+2
-2
shell.c
dlls/shell32/shell.c
+2
-2
resource.c
dlls/version/resource.c
+2
-2
imagehlp.h
include/imagehlp.h
+0
-273
neexe.h
include/neexe.h
+0
-75
pe_image.h
include/pe_image.h
+11
-1
peexe.h
include/peexe.h
+0
-599
winnt.h
include/winnt.h
+953
-0
module.c
loader/dos/module.c
+0
-1
elf.c
loader/elf.c
+0
-1
module.c
loader/module.c
+1
-1
module.c
loader/ne/module.c
+39
-40
pe_image.c
loader/pe_image.c
+0
-1
task.c
loader/task.c
+0
-1
builtin32.c
relay32/builtin32.c
+0
-1
snoop.c
relay32/snoop.c
+0
-1
cvcrunch.c
tools/cvdump/cvcrunch.c
+0
-1
cvdump.h
tools/cvdump/cvdump.h
+0
-1
fnt2bdf.c
tools/fnt2bdf.c
+2
-2
No files found.
debugger/dbgmain.c
View file @
180a088b
...
...
@@ -12,7 +12,6 @@
#include "module.h"
#include "debugger.h"
#include "win.h"
#include "peexe.h"
#include "pe_image.h"
ldt_copy_entry
ldt_copy
[
LDT_SIZE
];
...
...
debugger/module.c
View file @
180a088b
...
...
@@ -10,7 +10,6 @@
#include <stdio.h>
#include <string.h>
#include "neexe.h"
#include "peexe.h"
#include "module.h"
#include "file.h"
#include "debugger.h"
...
...
debugger/msc.c
View file @
180a088b
...
...
@@ -25,7 +25,7 @@
#endif
#include "debugger.h"
#include "neexe.h"
#include "pe
ex
e.h"
#include "pe
_imag
e.h"
#include "file.h"
typedef
struct
{
...
...
@@ -719,23 +719,6 @@ struct codeview_linetab_hdr
};
/*
* A simple macro that tells us whether a given COFF symbol is a
* function or not.
*/
#define N_TMASK 0x0030
#define IMAGE_SYM_DTYPE_FUNCTION 2
#define N_BTSHFT 4
#define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
/*
* This is what we are looking for in the COFF symbols.
*/
#define IMAGE_SYM_CLASS_EXTERNAL 0x2
#define IMAGE_SYM_CLASS_STATIC 0x3
#define IMAGE_SYM_CLASS_FILE 0x67
static
struct
datatype
*
DEBUG_GetCVType
(
unsigned
int
typeno
)
{
...
...
debugger/types.c
View file @
180a088b
...
...
@@ -19,7 +19,6 @@
#include <unistd.h>
#include "pe_image.h"
#include "peexe.h"
#include "debugger.h"
#define NR_TYPE_HASH 521
...
...
dlls/shell32/iconcache.c
View file @
180a088b
...
...
@@ -101,12 +101,12 @@ static DWORD SHELL_GetResourceTable(HFILE hFile, LPBYTE *retptr)
if
(
ne_header
.
ne_magic
!=
IMAGE_OS2_SIGNATURE
)
return
0
;
size
=
ne_header
.
rname_tab_offset
-
ne_header
.
resource_tab_offset
;
size
=
ne_header
.
ne_restab
-
ne_header
.
ne_rsrctab
;
if
(
size
>
sizeof
(
NE_TYPEINFO
)
)
{
pTypeInfo
=
(
BYTE
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
pTypeInfo
)
{
_llseek
(
hFile
,
mz_header
.
e_lfanew
+
ne_header
.
resource_tab_offset
,
SEEK_SET
);
{
_llseek
(
hFile
,
mz_header
.
e_lfanew
+
ne_header
.
ne_rsrctab
,
SEEK_SET
);
if
(
_lread
(
hFile
,
(
char
*
)
pTypeInfo
,
size
)
!=
size
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pTypeInfo
);
pTypeInfo
=
NULL
;
...
...
dlls/shell32/shell.c
View file @
180a088b
...
...
@@ -684,12 +684,12 @@ static DWORD SHELL_GetResourceTable(HFILE hFile,LPBYTE *retptr)
if
(
ne_header
.
ne_magic
!=
IMAGE_OS2_SIGNATURE
)
return
0
;
size
=
ne_header
.
rname_tab_offset
-
ne_header
.
resource_tab_offset
;
size
=
ne_header
.
ne_restab
-
ne_header
.
ne_rsrctab
;
if
(
size
>
sizeof
(
NE_TYPEINFO
)
)
{
pTypeInfo
=
(
BYTE
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
pTypeInfo
)
{
_llseek
(
hFile
,
mz_header
.
e_lfanew
+
ne_header
.
resource_tab_offset
,
SEEK_SET
);
{
_llseek
(
hFile
,
mz_header
.
e_lfanew
+
ne_header
.
ne_rsrctab
,
SEEK_SET
);
if
(
_lread
(
hFile
,
(
char
*
)
pTypeInfo
,
size
)
!=
size
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pTypeInfo
);
pTypeInfo
=
NULL
;
...
...
dlls/version/resource.c
View file @
180a088b
...
...
@@ -67,7 +67,7 @@ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
nehdoffset
=
LZSeek
(
lzfd
,
0
,
SEEK_CUR
);
if
(
sizeof
(
nehd
)
!=
LZRead
(
lzfd
,
&
nehd
,
sizeof
(
nehd
)
)
)
return
0
;
resTabSize
=
nehd
.
rname_tab_offset
-
nehd
.
resource_tab_offset
;
resTabSize
=
nehd
.
ne_restab
-
nehd
.
ne_rsrctab
;
if
(
!
resTabSize
)
{
TRACE
(
"No resources in NE dll
\n
"
);
...
...
@@ -78,7 +78,7 @@ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
resTab
=
HeapAlloc
(
GetProcessHeap
(),
0
,
resTabSize
);
if
(
!
resTab
)
return
FALSE
;
LZSeek
(
lzfd
,
nehd
.
resource_tab_offset
+
nehdoffset
,
SEEK_SET
);
LZSeek
(
lzfd
,
nehd
.
ne_rsrctab
+
nehdoffset
,
SEEK_SET
);
if
(
resTabSize
!=
LZRead
(
lzfd
,
resTab
,
resTabSize
)
)
{
HeapFree
(
GetProcessHeap
(),
0
,
resTab
);
...
...
include/imagehlp.h
View file @
180a088b
...
...
@@ -62,18 +62,6 @@ typedef enum _IMAGEHLP_STATUS_REASON {
#define SPLITSYM_EXTRACT_ALL 0x00000002
#define SPLITSYM_SYMBOLPATH_IS_SRC 0x00000004
#define IMAGE_DEBUG_TYPE_UNKNOWN 0
#define IMAGE_DEBUG_TYPE_COFF 1
#define IMAGE_DEBUG_TYPE_CODEVIEW 2
#define IMAGE_DEBUG_TYPE_FPO 3
#define IMAGE_DEBUG_TYPE_MISC 4
#define IMAGE_DEBUG_TYPE_EXCEPTION 5
#define IMAGE_DEBUG_TYPE_FIXUP 6
#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
#define IMAGE_DEBUG_TYPE_BORLAND 9
#define IMAGE_DEBUG_TYPE_RESERVED10 10
#define FRAME_FPO 0
#define FRAME_TRAP 1
#define FRAME_TSS 2
...
...
@@ -136,97 +124,10 @@ typedef enum _SYM_TYPE {
#define CBA_SYMBOLS_UNLOADED 0x00000004
#define CBA_DUPLICATE_SYMBOL 0x00000005
#define IMAGE_DOS_SIGNATURE 0x5A4D
/* MZ */
#define IMAGE_OS2_SIGNATURE 0x454E
/* NE */
#define IMAGE_OS2_SIGNATURE_LE 0x454C
/* LE */
#define IMAGE_VXD_SIGNATURE 0x454C
/* LE */
#define IMAGE_NT_SIGNATURE 0x00004550
/* PE00 */
/***********************************************************************
* Structures
*/
typedef
struct
_IMAGE_DATA_DIRECTORY
{
DWORD
VirtualAddress
;
DWORD
Size
;
}
IMAGE_DATA_DIRECTORY
,
*
PIMAGE_DATA_DIRECTORY
;
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
typedef
struct
_IMAGE_OPTIONAL_HEADER
{
/* Standard fields */
WORD
Magic
;
BYTE
MajorLinkerVersion
;
BYTE
MinorLinkerVersion
;
DWORD
SizeOfCode
;
DWORD
SizeOfInitializedData
;
DWORD
SizeOfUninitializedData
;
DWORD
AddressOfEntryPoint
;
DWORD
BaseOfCode
;
DWORD
BaseOfData
;
/* NT additional fields */
DWORD
ImageBase
;
DWORD
SectionAlignment
;
DWORD
FileAlignment
;
WORD
MajorOperatingSystemVersion
;
WORD
MinorOperatingSystemVersion
;
WORD
MajorImageVersion
;
WORD
MinorImageVersion
;
WORD
MajorSubsystemVersion
;
WORD
MinorSubsystemVersion
;
DWORD
Win32VersionValue
;
DWORD
SizeOfImage
;
DWORD
SizeOfHeaders
;
DWORD
CheckSum
;
WORD
Subsystem
;
WORD
DllCharacteristics
;
DWORD
SizeOfStackReserve
;
DWORD
SizeOfStackCommit
;
DWORD
SizeOfHeapReserve
;
DWORD
SizeOfHeapCommit
;
DWORD
LoaderFlags
;
DWORD
NumberOfRvaAndSizes
;
IMAGE_DATA_DIRECTORY
DataDirectory
[
IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
}
IMAGE_OPTIONAL_HEADER
,
*
PIMAGE_OPTIONAL_HEADER
;
typedef
struct
_IMAGE_FILE_HEADER
{
WORD
Machine
;
WORD
NumberOfSections
;
DWORD
TimeDateStamp
;
DWORD
PointerToSymbolTable
;
DWORD
NumberOfSymbols
;
WORD
SizeOfOptionalHeader
;
WORD
Characteristics
;
}
IMAGE_FILE_HEADER
,
*
PIMAGE_FILE_HEADER
;
typedef
struct
_IMAGE_NT_HEADERS
{
DWORD
Signature
;
IMAGE_FILE_HEADER
FileHeader
;
IMAGE_OPTIONAL_HEADER
OptionalHeader
;
}
IMAGE_NT_HEADERS
,
*
PIMAGE_NT_HEADERS
;
#define IMAGE_SIZEOF_SHORT_NAME 8
typedef
struct
_IMAGE_SECTION_HEADER
{
BYTE
Name
[
IMAGE_SIZEOF_SHORT_NAME
];
union
{
DWORD
PhysicalAddress
;
DWORD
VirtualSize
;
}
Misc
;
DWORD
VirtualAddress
;
DWORD
SizeOfRawData
;
DWORD
PointerToRawData
;
DWORD
PointerToRelocations
;
DWORD
PointerToLinenumbers
;
WORD
NumberOfRelocations
;
WORD
NumberOfLinenumbers
;
DWORD
Characteristics
;
}
IMAGE_SECTION_HEADER
,
*
PIMAGE_SECTION_HEADER
;
typedef
struct
_LOADED_IMAGE
{
LPSTR
ModuleName
;
HANDLE
hFile
;
...
...
@@ -242,27 +143,6 @@ typedef struct _LOADED_IMAGE {
ULONG
SizeOfImage
;
}
LOADED_IMAGE
,
*
PLOADED_IMAGE
;
typedef
struct
_IMAGE_LOAD_CONFIG_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
GlobalFlagsClear
;
DWORD
GlobalFlagsSet
;
DWORD
CriticalSectionDefaultTimeout
;
DWORD
DeCommitFreeBlockThreshold
;
DWORD
DeCommitTotalFreeThreshold
;
PVOID
LockPrefixTable
;
DWORD
MaximumAllocationSize
;
DWORD
VirtualMemoryThreshold
;
DWORD
ProcessHeapFlags
;
DWORD
ProcessAffinityMask
;
WORD
CSDVersion
;
WORD
Reserved1
;
PVOID
EditList
;
DWORD
Reserved
[
1
];
}
IMAGE_LOAD_CONFIG_DIRECTORY
,
*
PIMAGE_LOAD_CONFIG_DIRECTORY
;
typedef
struct
_WIN_CERTIFICATE
{
DWORD
dwLength
;
WORD
wRevision
;
/* WIN_CERT_REVISON_xxx */
...
...
@@ -277,47 +157,6 @@ typedef struct _API_VERSION {
USHORT
Reserved
;
}
API_VERSION
,
*
PAPI_VERSION
;
typedef
struct
_IMAGE_FUNCTION_ENTRY
{
DWORD
StartingAddress
;
DWORD
EndingAddress
;
DWORD
EndOfPrologue
;
}
IMAGE_FUNCTION_ENTRY
,
*
PIMAGE_FUNCTION_ENTRY
;
typedef
struct
_IMAGE_DEBUG_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
Type
;
DWORD
SizeOfData
;
DWORD
AddressOfRawData
;
DWORD
PointerToRawData
;
}
IMAGE_DEBUG_DIRECTORY
,
*
PIMAGE_DEBUG_DIRECTORY
;
typedef
struct
_IMAGE_COFF_SYMBOLS_HEADER
{
DWORD
NumberOfSymbols
;
DWORD
LvaToFirstSymbol
;
DWORD
NumberOfLinenumbers
;
DWORD
LvaToFirstLinenumber
;
DWORD
RvaToFirstByteOfCode
;
DWORD
RvaToLastByteOfCode
;
DWORD
RvaToFirstByteOfData
;
DWORD
RvaToLastByteOfData
;
}
IMAGE_COFF_SYMBOLS_HEADER
,
*
PIMAGE_COFF_SYMBOLS_HEADER
;
typedef
struct
_FPO_DATA
{
DWORD
ulOffStart
;
DWORD
cbProcSize
;
DWORD
cdwLocals
;
WORD
cdwParams
;
unsigned
cbProlog
:
8
;
unsigned
cbRegs
:
3
;
unsigned
fHasSEH
:
1
;
unsigned
fUseBP
:
1
;
unsigned
reserved
:
1
;
unsigned
cbFrame
:
2
;
}
FPO_DATA
,
*
PFPO_DATA
;
typedef
struct
_IMAGE_DEBUG_INFORMATION
{
LIST_ENTRY
List
;
DWORD
Size
;
...
...
@@ -436,115 +275,6 @@ typedef struct _IMAGEHLP_DUPLICATE_SYMBOL {
ULONG
SelectedSymbol
;
}
IMAGEHLP_DUPLICATE_SYMBOL
,
*
PIMAGEHLP_DUPLICATE_SYMBOL
;
typedef
struct
_IMAGE_DOS_HEADER
{
WORD
e_magic
;
WORD
e_cblp
;
WORD
e_cp
;
WORD
e_crlc
;
WORD
e_cparhdr
;
WORD
e_minalloc
;
WORD
e_maxalloc
;
WORD
e_ss
;
WORD
e_sp
;
WORD
e_csum
;
WORD
e_ip
;
WORD
e_cs
;
WORD
e_lfarlc
;
WORD
e_ovno
;
WORD
e_res
[
4
];
WORD
e_oemid
;
WORD
e_oeminfo
;
WORD
e_res2
[
10
];
LONG
e_lfanew
;
}
IMAGE_DOS_HEADER
,
*
PIMAGE_DOS_HEADER
;
typedef
struct
_IMAGE_OS2_HEADER
{
WORD
ne_magic
;
CHAR
ne_ver
;
CHAR
ne_rev
;
WORD
ne_enttab
;
WORD
ne_cbenttab
;
LONG
ne_crc
;
WORD
ne_flags
;
WORD
ne_autodata
;
WORD
ne_heap
;
WORD
ne_stack
;
LONG
ne_csip
;
LONG
ne_sssp
;
WORD
ne_cseg
;
WORD
ne_cmod
;
WORD
ne_cbnrestab
;
WORD
ne_segtab
;
WORD
ne_rsrctab
;
WORD
ne_restab
;
WORD
ne_modtab
;
WORD
ne_imptab
;
LONG
ne_nrestab
;
WORD
ne_cmovent
;
WORD
ne_align
;
WORD
ne_cres
;
BYTE
ne_exetyp
;
BYTE
ne_flagsothers
;
WORD
ne_pretthunks
;
WORD
ne_psegrefbytes
;
WORD
ne_swaparea
;
WORD
ne_expver
;
}
IMAGE_OS2_HEADER
,
*
PIMAGE_OS2_HEADER
;
typedef
struct
_IMAGE_VXD_HEADER
{
WORD
e32_magic
;
BYTE
e32_border
;
BYTE
e32_worder
;
DWORD
e32_level
;
WORD
e32_cpu
;
WORD
e32_os
;
DWORD
e32_ver
;
DWORD
e32_mflags
;
DWORD
e32_mpages
;
DWORD
e32_startobj
;
DWORD
e32_eip
;
DWORD
e32_stackobj
;
DWORD
e32_esp
;
DWORD
e32_pagesize
;
DWORD
e32_lastpagesize
;
DWORD
e32_fixupsize
;
DWORD
e32_fixupsum
;
DWORD
e32_ldrsize
;
DWORD
e32_ldrsum
;
DWORD
e32_objtab
;
DWORD
e32_objcnt
;
DWORD
e32_objmap
;
DWORD
e32_itermap
;
DWORD
e32_rsrctab
;
DWORD
e32_rsrccnt
;
DWORD
e32_restab
;
DWORD
e32_enttab
;
DWORD
e32_dirtab
;
DWORD
e32_dircnt
;
DWORD
e32_fpagetab
;
DWORD
e32_frectab
;
DWORD
e32_impmod
;
DWORD
e32_impmodcnt
;
DWORD
e32_impproc
;
DWORD
e32_pagesum
;
DWORD
e32_datapage
;
DWORD
e32_preload
;
DWORD
e32_nrestab
;
DWORD
e32_cbnrestab
;
DWORD
e32_nressum
;
DWORD
e32_autodata
;
DWORD
e32_debuginfo
;
DWORD
e32_debuglen
;
DWORD
e32_instpreload
;
DWORD
e32_instdemand
;
DWORD
e32_heapsize
;
BYTE
e32_res3
[
12
];
DWORD
e32_winresoff
;
DWORD
e32_winreslen
;
WORD
e32_devid
;
WORD
e32_ddkver
;
}
IMAGE_VXD_HEADER
,
*
PIMAGE_VXD_HEADER
;
/***********************************************************************
* Callbacks
*/
...
...
@@ -821,6 +551,3 @@ extern HANDLE IMAGEHLP_hHeap;
#endif
/* defined(__cplusplus) */
#endif
/* __WINE_IMAGEHLP_H */
include/neexe.h
View file @
180a088b
...
...
@@ -7,81 +7,6 @@
#include "windef.h"
/*
* Old MZ header for DOS programs.
* We check only the magic and the e_lfanew offset to the new executable
* header.
*/
typedef
struct
{
WORD
e_magic
;
/* 00: MZ Header signature */
WORD
e_cblp
;
/* 02: Bytes on last page of file */
WORD
e_cp
;
/* 04: Pages in file */
WORD
e_crlc
;
/* 06: Relocations */
WORD
e_cparhdr
;
/* 08: Size of header in paragraphs */
WORD
e_minalloc
;
/* 0a: Minimum extra paragraphs needed */
WORD
e_maxalloc
;
/* 0c: Maximum extra paragraphs needed */
WORD
e_ss
;
/* 0e: Initial (relative) SS value */
WORD
e_sp
;
/* 10: Initial SP value */
WORD
e_csum
;
/* 12: Checksum */
WORD
e_ip
;
/* 14: Initial IP value */
WORD
e_cs
;
/* 16: Initial (relative) CS value */
WORD
e_lfarlc
;
/* 18: File address of relocation table */
WORD
e_ovno
;
/* 1a: Overlay number */
WORD
e_res
[
4
];
/* 1c: Reserved words */
WORD
e_oemid
;
/* 24: OEM identifier (for e_oeminfo) */
WORD
e_oeminfo
;
/* 26: OEM information; e_oemid specific */
WORD
e_res2
[
10
];
/* 28: Reserved words */
DWORD
e_lfanew
;
/* 3c: Offset to extended header */
}
IMAGE_DOS_HEADER
,
*
PIMAGE_DOS_HEADER
;
#define IMAGE_DOS_SIGNATURE 0x5A4D
/* MZ */
#define IMAGE_OS2_SIGNATURE 0x454E
/* NE */
#define IMAGE_OS2_SIGNATURE_LE 0x454C
/* LE */
#define IMAGE_OS2_SIGNATURE_LX 0x584C
/* LX */
#define IMAGE_VXD_SIGNATURE 0x454C
/* LE */
#define IMAGE_NT_SIGNATURE 0x00004550
/* PE00 */
/*
* This is the Windows executable (NE) header.
* the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
*/
typedef
struct
{
WORD
ne_magic
;
/* 00 NE signature 'NE' */
BYTE
linker_version
;
/* 02 Linker version number */
BYTE
linker_revision
;
/* 03 Linker revision number */
WORD
entry_tab_offset
;
/* 04 Offset to entry table relative to NE */
WORD
entry_tab_length
;
/* 06 Length of entry table in bytes */
DWORD
reserved1
;
/* 08 Reserved by Microsoft */
WORD
format_flags
;
/* 0c Flags about segments in this file */
WORD
auto_data_seg
;
/* 0e Automatic data segment number */
WORD
local_heap_length
;
/* 10 Initial size of local heap */
WORD
stack_length
;
/* 12 Initial size of stack */
WORD
ip
;
/* 14 Initial IP */
WORD
cs
;
/* 16 Initial CS */
WORD
sp
;
/* 18 Initial SP */
WORD
ss
;
/* 1a Initial SS */
WORD
n_segment_tab
;
/* 1c # of entries in segment table */
WORD
n_mod_ref_tab
;
/* 1e # of entries in module reference tab. */
WORD
nrname_tab_length
;
/* 20 Length of nonresident-name table */
WORD
segment_tab_offset
;
/* 22 Offset to segment table */
WORD
resource_tab_offset
;
/* 24 Offset to resource table */
WORD
rname_tab_offset
;
/* 26 Offset to resident-name table */
WORD
moduleref_tab_offset
;
/* 28 Offset to module reference table */
WORD
iname_tab_offset
;
/* 2a Offset to imported name table */
DWORD
nrname_tab_offset
;
/* 2c Offset to nonresident-name table */
WORD
n_mov_entry_points
;
/* 30 # of movable entry points */
WORD
align_shift_count
;
/* 32 Logical sector alignment shift count */
WORD
n_resource_seg
;
/* 34 # of resource segments */
BYTE
operating_system
;
/* 36 Flags indicating target OS */
BYTE
additional_flags
;
/* 37 Additional information flags */
WORD
fastload_offset
;
/* 38 Offset to fast load area */
WORD
fastload_length
;
/* 3a Length of fast load area */
WORD
reserved2
;
/* 3c Reserved by Microsoft */
WORD
expect_version
;
/* 3e Expected Windows version number */
}
IMAGE_OS2_HEADER
,
*
PIMAGE_OS2_HEADER
;
/*
* NE Header FORMAT FLAGS
*/
#define NE_FFLAGS_SINGLEDATA 0x0001
...
...
include/pe_image.h
View file @
180a088b
...
...
@@ -3,7 +3,17 @@
#include "windef.h"
#include "winbase.h"
#include "peexe.h"
#define PE_HEADER(module) \
((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
(((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
#define PE_SECTIONS(module) \
((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
#define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
/* modreference used for attached processes
* all section are calculated here, relocations etc.
*/
...
...
include/peexe.h
deleted
100644 → 0
View file @
4bdf4af1
/*
* Copyright Eric Youngdale (1994)
*/
#ifndef __WINE_PEEXE_H
#define __WINE_PEEXE_H
#include "windef.h"
typedef
struct
_IMAGE_FILE_HEADER
{
WORD
Machine
;
/* 00 */
WORD
NumberOfSections
;
/* 02 */
DWORD
TimeDateStamp
;
/* 04 */
DWORD
PointerToSymbolTable
;
/* 08 */
DWORD
NumberOfSymbols
;
/* 0c */
WORD
SizeOfOptionalHeader
;
/* 10 */
WORD
Characteristics
;
/* 12 */
}
IMAGE_FILE_HEADER
,
*
PIMAGE_FILE_HEADER
;
#define IMAGE_SIZEOF_FILE_HEADER 20
/* These defines describe the meanings of the bits in the Characteristics
field */
#define IMAGE_FILE_RELOCS_STRIPPED 1
/* No relocation info */
#define IMAGE_FILE_EXECUTABLE_IMAGE 2
#define IMAGE_FILE_LINE_NUMS_STRIPPED 4
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
#define IMAGE_FILE_16BIT_MACHINE 0x40
#define IMAGE_FILE_BYTES_REVERSED_LO 0x80
#define IMAGE_FILE_32BIT_MACHINE 0x100
#define IMAGE_FILE_DEBUG_STRIPPED 0x200
#define IMAGE_FILE_SYSTEM 0x1000
#define IMAGE_FILE_DLL 0x2000
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
/* These are the settings of the Machine field. */
#define IMAGE_FILE_MACHINE_UNKNOWN 0
#define IMAGE_FILE_MACHINE_I860 0x14d
#define IMAGE_FILE_MACHINE_I386 0x14c
#define IMAGE_FILE_MACHINE_R3000 0x162
#define IMAGE_FILE_MACHINE_R4000 0x166
#define IMAGE_FILE_MACHINE_R10000 0x168
#define IMAGE_FILE_MACHINE_ALPHA 0x184
#define IMAGE_FILE_MACHINE_POWERPC 0x1F0
typedef
struct
_IMAGE_DATA_DIRECTORY
{
DWORD
VirtualAddress
;
DWORD
Size
;
}
IMAGE_DATA_DIRECTORY
,
*
PIMAGE_DATA_DIRECTORY
;
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
/* Optional coff header - used by NT to provide additional information. */
typedef
struct
_IMAGE_OPTIONAL_HEADER
{
/*
* Standard fields.
*/
WORD
Magic
;
/* 00 */
BYTE
MajorLinkerVersion
;
/* 02 */
BYTE
MinorLinkerVersion
;
/* 03 */
DWORD
SizeOfCode
;
/* 04 */
DWORD
SizeOfInitializedData
;
/* 08 */
DWORD
SizeOfUninitializedData
;
/* 0C */
DWORD
AddressOfEntryPoint
;
/* 10 */
DWORD
BaseOfCode
;
/* 14 */
DWORD
BaseOfData
;
/* 18 */
/*
* NT additional fields.
*/
DWORD
ImageBase
;
/* 1C */
DWORD
SectionAlignment
;
/* 20 */
DWORD
FileAlignment
;
/* 24 */
WORD
MajorOperatingSystemVersion
;
/* 28 */
WORD
MinorOperatingSystemVersion
;
/* 2A */
WORD
MajorImageVersion
;
/* 2C */
WORD
MinorImageVersion
;
/* 2E */
WORD
MajorSubsystemVersion
;
/* 30 */
WORD
MinorSubsystemVersion
;
/* 32 */
DWORD
Reserved1
;
/* 34 */
DWORD
SizeOfImage
;
/* 38 */
DWORD
SizeOfHeaders
;
/* 3C */
DWORD
CheckSum
;
/* 40 */
WORD
Subsystem
;
/* 44 */
WORD
DllCharacteristics
;
/* 46 */
DWORD
SizeOfStackReserve
;
/* 48 */
DWORD
SizeOfStackCommit
;
/* 4C */
DWORD
SizeOfHeapReserve
;
/* 50 */
DWORD
SizeOfHeapCommit
;
/* 54 */
DWORD
LoaderFlags
;
/* 58 */
DWORD
NumberOfRvaAndSizes
;
/* 5C */
/* 60: */
IMAGE_DATA_DIRECTORY
DataDirectory
[
IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
}
IMAGE_OPTIONAL_HEADER
,
*
PIMAGE_OPTIONAL_HEADER
;
/* Possible Magic values */
#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
/* These are indexes into the DataDirectory array */
#define IMAGE_FILE_EXPORT_DIRECTORY 0
#define IMAGE_FILE_IMPORT_DIRECTORY 1
#define IMAGE_FILE_RESOURCE_DIRECTORY 2
#define IMAGE_FILE_EXCEPTION_DIRECTORY 3
#define IMAGE_FILE_SECURITY_DIRECTORY 4
#define IMAGE_FILE_BASE_RELOCATION_TABLE 5
#define IMAGE_FILE_DEBUG_DIRECTORY 6
#define IMAGE_FILE_DESCRIPTION_STRING 7
#define IMAGE_FILE_MACHINE_VALUE 8
/* Mips */
#define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
#define IMAGE_FILE_CALLBACK_DIRECTORY 10
/* Directory Entries, indices into the DataDirectory array */
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
/* (MIPS GP) */
#define IMAGE_DIRECTORY_ENTRY_TLS 9
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
#define IMAGE_DIRECTORY_ENTRY_IAT 12
/* Import Address Table */
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
/* Subsystem Values */
#define IMAGE_SUBSYSTEM_UNKNOWN 0
#define IMAGE_SUBSYSTEM_NATIVE 1
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
/* Windows GUI subsystem */
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
/* Windows character subsystem*/
#define IMAGE_SUBSYSTEM_OS2_CUI 5
#define IMAGE_SUBSYSTEM_POSIX_CUI 7
typedef
struct
_IMAGE_NT_HEADERS
{
DWORD
Signature
;
/* 00: PE\0\0 */
IMAGE_FILE_HEADER
FileHeader
;
/* 04: Fileheader */
IMAGE_OPTIONAL_HEADER
OptionalHeader
;
/* 18: Optional Header */
}
IMAGE_NT_HEADERS
,
*
PIMAGE_NT_HEADERS
;
#define PE_HEADER(module) \
((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
(((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
#define PE_SECTIONS(module) \
((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
#define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
/* Section header format */
#define IMAGE_SIZEOF_SHORT_NAME 8
typedef
struct
_IMAGE_SECTION_HEADER
{
BYTE
Name
[
IMAGE_SIZEOF_SHORT_NAME
];
/* 00: */
union
{
DWORD
PhysicalAddress
;
/* 04: */
DWORD
VirtualSize
;
/* 04: */
}
Misc
;
DWORD
VirtualAddress
;
/* 08: */
DWORD
SizeOfRawData
;
/* 0C: */
DWORD
PointerToRawData
;
/* 10: */
DWORD
PointerToRelocations
;
/* 14: */
DWORD
PointerToLinenumbers
;
/* 18: */
WORD
NumberOfRelocations
;
/* 1C: */
WORD
NumberOfLinenumbers
;
/* 1E: */
DWORD
Characteristics
;
/* 20: */
/* 24: */
}
IMAGE_SECTION_HEADER
,
*
PIMAGE_SECTION_HEADER
;
#define IMAGE_SIZEOF_SECTION_HEADER 40
/* These defines are for the Characteristics bitfield. */
/* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
/* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
/* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
/* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
/* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
/* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
#define IMAGE_SCN_CNT_CODE 0x00000020
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
#define IMAGE_SCN_LNK_OTHER 0x00000100
#define IMAGE_SCN_LNK_INFO 0x00000200
/* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
#define IMAGE_SCN_LNK_REMOVE 0x00000800
#define IMAGE_SCN_LNK_COMDAT 0x00001000
/* 0x00002000 - Reserved */
/* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
#define IMAGE_SCN_MEM_FARDATA 0x00008000
/* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
#define IMAGE_SCN_MEM_16BIT 0x00020000
#define IMAGE_SCN_MEM_LOCKED 0x00040000
#define IMAGE_SCN_MEM_PRELOAD 0x00080000
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000
/* Default */
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
/* 0x00800000 - Unused */
#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
#define IMAGE_SCN_MEM_SHARED 0x10000000
#define IMAGE_SCN_MEM_EXECUTE 0x20000000
#define IMAGE_SCN_MEM_READ 0x40000000
#define IMAGE_SCN_MEM_WRITE 0x80000000
/* Import name entry */
typedef
struct
_IMAGE_IMPORT_BY_NAME
{
WORD
Hint
;
BYTE
Name
[
1
];
}
IMAGE_IMPORT_BY_NAME
,
*
PIMAGE_IMPORT_BY_NAME
;
/* Import thunk */
typedef
struct
_IMAGE_THUNK_DATA
{
union
{
LPBYTE
ForwarderString
;
FARPROC
Function
;
DWORD
Ordinal
;
PIMAGE_IMPORT_BY_NAME
AddressOfData
;
}
u1
;
}
IMAGE_THUNK_DATA
,
*
PIMAGE_THUNK_DATA
;
/* Import module directory */
typedef
struct
_IMAGE_IMPORT_DESCRIPTOR
{
union
{
DWORD
Characteristics
;
/* 0 for terminating null import descriptor */
PIMAGE_THUNK_DATA
OriginalFirstThunk
;
/* RVA to original unbound IAT */
}
u
;
DWORD
TimeDateStamp
;
/* 0 if not bound,
* -1 if bound, and real date\time stamp
* in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
* (new BIND)
* otherwise date/time stamp of DLL bound to
* (Old BIND)
*/
DWORD
ForwarderChain
;
/* -1 if no forwarders */
DWORD
Name
;
/* RVA to IAT (if bound this IAT has actual addresses) */
PIMAGE_THUNK_DATA
FirstThunk
;
}
IMAGE_IMPORT_DESCRIPTOR
,
*
PIMAGE_IMPORT_DESCRIPTOR
;
#define IMAGE_ORDINAL_FLAG 0x80000000
#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
/* Export module directory */
typedef
struct
_IMAGE_EXPORT_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
Name
;
DWORD
Base
;
DWORD
NumberOfFunctions
;
DWORD
NumberOfNames
;
LPDWORD
*
AddressOfFunctions
;
LPDWORD
*
AddressOfNames
;
LPWORD
*
AddressOfNameOrdinals
;
/* u_char ModuleName[1]; */
}
IMAGE_EXPORT_DIRECTORY
,
*
PIMAGE_EXPORT_DIRECTORY
;
/*
* Resource directory stuff
*/
typedef
struct
_IMAGE_RESOURCE_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
WORD
NumberOfNamedEntries
;
WORD
NumberOfIdEntries
;
/* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
}
IMAGE_RESOURCE_DIRECTORY
,
*
PIMAGE_RESOURCE_DIRECTORY
;
#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
typedef
struct
_IMAGE_RESOURCE_DIRECTORY_ENTRY
{
union
{
struct
{
unsigned
NameOffset
:
31
;
unsigned
NameIsString
:
1
;
}
s
;
DWORD
Name
;
WORD
Id
;
}
u1
;
union
{
DWORD
OffsetToData
;
struct
{
unsigned
OffsetToDirectory
:
31
;
unsigned
DataIsDirectory
:
1
;
}
s
;
}
u2
;
}
IMAGE_RESOURCE_DIRECTORY_ENTRY
,
*
PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
typedef
struct
_IMAGE_RESOURCE_DIRECTORY_STRING
{
WORD
Length
;
CHAR
NameString
[
1
];
}
IMAGE_RESOURCE_DIRECTORY_STRING
,
*
PIMAGE_RESOURCE_DIRECTORY_STRING
;
typedef
struct
_IMAGE_RESOURCE_DIR_STRING_U
{
WORD
Length
;
WCHAR
NameString
[
1
];
}
IMAGE_RESOURCE_DIR_STRING_U
,
*
PIMAGE_RESOURCE_DIR_STRING_U
;
typedef
struct
_IMAGE_RESOURCE_DATA_ENTRY
{
DWORD
OffsetToData
;
DWORD
Size
;
DWORD
CodePage
;
DWORD
ResourceHandle
;
}
IMAGE_RESOURCE_DATA_ENTRY
,
*
PIMAGE_RESOURCE_DATA_ENTRY
;
typedef
struct
_IMAGE_BASE_RELOCATION
{
DWORD
VirtualAddress
;
DWORD
SizeOfBlock
;
WORD
TypeOffset
[
1
];
}
IMAGE_BASE_RELOCATION
,
*
PIMAGE_BASE_RELOCATION
;
typedef
struct
_IMAGE_LOAD_CONFIG_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
GlobalFlagsClear
;
DWORD
GlobalFlagsSet
;
DWORD
CriticalSectionDefaultTimeout
;
DWORD
DeCommitFreeBlockThreshold
;
DWORD
DeCommitTotalFreeThreshold
;
LPVOID
LockPrefixTable
;
DWORD
MaximumAllocationSize
;
DWORD
VirtualMemoryThreshold
;
DWORD
ProcessHeapFlags
;
DWORD
Reserved
[
4
];
}
IMAGE_LOAD_CONFIG_DIRECTORY
,
*
PIMAGE_LOAD_CONFIG_DIRECTORY
;
typedef
VOID
(
CALLBACK
*
PIMAGE_TLS_CALLBACK
)(
LPVOID
DllHandle
,
DWORD
Reason
,
LPVOID
Reserved
);
typedef
struct
_IMAGE_TLS_DIRECTORY
{
DWORD
StartAddressOfRawData
;
DWORD
EndAddressOfRawData
;
LPDWORD
AddressOfIndex
;
PIMAGE_TLS_CALLBACK
*
AddressOfCallBacks
;
DWORD
SizeOfZeroFill
;
DWORD
Characteristics
;
}
IMAGE_TLS_DIRECTORY
,
*
PIMAGE_TLS_DIRECTORY
;
/*
* The IMAGE_DEBUG_DIRECTORY data directory points to an array of
* these structures.
*/
typedef
struct
_IMAGE_DEBUG_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
Type
;
DWORD
SizeOfData
;
DWORD
AddressOfRawData
;
DWORD
PointerToRawData
;
}
IMAGE_DEBUG_DIRECTORY
,
*
PIMAGE_DEBUG_DIRECTORY
;
/*
* The type field above can take these (plus a few other
* irrelevant) values.
*/
#define IMAGE_DEBUG_TYPE_UNKNOWN 0
#define IMAGE_DEBUG_TYPE_COFF 1
#define IMAGE_DEBUG_TYPE_CODEVIEW 2
#define IMAGE_DEBUG_TYPE_FPO 3
#define IMAGE_DEBUG_TYPE_MISC 4
#define IMAGE_DEBUG_TYPE_EXCEPTION 5
#define IMAGE_DEBUG_TYPE_FIXUP 6
#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
/* generic relocation types */
#define IMAGE_REL_BASED_ABSOLUTE 0
#define IMAGE_REL_BASED_HIGH 1
#define IMAGE_REL_BASED_LOW 2
#define IMAGE_REL_BASED_HIGHLOW 3
#define IMAGE_REL_BASED_HIGHADJ 4
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
#define IMAGE_REL_BASED_SECTION 6
#define IMAGE_REL_BASED_REL 7
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
#define IMAGE_REL_BASED_IA64_IMM64 9
/* yes, 9 too */
#define IMAGE_REL_BASED_DIR64 10
#define IMAGE_REL_BASED_HIGH3ADJ 11
/* I386 relocation types */
#define IMAGE_REL_I386_ABSOLUTE 0
#define IMAGE_REL_I386_DIR16 1
#define IMAGE_REL_I386_REL16 2
#define IMAGE_REL_I386_DIR 6
#define IMAGE_REL_I386_DIR32NB 7
#define IMAGE_REL_I386_SEG12 9
#define IMAGE_REL_I386_SECTION 10
#define IMAGE_REL_I386_SECREL 11
#define IMAGE_REL_I386_REL 20
/* MIPS relocation types */
#define IMAGE_REL_MIPS_ABSOLUTE 0x0000
#define IMAGE_REL_MIPS_REFHALF 0x0001
#define IMAGE_REL_MIPS_REFWORD 0x0002
#define IMAGE_REL_MIPS_JMPADDR 0x0003
#define IMAGE_REL_MIPS_REFHI 0x0004
#define IMAGE_REL_MIPS_REFLO 0x0005
#define IMAGE_REL_MIPS_GPREL 0x0006
#define IMAGE_REL_MIPS_LITERAL 0x0007
#define IMAGE_REL_MIPS_SECTION 0x000A
#define IMAGE_REL_MIPS_SECREL 0x000B
#define IMAGE_REL_MIPS_SECRELLO 0x000C
#define IMAGE_REL_MIPS_SECRELHI 0x000D
#define IMAGE_REL_MIPS_JMPADDR16 0x0010
#define IMAGE_REL_MIPS_REFWORDNB 0x0022
#define IMAGE_REL_MIPS_PAIR 0x0025
/* ALPHA relocation types */
#define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
#define IMAGE_REL_ALPHA_REFLONG 0x0001
#define IMAGE_REL_ALPHA_REFQUAD 0x0002
#define IMAGE_REL_ALPHA_GPREL 0x0003
#define IMAGE_REL_ALPHA_LITERAL 0x0004
#define IMAGE_REL_ALPHA_LITUSE 0x0005
#define IMAGE_REL_ALPHA_GPDISP 0x0006
#define IMAGE_REL_ALPHA_BRADDR 0x0007
#define IMAGE_REL_ALPHA_HINT 0x0008
#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
#define IMAGE_REL_ALPHA_REFHI 0x000A
#define IMAGE_REL_ALPHA_REFLO 0x000B
#define IMAGE_REL_ALPHA_PAIR 0x000C
#define IMAGE_REL_ALPHA_MATCH 0x000D
#define IMAGE_REL_ALPHA_SECTION 0x000E
#define IMAGE_REL_ALPHA_SECREL 0x000F
#define IMAGE_REL_ALPHA_REFLONGNB 0x0010
#define IMAGE_REL_ALPHA_SECRELLO 0x0011
#define IMAGE_REL_ALPHA_SECRELHI 0x0012
#define IMAGE_REL_ALPHA_REFQ3 0x0013
#define IMAGE_REL_ALPHA_REFQ2 0x0014
#define IMAGE_REL_ALPHA_REFQ1 0x0015
#define IMAGE_REL_ALPHA_GPRELLO 0x0016
#define IMAGE_REL_ALPHA_GPRELHI 0x0017
/* PowerPC relocation types */
#define IMAGE_REL_PPC_ABSOLUTE 0x0000
#define IMAGE_REL_PPC_ADDR64 0x0001
#define IMAGE_REL_PPC_ADDR 0x0002
#define IMAGE_REL_PPC_ADDR24 0x0003
#define IMAGE_REL_PPC_ADDR16 0x0004
#define IMAGE_REL_PPC_ADDR14 0x0005
#define IMAGE_REL_PPC_REL24 0x0006
#define IMAGE_REL_PPC_REL14 0x0007
#define IMAGE_REL_PPC_TOCREL16 0x0008
#define IMAGE_REL_PPC_TOCREL14 0x0009
#define IMAGE_REL_PPC_ADDR32NB 0x000A
#define IMAGE_REL_PPC_SECREL 0x000B
#define IMAGE_REL_PPC_SECTION 0x000C
#define IMAGE_REL_PPC_IFGLUE 0x000D
#define IMAGE_REL_PPC_IMGLUE 0x000E
#define IMAGE_REL_PPC_SECREL16 0x000F
#define IMAGE_REL_PPC_REFHI 0x0010
#define IMAGE_REL_PPC_REFLO 0x0011
#define IMAGE_REL_PPC_PAIR 0x0012
#define IMAGE_REL_PPC_SECRELLO 0x0013
#define IMAGE_REL_PPC_SECRELHI 0x0014
#define IMAGE_REL_PPC_GPREL 0x0015
#define IMAGE_REL_PPC_TYPEMASK 0x00FF
/* modifier bits */
#define IMAGE_REL_PPC_NEG 0x0100
#define IMAGE_REL_PPC_BRTAKEN 0x0200
#define IMAGE_REL_PPC_BRNTAKEN 0x0400
#define IMAGE_REL_PPC_TOCDEFN 0x0800
/* SH3 ? relocation type */
#define IMAGE_REL_SH3_ABSOLUTE 0x0000
#define IMAGE_REL_SH3_DIRECT16 0x0001
#define IMAGE_REL_SH3_DIRECT 0x0002
#define IMAGE_REL_SH3_DIRECT8 0x0003
#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
#define IMAGE_REL_SH3_DIRECT4 0x0006
#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
#define IMAGE_REL_SH3_PCREL8_WORD 0x0009
#define IMAGE_REL_SH3_PCREL8_LONG 0x000A
#define IMAGE_REL_SH3_PCREL12_WORD 0x000B
#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
#define IMAGE_REL_SH3_SECTION 0x000E
#define IMAGE_REL_SH3_SECREL 0x000F
#define IMAGE_REL_SH3_DIRECT32_NB 0x0010
/* ARM (Archimedes?) relocation types */
#define IMAGE_REL_ARM_ABSOLUTE 0x0000
#define IMAGE_REL_ARM_ADDR 0x0001
#define IMAGE_REL_ARM_ADDR32NB 0x0002
#define IMAGE_REL_ARM_BRANCH24 0x0003
#define IMAGE_REL_ARM_BRANCH11 0x0004
#define IMAGE_REL_ARM_SECTION 0x000E
#define IMAGE_REL_ARM_SECREL 0x000F
/* IA64 relocation types */
#define IMAGE_REL_IA64_ABSOLUTE 0x0000
#define IMAGE_REL_IA64_IMM14 0x0001
#define IMAGE_REL_IA64_IMM22 0x0002
#define IMAGE_REL_IA64_IMM64 0x0003
#define IMAGE_REL_IA64_DIR 0x0004
#define IMAGE_REL_IA64_DIR64 0x0005
#define IMAGE_REL_IA64_PCREL21B 0x0006
#define IMAGE_REL_IA64_PCREL21M 0x0007
#define IMAGE_REL_IA64_PCREL21F 0x0008
#define IMAGE_REL_IA64_GPREL22 0x0009
#define IMAGE_REL_IA64_LTOFF22 0x000A
#define IMAGE_REL_IA64_SECTION 0x000B
#define IMAGE_REL_IA64_SECREL22 0x000C
#define IMAGE_REL_IA64_SECREL64I 0x000D
#define IMAGE_REL_IA64_SECREL 0x000E
#define IMAGE_REL_IA64_LTOFF64 0x000F
#define IMAGE_REL_IA64_DIR32NB 0x0010
#define IMAGE_REL_IA64_RESERVED_11 0x0011
#define IMAGE_REL_IA64_RESERVED_12 0x0012
#define IMAGE_REL_IA64_RESERVED_13 0x0013
#define IMAGE_REL_IA64_RESERVED_14 0x0014
#define IMAGE_REL_IA64_RESERVED_15 0x0015
#define IMAGE_REL_IA64_RESERVED_16 0x0016
#define IMAGE_REL_IA64_ADDEND 0x001F
/*
* This is the structure that appears at the very start of a .DBG file.
*/
typedef
struct
_IMAGE_SEPARATE_DEBUG_HEADER
{
WORD
Signature
;
WORD
Flags
;
WORD
Machine
;
WORD
Characteristics
;
DWORD
TimeDateStamp
;
DWORD
CheckSum
;
DWORD
ImageBase
;
DWORD
SizeOfImage
;
DWORD
NumberOfSections
;
DWORD
ExportedNamesSize
;
DWORD
DebugDirectorySize
;
DWORD
Reserved
[
3
];
}
IMAGE_SEPARATE_DEBUG_HEADER
,
*
PIMAGE_SEPARATE_DEBUG_HEADER
;
#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
typedef
struct
tagMESSAGE_RESOURCE_ENTRY
{
WORD
Length
;
WORD
Flags
;
BYTE
Text
[
1
];
}
MESSAGE_RESOURCE_ENTRY
,
*
PMESSAGE_RESOURCE_ENTRY
;
#define MESSAGE_RESOURCE_UNICODE 0x0001
typedef
struct
tagMESSAGE_RESOURCE_BLOCK
{
DWORD
LowId
;
DWORD
HighId
;
DWORD
OffsetToEntries
;
}
MESSAGE_RESOURCE_BLOCK
,
*
PMESSAGE_RESOURCE_BLOCK
;
typedef
struct
tagMESSAGE_RESOURCE_DATA
{
DWORD
NumberOfBlocks
;
MESSAGE_RESOURCE_BLOCK
Blocks
[
1
];
}
MESSAGE_RESOURCE_DATA
,
*
PMESSAGE_RESOURCE_DATA
;
#endif
/* __WINE_PEEXE_H */
include/winnt.h
View file @
180a088b
...
...
@@ -1081,6 +1081,959 @@ extern inline struct _TEB * WINAPI NtCurrentTeb(void)
extern
struct
_TEB
*
WINAPI
NtCurrentTeb
(
void
);
#endif
/*
* File formats definitions
*/
typedef
struct
_IMAGE_DOS_HEADER
{
WORD
e_magic
;
/* 00: MZ Header signature */
WORD
e_cblp
;
/* 02: Bytes on last page of file */
WORD
e_cp
;
/* 04: Pages in file */
WORD
e_crlc
;
/* 06: Relocations */
WORD
e_cparhdr
;
/* 08: Size of header in paragraphs */
WORD
e_minalloc
;
/* 0a: Minimum extra paragraphs needed */
WORD
e_maxalloc
;
/* 0c: Maximum extra paragraphs needed */
WORD
e_ss
;
/* 0e: Initial (relative) SS value */
WORD
e_sp
;
/* 10: Initial SP value */
WORD
e_csum
;
/* 12: Checksum */
WORD
e_ip
;
/* 14: Initial IP value */
WORD
e_cs
;
/* 16: Initial (relative) CS value */
WORD
e_lfarlc
;
/* 18: File address of relocation table */
WORD
e_ovno
;
/* 1a: Overlay number */
WORD
e_res
[
4
];
/* 1c: Reserved words */
WORD
e_oemid
;
/* 24: OEM identifier (for e_oeminfo) */
WORD
e_oeminfo
;
/* 26: OEM information; e_oemid specific */
WORD
e_res2
[
10
];
/* 28: Reserved words */
DWORD
e_lfanew
;
/* 3c: Offset to extended header */
}
IMAGE_DOS_HEADER
,
*
PIMAGE_DOS_HEADER
;
#define IMAGE_DOS_SIGNATURE 0x5A4D
/* MZ */
#define IMAGE_OS2_SIGNATURE 0x454E
/* NE */
#define IMAGE_OS2_SIGNATURE_LE 0x454C
/* LE */
#define IMAGE_OS2_SIGNATURE_LX 0x584C
/* LX */
#define IMAGE_VXD_SIGNATURE 0x454C
/* LE */
#define IMAGE_NT_SIGNATURE 0x00004550
/* PE00 */
/*
* This is the Windows executable (NE) header.
* the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
*/
typedef
struct
{
WORD
ne_magic
;
/* 00 NE signature 'NE' */
BYTE
ne_ver
;
/* 02 Linker version number */
BYTE
ne_rev
;
/* 03 Linker revision number */
WORD
ne_enttab
;
/* 04 Offset to entry table relative to NE */
WORD
ne_cbenttab
;
/* 06 Length of entry table in bytes */
LONG
ne_crc
;
/* 08 Checksum */
WORD
ne_flags
;
/* 0c Flags about segments in this file */
WORD
ne_autodata
;
/* 0e Automatic data segment number */
WORD
ne_heap
;
/* 10 Initial size of local heap */
WORD
ne_stack
;
/* 12 Initial size of stack */
DWORD
ne_csip
;
/* 14 Initial CS:IP */
DWORD
ne_sssp
;
/* 18 Initial SS:SP */
WORD
ne_cseg
;
/* 1c # of entries in segment table */
WORD
ne_cmod
;
/* 1e # of entries in module reference tab. */
WORD
ne_cbnrestab
;
/* 20 Length of nonresident-name table */
WORD
ne_segtab
;
/* 22 Offset to segment table */
WORD
ne_rsrctab
;
/* 24 Offset to resource table */
WORD
ne_restab
;
/* 26 Offset to resident-name table */
WORD
ne_modtab
;
/* 28 Offset to module reference table */
WORD
ne_imptab
;
/* 2a Offset to imported name table */
DWORD
ne_nrestab
;
/* 2c Offset to nonresident-name table */
WORD
ne_cmovent
;
/* 30 # of movable entry points */
WORD
ne_align
;
/* 32 Logical sector alignment shift count */
WORD
ne_cres
;
/* 34 # of resource segments */
BYTE
ne_exetyp
;
/* 36 Flags indicating target OS */
BYTE
ne_flagsothers
;
/* 37 Additional information flags */
WORD
fastload_offset
;
/* 38 Offset to fast load area (should be ne_pretthunks)*/
WORD
fastload_length
;
/* 3a Length of fast load area (should be ne_psegrefbytes) */
WORD
ne_swaparea
;
/* 3c Reserved by Microsoft */
WORD
ne_expver
;
/* 3e Expected Windows version number */
}
IMAGE_OS2_HEADER
,
*
PIMAGE_OS2_HEADER
;
typedef
struct
_IMAGE_VXD_HEADER
{
WORD
e32_magic
;
BYTE
e32_border
;
BYTE
e32_worder
;
DWORD
e32_level
;
WORD
e32_cpu
;
WORD
e32_os
;
DWORD
e32_ver
;
DWORD
e32_mflags
;
DWORD
e32_mpages
;
DWORD
e32_startobj
;
DWORD
e32_eip
;
DWORD
e32_stackobj
;
DWORD
e32_esp
;
DWORD
e32_pagesize
;
DWORD
e32_lastpagesize
;
DWORD
e32_fixupsize
;
DWORD
e32_fixupsum
;
DWORD
e32_ldrsize
;
DWORD
e32_ldrsum
;
DWORD
e32_objtab
;
DWORD
e32_objcnt
;
DWORD
e32_objmap
;
DWORD
e32_itermap
;
DWORD
e32_rsrctab
;
DWORD
e32_rsrccnt
;
DWORD
e32_restab
;
DWORD
e32_enttab
;
DWORD
e32_dirtab
;
DWORD
e32_dircnt
;
DWORD
e32_fpagetab
;
DWORD
e32_frectab
;
DWORD
e32_impmod
;
DWORD
e32_impmodcnt
;
DWORD
e32_impproc
;
DWORD
e32_pagesum
;
DWORD
e32_datapage
;
DWORD
e32_preload
;
DWORD
e32_nrestab
;
DWORD
e32_cbnrestab
;
DWORD
e32_nressum
;
DWORD
e32_autodata
;
DWORD
e32_debuginfo
;
DWORD
e32_debuglen
;
DWORD
e32_instpreload
;
DWORD
e32_instdemand
;
DWORD
e32_heapsize
;
BYTE
e32_res3
[
12
];
DWORD
e32_winresoff
;
DWORD
e32_winreslen
;
WORD
e32_devid
;
WORD
e32_ddkver
;
}
IMAGE_VXD_HEADER
,
*
PIMAGE_VXD_HEADER
;
/* These defines describe the meanings of the bits in the Characteristics
field */
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
/* No relocation info */
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
#define IMAGE_FILE_16BIT_MACHINE 0x0040
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
#define IMAGE_FILE_32BIT_MACHINE 0x0100
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
#define IMAGE_FILE_SYSTEM 0x1000
#define IMAGE_FILE_DLL 0x2000
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
/* These are the settings of the Machine field. */
#define IMAGE_FILE_MACHINE_UNKNOWN 0
#define IMAGE_FILE_MACHINE_I860 0x14d
#define IMAGE_FILE_MACHINE_I386 0x14c
#define IMAGE_FILE_MACHINE_R3000 0x162
#define IMAGE_FILE_MACHINE_R4000 0x166
#define IMAGE_FILE_MACHINE_R10000 0x168
#define IMAGE_FILE_MACHINE_ALPHA 0x184
#define IMAGE_FILE_MACHINE_POWERPC 0x1F0
#define IMAGE_SIZEOF_FILE_HEADER 20
/* Possible Magic values */
#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
/* These are indexes into the DataDirectory array */
#define IMAGE_FILE_EXPORT_DIRECTORY 0
#define IMAGE_FILE_IMPORT_DIRECTORY 1
#define IMAGE_FILE_RESOURCE_DIRECTORY 2
#define IMAGE_FILE_EXCEPTION_DIRECTORY 3
#define IMAGE_FILE_SECURITY_DIRECTORY 4
#define IMAGE_FILE_BASE_RELOCATION_TABLE 5
#define IMAGE_FILE_DEBUG_DIRECTORY 6
#define IMAGE_FILE_DESCRIPTION_STRING 7
#define IMAGE_FILE_MACHINE_VALUE 8
/* Mips */
#define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
#define IMAGE_FILE_CALLBACK_DIRECTORY 10
/* Directory Entries, indices into the DataDirectory array */
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
/* (MIPS GP) */
#define IMAGE_DIRECTORY_ENTRY_TLS 9
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
#define IMAGE_DIRECTORY_ENTRY_IAT 12
/* Import Address Table */
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
/* Subsystem Values */
#define IMAGE_SUBSYSTEM_UNKNOWN 0
#define IMAGE_SUBSYSTEM_NATIVE 1
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
/* Windows GUI subsystem */
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
/* Windows character subsystem*/
#define IMAGE_SUBSYSTEM_OS2_CUI 5
#define IMAGE_SUBSYSTEM_POSIX_CUI 7
typedef
struct
_IMAGE_FILE_HEADER
{
WORD
Machine
;
WORD
NumberOfSections
;
DWORD
TimeDateStamp
;
DWORD
PointerToSymbolTable
;
DWORD
NumberOfSymbols
;
WORD
SizeOfOptionalHeader
;
WORD
Characteristics
;
}
IMAGE_FILE_HEADER
,
*
PIMAGE_FILE_HEADER
;
typedef
struct
_IMAGE_DATA_DIRECTORY
{
DWORD
VirtualAddress
;
DWORD
Size
;
}
IMAGE_DATA_DIRECTORY
,
*
PIMAGE_DATA_DIRECTORY
;
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
typedef
struct
_IMAGE_OPTIONAL_HEADER
{
/* Standard fields */
WORD
Magic
;
BYTE
MajorLinkerVersion
;
BYTE
MinorLinkerVersion
;
DWORD
SizeOfCode
;
DWORD
SizeOfInitializedData
;
DWORD
SizeOfUninitializedData
;
DWORD
AddressOfEntryPoint
;
DWORD
BaseOfCode
;
DWORD
BaseOfData
;
/* NT additional fields */
DWORD
ImageBase
;
DWORD
SectionAlignment
;
DWORD
FileAlignment
;
WORD
MajorOperatingSystemVersion
;
WORD
MinorOperatingSystemVersion
;
WORD
MajorImageVersion
;
WORD
MinorImageVersion
;
WORD
MajorSubsystemVersion
;
WORD
MinorSubsystemVersion
;
DWORD
Win32VersionValue
;
DWORD
SizeOfImage
;
DWORD
SizeOfHeaders
;
DWORD
CheckSum
;
WORD
Subsystem
;
WORD
DllCharacteristics
;
DWORD
SizeOfStackReserve
;
DWORD
SizeOfStackCommit
;
DWORD
SizeOfHeapReserve
;
DWORD
SizeOfHeapCommit
;
DWORD
LoaderFlags
;
DWORD
NumberOfRvaAndSizes
;
IMAGE_DATA_DIRECTORY
DataDirectory
[
IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
}
IMAGE_OPTIONAL_HEADER
,
*
PIMAGE_OPTIONAL_HEADER
;
typedef
struct
_IMAGE_NT_HEADERS
{
DWORD
Signature
;
IMAGE_FILE_HEADER
FileHeader
;
IMAGE_OPTIONAL_HEADER
OptionalHeader
;
}
IMAGE_NT_HEADERS
,
*
PIMAGE_NT_HEADERS
;
#define IMAGE_SIZEOF_SHORT_NAME 8
typedef
struct
_IMAGE_SECTION_HEADER
{
BYTE
Name
[
IMAGE_SIZEOF_SHORT_NAME
];
union
{
DWORD
PhysicalAddress
;
DWORD
VirtualSize
;
}
Misc
;
DWORD
VirtualAddress
;
DWORD
SizeOfRawData
;
DWORD
PointerToRawData
;
DWORD
PointerToRelocations
;
DWORD
PointerToLinenumbers
;
WORD
NumberOfRelocations
;
WORD
NumberOfLinenumbers
;
DWORD
Characteristics
;
}
IMAGE_SECTION_HEADER
,
*
PIMAGE_SECTION_HEADER
;
#define IMAGE_SIZEOF_SECTION_HEADER 40
#define IMAGE_FIRST_SECTION(ntheader) \
((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
/* These defines are for the Characteristics bitfield. */
/* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
/* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
/* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
/* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
/* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
/* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
#define IMAGE_SCN_CNT_CODE 0x00000020
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
#define IMAGE_SCN_LNK_OTHER 0x00000100
#define IMAGE_SCN_LNK_INFO 0x00000200
/* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
#define IMAGE_SCN_LNK_REMOVE 0x00000800
#define IMAGE_SCN_LNK_COMDAT 0x00001000
/* 0x00002000 - Reserved */
/* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
#define IMAGE_SCN_MEM_FARDATA 0x00008000
/* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
#define IMAGE_SCN_MEM_16BIT 0x00020000
#define IMAGE_SCN_MEM_LOCKED 0x00040000
#define IMAGE_SCN_MEM_PRELOAD 0x00080000
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000
/* Default */
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
/* 0x00800000 - Unused */
#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
#define IMAGE_SCN_MEM_SHARED 0x10000000
#define IMAGE_SCN_MEM_EXECUTE 0x20000000
#define IMAGE_SCN_MEM_READ 0x40000000
#define IMAGE_SCN_MEM_WRITE 0x80000000
#include "pshpack2.h"
typedef
struct
_IMAGE_SYMBOL
{
union
{
BYTE
ShortName
[
8
];
struct
{
DWORD
Short
;
DWORD
Long
;
}
Name
;
DWORD
LongName
[
2
];
}
N
;
DWORD
Value
;
SHORT
SectionNumber
;
WORD
Type
;
BYTE
StorageClass
;
BYTE
NumberOfAuxSymbols
;
}
IMAGE_SYMBOL
;
typedef
IMAGE_SYMBOL
*
PIMAGE_SYMBOL
;
#define IMAGE_SIZEOF_SYMBOL 18
typedef
struct
_IMAGE_LINENUMBER
{
union
{
DWORD
SymbolTableIndex
;
DWORD
VirtualAddress
;
}
Type
;
WORD
Linenumber
;
}
IMAGE_LINENUMBER
;
typedef
IMAGE_LINENUMBER
*
PIMAGE_LINENUMBER
;
#define IMAGE_SIZEOF_LINENUMBER 6
typedef
union
_IMAGE_AUX_SYMBOL
{
struct
{
DWORD
TagIndex
;
union
{
struct
{
WORD
Linenumber
;
WORD
Size
;
}
LnSz
;
DWORD
TotalSize
;
}
Misc
;
union
{
struct
{
DWORD
PointerToLinenumber
;
DWORD
PointerToNextFunction
;
}
Function
;
struct
{
WORD
Dimension
[
4
];
}
Array
;
}
FcnAry
;
WORD
TvIndex
;
}
Sym
;
struct
{
BYTE
Name
[
IMAGE_SIZEOF_SYMBOL
];
}
File
;
struct
{
DWORD
Length
;
WORD
NumberOfRelocations
;
WORD
NumberOfLinenumbers
;
DWORD
CheckSum
;
SHORT
Number
;
BYTE
Selection
;
}
Section
;
}
IMAGE_AUX_SYMBOL
;
typedef
IMAGE_AUX_SYMBOL
*
PIMAGE_AUX_SYMBOL
;
#define IMAGE_SIZEOF_AUX_SYMBOL 18
#include "poppack.h"
#define IMAGE_SYM_UNDEFINED (SHORT)0
#define IMAGE_SYM_ABSOLUTE (SHORT)-1
#define IMAGE_SYM_DEBUG (SHORT)-2
#define IMAGE_SYM_TYPE_NULL 0x0000
#define IMAGE_SYM_TYPE_VOID 0x0001
#define IMAGE_SYM_TYPE_CHAR 0x0002
#define IMAGE_SYM_TYPE_SHORT 0x0003
#define IMAGE_SYM_TYPE_INT 0x0004
#define IMAGE_SYM_TYPE_LONG 0x0005
#define IMAGE_SYM_TYPE_FLOAT 0x0006
#define IMAGE_SYM_TYPE_DOUBLE 0x0007
#define IMAGE_SYM_TYPE_STRUCT 0x0008
#define IMAGE_SYM_TYPE_UNION 0x0009
#define IMAGE_SYM_TYPE_ENUM 0x000A
#define IMAGE_SYM_TYPE_MOE 0x000B
#define IMAGE_SYM_TYPE_BYTE 0x000C
#define IMAGE_SYM_TYPE_WORD 0x000D
#define IMAGE_SYM_TYPE_UINT 0x000E
#define IMAGE_SYM_TYPE_DWORD 0x000F
#define IMAGE_SYM_TYPE_PCODE 0x8000
#define IMAGE_SYM_DTYPE_NULL 0
#define IMAGE_SYM_DTYPE_POINTER 1
#define IMAGE_SYM_DTYPE_FUNCTION 2
#define IMAGE_SYM_DTYPE_ARRAY 3
#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
#define IMAGE_SYM_CLASS_NULL 0x0000
#define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
#define IMAGE_SYM_CLASS_EXTERNAL 0x0002
#define IMAGE_SYM_CLASS_STATIC 0x0003
#define IMAGE_SYM_CLASS_REGISTER 0x0004
#define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
#define IMAGE_SYM_CLASS_LABEL 0x0006
#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
#define IMAGE_SYM_CLASS_ARGUMENT 0x0009
#define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
#define IMAGE_SYM_CLASS_UNION_TAG 0x000C
#define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
#define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
#define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
#define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
#define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
#define IMAGE_SYM_CLASS_BLOCK 0x0064
#define IMAGE_SYM_CLASS_FUNCTION 0x0065
#define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
#define IMAGE_SYM_CLASS_FILE 0x0067
#define IMAGE_SYM_CLASS_SECTION 0x0068
#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
#define N_BTMASK 0x000F
#define N_TMASK 0x0030
#define N_TMASK1 0x00C0
#define N_TMASK2 0x00F0
#define N_BTSHFT 4
#define N_TSHIFT 2
#define BTYPE(x) ((x) & N_BTMASK)
#ifndef ISPTR
#define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
#endif
#ifndef ISFCN
#define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
#endif
#ifndef ISARY
#define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
#endif
#ifndef ISTAG
#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
#endif
#ifndef INCREF
#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
#endif
#ifndef DECREF
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
#endif
#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
#define IMAGE_COMDAT_SELECT_ANY 2
#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
#define IMAGE_COMDAT_SELECT_LARGEST 6
#define IMAGE_COMDAT_SELECT_NEWEST 7
#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
/* Export module directory */
typedef
struct
_IMAGE_EXPORT_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
Name
;
DWORD
Base
;
DWORD
NumberOfFunctions
;
DWORD
NumberOfNames
;
LPDWORD
*
AddressOfFunctions
;
LPDWORD
*
AddressOfNames
;
LPWORD
*
AddressOfNameOrdinals
;
}
IMAGE_EXPORT_DIRECTORY
,
*
PIMAGE_EXPORT_DIRECTORY
;
/* Import name entry */
typedef
struct
_IMAGE_IMPORT_BY_NAME
{
WORD
Hint
;
BYTE
Name
[
1
];
}
IMAGE_IMPORT_BY_NAME
,
*
PIMAGE_IMPORT_BY_NAME
;
/* Import thunk */
typedef
struct
_IMAGE_THUNK_DATA
{
union
{
LPBYTE
ForwarderString
;
FARPROC
Function
;
DWORD
Ordinal
;
PIMAGE_IMPORT_BY_NAME
AddressOfData
;
}
u1
;
}
IMAGE_THUNK_DATA
,
*
PIMAGE_THUNK_DATA
;
/* Import module directory */
typedef
struct
_IMAGE_IMPORT_DESCRIPTOR
{
union
{
DWORD
Characteristics
;
/* 0 for terminating null import descriptor */
PIMAGE_THUNK_DATA
OriginalFirstThunk
;
/* RVA to original unbound IAT */
}
u
;
DWORD
TimeDateStamp
;
/* 0 if not bound,
* -1 if bound, and real date\time stamp
* in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
* (new BIND)
* otherwise date/time stamp of DLL bound to
* (Old BIND)
*/
DWORD
ForwarderChain
;
/* -1 if no forwarders */
DWORD
Name
;
/* RVA to IAT (if bound this IAT has actual addresses) */
PIMAGE_THUNK_DATA
FirstThunk
;
}
IMAGE_IMPORT_DESCRIPTOR
,
*
PIMAGE_IMPORT_DESCRIPTOR
;
#define IMAGE_ORDINAL_FLAG 0x80000000
#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
typedef
struct
_IMAGE_BOUND_IMPORT_DESCRIPTOR
{
DWORD
TimeDateStamp
;
WORD
OffsetModuleName
;
WORD
NumberOfModuleForwarderRefs
;
/* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
}
IMAGE_BOUND_IMPORT_DESCRIPTOR
,
*
PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
typedef
struct
_IMAGE_BOUND_FORWARDER_REF
{
DWORD
TimeDateStamp
;
WORD
OffsetModuleName
;
WORD
Reserved
;
}
IMAGE_BOUND_FORWARDER_REF
,
*
PIMAGE_BOUND_FORWARDER_REF
;
typedef
struct
_IMAGE_BASE_RELOCATION
{
DWORD
VirtualAddress
;
DWORD
SizeOfBlock
;
WORD
TypeOffset
[
1
];
}
IMAGE_BASE_RELOCATION
,
*
PIMAGE_BASE_RELOCATION
;
typedef
struct
_IMAGE_RELOCATION
{
union
{
DWORD
VirtualAddress
;
DWORD
RelocCount
;
}
u
;
DWORD
SymbolTableIndex
;
WORD
Type
;
}
IMAGE_RELOCATION
;
typedef
IMAGE_RELOCATION
*
PIMAGE_RELOCATION
;
#define IMAGE_SIZEOF_RELOCATION 10
/* generic relocation types */
#define IMAGE_REL_BASED_ABSOLUTE 0
#define IMAGE_REL_BASED_HIGH 1
#define IMAGE_REL_BASED_LOW 2
#define IMAGE_REL_BASED_HIGHLOW 3
#define IMAGE_REL_BASED_HIGHADJ 4
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
#define IMAGE_REL_BASED_SECTION 6
#define IMAGE_REL_BASED_REL 7
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
#define IMAGE_REL_BASED_IA64_IMM64 9
/* yes, 9 too */
#define IMAGE_REL_BASED_DIR64 10
#define IMAGE_REL_BASED_HIGH3ADJ 11
/* I386 relocation types */
#define IMAGE_REL_I386_ABSOLUTE 0
#define IMAGE_REL_I386_DIR16 1
#define IMAGE_REL_I386_REL16 2
#define IMAGE_REL_I386_DIR32 6
#define IMAGE_REL_I386_DIR32NB 7
#define IMAGE_REL_I386_SEG12 9
#define IMAGE_REL_I386_SECTION 10
#define IMAGE_REL_I386_SECREL 11
#define IMAGE_REL_I386_REL32 20
/* MIPS relocation types */
#define IMAGE_REL_MIPS_ABSOLUTE 0x0000
#define IMAGE_REL_MIPS_REFHALF 0x0001
#define IMAGE_REL_MIPS_REFWORD 0x0002
#define IMAGE_REL_MIPS_JMPADDR 0x0003
#define IMAGE_REL_MIPS_REFHI 0x0004
#define IMAGE_REL_MIPS_REFLO 0x0005
#define IMAGE_REL_MIPS_GPREL 0x0006
#define IMAGE_REL_MIPS_LITERAL 0x0007
#define IMAGE_REL_MIPS_SECTION 0x000A
#define IMAGE_REL_MIPS_SECREL 0x000B
#define IMAGE_REL_MIPS_SECRELLO 0x000C
#define IMAGE_REL_MIPS_SECRELHI 0x000D
#define IMAGE_REL_MIPS_JMPADDR16 0x0010
#define IMAGE_REL_MIPS_REFWORDNB 0x0022
#define IMAGE_REL_MIPS_PAIR 0x0025
/* ALPHA relocation types */
#define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
#define IMAGE_REL_ALPHA_REFLONG 0x0001
#define IMAGE_REL_ALPHA_REFQUAD 0x0002
#define IMAGE_REL_ALPHA_GPREL 0x0003
#define IMAGE_REL_ALPHA_LITERAL 0x0004
#define IMAGE_REL_ALPHA_LITUSE 0x0005
#define IMAGE_REL_ALPHA_GPDISP 0x0006
#define IMAGE_REL_ALPHA_BRADDR 0x0007
#define IMAGE_REL_ALPHA_HINT 0x0008
#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
#define IMAGE_REL_ALPHA_REFHI 0x000A
#define IMAGE_REL_ALPHA_REFLO 0x000B
#define IMAGE_REL_ALPHA_PAIR 0x000C
#define IMAGE_REL_ALPHA_MATCH 0x000D
#define IMAGE_REL_ALPHA_SECTION 0x000E
#define IMAGE_REL_ALPHA_SECREL 0x000F
#define IMAGE_REL_ALPHA_REFLONGNB 0x0010
#define IMAGE_REL_ALPHA_SECRELLO 0x0011
#define IMAGE_REL_ALPHA_SECRELHI 0x0012
#define IMAGE_REL_ALPHA_REFQ3 0x0013
#define IMAGE_REL_ALPHA_REFQ2 0x0014
#define IMAGE_REL_ALPHA_REFQ1 0x0015
#define IMAGE_REL_ALPHA_GPRELLO 0x0016
#define IMAGE_REL_ALPHA_GPRELHI 0x0017
/* PowerPC relocation types */
#define IMAGE_REL_PPC_ABSOLUTE 0x0000
#define IMAGE_REL_PPC_ADDR64 0x0001
#define IMAGE_REL_PPC_ADDR 0x0002
#define IMAGE_REL_PPC_ADDR24 0x0003
#define IMAGE_REL_PPC_ADDR16 0x0004
#define IMAGE_REL_PPC_ADDR14 0x0005
#define IMAGE_REL_PPC_REL24 0x0006
#define IMAGE_REL_PPC_REL14 0x0007
#define IMAGE_REL_PPC_TOCREL16 0x0008
#define IMAGE_REL_PPC_TOCREL14 0x0009
#define IMAGE_REL_PPC_ADDR32NB 0x000A
#define IMAGE_REL_PPC_SECREL 0x000B
#define IMAGE_REL_PPC_SECTION 0x000C
#define IMAGE_REL_PPC_IFGLUE 0x000D
#define IMAGE_REL_PPC_IMGLUE 0x000E
#define IMAGE_REL_PPC_SECREL16 0x000F
#define IMAGE_REL_PPC_REFHI 0x0010
#define IMAGE_REL_PPC_REFLO 0x0011
#define IMAGE_REL_PPC_PAIR 0x0012
#define IMAGE_REL_PPC_SECRELLO 0x0013
#define IMAGE_REL_PPC_SECRELHI 0x0014
#define IMAGE_REL_PPC_GPREL 0x0015
#define IMAGE_REL_PPC_TYPEMASK 0x00FF
/* modifier bits */
#define IMAGE_REL_PPC_NEG 0x0100
#define IMAGE_REL_PPC_BRTAKEN 0x0200
#define IMAGE_REL_PPC_BRNTAKEN 0x0400
#define IMAGE_REL_PPC_TOCDEFN 0x0800
/* SH3 ? relocation type */
#define IMAGE_REL_SH3_ABSOLUTE 0x0000
#define IMAGE_REL_SH3_DIRECT16 0x0001
#define IMAGE_REL_SH3_DIRECT 0x0002
#define IMAGE_REL_SH3_DIRECT8 0x0003
#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
#define IMAGE_REL_SH3_DIRECT4 0x0006
#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
#define IMAGE_REL_SH3_PCREL8_WORD 0x0009
#define IMAGE_REL_SH3_PCREL8_LONG 0x000A
#define IMAGE_REL_SH3_PCREL12_WORD 0x000B
#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
#define IMAGE_REL_SH3_SECTION 0x000E
#define IMAGE_REL_SH3_SECREL 0x000F
#define IMAGE_REL_SH3_DIRECT32_NB 0x0010
/* ARM (Archimedes?) relocation types */
#define IMAGE_REL_ARM_ABSOLUTE 0x0000
#define IMAGE_REL_ARM_ADDR 0x0001
#define IMAGE_REL_ARM_ADDR32NB 0x0002
#define IMAGE_REL_ARM_BRANCH24 0x0003
#define IMAGE_REL_ARM_BRANCH11 0x0004
#define IMAGE_REL_ARM_SECTION 0x000E
#define IMAGE_REL_ARM_SECREL 0x000F
/* IA64 relocation types */
#define IMAGE_REL_IA64_ABSOLUTE 0x0000
#define IMAGE_REL_IA64_IMM14 0x0001
#define IMAGE_REL_IA64_IMM22 0x0002
#define IMAGE_REL_IA64_IMM64 0x0003
#define IMAGE_REL_IA64_DIR 0x0004
#define IMAGE_REL_IA64_DIR64 0x0005
#define IMAGE_REL_IA64_PCREL21B 0x0006
#define IMAGE_REL_IA64_PCREL21M 0x0007
#define IMAGE_REL_IA64_PCREL21F 0x0008
#define IMAGE_REL_IA64_GPREL22 0x0009
#define IMAGE_REL_IA64_LTOFF22 0x000A
#define IMAGE_REL_IA64_SECTION 0x000B
#define IMAGE_REL_IA64_SECREL22 0x000C
#define IMAGE_REL_IA64_SECREL64I 0x000D
#define IMAGE_REL_IA64_SECREL 0x000E
#define IMAGE_REL_IA64_LTOFF64 0x000F
#define IMAGE_REL_IA64_DIR32NB 0x0010
#define IMAGE_REL_IA64_RESERVED_11 0x0011
#define IMAGE_REL_IA64_RESERVED_12 0x0012
#define IMAGE_REL_IA64_RESERVED_13 0x0013
#define IMAGE_REL_IA64_RESERVED_14 0x0014
#define IMAGE_REL_IA64_RESERVED_15 0x0015
#define IMAGE_REL_IA64_RESERVED_16 0x0016
#define IMAGE_REL_IA64_ADDEND 0x001F
/* archive format */
#define IMAGE_ARCHIVE_START_SIZE 8
#define IMAGE_ARCHIVE_START "!<arch>\n"
#define IMAGE_ARCHIVE_END "`\n"
#define IMAGE_ARCHIVE_PAD "\n"
#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
typedef
struct
_IMAGE_ARCHIVE_MEMBER_HEADER
{
BYTE
Name
[
16
];
BYTE
Date
[
12
];
BYTE
UserID
[
6
];
BYTE
GroupID
[
6
];
BYTE
Mode
[
8
];
BYTE
Size
[
10
];
BYTE
EndHeader
[
2
];
}
IMAGE_ARCHIVE_MEMBER_HEADER
,
*
PIMAGE_ARCHIVE_MEMBER_HEADER
;
#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
/*
* Resource directory stuff
*/
typedef
struct
_IMAGE_RESOURCE_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
WORD
NumberOfNamedEntries
;
WORD
NumberOfIdEntries
;
/* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
}
IMAGE_RESOURCE_DIRECTORY
,
*
PIMAGE_RESOURCE_DIRECTORY
;
#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
typedef
struct
_IMAGE_RESOURCE_DIRECTORY_ENTRY
{
union
{
struct
{
unsigned
NameOffset
:
31
;
unsigned
NameIsString
:
1
;
}
s
;
DWORD
Name
;
WORD
Id
;
}
u1
;
union
{
DWORD
OffsetToData
;
struct
{
unsigned
OffsetToDirectory
:
31
;
unsigned
DataIsDirectory
:
1
;
}
s
;
}
u2
;
}
IMAGE_RESOURCE_DIRECTORY_ENTRY
,
*
PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
typedef
struct
_IMAGE_RESOURCE_DIRECTORY_STRING
{
WORD
Length
;
CHAR
NameString
[
1
];
}
IMAGE_RESOURCE_DIRECTORY_STRING
,
*
PIMAGE_RESOURCE_DIRECTORY_STRING
;
typedef
struct
_IMAGE_RESOURCE_DIR_STRING_U
{
WORD
Length
;
WCHAR
NameString
[
1
];
}
IMAGE_RESOURCE_DIR_STRING_U
,
*
PIMAGE_RESOURCE_DIR_STRING_U
;
typedef
struct
_IMAGE_RESOURCE_DATA_ENTRY
{
DWORD
OffsetToData
;
DWORD
Size
;
DWORD
CodePage
;
DWORD
ResourceHandle
;
}
IMAGE_RESOURCE_DATA_ENTRY
,
*
PIMAGE_RESOURCE_DATA_ENTRY
;
typedef
VOID
(
CALLBACK
*
PIMAGE_TLS_CALLBACK
)(
LPVOID
DllHandle
,
DWORD
Reason
,
LPVOID
Reserved
);
typedef
struct
_IMAGE_TLS_DIRECTORY
{
DWORD
StartAddressOfRawData
;
DWORD
EndAddressOfRawData
;
LPDWORD
AddressOfIndex
;
PIMAGE_TLS_CALLBACK
*
AddressOfCallBacks
;
DWORD
SizeOfZeroFill
;
DWORD
Characteristics
;
}
IMAGE_TLS_DIRECTORY
,
*
PIMAGE_TLS_DIRECTORY
;
typedef
struct
_IMAGE_DEBUG_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
Type
;
DWORD
SizeOfData
;
DWORD
AddressOfRawData
;
DWORD
PointerToRawData
;
}
IMAGE_DEBUG_DIRECTORY
,
*
PIMAGE_DEBUG_DIRECTORY
;
#define IMAGE_DEBUG_TYPE_UNKNOWN 0
#define IMAGE_DEBUG_TYPE_COFF 1
#define IMAGE_DEBUG_TYPE_CODEVIEW 2
#define IMAGE_DEBUG_TYPE_FPO 3
#define IMAGE_DEBUG_TYPE_MISC 4
#define IMAGE_DEBUG_TYPE_EXCEPTION 5
#define IMAGE_DEBUG_TYPE_FIXUP 6
#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
#define IMAGE_DEBUG_TYPE_BORLAND 9
#define IMAGE_DEBUG_TYPE_RESERVED10 10
typedef
struct
_IMAGE_COFF_SYMBOLS_HEADER
{
DWORD
NumberOfSymbols
;
DWORD
LvaToFirstSymbol
;
DWORD
NumberOfLinenumbers
;
DWORD
LvaToFirstLinenumber
;
DWORD
RvaToFirstByteOfCode
;
DWORD
RvaToLastByteOfCode
;
DWORD
RvaToFirstByteOfData
;
DWORD
RvaToLastByteOfData
;
}
IMAGE_COFF_SYMBOLS_HEADER
,
*
PIMAGE_COFF_SYMBOLS_HEADER
;
#define FRAME_FPO 0
#define FRAME_TRAP 1
#define FRAME_TSS 2
#define FRAME_NONFPO 3
typedef
struct
_FPO_DATA
{
DWORD
ulOffStart
;
DWORD
cbProcSize
;
DWORD
cdwLocals
;
WORD
cdwParams
;
unsigned
cbProlog
:
8
;
unsigned
cbRegs
:
3
;
unsigned
fHasSEH
:
1
;
unsigned
fUseBP
:
1
;
unsigned
reserved
:
1
;
unsigned
cbFrame
:
2
;
}
FPO_DATA
,
*
PFPO_DATA
;
typedef
struct
_IMAGE_LOAD_CONFIG_DIRECTORY
{
DWORD
Characteristics
;
DWORD
TimeDateStamp
;
WORD
MajorVersion
;
WORD
MinorVersion
;
DWORD
GlobalFlagsClear
;
DWORD
GlobalFlagsSet
;
DWORD
CriticalSectionDefaultTimeout
;
DWORD
DeCommitFreeBlockThreshold
;
DWORD
DeCommitTotalFreeThreshold
;
PVOID
LockPrefixTable
;
DWORD
MaximumAllocationSize
;
DWORD
VirtualMemoryThreshold
;
DWORD
ProcessHeapFlags
;
DWORD
ProcessAffinityMask
;
WORD
CSDVersion
;
WORD
Reserved1
;
PVOID
EditList
;
DWORD
Reserved
[
1
];
}
IMAGE_LOAD_CONFIG_DIRECTORY
,
*
PIMAGE_LOAD_CONFIG_DIRECTORY
;
typedef
struct
_IMAGE_FUNCTION_ENTRY
{
DWORD
StartingAddress
;
DWORD
EndingAddress
;
DWORD
EndOfPrologue
;
}
IMAGE_FUNCTION_ENTRY
,
*
PIMAGE_FUNCTION_ENTRY
;
/* This is the structure that appears at the very start of a .DBG file. */
typedef
struct
_IMAGE_SEPARATE_DEBUG_HEADER
{
WORD
Signature
;
WORD
Flags
;
WORD
Machine
;
WORD
Characteristics
;
DWORD
TimeDateStamp
;
DWORD
CheckSum
;
DWORD
ImageBase
;
DWORD
SizeOfImage
;
DWORD
NumberOfSections
;
DWORD
ExportedNamesSize
;
DWORD
DebugDirectorySize
;
DWORD
SectionAlignment
;
DWORD
Reserved
[
2
];
}
IMAGE_SEPARATE_DEBUG_HEADER
,
*
PIMAGE_SEPARATE_DEBUG_HEADER
;
#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
typedef
struct
tagMESSAGE_RESOURCE_ENTRY
{
WORD
Length
;
WORD
Flags
;
BYTE
Text
[
1
];
}
MESSAGE_RESOURCE_ENTRY
,
*
PMESSAGE_RESOURCE_ENTRY
;
#define MESSAGE_RESOURCE_UNICODE 0x0001
typedef
struct
tagMESSAGE_RESOURCE_BLOCK
{
DWORD
LowId
;
DWORD
HighId
;
DWORD
OffsetToEntries
;
}
MESSAGE_RESOURCE_BLOCK
,
*
PMESSAGE_RESOURCE_BLOCK
;
typedef
struct
tagMESSAGE_RESOURCE_DATA
{
DWORD
NumberOfBlocks
;
MESSAGE_RESOURCE_BLOCK
Blocks
[
1
];
}
MESSAGE_RESOURCE_DATA
,
*
PMESSAGE_RESOURCE_DATA
;
/*
* Here follows typedefs for security and tokens.
*/
...
...
loader/dos/module.c
View file @
180a088b
...
...
@@ -22,7 +22,6 @@
#include "wine/winbase16.h"
#include "winerror.h"
#include "module.h"
#include "peexe.h"
#include "neexe.h"
#include "task.h"
#include "selectors.h"
...
...
loader/elf.c
View file @
180a088b
...
...
@@ -19,7 +19,6 @@
#include "snoop.h"
#include "process.h"
#include "neexe.h"
#include "peexe.h"
#include "heap.h"
#include "module.h"
#include "pe_image.h"
...
...
loader/module.c
View file @
180a088b
...
...
@@ -575,7 +575,7 @@ static BOOL MODULE_GetBinaryType( HANDLE hfile, LPCSTR filename,
&&
ReadFile
(
hfile
,
&
ne
,
sizeof
(
ne
),
&
len
,
NULL
)
&&
len
==
sizeof
(
ne
)
)
{
switch
(
ne
.
operating_system
)
switch
(
ne
.
ne_exetyp
)
{
case
2
:
*
lpBinaryType
=
SCS_WOW_BINARY
;
return
TRUE
;
case
5
:
*
lpBinaryType
=
SCS_DOS_BINARY
;
return
TRUE
;
...
...
loader/ne/module.c
View file @
180a088b
...
...
@@ -14,7 +14,6 @@
#include "winerror.h"
#include "module.h"
#include "neexe.h"
#include "peexe.h"
#include "toolhelp.h"
#include "file.h"
#include "ldt.h"
...
...
@@ -448,20 +447,20 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
size
=
sizeof
(
NE_MODULE
)
+
/* segment table */
ne_header
.
n
_segment_tab
*
sizeof
(
SEGTABLEENTRY
)
+
ne_header
.
n
e_cseg
*
sizeof
(
SEGTABLEENTRY
)
+
/* resource table */
ne_header
.
rname_tab_offset
-
ne_header
.
resource_tab_offset
+
ne_header
.
ne_restab
-
ne_header
.
ne_rsrctab
+
/* resident names table */
ne_header
.
moduleref_tab_offset
-
ne_header
.
rname_tab_offset
+
ne_header
.
ne_modtab
-
ne_header
.
ne_restab
+
/* module ref table */
ne_header
.
n
_mod_ref_tab
*
sizeof
(
WORD
)
+
ne_header
.
n
e_cmod
*
sizeof
(
WORD
)
+
/* imported names table */
ne_header
.
entry_tab_offset
-
ne_header
.
iname_tab_offset
+
ne_header
.
ne_enttab
-
ne_header
.
ne_imptab
+
/* entry table length */
ne_header
.
entry_tab_length
+
ne_header
.
ne_cbenttab
+
/* entry table extra conversion space */
sizeof
(
ET_BUNDLE
)
+
2
*
(
ne_header
.
entry_tab_length
-
ne_header
.
n_mov_entry_points
*
6
)
+
2
*
(
ne_header
.
ne_cbenttab
-
ne_header
.
ne_cmovent
*
6
)
+
/* loaded file info */
sizeof
(
OFSTRUCT
)
-
sizeof
(
ofs
.
szPathName
)
+
strlen
(
ofs
.
szPathName
)
+
1
;
...
...
@@ -491,10 +490,10 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
/* Read the fast-load area */
if
(
ne_header
.
additional_flag
s
&
NE_AFLAGS_FASTLOAD
)
if
(
ne_header
.
ne_flagsother
s
&
NE_AFLAGS_FASTLOAD
)
{
fastload_offset
=
ne_header
.
fastload_offset
<<
ne_header
.
align_shift_count
;
fastload_length
=
ne_header
.
fastload_length
<<
ne_header
.
align_shift_count
;
fastload_offset
=
ne_header
.
fastload_offset
<<
ne_header
.
ne_align
;
fastload_length
=
ne_header
.
fastload_length
<<
ne_header
.
ne_align
;
TRACE
(
"Using fast-load area offset=%x len=%d
\n
"
,
fastload_offset
,
fastload_length
);
if
((
fastload
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fastload_length
))
!=
NULL
)
...
...
@@ -512,15 +511,15 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
/* Get the segment table */
pModule
->
seg_table
=
(
int
)
pData
-
(
int
)
pModule
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ne_header
.
n
_segment_tab
*
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ne_header
.
n
e_cseg
*
sizeof
(
struct
ne_segment_table_entry_s
));
if
(
buffer
)
{
int
i
;
struct
ne_segment_table_entry_s
*
pSeg
;
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
segment_tab_offset
,
ne_header
.
n
_segment_tab
*
sizeof
(
struct
ne_segment_table_entry_s
),
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
ne_segtab
,
ne_header
.
n
e_cseg
*
sizeof
(
struct
ne_segment_table_entry_s
),
buffer
))
{
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
...
...
@@ -531,7 +530,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
return
(
HMODULE16
)
11
;
/* invalid exe */
}
pSeg
=
(
struct
ne_segment_table_entry_s
*
)
buffer
;
for
(
i
=
ne_header
.
n
_segment_tab
;
i
>
0
;
i
--
,
pSeg
++
)
for
(
i
=
ne_header
.
n
e_cseg
;
i
>
0
;
i
--
,
pSeg
++
)
{
memcpy
(
pData
,
pSeg
,
sizeof
(
*
pSeg
)
);
pData
+=
sizeof
(
SEGTABLEENTRY
);
...
...
@@ -549,17 +548,17 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
/* Get the resource table */
if
(
ne_header
.
resource_tab_offset
<
ne_header
.
rname_tab_offset
)
if
(
ne_header
.
ne_rsrctab
<
ne_header
.
ne_restab
)
{
pModule
->
res_table
=
(
int
)
pData
-
(
int
)
pModule
;
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
resource_tab_offset
,
ne_header
.
rname_tab_offset
-
ne_header
.
resource_tab_offset
,
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
ne_rsrctab
,
ne_header
.
ne_restab
-
ne_header
.
ne_rsrctab
,
pData
))
{
_lclose16
(
hFile
);
return
(
HMODULE16
)
11
;
/* invalid exe */
}
pData
+=
ne_header
.
rname_tab_offset
-
ne_header
.
resource_tab_offset
;
pData
+=
ne_header
.
ne_restab
-
ne_header
.
ne_rsrctab
;
NE_InitResourceHandler
(
hModule
);
}
else
pModule
->
res_table
=
0
;
/* No resource table */
...
...
@@ -567,8 +566,8 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
/* Get the resident names table */
pModule
->
name_table
=
(
int
)
pData
-
(
int
)
pModule
;
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
rname_tab_offset
,
ne_header
.
moduleref_tab_offset
-
ne_header
.
rname_tab_offset
,
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
ne_restab
,
ne_header
.
ne_modtab
-
ne_header
.
ne_restab
,
pData
))
{
if
(
fastload
)
...
...
@@ -577,15 +576,15 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
_lclose16
(
hFile
);
return
(
HMODULE16
)
11
;
/* invalid exe */
}
pData
+=
ne_header
.
moduleref_tab_offset
-
ne_header
.
rname_tab_offset
;
pData
+=
ne_header
.
ne_modtab
-
ne_header
.
ne_restab
;
/* Get the module references table */
if
(
ne_header
.
n
_mod_ref_tab
>
0
)
if
(
ne_header
.
n
e_cmod
>
0
)
{
pModule
->
modref_table
=
(
int
)
pData
-
(
int
)
pModule
;
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
moduleref_tab_offset
,
ne_header
.
n
_mod_ref_tab
*
sizeof
(
WORD
),
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
ne_modtab
,
ne_header
.
n
e_cmod
*
sizeof
(
WORD
),
pData
))
{
if
(
fastload
)
...
...
@@ -594,15 +593,15 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
_lclose16
(
hFile
);
return
(
HMODULE16
)
11
;
/* invalid exe */
}
pData
+=
ne_header
.
n
_mod_ref_tab
*
sizeof
(
WORD
);
pData
+=
ne_header
.
n
e_cmod
*
sizeof
(
WORD
);
}
else
pModule
->
modref_table
=
0
;
/* No module references */
/* Get the imported names table */
pModule
->
import_table
=
(
int
)
pData
-
(
int
)
pModule
;
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
iname_tab_offset
,
ne_header
.
entry_tab_offset
-
ne_header
.
iname_tab_offset
,
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
ne_imptab
,
ne_header
.
ne_enttab
-
ne_header
.
ne_imptab
,
pData
))
{
if
(
fastload
)
...
...
@@ -611,18 +610,18 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
_lclose16
(
hFile
);
return
(
HMODULE16
)
11
;
/* invalid exe */
}
pData
+=
ne_header
.
entry_tab_offset
-
ne_header
.
iname_tab_offset
;
pData
+=
ne_header
.
ne_enttab
-
ne_header
.
ne_imptab
;
/* Load entry table, convert it to the optimized version used by Windows */
if
((
pTempEntryTable
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ne_header
.
entry_tab_length
))
!=
NULL
)
if
((
pTempEntryTable
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ne_header
.
ne_cbenttab
))
!=
NULL
)
{
BYTE
nr_entries
,
type
,
*
s
;
TRACE
(
"Converting entry table.
\n
"
);
pModule
->
entry_table
=
(
int
)
pData
-
(
int
)
pModule
;
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
entry_tab_offset
,
ne_header
.
entry_tab_length
,
pTempEntryTable
))
if
(
!
READ
(
mz_header
.
e_lfanew
+
ne_header
.
ne_enttab
,
ne_header
.
ne_cbenttab
,
pTempEntryTable
))
{
HeapFree
(
GetProcessHeap
(),
0
,
pTempEntryTable
);
if
(
fastload
)
...
...
@@ -633,7 +632,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
}
s
=
pTempEntryTable
;
TRACE
(
"entry table: offs %04x, len %04x, entries %d
\n
"
,
ne_header
.
entry_tab_offset
,
ne_header
.
entry_tab_length
,
*
s
);
TRACE
(
"entry table: offs %04x, len %04x, entries %d
\n
"
,
ne_header
.
ne_enttab
,
ne_header
.
ne_cbenttab
,
*
s
);
bundle
=
(
ET_BUNDLE
*
)
pData
;
TRACE
(
"first bundle: %p
\n
"
,
bundle
);
...
...
@@ -698,8 +697,8 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
return
(
HMODULE16
)
11
;
/* invalid exe */
}
pData
+=
ne_header
.
entry_tab_length
+
sizeof
(
ET_BUNDLE
)
+
2
*
(
ne_header
.
entry_tab_length
-
ne_header
.
n_mov_entry_points
*
6
);
pData
+=
ne_header
.
ne_cbenttab
+
sizeof
(
ET_BUNDLE
)
+
2
*
(
ne_header
.
ne_cbenttab
-
ne_header
.
ne_cmovent
*
6
);
if
((
DWORD
)
entry
>
(
DWORD
)
pData
)
ERR
(
"converted entry table bigger than reserved space !!!
\n
entry: %p, pData: %p. Please report !
\n
"
,
entry
,
pData
);
...
...
@@ -720,9 +719,9 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
/* Get the non-resident names table */
if
(
ne_header
.
n
rname_tab_length
)
if
(
ne_header
.
n
e_cbnrestab
)
{
pModule
->
nrname_handle
=
GLOBAL_Alloc
(
0
,
ne_header
.
n
rname_tab_length
,
pModule
->
nrname_handle
=
GLOBAL_Alloc
(
0
,
ne_header
.
n
e_cbnrestab
,
hModule
,
FALSE
,
FALSE
,
FALSE
);
if
(
!
pModule
->
nrname_handle
)
{
...
...
@@ -731,9 +730,9 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
return
(
HMODULE16
)
11
;
/* invalid exe */
}
buffer
=
GlobalLock16
(
pModule
->
nrname_handle
);
_llseek16
(
hFile
,
ne_header
.
n
rname_tab_offset
,
SEEK_SET
);
if
(
_hread16
(
hFile
,
buffer
,
ne_header
.
n
rname_tab_length
)
!=
ne_header
.
n
rname_tab_length
)
_llseek16
(
hFile
,
ne_header
.
n
e_nrestab
,
SEEK_SET
);
if
(
_hread16
(
hFile
,
buffer
,
ne_header
.
n
e_cbnrestab
)
!=
ne_header
.
n
e_cbnrestab
)
{
GlobalFree16
(
pModule
->
nrname_handle
);
GlobalFree16
(
hModule
);
...
...
loader/pe_image.c
View file @
180a088b
...
...
@@ -52,7 +52,6 @@
#include "file.h"
#include "heap.h"
#include "neexe.h"
#include "peexe.h"
#include "process.h"
#include "thread.h"
#include "pe_image.h"
...
...
loader/task.c
View file @
180a088b
...
...
@@ -20,7 +20,6 @@
#include "miscemu.h"
#include "module.h"
#include "neexe.h"
#include "peexe.h"
#include "pe_image.h"
#include "process.h"
#include "queue.h"
...
...
relay32/builtin32.c
View file @
180a088b
...
...
@@ -12,7 +12,6 @@
#include "wingdi.h"
#include "winuser.h"
#include "builtin32.h"
#include "peexe.h"
#include "neexe.h"
#include "heap.h"
#include "main.h"
...
...
relay32/snoop.c
View file @
180a088b
...
...
@@ -17,7 +17,6 @@
#include "builtin32.h"
#include "snoop.h"
#include "neexe.h"
#include "peexe.h"
#include "selectors.h"
#include "stackframe.h"
#include "debugtools.h"
...
...
tools/cvdump/cvcrunch.c
View file @
180a088b
...
...
@@ -12,7 +12,6 @@
#include <string.h>
#include <windows.h>
#include "peexe.h"
#include "cvinclude.h"
/************************ sstSrcModule ************************/
...
...
tools/cvdump/cvdump.h
View file @
180a088b
...
...
@@ -6,7 +6,6 @@
/* #define VERBOSE */
#include "peexe.h"
#include "neexe.h"
#include "cvinclude.h"
...
...
tools/fnt2bdf.c
View file @
180a088b
...
...
@@ -486,8 +486,8 @@ int get_resource_table(int fd, unsigned char** lpdata, int fsize)
}
else
if
(
s
!=
IMAGE_OS2_SIGNATURE
)
return
FILE_ERROR
;
s
=
return_data_value
(
dfShort
,
&
ne_header
.
resource_tab_offset
);
size
=
return_data_value
(
dfShort
,
&
ne_header
.
rname_tab_offset
);
s
=
return_data_value
(
dfShort
,
&
ne_header
.
ne_rsrctab
);
size
=
return_data_value
(
dfShort
,
&
ne_header
.
ne_restab
);
if
(
size
>
fsize
)
return
FILE_ERROR
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment