LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
RegularHeader.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_COFF_REGULAR_HEADER_H
16#define LIEF_COFF_REGULAR_HEADER_H
17#include "LIEF/COFF/Header.hpp"
18#include "LIEF/visibility.h"
19#include <cstdint>
20
21
22namespace LIEF::COFF {
23
26 public:
28 Header(KIND::REGULAR) {}
29
31 static std::unique_ptr<RegularHeader> create(BinaryStream& stream);
32
34 RegularHeader(const RegularHeader&) = default;
35
38
39 std::unique_ptr<Header> clone() const override {
40 return std::unique_ptr<Header>(new RegularHeader(*this));
41 }
42
44 uint16_t sizeof_optionalheader() const {
45 return sizeof_optionalheader_;
46 }
47
49 uint16_t characteristics() const {
50 return characteristics_;
51 }
52
53 void sizeof_optionalheader(uint16_t value) {
54 sizeof_optionalheader_ = value;
55 }
56
57 void characteristics(uint16_t value) {
58 characteristics_ = value;
59 }
60
61 static bool classof(const Header* header) {
62 return header->kind() == Header::KIND::REGULAR;
63 }
64
65 ~RegularHeader() override = default;
66
67 std::string to_string() const override;
68
69 protected:
70 uint16_t sizeof_optionalheader_ = 0;
71 uint16_t characteristics_ = 0;
72};
73
74}
75
76#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:34
KIND kind() const
The type of this header: whether it is regular or using the /bigobj format.
Definition COFF/Header.hpp:61
KIND
Definition COFF/Header.hpp:34
@ REGULAR
Definition COFF/Header.hpp:36
RegularHeader()
Definition RegularHeader.hpp:27
RegularHeader(const RegularHeader &)=default
RegularHeader & operator=(RegularHeader &&)=default
uint16_t sizeof_optionalheader() const
The size of the optional header which follows this header (should be 0).
Definition RegularHeader.hpp:44
void characteristics(uint16_t value)
Definition RegularHeader.hpp:57
RegularHeader(RegularHeader &&)=default
std::unique_ptr< Header > clone() const override
Definition RegularHeader.hpp:39
void sizeof_optionalheader(uint16_t value)
Definition RegularHeader.hpp:53
std::string to_string() const override
static bool classof(const Header *header)
Definition RegularHeader.hpp:61
static std::unique_ptr< RegularHeader > create(BinaryStream &stream)
Create a RegularHeader from the given stream.
uint16_t characteristics() const
Characteristics.
Definition RegularHeader.hpp:49
~RegularHeader() override=default
RegularHeader & operator=(const RegularHeader &)=default
Definition AuxiliarySymbol.hpp:29
#define LIEF_API
Definition visibility.h:44