| 1079 | |
| 1080 | #ifdef _WIN32 |
| 1081 | std::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 | |
| 1107 | bool DiskFile::Rename(std::string _filename) |
| 1108 | { |
nothing calls this directly
no test coverage detected