| 24 | HANDLE g_hSingleInstMutex{ nullptr }; |
| 25 | |
| 26 | void 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 | |
| 50 | void ClearSymbols() { |
| 51 | WCHAR path[MAX_PATH]; |
no test coverage detected