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 <ostream>
21
22#include "LIEF/Object.hpp"
23#include "LIEF/visibility.h"
24
25#include "LIEF/Abstract/Symbol.hpp"
26#include "LIEF/PE/enums.hpp"
27
28namespace LIEF {
29namespace PE {
30
31class Parser;
32class Builder;
33class Section;
34
35namespace details {
36struct pe_symbol;
37}
38
40class LIEF_API Symbol : public LIEF::Symbol {
41
42 friend class Parser;
43 friend class Builder;
44
45 public:
46 Symbol(const details::pe_symbol& header);
47
48 Symbol();
49 ~Symbol() override;
50
51 Symbol& operator=(Symbol other);
52 Symbol(const Symbol& other);
53 void swap(Symbol& other);
54
55 int16_t section_number() const;
56 uint16_t type() const;
57 SYMBOL_BASE_TYPES base_type() const;
58 SYMBOL_COMPLEX_TYPES complex_type() const;
59 SYMBOL_STORAGE_CLASS storage_class() const;
60 uint8_t numberof_aux_symbols() const;
61 std::wstring wname() const;
62 Section* section();
63 const Section* section() const;
64
66 bool has_section() const;
67
68 void accept(Visitor& visitor) const override;
69
70
71 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Symbol& entry);
72
73 private:
74 int16_t section_number_ = 0;
75 uint16_t type_ = 0;
76 uint8_t numberof_aux_symbols_ = 0;
77 Section* section_ = nullptr;
78 SYMBOL_STORAGE_CLASS storage_class_ = SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_INVALID;
79};
80
81
82} // namespace PE
83} // namespace LIEF
84#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:40
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