LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
RegularHeader.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 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_REGULAR_HEADER_H
17#define LIEF_COFF_REGULAR_HEADER_H
18#include <cstdint>
19#include "LIEF/COFF/Header.hpp"
20#include "LIEF/visibility.h"
21
22namespace LIEF {
23namespace COFF {
24
27 public:
31
33 static std::unique_ptr<RegularHeader> create(BinaryStream& stream);
34
36 RegularHeader(const RegularHeader&) = default;
37
40
41 std::unique_ptr<Header> clone() const override {
42 return std::unique_ptr<Header>(new RegularHeader(*this));
43 }
44
46 uint16_t sizeof_optionalheader() const {
47 return sizeof_optionalheader_;
48 }
49
51 uint16_t characteristics() const {
52 return characteristics_;
53 }
54
55 void sizeof_optionalheader(uint16_t value) {
56 sizeof_optionalheader_ = value;
57 }
58
59 void characteristics(uint16_t value) {
60 characteristics_ = value;
61 }
62
63 static bool classof(const Header* header) {
64 return header->kind() == Header::KIND::REGULAR;
65 }
66
67 ~RegularHeader() override = default;
68
69 std::string to_string() const override;
70
71 protected:
72 uint16_t sizeof_optionalheader_ = 0;
73 uint16_t characteristics_ = 0;
74};
75
76}
77}
78#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
KIND kind() const
The type of this header: whether it is regular or using the /bigobj format.
Definition COFF/Header.hpp:64
KIND
Definition COFF/Header.hpp:36
@ REGULAR
Definition COFF/Header.hpp:38
RegularHeader()
Definition RegularHeader.hpp:28
RegularHeader(const RegularHeader &)=default
RegularHeader & operator=(RegularHeader &&)=default
uint16_t sizeof_optionalheader() const
The size of the optional header that follows this header (should be 0).
Definition RegularHeader.hpp:46
void characteristics(uint16_t value)
Definition RegularHeader.hpp:59
RegularHeader(RegularHeader &&)=default
std::unique_ptr< Header > clone() const override
Definition RegularHeader.hpp:41
void sizeof_optionalheader(uint16_t value)
Definition RegularHeader.hpp:55
std::string to_string() const override
static bool classof(const Header *header)
Definition RegularHeader.hpp:63
static std::unique_ptr< RegularHeader > create(BinaryStream &stream)
Create a RegularHeader from the given stream.
uint16_t characteristics() const
Characteristics.
Definition RegularHeader.hpp:51
~RegularHeader() override=default
RegularHeader & operator=(const RegularHeader &)=default
Definition AuxiliarySymbol.hpp:29
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:41