MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetWindowsErrorMessage

Function GetWindowsErrorMessage

src/leveldb/util/env_windows.cc:52–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50int g_mmap_limit = kDefaultMmapLimit;
51
52std::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
69Status WindowsError(const std::string& context, DWORD error_code) {
70 if (error_code == ERROR_FILE_NOT_FOUND || error_code == ERROR_PATH_NOT_FOUND)

Callers 4

WindowsErrorFunction · 0.85
ReadMethod · 0.85
SyncMethod · 0.85
WriteUnbufferedMethod · 0.85

Calls 1

assignMethod · 0.45

Tested by

no test coverage detected