1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[misc] fix improper processing of net related errors

* With thanks to @Wack0
* Also silence a Coverity warning
This commit is contained in:
Pete Batard 2023-09-08 16:57:39 +01:00
parent 94ecf74c5f
commit 98725a0d5f
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 12 additions and 7 deletions

View file

@ -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.3.2080"
CAPTION "Rufus 4.3.2081"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -392,8 +392,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,3,2080,0
PRODUCTVERSION 4,3,2080,0
FILEVERSION 4,3,2081,0
PRODUCTVERSION 4,3,2081,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.3.2080"
VALUE "FileVersion", "4.3.2081"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.3.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.3.2080"
VALUE "ProductVersion", "4.3.2081"
END
END
BLOCK "VarFileInfo"

View file

@ -27,6 +27,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <wininet.h>
#include <winternl.h>
#include <dbghelp.h>
#include <assert.h>
@ -233,7 +234,10 @@ const char *WindowsErrorString(void)
error_code = GetLastError();
// Check for specific facility error codes
switch (HRESULT_FACILITY(error_code)) {
case FACILITY_HTTP:
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))
hModule = GetModuleHandleA("wininet.dll");
break;
case FACILITY_ITF:
@ -248,6 +252,7 @@ const char *WindowsErrorString(void)
static_sprintf(err_string, "[0x%08lX] ", error_code);
presize = (DWORD)strlen(err_string);
// coverity[var_deref_model]
size = FormatMessageU(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
((hModule != NULL) ? FORMAT_MESSAGE_FROM_HMODULE : 0), hModule,
HRESULT_CODE(error_code), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),