-
Notifications
You must be signed in to change notification settings - Fork 2
/
symbol_enum.h
56 lines (48 loc) · 1.43 KB
/
symbol_enum.h
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
55
56
#pragma once
class SymbolEnum {
public:
enum class UndecorateMode {
Default = 0,
OldVersionCompatible,
None,
};
struct Callbacks {
std::function<bool()> queryCancel;
std::function<void(int)> notifyProgress;
std::function<void(PCSTR)> notifyLog;
};
SymbolEnum(HMODULE moduleBase,
PCWSTR enginePath,
PCWSTR symbolsPath,
PCWSTR symbolServer,
UndecorateMode undecorateMode,
Callbacks callbacks = {});
SymbolEnum(PCWSTR modulePath,
HMODULE moduleBase,
PCWSTR enginePath,
PCWSTR symbolsPath,
PCWSTR symbolServer,
UndecorateMode undecorateMode,
Callbacks callbacks = {});
struct Symbol {
void* address;
PCWSTR name;
PCWSTR nameDecorated;
};
std::optional<Symbol> GetNextSymbol();
private:
wil::com_ptr<IDiaDataSource> LoadMsdia();
static constexpr enum SymTagEnum kSymTags[] = {
SymTagPublicSymbol,
SymTagFunction,
SymTagData,
};
HMODULE m_moduleBase;
UndecorateMode m_undecorateMode;
wil::unique_hmodule m_msdiaModule;
wil::com_ptr<IDiaSymbol> m_diaGlobal;
wil::com_ptr<IDiaEnumSymbols> m_diaSymbols;
size_t m_symTagIndex = 0;
wil::unique_bstr m_currentSymbolName;
wil::unique_bstr m_currentDecoratedSymbolName;
};