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

Compare commits

...

3 commits

Author SHA1 Message Date
Pete Batard
3177e70e25
[misc] fix CodeQL warnings 2023-04-22 16:36:27 +01:00
Pete Batard
d18260bec3
[misc] update version to 4.0
* With the removal of Windows 7 support, wrong platform archs in the check for updates
  (that has now been fixed) and switch to an x86_64 default MinGW binary, we have enough
  breaking changes to warrant a version bump for the major. So just do that.
* Also fix a couple Coverity warnings and update a URL.
2023-04-22 15:46:03 +01:00
Pete Batard
41ebb9d9ca
[iso] fix persistence support for Ubuntu 23.04
* Closes #2231
2023-04-22 12:46:45 +01:00
16 changed files with 69 additions and 59 deletions

View file

@ -32,8 +32,8 @@ jobs:
strategy:
matrix:
include:
- { sys: mingw64, env: x86_64 }
- { sys: mingw32, env: i686 }
- { sys: mingw64, env: x86_64, exe: rufus.exe }
- { sys: mingw32, env: i686, exe: rufus_x86.exe }
defaults:
run:
@ -76,22 +76,22 @@ jobs:
run: |
./configure --disable-debug ${{ steps.set_alpha.outputs.option }} ${{ steps.set_beta.outputs.option }}
make -j4
mv ./src/rufus.exe .
strip ./rufus.exe
upx --lzma --best ./rufus.exe
mv ./src/rufus.exe ./${{ matrix.exe }}
strip ./${{ matrix.exe }}
upx --lzma --best ./${{ matrix.exe }}
- name: Display SHA-256
run: sha256sum ./rufus.exe
run: sha256sum ./${{ matrix.exe }}
- name: Upload to VirusTotal
if: ${{ github.event_name == 'push' }}
continue-on-error: true
if: ${{ matrix.env == 'i686' && github.event_name == 'push' }}
run: |
curl --request POST --url https://www.virustotal.com/vtapi/v2/file/scan --form apikey=${{ secrets.VIRUSTOTAL_API_KEY }} --form file=@./rufus.exe
curl --request POST --url https://www.virustotal.com/api/v3/monitor/items --header 'x-apikey: ${{ secrets.VIRUSTOTAL_API_KEY }}' --form path='/rufus.exe' --form file=@./rufus.exe
curl --request POST --url https://www.virustotal.com/vtapi/v2/file/scan --form apikey=${{ secrets.VIRUSTOTAL_API_KEY }} --form file=@./${{ matrix.exe }}
curl --request POST --url https://www.virustotal.com/api/v3/monitor/items --header 'x-apikey: ${{ secrets.VIRUSTOTAL_API_KEY }}' --form path='/${{ matrix.exe }}' --form file=@./${{ matrix.exe }}
- name: Upload artifacts
if: ${{ matrix.env == 'i686' && github.event_name == 'push' }}
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v3
with:
name: MinGW

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for rufus 3.23.
# Generated by GNU Autoconf 2.71 for rufus 4.0.
#
# Report bugs to <https://github.com/pbatard/rufus/issues>.
#
@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='3.23'
PACKAGE_STRING='rufus 3.23'
PACKAGE_VERSION='4.0'
PACKAGE_STRING='rufus 4.0'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.ie'
@ -1269,7 +1269,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures rufus 3.23 to adapt to many kinds of systems.
\`configure' configures rufus 4.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1336,7 +1336,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rufus 3.23:";;
short | recursive ) echo "Configuration of rufus 4.0:";;
esac
cat <<\_ACEOF
@ -1428,7 +1428,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rufus configure 3.23
rufus configure 4.0
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@ -1504,7 +1504,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by rufus $as_me 3.23, which was
It was created by rufus $as_me 4.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@ -2767,7 +2767,7 @@ fi
# Define the identity of the package.
PACKAGE='rufus'
VERSION='3.23'
VERSION='4.0'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -5309,7 +5309,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by rufus $as_me 3.23, which was
This file was extended by rufus $as_me 4.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -5365,7 +5365,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
rufus config.status 3.23
rufus config.status 4.0
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [3.23], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AC_INIT([rufus], [4.0], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4])

View file

@ -4,7 +4,7 @@
* Copyright 1992-1994 Remy Card <card@masi.ibp.fr>
* Copyright 1995-1999 Theodore Ts'o
* Copyright 1999 David Beattie
* Copyright 2011-2019 Pete Batard <pete@akeo.ie>
* Copyright 2011-2023 Pete Batard <pete@akeo.ie>
*
* This file is based on the minix file system programs fsck and mkfs
* written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi>
@ -377,7 +377,7 @@ static int64_t do_read (HANDLE hDrive, unsigned char * buffer, uint64_t tryout,
if (got < 0)
got = 0;
if (got & 511)
uprintf("%sWeird value (%ld) in do_read\n", bb_prefix, got);
uprintf("%sWeird value (%lld) in do_read\n", bb_prefix, got);
got /= block_size;
return got;
}
@ -399,7 +399,7 @@ static int64_t do_write(HANDLE hDrive, unsigned char * buffer, uint64_t tryout,
if (got < 0)
got = 0;
if (got & 511)
uprintf("%sWeird value (%ld) in do_write\n", bb_prefix, got);
uprintf("%sWeird value (%lld) in do_write\n", bb_prefix, got);
got /= block_size;
return got;
}
@ -447,7 +447,7 @@ static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size
if (detect_fakes && (pat_idx == 0)) {
srand((unsigned int)GetTickCount64());
id_offset = rand() * (block_size - sizeof(blk64_t)) / RAND_MAX;
uprintf("%sUsing offset %d for fake device check\n", bb_prefix, id_offset);
uprintf("%sUsing offset %zu for fake device check\n", bb_prefix, id_offset);
}
// coverity[dont_call]
pattern_fill(buffer, pattern[pattern_type][pat_idx], blocks_at_once * block_size);

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility
* DOS boot file extraction, from the FAT12 floppy image in diskcopy.dll
* (MS WinME DOS) or from the embedded FreeDOS resource files
* Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2023 Pete Batard <pete@akeo.ie>
*
* 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
@ -235,7 +235,7 @@ static BOOL ExtractFAT(int entry, const char* path)
filestart = (dir_entry->FirstCluster + FAT12_CLUSTER_OFFSET)*FAT12_CLUSTER_SIZE;
filesize = dir_entry->FileSize;
if ((filestart + filesize) > DiskImageSize) {
uprintf("FAT File %s would be out of bounds: %X, %X", filename, filestart, filesize);
uprintf("FAT File %s would be out of bounds: %zX, %zX", filename, filestart, filesize);
uprintf("%X, %X", dir_entry->FirstCluster, dir_entry->FileSize);
return FALSE;
}
@ -278,7 +278,7 @@ static BOOL ExtractFAT(int entry, const char* path)
}
safe_closehandle(hFile);
uprintf("Successfully wrote '%s' (%d bytes)", filename, filesize);
uprintf("Successfully wrote '%s' (%zu bytes)", filename, filesize);
return TRUE;
}

View file

@ -1129,7 +1129,7 @@ static BOOL _GetDriveLettersAndType(DWORD DriveIndex, char* drive_letters, UINT*
goto out;
}
if (size > sizeof(drives)) {
uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives));
uprintf("GetLogicalDriveStrings: Buffer too small (required %lu vs. %zu)", size, sizeof(drives));
goto out;
}
@ -1266,7 +1266,7 @@ char GetUnusedDriveLetter(void)
return 0;
}
if (size > sizeof(drives)) {
uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives));
uprintf("GetLogicalDriveStrings: Buffer too small (required %lu vs. %zu)", size, sizeof(drives));
return 0;
}
@ -1295,7 +1295,7 @@ BOOL IsDriveLetterInUse(const char drive_letter)
return TRUE;
}
if (size > sizeof(drives)) {
uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives));
uprintf("GetLogicalDriveStrings: Buffer too small (required %lu vs. %zu)", size, sizeof(drives));
return TRUE;
}
@ -1347,8 +1347,7 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letters, char** label)
if (DeviceIoControl(hPhysical, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, &size, NULL))
AutorunLabel = get_token_data_file("label", AutorunPath);
else if (GetLastError() == ERROR_NOT_READY)
uprintf("Ignoring 'autorun.inf' label for drive %c: %s", toupper(letters[0]),
(HRESULT_CODE(GetLastError()) == ERROR_NOT_READY)?"No media":WindowsErrorString());
uprintf("Ignoring 'autorun.inf' label for drive %c: No media", toupper(letters[0]));
safe_closehandle(hPhysical);
if (AutorunLabel != NULL) {
uprintf("Using 'autorun.inf' label for drive %c: '%s'", toupper(letters[0]), AutorunLabel);

View file

@ -736,7 +736,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi
if (num_sectors_to_clear < 4)
num_sectors_to_clear = (DWORD)((add1MB ? 2048 : 0) + MAX_SECTORS_TO_CLEAR);
uprintf("Erasing %d sectors", num_sectors_to_clear);
uprintf("Erasing %llu sectors", num_sectors_to_clear);
pZeroBuf = calloc(SectorSize, (size_t)num_sectors_to_clear);
if (pZeroBuf == NULL) {
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_NOT_ENOUGH_MEMORY;

View file

@ -394,17 +394,17 @@ BOOL FormatLargeFAT32(DWORD DriveIndex, uint64_t PartitionOffset, DWORD ClusterS
}
// Now we're committed - print some info first
uprintf("Size : %s %u sectors", SizeToHumanReadable(piDrive.PartitionLength.QuadPart, TRUE, FALSE), TotalSectors);
uprintf("Cluster size %d bytes, %d bytes per sector", SectorsPerCluster * BytesPerSect, BytesPerSect);
uprintf("Size : %s %lu sectors", SizeToHumanReadable(piDrive.PartitionLength.QuadPart, TRUE, FALSE), TotalSectors);
uprintf("Cluster size %lu bytes, %lu bytes per sector", SectorsPerCluster * BytesPerSect, BytesPerSect);
uprintf("Volume ID is %x:%x", VolumeId >> 16, VolumeId & 0xffff);
uprintf("%d Reserved sectors, %d sectors per FAT, %d FATs", ReservedSectCount, FatSize, NumFATs);
uprintf("%d Total clusters", ClusterCount);
uprintf("%lu Reserved sectors, %lu sectors per FAT, %lu FATs", ReservedSectCount, FatSize, NumFATs);
uprintf("%llu Total clusters", ClusterCount);
// Fix up the FSInfo sector
pFAT32FsInfo->dFree_Count = (UserAreaSize / SectorsPerCluster) - 1;
pFAT32FsInfo->dNxt_Free = 3; // clusters 0-1 reserved, we used cluster 2 for the root dir
uprintf("%d Free clusters", pFAT32FsInfo->dFree_Count);
uprintf("%lu Free clusters", pFAT32FsInfo->dFree_Count);
// Work out the Cluster count
// First zero out ReservedSect + FatSize * NumFats + SectorsPerCluster

View file

@ -115,7 +115,7 @@ static const char* autorun_name = "autorun.inf";
static const char* manjaro_marker = ".miso";
static const char* pop_os_name = "pop-os";
static const char* stupid_antivirus = " NOTE: This is usually caused by a poorly designed security solution. "
"See https://goo.gl/QTobxX.\r\n This file will be skipped for now, but you should really "
"See https://bit.ly/40qDtyF.\r\n This file will be skipped for now, but you should really "
"look into using a *SMARTER* antivirus solution.";
const char* old_c32_name[NB_OLD_C32] = OLD_C32_NAMES;
static const int64_t old_c32_threshold[NB_OLD_C32] = OLD_C32_THRESHOLD;
@ -322,7 +322,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const
// Apply various workarounds to Linux config files
static void fix_config(const char* psz_fullpath, const char* psz_path, const char* psz_basename, EXTRACT_PROPS* props)
{
BOOL modified = FALSE;
BOOL modified = FALSE, patched;
size_t nul_pos;
char *iso_label = NULL, *usb_label = NULL, *src, *dst;
@ -338,6 +338,7 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
if (replace_in_token_data(src, props->is_grub_cfg ? "linux" : "append",
"file=/cdrom/preseed", "persistent file=/cdrom/preseed", TRUE) != NULL) {
// Ubuntu & derivatives are assumed to use 'file=/cdrom/preseed/...'
// or 'layerfs-path=minimal.standard.live.squashfs' (see below)
// somewhere in their kernel options and use 'persistent' as keyword.
uprintf(" Added 'persistent' kernel option");
modified = TRUE;
@ -345,6 +346,11 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
if ((props->is_grub_cfg) && replace_in_token_data(src, "linux",
"maybe-ubiquity", "", TRUE))
uprintf(" Removed 'maybe-ubiquity' kernel option");
} else if (replace_in_token_data(src, "linux", "layerfs-path=minimal.standard.live.squashfs",
"persistent layerfs-path=minimal.standard.live.squashfs", TRUE) != NULL) {
// Ubuntu 23.04 uses GRUB only with the above and does not use "maybe-ubiquity"
uprintf(" Added 'persistent' kernel option");
modified = TRUE;
} else if (replace_in_token_data(src, props->is_grub_cfg ? "linux" : "append",
"boot=live", "boot=live persistence", TRUE) != NULL) {
// Debian & derivatives are assumed to use 'boot=live' in
@ -375,11 +381,14 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
iso_label = replace_char(img_report.label, ' ', "\\x20");
usb_label = replace_char(img_report.usb_label, ' ', "\\x20");
if ((iso_label != NULL) && (usb_label != NULL)) {
patched = FALSE;
for (int i = 0; i < ARRAYSIZE(cfg_token); i++) {
if (replace_in_token_data(src, cfg_token[i], iso_label, usb_label, TRUE) != NULL)
if (replace_in_token_data(src, cfg_token[i], iso_label, usb_label, TRUE) != NULL) {
modified = TRUE;
patched = TRUE;
}
}
if (modified)
if (patched)
uprintf(" Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label);
// Since version 8.2, and https://github.com/rhinstaller/anaconda/commit/a7661019546ec1d8b0935f9cb0f151015f2e1d95,
// Red Hat derivatives have changed their CD-ROM detection policy which leads to the installation source
@ -388,13 +397,15 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
// netinst from regular is a pain. So, because I don't have all day to fix the mess that Red-Hat created when
// they introduced a kernel option to decide where the source packages should be picked from we're just going
// to *hope* that users didn't rename their ISOs and check whether it contains 'netinst' or not. Oh well...
modified = FALSE;
patched = FALSE;
if (img_report.rh8_derivative && (strstr(image_path, "netinst") == NULL)) {
for (int i = 0; i < ARRAYSIZE(cfg_token); i++) {
if (replace_in_token_data(src, cfg_token[i], "inst.stage2", "inst.repo", TRUE) != NULL)
if (replace_in_token_data(src, cfg_token[i], "inst.stage2", "inst.repo", TRUE) != NULL) {
modified = TRUE;
patched = TRUE;
}
}
if (modified)
if (patched)
uprintf(" Patched %s: '%s' ➔ '%s'\n", src, "inst.stage2", "inst.repo");
}
}
@ -1454,7 +1465,7 @@ int iso9660_readfat(intptr_t pp, void *buf, size_t secsize, libfat_sector_t sec)
iso9660_readfat_private* p_private = (iso9660_readfat_private*)pp;
if (sizeof(p_private->buf) % secsize != 0) {
uprintf("iso9660_readfat: Sector size %d is not a divisor of %d", secsize, sizeof(p_private->buf));
uprintf("iso9660_readfat: Sector size %zu is not a divisor of %zu", secsize, sizeof(p_private->buf));
return 0;
}

View file

@ -994,7 +994,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
dwPipeSize, dwPipeSize, 0, NULL);
if (hPipe == INVALID_HANDLE_VALUE) {
uprintf("Could not create pipe '%s': %s", pipe, WindowsErrorString);
uprintf("Could not create pipe '%s': %s", pipe, WindowsErrorString());
goto out;
}

View file

@ -1341,7 +1341,7 @@ static BOOL get_data_from_asn1_internal(const uint8_t* buf, size_t buf_len, cons
}
if (len > buf_len - pos) {
uprintf("get_data_from_asn1: Overflow error (computed length %d is larger than remaining data)", len);
uprintf("get_data_from_asn1: Overflow error (computed length %zu is larger than remaining data)", len);
return FALSE;
}
}

View file

@ -728,7 +728,7 @@ BOOL SearchProcessAlt(char* HandleName)
bFound = TRUE;
uprintf("WARNING: The following process(es) or service(s) are accessing %s:", HandleName);
for (i = 0; i < info->NumberOfProcessIdsInList; i++) {
uprintf("o Process with PID %ld", info->ProcessIdList[i]);
uprintf("o Process with PID %llu", (uint64_t)info->ProcessIdList[i]);
}
}

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 3.23.2026"
CAPTION "Rufus 4.0.2029"
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 3,23,2026,0
PRODUCTVERSION 3,23,2026,0
FILEVERSION 4,0,2029,0
PRODUCTVERSION 4,0,2029,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", "3.23.2026"
VALUE "FileVersion", "4.0.2029"
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-3.23.exe"
VALUE "OriginalFilename", "rufus-4.0.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.23.2026"
VALUE "ProductVersion", "4.0.2029"
END
END
BLOCK "VarFileInfo"

View file

@ -72,7 +72,7 @@ int libfat_readfile(intptr_t pp, void *buf, size_t secsize, libfat_sector_t sect
}
if (bytes_read != secsize) {
uprintf("Sector %llu: Read %d bytes instead of %d requested", sector, bytes_read, secsize);
uprintf("Sector %llu: Read %lu bytes instead of %zu requested", sector, bytes_read, secsize);
return 0;
}

View file

@ -123,7 +123,7 @@ void GetBasicControlsWidth(HWND hDlg)
sz.cy = rc.bottom;
// TODO: figure out the specifics of each Windows version
if (WindowsVersion.Version == WINDOWS_10) {
if (WindowsVersion.Version >= WINDOWS_10) {
checkbox_internal_spacing = 10;
dropdown_internal_spacing = 13;
}

View file

@ -368,7 +368,7 @@ DWORD WINAPI WimProgressCallback(DWORD dwMsgId, WPARAM wParam, LPARAM lParam, PV
case WIM_MSG_ERROR:
if (level == NULL) level = "error";
SetLastError((DWORD)lParam);
uprintf("WIM processing %s: %S [err = %d]\n", level, (PWSTR)wParam, WindowsErrorString());
uprintf("WIM processing %s: %S [%s]\n", level, (PWSTR)wParam, WindowsErrorString());
break;
}