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

[misc] introduce hImageOption and ComboBox_GetCurItemData() to simplify code

* Also add retry to ms-sys' write_sectors()
This commit is contained in:
Pete Batard 2020-07-17 21:51:15 +01:00
parent 09d2f2f0ab
commit 4617f91e3b
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
9 changed files with 60 additions and 60 deletions

View file

@ -414,7 +414,7 @@ BOOL ExtractFreeDOS(const char* path)
BOOL ExtractDOS(const char* path) BOOL ExtractDOS(const char* path)
{ {
switch(ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType))) { switch(ComboBox_GetCurItemData(hBootType)) {
case BT_MSDOS: case BT_MSDOS:
return ExtractMSDOS(path); return ExtractMSDOS(path);
case BT_FREEDOS: case BT_FREEDOS:

View file

@ -1256,7 +1256,6 @@ BOOL ToggleEsp(DWORD DriveIndex)
if (guid != NULL) { if (guid != NULL) {
for (i = 0; i < DriveLayout->PartitionCount; i++) { for (i = 0; i < DriveLayout->PartitionCount; i++) {
if (CompareGUID(guid, &DriveLayout->PartitionEntry[i].Gpt.PartitionId)) { if (CompareGUID(guid, &DriveLayout->PartitionEntry[i].Gpt.PartitionId)) {
uprintf("BD name: '%S'", DriveLayout->PartitionEntry[i].Gpt.Name);
found = TRUE; found = TRUE;
break; break;
} }
@ -1724,7 +1723,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
// CHS sizes that IBM imparted upon us. Long story short, we now align to a // CHS sizes that IBM imparted upon us. Long story short, we now align to a
// cylinder size that is itself aligned to the cluster size. // cylinder size that is itself aligned to the cluster size.
// If this actually breaks old systems, please send your complaints to IBM. // If this actually breaks old systems, please send your complaints to IBM.
LONGLONG ClusterSize = (LONGLONG)ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)); LONGLONG ClusterSize = (LONGLONG)ComboBox_GetCurItemData(hClusterSize);
if (ClusterSize == 0) if (ClusterSize == 0)
ClusterSize = 0x200; ClusterSize = 0x200;
DriveLayoutEx.PartitionEntry[pn].StartingOffset.QuadPart = DriveLayoutEx.PartitionEntry[pn].StartingOffset.QuadPart =

View file

@ -802,7 +802,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
goto out; goto out;
} }
switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) { switch (ComboBox_GetCurItemData(hFileSystem)) {
case FS_FAT16: case FS_FAT16:
if (buffer[0x1c2] == 0x0e) { if (buffer[0x1c2] == 0x0e) {
uprintf("Partition is already FAT16 LBA...\n"); uprintf("Partition is already FAT16 LBA...\n");
@ -823,7 +823,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
if ((boot_type != BT_NON_BOOTABLE) && (target_type == TT_BIOS)) { if ((boot_type != BT_NON_BOOTABLE) && (target_type == TT_BIOS)) {
// Set first partition bootable - masquerade as per the DiskID selected // Set first partition bootable - masquerade as per the DiskID selected
buffer[0x1be] = IsChecked(IDC_RUFUS_MBR) ? buffer[0x1be] = IsChecked(IDC_RUFUS_MBR) ?
(BYTE)ComboBox_GetItemData(hDiskID, ComboBox_GetCurSel(hDiskID)):0x80; (BYTE)ComboBox_GetCurItemData(hDiskID):0x80;
uprintf("Set bootable USB partition as 0x%02X\n", buffer[0x1be]); uprintf("Set bootable USB partition as 0x%02X\n", buffer[0x1be]);
} }
@ -1231,7 +1231,7 @@ int SetWinToGoIndex(void)
wintogo_index = -1; wintogo_index = -1;
wininst_index = 0; wininst_index = 0;
if ((nWindowsVersion < WINDOWS_8) || ((WimExtractCheck() & 4) == 0) || if ((nWindowsVersion < WINDOWS_8) || ((WimExtractCheck() & 4) == 0) ||
(ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)) != FS_NTFS)) { (ComboBox_GetCurItemData(hFileSystem) != FS_NTFS)) {
return -1; return -1;
} }
@ -1721,7 +1721,7 @@ DWORD WINAPI FormatThread(void* param)
use_large_fat32 = (fs_type == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); use_large_fat32 = (fs_type == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32));
windows_to_go = (image_options & IMOP_WINTOGO) && (boot_type == BT_IMAGE) && HAS_WINTOGO(img_report) && windows_to_go = (image_options & IMOP_WINTOGO) && (boot_type == BT_IMAGE) && HAS_WINTOGO(img_report) &&
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1); ComboBox_GetCurItemData(hImageOption);
large_drive = (SelectedDrive.DiskSize > (1*TB)); large_drive = (SelectedDrive.DiskSize > (1*TB));
if (large_drive) if (large_drive)
uprintf("Notice: Large drive detected (may produce short writes)"); uprintf("Notice: Large drive detected (may produce short writes)");
@ -2005,7 +2005,7 @@ DWORD WINAPI FormatThread(void* param)
GetWindowTextU(hLabel, label, sizeof(label)); GetWindowTextU(hLabel, label, sizeof(label));
if (fs_type < FS_EXT2) if (fs_type < FS_EXT2)
ToValidLabel(label, (fs_type == FS_FAT16) || (fs_type == FS_FAT32) || (fs_type == FS_EXFAT)); ToValidLabel(label, (fs_type == FS_FAT16) || (fs_type == FS_FAT32) || (fs_type == FS_EXFAT));
ClusterSize = (DWORD)ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)); ClusterSize = (DWORD)ComboBox_GetCurItemData(hClusterSize);
if ((ClusterSize < 0x200) || (write_as_esp)) if ((ClusterSize < 0x200) || (write_as_esp))
ClusterSize = 0; // 0 = default cluster size ClusterSize = 0; // 0 = default cluster size

View file

@ -48,7 +48,7 @@ int64_t write_sectors(HANDLE hDrive, uint64_t SectorSize,
} }
LastWriteError = 0; LastWriteError = 0;
if(!WriteFile(hDrive, pBuf, Size, &Size, NULL)) if(!WriteFileWithRetry(hDrive, pBuf, Size, &Size, WRITE_RETRIES))
{ {
LastWriteError = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|GetLastError(); LastWriteError = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|GetLastError();
uprintf("write_sectors: Write error %s\n", WindowsErrorString()); uprintf("write_sectors: Write error %s\n", WindowsErrorString());

View file

@ -109,7 +109,7 @@ loc_cmd* selected_locale = NULL;
WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
DWORD MainThreadId; DWORD MainThreadId;
HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL; HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL;
HWND hLogDialog = NULL, hProgress = NULL, hDiskID; HWND hImageOption, hLogDialog = NULL, hProgress = NULL, hDiskID;
HANDLE dialog_handle = NULL; HANDLE dialog_handle = NULL;
BOOL is_x86_32, use_own_c32[NB_OLD_C32] = { FALSE, FALSE }, mbr_selected_by_user = FALSE; BOOL is_x86_32, use_own_c32[NB_OLD_C32] = { FALSE, FALSE }, mbr_selected_by_user = FALSE;
BOOL op_in_progress = TRUE, right_to_left_mode = FALSE, has_uefi_csm = FALSE, its_a_me_mario = FALSE; BOOL op_in_progress = TRUE, right_to_left_mode = FALSE, has_uefi_csm = FALSE, its_a_me_mario = FALSE;
@ -174,7 +174,7 @@ static void SetAllowedFileSystems(void)
if ((image_path != NULL) && (img_report.has_4GB_file)) if ((image_path != NULL) && (img_report.has_4GB_file))
break; break;
if (!HAS_WINDOWS(img_report) || (target_type != TT_BIOS) || allow_dual_uefi_bios) { if (!HAS_WINDOWS(img_report) || (target_type != TT_BIOS) || allow_dual_uefi_bios) {
if (!HAS_WINTOGO(img_report) || (ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) != 1)) { if (!HAS_WINTOGO(img_report) || ComboBox_GetCurItemData(hImageOption)) {
allowed_filesystem[FS_FAT16] = TRUE; allowed_filesystem[FS_FAT16] = TRUE;
allowed_filesystem[FS_FAT32] = TRUE; allowed_filesystem[FS_FAT32] = TRUE;
} }
@ -247,9 +247,9 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target)
IGNORE_RETVAL(ComboBox_ResetContent(hPartitionScheme)); IGNORE_RETVAL(ComboBox_ResetContent(hPartitionScheme));
IGNORE_RETVAL(ComboBox_ResetContent(hTargetSystem)); IGNORE_RETVAL(ComboBox_ResetContent(hTargetSystem));
boot_type = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); boot_type = (int)ComboBox_GetCurItemData(hBootType);
is_windows_to_go_selected = (boot_type == BT_IMAGE) && (image_path != NULL) && HAS_WINTOGO(img_report) && is_windows_to_go_selected = (boot_type == BT_IMAGE) && (image_path != NULL) && HAS_WINTOGO(img_report) &&
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1); ComboBox_GetCurItemData(hImageOption);
// If no device is selected, don't populate anything // If no device is selected, don't populate anything
if (ComboBox_GetCurSel(hDeviceList) < 0) if (ComboBox_GetCurSel(hDeviceList) < 0)
return; return;
@ -323,7 +323,7 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target)
preferred_pt = (selected_pt >= 0) ? selected_pt : PARTITION_STYLE_MBR; preferred_pt = (selected_pt >= 0) ? selected_pt : PARTITION_STYLE_MBR;
} }
SetComboEntry(hPartitionScheme, preferred_pt); SetComboEntry(hPartitionScheme, preferred_pt);
partition_type = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)); partition_type = (int)ComboBox_GetCurItemData(hPartitionScheme);
} }
has_uefi_csm = FALSE; has_uefi_csm = FALSE;
@ -339,7 +339,7 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target)
IGNORE_RETVAL(ComboBox_SetItemData(hTargetSystem, IGNORE_RETVAL(ComboBox_SetItemData(hTargetSystem,
ComboBox_AddStringU(hTargetSystem, lmprintf(MSG_033)), TT_BIOS)); ComboBox_AddStringU(hTargetSystem, lmprintf(MSG_033)), TT_BIOS));
IGNORE_RETVAL(ComboBox_SetCurSel(hTargetSystem, 0)); IGNORE_RETVAL(ComboBox_SetCurSel(hTargetSystem, 0));
target_type = (int)ComboBox_GetItemData(hTargetSystem, ComboBox_GetCurSel(hTargetSystem)); target_type = (int)ComboBox_GetCurItemData(hTargetSystem);
// Can't update a tooltip from a thread, so we send a message instead // Can't update a tooltip from a thread, so we send a message instead
SendMessage(hMainDialog, UM_UPDATE_CSM_TOOLTIP, 0, 0); SendMessage(hMainDialog, UM_UPDATE_CSM_TOOLTIP, 0, 0);
} }
@ -566,15 +566,15 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name)
SetComboEntry(hFileSystem, default_fs); SetComboEntry(hFileSystem, default_fs);
} }
return SetClusterSizes((int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))); return SetClusterSizes((int)ComboBox_GetCurItemData(hFileSystem));
} }
static void SetFSFromISO(void) static void SetFSFromISO(void)
{ {
int i, fs_tmp, preferred_fs = FS_UNKNOWN; int i, fs_tmp, preferred_fs = FS_UNKNOWN;
uint32_t fs_mask = FS_FAT32 | FS_NTFS; uint32_t fs_mask = FS_FAT32 | FS_NTFS;
BOOL windows_to_go = (image_options & IMOP_WINTOGO) && (boot_type == BT_IMAGE) && HAS_WINTOGO(img_report) && BOOL windows_to_go = (image_options & IMOP_WINTOGO) && (boot_type == BT_IMAGE) &&
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1); HAS_WINTOGO(img_report) && ComboBox_GetCurItemData(hImageOption);
if (image_path == NULL) if (image_path == NULL)
return; return;
@ -633,7 +633,7 @@ static void SetMBRProps(void)
BOOL needs_masquerading = HAS_WINPE(img_report) && (!img_report.uses_minint); BOOL needs_masquerading = HAS_WINPE(img_report) && (!img_report.uses_minint);
if ((!mbr_selected_by_user) && ((image_path == NULL) || (boot_type != BT_IMAGE) || (fs_type != FS_NTFS) || HAS_GRUB(img_report) || if ((!mbr_selected_by_user) && ((image_path == NULL) || (boot_type != BT_IMAGE) || (fs_type != FS_NTFS) || HAS_GRUB(img_report) ||
((image_options & IMOP_WINTOGO) && (ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1)) )) { ((image_options & IMOP_WINTOGO) && ComboBox_GetCurItemData(hImageOption)) )) {
CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, BST_UNCHECKED); CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, BST_UNCHECKED);
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0)); IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0));
return; return;
@ -793,7 +793,7 @@ static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes)
if ((boot_type == BT_IMAGE) && (img_report.is_bootable_img) && (!img_report.is_iso)) if ((boot_type == BT_IMAGE) && (img_report.is_bootable_img) && (!img_report.is_iso))
actual_enable = FALSE; actual_enable = FALSE;
EnableWindow(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), actual_enable); EnableWindow(hImageOption, actual_enable);
EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), actual_enable); EnableWindow(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), actual_enable);
// Make sure we set the range if we have persistence // Make sure we set the range if we have persistence
if ((image_path != NULL) && HAS_PERSISTENCE(img_report)) if ((image_path != NULL) && HAS_PERSISTENCE(img_report))
@ -840,7 +840,7 @@ static void EnableControls(BOOL enable, BOOL remove_checkboxes)
// Only enable the following controls if a device is active // Only enable the following controls if a device is active
enable = (ComboBox_GetCurSel(hDeviceList) < 0) ? FALSE : enable; enable = (ComboBox_GetCurSel(hDeviceList) < 0) ? FALSE : enable;
EnableWindow(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), enable); EnableWindow(hImageOption, enable);
EnableWindow(hSaveToolbar, enable); EnableWindow(hSaveToolbar, enable);
// Enable or disable the Start button and the other boot options // Enable or disable the Start button and the other boot options
@ -1097,7 +1097,7 @@ static void UpdateImage(void)
(image_path == NULL) ? lmprintf(MSG_281, lmprintf(MSG_280)) : short_image_path); (image_path == NULL) ? lmprintf(MSG_281, lmprintf(MSG_280)) : short_image_path);
ComboBox_SetItemData(hBootType, image_index, BT_IMAGE); ComboBox_SetItemData(hBootType, image_index, BT_IMAGE);
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, image_index)); IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, image_index));
boot_type = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); boot_type = (int)ComboBox_GetCurItemData(hBootType);
SetBootTypeDropdownWidth(); SetBootTypeDropdownWidth();
} }
@ -1236,7 +1236,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
ret = BOOTCHECK_PROCEED; ret = BOOTCHECK_PROCEED;
goto out; goto out;
} }
if ((image_options & IMOP_WINTOGO) && (ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1)) { if ((image_options & IMOP_WINTOGO) && ComboBox_GetCurItemData(hImageOption)) {
if (fs_type != FS_NTFS) { if (fs_type != FS_NTFS) {
// Windows To Go only works for NTFS // Windows To Go only works for NTFS
MessageBoxExU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid); MessageBoxExU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
@ -1495,7 +1495,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
} }
} }
} else if (boot_type == BT_MSDOS) { } else if (boot_type == BT_MSDOS) {
if ((size_check) && (ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)) >= 65536)) { if ((size_check) && (ComboBox_GetCurItemData(hClusterSize) >= 65536)) {
// MS-DOS cannot boot from a drive using a 64 kilobytes Cluster size // MS-DOS cannot boot from a drive using a 64 kilobytes Cluster size
MessageBoxExU(hMainDialog, lmprintf(MSG_110), lmprintf(MSG_111), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid); MessageBoxExU(hMainDialog, lmprintf(MSG_110), lmprintf(MSG_111), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
goto out; goto out;
@ -1530,7 +1530,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
uefi_target: uefi_target:
if (boot_type == BT_UEFI_NTFS) { if (boot_type == BT_UEFI_NTFS) {
fs_type = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); fs_type = (int)ComboBox_GetCurItemData(hFileSystem);
if (fs_type != FS_NTFS && fs_type != FS_EXFAT) { if (fs_type != FS_NTFS && fs_type != FS_EXFAT) {
MessageBoxExU(hMainDialog, lmprintf(MSG_097, "UEFI:NTFS"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid); MessageBoxExU(hMainDialog, lmprintf(MSG_097, "UEFI:NTFS"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
goto out; goto out;
@ -1560,7 +1560,6 @@ static __inline const char* IsAlphaOrBeta(void)
static void InitDialog(HWND hDlg) static void InitDialog(HWND hDlg)
{ {
DWORD len; DWORD len;
HWND hCtrl;
HDC hDC; HDC hDC;
int i, lfHeight; int i, lfHeight;
char tmp[128], *token, *buf, *ext, *msg; char tmp[128], *token, *buf, *ext, *msg;
@ -1585,6 +1584,7 @@ static void InitDialog(HWND hDlg)
hLabel = GetDlgItem(hDlg, IDC_LABEL); hLabel = GetDlgItem(hDlg, IDC_LABEL);
hProgress = GetDlgItem(hDlg, IDC_PROGRESS); hProgress = GetDlgItem(hDlg, IDC_PROGRESS);
hBootType = GetDlgItem(hDlg, IDC_BOOT_SELECTION); hBootType = GetDlgItem(hDlg, IDC_BOOT_SELECTION);
hImageOption = GetDlgItem(hDlg, IDC_IMAGE_OPTION);
hSelectImage = GetDlgItem(hDlg, IDC_SELECT); hSelectImage = GetDlgItem(hDlg, IDC_SELECT);
hNBPasses = GetDlgItem(hDlg, IDC_NB_PASSES); hNBPasses = GetDlgItem(hDlg, IDC_NB_PASSES);
hDiskID = GetDlgItem(hDlg, IDC_DISK_ID); hDiskID = GetDlgItem(hDlg, IDC_DISK_ID);
@ -1681,9 +1681,8 @@ static void InitDialog(HWND hDlg)
SetBootOptions(); SetBootOptions();
// Fill up the Image Options Windows To Go dropdown // Fill up the Image Options Windows To Go dropdown
hCtrl = GetDlgItem(hMainDialog, IDC_IMAGE_OPTION); IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_117)), FALSE));
IGNORE_RETVAL(ComboBox_SetItemData(hCtrl, ComboBox_AddStringU(hCtrl, lmprintf(MSG_117)), FALSE)); IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_118)), TRUE));
IGNORE_RETVAL(ComboBox_SetItemData(hCtrl, ComboBox_AddStringU(hCtrl, lmprintf(MSG_118)), TRUE));
// Fill up the MBR masqueraded disk IDs ("8 disks should be enough for anybody") // Fill up the MBR masqueraded disk IDs ("8 disks should be enough for anybody")
IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_030, LEFT_TO_RIGHT_EMBEDDING "0x80" POP_DIRECTIONAL_FORMATTING)), 0x80)); IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_030, LEFT_TO_RIGHT_EMBEDDING "0x80" POP_DIRECTIONAL_FORMATTING)), 0x80));
@ -1733,7 +1732,7 @@ static void InitDialog(HWND hDlg)
CreateTooltip(hPartitionScheme, lmprintf(MSG_163), -1); CreateTooltip(hPartitionScheme, lmprintf(MSG_163), -1);
CreateTooltip(hTargetSystem, lmprintf(MSG_150), 30000); CreateTooltip(hTargetSystem, lmprintf(MSG_150), 30000);
CreateTooltip(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), lmprintf(MSG_151), 30000); CreateTooltip(GetDlgItem(hDlg, IDS_CSM_HELP_TXT), lmprintf(MSG_151), 30000);
CreateTooltip(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_305), 30000); CreateTooltip(hImageOption, lmprintf(MSG_305), 30000);
CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER), lmprintf(MSG_125), 30000); CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER), lmprintf(MSG_125), 30000);
CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), lmprintf(MSG_125), 30000); CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), lmprintf(MSG_125), 30000);
CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS), lmprintf(MSG_126), 30000); CreateTooltip(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS), lmprintf(MSG_126), 30000);
@ -1876,7 +1875,7 @@ DWORD CheckDriveAccess(DWORD dwTimeOut, BOOL bPrompt)
uint64_t start_time = GetTickCount64(), cur_time, end_time = start_time + dwTimeOut; uint64_t start_time = GetTickCount64(), cur_time, end_time = start_time + dwTimeOut;
// Get the current selected device // Get the current selected device
DWORD DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList)); DWORD DeviceNum = (DWORD)ComboBox_GetCurItemData(hDeviceList);
if ((DeviceNum < 0x80) || (DeviceNum == (DWORD)-1)) if ((DeviceNum < 0x80) || (DeviceNum == (DWORD)-1))
return FALSE; return FALSE;
@ -1986,7 +1985,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
selected_locale = lcmd; selected_locale = lcmd;
selected_langid = get_language_id(lcmd); selected_langid = get_language_id(lcmd);
// Avoid the FS being reset on language change // Avoid the FS being reset on language change
selected_fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); selected_fs = (int)ComboBox_GetCurItemData(hFileSystem);
relaunch = TRUE; relaunch = TRUE;
PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0); PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0);
} }
@ -2096,7 +2095,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
WriteSettingBool(SETTING_ADVANCED_MODE_DEVICE, advanced_mode_device); WriteSettingBool(SETTING_ADVANCED_MODE_DEVICE, advanced_mode_device);
ToggleAdvancedDeviceOptions(advanced_mode_device); ToggleAdvancedDeviceOptions(advanced_mode_device);
SetBootOptions(); SetBootOptions();
boot_type = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); boot_type = (int)ComboBox_GetCurItemData(hBootType);
EnableControls(TRUE, FALSE); EnableControls(TRUE, FALSE);
SetFileSystemAndClusterSize(NULL); SetFileSystemAndClusterSize(NULL);
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL<<16) | IDC_FILE_SYSTEM, SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL<<16) | IDC_FILE_SYSTEM,
@ -2107,7 +2106,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
WriteSettingBool(SETTING_ADVANCED_MODE_FORMAT, advanced_mode_format); WriteSettingBool(SETTING_ADVANCED_MODE_FORMAT, advanced_mode_format);
ToggleAdvancedFormatOptions(advanced_mode_format); ToggleAdvancedFormatOptions(advanced_mode_format);
if (selected_fs == FS_UNKNOWN) if (selected_fs == FS_UNKNOWN)
selected_fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); selected_fs = (int)ComboBox_GetCurItemData(hFileSystem);
SetFileSystemAndClusterSize(NULL); SetFileSystemAndClusterSize(NULL);
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL << 16) | IDC_FILE_SYSTEM, SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL << 16) | IDC_FILE_SYSTEM,
ComboBox_GetCurSel(hFileSystem)); ComboBox_GetCurSel(hFileSystem));
@ -2135,7 +2134,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (HIWORD(wParam) != CBN_SELCHANGE) if (HIWORD(wParam) != CBN_SELCHANGE)
break; break;
SetFileSystemAndClusterSize(NULL); SetFileSystemAndClusterSize(NULL);
windows_to_go_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_IMAGE_OPTION)); windows_to_go_selection = ComboBox_GetCurSel(hImageOption);
break; break;
case IDC_PERSISTENCE_SIZE: case IDC_PERSISTENCE_SIZE:
if (HIWORD(wParam) == EN_CHANGE) { if (HIWORD(wParam) == EN_CHANGE) {
@ -2192,14 +2191,14 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
case IDC_TARGET_SYSTEM: case IDC_TARGET_SYSTEM:
if (HIWORD(wParam) != CBN_SELCHANGE) if (HIWORD(wParam) != CBN_SELCHANGE)
break; break;
target_type = (int)ComboBox_GetItemData(hTargetSystem, ComboBox_GetCurSel(hTargetSystem)); target_type = (int)ComboBox_GetCurItemData(hTargetSystem);
SendMessage(hMainDialog, UM_UPDATE_CSM_TOOLTIP, 0, 0); SendMessage(hMainDialog, UM_UPDATE_CSM_TOOLTIP, 0, 0);
SetFileSystemAndClusterSize(NULL); SetFileSystemAndClusterSize(NULL);
break; break;
case IDC_PARTITION_TYPE: case IDC_PARTITION_TYPE:
if (HIWORD(wParam) != CBN_SELCHANGE) if (HIWORD(wParam) != CBN_SELCHANGE)
break; break;
partition_type = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)); partition_type = (int)ComboBox_GetCurItemData(hPartitionScheme);
SetPartitionSchemeAndTargetSystem(TRUE); SetPartitionSchemeAndTargetSystem(TRUE);
SetFileSystemAndClusterSize(NULL); SetFileSystemAndClusterSize(NULL);
EnableMBRBootOptions(TRUE, TRUE); EnableMBRBootOptions(TRUE, TRUE);
@ -2209,7 +2208,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if ((HIWORD(wParam) != CBN_SELCHANGE) && (HIWORD(wParam) != CBN_SELCHANGE_INTERNAL)) if ((HIWORD(wParam) != CBN_SELCHANGE) && (HIWORD(wParam) != CBN_SELCHANGE_INTERNAL))
break; break;
set_selected_fs = (HIWORD(wParam) == CBN_SELCHANGE); set_selected_fs = (HIWORD(wParam) == CBN_SELCHANGE);
fs_type = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); fs_type = (int)ComboBox_GetCurItemData(hFileSystem);
SetClusterSizes(fs_type); SetClusterSizes(fs_type);
if (set_selected_fs && (fs_type > 0)) if (set_selected_fs && (fs_type > 0))
selected_fs = fs_type; selected_fs = fs_type;
@ -2222,7 +2221,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
case IDC_BOOT_SELECTION: case IDC_BOOT_SELECTION:
if (HIWORD(wParam) != CBN_SELCHANGE) if (HIWORD(wParam) != CBN_SELCHANGE)
break; break;
boot_type = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); boot_type = (int)ComboBox_GetCurItemData(hBootType);
if ((HIWORD(wParam) != CBN_SELCHANGE) || (boot_type == selection_default)) if ((HIWORD(wParam) != CBN_SELCHANGE) || (boot_type == selection_default))
break; break;
selection_default = boot_type; selection_default = boot_type;
@ -2235,8 +2234,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
ToggleImageOptions(); ToggleImageOptions();
SetProposedLabel(ComboBox_GetCurSel(hDeviceList)); SetProposedLabel(ComboBox_GetCurSel(hDeviceList));
EnableControls(TRUE, TRUE); EnableControls(TRUE, TRUE);
target_type = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)); target_type = (int)ComboBox_GetCurItemData(hPartitionScheme);
partition_type = (int)ComboBox_GetItemData(hTargetSystem, ComboBox_GetCurSel(hTargetSystem)); partition_type = (int)ComboBox_GetCurItemData(hTargetSystem);
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
case IDC_SELECT: case IDC_SELECT:
// Ctrl-SELECT is used to select an additional archive of files to extract // Ctrl-SELECT is used to select an additional archive of files to extract
@ -2306,10 +2305,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (format_thread != NULL) if (format_thread != NULL)
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
// Just in case // Just in case
boot_type = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); boot_type = (int)ComboBox_GetCurItemData(hBootType);
partition_type = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)); partition_type = (int)ComboBox_GetCurItemData(hPartitionScheme);
target_type = (int)ComboBox_GetItemData(hTargetSystem, ComboBox_GetCurSel(hTargetSystem)); target_type = (int)ComboBox_GetCurItemData(hTargetSystem);
fs_type = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); fs_type = (int)ComboBox_GetCurItemData(hFileSystem);
write_as_image = FALSE; write_as_image = FALSE;
write_as_esp = FALSE; write_as_esp = FALSE;
installed_uefi_ntfs = FALSE; installed_uefi_ntfs = FALSE;
@ -2320,7 +2319,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
StrArrayClear(&BlockingProcess); StrArrayClear(&BlockingProcess);
no_confirmation_on_cancel = FALSE; no_confirmation_on_cancel = FALSE;
SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0); SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0);
selection_default = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); selection_default = (int)ComboBox_GetCurItemData(hBootType);
// Create a thread to validate options and download files as needed (so that we can update the UI). // Create a thread to validate options and download files as needed (so that we can update the UI).
// On exit, this thread sends message UM_FORMAT_START back to this dialog. // On exit, this thread sends message UM_FORMAT_START back to this dialog.
if (CreateThread(NULL, 0, BootCheckThread, NULL, 0, NULL) == NULL) { if (CreateThread(NULL, 0, BootCheckThread, NULL, 0, NULL) == NULL) {
@ -2430,7 +2429,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
KillTimer(hMainDialog, TID_REFRESH_TIMER); KillTimer(hMainDialog, TID_REFRESH_TIMER);
if (!op_in_progress) { if (!op_in_progress) {
queued_hotplug_event = FALSE; queued_hotplug_event = FALSE;
GetDevices((DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList))); GetDevices((DWORD)ComboBox_GetCurItemData(hDeviceList));
user_changed_label = FALSE; user_changed_label = FALSE;
EnableControls(TRUE, FALSE); EnableControls(TRUE, FALSE);
if (ComboBox_GetCurSel(hDeviceList) < 0) { if (ComboBox_GetCurSel(hDeviceList) < 0) {

View file

@ -129,6 +129,8 @@
#define IMOP_WINTOGO 0x01 #define IMOP_WINTOGO 0x01
#define IMOP_PERSISTENCE 0x02 #define IMOP_PERSISTENCE 0x02
#define ComboBox_GetCurItemData(hCtrl) ComboBox_GetItemData(hCtrl, ComboBox_GetCurSel(hCtrl))
#define safe_free(p) do {free((void*)p); p = NULL;} while(0) #define safe_free(p) do {free((void*)p); p = NULL;} while(0)
#define safe_mm_free(p) do {_mm_free((void*)p); p = NULL;} while(0) #define safe_mm_free(p) do {_mm_free((void*)p); p = NULL;} while(0)
#define safe_min(a, b) min((size_t)(a), (size_t)(b)) #define safe_min(a, b) min((size_t)(a), (size_t)(b))
@ -451,7 +453,7 @@ enum CpuArch {
extern RUFUS_UPDATE update; extern RUFUS_UPDATE update;
extern RUFUS_IMG_REPORT img_report; extern RUFUS_IMG_REPORT img_report;
extern HINSTANCE hMainInstance; extern HINSTANCE hMainInstance;
extern HWND hMainDialog, hLogDialog, hStatus, hDeviceList, hCapacity; extern HWND hMainDialog, hLogDialog, hStatus, hDeviceList, hCapacity, hImageOption;
extern HWND hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog; extern HWND hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
extern HWND hInfo, hProgress, hDiskID; extern HWND hInfo, hProgress, hDiskID;
extern WORD selected_langid; extern WORD selected_langid;

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 3.12.1689" CAPTION "Rufus 3.12.1690"
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
@ -397,8 +397,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,12,1689,0 FILEVERSION 3,12,1690,0
PRODUCTVERSION 3,12,1689,0 PRODUCTVERSION 3,12,1690,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -416,13 +416,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", "3.12.1689" VALUE "FileVersion", "3.12.1690"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2020 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-3.12.exe" VALUE "OriginalFilename", "rufus-3.12.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.12.1689" VALUE "ProductVersion", "3.12.1690"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1486,7 +1486,7 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
case IDC_UPDATE_FREQUENCY: case IDC_UPDATE_FREQUENCY:
if (HIWORD(wParam) != CBN_SELCHANGE) if (HIWORD(wParam) != CBN_SELCHANGE)
break; break;
freq = (int32_t)ComboBox_GetItemData(hFrequency, ComboBox_GetCurSel(hFrequency)); freq = (int32_t)ComboBox_GetCurItemData(hFrequency);
WriteSetting32(SETTING_UPDATE_INTERVAL, (DWORD)freq); WriteSetting32(SETTING_UPDATE_INTERVAL, (DWORD)freq);
EnableWindow(hBeta, (freq >= 0) && is_x86_32); EnableWindow(hBeta, (freq >= 0) && is_x86_32);
return (INT_PTR)TRUE; return (INT_PTR)TRUE;

View file

@ -271,8 +271,8 @@ void GetFullWidth(HWND hDlg)
fw = rc.right - rc.left - ddw; fw = rc.right - rc.left - ddw;
// Go through the Image Options for Windows To Go // Go through the Image Options for Windows To Go
fw = max(fw, GetTextSize(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_117)).cx); fw = max(fw, GetTextSize(hImageOption, lmprintf(MSG_117)).cx);
fw = max(fw, GetTextSize(GetDlgItem(hDlg, IDC_IMAGE_OPTION), lmprintf(MSG_118)).cx); fw = max(fw, GetTextSize(hImageOption, lmprintf(MSG_118)).cx);
// Now deal with full length checkbox lines // Now deal with full length checkbox lines
for (i = 0; i<ARRAYSIZE(full_width_checkboxes); i++) for (i = 0; i<ARRAYSIZE(full_width_checkboxes); i++)
@ -428,7 +428,7 @@ void PositionMainControls(HWND hDlg)
hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER); hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_SLIDER);
GetWindowRect(hCtrl, &rc); GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hCtrl, GetDlgItem(hDlg, IDC_IMAGE_OPTION), mw, rc.top, bsw, rc.bottom - rc.top, 0); SetWindowPos(hCtrl, hImageOption, mw, rc.top, bsw, rc.bottom - rc.top, 0);
// Reposition the Persistence Units dropdown (no need to resize) // Reposition the Persistence Units dropdown (no need to resize)
hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS); hCtrl = GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS);
@ -785,7 +785,7 @@ void ToggleImageOptions(void)
((!has_wintogo) && (image_options & IMOP_WINTOGO)) ) { ((!has_wintogo) && (image_options & IMOP_WINTOGO)) ) {
image_options ^= IMOP_WINTOGO; image_options ^= IMOP_WINTOGO;
// Set the Windows To Go selection in the dropdown // Set the Windows To Go selection in the dropdown
IGNORE_RETVAL(ComboBox_SetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), windows_to_go_selection)); IGNORE_RETVAL(ComboBox_SetCurSel(hImageOption, windows_to_go_selection));
} }
if (((has_persistence) && !(image_options & IMOP_PERSISTENCE)) || if (((has_persistence) && !(image_options & IMOP_PERSISTENCE)) ||
@ -818,7 +818,7 @@ void ToggleImageOptions(void)
// Set the dropdown default selection // Set the dropdown default selection
if (image_options & IMOP_WINTOGO) { if (image_options & IMOP_WINTOGO) {
SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), image_option_txt); SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), image_option_txt);
IGNORE_RETVAL(ComboBox_SetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), windows_to_go_selection)); IGNORE_RETVAL(ComboBox_SetCurSel(hImageOption, windows_to_go_selection));
} else if (image_options & IMOP_PERSISTENCE) { } else if (image_options & IMOP_PERSISTENCE) {
SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), lmprintf(MSG_123)); SetWindowTextU(GetDlgItem(hMainDialog, IDS_IMAGE_OPTION_TXT), lmprintf(MSG_123));
TogglePersistenceControls(persistence_size != 0); TogglePersistenceControls(persistence_size != 0);
@ -1194,7 +1194,7 @@ void InitProgress(BOOL bOnlyFormat)
nb_slots[OP_PARTITION] = 1; nb_slots[OP_PARTITION] = 1;
nb_slots[OP_FIX_MBR] = 1; nb_slots[OP_FIX_MBR] = 1;
nb_slots[OP_CREATE_FS] = (use_vds) ? 2 : nb_slots[OP_CREATE_FS] = (use_vds) ? 2 :
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))]; nb_steps[ComboBox_GetCurItemData(hFileSystem)];
// So, yeah, if you're doing slow format, or using Large FAT32, and have persistence, you'll see // So, yeah, if you're doing slow format, or using Large FAT32, and have persistence, you'll see
// the progress bar revert during format on account that we reuse the same operation for both // the progress bar revert during format on account that we reuse the same operation for both
// partitions. Maybe one day I'll be bothered to handle two separate OP_FORMAT ops... // partitions. Maybe one day I'll be bothered to handle two separate OP_FORMAT ops...