summaryrefslogtreecommitdiffhomepage
path: root/coff.h
blob: 6ee9698986d9020236ae124fe83f06d70f8f8729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include <filesystem>

namespace COFF {
 // COFFHeader.Machine:
 const uint16_t IMAGE_FILE_MACHINE_UNKNOWN = 0;
 const uint16_t IMAGE_FILE_MACHINE_AMD64   = 0x8664;

 // COFFHeader.Characteristics:
 const uint16_t IMAGE_FILE_EXECUTABLE_IMAGE    = 0x002;
 const uint16_t IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x020;

 // COFFOptionalHeader_Windows.SubSystem
 const uint16_t IMAGE_SUBSYSTEM_WINDOWS_CUI = 3;

 // COFFOptionalHeader.Magic
 const uint16_t MAGIC_PE32 = 0x010b;
 const uint16_t MAGIC_PE32p = 0x020b;

 // SectionHeader.Characteristics
 const uint32_t IMAGE_SCN_CNT_CODE             = 0x00000020;
 const uint32_t IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040;
 const uint32_t IMAGE_SCN_MEM_EXECUTE          = 0x20000000;
 const uint32_t IMAGE_SCN_MEM_READ             = 0x40000000;
 const uint32_t IMAGE_SCN_MEM_WRITE            = 0x80000000;

 void Dump(std::filesystem::path path);
 void Create(std::filesystem::path path);
}