-------------------------------------------------------------------------
| 122 | |
| 123 | //------------------------------------------------------------------------- |
| 124 | std::wstring ExceptionHandler::GetExceptionStrFromCode(DWORD exceptionCode) const |
| 125 | { |
| 126 | auto it = exceptionCode_.find(exceptionCode); |
| 127 | |
| 128 | if (it != exceptionCode_.end()) |
| 129 | return it->second; |
| 130 | |
| 131 | LPTSTR message = nullptr; |
| 132 | HMODULE ntDllModule = LoadLibrary(L"NTDLL.DLL"); |
| 133 | Tools::ScopedAction closeLibrary{ [=](){ FreeLibrary(ntDllModule); } }; |
| 134 | |
| 135 | FormatMessage( |
| 136 | FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 137 | FORMAT_MESSAGE_FROM_SYSTEM | |
| 138 | FORMAT_MESSAGE_FROM_HMODULE, |
| 139 | ntDllModule, |
| 140 | exceptionCode, |
| 141 | MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), |
| 142 | reinterpret_cast<LPTSTR>(&message), |
| 143 | 0, |
| 144 | nullptr); |
| 145 | Tools::ScopedAction freeMessage{ [=](){ LocalFree(message); } }; |
| 146 | |
| 147 | if (message) |
| 148 | return message; |
| 149 | |
| 150 | return ExceptionUnknown; |
| 151 | } |
| 152 | } |
nothing calls this directly
no outgoing calls
no test coverage detected