mirror of
https://github.com/LegacyUpdate/LegacyUpdate.git
synced 2025-01-22 14:12:07 -05:00
Make hex error codes uppercase, remove title lines in braces
This commit is contained in:
parent
64f566990a
commit
2ee33d9c53
1 changed files with 10 additions and 1 deletions
|
@ -15,7 +15,8 @@ STDAPI_(LPWSTR) GetMessageForHresult(HRESULT hr) {
|
|||
|
||||
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&message, 0, NULL) == 0) {
|
||||
message = (LPWSTR)LocalAlloc(LPTR, 1024 * sizeof(WCHAR));
|
||||
wsprintf(message, L"Error 0x%08x", hr);
|
||||
wsprintf(message, L"Error 0x%08X", hr);
|
||||
return message;
|
||||
}
|
||||
|
||||
// Truncate trailing \r\n if any
|
||||
|
@ -24,5 +25,13 @@ STDAPI_(LPWSTR) GetMessageForHresult(HRESULT hr) {
|
|||
message[len - 2] = 0;
|
||||
}
|
||||
|
||||
// Remove title part in braces
|
||||
if (len > 1 && message[0] == '{') {
|
||||
LPWSTR closeBrace = wcsstr(message, L"}\r\n");
|
||||
if (closeBrace) {
|
||||
message = closeBrace + 3;
|
||||
}
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue