LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
ART/Header.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 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_ART_HEADER_H
17#define LIEF_ART_HEADER_H
18
19#include <array>
20#include <cstdint>
21
22#include "LIEF/ART/types.hpp"
23#include "LIEF/ART/enums.hpp"
24
25#include "LIEF/visibility.h"
26#include "LIEF/Object.hpp"
27
28namespace LIEF {
29namespace ART {
30class Parser;
31
32class LIEF_API Header : public Object {
33 friend class Parser;
34
35 public:
36 using magic_t = std::array<uint8_t, 4>;
37
39
40 template<class T>
41 LIEF_LOCAL Header(const T* header);
42
43 Header(const Header&);
44 Header& operator=(const Header&);
45
46 magic_t magic() const;
48
49 uint32_t image_begin() const;
50 uint32_t image_size() const;
51
52 uint32_t oat_checksum() const;
53
54 uint32_t oat_file_begin() const;
55 uint32_t oat_file_end() const;
56
57 uint32_t oat_data_begin() const;
58 uint32_t oat_data_end() const;
59
60 int32_t patch_delta() const;
61
62 uint32_t image_roots() const;
63
64 uint32_t pointer_size() const;
65 bool compile_pic() const;
66
67 uint32_t nb_sections() const;
68 uint32_t nb_methods() const;
69
70 uint32_t boot_image_begin() const;
71 uint32_t boot_image_size() const;
72
73 uint32_t boot_oat_begin() const;
74 uint32_t boot_oat_size() const;
75
77
78 uint32_t data_size() const;
79
80 void accept(Visitor& visitor) const override;
81
82
83 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Header& hdr);
84
85 ~Header() override;
86
87 private:
88 magic_t magic_;
89 art_version_t version_;
90
91 uint32_t image_begin_;
92 uint32_t image_size_;
93
94 uint32_t oat_checksum_;
95
96 uint32_t oat_file_begin_;
97 uint32_t oat_file_end_;
98
99 uint32_t oat_data_begin_;
100 uint32_t oat_data_end_;
101
102 int32_t patch_delta_;
103 uint32_t image_roots_;
104
105 uint32_t pointer_size_;
106
107 bool compile_pic_;
108
109 uint32_t nb_sections_;
110 uint32_t nb_methods_;
111
112 bool is_pic_;
113
114 // From ART 29
115 // ===========
116 uint32_t boot_image_begin_;
117 uint32_t boot_image_size_;
118
119 uint32_t boot_oat_begin_;
120 uint32_t boot_oat_size_;
121
122 STORAGE_MODES storage_mode_;
123
124 uint32_t data_size_;
125};
126
127} // Namespace ART
128} // Namespace LIEF
129
130#endif
Definition ART/Header.hpp:32
Header & operator=(const Header &)
bool compile_pic() const
uint32_t boot_image_begin() const
uint32_t nb_sections() const
uint32_t image_size() const
uint32_t data_size() const
STORAGE_MODES storage_mode() const
friend std::ostream & operator<<(std::ostream &os, const Header &hdr)
uint32_t pointer_size() const
~Header() override
Header(const T *header)
magic_t magic() const
uint32_t oat_file_end() const
uint32_t nb_methods() const
uint32_t image_begin() const
art_version_t version() const
void accept(Visitor &visitor) const override
uint32_t boot_oat_begin() const
int32_t patch_delta() const
uint32_t oat_data_end() const
Header(const Header &)
uint32_t oat_file_begin() const
uint32_t boot_image_size() const
uint32_t boot_oat_size() const
uint32_t oat_data_begin() const
uint32_t oat_checksum() const
uint32_t image_roots() const
Class which parses an ART file and transform into a ART::File object.
Definition ART/Parser.hpp:32
Namespace related to the LIEF's ART module.
Definition ART/enums.hpp:20
STORAGE_MODES
Definition ART/enums.hpp:22
uint32_t art_version_t
Definition ART/types.hpp:26
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41
#define LIEF_LOCAL
Definition visibility.h:42