blob: bff8bd61e36d77f03b9d134badb757c4d9990289 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// Copyright (c) 2017 Egor Tensin <Egor.Tensin@gmail.com>
// This file is part of the "PDB repository" project.
// For details, see https://github.com/egor-tensin/pdb-repo.
// Distributed under the MIT License.
#pragma once
#include "address.hpp"
#include <DbgHelp.h>
#include <Windows.h>
#include <string>
namespace pdb {
class ModuleInfo {
public:
typedef IMAGEHLP_MODULE64 Impl;
ModuleInfo();
explicit ModuleInfo(const Impl& impl);
explicit operator Impl&() { return impl; }
explicit operator const Impl&() const { return impl; }
Address get_offline_base() const { return impl.BaseOfImage; }
std::string get_name() const { return impl.ModuleName; }
private:
static Impl create_impl();
Impl impl;
};
class Module : public ModuleInfo {
public:
Module(Address online_base, const ModuleInfo& info)
: ModuleInfo{info}, online_base{online_base} {}
Address get_online_base() const { return online_base; }
Address translate_offline_address(Address offline) const;
Address translate_online_address(Address online) const;
private:
std::string invalid_offline_address(Address offline) const;
std::string invalid_online_address(Address online) const;
const Address online_base;
};
} // namespace pdb
|