| 68 | bool SK_SEH_CompatibleCallerName (LPCVOID lpAddr, wchar_t* wszDllFullName);\ |
| 69 | |
| 70 | HMODULE |
| 71 | SK_Debug_LoadHelper (void) |
| 72 | { |
| 73 | static HMODULE hModDbgHelp = nullptr; |
| 74 | static volatile LONG __init = 0; |
| 75 | |
| 76 | // Isolate and load the system DLL as a different module since |
| 77 | // dbghelp.dll is not threadsafe and other software may be using |
| 78 | // the system DLL. |
| 79 | if (! InterlockedCompareExchangeAcquire (&__init, 1, 0)) |
| 80 | { |
| 81 | static std::filesystem::path path_to_driver = |
| 82 | std::filesystem::path (SK_GetInstallPath ()) / |
| 83 | LR"(Drivers\Dbghelp\)"; |
| 84 | |
| 85 | wchar_t wszSystemDbgHelp [MAX_PATH + 2] = { }; |
| 86 | wchar_t wszIsolatedDbgHelp [MAX_PATH + 2] = { }; |
| 87 | |
| 88 | GetSystemDirectory (wszSystemDbgHelp, MAX_PATH ); |
| 89 | PathAppendW (wszSystemDbgHelp, L"dbghelp.dll"); |
| 90 | |
| 91 | lstrcatW (wszIsolatedDbgHelp, path_to_driver.c_str ()); |
| 92 | PathAppendW (wszIsolatedDbgHelp, |
| 93 | SK_RunLHIfBitness (64, L"dbghelp_sk64.dll", |
| 94 | L"dbghelp_sk32.dll")); |
| 95 | |
| 96 | if ( FALSE == PathFileExistsW (wszIsolatedDbgHelp) || |
| 97 | FALSE == SK_Assert_SameDLLVersion (wszIsolatedDbgHelp, |
| 98 | wszSystemDbgHelp) |
| 99 | ) |
| 100 | { |
| 101 | if (PathFileExistsW (wszIsolatedDbgHelp)) |
| 102 | { |
| 103 | SK_LOGi0 ( |
| 104 | L"Performing in-place upgrade for %ws", |
| 105 | SK_StripUserNameFromPathW ( |
| 106 | (std::wstring (wszIsolatedDbgHelp) + L'\0').data () |
| 107 | ) |
| 108 | ); |
| 109 | |
| 110 | wchar_t |
| 111 | wszTemp [MAX_PATH + 2] = { }; |
| 112 | |
| 113 | GetTempFileNameW (path_to_driver.c_str (), |
| 114 | L"SKI", SK_timeGetTime (), |
| 115 | wszTemp); |
| 116 | SK_File_MoveNoFail (wszIsolatedDbgHelp, wszTemp); |
| 117 | } |
| 118 | |
| 119 | SK_DeleteTemporaryFiles (path_to_driver.c_str ()); |
| 120 | |
| 121 | SK_CreateDirectories (wszIsolatedDbgHelp); |
| 122 | CopyFileW ( |
| 123 | wszSystemDbgHelp, wszIsolatedDbgHelp, TRUE); |
| 124 | } |
| 125 | |
| 126 | _Notnull_ auto* mods = |
| 127 | SK_Modules.getPtr (); |
no test coverage detected