MCPcopy Create free account
hub / github.com/ddnet/ddnet / windows_format_system_message

Function windows_format_system_message

src/base/windows.cpp:14–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#include <windows.h>
13
14std::string windows_format_system_message(unsigned long error)
15{
16 WCHAR *wide_message;
17 const DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_MAX_WIDTH_MASK;
18 if(FormatMessageW(flags, nullptr, error, 0, (LPWSTR)&wide_message, 0, nullptr) == 0)
19 return "unknown error";
20
21 std::optional<std::string> message = windows_wide_to_utf8(wide_message);
22 LocalFree(wide_message);
23 return message.value_or("(invalid UTF-16 in error message)");
24}
25
26std::wstring windows_args_to_wide(const char **arguments, size_t num_arguments)
27{

Callers 11

InitMethod · 0.85
UpdateMethod · 0.85
secure_random_fillFunction · 0.85
fs_makedirFunction · 0.85
fs_removedirFunction · 0.85
fs_removeFunction · 0.85
fs_renameFunction · 0.85
windows_print_errorFunction · 0.85
net_error_messageFunction · 0.85

Calls 1

windows_wide_to_utf8Function · 0.85

Tested by

no test coverage detected