| 50 | int g_mmap_limit = kDefaultMmapLimit; |
| 51 | |
| 52 | std::string GetWindowsErrorMessage(DWORD error_code) { |
| 53 | std::string message; |
| 54 | char* error_text = nullptr; |
| 55 | // Use MBCS version of FormatMessage to match return value. |
| 56 | size_t error_text_size = ::FormatMessageA( |
| 57 | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 58 | FORMAT_MESSAGE_IGNORE_INSERTS, |
| 59 | nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 60 | reinterpret_cast<char*>(&error_text), 0, nullptr); |
| 61 | if (!error_text) { |
| 62 | return message; |
| 63 | } |
| 64 | message.assign(error_text, error_text_size); |
| 65 | ::LocalFree(error_text); |
| 66 | return message; |
| 67 | } |
| 68 | |
| 69 | Status WindowsError(const std::string& context, DWORD error_code) { |
| 70 | if (error_code == ERROR_FILE_NOT_FOUND || error_code == ERROR_PATH_NOT_FOUND) |
no test coverage detected