-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Quickfall/comp
Compiler V3
- Loading branch information
Showing
20 changed files
with
519 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/** | ||
* Quickfall PE Format Defintion. | ||
*/ | ||
|
||
#include "../units.h" | ||
|
||
#ifndef PE_FORMAT | ||
#define PE_FORMAT | ||
|
||
/** | ||
* Constants. | ||
*/ | ||
|
||
#define PE_HEADER_SIGNATURE 0x00004550 | ||
#define PE_DOS_HDR_SZ 0x40 | ||
|
||
/** | ||
* Structures. | ||
*/ | ||
|
||
#pragma pack(push, 1) | ||
|
||
typedef struct { | ||
uint16_t e_magic; | ||
uint16_t e_cblp; | ||
uint16_t e_cp; | ||
uint16_t e_crlc; | ||
uint16_t e_cparhdr; | ||
uint16_t e_minalloc; | ||
uint16_t e_maxalloc; | ||
uint16_t e_ss; | ||
uint16_t e_sp; | ||
uint16_t e_csum; | ||
uint16_t e_ip; | ||
uint16_t e_cs; | ||
uint16_t e_lfarlc; | ||
uint16_t e_ovno; | ||
uint16_t e_res[4]; | ||
uint16_t e_oemid; | ||
uint16_t e_oeminfo; | ||
uint16_t e_res2[10]; | ||
uint32_t e_lfanew; | ||
} PE_DOS_HEADER; | ||
|
||
typedef struct { | ||
uint32_t Signature; | ||
uint16_t Machine; | ||
uint16_t NumberOfSections; | ||
uint32_t TimeDateStamp; | ||
uint32_t PointerToSymbolTable; | ||
uint32_t NumberOfSymbols; | ||
uint16_t SizeOfOptionalHeader; | ||
uint16_t Characteristics; | ||
} PE_NT_HEADERS; | ||
|
||
typedef struct { | ||
uint16_t Magic; | ||
uint8_t MajorLinkerVersion; | ||
uint8_t MinorLinkerVersion; | ||
uint32_t SizeOfCode; | ||
uint32_t SizeOfInitializedData; | ||
uint32_t SizeOfUninitializedData; | ||
uint32_t AddressOfEntryPoint; | ||
uint32_t BaseOfCode; | ||
uint64_t ImageBase; | ||
uint32_t SectionAlignment; | ||
uint32_t FileAlignment; | ||
uint16_t MajorOperatingSystemVersion; | ||
uint16_t MinorOperatingSystemVersion; | ||
uint16_t MajorImageVersion; | ||
uint16_t MinorImageVersion; | ||
uint16_t MajorSubsystemVersion; | ||
uint16_t MinorSubsystemVersion; | ||
uint32_t Win32VersionValue; | ||
uint32_t SizeOfImage; | ||
uint32_t SizeOfHeaders; | ||
uint32_t CheckSum; | ||
uint16_t Subsystem; | ||
uint16_t DllCharacteristics; | ||
uint64_t SizeOfStackReserve; | ||
uint64_t SizeOfStackCommit; | ||
uint64_t SizeOfHeapReserve; | ||
uint64_t SizeOfHeapCommit; | ||
uint32_t LoaderFlags; | ||
uint32_t NumberOfRvaAndSizes; | ||
struct { | ||
uint32_t VirtualAddress; | ||
uint32_t Size; | ||
} DataDirectory[16]; | ||
} PE_OPTIONAL_HEADER; | ||
|
||
typedef struct { | ||
uint8_t Name[8]; | ||
union { | ||
uint32_t PhysicalAddress; | ||
uint32_t VirtualSize; | ||
} Misc; | ||
uint32_t VirtualAddress; | ||
uint32_t SizeOfRawData; | ||
uint32_t PointerToRawData; | ||
uint32_t PointerToRelocations; | ||
uint32_t PointerToLinenumbers; | ||
uint16_t NumberOfRelocations; | ||
uint16_t NumberOfLinenumbers; | ||
uint32_t Characteristics; | ||
} PE_SECTION_HEADER; | ||
|
||
#pragma pack(pop) | ||
|
||
#endif |
Oops, something went wrong.