MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / InitSymbols

Function InitSymbols

WinArk/WinArk.cpp:26–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24HANDLE g_hSingleInstMutex{ nullptr };
25
26void InitSymbols(std::wstring fileName) {
27 WCHAR path[MAX_PATH];
28 ::GetSystemDirectory(path, MAX_PATH);
29 wcscat_s(path, L"\\");
30 wcscat_s(path, fileName.c_str());
31 PEParser parser(path);
32 auto dir = parser.GetDataDirectory(IMAGE_DIRECTORY_ENTRY_DEBUG);
33 if (dir != nullptr) {
34 SymbolFileInfo info;
35 auto entry = static_cast<PIMAGE_DEBUG_DIRECTORY>(parser.GetAddress(dir->VirtualAddress));
36 ULONG_PTR VA = reinterpret_cast<ULONG_PTR>(parser.GetBaseAddress());
37 info.GetPdbSignature(VA, entry);
38 ::GetCurrentDirectory(MAX_PATH, path);
39 wcscat_s(path, L"\\Symbols");
40 std::filesystem::create_directory(path);
41 bool success = info.SymDownloadSymbol(path);
42 if (!success)
43 g_hasSymbol = false;
44 }
45 else {
46 g_hasSymbol = false;
47 }
48}
49
50void ClearSymbols() {
51 WCHAR path[MAX_PATH];

Callers 1

RunFunction · 0.85

Calls 5

GetPdbSignatureMethod · 0.80
SymDownloadSymbolMethod · 0.80
GetDataDirectoryMethod · 0.45
GetAddressMethod · 0.45
GetBaseAddressMethod · 0.45

Tested by

no test coverage detected