MCPcopy Create free account
hub / github.com/Kitware/CMake / FormatSystemError

Method FormatSystemError

Source/cmWindowsRegistry.cxx:189–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189std::string KeyHandler::FormatSystemError(LSTATUS status)
190{
191 std::string formattedMessage{ "Windows Registry: unexpected error." };
192 LPWSTR message = nullptr;
193 DWORD size = 1024;
194 if (FormatMessageW(
195 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, nullptr,
196 status, 0, reinterpret_cast<LPWSTR>(&message), size, nullptr) != 0) {
197 try {
198 formattedMessage = cmTrimWhitespace(ToNarrow(message));
199 } catch (...) {
200 // ignore any exception because this method can be called
201 // as part of the raise of an exception
202 }
203 }
204 LocalFree(message);
205
206 return formattedMessage;
207}
208
209std::wstring KeyHandler::ToWide(cm::string_view str)
210{

Callers 3

ReadValueMethod · 0.95
GetValueNamesMethod · 0.95
GetSubKeysMethod · 0.95

Calls 1

cmTrimWhitespaceFunction · 0.85

Tested by

no test coverage detected