LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
RegularHeader.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_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:
29 Header(KIND::REGULAR) {}
30
32 static std::unique_ptr<RegularHeader> create(BinaryStream& stream);
33
35 RegularHeader(const RegularHeader&) = default;
36
39
40 std::unique_ptr<Header> clone() const override {
41 return std::unique_ptr<Header>(new RegularHeader(*this));
42 }
43
45 uint16_t sizeof_optionalheader() const {
46 return sizeof_optionalheader_;
47 }
48
50 uint16_t characteristics() const {
51 return characteristics_;
52 }
53
54 void sizeof_optionalheader(uint16_t value) {
55 sizeof_optionalheader_ = value;
56 }
57
58 void characteristics(uint16_t value) {
59 characteristics_ = value;
60 }
61
62 static bool classof(const Header* header) {
63 return header->kind() == Header::KIND::REGULAR;
64 }
65
66 ~RegularHeader() override = default;
67
68 std::string to_string() const override;
69
70 protected:
71 uint16_t sizeof_optionalheader_ = 0;
72 uint16_t characteristics_ = 0;
73};
74
75}
76}
77#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:62
KIND
Definition COFF/Header.hpp:35
@ REGULAR
Definition COFF/Header.hpp:37
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:45
void characteristics(uint16_t value)
Definition RegularHeader.hpp:58
RegularHeader(RegularHeader &&)=default
std::unique_ptr< Header > clone() const override
Definition RegularHeader.hpp:40
void sizeof_optionalheader(uint16_t value)
Definition RegularHeader.hpp:54
std::string to_string() const override
static bool classof(const Header *header)
Definition RegularHeader.hpp:62
static std::unique_ptr< RegularHeader > create(BinaryStream &stream)
Create a RegularHeader from the given stream.
uint16_t characteristics() const
Characteristics.
Definition RegularHeader.hpp:50
~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:43