18bf80f4bSopenharmony_ci/* 28bf80f4bSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 38bf80f4bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 48bf80f4bSopenharmony_ci * you may not use this file except in compliance with the License. 58bf80f4bSopenharmony_ci * You may obtain a copy of the License at 68bf80f4bSopenharmony_ci * 78bf80f4bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 88bf80f4bSopenharmony_ci * 98bf80f4bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 108bf80f4bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 118bf80f4bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128bf80f4bSopenharmony_ci * See the License for the specific language governing permissions and 138bf80f4bSopenharmony_ci * limitations under the License. 148bf80f4bSopenharmony_ci */ 158bf80f4bSopenharmony_ci#ifndef __LUME_COFF__ 168bf80f4bSopenharmony_ci#define __LUME_COFF__ 178bf80f4bSopenharmony_ci#include <cstdint> 188bf80f4bSopenharmony_ci#define IMAGE_FILE_MACHINE_UNKNOWN 0 198bf80f4bSopenharmony_ci#define IMAGE_FILE_MACHINE_I386 0x014c 208bf80f4bSopenharmony_ci#define IMAGE_FILE_MACHINE_AMD64 0x8664 218bf80f4bSopenharmony_ci#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40 228bf80f4bSopenharmony_ci#define IMAGE_SCN_ALIGN_4BYTES 0x300000 238bf80f4bSopenharmony_ci#define IMAGE_SCN_MEM_READ 0x40000000 248bf80f4bSopenharmony_ci#define IMAGE_SYM_TYPE_CHAR 0x2 258bf80f4bSopenharmony_ci#define IMAGE_SYM_DTYPE_ARRAY 0x3 268bf80f4bSopenharmony_ci#define IMAGE_SYM_CLASS_EXTERNAL 0x2 278bf80f4bSopenharmony_ci#pragma pack(push, 4) 288bf80f4bSopenharmony_citypedef struct _IMAGE_FILE_HEADER { 298bf80f4bSopenharmony_ci uint16_t Machine; 308bf80f4bSopenharmony_ci uint16_t NumberOfSections; 318bf80f4bSopenharmony_ci uint32_t TimeDateStamp; 328bf80f4bSopenharmony_ci uint32_t PointerToSymbolTable; 338bf80f4bSopenharmony_ci uint32_t NumberOfSymbols; 348bf80f4bSopenharmony_ci uint16_t SizeOfOptionalHeader; 358bf80f4bSopenharmony_ci uint16_t Characteristics; 368bf80f4bSopenharmony_ci} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; 378bf80f4bSopenharmony_ci 388bf80f4bSopenharmony_citypedef struct _IMAGE_SECTION_HEADER { 398bf80f4bSopenharmony_ci uint8_t Name[8]; 408bf80f4bSopenharmony_ci union { 418bf80f4bSopenharmony_ci uint32_t PhysicalAddress; 428bf80f4bSopenharmony_ci uint32_t VirtualSize; 438bf80f4bSopenharmony_ci } Misc; 448bf80f4bSopenharmony_ci uint32_t VirtualAddress; 458bf80f4bSopenharmony_ci uint32_t SizeOfRawData; 468bf80f4bSopenharmony_ci uint32_t PointerToRawData; 478bf80f4bSopenharmony_ci uint32_t PointerToRelocations; 488bf80f4bSopenharmony_ci uint32_t PointerToLinenumbers; 498bf80f4bSopenharmony_ci uint16_t NumberOfRelocations; 508bf80f4bSopenharmony_ci uint16_t NumberOfLinenumbers; 518bf80f4bSopenharmony_ci uint32_t Characteristics; 528bf80f4bSopenharmony_ci} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; 538bf80f4bSopenharmony_ci#pragma pack(pop) 548bf80f4bSopenharmony_ci#pragma pack(push, 2) 558bf80f4bSopenharmony_citypedef struct _IMAGE_SYMBOL { 568bf80f4bSopenharmony_ci union { 578bf80f4bSopenharmony_ci uint8_t ShortName[8]; 588bf80f4bSopenharmony_ci struct { 598bf80f4bSopenharmony_ci uint32_t Short; 608bf80f4bSopenharmony_ci uint32_t Long; 618bf80f4bSopenharmony_ci } Name; 628bf80f4bSopenharmony_ci uint32_t LongName[2]; 638bf80f4bSopenharmony_ci } N; 648bf80f4bSopenharmony_ci 658bf80f4bSopenharmony_ci uint32_t Value; 668bf80f4bSopenharmony_ci int16_t SectionNumber; 678bf80f4bSopenharmony_ci uint16_t Type; 688bf80f4bSopenharmony_ci uint8_t StorageClass; 698bf80f4bSopenharmony_ci uint8_t NumberOfAuxSymbols; 708bf80f4bSopenharmony_ci} IMAGE_SYMBOL; 718bf80f4bSopenharmony_ci#pragma pack(pop) 728bf80f4bSopenharmony_ci#endif