LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
PE/Symbol.hpp
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_PE_SYMBOLS_H
17#define LIEF_PE_SYMBOLS_H
18
19#include <string>
20#include <vector>
21#include <ostream>
22
23#include "LIEF/Object.hpp"
24#include "LIEF/visibility.h"
25
26#include "LIEF/Abstract/Symbol.hpp"
27#include "LIEF/PE/enums.hpp"
28
29namespace LIEF {
30namespace PE {
31
32class Parser;
33class Builder;
34class Section;
35
36namespace details {
37struct pe_symbol;
38}
39
41class LIEF_API Symbol : public LIEF::Symbol {
42
43 friend class Parser;
44 friend class Builder;
45
46 public:
47 Symbol(const details::pe_symbol& header);
48
49 Symbol();
50 ~Symbol() override;
51
52 Symbol& operator=(Symbol other);
53 Symbol(const Symbol& other);
54 void swap(Symbol& other);
55
56 int16_t section_number() const;
57 uint16_t type() const;
58 SYMBOL_BASE_TYPES base_type() const;
59 SYMBOL_COMPLEX_TYPES complex_type() const;
60 SYMBOL_STORAGE_CLASS storage_class() const;
61 uint8_t numberof_aux_symbols() const;
62 std::wstring wname() const;
63 Section* section();
64 const Section* section() const;
65
67 bool has_section() const;
68
69 void accept(Visitor& visitor) const override;
70
71
72 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Symbol& entry);
73
74 private:
75 int16_t section_number_ = 0;
76 uint16_t type_ = 0;
77 uint8_t numberof_aux_symbols_ = 0;
78 Section* section_ = nullptr;
79 SYMBOL_STORAGE_CLASS storage_class_ = SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_INVALID;
80
81};
82
83
84} // namespace PE
85} // namespace LIEF
86#endif /* SYMBOLS_H */
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
Class which represents a PE section.
Definition PE/Section.hpp:41
Class that represents a PE symbol.
Definition PE/Symbol.hpp:41
bool has_section() const
True if symbols are located in a section
This class represents a symbol in an executable format.
Definition Abstract/Symbol.hpp:28
Definition Visitor.hpp:219
SYMBOL_BASE_TYPES
Definition PE/enums.hpp:72
SYMBOL_STORAGE_CLASS
Storage class tells where and what the symbol represents.
Definition PE/enums.hpp:39
SYMBOL_COMPLEX_TYPES
Definition PE/enums.hpp:91
LIEF namespace.
Definition Abstract/Binary.hpp:32