PStack  2.0
Stack trace printer for MSVC and GCC binaries
dll_export_iterator.hpp
Go to the documentation of this file.
1 // ===-- include/psystem/dll_export_iterator.hpp ---------- -*- C++ -*- --=== //
2 // Copyright (c) 2015 Matt Bisson. All rights reserved.
3 
19 #pragma once
20 #ifndef PSYSTEM_DLL_EXPORT_ITERATOR_HPP
21 #define PSYSTEM_DLL_EXPORT_ITERATOR_HPP
22 
23 #include "psystem_ns.hpp"
24 
25 namespace psystem {
26 
51  // : public std::iterator<
52  // std::forward_iterator_tag,
53  // std::pair<psystem::address_t, char const *>,
54  // size_t>
55 {
59 public:
78  uint8_t const *base_address,
79  integral_address_t const va_offset,
80  uint16_t const index,
81  uint32_t const *export_rva,
82  uint16_t const *idx_with_name,
83  uint32_t const *export_name_rva) noexcept;
84 
88 public:
97 
106  bool operator==(dll_export_iterator const& other) const;
107 
117  bool operator!=(dll_export_iterator const& other) const;
118 
122 public:
128  char const *get_export_name() const
129  {
130  return reinterpret_cast<char const*>(
132  }
133 
137 private:
139  uint8_t const *m_base_address;
140 
146 
147 public:
155  uint16_t const *m_idx_with_name;
156 
158  uint16_t m_current_idx;
159 
168  uint32_t const *m_export_rva;
169 
181  uint32_t const *m_export_name_rva;
182 };
183 
184 } // namespace psystem
185 
186 #endif // PSYSTEM_DLL_EXPORT_ITERATOR_HPP
dll_export_iterator & operator++()
Prefix increment.
Definition: dll_export_iterator.cpp:66
Iterator type for Windows Dynamic Link-Library (DLL) exports.
Definition: dll_export_iterator.hpp:50
uint32_t const * m_export_name_rva
Pointer to the array of exported symbol names.
Definition: dll_export_iterator.hpp:181
#define noexcept
Replace keyword with something useful.
Definition: platform.hpp:71
uint16_t const * m_idx_with_name
Pointer in the array of export indices that have names.
Definition: dll_export_iterator.hpp:155
char const * get_export_name() const
Retrieve the name of the current exported symbol.
Definition: dll_export_iterator.hpp:128
The basic header file for the PSystem namespce.
Contains the process examination "system" and basic frameworks.
Definition: pstack_event_handler.hpp:28
std::ptrdiff_t integral_address_t
A memory address as an integer type (platform specific).
Definition: platform.hpp:228
uint16_t m_current_idx
Index to the current exported symbol.
Definition: dll_export_iterator.hpp:158
bool operator!=(dll_export_iterator const &other) const
Determine the inequality of two instances.
Definition: dll_export_iterator.cpp:56
dll_export_iterator(uint8_t const *base_address, integral_address_t const va_offset, uint16_t const index, uint32_t const *export_rva, uint16_t const *idx_with_name, uint32_t const *export_name_rva) noexcept
Construct an instance of this DLL export iterator.
Definition: dll_export_iterator.cpp:26
integral_address_t m_va_offset
Offset required to translate the virtual address to a raw data pointer.
Definition: dll_export_iterator.hpp:145
uint8_t const * m_base_address
Address to the memory-mapped DLL image.
Definition: dll_export_iterator.hpp:139
bool operator==(dll_export_iterator const &other) const
Determine the equality of two instances.
Definition: dll_export_iterator.cpp:48
uint32_t const * m_export_rva
Pointer to the array of addresses of the exported symbols.
Definition: dll_export_iterator.hpp:168