LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
BigObjHeader.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_COFF_BIGOBJ_HEADER_H
17#define LIEF_COFF_BIGOBJ_HEADER_H
18#include <cstdint>
19#include <array>
20
21#include "LIEF/COFF/Header.hpp"
22
24#include "LIEF/visibility.h"
25#include "LIEF/span.hpp"
26
27namespace LIEF {
28namespace COFF {
29
36 public:
37 static constexpr auto UUID_SZ = 16;
39 Header(KIND::BIGOBJ) {}
40
41 static std::unique_ptr<BigObjHeader> create(BinaryStream& stream);
42
44 BigObjHeader(const BigObjHeader&) = default;
45
48
49 std::unique_ptr<Header> clone() const override {
50 return std::unique_ptr<Header>(new BigObjHeader(*this));
51 }
52
54 uint16_t version() const {
55 return version_;
56 }
57
61 return uuid_;
62 }
63
65 uint32_t sizeof_data() const {
66 return sizeof_data_;
67 }
68
70 uint32_t flags() const {
71 return flags_;
72 }
73
75 uint32_t metadata_size() const {
76 return metadata_size_;
77 }
78
80 uint32_t metadata_offset() const {
81 return metadata_offset_;
82 }
83
84 void version(uint16_t value) {
85 version_ = value;
86 }
87
88 void sizeof_data(uint32_t value) {
89 sizeof_data_ = value;
90 }
91
92 void flags(uint32_t value) {
93 flags_ = value;
94 }
95
96 void metadata_size(uint32_t value) {
97 metadata_size_ = value;
98 }
99
100 void metadata_offset(uint32_t value) {
101 metadata_offset_ = value;
102 }
103
104 static bool classof(const Header* header) {
105 return header->kind() == Header::KIND::BIGOBJ;
106 }
107
108 ~BigObjHeader() override = default;
109
110 std::string to_string() const override;
111
112 protected:
113 uint16_t version_ = 0;
114 std::array<uint8_t, UUID_SZ> uuid_ = {};
115
116 uint32_t sizeof_data_ = 0;
117 uint32_t flags_ = 0;
118 uint32_t metadata_size_ = 0;
119 uint32_t metadata_offset_ = 0;
120};
121
122}
123}
124#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:34
uint32_t metadata_size() const
Size of CLR metadata.
Definition BigObjHeader.hpp:75
void flags(uint32_t value)
Definition BigObjHeader.hpp:92
uint32_t flags() const
1 means that it contains metadata
Definition BigObjHeader.hpp:70
static std::unique_ptr< BigObjHeader > create(BinaryStream &stream)
uint32_t sizeof_data() const
Size of data that follows the header.
Definition BigObjHeader.hpp:65
BigObjHeader()
Definition BigObjHeader.hpp:38
void version(uint16_t value)
Definition BigObjHeader.hpp:84
std::string to_string() const override
std::unique_ptr< Header > clone() const override
Definition BigObjHeader.hpp:49
static constexpr auto UUID_SZ
Definition BigObjHeader.hpp:37
void sizeof_data(uint32_t value)
Definition BigObjHeader.hpp:88
void metadata_size(uint32_t value)
Definition BigObjHeader.hpp:96
static bool classof(const Header *header)
Definition BigObjHeader.hpp:104
span< const uint8_t > uuid() const
Originally named ClassID, this uuid should match: {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8}...
Definition BigObjHeader.hpp:60
void metadata_offset(uint32_t value)
Definition BigObjHeader.hpp:100
BigObjHeader & operator=(BigObjHeader &&)=default
BigObjHeader & operator=(const BigObjHeader &)=default
BigObjHeader(BigObjHeader &&)=default
BigObjHeader(const BigObjHeader &)=default
uint32_t metadata_offset() const
Offset of CLR metadata.
Definition BigObjHeader.hpp:80
~BigObjHeader() override=default
uint16_t version() const
The version of this header which must be >= 2.
Definition BigObjHeader.hpp:54
KIND kind() const
The type of this header: whether it is regular or using the /bigobj format.
Definition COFF/Header.hpp:62
KIND
Definition COFF/Header.hpp:35
@ BIGOBJ
Definition COFF/Header.hpp:38
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition AuxiliarySymbol.hpp:30
LIEF namespace.
Definition Abstract/Binary.hpp:41
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:45