Why is this needed? ie: what missing functionality of obj2dump does
this tool add?
I'm only asking because whenever I build ARM binaries with GCC I use
obj2dump to do exactly this -- convert a PE/COFF to a raw binary for
the boot-loader or firmware.
So maybe I'm missing something?
Best regards,
Alex Ionescu
On Tue, Jun 7, 2011 at 3:29 PM, <tkreuzer(a)svn.reactos.org> wrote:
Author: tkreuzer
Date: Tue Jun 7 19:29:09 2011
New Revision: 52133
URL:
http://svn.reactos.org/svn/reactos?rev=52133&view=rev
Log:
[OBJ2BIN]
- Add new tool obj2bin, that converts a coff object file into a raw binary file
- Move pe/coff types into a common header file pecoff.h
Added:
trunk/reactos/tools/obj2bin/ (with props)
trunk/reactos/tools/obj2bin/CMakeLists.txt (with props)
trunk/reactos/tools/obj2bin/obj2bin.c (with props)
trunk/reactos/tools/pecoff.h (with props)
Modified:
trunk/reactos/tools/CMakeLists.txt
trunk/reactos/tools/rsym/rsym.h
Modified: trunk/reactos/tools/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/CMakeLists.txt?rev=5…
==============================================================================
--- trunk/reactos/tools/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/CMakeLists.txt [iso-8859-1] Tue Jun 7 19:29:09 2011
@@ -6,6 +6,7 @@
add_subdirectory(gendib)
add_subdirectory(geninc)
add_subdirectory(mkhive)
+add_subdirectory(obj2bin)
add_subdirectory(spec2def)
add_subdirectory(unicode)
Propchange: trunk/reactos/tools/obj2bin/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Tue Jun 7 19:29:09 2011
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: trunk/reactos/tools/obj2bin/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/tools/obj2bin/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/tools/obj2bin/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/tools/obj2bin/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/obj2bin/CMakeLists.t…
==============================================================================
--- trunk/reactos/tools/obj2bin/CMakeLists.txt (added)
+++ trunk/reactos/tools/obj2bin/CMakeLists.txt [iso-8859-1] Tue Jun 7 19:29:09 2011
@@ -1,0 +1,1 @@
+add_executable(obj2bin obj2bin.c)
Propchange: trunk/reactos/tools/obj2bin/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/tools/obj2bin/obj2bin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/obj2bin/obj2bin.c?re…
==============================================================================
--- trunk/reactos/tools/obj2bin/obj2bin.c (added)
+++ trunk/reactos/tools/obj2bin/obj2bin.c [iso-8859-1] Tue Jun 7 19:29:09 2011
@@ -1,0 +1,112 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "../pecoff.h"
+
+static
+void
+Usage(void)
+{
+ printf("Converts a coff object file into a raw binary file.\n"
+ "Syntax: obj2bin <source file> <dest file>\n");
+}
+
+int main(int argc, char *argv[])
+{
+ char *pszSourceFile;
+ char *pszDestFile;
+ FILE *pSourceFile, *pDestFile;
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_SECTION_HEADER SectionHeader;
+ unsigned int i, nSize;
+ void *pData;
+
+ if ((argc != 3) || (strcmp(argv[1], "--help") == 0)) Usage();
+
+ pszSourceFile = argv[1];
+ pszDestFile = argv[2];
+
+ pSourceFile = fopen(pszSourceFile, "rb");
+ if (!pSourceFile)
+ {
+ fprintf(stderr, "Couldn't open source file '%s'\n",
pszSourceFile);
+ return -1;
+ }
+
+ pDestFile = fopen(pszDestFile, "wb");
+ if (!pszDestFile)
+ {
+ fprintf(stderr, "Couldn't open dest file '%s'\n",
pszDestFile);
+ return -2;
+ }
+
+ /* Load the coff header */
+ nSize = fread(&FileHeader, 1, sizeof(FileHeader), pSourceFile);
+ if (nSize != sizeof(FileHeader))
+ {
+ fprintf(stderr, "Failed to read source file\n");
+ return -3;
+ }
+
+ /* Jump to section headers (skip optional header) */
+ if (fseek(pSourceFile, FileHeader.SizeOfOptionalHeader, SEEK_CUR))
+ {
+ fprintf(stderr, "Failed to set file pointer\n");
+ return -4;
+ }
+
+ /* Loop all sections */
+ for (i = 0; i < FileHeader.NumberOfSections; i++)
+ {
+ /* Read section header */
+ nSize = fread(&SectionHeader, 1, sizeof(SectionHeader), pSourceFile);
+ if (nSize != sizeof(SectionHeader))
+ {
+ fprintf(stderr, "Failed to read section %ld file\n", i);
+ return -5;
+ }
+
+ /* Check if this is '.text' section */
+ if (strcmp(SectionHeader.Name, ".text") == 0) break;
+ }
+
+ if (i == FileHeader.NumberOfSections)
+ {
+ fprintf(stderr, "No .text section found\n");
+ return -6;
+ }
+
+ /* Move file pointer to the start of the section*/
+ if (fseek(pSourceFile, SectionHeader.PointerToRawData, SEEK_SET))
+ {
+ fprintf(stderr, "Failed to set file pointer\n");
+ return -7;
+ }
+
+ /* Allocate memory for the section */
+ pData = malloc(SectionHeader.SizeOfRawData);
+ if (!pData)
+ {
+ fprintf(stderr, "Failed to allocate %ld bytes\n",
SectionHeader.SizeOfRawData);
+ return -8;
+ }
+
+ /* Read section data */
+ if (!fread(pData, SectionHeader.SizeOfRawData, 1, pSourceFile))
+ {
+ fprintf(stderr, "Failed to read section %ld file\n", i);
+ return -5;
+ }
+
+ /* Write the section to the destination file */
+ if (!fwrite(pData, SectionHeader.SizeOfRawData, 1, pDestFile))
+ {
+ fprintf(stderr, "Failed to write data\n");
+ return -9;
+ }
+
+ fclose(pDestFile);
+ fclose(pSourceFile);
+
+ return 0;
+}
+
Propchange: trunk/reactos/tools/obj2bin/obj2bin.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/tools/pecoff.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/pecoff.h?rev=52133&a…
==============================================================================
--- trunk/reactos/tools/pecoff.h (added)
+++ trunk/reactos/tools/pecoff.h [iso-8859-1] Tue Jun 7 19:29:09 2011
@@ -1,0 +1,207 @@
+#pragma once
+
+#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x010b
+#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x020b
+
+#define IMAGE_DOS_MAGIC 0x5a4d
+#define IMAGE_PE_MAGIC 0x00004550
+#define IMAGE_SIZEOF_SHORT_NAME 8
+
+#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
+#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
+
+#define IMAGE_FILE_MACHINE_I386 0x14c
+#define IMAGE_FILE_MACHINE_AMD64 0x8664
+#define IMAGE_FILE_MACHINE_IA64 0x0200
+
+#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
+
+#define IMAGE_SCN_TYPE_NOLOAD 0x00000002
+#define IMAGE_SCN_TYPE_NO_PAD 0x00000008
+#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_LNK_REMOVE 0x00000800
+#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000
+#define IMAGE_SCN_GPREL 0x00008000
+#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
+#define IMAGE_SCN_MEM_LOCKED 0x00040000
+#define IMAGE_SCN_MEM_PRELOAD 0x00080000
+#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
+
+#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
+
+typedef unsigned char BYTE;
+typedef unsigned char UCHAR;
+typedef unsigned short WORD;
+typedef unsigned short USHORT;
+typedef unsigned long long ULONGLONG;
+#if defined(__x86_64__) && !defined(_WIN64)
+typedef signed int LONG;
+typedef unsigned int ULONG;
+typedef unsigned int DWORD;
+#else
+typedef signed long LONG;
+typedef unsigned long ULONG;
+typedef unsigned long DWORD;
+#endif
+#if defined(_WIN64)
+typedef unsigned __int64 ULONG_PTR;
+#else
+#if defined(__x86_64__) && !defined(_WIN64)
+typedef unsigned int ULONG_PTR;
+#else
+typedef unsigned long ULONG_PTR;
+#endif
+#endif
+
+#pragma pack(push,2)
+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;
+#pragma pack(pop)
+
+#pragma pack(push,4)
+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;
+#pragma pack(pop)
+
+typedef struct _IMAGE_DATA_DIRECTORY {
+ DWORD VirtualAddress;
+ DWORD Size;
+} IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
+
+typedef struct _IMAGE_OPTIONAL_HEADER32 {
+ WORD Magic;
+ BYTE MajorLinkerVersion;
+ BYTE MinorLinkerVersion;
+ DWORD SizeOfCode;
+ DWORD SizeOfInitializedData;
+ DWORD SizeOfUninitializedData;
+ DWORD AddressOfEntryPoint;
+ DWORD BaseOfCode;
+ DWORD BaseOfData;
+ 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_HEADER32,*PIMAGE_OPTIONAL_HEADER32;
+
+typedef struct _IMAGE_OPTIONAL_HEADER64 {
+ WORD Magic;
+ BYTE MajorLinkerVersion;
+ BYTE MinorLinkerVersion;
+ DWORD SizeOfCode;
+ DWORD SizeOfInitializedData;
+ DWORD SizeOfUninitializedData;
+ DWORD AddressOfEntryPoint;
+ DWORD BaseOfCode;
+ ULONGLONG 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;
+ ULONGLONG SizeOfStackReserve;
+ ULONGLONG SizeOfStackCommit;
+ ULONGLONG SizeOfHeapReserve;
+ ULONGLONG SizeOfHeapCommit;
+ DWORD LoaderFlags;
+ DWORD NumberOfRvaAndSizes;
+ IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
+} IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64;
+
+#ifdef _TARGET_PE64
+typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
+typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
+#else
+typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
+typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
+#endif
+
+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;
+
+#pragma pack(push,4)
+typedef struct _IMAGE_BASE_RELOCATION {
+ DWORD VirtualAddress;
+ DWORD SizeOfBlock;
+ WORD TypeOffset[1];
+} IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
+#pragma pack(pop)
+
Propchange: trunk/reactos/tools/pecoff.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/tools/rsym/rsym.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rsym/rsym.h?rev=5213…
==============================================================================
--- trunk/reactos/tools/rsym/rsym.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rsym/rsym.h [iso-8859-1] Tue Jun 7 19:29:09 2011
@@ -1,209 +1,7 @@
/* rsym.h */
#pragma once
-
-#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x010b
-#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x020b
-
-#define IMAGE_DOS_MAGIC 0x5a4d
-#define IMAGE_PE_MAGIC 0x00004550
-#define IMAGE_SIZEOF_SHORT_NAME 8
-
-#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
-#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
-#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
-
-#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
-
-#define IMAGE_SCN_TYPE_NOLOAD 0x00000002
-#define IMAGE_SCN_TYPE_NO_PAD 0x00000008
-#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_LNK_REMOVE 0x00000800
-#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000
-#define IMAGE_SCN_GPREL 0x00008000
-#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
-#define IMAGE_SCN_MEM_LOCKED 0x00040000
-#define IMAGE_SCN_MEM_PRELOAD 0x00080000
-#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
-
-#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
-
-typedef unsigned char BYTE;
-typedef unsigned char UCHAR;
-typedef unsigned short WORD;
-typedef unsigned short USHORT;
-typedef unsigned long long ULONGLONG;
-#if defined(__x86_64__) && !defined(_WIN64)
-typedef signed int LONG;
-typedef unsigned int ULONG;
-typedef unsigned int DWORD;
-#else
-typedef signed long LONG;
-typedef unsigned long ULONG;
-typedef unsigned long DWORD;
-#endif
-#if defined(_WIN64)
-typedef unsigned __int64 ULONG_PTR;
-#else
-#if defined(__x86_64__) && !defined(_WIN64)
-typedef unsigned int ULONG_PTR;
-#else
-typedef unsigned long ULONG_PTR;
-#endif
-#endif
-
-#pragma pack(push,2)
-
-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;
-#pragma pack(pop)
-
-#pragma pack(push,4)
-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;
-#pragma pack(pop)
-
-typedef struct _IMAGE_DATA_DIRECTORY {
- DWORD VirtualAddress;
- DWORD Size;
-} IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
-
-typedef struct _IMAGE_OPTIONAL_HEADER32 {
- WORD Magic;
- BYTE MajorLinkerVersion;
- BYTE MinorLinkerVersion;
- DWORD SizeOfCode;
- DWORD SizeOfInitializedData;
- DWORD SizeOfUninitializedData;
- DWORD AddressOfEntryPoint;
- DWORD BaseOfCode;
- DWORD BaseOfData;
- 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_HEADER32,*PIMAGE_OPTIONAL_HEADER32;
-
-typedef struct _IMAGE_OPTIONAL_HEADER64 {
- WORD Magic;
- BYTE MajorLinkerVersion;
- BYTE MinorLinkerVersion;
- DWORD SizeOfCode;
- DWORD SizeOfInitializedData;
- DWORD SizeOfUninitializedData;
- DWORD AddressOfEntryPoint;
- DWORD BaseOfCode;
- ULONGLONG 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;
- ULONGLONG SizeOfStackReserve;
- ULONGLONG SizeOfStackCommit;
- ULONGLONG SizeOfHeapReserve;
- ULONGLONG SizeOfHeapCommit;
- DWORD LoaderFlags;
- DWORD NumberOfRvaAndSizes;
- IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
-} IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64;
-
-
-#ifdef _TARGET_PE64
-typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
-typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
-#else
-typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
-typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
-#endif
-
-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;
-
-#pragma pack(push,4)
-typedef struct _IMAGE_BASE_RELOCATION {
- DWORD VirtualAddress;
- DWORD SizeOfBlock;
- WORD TypeOffset[1];
-} IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
-#pragma pack(pop)
+#include "../pecoff.h"
typedef struct {
USHORT f_magic; /* magic number */