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

[internal] UI redesign, part 1

* Not even close!
This commit is contained in:
Pete Batard 2018-01-23 17:16:49 +00:00
parent 8fb4b091d5
commit 07f3eb42ce
18 changed files with 956 additions and 758 deletions

View file

@ -98,20 +98,17 @@ v 1.0.22
# Main dialog # Main dialog
g IDD_DIALOG g IDD_DIALOG
t IDS_DEVICE_TXT "Device" t IDS_DEVICE_TXT "Device"
# TODO: use MSG_278 for translations
t IDS_BOOT_TYPE_TXT "Boot type"
t IDS_PARTITION_TYPE_TXT "Partition scheme" t IDS_PARTITION_TYPE_TXT "Partition scheme"
t IDS_TARGET_SYSTEM_TXT "Target system type" t IDS_TARGET_SYSTEM_TXT "Target system"
t IDS_FILESYSTEM_TXT "File system" t IDS_FILESYSTEM_TXT "File system"
t IDS_CLUSTERSIZE_TXT "Cluster size" t IDS_CLUSTERSIZE_TXT "Cluster size"
t IDS_LABEL_TXT "New volume label" t IDS_LABEL_TXT "Volume label"
t IDS_FORMAT_OPTIONS_GRP "Format Options" t IDS_FORMAT_OPTIONS_GRP "Format Options"
# Note: The button (IDC_ADVANCED) that appears next to "Format Options" is repositioned automatically. # Note: The button (IDC_ADVANCED) that appears next to "Format Options" is repositioned automatically.
t IDC_BADBLOCKS "Check device for bad blocks" t IDC_BADBLOCKS "Check device for bad blocks"
t IDC_QUICKFORMAT "Quick format" t IDC_QUICKFORMAT "Quick format"
t IDC_BOOT "Create a bootable disk using"
t IDC_WINDOWS_INSTALL "Standard Windows installation"
# Only translate if Microsoft has a specific name for http://en.wikipedia.org/wiki/Windows_To_Go in your language
# Otherwise, you can add a parenthesis eg. "Windows To Go (hint at what it does)" and/or use the tooltip (MSG_200)
t IDC_WINDOWS_TO_GO "Windows To Go"
t IDC_SET_ICON "Create extended label and icon files" t IDC_SET_ICON "Create extended label and icon files"
t IDC_ABOUT "About..." t IDC_ABOUT "About..."
t IDC_LOG "Log" t IDC_LOG "Log"
@ -180,8 +177,8 @@ t MSG_003 "WARNING: ALL DATA ON DEVICE '%s' WILL BE DESTROYED.\n"
t MSG_004 "Rufus update policy" t MSG_004 "Rufus update policy"
t MSG_005 "Do you want to allow Rufus to check for application updates online?" t MSG_005 "Do you want to allow Rufus to check for application updates online?"
# Must be the same as IDD_DIALOG:IDCANCEL (i.e. "Close" - I know it's confusing) # Must be the same as IDD_DIALOG:IDCANCEL (i.e. "Close" - I know it's confusing)
t MSG_006 "Close" t MSG_006 "CLOSE"
t MSG_007 "Cancel" t MSG_007 "CANCEL"
t MSG_008 "Yes" t MSG_008 "Yes"
t MSG_009 "No" t MSG_009 "No"
t MSG_010 "Bad blocks found" t MSG_010 "Bad blocks found"
@ -210,13 +207,13 @@ t MSG_028 "megabytes"
t MSG_029 "Default" t MSG_029 "Default"
# The following gets appended to the file system, cluster size, etc. # The following gets appended to the file system, cluster size, etc.
t MSG_030 "%s (Default)" t MSG_030 "%s (Default)"
t MSG_031 "%s partition scheme for BIOS or %s" t MSG_031 "BIOS (or UEFI-CSM)"
t MSG_032 "%s partition scheme for BIOS" t MSG_032 "UEFI (non CSM)"
t MSG_033 "%s partition scheme for UEFI" t MSG_033 "BIOS or UEFI"
# Number of bad block check passes (singular for 1 pass, plural for 2 or more passes) # Number of bad block check passes (singular for 1 pass, plural for 2 or more passes)
t MSG_034 "%d mass" t MSG_034 "%d pass"
t MSG_035 "%d masses" t MSG_035 "%d passes"
t MSG_036 "ISO Image" t MSG_036 "Disk or ISO Image"
t MSG_037 "Application" t MSG_037 "Application"
t MSG_038 "Abort" t MSG_038 "Abort"
t MSG_039 "Launch" t MSG_039 "Launch"
@ -298,7 +295,7 @@ t MSG_093 "IMPORTANT: THIS DRIVE CONTAINS MULTIPLE PARTITIONS!!\n\n"
"This may include partitions/volumes that aren't listed or even visible from Windows. " "This may include partitions/volumes that aren't listed or even visible from Windows. "
"Should you wish to proceed, you are responsible for any data loss on these partitions." "Should you wish to proceed, you are responsible for any data loss on these partitions."
t MSG_094 "Multiple partitions detected" t MSG_094 "Multiple partitions detected"
t MSG_095 "DD Image" ###### t MSG_095 "DD Image"
t MSG_096 "The file system currently selected can not be used with this type of ISO. " t MSG_096 "The file system currently selected can not be used with this type of ISO. "
"Please select a different file system or use a different ISO." "Please select a different file system or use a different ISO."
t MSG_097 "'%s' can only be applied if the file system is NTFS." t MSG_097 "'%s' can only be applied if the file system is NTFS."
@ -379,7 +376,7 @@ t MSG_159 "Use this field to set the drive label\nInternational characters are a
t MSG_160 "Toggle advanced options" t MSG_160 "Toggle advanced options"
t MSG_161 "Check the device for bad blocks using a test pattern" t MSG_161 "Check the device for bad blocks using a test pattern"
t MSG_162 "Uncheck this box to use the \"slow\" format method" t MSG_162 "Uncheck this box to use the \"slow\" format method"
t MSG_163 "Check this box to make the USB drive bootable" ### t MSG_163 ###FREE TO USE###
t MSG_164 "Method that will be used to make the drive bootable" t MSG_164 "Method that will be used to make the drive bootable"
t MSG_165 "Click to select an image..." t MSG_165 "Click to select an image..."
t MSG_166 "Check this box to allow the display of international labels " t MSG_166 "Check this box to allow the display of international labels "
@ -570,6 +567,11 @@ t MSG_299 "Timestamp validation error"
t MSG_300 "Rufus could not validate that the timestamp of the downloaded update is more recent than the one for the " t MSG_300 "Rufus could not validate that the timestamp of the downloaded update is more recent than the one for the "
"current executable.\n\nIn order to prevent potential attack scenarios, the update process has been aborted and " "current executable.\n\nIn order to prevent potential attack scenarios, the update process has been aborted and "
"the download will be deleted. Please check the log for more details." "the download will be deleted. Please check the log for more details."
t MSG_301 "Standard Windows installation"
# Only translate if Microsoft has a specific name for http://en.wikipedia.org/wiki/Windows_To_Go in your language
# Otherwise, you can add a parenthesis eg. "Windows To Go (hint at what it does)" and/or use the tooltip (MSG_200)
t MSG_302 "Windows To Go"
################################################################################ ################################################################################
############################# TRANSLATOR END COPY ############################## ############################# TRANSLATOR END COPY ##############################

View file

@ -69,6 +69,7 @@ uint32_t bufnum, sum_count[CHECKSUM_MAX] = { 16, 20, 32 };
HANDLE data_ready[CHECKSUM_MAX] = { 0 }, thread_ready[CHECKSUM_MAX] = { 0 }; HANDLE data_ready[CHECKSUM_MAX] = { 0 }, thread_ready[CHECKSUM_MAX] = { 0 };
DWORD read_size[2]; DWORD read_size[2];
unsigned char ALIGNED(64) buffer[2][BUFFER_SIZE]; unsigned char ALIGNED(64) buffer[2][BUFFER_SIZE];
extern progress_in_use;
/* /*
* Rotate 32 bit integers by n bytes. * Rotate 32 bit integers by n bytes.
@ -927,6 +928,7 @@ DWORD WINAPI SumThread(void* param)
bufnum = 0; bufnum = 0;
_bufnum = 0; _bufnum = 0;
read_size[0] = 1; // Don't trigger the first loop break read_size[0] = 1; // Don't trigger the first loop break
progress_in_use = TRUE;
for (rb = 0; ;rb += read_size[_bufnum]) { for (rb = 0; ;rb += read_size[_bufnum]) {
// Update the progress and check for cancel // Update the progress and check for cancel
if (GetTickCount64() > LastRefresh + MAX_REFRESH) { if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
@ -982,6 +984,7 @@ DWORD WINAPI SumThread(void* param)
r = 0; r = 0;
out: out:
progress_in_use = FALSE;
for (i = 0; i < CHECKSUM_MAX; i++) { for (i = 0; i < CHECKSUM_MAX; i++) {
if (sum_thread[i] != NULL) if (sum_thread[i] != NULL)
TerminateThread(sum_thread[i], 1); TerminateThread(sum_thread[i], 1);

View file

@ -1,7 +1,7 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* Device detection and enumeration * Device detection and enumeration
* Copyright © 2014-2017 Pete Batard <pete@akeo.ie> * Copyright © 2014-2018 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

@ -1,7 +1,7 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* Drive access function calls * Drive access function calls
* Copyright © 2011-2016 Pete Batard <pete@akeo.ie> * Copyright © 2011-2018 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
@ -1164,7 +1164,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
} }
DriveLayoutEx.PartitionEntry[pn].PartitionLength.QuadPart = main_part_size_in_sectors * SelectedDrive.SectorSize; DriveLayoutEx.PartitionEntry[pn].PartitionLength.QuadPart = main_part_size_in_sectors * SelectedDrive.SectorSize;
if (partition_style == PARTITION_STYLE_MBR) { if (partition_style == PARTITION_STYLE_MBR) {
DriveLayoutEx.PartitionEntry[pn].Mbr.BootIndicator = IsChecked(IDC_BOOT); DriveLayoutEx.PartitionEntry[pn].Mbr.BootIndicator = (bt != BT_NON_BOOTABLE);
switch (file_system) { switch (file_system) {
case FS_FAT16: case FS_FAT16:
DriveLayoutEx.PartitionEntry[pn].Mbr.PartitionType = 0x0e; // FAT16 LBA DriveLayoutEx.PartitionEntry[pn].Mbr.PartitionType = 0x0e; // FAT16 LBA

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* Formatting function calls * Formatting function calls
* Copyright © 2007-2009 Tom Thornhill/Ridgecrop * Copyright © 2007-2009 Tom Thornhill/Ridgecrop
* Copyright © 2011-2017 Pete Batard <pete@akeo.ie> * Copyright © 2011-2018 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
@ -683,7 +683,6 @@ static BOOL FormatDrive(DWORD DriveIndex)
WCHAR wLabel[64]; WCHAR wLabel[64];
ULONG ulClusterSize; ULONG ulClusterSize;
size_t i; size_t i;
int fs;
GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType)); GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType));
// Might have a (Default) suffix => remove it // Might have a (Default) suffix => remove it
@ -693,7 +692,6 @@ static BOOL FormatDrive(DWORD DriveIndex)
break; break;
} }
} }
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) { if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) {
PrintInfoDebug(0, MSG_220, FSType, dur_mins, dur_secs); PrintInfoDebug(0, MSG_220, FSType, dur_mins, dur_secs);
} else { } else {
@ -864,9 +862,6 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
FAKE_FD fake_fd = { 0 }; FAKE_FD fake_fd = { 0 };
FILE* fp = (FILE*)&fake_fd; FILE* fp = (FILE*)&fake_fd;
const char* using_msg = "Using %s MBR\n"; const char* using_msg = "Using %s MBR\n";
int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
AnalyzeMBR(hPhysicalDrive, "Drive"); AnalyzeMBR(hPhysicalDrive, "Drive");
@ -906,7 +901,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
buffer[0x1c2] = 0x0c; buffer[0x1c2] = 0x0c;
break; break;
} }
if ((IsChecked(IDC_BOOT)) && (tt == TT_BIOS)) { if ((bt != BT_NON_BOOTABLE) && (tt == 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_GetItemData(hDiskID, ComboBox_GetCurSel(hDiskID)):0x80;
@ -936,21 +931,21 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
// Syslinux // Syslinux
if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) ||
((bt == BT_ISO) && HAS_SYSLINUX(img_report)) ) { ((bt == BT_IMAGE) && HAS_SYSLINUX(img_report)) ) {
uprintf(using_msg, "Syslinux"); uprintf(using_msg, "Syslinux");
r = write_syslinux_mbr(fp); r = write_syslinux_mbr(fp);
goto notify; goto notify;
} }
// Grub 2.0 // Grub 2.0
if ( ((bt == BT_ISO) && (img_report.has_grub2)) || (bt == BT_GRUB2) ) { if ( ((bt == BT_IMAGE) && (img_report.has_grub2)) || (bt == BT_GRUB2) ) {
uprintf(using_msg, "Grub 2.0"); uprintf(using_msg, "Grub 2.0");
r = write_grub2_mbr(fp); r = write_grub2_mbr(fp);
goto notify; goto notify;
} }
// Grub4DOS // Grub4DOS
if ( ((bt == BT_ISO) && (img_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) { if ( ((bt == BT_IMAGE) && (img_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) {
uprintf(using_msg, "Grub4DOS"); uprintf(using_msg, "Grub4DOS");
r = write_grub4dos_mbr(fp); r = write_grub4dos_mbr(fp);
goto notify; goto notify;
@ -964,7 +959,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
} }
// KolibriOS // KolibriOS
if ( (bt == BT_ISO) && HAS_KOLIBRIOS(img_report) && (IS_FAT(fs))) { if ( (bt == BT_IMAGE) && HAS_KOLIBRIOS(img_report) && (IS_FAT(fs))) {
uprintf(using_msg, "KolibriOS"); uprintf(using_msg, "KolibriOS");
r = write_kolibrios_mbr(fp); r = write_kolibrios_mbr(fp);
goto notify; goto notify;
@ -997,7 +992,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
{ {
// TODO: Do we need anything special for 4K sectors? // TODO: Do we need anything special for 4K sectors?
DWORD size, max_size, mbr_size = 0x200; DWORD size, max_size, mbr_size = 0x200;
int r, bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); int r;
unsigned char* buf = NULL; unsigned char* buf = NULL;
FAKE_FD fake_fd = { 0 }; FAKE_FD fake_fd = { 0 };
FILE* fp = (FILE*)&fake_fd; FILE* fp = (FILE*)&fake_fd;
@ -1009,7 +1004,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
(DWORD)(SelectedDrive.SectorsPerTrack * SelectedDrive.SectorSize) : 1*MB; (DWORD)(SelectedDrive.SectorsPerTrack * SelectedDrive.SectorSize) : 1*MB;
max_size -= mbr_size; max_size -= mbr_size;
// Syslinux has precedence over Grub // Syslinux has precedence over Grub
if ((bt == BT_ISO) && (!HAS_SYSLINUX(img_report))) { if ((bt == BT_IMAGE) && (!HAS_SYSLINUX(img_report))) {
if (img_report.has_grub4dos) if (img_report.has_grub4dos)
bt = BT_GRUB4DOS; bt = BT_GRUB4DOS;
if (img_report.has_grub2) if (img_report.has_grub2)
@ -1059,12 +1054,12 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
/* /*
* Process the Partition Boot Record * Process the Partition Boot Record
*/ */
static __inline const char* bt_to_name(int bt) { static __inline const char* bt_to_name(void) {
switch (bt) { switch (bt) {
case BT_FREEDOS: return "FreeDOS"; case BT_FREEDOS: return "FreeDOS";
case BT_REACTOS: return "ReactOS"; case BT_REACTOS: return "ReactOS";
default: default:
return ((bt==BT_ISO) && HAS_KOLIBRIOS(img_report)) ? "KolibriOS" : "Standard"; return ((bt==BT_IMAGE) && HAS_KOLIBRIOS(img_report)) ? "KolibriOS" : "Standard";
} }
} }
static BOOL WritePBR(HANDLE hLogicalVolume) static BOOL WritePBR(HANDLE hLogicalVolume)
@ -1072,7 +1067,6 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
int i; int i;
FAKE_FD fake_fd = { 0 }; FAKE_FD fake_fd = { 0 };
FILE* fp = (FILE*)&fake_fd; FILE* fp = (FILE*)&fake_fd;
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
const char* using_msg = "Using %s %s partition boot record\n"; const char* using_msg = "Using %s %s partition boot record\n";
fake_fd._handle = (char*)hLogicalVolume; fake_fd._handle = (char*)hLogicalVolume;
@ -1080,7 +1074,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) { switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) {
case FS_FAT16: case FS_FAT16:
uprintf(using_msg, bt_to_name(bt), "FAT16"); uprintf(using_msg, bt_to_name(), "FAT16");
if (!is_fat_16_fs(fp)) { if (!is_fat_16_fs(fp)) {
uprintf("New volume does not have a FAT16 boot sector - aborting\n"); uprintf("New volume does not have a FAT16 boot sector - aborting\n");
break; break;
@ -1090,7 +1084,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
if (!write_fat_16_fd_br(fp, 0)) break; if (!write_fat_16_fd_br(fp, 0)) break;
} else if (bt == BT_REACTOS) { } else if (bt == BT_REACTOS) {
if (!write_fat_16_ros_br(fp, 0)) break; if (!write_fat_16_ros_br(fp, 0)) break;
} else if ((bt == BT_ISO) && HAS_KOLIBRIOS(img_report)) { } else if ((bt == BT_IMAGE) && HAS_KOLIBRIOS(img_report)) {
uprintf("FAT16 is not supported for KolibriOS\n"); break; uprintf("FAT16 is not supported for KolibriOS\n"); break;
} else { } else {
if (!write_fat_16_br(fp, 0)) break; if (!write_fat_16_br(fp, 0)) break;
@ -1100,7 +1094,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
break; break;
return TRUE; return TRUE;
case FS_FAT32: case FS_FAT32:
uprintf(using_msg, bt_to_name(bt), "FAT32"); uprintf(using_msg, bt_to_name(), "FAT32");
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
if (!is_fat_32_fs(fp)) { if (!is_fat_32_fs(fp)) {
uprintf("New volume does not have a %s FAT32 boot sector - aborting\n", i?"secondary":"primary"); uprintf("New volume does not have a %s FAT32 boot sector - aborting\n", i?"secondary":"primary");
@ -1112,11 +1106,11 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
if (!write_fat_32_fd_br(fp, 0)) break; if (!write_fat_32_fd_br(fp, 0)) break;
} else if (bt == BT_REACTOS) { } else if (bt == BT_REACTOS) {
if (!write_fat_32_ros_br(fp, 0)) break; if (!write_fat_32_ros_br(fp, 0)) break;
} else if ((bt == BT_ISO) && HAS_KOLIBRIOS(img_report)) { } else if ((bt == BT_IMAGE) && HAS_KOLIBRIOS(img_report)) {
if (!write_fat_32_kos_br(fp, 0)) break; if (!write_fat_32_kos_br(fp, 0)) break;
} else if ((bt == BT_ISO) && HAS_BOOTMGR(img_report)) { } else if ((bt == BT_IMAGE) && HAS_BOOTMGR(img_report)) {
if (!write_fat_32_pe_br(fp, 0)) break; if (!write_fat_32_pe_br(fp, 0)) break;
} else if ((bt == BT_ISO) && HAS_WINPE(img_report)) { } else if ((bt == BT_IMAGE) && HAS_WINPE(img_report)) {
if (!write_fat_32_nt_br(fp, 0)) break; if (!write_fat_32_nt_br(fp, 0)) break;
} else { } else {
if (!write_fat_32_br(fp, 0)) break; if (!write_fat_32_br(fp, 0)) break;
@ -1128,7 +1122,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
} }
return TRUE; return TRUE;
case FS_NTFS: case FS_NTFS:
uprintf(using_msg, bt_to_name(bt), "NTFS"); uprintf(using_msg, bt_to_name(), "NTFS");
if (!is_ntfs_fs(fp)) { if (!is_ntfs_fs(fp)) {
uprintf("New volume does not have an NTFS boot sector - aborting\n"); uprintf("New volume does not have an NTFS boot sector - aborting\n");
break; break;
@ -1644,7 +1638,7 @@ out:
*/ */
DWORD WINAPI FormatThread(void* param) DWORD WINAPI FormatThread(void* param)
{ {
int i, r, pt, tt, fs, bt; int i, r;
BOOL ret, use_large_fat32, windows_to_go; BOOL ret, use_large_fat32, windows_to_go;
DWORD DriveIndex = (DWORD)(uintptr_t)param; DWORD DriveIndex = (DWORD)(uintptr_t)param;
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE; HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
@ -1660,11 +1654,9 @@ DWORD WINAPI FormatThread(void* param)
char efi_dst[] = "?:\\efi\\boot\\bootx64.efi"; char efi_dst[] = "?:\\efi\\boot\\bootx64.efi";
char kolibri_dst[] = "?:\\MTLD_F32"; char kolibri_dst[] = "?:\\MTLD_F32";
char grub4dos_dst[] = "?:\\grldr"; char grub4dos_dst[] = "?:\\grldr";
// TODO: Have a boolean to indicate DD writing
BOOL write_as_image = FALSE;
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32));
windows_to_go = (togo_mode) && HAS_WINTOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); windows_to_go = (togo_mode) && HAS_WINTOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED);
large_drive = (SelectedDrive.DiskSize > (1*TB)); large_drive = (SelectedDrive.DiskSize > (1*TB));
@ -1676,7 +1668,7 @@ DWORD WINAPI FormatThread(void* param)
// http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr // http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr
extra_partitions = XP_MSR | XP_EFI; extra_partitions = XP_MSR | XP_EFI;
else if ( (fs == FS_NTFS) && ((bt == BT_UEFI_NTFS) || else if ( (fs == FS_NTFS) && ((bt == BT_UEFI_NTFS) ||
((bt == BT_ISO) && IS_EFI_BOOTABLE(img_report) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) ) ((bt == BT_IMAGE) && IS_EFI_BOOTABLE(img_report) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) )
extra_partitions = XP_UEFI_NTFS; extra_partitions = XP_UEFI_NTFS;
else if (IsChecked(IDC_EXTRA_PARTITION)) else if (IsChecked(IDC_EXTRA_PARTITION))
extra_partitions = XP_COMPAT; extra_partitions = XP_COMPAT;
@ -1707,7 +1699,7 @@ DWORD WINAPI FormatThread(void* param)
// Do it in reverse so that we always end on the first volume letter // Do it in reverse so that we always end on the first volume letter
for (i=(int)safe_strlen(drive_letters); i>0; i--) { for (i=(int)safe_strlen(drive_letters); i>0; i--) {
drive_name[0] = drive_letters[i-1]; drive_name[0] = drive_letters[i-1];
if (IsChecked(IDC_BOOT) && ((bt == BT_ISO) || (bt == BT_IMG))) { if (bt == BT_IMAGE) {
// If we are using an image, check that it isn't located on the drive we are trying to format // If we are using an image, check that it isn't located on the drive we are trying to format
if ((PathGetDriveNumberU(image_path) + 'A') == drive_letters[i-1]) { if ((PathGetDriveNumberU(image_path) + 'A') == drive_letters[i-1]) {
uprintf("ABORTED: Cannot use an image that is located on the target drive!\n"); uprintf("ABORTED: Cannot use an image that is located on the target drive!\n");
@ -1755,7 +1747,7 @@ DWORD WINAPI FormatThread(void* param)
// Note, Microsoft's way of cleaning partitions (IOCTL_DISK_CREATE_DISK, which is what we apply // Note, Microsoft's way of cleaning partitions (IOCTL_DISK_CREATE_DISK, which is what we apply
// in InitializeDisk) is *NOT ENOUGH* to reset a disk and can render it inoperable for partitioning // in InitializeDisk) is *NOT ENOUGH* to reset a disk and can render it inoperable for partitioning
// or formatting under Windows. See https://github.com/pbatard/rufus/issues/759 for details. // or formatting under Windows. See https://github.com/pbatard/rufus/issues/759 for details.
if ((!IsChecked(IDC_BOOT)) || (bt != BT_IMG)) { if ((bt != BT_IMAGE) || (img_report.is_iso)) {
if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) || if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) ||
(!InitializeDisk(hPhysicalDrive))) { (!InitializeDisk(hPhysicalDrive))) {
uprintf("Could not reset partitions\n"); uprintf("Could not reset partitions\n");
@ -1830,7 +1822,7 @@ DWORD WINAPI FormatThread(void* param)
} }
// Write an image file // Write an image file
if (IsChecked(IDC_BOOT) && (bt == BT_IMG)) { if ((bt == BT_IMAGE) && write_as_image) {
hSourceImage = CreateFileU(image_path, GENERIC_READ, FILE_SHARE_READ, NULL, hSourceImage = CreateFileU(image_path, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hSourceImage == INVALID_HANDLE_VALUE) { if (hSourceImage == INVALID_HANDLE_VALUE) {
@ -1935,18 +1927,18 @@ DWORD WINAPI FormatThread(void* param)
uprintf("Warning: Failed to refresh label: %s", WindowsErrorString()); uprintf("Warning: Failed to refresh label: %s", WindowsErrorString());
} }
if (IsChecked(IDC_BOOT)) { if (bt != BT_NON_BOOTABLE) {
if (bt == BT_UEFI_NTFS) { if (bt == BT_UEFI_NTFS) {
// All good // All good
} else if (tt == TT_UEFI) { } else if (tt == TT_UEFI) {
// For once, no need to do anything - just check our sanity // For once, no need to do anything - just check our sanity
if ( (bt != BT_ISO) || !IS_EFI_BOOTABLE(img_report) || (fs > FS_NTFS) ) { if ( (bt != BT_IMAGE) || !IS_EFI_BOOTABLE(img_report) || (fs > FS_NTFS) ) {
uprintf("Spock gone crazy error in %s:%d", __FILE__, __LINE__); uprintf("Spock gone crazy error in %s:%d", __FILE__, __LINE__);
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
goto out; goto out;
} }
} else if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || } else if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) ||
((bt == BT_ISO) && (HAS_SYSLINUX(img_report) || HAS_REACTOS(img_report)) && ((bt == BT_IMAGE) && (HAS_SYSLINUX(img_report) || HAS_REACTOS(img_report)) &&
(!HAS_WINDOWS(img_report) || !allow_dual_uefi_bios)) ) { (!HAS_WINDOWS(img_report) || !allow_dual_uefi_bios)) ) {
if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) { if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
@ -1985,7 +1977,7 @@ DWORD WINAPI FormatThread(void* param)
goto out; goto out;
CHECK_FOR_USER_CANCEL; CHECK_FOR_USER_CANCEL;
if (IsChecked(IDC_BOOT)) { if (bt != BT_NON_BOOTABLE) {
if ((bt == BT_MSDOS) || (bt == BT_FREEDOS)) { if ((bt == BT_MSDOS) || (bt == BT_FREEDOS)) {
UpdateProgress(OP_DOS, -1.0f); UpdateProgress(OP_DOS, -1.0f);
PrintInfoDebug(0, MSG_230); PrintInfoDebug(0, MSG_230);
@ -2001,7 +1993,7 @@ DWORD WINAPI FormatThread(void* param)
IsFileInDB(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr")?"":""); IsFileInDB(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr")?"":"");
if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE)) if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE))
uprintf("Failed to copy file: %s", WindowsErrorString()); uprintf("Failed to copy file: %s", WindowsErrorString());
} else if ((bt == BT_ISO) && (image_path != NULL)) { } else if ((bt == BT_IMAGE) && (image_path != NULL) && (img_report.is_iso)) {
UpdateProgress(OP_DOS, 0.0f); UpdateProgress(OP_DOS, 0.0f);
drive_name[2] = 0; // Ensure our drive is something like 'D:' drive_name[2] = 0; // Ensure our drive is something like 'D:'
if (windows_to_go) { if (windows_to_go) {
@ -2057,7 +2049,7 @@ DWORD WINAPI FormatThread(void* param)
// Issue another complete remount before we exit, to ensure we're clean // Issue another complete remount before we exit, to ensure we're clean
RemountVolume(drive_name); RemountVolume(drive_name);
// NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk) // NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk)
if ((bt == BT_ISO) && (fs == FS_NTFS)) { if ((bt == BT_IMAGE) && (img_report.is_iso) && (fs == FS_NTFS)) {
// Try to ensure that all messages from Checkdisk will be in English // Try to ensure that all messages from Checkdisk will be in English
if (PRIMARYLANGID(GetThreadUILanguage()) != LANG_ENGLISH) { if (PRIMARYLANGID(GetThreadUILanguage()) != LANG_ENGLISH) {
SetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); SetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* Formatting function calls * Formatting function calls
* Copyright © 2007-2009 Tom Thornhill/Ridgecrop * Copyright © 2007-2009 Tom Thornhill/Ridgecrop
* Copyright © 2011-2014 Pete Batard <pete@akeo.ie> * Copyright © 2011-2018 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

@ -1,7 +1,7 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* ISO file extraction * ISO file extraction
* Copyright © 2011-2016 Pete Batard <pete@akeo.ie> * Copyright © 2011-2018 Pete Batard <pete@akeo.ie>
* Based on libcdio's iso & udf samples: * Based on libcdio's iso & udf samples:
* Copyright © 2003-2014 Rocky Bernstein <rocky@gnu.org> * Copyright © 2003-2014 Rocky Bernstein <rocky@gnu.org>
* *
@ -1170,7 +1170,7 @@ BOOL ExtractEfiImgFiles(const char* dir)
iso9660_readfat_private* p_private = NULL; iso9660_readfat_private* p_private = NULL;
libfat_sector_t s; libfat_sector_t s;
int32_t dc, c; int32_t dc, c;
struct libfat_filesystem *fs = NULL; struct libfat_filesystem *lf_fs = NULL;
struct libfat_direntry direntry; struct libfat_direntry direntry;
char name[12] = { 0 }; char name[12] = { 0 };
char path[64]; char path[64];
@ -1201,17 +1201,17 @@ BOOL ExtractEfiImgFiles(const char* dir)
uprintf("Error reading ISO-9660 file %s at LSN %lu\n", img_report.efi_img_path, (long unsigned int)p_private->lsn); uprintf("Error reading ISO-9660 file %s at LSN %lu\n", img_report.efi_img_path, (long unsigned int)p_private->lsn);
goto out; goto out;
} }
fs = libfat_open(iso9660_readfat, (intptr_t)p_private); lf_fs = libfat_open(iso9660_readfat, (intptr_t)p_private);
if (fs == NULL) { if (lf_fs == NULL) {
uprintf("FAT access error"); uprintf("FAT access error");
goto out; goto out;
} }
// Navigate to /EFI/BOOT // Navigate to /EFI/BOOT
if (libfat_searchdir(fs, 0, "EFI ", &direntry) < 0) if (libfat_searchdir(lf_fs, 0, "EFI ", &direntry) < 0)
goto out; goto out;
dc = direntry.entry[26] + (direntry.entry[27] << 8); dc = direntry.entry[26] + (direntry.entry[27] << 8);
if (libfat_searchdir(fs, dc, "BOOT ", &direntry) < 0) if (libfat_searchdir(lf_fs, dc, "BOOT ", &direntry) < 0)
goto out; goto out;
dc = direntry.entry[26] + (direntry.entry[27] << 8); dc = direntry.entry[26] + (direntry.entry[27] << 8);
@ -1228,7 +1228,7 @@ BOOL ExtractEfiImgFiles(const char* dir)
} else } else
name[k++] = toupper(efi_bootname[i][j]); name[k++] = toupper(efi_bootname[i][j]);
} }
c = libfat_searchdir(fs, dc, name, &direntry); c = libfat_searchdir(lf_fs, dc, name, &direntry);
if (c > 0) { if (c > 0) {
if (dir == NULL) { if (dir == NULL) {
if (!ret) if (!ret)
@ -1265,9 +1265,9 @@ BOOL ExtractEfiImgFiles(const char* dir)
} }
written = 0; written = 0;
s = libfat_clustertosector(fs, c); s = libfat_clustertosector(lf_fs, c);
while ((s != 0) && (s < 0xFFFFFFFFULL) && (written < file_size)) { while ((s != 0) && (s < 0xFFFFFFFFULL) && (written < file_size)) {
buf = libfat_get_sector(fs, s); buf = libfat_get_sector(lf_fs, s);
size = MIN(LIBFAT_SECTOR_SIZE, file_size - written); size = MIN(LIBFAT_SECTOR_SIZE, file_size - written);
if (!WriteFileWithRetry(handle, buf, size, &size, WRITE_RETRIES) || if (!WriteFileWithRetry(handle, buf, size, &size, WRITE_RETRIES) ||
(size != MIN(LIBFAT_SECTOR_SIZE, file_size - written))) { (size != MIN(LIBFAT_SECTOR_SIZE, file_size - written))) {
@ -1276,7 +1276,7 @@ BOOL ExtractEfiImgFiles(const char* dir)
continue; continue;
} }
written += size; written += size;
s = libfat_nextsector(fs, s); s = libfat_nextsector(lf_fs, s);
} }
CloseHandle(handle); CloseHandle(handle);
ret = TRUE; ret = TRUE;
@ -1285,8 +1285,8 @@ BOOL ExtractEfiImgFiles(const char* dir)
} }
out: out:
if (fs != NULL) if (lf_fs != NULL)
libfat_close(fs); libfat_close(lf_fs);
if (p_statbuf != NULL) if (p_statbuf != NULL)
safe_free(p_statbuf->rr.psz_symlink); safe_free(p_statbuf->rr.psz_symlink);
safe_free(p_statbuf); safe_free(p_statbuf);

View file

@ -34,7 +34,7 @@ RUFUS_URL "\\line\n"
const char* additional_copyrights = const char* additional_copyrights =
"{\\rtf1\\ansi\n" "{\\rtf1\\ansi\n"
"Based on a GUI redesign concept by Fahad Al-Riyami\\line\n" "Rufus 3.0 GUI redesign concept by Fahad Al-Riyami\\line\n"
"Used with kind authorization\\line\n" "Used with kind authorization\\line\n"
"\\line\n" "\\line\n"
"Icon by PC Unleashed:\\line\n" "Icon by PC Unleashed:\\line\n"

View file

@ -80,6 +80,8 @@ char* default_msg_table[MSG_MAX-MSG_000] = {"%s", 0};
char* current_msg_table[MSG_MAX-MSG_000] = {"%s", 0}; char* current_msg_table[MSG_MAX-MSG_000] = {"%s", 0};
char** msg_table = NULL; char** msg_table = NULL;
extern progress_in_use;
static void mtab_destroy(BOOL reinit) static void mtab_destroy(BOOL reinit)
{ {
size_t j; size_t j;
@ -428,6 +430,14 @@ static uint64_t last_msg_time[2] = { 0, 0 };
static void PrintInfoMessage(char* msg) { static void PrintInfoMessage(char* msg) {
SetWindowTextU(hProgress, msg); SetWindowTextU(hProgress, msg);
// Make sure our field gets redrawn // Make sure our field gets redrawn
// If the progress bar is not active, it looks like WM_PAINT is
// ignored. But InvalidateRect is causing refresh tearing so we
// don't want to use that while active.
// Refresh still sucks though and marquee no longer works... :(
// TODO: Create our own progress bar control with text overlay and inverted text
if (!progress_in_use)
InvalidateRect(hProgress, NULL, TRUE);
else
SendMessage(hProgress, WM_PAINT, 0, 0); SendMessage(hProgress, WM_PAINT, 0, 0);
} }
static void PrintStatusMessage(char* msg) { static void PrintStatusMessage(char* msg) {
@ -446,6 +456,7 @@ static void CALLBACK OutputMessageTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent
KillTimer(hMainDialog, idEvent); KillTimer(hMainDialog, idEvent);
bOutputTimerArmed[i] = FALSE; bOutputTimerArmed[i] = FALSE;
PrintMessage[i](output_msg[i]); PrintMessage[i](output_msg[i]);
last_msg_time[i] = GetTickCount64(); last_msg_time[i] = GetTickCount64();
} }

View file

@ -46,13 +46,12 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDC_ABOUT), LOC_CTRL(IDC_ABOUT),
LOC_CTRL(IDC_LABEL), LOC_CTRL(IDC_LABEL),
LOC_CTRL(IDC_QUICKFORMAT), LOC_CTRL(IDC_QUICKFORMAT),
LOC_CTRL(IDC_BOOT),
LOC_CTRL(IDC_BADBLOCKS), LOC_CTRL(IDC_BADBLOCKS),
LOC_CTRL(IDC_PROGRESS), LOC_CTRL(IDC_PROGRESS),
LOC_CTRL(IDC_BOOTTYPE), LOC_CTRL(IDC_BOOTTYPE),
LOC_CTRL(IDC_NBPASSES), LOC_CTRL(IDC_NBPASSES),
LOC_CTRL(IDC_TEST), LOC_CTRL(IDC_TEST),
LOC_CTRL(IDC_SELECT_ISO), LOC_CTRL(IDC_SELECT_IMAGE),
LOC_CTRL(IDC_SET_ICON), LOC_CTRL(IDC_SET_ICON),
LOC_CTRL(IDC_RUFUS_MBR), LOC_CTRL(IDC_RUFUS_MBR),
LOC_CTRL(IDC_TARGET_SYSTEM), LOC_CTRL(IDC_TARGET_SYSTEM),
@ -65,7 +64,7 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDC_HASH), LOC_CTRL(IDC_HASH),
LOC_CTRL(IDC_SAVE), LOC_CTRL(IDC_SAVE),
LOC_CTRL(IDC_SELECTED_IMAGE), LOC_CTRL(IDC_SELECTED_IMAGE),
LOC_CTRL(IDC_BOOT_OPTION), LOC_CTRL(IDC_IMAGE_OPTION),
LOC_CTRL(IDC_ABOUT_LICENSE), LOC_CTRL(IDC_ABOUT_LICENSE),
LOC_CTRL(IDC_ABOUT_ICON), LOC_CTRL(IDC_ABOUT_ICON),
LOC_CTRL(IDC_ABOUT_UPDATES), LOC_CTRL(IDC_ABOUT_UPDATES),
@ -150,13 +149,13 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDS_CHECK_NOW_GRP), LOC_CTRL(IDS_CHECK_NOW_GRP),
LOC_CTRL(IDS_TARGET_SYSTEM_TXT), LOC_CTRL(IDS_TARGET_SYSTEM_TXT),
LOC_CTRL(IDS_SELETED_IMAGE_TXT), LOC_CTRL(IDS_SELETED_IMAGE_TXT),
LOC_CTRL(IDS_BOOT_OPTION_TXT), LOC_CTRL(IDS_IMAGE_OPTION_TXT),
LOC_CTRL(IDS_SELECTED_IMAGE_TXT), LOC_CTRL(IDS_SELECTED_IMAGE_TXT),
LOC_CTRL(IDS_BOOT_TYPE_TXT), LOC_CTRL(IDS_BOOT_TYPE_TXT),
LOC_CTRL(IDS_DEVICE_OPTIONS_TXT), LOC_CTRL(IDS_DEVICE_SETTINGS_TXT),
LOC_CTRL(IDS_IMAGE_SETTINGS_TXT),
LOC_CTRL(IDS_FORMAT_OPTIONS_TXT), LOC_CTRL(IDS_FORMAT_OPTIONS_TXT),
LOC_CTRL(IDS_ADVANCED_OPTIONS_TXT), LOC_CTRL(IDS_ADVANCED_OPTIONS_TXT),
LOC_CTRL(IDS_FORMAT_OPTIONS_TXT2),
LOC_CTRL(IDS_STATUS_TXT), LOC_CTRL(IDS_STATUS_TXT),
LOC_CTRL(MSG_000), LOC_CTRL(MSG_000),
LOC_CTRL(MSG_001), LOC_CTRL(MSG_001),
@ -459,6 +458,16 @@ const loc_control_id control_id[] = {
LOC_CTRL(MSG_298), LOC_CTRL(MSG_298),
LOC_CTRL(MSG_299), LOC_CTRL(MSG_299),
LOC_CTRL(MSG_300), LOC_CTRL(MSG_300),
LOC_CTRL(MSG_301),
LOC_CTRL(MSG_302),
LOC_CTRL(MSG_303),
LOC_CTRL(MSG_304),
LOC_CTRL(MSG_305),
LOC_CTRL(MSG_306),
LOC_CTRL(MSG_307),
LOC_CTRL(MSG_308),
LOC_CTRL(MSG_309),
LOC_CTRL(MSG_310),
LOC_CTRL(MSG_MAX), LOC_CTRL(MSG_MAX),
LOC_CTRL(IDOK), LOC_CTRL(IDOK),
LOC_CTRL(IDCANCEL), LOC_CTRL(IDCANCEL),

View file

@ -82,13 +82,12 @@
#define IDC_ABOUT 1007 #define IDC_ABOUT 1007
#define IDC_LABEL 1008 #define IDC_LABEL 1008
#define IDC_QUICKFORMAT 1009 #define IDC_QUICKFORMAT 1009
#define IDC_BOOT 1010
#define IDC_BADBLOCKS 1011 #define IDC_BADBLOCKS 1011
#define IDC_PROGRESS 1012 #define IDC_PROGRESS 1012
#define IDC_BOOTTYPE 1013 #define IDC_BOOTTYPE 1013
#define IDC_NBPASSES 1014 #define IDC_NBPASSES 1014
#define IDC_TEST 1015 #define IDC_TEST 1015
#define IDC_SELECT_ISO 1016 #define IDC_SELECT_IMAGE 1016
#define IDC_SET_ICON 1017 #define IDC_SET_ICON 1017
#define IDC_RUFUS_MBR 1018 #define IDC_RUFUS_MBR 1018
#define IDC_TARGET_SYSTEM 1019 #define IDC_TARGET_SYSTEM 1019
@ -101,7 +100,7 @@
#define IDC_HASH 1026 #define IDC_HASH 1026
#define IDC_SAVE 1027 #define IDC_SAVE 1027
#define IDC_SELECTED_IMAGE 1028 #define IDC_SELECTED_IMAGE 1028
#define IDC_BOOT_OPTION 1029 #define IDC_IMAGE_OPTION 1029
#define IDC_ABOUT_LICENSE 1030 #define IDC_ABOUT_LICENSE 1030
#define IDC_ABOUT_ICON 1031 #define IDC_ABOUT_ICON 1031
#define IDC_ABOUT_UPDATES 1032 #define IDC_ABOUT_UPDATES 1032
@ -186,14 +185,14 @@
#define IDS_CHECK_NOW_GRP 2012 #define IDS_CHECK_NOW_GRP 2012
#define IDS_TARGET_SYSTEM_TXT 2013 #define IDS_TARGET_SYSTEM_TXT 2013
#define IDS_SELETED_IMAGE_TXT 2014 #define IDS_SELETED_IMAGE_TXT 2014
#define IDS_BOOT_OPTION_TXT 2015 #define IDS_IMAGE_OPTION_TXT 2015
#define IDS_SELECTED_IMAGE_TXT 2016 #define IDS_SELECTED_IMAGE_TXT 2016
#define IDS_BOOT_TYPE_TXT 2017 #define IDS_BOOT_TYPE_TXT 2017
#define IDS_DEVICE_OPTIONS_TXT 2018 #define IDS_DEVICE_SETTINGS_TXT 2018
#define IDS_FORMAT_OPTIONS_TXT 2019 #define IDS_IMAGE_SETTINGS_TXT 2019
#define IDS_ADVANCED_OPTIONS_TXT 2020 #define IDS_FORMAT_OPTIONS_TXT 2020
#define IDS_FORMAT_OPTIONS_TXT2 2020 #define IDS_ADVANCED_OPTIONS_TXT 2021
#define IDS_STATUS_TXT 2021 #define IDS_STATUS_TXT 2022
#define MSG_000 3000 #define MSG_000 3000
#define MSG_001 3001 #define MSG_001 3001
#define MSG_002 3002 #define MSG_002 3002
@ -495,7 +494,17 @@
#define MSG_298 3298 #define MSG_298 3298
#define MSG_299 3299 #define MSG_299 3299
#define MSG_300 3300 #define MSG_300 3300
#define MSG_MAX 3301 #define MSG_301 3301
#define MSG_302 3302
#define MSG_303 3303
#define MSG_304 3304
#define MSG_305 3305
#define MSG_306 3306
#define MSG_307 3307
#define MSG_308 3308
#define MSG_309 3309
#define MSG_310 3310
#define MSG_MAX 3311
// Next default values for new objects // Next default values for new objects
// //

File diff suppressed because it is too large Load diff

View file

@ -218,14 +218,14 @@ enum fs_type {
enum boot_type { enum boot_type {
BT_MSDOS = 0, BT_MSDOS = 0,
BT_FREEDOS, BT_FREEDOS,
BT_ISO, BT_IMAGE,
BT_IMG,
BT_SYSLINUX_V4, // Start of indexes that only display in advanced mode BT_SYSLINUX_V4, // Start of indexes that only display in advanced mode
BT_SYSLINUX_V6, BT_SYSLINUX_V6,
BT_REACTOS, BT_REACTOS,
BT_GRUB4DOS, BT_GRUB4DOS,
BT_GRUB2, BT_GRUB2,
BT_UEFI_NTFS, BT_UEFI_NTFS,
BT_NON_BOOTABLE,
BT_MAX BT_MAX
}; };
@ -236,8 +236,6 @@ enum target_type {
}; };
// For the partition types we'll use Microsoft's PARTITION_STYLE_### constants // For the partition types we'll use Microsoft's PARTITION_STYLE_### constants
#define PARTITION_STYLE_SFD PARTITION_STYLE_RAW #define PARTITION_STYLE_SFD PARTITION_STYLE_RAW
#define GETTARGETTYPE(x) (((x)>0)?(((x) >> 16) & 0xFFFF):0)
#define GETPARTTYPE(x) (((x)>0)?((x) & 0xFFFF):0);
enum checksum_type { enum checksum_type {
CHECKSUM_MD5 = 0, CHECKSUM_MD5 = 0,
@ -385,7 +383,7 @@ enum WindowsVersion {
*/ */
extern HINSTANCE hMainInstance; extern HINSTANCE hMainInstance;
extern HWND hMainDialog, hLogDlg, hStatus, hDeviceList, hCapacity; extern HWND hMainDialog, hLogDlg, hStatus, hDeviceList, hCapacity;
extern HWND hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog; extern HWND hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
extern HWND hInfo, hProgress, hDiskID, hStatusToolbar; extern HWND hInfo, hProgress, hDiskID, hStatusToolbar;
extern float fScale; extern float fScale;
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], temp_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH]; extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], temp_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH];
@ -401,6 +399,7 @@ extern int64_t iso_blocking_status;
extern uint16_t rufus_version[3], embedded_sl_version[2]; extern uint16_t rufus_version[3], embedded_sl_version[2];
extern int nWindowsVersion; extern int nWindowsVersion;
extern int nWindowsBuildNumber; extern int nWindowsBuildNumber;
extern int fs, bt, pt, tt;
extern char WindowsVersionStr[128]; extern char WindowsVersionStr[128];
extern size_t ubuffer_pos; extern size_t ubuffer_pos;
extern char ubuffer[UBUFFER_SIZE]; extern char ubuffer[UBUFFER_SIZE];
@ -541,6 +540,7 @@ typedef struct {
} StrArray; } StrArray;
extern void StrArrayCreate(StrArray* arr, uint32_t initial_size); extern void StrArrayCreate(StrArray* arr, uint32_t initial_size);
extern int32_t StrArrayAdd(StrArray* arr, const char* str, BOOL ); extern int32_t StrArrayAdd(StrArray* arr, const char* str, BOOL );
extern int32_t StrArrayFind(StrArray* arr, const char* str);
extern void StrArrayClear(StrArray* arr); extern void StrArrayClear(StrArray* arr);
extern void StrArrayDestroy(StrArray* arr); extern void StrArrayDestroy(StrArray* arr);
#define IsStrArrayEmpty(arr) (arr.Index == 0) #define IsStrArrayEmpty(arr) (arr.Index == 0)

View file

@ -36,48 +36,49 @@ EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.0.1220" CAPTION "Rufus 3.0.1220"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,19,101,8 LTEXT "Device Settings ",IDS_DEVICE_SETTINGS_TXT,8,3,53,11,NOT WS_GROUP
LTEXT "Device",IDS_DEVICE_TXT,8,19,101,8
COMBOBOX IDC_DEVICE,8,30,200,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DEVICE,8,30,200,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Boot Type",IDS_BOOT_TYPE_TXT,9,45,35,8
COMBOBOX IDC_BOOTTYPE,8,55,175,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Boot Option",IDS_BOOT_OPTION_TXT,8,92,201,8
COMBOBOX IDC_BOOT_OPTION,7,102,175,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,9,116,108,8
COMBOBOX IDC_PARTITION_TYPE,8,129,109,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Target system type",IDS_TARGET_SYSTEM_TXT,130,116,71,10
COMBOBOX IDC_TARGET_SYSTEM,132,129,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "File system",IDS_FILESYSTEM_TXT,9,162,110,10
COMBOBOX IDC_FILESYSTEM,8,173,108,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Cluster size",IDS_CLUSTERSIZE_TXT,130,161,71,10
COMBOBOX IDC_CLUSTERSIZE,132,173,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "New volume label",IDS_LABEL_TXT,9,188,222,10
EDITTEXT IDC_LABEL,8,198,226,12,ES_AUTOHSCROLL
PUSHBUTTON "",IDC_ADVANCED,217,146,14,10,BS_ICON
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,218,112,10
COMBOBOX IDC_NBPASSES,124,216,16,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,276,121,10
PUSHBUTTON "SELECT",IDC_SELECT_ISO,191,51,44,14,BS_ICON
CONTROL "Create extended label and icon files",IDC_SET_ICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,231,216,10
CONTROL "List USB Hard Drives",IDC_ENABLE_FIXED_DISKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,263,216,10
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,290,216,10
CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,304,110,10
COMBOBOX IDC_DISK_ID,128,305,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,341,225,9
PUSHBUTTON "About...",IDC_ABOUT,8,359,50,14
PUSHBUTTON "Log",IDC_LOG,63,359,21,14
PUSHBUTTON "T",IDC_TEST,90,359,12,14,NOT WS_VISIBLE
DEFPUSHBUTTON "START",IDC_START,127,359,50,14
PUSHBUTTON "CLOSE",IDCANCEL,183,359,50,14
PUSHBUTTON "#",IDC_HASH,215,77,21,14,BS_ICON
PUSHBUTTON "...",IDC_SAVE,215,28,21,14,BS_ICON PUSHBUTTON "...",IDC_SAVE,215,28,21,14,BS_ICON
LTEXT "Selected Image",IDS_SELECTED_IMAGE_TXT,8,69,204,8 LTEXT "Boot Type",IDS_BOOT_TYPE_TXT,8,45,35,8
COMBOBOX IDC_SELECTED_IMAGE,7,79,199,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_BOOTTYPE,8,55,175,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Device Settings ",IDS_DEVICE_OPTIONS_TXT,9,3,53,11,NOT WS_GROUP LTEXT "Selected Image",IDS_SELECTED_IMAGE_TXT,8,110,204,8
LTEXT "Status ",IDS_STATUS_TXT,11,325,23,9,NOT WS_GROUP COMBOBOX IDC_SELECTED_IMAGE,8,119,199,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Format Options ",IDS_FORMAT_OPTIONS_TXT,9,147,57,9,NOT WS_GROUP PUSHBUTTON "#",IDC_HASH,215,118,21,14,BS_ICON
LTEXT "Advanced Options ",IDS_ADVANCED_OPTIONS_TXT,7,250,67,9,NOT WS_GROUP LTEXT "Image Option",IDS_IMAGE_OPTION_TXT,8,130,201,8
COMBOBOX IDC_IMAGE_OPTION,8,141,175,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,70,108,8
COMBOBOX IDC_PARTITION_TYPE,8,81,109,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Target system",IDS_TARGET_SYSTEM_TXT,130,70,71,10
COMBOBOX IDC_TARGET_SYSTEM,132,81,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Format Options ",IDS_FORMAT_OPTIONS_TXT,8,156,57,9,NOT WS_GROUP
LTEXT "File system",IDS_FILESYSTEM_TXT,8,194,110,10
COMBOBOX IDC_FILESYSTEM,8,208,108,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Cluster size",IDS_CLUSTERSIZE_TXT,130,193,71,10
COMBOBOX IDC_CLUSTERSIZE,132,208,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Volume label",IDS_LABEL_TXT,8,171,222,10
EDITTEXT IDC_LABEL,8,181,226,12,ES_AUTOHSCROLL
PUSHBUTTON "",IDC_ADVANCED,217,155,14,10,BS_ICON
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,227,112,10
COMBOBOX IDC_NBPASSES,124,225,16,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,285,121,10
PUSHBUTTON "SELECT",IDC_SELECT_IMAGE,191,51,44,14
CONTROL "Create extended label and icon files",IDC_SET_ICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,240,216,10
LTEXT "Advanced Options ",IDS_ADVANCED_OPTIONS_TXT,8,259,67,9,NOT WS_GROUP
CONTROL "List USB Hard Drives",IDC_ENABLE_FIXED_DISKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,272,216,10
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,299,216,10
CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,313,110,10
COMBOBOX IDC_DISK_ID,124,314,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Status ",IDS_STATUS_TXT,8,327,23,9,NOT WS_GROUP
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,342,225,9
PUSHBUTTON "About...",IDC_ABOUT,8,362,50,14
PUSHBUTTON "Log",IDC_LOG,63,362,21,14
PUSHBUTTON "T",IDC_TEST,90,362,12,14,NOT WS_VISIBLE
DEFPUSHBUTTON "START",IDC_START,127,362,50,14
PUSHBUTTON "CLOSE",IDCANCEL,183,362,50,14
LTEXT "Image Settings ",IDS_IMAGE_SETTINGS_TXT,8,96,57,9,NOT WS_GROUP
END END
IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237 IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237

View file

@ -312,7 +312,7 @@ static int UsbCypressAtaPassthrough(HANDLE hPhysical, ATA_PASSTHROUGH_CMD* Comma
} }
/* The various bridges we will try, in order */ /* The various bridges we will try, in order */
AtaPassThroughType pt[] = { AtaPassThroughType ata_pt[] = {
{ SatAtaPassthrough, "SAT" }, { SatAtaPassthrough, "SAT" },
{ UsbJmicronAtaPassthrough, "JMicron" }, { UsbJmicronAtaPassthrough, "JMicron" },
{ UsbProlificAtaPassthrough, "Prolific" }, { UsbProlificAtaPassthrough, "Prolific" },
@ -335,10 +335,10 @@ BOOL Identify(HANDLE hPhysical)
if (idd == NULL) if (idd == NULL)
return FALSE; return FALSE;
for (i=0; i<ARRAYSIZE(pt); i++) { for (i=0; i<ARRAYSIZE(ata_pt); i++) {
r = pt[i].fn(hPhysical, &Command, idd, sizeof(IDENTIFY_DEVICE_DATA), SPT_TIMEOUT_VALUE); r = ata_pt[i].fn(hPhysical, &Command, idd, sizeof(IDENTIFY_DEVICE_DATA), SPT_TIMEOUT_VALUE);
if (r == SPT_SUCCESS) { if (r == SPT_SUCCESS) {
uprintf("Success using %s\n", pt[i].type); uprintf("Success using %s\n", ata_pt[i].type);
if (idd->CommandSetSupport.SmartCommands) { if (idd->CommandSetSupport.SmartCommands) {
DumpBufferHex(idd, sizeof(IDENTIFY_DEVICE_DATA)); DumpBufferHex(idd, sizeof(IDENTIFY_DEVICE_DATA));
uprintf("SMART support detected!\n"); uprintf("SMART support detected!\n");
@ -347,9 +347,9 @@ BOOL Identify(HANDLE hPhysical)
} }
break; break;
} }
uprintf("No joy with: %s (%s)\n", pt[i].type, SptStrerr(r)); uprintf("No joy with: %s (%s)\n", ata_pt[i].type, SptStrerr(r));
} }
if (i >= ARRAYSIZE(pt)) if (i >= ARRAYSIZE(ata_pt))
uprintf("NO ATA FOR YOU!\n"); uprintf("NO ATA FOR YOU!\n");
_mm_free(idd); _mm_free(idd);

View file

@ -370,6 +370,18 @@ int32_t StrArrayAdd(StrArray* arr, const char* str, BOOL duplicate)
return arr->Index++; return arr->Index++;
} }
int32_t StrArrayFind(StrArray* arr, const char* str)
{
size_t i;
if ((str == NULL) || (arr == NULL) || (arr->String == NULL))
return -1;
for (i = 0; i<arr->Index; i++) {
if (strcmp(arr->String[i], str) == 0)
return i;
}
return -1;
}
void StrArrayClear(StrArray* arr) void StrArrayClear(StrArray* arr)
{ {
size_t i; size_t i;
@ -628,19 +640,23 @@ static BOOL CALLBACK EnumFontFamExProc(const LOGFONTA *lpelfe,
return TRUE; return TRUE;
} }
BOOL IsFontAvailable(const char* font_name) { BOOL IsFontAvailable(const char* font_name)
{
BOOL r;
LOGFONTA lf = { 0 }; LOGFONTA lf = { 0 };
HDC hDC = GetDC(hMainDialog); HDC hDC = GetDC(hMainDialog);
if (font_name == NULL) { if (font_name == NULL) {
ReleaseDC(hMainDialog, hDC); safe_release_dc(hMainDialog, hDC);
return FALSE; return FALSE;
} }
lf.lfCharSet = DEFAULT_CHARSET; lf.lfCharSet = DEFAULT_CHARSET;
safe_strcpy(lf.lfFaceName, LF_FACESIZE, font_name); safe_strcpy(lf.lfFaceName, LF_FACESIZE, font_name);
return EnumFontFamiliesExA(hDC, &lf, EnumFontFamExProc, 0, 0); r = EnumFontFamiliesExA(hDC, &lf, EnumFontFamExProc, 0, 0);
safe_release_dc(hMainDialog, hDC);
return r;
} }
/* /*

View file

@ -409,16 +409,15 @@ void CreateStatusBar(void)
height = rect.bottom; height = rect.bottom;
// Set the font we'll use to display the '#' sign in the toolbar button // Set the font we'll use to display the '#' sign in the toolbar button
hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), hDC = GetDC(hMainDialog);
hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(hDC, LOGPIXELSY), 72),
0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
0, 0, PROOF_QUALITY, 0, "Segoe UI"); 0, 0, PROOF_QUALITY, 0, "Segoe UI");
// Find the width of our hash sign // Find the width of our hash sign
hDC = GetDC(hMainDialog);
SelectObject(hDC, hFont); SelectObject(hDC, hFont);
GetTextExtentPoint32W(hDC, L"#", 1, &sz); GetTextExtentPoint32W(hDC, L"#", 1, &sz);
if (hDC != NULL) safe_release_dc(hMainDialog, hDC);
ReleaseDC(hMainDialog, hDC);
// Create 3 status areas // Create 3 status areas
GetClientRect(hMainDialog, &rect); GetClientRect(hMainDialog, &rect);
@ -879,8 +878,7 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
dh = rect.bottom - rect.top; dh = rect.bottom - rect.top;
DrawTextU(hDC, szMessageText, -1, &rect, DT_CALCRECT | DT_WORDBREAK); DrawTextU(hDC, szMessageText, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
dh = rect.bottom - rect.top - dh; dh = rect.bottom - rect.top - dh;
if (hDC != NULL) safe_release_dc(hCtrl, hDC);
ReleaseDC(hCtrl, hDC);
ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f); ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f);
for (i = 0; i < nDialogItems; i++) for (i = 0; i < nDialogItems; i++)
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), 0, dh, 0, 0, 1.0f); ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), 0, dh, 0, 0, 1.0f);
@ -1012,8 +1010,7 @@ INT_PTR CALLBACK ListCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
dh = rect.bottom - rect.top; dh = rect.bottom - rect.top;
DrawTextU(hDC, szMessageText, -1, &rect, DT_CALCRECT | DT_WORDBREAK); DrawTextU(hDC, szMessageText, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
dh = rect.bottom - rect.top - dh; dh = rect.bottom - rect.top - dh;
if (hDC != NULL) safe_release_dc(hCtrl, hDC);
ReleaseDC(hCtrl, hDC);
ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f); ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f);
for (i = 0; i < nDialogItems; i++) for (i = 0; i < nDialogItems; i++)
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_LIST_ITEM1 + i), 0, dh, 0, 0, 1.0f); ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_LIST_ITEM1 + i), 0, dh, 0, 0, 1.0f);
@ -1237,8 +1234,7 @@ LONG GetEntryWidth(HWND hDropDown, const char *entry)
if (hFont != NULL) if (hFont != NULL)
SelectObject(hDC, hDefFont); SelectObject(hDC, hDefFont);
if (hDC != NULL) safe_release_dc(hDropDown, hDC);
ReleaseDC(hDropDown, hDC);
return size.cx; return size.cx;
} }
@ -1669,8 +1665,7 @@ SIZE GetTextSize(HWND hCtrl)
GetTextExtentPoint32W(hDC, wstr, len, &sz); GetTextExtentPoint32W(hDC, wstr, len, &sz);
out: out:
safe_free(wstr); safe_free(wstr);
if (hDC != NULL) safe_release_dc(hCtrl, hDC);
ReleaseDC(hCtrl, hDC);
return sz; return sz;
} }

View file

@ -2,7 +2,7 @@
* *
* Copyright 2003 Lars Munch Christensen - All Rights Reserved * Copyright 2003 Lars Munch Christensen - All Rights Reserved
* Copyright 1998-2008 H. Peter Anvin - All Rights Reserved * Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
* Copyright 2012-2016 Pete Batard * Copyright 2012-2018 Pete Batard
* *
* Based on the Linux installer program for SYSLINUX by H. Peter Anvin * Based on the Linux installer program for SYSLINUX by H. Peter Anvin
* *
@ -106,16 +106,15 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
const char* mboot_c32 = "mboot.c32"; const char* mboot_c32 = "mboot.c32";
char path[MAX_PATH], tmp[64]; char path[MAX_PATH], tmp[64];
const char *errmsg; const char *errmsg;
struct libfat_filesystem *fs; struct libfat_filesystem *lf_fs;
libfat_sector_t s, *secp; libfat_sector_t s, *secp;
libfat_sector_t *sectors = NULL; libfat_sector_t *sectors = NULL;
int ldlinux_sectors; int ldlinux_sectors;
uint32_t ldlinux_cluster; uint32_t ldlinux_cluster;
int i, nsectors, sl_fs_stype; int i, nsectors, sl_fs_stype;
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_IMAGE) && (SL_MAJOR(img_report.sl_version) >= 5));
BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_ISO) && (SL_MAJOR(img_report.sl_version) >= 5));
PrintInfoDebug(0, MSG_234, (bt == BT_ISO)?img_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]); PrintInfoDebug(0, MSG_234, (bt == BT_IMAGE)?img_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]);
/* 4K sector size workaround */ /* 4K sector size workaround */
SECTOR_SHIFT = 0; SECTOR_SHIFT = 0;
@ -219,7 +218,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
} }
uprintf("Successfully wrote '%s'", &path[3]); uprintf("Successfully wrote '%s'", &path[3]);
if (bt != BT_ISO) if (bt != BT_IMAGE)
UpdateProgress(OP_DOS, -1.0f); UpdateProgress(OP_DOS, -1.0f);
/* Now flush the media */ /* Now flush the media */
@ -266,21 +265,21 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
case FS_FAT16: case FS_FAT16:
case FS_FAT32: case FS_FAT32:
case FS_EXFAT: case FS_EXFAT:
fs = libfat_open(libfat_readfile, (intptr_t) d_handle); lf_fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
if (fs == NULL) { if (lf_fs == NULL) {
uprintf("Syslinux FAT access error"); uprintf("Syslinux FAT access error");
goto out; goto out;
} }
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL); ldlinux_cluster = libfat_searchdir(lf_fs, 0, "LDLINUX SYS", NULL);
secp = sectors; secp = sectors;
nsectors = 0; nsectors = 0;
s = libfat_clustertosector(fs, ldlinux_cluster); s = libfat_clustertosector(lf_fs, ldlinux_cluster);
while (s && nsectors < ldlinux_sectors) { while (s && nsectors < ldlinux_sectors) {
*secp++ = s; *secp++ = s;
nsectors++; nsectors++;
s = libfat_nextsector(fs, s); s = libfat_nextsector(lf_fs, s);
} }
libfat_close(fs); libfat_close(lf_fs);
break; break;
default: default:
uprintf("Unsupported Syslinux filesystem"); uprintf("Unsupported Syslinux filesystem");
@ -380,7 +379,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
fclose(fd); fclose(fd);
} }
if (bt != BT_ISO) if (bt != BT_IMAGE)
UpdateProgress(OP_DOS, -1.0f); UpdateProgress(OP_DOS, -1.0f);
r = TRUE; r = TRUE;