diff --git a/src/rufus.rc b/src/rufus.rc index 2e094160c15..7d3c20aee04 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 4.6.2205" +CAPTION "Rufus 4.6.2206" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -399,8 +399,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,2205,0 - PRODUCTVERSION 4,6,2205,0 + FILEVERSION 4,6,2206,0 + PRODUCTVERSION 4,6,2206,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -418,13 +418,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "4.6.2205" + VALUE "FileVersion", "4.6.2206" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2024 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-4.6.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "4.6.2205" + VALUE "ProductVersion", "4.6.2206" END END BLOCK "VarFileInfo" diff --git a/src/stdio.c b/src/stdio.c index a6c257b403e..db6d9086ed3 100644 --- a/src/stdio.c +++ b/src/stdio.c @@ -233,16 +233,18 @@ const char *WindowsErrorString(void) static char err_string[256] = { 0 }; DWORD size, presize; - DWORD error_code, format_error; + DWORD error_code, _error_code, format_error; HANDLE hModule = NULL; error_code = GetLastError(); + _error_code = error_code; +retry: // Check for specific facility error codes - switch (HRESULT_FACILITY(error_code)) { + switch (HRESULT_FACILITY(_error_code)) { case FACILITY_NULL: // Special case for internet related errors, that don't actually have a facility // set but still require a hModule into wininet to display the messages. - if ((error_code >= INTERNET_ERROR_BASE) && (error_code <= INTERNET_ERROR_LAST)) + if ((_error_code >= INTERNET_ERROR_BASE) && (_error_code <= INTERNET_ERROR_LAST)) hModule = GetModuleHandleA("wininet.dll"); break; case FACILITY_ITF: @@ -260,22 +262,26 @@ const char *WindowsErrorString(void) // coverity[var_deref_model] size = FormatMessageU(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | ((hModule != NULL) ? FORMAT_MESSAGE_FROM_HMODULE : 0), hModule, - error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + _error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), &err_string[presize], (DWORD)(sizeof(err_string) - strlen(err_string)), NULL); if (size == 0) { format_error = GetLastError(); switch (format_error) { case ERROR_SUCCESS: - static_sprintf(err_string, "[0x%08lX] (No Windows Error String)", error_code); + static_sprintf(err_string, "[0x%08lX] (No Windows Error String)", _error_code); break; case ERROR_MR_MID_NOT_FOUND: case ERROR_MUI_FILE_NOT_FOUND: case ERROR_MUI_FILE_NOT_LOADED: + // We might be trying with the wrong facility. Remove it and try again. + if (HRESULT_FACILITY(_error_code) != FACILITY_NULL) { + _error_code = HRESULT_CODE(_error_code); + goto retry; + } static_sprintf(err_string, "[0x%08lX] (NB: This system was unable to provide an English error message)", error_code); break; default: - static_sprintf(err_string, "[0x%08lX] (FormatMessage error code 0x%08lX)", - error_code, format_error); + static_sprintf(err_string, "[0x%08lX] (FormatMessage error code 0x%08lX)", error_code, format_error); break; } } else {