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 {
24class LIEF_API RegularHeader : public Header {
27 public:
29 Header(KIND::REGULAR)
30 {}
31 static std::unique_ptr<RegularHeader> create(BinaryStream& stream);
34
35 RegularHeader& operator=(const RegularHeader&) = default;
36 RegularHeader(const RegularHeader&) = default;
37
38 RegularHeader& operator=(RegularHeader&&) = default;
39 RegularHeader(RegularHeader&&) = default;
40
41 std::unique_ptr<Header> clone() const override {
42 return std::unique_ptr<Header>(new RegularHeader(*this));
43 }
44 uint16_t sizeof_optionalheader() const {
47 return sizeof_optionalheader_;
48 }
49 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
Header.hpp
LIEF::COFF::Header
Class that represents the COFF header. It is subclassed by LIEF::COFF::RegularHeader and LIEF::COFF::...
Definition COFF/Header.hpp:33
LIEF::COFF::Header::kind
KIND kind() const
The type of this header: whether it is regular or using the /bigobj format.
Definition COFF/Header.hpp:64
LIEF::COFF::RegularHeader
This class represents the COFF header for non-bigobj.
Definition RegularHeader.hpp:26
LIEF::COFF::RegularHeader::RegularHeader
RegularHeader()
Definition RegularHeader.hpp:28
LIEF::COFF::RegularHeader::RegularHeader
RegularHeader(const RegularHeader &)=default
LIEF::COFF::RegularHeader::operator=
RegularHeader & operator=(RegularHeader &&)=default
LIEF::COFF::RegularHeader::sizeof_optionalheader
uint16_t sizeof_optionalheader() const
The size of the optional header that follows this header (should be 0)
Definition RegularHeader.hpp:46
LIEF::COFF::RegularHeader::characteristics
void characteristics(uint16_t value)
Definition RegularHeader.hpp:59
LIEF::COFF::RegularHeader::RegularHeader
RegularHeader(RegularHeader &&)=default
LIEF::COFF::RegularHeader::clone
std::unique_ptr< Header > clone() const override
Definition RegularHeader.hpp:41
LIEF::COFF::RegularHeader::sizeof_optionalheader
void sizeof_optionalheader(uint16_t value)
Definition RegularHeader.hpp:55
LIEF::COFF::RegularHeader::to_string
std::string to_string() const override
LIEF::COFF::RegularHeader::classof
static bool classof(const Header *header)
Definition RegularHeader.hpp:63
LIEF::COFF::RegularHeader::create
static std::unique_ptr< RegularHeader > create(BinaryStream &stream)
Create a RegularHeader from the given stream.
LIEF::COFF::RegularHeader::characteristics
uint16_t characteristics() const
Characteristics.
Definition RegularHeader.hpp:51
LIEF::COFF::RegularHeader::~RegularHeader
~RegularHeader() override=default
LIEF::COFF::RegularHeader::operator=
RegularHeader & operator=(const RegularHeader &)=default
LIEF::COFF
Definition AuxiliarySymbol.hpp:29
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:39
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41