[misc] silence Coverity warnings

* Also update copyright year and improve uprintf error handling
* Also bump GitHub Actions dependencies. Note that we do NOT want to update to
  upload-artifact v4 because it BREAKS the creation of artifacts from matrix.
  See: https://github.com/actions/upload-artifact#v4---whats-new
* Closes #2382
* Closes #2383
This commit is contained in:
Pete Batard 2024-01-08 14:01:30 +00:00
parent 965d82c425
commit 51569d9e13
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
6 changed files with 33 additions and 19 deletions

View File

@ -43,7 +43,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v3
with: with:
languages: cpp languages: cpp
@ -56,4 +56,4 @@ jobs:
run: msbuild ${{env.SOLUTION_FILE_PATH}} /m /p:Configuration=${{ env.BUILD_CONFIGURATION}},Platform=${{ env.TARGET_PLATFORM }} run: msbuild ${{env.SOLUTION_FILE_PATH}} /m /p:Configuration=${{ env.BUILD_CONFIGURATION}},Platform=${{ env.TARGET_PLATFORM }}
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v3

View File

@ -12,7 +12,7 @@ cat > cmd.sed <<\_EOF
1i /*\ 1i /*\
* Rufus: The Reliable USB Formatting Utility\ * Rufus: The Reliable USB Formatting Utility\
* Localization tables - autogenerated from resource.h\ * Localization tables - autogenerated from resource.h\
* Copyright © 2013-2023 Pete Batard <pete@akeo.ie>\ * Copyright © 2013-2024 Pete Batard <pete@akeo.ie>\
*\ *\
* This program is free software: you can redistribute it and/or modify\ * This program is free software: you can redistribute it and/or modify\
* it under the terms of the GNU General Public License as published by\ * it under the terms of the GNU General Public License as published by\

View File

@ -4,7 +4,7 @@
* *
* Modified from System Informer (a.k.a. Process Hacker): * Modified from System Informer (a.k.a. Process Hacker):
* https://github.com/winsiderss/systeminformer * https://github.com/winsiderss/systeminformer
* Copyright © 2017-2023 Pete Batard <pete@akeo.ie> * Copyright © 2017-2024 Pete Batard <pete@akeo.ie>
* Copyright © 2017 dmex * Copyright © 2017 dmex
* Copyright © 2009-2016 wj32 * Copyright © 2009-2016 wj32
* *
@ -589,6 +589,7 @@ static DWORD WINAPI SearchProcessThread(LPVOID param)
pe[j].seen_on_pass = blocking_process.nPass; pe[j].seen_on_pass = blocking_process.nPass;
static_strcpy(pe[j].cmdline, cmdline); static_strcpy(pe[j].cmdline, cmdline);
} else if (usb_debug) { } else if (usb_debug) {
// coverity[dont_call]
OutputDebugStringA("SearchProcessThread: No empty slot!\n"); OutputDebugStringA("SearchProcessThread: No empty slot!\n");
} }
ReleaseMutex(hLock); ReleaseMutex(hLock);
@ -726,10 +727,12 @@ static DWORD WINAPI SearchProcessThread(LPVOID param)
// We are the only ones updating the counter so no need for lock // We are the only ones updating the counter so no need for lock
blocking_process.nPass++; blocking_process.nPass++;
// In extended debug mode, notify how much time our search took to the debug facility // In extended debug mode, notify how much time our search took to the debug facility
static_sprintf(tmp, "Process search run #%d completed in %llu ms\n", if (usb_debug) {
blocking_process.nPass, GetTickCount64() - start_time); static_sprintf(tmp, "Process search run #%d completed in %llu ms\n",
if (usb_debug) blocking_process.nPass, GetTickCount64() - start_time);
// coverity[dont_call]
OutputDebugStringA(tmp); OutputDebugStringA(tmp);
}
Sleep(1000); Sleep(1000);
} }

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.4.2094" CAPTION "Rufus 4.4.2096"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -392,8 +392,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,4,2094,0 FILEVERSION 4,4,2096,0
PRODUCTVERSION 4,4,2094,0 PRODUCTVERSION 4,4,2096,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.4.2094" VALUE "FileVersion", "4.4.2096"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2024 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.4.exe" VALUE "OriginalFilename", "rufus-4.4.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.4.2094" VALUE "ProductVersion", "4.4.2096"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -1,7 +1,7 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* Standard User I/O Routines (logging, status, error, etc.) * Standard User I/O Routines (logging, status, error, etc.)
* Copyright © 2011-2023 Pete Batard <pete@akeo.ie> * Copyright © 2011-2024 Pete Batard <pete@akeo.ie>
* Copyright © 2020 Mattiwatti <mattiwatti@gmail.com> * Copyright © 2020 Mattiwatti <mattiwatti@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -85,6 +85,7 @@ void uprintf(const char *format, ...)
wbuf = utf8_to_wchar(buf); wbuf = utf8_to_wchar(buf);
// Send output to Windows debug facility // Send output to Windows debug facility
// coverity[dont_call]
OutputDebugStringW(wbuf); OutputDebugStringW(wbuf);
if ((hLog != NULL) && (hLog != INVALID_HANDLE_VALUE)) { if ((hLog != NULL) && (hLog != INVALID_HANDLE_VALUE)) {
// Send output to our log Window // Send output to our log Window
@ -100,6 +101,7 @@ void uprintfs(const char* str)
{ {
wchar_t* wstr; wchar_t* wstr;
wstr = utf8_to_wchar(str); wstr = utf8_to_wchar(str);
// coverity[dont_call]
OutputDebugStringW(wstr); OutputDebugStringW(wstr);
if ((hLog != NULL) && (hLog != INVALID_HANDLE_VALUE)) { if ((hLog != NULL) && (hLog != INVALID_HANDLE_VALUE)) {
Edit_SetSel(hLog, MAX_LOG_SIZE, MAX_LOG_SIZE); Edit_SetSel(hLog, MAX_LOG_SIZE, MAX_LOG_SIZE);
@ -257,11 +259,20 @@ const char *WindowsErrorString(void)
&err_string[presize], (DWORD)(sizeof(err_string)-strlen(err_string)), NULL); &err_string[presize], (DWORD)(sizeof(err_string)-strlen(err_string)), NULL);
if (size == 0) { if (size == 0) {
format_error = GetLastError(); format_error = GetLastError();
if ((format_error) && (format_error != ERROR_MR_MID_NOT_FOUND) && (format_error != ERROR_MUI_FILE_NOT_LOADED)) switch (format_error) {
case ERROR_SUCCESS:
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:
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)", static_sprintf(err_string, "[0x%08lX] (FormatMessage error code 0x%08lX)",
error_code, format_error); error_code, format_error);
else break;
static_sprintf(err_string, "[0x%08lX] (No Windows Error String)", error_code); }
} else { } else {
// Microsoft may suffix CRLF to error messages, which we need to remove... // Microsoft may suffix CRLF to error messages, which we need to remove...
assert(presize > 2); assert(presize > 2);

View File

@ -1,7 +1,7 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* Standard Dialog Routines (Browse for folder, About, etc) * Standard Dialog Routines (Browse for folder, About, etc)
* Copyright © 2011-2023 Pete Batard <pete@akeo.ie> * Copyright © 2011-2024 Pete Batard <pete@akeo.ie>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -386,7 +386,7 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
ResizeButtonHeight(hDlg, IDOK); ResizeButtonHeight(hDlg, IDOK);
static_sprintf(about_blurb, about_blurb_format, lmprintf(MSG_174|MSG_RTF), static_sprintf(about_blurb, about_blurb_format, lmprintf(MSG_174|MSG_RTF),
lmprintf(MSG_175|MSG_RTF, rufus_version[0], rufus_version[1], rufus_version[2]), lmprintf(MSG_175|MSG_RTF, rufus_version[0], rufus_version[1], rufus_version[2]),
"Copyright © 2011-2023 Pete Batard", "Copyright © 2011-2024 Pete Batard",
lmprintf(MSG_176|MSG_RTF), lmprintf(MSG_177|MSG_RTF), lmprintf(MSG_178|MSG_RTF)); lmprintf(MSG_176|MSG_RTF), lmprintf(MSG_177|MSG_RTF), lmprintf(MSG_178|MSG_RTF));
for (i = 0; i < ARRAYSIZE(hEdit); i++) { for (i = 0; i < ARRAYSIZE(hEdit); i++) {
hEdit[i] = GetDlgItem(hDlg, edit_id[i]); hEdit[i] = GetDlgItem(hDlg, edit_id[i]);