MCPcopy Create free account
hub / github.com/Parchive/par2cmdline / ErrorMessage

Method ErrorMessage

src/diskfile.cpp:1081–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1079
1080#ifdef _WIN32
1081std::string DiskFile::ErrorMessage(DWORD error)
1082{
1083 std::string result;
1084
1085 LPVOID lpMsgBuf;
1086 if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
1087 NULL,
1088 error,
1089 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
1090 (LPWSTR)&lpMsgBuf,
1091 0,
1092 NULL))
1093 {
1094 result = utf8::WideToUtf8((wchar_t*)lpMsgBuf);
1095 LocalFree(lpMsgBuf);
1096 }
1097 else
1098 {
1099 char message[40];
1100 snprintf(message, sizeof(message), "Unknown error code (%lu)", error);
1101 result = message;
1102 }
1103
1104 return result;
1105}
1106
1107bool DiskFile::Rename(std::string _filename)
1108{

Callers

nothing calls this directly

Calls 1

WideToUtf8Function · 0.85

Tested by

no test coverage detected