Skip to content

Commit

Permalink
[ui] add runtime UEFI media validation as a selectable advanced option
Browse files Browse the repository at this point in the history
* Also add Ctrl-A as a new cheat-mode to toggle the use of Rufus MBR (which is enabled by default)
  which replaces the previous UI checkbox. The Disk ID field is now completely removed as we now
  use the default values for XP and non XP installs, and will expect people with multiple disks to
  disconnect all except the one where they plan to install Windows.
  • Loading branch information
pbatard committed Apr 2, 2024
1 parent 6dac531 commit dd8314b
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 131 deletions.
5 changes: 4 additions & 1 deletion res/loc/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ To edit a translation, please make sure to follow:
https://github.com/pbatard/rufus/wiki/Localization#Editing_an_existing_translation
Or simply download https://files.akeo.ie/pollock/pollock-1.5.exe and follow its directions.

o v4.?? (202?.??.??)
o v4.5 (202?.??.??)
- *UPDATED* IDC_RUFUS_MBR -> IDC_UEFI_MEDIA_VALIDATION "Enable runtime UEFI media validation"
- *UPDATED* MSG_167 "Install a UEFI bootloader, that will perform MD5Sum file validation of the media"
- *NEW* MSG_337 "An additional file ('diskcopy.dll') must be downloaded from Microsoft to install MS-DOS (...)"
- *NEW* MSG_338 "Revoked UEFI bootloader detected"
- *NEW* MSG_339 "Rufus detected that the ISO you have selected contains a UEFI bootloader that has been revoked (...)"
Expand All @@ -18,6 +20,7 @@ o v4.?? (202?.??.??)
- *NEW* MSG_346 "Restrict Windows to S-Mode (INCOMPATIBLE with online account bypass)"
- *NEW* MSG_347 "Expert Mode"
- *NEW* MSG_348 "Extracting archive files: %s"
- *NEW* MSG_349 "Use Rufus MBR"

o v3.22 (2023.??.??)
// MSG_144 is aimed the the ISO download feature
Expand Down
10 changes: 5 additions & 5 deletions res/loc/rufus.loc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ t IDC_OLD_BIOS_FIXES "Add fixes for old BIOSes (extra partition, align, etc.)"
# 'MBR': See http://en.wikipedia.org/wiki/Master_boot_record
# Rufus can install it's own custom MBR (the Rufus MBR), which also allows users to
# specify a custom disk ID for the BIOS. The tooltip for this control is MSG_167.
t IDC_RUFUS_MBR "Use Rufus MBR with BIOS ID"
t IDC_UEFI_MEDIA_VALIDATION "Enable runtime UEFI media validation"
t IDS_FORMAT_OPTIONS_TXT "Format Options"
t IDS_FILE_SYSTEM_TXT "File system"
t IDS_CLUSTER_SIZE_TXT "Cluster size"
Expand Down Expand Up @@ -370,9 +370,7 @@ t MSG_164 "Method that will be used to make the drive bootable"
t MSG_165 "Click to select or download an image..."
t MSG_166 "Check this box to allow the display of international labels "
"and set a device icon (creates an autorun.inf)"
t MSG_167 "Install an MBR that allows boot selection and can masquerade the BIOS USB drive ID"
t MSG_168 "Try to masquerade first bootable USB drive (usually 0x80) as a different disk.\n"
"This should only be necessary if you install Windows XP and have more than one disk."
t MSG_167 "Install a UEFI bootloader, that will perform MD5Sum file validation of the media"
t MSG_169 "Create an extra hidden partition and try to align partitions boundaries.\n"
"This can improve boot detection for older BIOSes."
t MSG_170 "Enable the listing of USB Hard Drive enclosures. USE AT YOUR OWN RISKS!!!"
Expand Down Expand Up @@ -574,7 +572,8 @@ t MSG_313 "Save to VHD"
t MSG_314 "Compute image checksums"
t MSG_315 "Multiple buttons"
t MSG_316 "Number of passes"
t MSG_317 "Disk ID"
# TODO: Use this with 168 for UEFI validation label and tooltip
t MSG_317 "Disk ID"
t MSG_318 "Default thread priority: %d"
t MSG_319 "Ignore Boot Marker"
t MSG_320 "Refreshing partition layout (%s)..."
Expand Down Expand Up @@ -612,6 +611,7 @@ t MSG_345 "Some additional data must be downloaded from Microsoft to use this fu
t MSG_346 "Restrict Windows to S-Mode (INCOMPATIBLE with online account bypass)"
t MSG_347 "Expert Mode"
t MSG_348 "Extracting archive files: %s"
t MSG_349 "Use Rufus MBR"
# The following messages are for the Windows Store listing only and are not used by the application
t MSG_900 "Rufus is a utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc."
t MSG_901 "Official site: %s"
Expand Down
9 changes: 5 additions & 4 deletions src/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern const char* md5sum_name[2];
extern uint32_t dur_mins, dur_secs;
extern uint32_t wim_nb_files, wim_proc_files, wim_extra_files;
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, fast_zeroing, enable_file_indexing;
extern BOOL write_as_image, use_vds, write_as_esp, is_vds_available, has_ffu_support;
extern BOOL write_as_image, use_vds, write_as_esp, is_vds_available, has_ffu_support, use_rufus_mbr;
extern char* archive_path;
uint8_t *grub2_buf = NULL, *sec_buf = NULL;
long grub2_len;
Expand Down Expand Up @@ -771,6 +771,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi
static BOOL WriteMBR(HANDLE hPhysicalDrive)
{
BOOL r = FALSE;
BOOL needs_masquerading = HAS_WINPE(img_report) && (!img_report.uses_minint);
uint8_t* buffer = NULL;
FAKE_FD fake_fd = { 0 };
FILE* fp = (FILE*)&fake_fd;
Expand Down Expand Up @@ -822,8 +823,8 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
break;
}
if ((boot_type != BT_NON_BOOTABLE) && (target_type == TT_BIOS)) {
// Set first partition bootable - masquerade as per the DiskID selected
buffer[0x1be] = IsChecked(IDC_RUFUS_MBR) ? (BYTE)ComboBox_GetCurItemData(hDiskID) : 0x80;
// Set first partition bootable or masquerade as second disk
buffer[0x1be] = needs_masquerading ? 0x81 : 0x80;
uprintf("Set bootable USB partition as 0x%02X", buffer[0x1be]);
}

Expand Down Expand Up @@ -886,7 +887,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)

// If everything else failed, fall back to a conventional Windows/Rufus MBR
windows_mbr:
if ((HAS_WINPE(img_report) && !img_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) {
if (needs_masquerading || use_rufus_mbr) {
uprintf(using_msg, APPLICATION_NAME);
r = write_rufus_mbr(fp);
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,10 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan)
uprintf("Could not move %s → %s", path, dst_path, WindowsErrorString());
}
}
if (fd_md5sum != NULL)
if (fd_md5sum != NULL) {
uprintf("Created: %s\\%s (%s)", dest_dir, md5sum_name[0], SizeToHumanReadable(ftell(fd_md5sum), FALSE, FALSE));
fclose(fd_md5sum);
}
}
iso9660_close(p_iso);
udf_close(p_udf);
Expand Down
54 changes: 51 additions & 3 deletions src/localization_data.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Localization tables - autogenerated from resource.h
* Copyright © 2013-2021 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
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -52,11 +52,10 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDC_TEST),
LOC_CTRL(IDC_SELECT),
LOC_CTRL(IDC_EXTENDED_LABEL),
LOC_CTRL(IDC_RUFUS_MBR),
LOC_CTRL(IDC_UEFI_MEDIA_VALIDATION),
LOC_CTRL(IDC_TARGET_SYSTEM),
LOC_CTRL(IDC_PERSISTENCE_SIZE),
LOC_CTRL(IDC_PERSISTENCE_UNITS),
LOC_CTRL(IDC_DISK_ID),
LOC_CTRL(IDC_OLD_BIOS_FIXES),
LOC_CTRL(IDC_LIST_USB_HDD),
LOC_CTRL(IDC_STATUS_TOOLBAR),
Expand Down Expand Up @@ -510,6 +509,55 @@ const loc_control_id control_id[] = {
LOC_CTRL(MSG_348),
LOC_CTRL(MSG_349),
LOC_CTRL(MSG_350),
LOC_CTRL(MSG_351),
LOC_CTRL(MSG_352),
LOC_CTRL(MSG_353),
LOC_CTRL(MSG_354),
LOC_CTRL(MSG_355),
LOC_CTRL(MSG_356),
LOC_CTRL(MSG_357),
LOC_CTRL(MSG_358),
LOC_CTRL(MSG_359),
LOC_CTRL(MSG_360),
LOC_CTRL(MSG_361),
LOC_CTRL(MSG_362),
LOC_CTRL(MSG_363),
LOC_CTRL(MSG_364),
LOC_CTRL(MSG_365),
LOC_CTRL(MSG_366),
LOC_CTRL(MSG_367),
LOC_CTRL(MSG_368),
LOC_CTRL(MSG_369),
LOC_CTRL(MSG_370),
LOC_CTRL(MSG_371),
LOC_CTRL(MSG_372),
LOC_CTRL(MSG_373),
LOC_CTRL(MSG_374),
LOC_CTRL(MSG_375),
LOC_CTRL(MSG_376),
LOC_CTRL(MSG_377),
LOC_CTRL(MSG_378),
LOC_CTRL(MSG_379),
LOC_CTRL(MSG_380),
LOC_CTRL(MSG_381),
LOC_CTRL(MSG_382),
LOC_CTRL(MSG_383),
LOC_CTRL(MSG_384),
LOC_CTRL(MSG_385),
LOC_CTRL(MSG_386),
LOC_CTRL(MSG_387),
LOC_CTRL(MSG_388),
LOC_CTRL(MSG_389),
LOC_CTRL(MSG_390),
LOC_CTRL(MSG_391),
LOC_CTRL(MSG_392),
LOC_CTRL(MSG_393),
LOC_CTRL(MSG_394),
LOC_CTRL(MSG_395),
LOC_CTRL(MSG_396),
LOC_CTRL(MSG_397),
LOC_CTRL(MSG_398),
LOC_CTRL(MSG_399),
LOC_CTRL(MSG_MAX),
LOC_CTRL(IDOK),
LOC_CTRL(IDCANCEL),
Expand Down
56 changes: 52 additions & 4 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@
#define IDC_TEST 1013
#define IDC_SELECT 1014
#define IDC_EXTENDED_LABEL 1015
#define IDC_RUFUS_MBR 1016
#define IDC_TARGET_SYSTEM 1017
#define IDC_PERSISTENCE_SIZE 1018
#define IDC_PERSISTENCE_UNITS 1019
#define IDC_DISK_ID 1020
#define IDC_OLD_BIOS_FIXES 1021
#define IDC_OLD_BIOS_FIXES 1020
#define IDC_UEFI_MEDIA_VALIDATION 1021
#define IDC_LIST_USB_HDD 1022
#define IDC_STATUS_TOOLBAR 1023
#define IDC_SAVE 1024
Expand Down Expand Up @@ -552,7 +551,56 @@
#define MSG_348 3348
#define MSG_349 3349
#define MSG_350 3350
#define MSG_MAX 3351
#define MSG_351 3351
#define MSG_352 3352
#define MSG_353 3353
#define MSG_354 3354
#define MSG_355 3355
#define MSG_356 3356
#define MSG_357 3357
#define MSG_358 3358
#define MSG_359 3359
#define MSG_360 3360
#define MSG_361 3361
#define MSG_362 3362
#define MSG_363 3363
#define MSG_364 3364
#define MSG_365 3365
#define MSG_366 3366
#define MSG_367 3367
#define MSG_368 3368
#define MSG_369 3369
#define MSG_370 3370
#define MSG_371 3371
#define MSG_372 3372
#define MSG_373 3373
#define MSG_374 3374
#define MSG_375 3375
#define MSG_376 3376
#define MSG_377 3377
#define MSG_378 3378
#define MSG_379 3379
#define MSG_380 3380
#define MSG_381 3381
#define MSG_382 3382
#define MSG_383 3383
#define MSG_384 3384
#define MSG_385 3385
#define MSG_386 3386
#define MSG_387 3387
#define MSG_388 3388
#define MSG_389 3389
#define MSG_390 3390
#define MSG_391 3391
#define MSG_392 3392
#define MSG_393 3393
#define MSG_394 3394
#define MSG_395 3395
#define MSG_396 3396
#define MSG_397 3397
#define MSG_398 3398
#define MSG_399 3399
#define MSG_MAX 3400

// Next default values for new objects
//
Expand Down
Loading

0 comments on commit dd8314b

Please sign in to comment.