mirror of
https://github.com/LegacyUpdate/LegacyUpdate.git
synced 2025-01-23 06:31:51 -05:00
Fix error messages not working
The docs say combining FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE
should work. It doesn't 🤷♀️
This commit is contained in:
parent
1405239be1
commit
49b29e76c4
1 changed files with 5 additions and 1 deletions
|
@ -27,7 +27,11 @@ EXTERN_C LPWSTR GetMessageForHresult(HRESULT hr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
LPWSTR message;
|
LPWSTR message;
|
||||||
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, g_messagesHModule, hr, LANG_NEUTRAL, (LPWSTR)&message, 0, NULL) == 0) {
|
if (FormatMessage(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, g_messagesHModule, hr, LANG_NEUTRAL, (LPWSTR)&message, 0, NULL) != 0) {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr, LANG_NEUTRAL, (LPWSTR)&message, 0, NULL) == 0) {
|
||||||
message = (LPWSTR)LocalAlloc(LPTR, 1024 * sizeof(WCHAR));
|
message = (LPWSTR)LocalAlloc(LPTR, 1024 * sizeof(WCHAR));
|
||||||
wsprintf(message, L"Error 0x%08X", hr);
|
wsprintf(message, L"Error 0x%08X", hr);
|
||||||
return message;
|
return message;
|
||||||
|
|
Loading…
Reference in a new issue