53 std::memcpy(&value,
address,
sizeof(
T));
73 return {std::format(
".?AV{}@@", name), std::format(
".?AU{}@@", name)};
95 if (name && std::memcmp(name,
mangled.c_str(),
mangled.size() + 1) == 0)
164 std::vector<int32_t> offsets;
187 return std::unexpected(
199 const int32_t offset = offsets.front();
221 for (
WORD i = 0;
i <
nt->FileHeader.NumberOfSections; ++
i)
241 return {
module.Base + sections[i].VirtualAddress, size};
248 return {.Base =
module.Base,
250 .Data = FindSection(module, ".data"),
251 .ReadOnlyData = FindSection(module, ".rdata")};
257 if (!
rtti.Data.Base || !
rtti.ReadOnlyData.Base)
267 if (!
rtti.Data.Base || !
rtti.ReadOnlyData.Base)
269 return std::unexpected(
Error::NotFound(
"the module has no RTTI sections"));
static constexpr size_t BaseVirtualOffset
Result< BaseSubobject > FindBaseInRtti(const PeRtti &rtti, std::string_view className, std::string_view baseName)
static const uint8_t * AtRva(const PeRtti &rtti, int64_t rva, size_t bytes)
static const uint8_t * FindLocator(const PeRtti &rtti, uint32_t typeDescriptor, uint32_t offset)
static uint32_t FindTypeDescriptor(const PeRtti &rtti, std::string_view className)
static const uint8_t * End(const ScanRange &range)
static constexpr size_t LocatorTypeDescriptor
static bool TypeDescriptorMatches(const PeRtti &rtti, int32_t rva, std::span< const std::string > names)
static std::string ReadFile(const std::filesystem::path &path)
static constexpr size_t LocatorHierarchy
static std::pair< uint32_t, const uint8_t * > PrimaryLocator(const PeRtti &rtti, std::string_view className)
static constexpr size_t BaseMemberOffset
Result< BaseSubobject > FindBaseIn(const Image &module, std::string_view className, std::string_view baseName)
static constexpr size_t HierarchyBaseList
static PeRtti RttiOf(const Image &module)
void * FindVirtualTableInRtti(const PeRtti &rtti, std::string_view className)
static constexpr size_t HierarchyBaseCount
static void * TableAfter(const PeRtti &rtti, const uint8_t *locator)
static constexpr uint32_t MaxBases
static ScanRange FindSection(const Image &module, std::string_view name)
static constexpr size_t LocatorSelf
static constexpr size_t TypeDescriptorName
static constexpr size_t HierarchySize
static constexpr size_t LocatorOffset
static constexpr size_t LocatorSize
std::expected< T, Error > Result
T ReadAt(void *base, std::ptrdiff_t offset) noexcept
static const uint8_t * FindValue(const uint8_t *begin, const uint8_t *end, const void *needle, size_t len, size_t stride)
static std::array< std::string, 2 > ClassAndStructNames(std::string_view name)
static constexpr size_t BaseSize
void * FindVirtualTableIn(const Image &module, std::string_view className)
static Error Invalid(std::string detail)
static Error Unsupported(std::string detail)
static Error NotFound(std::string detail)