[ui] UI redesign

* Better guide the user through the flow of operations
* Also follow a concept design by Fahad Al-Riyami
* Closes #117
This commit is contained in:
Pete Batard 2018-03-22 23:14:20 +00:00
parent 95db209b04
commit a44518355f
31 changed files with 3114 additions and 3572 deletions

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 };
DWORD read_size[2];
unsigned char ALIGNED(64) buffer[2][BUFFER_SIZE];
extern BOOL progress_in_use;
/*
* Rotate 32 bit integers by n bytes.
@ -818,6 +819,7 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
dw = rect.right - rect.left - dw + 12;
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_MD5), 0, 0, dw, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SHA1), 0, 0, dw, 0, 1.0f);
ResizeButtonHeight(hDlg, IDOK);
safe_release_dc(GetDlgItem(hDlg, IDC_MD5), hDC);
@ -834,8 +836,6 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
case IDCANCEL:
reset_localization(IDD_CHECKSUM);
EndDialog(hDlg, LOWORD(wParam));
// Reset focus to our toolbar
PostMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hStatusToolbar, TRUE);
return (INT_PTR)TRUE;
}
}
@ -927,6 +927,7 @@ DWORD WINAPI SumThread(void* param)
bufnum = 0;
_bufnum = 0;
read_size[0] = 1; // Don't trigger the first loop break
progress_in_use = TRUE;
for (rb = 0; ;rb += read_size[_bufnum]) {
// Update the progress and check for cancel
if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
@ -982,6 +983,7 @@ DWORD WINAPI SumThread(void* param)
r = 0;
out:
progress_in_use = FALSE;
for (i = 0; i < CHECKSUM_MAX; i++) {
if (sum_thread[i] != NULL)
TerminateThread(sum_thread[i], 1);

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* 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
* it under the terms of the GNU General Public License as published by
@ -84,8 +84,8 @@ static BOOL GetUSBProperties(char* parent_path, char* device_id, usb_device_prop
uprintf("Could not open hub %s: %s", parent_path, WindowsErrorString());
goto out;
}
memset(&conn_info, 0, sizeof(conn_info));
size = sizeof(conn_info);
memset(&conn_info, 0, size);
conn_info.ConnectionIndex = (ULONG)props->port;
// coverity[tainted_data_argument]
if (!DeviceIoControl(handle, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, &conn_info, size, &conn_info, size, &size, NULL)) {
@ -105,8 +105,8 @@ static BOOL GetUSBProperties(char* parent_path, char* device_id, usb_device_prop
// In their great wisdom, Microsoft decided to BREAK the USB speed report between Windows 7 and Windows 8
if (nWindowsVersion >= WINDOWS_8) {
memset(&conn_info_v2, 0, sizeof(conn_info_v2));
size = sizeof(conn_info_v2);
memset(&conn_info_v2, 0, size);
conn_info_v2.ConnectionIndex = (ULONG)props->port;
conn_info_v2.Length = size;
conn_info_v2.SupportedUsbProtocols.Usb300 = 1;
@ -152,8 +152,8 @@ BOOL ResetDevice(int index)
goto out;
}
memset(&cycle_port, 0, sizeof(cycle_port));
size = sizeof(cycle_port);
memset(&cycle_port, 0, size);
cycle_port.ConnectionIndex = DrivePort[index];
uprintf("Cycling port %d (reset) on %s", DrivePort[index], DriveHub.String[index]);
// As per https://msdn.microsoft.com/en-us/library/windows/hardware/ff537340.aspx
@ -845,7 +845,7 @@ BOOL GetDevices(DWORD devnum)
i = 0;
IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, i));
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0);
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILE_SYSTEM,
ComboBox_GetCurSel(hFileSystem));
r = TRUE;

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* 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
* it under the terms of the GNU General Public License as published by
@ -57,6 +57,7 @@ const GUID PARTITION_SYSTEM_GUID =
* Globals
*/
RUFUS_DRIVE_INFO SelectedDrive;
const char* sfd_name = "Super Floppy Disk";
/*
* The following methods get or set the AutoMount setting (which is different from AutoRun)
@ -765,7 +766,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
// Detect drives that are using the whole disk as a single partition
if ((DriveLayout->PartitionEntry[0].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) &&
(DriveLayout->PartitionEntry[0].StartingOffset.QuadPart == 0LL)) {
suprintf("Partition type: SFD (Super Floppy Disk) or Unpartitioned");
suprintf("Partition type: SFD (%s) or Unpartitioned", sfd_name);
super_floppy_disk = TRUE;
} else {
suprintf("Partition type: MBR, NB Partitions: %d", SelectedDrive.nPartitions);
@ -1098,7 +1099,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
}
// Compute the start offset of our first partition
if ((partition_style == PARTITION_STYLE_GPT) || (!IsChecked(IDC_EXTRA_PARTITION))) {
if ((partition_style == PARTITION_STYLE_GPT) || (!IsChecked(IDC_OLD_BIOS_FIXES))) {
// Go with the MS 1 MB wastage at the beginning...
DriveLayoutEx.PartitionEntry[pn].StartingOffset.QuadPart = MB;
} else {
@ -1164,7 +1165,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;
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) {
case FS_FAT16:
DriveLayoutEx.PartitionEntry[pn].Mbr.PartitionType = 0x0e; // FAT16 LBA

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility
* Formatting function calls
* 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
* it under the terms of the GNU General Public License as published by
@ -61,7 +61,7 @@ static int task_number = 0;
extern const int nb_steps[FS_MAX];
extern uint32_t dur_mins, dur_secs;
static int fs_index = 0, wintogo_index = -1;
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, disable_file_indexing;
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, disable_file_indexing, write_as_image;
uint8_t *grub2_buf = NULL;
long grub2_len;
static BOOL WritePBR(HANDLE hLogicalDrive);
@ -683,7 +683,6 @@ static BOOL FormatDrive(DWORD DriveIndex)
WCHAR wLabel[64];
ULONG ulClusterSize;
size_t i;
int fs;
GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType));
// Might have a (Default) suffix => remove it
@ -693,7 +692,6 @@ static BOOL FormatDrive(DWORD DriveIndex)
break;
}
}
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) {
PrintInfoDebug(0, MSG_220, FSType, dur_mins, dur_secs);
} else {
@ -751,9 +749,9 @@ static BOOL FormatDrive(DWORD DriveIndex)
task_number = 0;
fs_index = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
uprintf("%s format was selected\n", IsChecked(IDC_QUICKFORMAT)?"Quick":"Slow");
uprintf("%s format was selected\n", IsChecked(IDC_QUICK_FORMAT)?"Quick":"Slow");
pfFormatEx(wVolumeName, SelectedDrive.MediaType, wFSType, wLabel,
IsChecked(IDC_QUICKFORMAT), ulClusterSize, FormatExCallback);
IsChecked(IDC_QUICK_FORMAT), ulClusterSize, FormatExCallback);
if ((fs == FS_NTFS) && (enable_ntfs_compression) && (pfEnableVolumeCompression != NULL)) {
wVolumeName[wcslen(wVolumeName)] = '\\'; // Add trailing backslash back again
@ -864,9 +862,6 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
FAKE_FD fake_fd = { 0 };
FILE* fp = (FILE*)&fake_fd;
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");
@ -906,7 +901,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
buffer[0x1c2] = 0x0c;
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
buffer[0x1be] = IsChecked(IDC_RUFUS_MBR) ?
(BYTE)ComboBox_GetItemData(hDiskID, ComboBox_GetCurSel(hDiskID)):0x80;
@ -936,21 +931,21 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
// Syslinux
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");
r = write_syslinux_mbr(fp);
goto notify;
}
// 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");
r = write_grub2_mbr(fp);
goto notify;
}
// 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");
r = write_grub4dos_mbr(fp);
goto notify;
@ -964,7 +959,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
}
// 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");
r = write_kolibrios_mbr(fp);
goto notify;
@ -997,7 +992,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
{
// TODO: Do we need anything special for 4K sectors?
DWORD size, max_size, mbr_size = 0x200;
int r, bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
int r;
unsigned char* buf = NULL;
FAKE_FD fake_fd = { 0 };
FILE* fp = (FILE*)&fake_fd;
@ -1005,11 +1000,11 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
fake_fd._handle = (char*)hPhysicalDrive;
set_bytes_per_sector(SelectedDrive.SectorSize);
// Ensure that we have sufficient space for the SBR
max_size = IsChecked(IDC_EXTRA_PARTITION) ?
max_size = IsChecked(IDC_OLD_BIOS_FIXES) ?
(DWORD)(SelectedDrive.SectorsPerTrack * SelectedDrive.SectorSize) : 1*MB;
max_size -= mbr_size;
// 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)
bt = BT_GRUB4DOS;
if (img_report.has_grub2)
@ -1059,12 +1054,12 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
/*
* Process the Partition Boot Record
*/
static __inline const char* bt_to_name(int bt) {
static __inline const char* bt_to_name(void) {
switch (bt) {
case BT_FREEDOS: return "FreeDOS";
case BT_REACTOS: return "ReactOS";
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)
@ -1072,7 +1067,6 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
int i;
FAKE_FD fake_fd = { 0 };
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";
fake_fd._handle = (char*)hLogicalVolume;
@ -1080,7 +1074,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) {
case FS_FAT16:
uprintf(using_msg, bt_to_name(bt), "FAT16");
uprintf(using_msg, bt_to_name(), "FAT16");
if (!is_fat_16_fs(fp)) {
uprintf("New volume does not have a FAT16 boot sector - aborting\n");
break;
@ -1090,7 +1084,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
if (!write_fat_16_fd_br(fp, 0)) break;
} else if (bt == BT_REACTOS) {
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;
} else {
if (!write_fat_16_br(fp, 0)) break;
@ -1100,7 +1094,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
break;
return TRUE;
case FS_FAT32:
uprintf(using_msg, bt_to_name(bt), "FAT32");
uprintf(using_msg, bt_to_name(), "FAT32");
for (i=0; i<2; i++) {
if (!is_fat_32_fs(fp)) {
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;
} else if (bt == BT_REACTOS) {
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;
} 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;
} 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;
} else {
if (!write_fat_32_br(fp, 0)) break;
@ -1128,7 +1122,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
}
return TRUE;
case FS_NTFS:
uprintf(using_msg, bt_to_name(bt), "NTFS");
uprintf(using_msg, bt_to_name(), "NTFS");
if (!is_ntfs_fs(fp)) {
uprintf("New volume does not have an NTFS boot sector - aborting\n");
break;
@ -1644,7 +1638,7 @@ out:
*/
DWORD WINAPI FormatThread(void* param)
{
int i, r, pt, tt, fs, bt;
int i, r;
BOOL ret, use_large_fat32, windows_to_go;
DWORD DriveIndex = (DWORD)(uintptr_t)param;
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
@ -1661,12 +1655,9 @@ DWORD WINAPI FormatThread(void* param)
char kolibri_dst[] = "?:\\MTLD_F32";
char grub4dos_dst[] = "?:\\grldr";
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));
windows_to_go = (togo_mode) && HAS_WINTOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED);
windows_to_go = display_togo_option && (bt == BT_IMAGE) && HAS_WINTOGO(img_report) &&
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1);
large_drive = (SelectedDrive.DiskSize > (1*TB));
if (large_drive)
uprintf("Notice: Large drive detected (may produce short writes)");
@ -1676,9 +1667,9 @@ DWORD WINAPI FormatThread(void* param)
// http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr
extra_partitions = XP_MSR | XP_EFI;
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;
else if (IsChecked(IDC_EXTRA_PARTITION))
else if (IsChecked(IDC_OLD_BIOS_FIXES))
extra_partitions = XP_COMPAT;
PrintInfoDebug(0, MSG_225);
@ -1707,7 +1698,7 @@ DWORD WINAPI FormatThread(void* param)
// Do it in reverse so that we always end on the first volume letter
for (i=(int)safe_strlen(drive_letters); i>0; i--) {
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 ((PathGetDriveNumberU(image_path) + 'A') == drive_letters[i-1]) {
uprintf("ABORTED: Cannot use an image that is located on the target drive!\n");
@ -1755,7 +1746,7 @@ DWORD WINAPI FormatThread(void* param)
// 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
// 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)) ||
(!InitializeDisk(hPhysicalDrive))) {
uprintf("Could not reset partitions\n");
@ -1764,7 +1755,7 @@ DWORD WINAPI FormatThread(void* param)
}
}
if (IsChecked(IDC_BADBLOCKS)) {
if (IsChecked(IDC_BAD_BLOCKS)) {
do {
// create a log file for bad blocks report. Since %USERPROFILE% may
// have localized characters, we use the UTF-8 API.
@ -1830,7 +1821,7 @@ DWORD WINAPI FormatThread(void* param)
}
// 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,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hSourceImage == INVALID_HANDLE_VALUE) {
@ -1935,18 +1926,18 @@ DWORD WINAPI FormatThread(void* param)
uprintf("Warning: Failed to refresh label: %s", WindowsErrorString());
}
if (IsChecked(IDC_BOOT)) {
if (bt != BT_NON_BOOTABLE) {
if (bt == BT_UEFI_NTFS) {
// All good
} else if (tt == TT_UEFI) {
// 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__);
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
goto out;
}
} 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)) ) {
if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
@ -1973,7 +1964,7 @@ DWORD WINAPI FormatThread(void* param)
safe_unlockclose(hLogicalVolume);
}
} else {
if (IsChecked(IDC_SET_ICON))
if (IsChecked(IDC_EXTENDED_LABEL))
SetAutorun(drive_name);
}
CHECK_FOR_USER_CANCEL;
@ -1985,7 +1976,7 @@ DWORD WINAPI FormatThread(void* param)
goto out;
CHECK_FOR_USER_CANCEL;
if (IsChecked(IDC_BOOT)) {
if (bt != BT_NON_BOOTABLE) {
if ((bt == BT_MSDOS) || (bt == BT_FREEDOS)) {
UpdateProgress(OP_DOS, -1.0f);
PrintInfoDebug(0, MSG_230);
@ -2001,7 +1992,7 @@ DWORD WINAPI FormatThread(void* param)
IsFileInDB(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr")?"":"");
if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE))
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);
drive_name[2] = 0; // Ensure our drive is something like 'D:'
if (windows_to_go) {
@ -2052,12 +2043,12 @@ DWORD WINAPI FormatThread(void* param)
}
UpdateProgress(OP_FINALIZE, -1.0f);
PrintInfoDebug(0, MSG_233);
if (IsChecked(IDC_SET_ICON))
if (IsChecked(IDC_EXTENDED_LABEL))
SetAutorun(drive_name);
// Issue another complete remount before we exit, to ensure we're clean
RemountVolume(drive_name);
// 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
if (PRIMARYLANGID(GetThreadUILanguage()) != LANG_ENGLISH) {
SetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility
* Formatting function calls
* 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
* 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
* 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:
* Copyright © 2003-2014 Rocky Bernstein <rocky@gnu.org>
*
@ -1170,7 +1170,7 @@ BOOL ExtractEfiImgFiles(const char* dir)
iso9660_readfat_private* p_private = NULL;
libfat_sector_t s;
int32_t dc, c;
struct libfat_filesystem *fs = NULL;
struct libfat_filesystem *lf_fs = NULL;
struct libfat_direntry direntry;
char name[12] = { 0 };
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);
goto out;
}
fs = libfat_open(iso9660_readfat, (intptr_t)p_private);
if (fs == NULL) {
lf_fs = libfat_open(iso9660_readfat, (intptr_t)p_private);
if (lf_fs == NULL) {
uprintf("FAT access error");
goto out;
}
// Navigate to /EFI/BOOT
if (libfat_searchdir(fs, 0, "EFI ", &direntry) < 0)
if (libfat_searchdir(lf_fs, 0, "EFI ", &direntry) < 0)
goto out;
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;
dc = direntry.entry[26] + (direntry.entry[27] << 8);
@ -1228,7 +1228,7 @@ BOOL ExtractEfiImgFiles(const char* dir)
} else
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 (dir == NULL) {
if (!ret)
@ -1265,9 +1265,9 @@ BOOL ExtractEfiImgFiles(const char* dir)
}
written = 0;
s = libfat_clustertosector(fs, c);
s = libfat_clustertosector(lf_fs, c);
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);
if (!WriteFileWithRetry(handle, buf, size, &size, WRITE_RETRIES) ||
(size != MIN(LIBFAT_SECTOR_SIZE, file_size - written))) {
@ -1276,7 +1276,7 @@ BOOL ExtractEfiImgFiles(const char* dir)
continue;
}
written += size;
s = libfat_nextsector(fs, s);
s = libfat_nextsector(lf_fs, s);
}
CloseHandle(handle);
ret = TRUE;
@ -1285,8 +1285,8 @@ BOOL ExtractEfiImgFiles(const char* dir)
}
out:
if (fs != NULL)
libfat_close(fs);
if (lf_fs != NULL)
libfat_close(lf_fs);
if (p_statbuf != NULL)
safe_free(p_statbuf->rr.psz_symlink);
safe_free(p_statbuf);

View file

@ -34,6 +34,9 @@ RUFUS_URL "\\line\n"
const char* additional_copyrights =
"{\\rtf1\\ansi\n"
"UI redesign concept by Fahad Al-Riyami\\line\n"
"Used with kind authorization\\line\n"
"\\line\n"
"Icon by PC Unleashed:\\line\n"
"http://pcunleashed.com\\line\n"
"Freeware\\line\n"

View file

@ -44,7 +44,7 @@
* u: 32 bit unsigned CSV list
* Remember to update the size of the array in localization.h when adding/removing elements
*/
const loc_parse parse_cmd[9] = {
const loc_parse parse_cmd[7] = {
// Translation name and Windows LCIDs it should apply to
{ 'l', LC_LOCALE, "ssu" }, // l "en_US" "English (US)" 0x0009,0x1009
// Base translation to add on top of (eg. "English (UK)" can be used to build on top of "English (US)"
@ -55,10 +55,6 @@ const loc_parse parse_cmd[9] = {
{ 't', LC_TEXT, "cs" }, // t IDC_CONTROL "Translation"
// Set the section/dialog to which the next commands should apply
{ 'g', LC_GROUP, "c" }, // g IDD_DIALOG
// Resize a dialog (dx dy pixel increment)
{ 's', LC_SIZE, "cii" }, // s IDC_CONTROL +10 +10
// Move a dialog (dx dy pixed displacement)
{ 'm', LC_MOVE, "cii" }, // m IDC_CONTROL -5 0
// Set the font to use for the text controls that follow
// Use f "Default" 0 to reset the font
{ 'f', LC_FONT, "si" }, // f "MS Dialog" 10
@ -80,6 +76,8 @@ char* default_msg_table[MSG_MAX-MSG_000] = {"%s", 0};
char* current_msg_table[MSG_MAX-MSG_000] = {"%s", 0};
char** msg_table = NULL;
extern BOOL progress_in_use;
static void mtab_destroy(BOOL reinit)
{
size_t j;
@ -259,8 +257,6 @@ BOOL dispatch_loc_cmd(loc_cmd* lcmd)
switch(lcmd->command) {
// NB: For commands that take an ID, ctrl_id is always a valid index at this stage
case LC_TEXT:
case LC_MOVE:
case LC_SIZE:
add_dialog_command(dlg_index, lcmd);
break;
case LC_GROUP:
@ -344,16 +340,6 @@ void apply_localization(int dlg_id, HWND hDlg)
SetWindowTextU(hCtrl, lcmd->txt[1]);
}
break;
case LC_MOVE:
if (hCtrl != NULL) {
ResizeMoveCtrl(hDlg, hCtrl, lcmd->num[0], lcmd->num[1], 0, 0, fScale);
}
break;
case LC_SIZE:
if (hCtrl != NULL) {
ResizeMoveCtrl(hDlg, hCtrl, 0, 0, lcmd->num[0], lcmd->num[1], fScale);
}
break;
}
}
}
@ -388,7 +374,7 @@ char* lmprintf(uint32_t msg_id, ...)
buf[buf_id][0] = 0;
msg_id &= MSG_MASK;
if ((msg_id > MSG_000) && (msg_id < MSG_MAX)) {
if ((msg_id >= MSG_000) && (msg_id < MSG_MAX)) {
format = msg_table[msg_id - MSG_000];
}
@ -426,9 +412,17 @@ static char *output_msg[2];
static uint64_t last_msg_time[2] = { 0, 0 };
static void PrintInfoMessage(char* msg) {
SetWindowTextU(hInfo, msg);
SetWindowTextU(hProgress, msg);
// Make sure our field gets redrawn
SendMessage(hInfo, WM_PAINT, 0, 0);
// 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);
}
static void PrintStatusMessage(char* msg) {
SendMessageLU(hStatus, SB_SETTEXTW, SBT_OWNERDRAW | SB_SECTION_LEFT, msg);
@ -446,6 +440,7 @@ static void CALLBACK OutputMessageTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent
KillTimer(hMainDialog, idEvent);
bOutputTimerArmed[i] = FALSE;
PrintMessage[i](output_msg[i]);
last_msg_time[i] = GetTickCount64();
}
@ -507,7 +502,8 @@ void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, .
if (!info)
szStatusMessage = szMessage[MSG_STATUS][(duration > 0)?MSG_LOW_PRI:MSG_HIGH_PRI];
format = msg_table[msg_id - MSG_000];
if ((msg_id >= MSG_000) && (msg_id < MSG_MAX))
format = msg_table[msg_id - MSG_000];
if (format == NULL) {
safe_sprintf(msg_hi, MSG_LEN, "MSG_%03d UNTRANSLATED", msg_id - MSG_000);
uprintf(msg_hi);
@ -530,7 +526,8 @@ void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, .
// Because we want the log messages in English, we go through the VA business once more, but this time with default_msg_table
if (debug) {
format = default_msg_table[msg_id - MSG_000];
if ((msg_id >= MSG_000) && (msg_id < MSG_MAX))
format = default_msg_table[msg_id - MSG_000];
if (format == NULL) {
safe_sprintf(buf, sizeof(szStatusMessage), "(default) MSG_%03d UNTRANSLATED", msg_id - MSG_000);
return;

View file

@ -113,8 +113,6 @@ static __inline void list_del(struct list_head *entry)
// The last command with a control ID *MUST* be LC_TEXT
enum loc_command_type {
LC_GROUP,
LC_MOVE,
LC_SIZE,
LC_TEXT, // Delimits commands that take a Control ID and commands that don't
LC_VERSION,
LC_LOCALE,
@ -151,7 +149,7 @@ typedef struct loc_dlg_list_struct {
struct list_head list;
} loc_dlg_list;
extern const loc_parse parse_cmd[9];
extern const loc_parse parse_cmd[7];
extern struct list_head locale_list;
extern char *default_msg_table[], *current_msg_table[], **msg_table;
int loc_line_nr;

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Localization tables - autogenerated from resource.h
* Copyright © 2013-2016 Pete Batard <pete@akeo.ie>
* Copyright © 2013-2018 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,44 +36,47 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDD_UPDATE_POLICY),
LOC_CTRL(IDD_NEW_VERSION),
LOC_CTRL(IDD_CHECKSUM),
LOC_CTRL(IDD_LIST),
LOC_CTRL(IDC_DEVICE),
LOC_CTRL(IDC_FILESYSTEM),
LOC_CTRL(IDC_FILE_SYSTEM),
LOC_CTRL(IDC_START),
LOC_CTRL(IDC_PARTITION_TYPE),
LOC_CTRL(IDC_CLUSTERSIZE),
LOC_CTRL(IDC_CLUSTER_SIZE),
LOC_CTRL(IDC_STATUS),
LOC_CTRL(IDC_ABOUT),
LOC_CTRL(IDC_LABEL),
LOC_CTRL(IDC_QUICKFORMAT),
LOC_CTRL(IDC_BOOT),
LOC_CTRL(IDC_BADBLOCKS),
LOC_CTRL(IDC_QUICK_FORMAT),
LOC_CTRL(IDC_BAD_BLOCKS),
LOC_CTRL(IDC_PROGRESS),
LOC_CTRL(IDC_BOOTTYPE),
LOC_CTRL(IDC_NBPASSES),
LOC_CTRL(IDC_BOOT_SELECTION),
LOC_CTRL(IDC_NB_PASSES),
LOC_CTRL(IDC_TEST),
LOC_CTRL(IDC_SELECT_ISO),
LOC_CTRL(IDC_SET_ICON),
LOC_CTRL(IDC_SELECT),
LOC_CTRL(IDC_EXTENDED_LABEL),
LOC_CTRL(IDC_RUFUS_MBR),
LOC_CTRL(IDC_INFO),
LOC_CTRL(IDC_TARGET_SYSTEM),
LOC_CTRL(IDC_DISK_ID),
LOC_CTRL(IDC_EXTRA_PARTITION),
LOC_CTRL(IDC_ENABLE_FIXED_DISKS),
LOC_CTRL(IDC_OLD_BIOS_FIXES),
LOC_CTRL(IDC_LIST_USB_HDD),
LOC_CTRL(IDC_STATUS_TOOLBAR),
LOC_CTRL(IDC_HASH),
LOC_CTRL(IDC_SAVE),
LOC_CTRL(IDC_IMAGE_OPTION),
LOC_CTRL(IDC_ABOUT_LICENSE),
LOC_CTRL(IDC_ABOUT_ICON),
LOC_CTRL(IDC_ABOUT_UPDATES),
LOC_CTRL(IDC_ABOUT_COPYRIGHTS),
LOC_CTRL(IDC_ABOUT_BLURB),
LOC_CTRL(IDC_LICENSE_TEXT),
LOC_CTRL(IDC_NOTIFICATION_ICON),
LOC_CTRL(IDC_NOTIFICATION_TEXT),
LOC_CTRL(IDC_NOTIFICATION_LINE),
LOC_CTRL(IDC_ADVANCED),
LOC_CTRL(IDS_ADVANCED_OPTIONS_GRP),
LOC_CTRL(IDC_ADVANCED_DEVICE_TOOLBAR),
LOC_CTRL(IDC_ADVANCED_FORMAT_TOOLBAR),
LOC_CTRL(IDC_CHECKSUM_TOOLBAR),
LOC_CTRL(IDC_MULTI_TOOLBAR),
LOC_CTRL(IDC_LANG),
LOC_CTRL(IDC_ABOUT),
LOC_CTRL(IDC_SETTINGS),
LOC_CTRL(IDC_LOG),
LOC_CTRL(IDC_WINDOWS_INSTALL),
LOC_CTRL(IDC_WINDOWS_TO_GO),
LOC_CTRL(IDC_LOG_EDIT),
LOC_CTRL(IDC_LOG_SAVE),
LOC_CTRL(IDC_LOG_CLEAR),
@ -110,12 +113,33 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDC_SELECTION_CHOICE14),
LOC_CTRL(IDC_SELECTION_CHOICE15),
LOC_CTRL(IDC_SELECTION_CHOICEMAX),
LOC_CTRL(IDC_LIST_ICON),
LOC_CTRL(IDC_LIST_TEXT),
LOC_CTRL(IDC_LIST_LINE),
LOC_CTRL(IDC_LIST_ITEM1),
LOC_CTRL(IDC_LIST_ITEM2),
LOC_CTRL(IDC_LIST_ITEM3),
LOC_CTRL(IDC_LIST_ITEM4),
LOC_CTRL(IDC_LIST_ITEM5),
LOC_CTRL(IDC_LIST_ITEM6),
LOC_CTRL(IDC_LIST_ITEM7),
LOC_CTRL(IDC_LIST_ITEM8),
LOC_CTRL(IDC_LIST_ITEM9),
LOC_CTRL(IDC_LIST_ITEM10),
LOC_CTRL(IDC_LIST_ITEM11),
LOC_CTRL(IDC_LIST_ITEM12),
LOC_CTRL(IDC_LIST_ITEM13),
LOC_CTRL(IDC_LIST_ITEM14),
LOC_CTRL(IDC_LIST_ITEM15),
LOC_CTRL(IDC_LIST_ITEMMAX),
LOC_CTRL(IDC_ADVANCED_DRIVE_PROPERTIES),
LOC_CTRL(IDC_ADVANCED_FORMAT_OPTIONS),
LOC_CTRL(IDS_DEVICE_TXT),
LOC_CTRL(IDS_PARTITION_TYPE_TXT),
LOC_CTRL(IDS_FILESYSTEM_TXT),
LOC_CTRL(IDS_CLUSTERSIZE_TXT),
LOC_CTRL(IDS_FILE_SYSTEM_TXT),
LOC_CTRL(IDS_CLUSTER_SIZE_TXT),
LOC_CTRL(IDS_LABEL_TXT),
LOC_CTRL(IDS_FORMAT_OPTIONS_GRP),
LOC_CTRL(IDS_CSM_HELP_TXT),
LOC_CTRL(IDS_UPDATE_SETTINGS_GRP),
LOC_CTRL(IDS_UPDATE_FREQUENCY_TXT),
LOC_CTRL(IDS_INCLUDE_BETAS_TXT),
@ -123,6 +147,12 @@ const loc_control_id control_id[] = {
LOC_CTRL(IDS_NEW_VERSION_DOWNLOAD_GRP),
LOC_CTRL(IDS_NEW_VERSION_NOTES_GRP),
LOC_CTRL(IDS_CHECK_NOW_GRP),
LOC_CTRL(IDS_TARGET_SYSTEM_TXT),
LOC_CTRL(IDS_IMAGE_OPTION_TXT),
LOC_CTRL(IDS_BOOT_SELECTION_TXT),
LOC_CTRL(IDS_DRIVE_PROPERTIES_TXT),
LOC_CTRL(IDS_FORMAT_OPTIONS_TXT),
LOC_CTRL(IDS_STATUS_TXT),
LOC_CTRL(MSG_000),
LOC_CTRL(MSG_001),
LOC_CTRL(MSG_002),
@ -423,6 +453,27 @@ const loc_control_id control_id[] = {
LOC_CTRL(MSG_297),
LOC_CTRL(MSG_298),
LOC_CTRL(MSG_299),
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_311),
LOC_CTRL(MSG_312),
LOC_CTRL(MSG_313),
LOC_CTRL(MSG_314),
LOC_CTRL(MSG_315),
LOC_CTRL(MSG_316),
LOC_CTRL(MSG_317),
LOC_CTRL(MSG_318),
LOC_CTRL(MSG_319),
LOC_CTRL(MSG_320),
LOC_CTRL(MSG_MAX),
LOC_CTRL(IDOK),
LOC_CTRL(IDCANCEL),
@ -446,4 +497,5 @@ loc_dlg_list loc_dlg[] = {
LOC_DLG(IDD_UPDATE_POLICY),
LOC_DLG(IDD_NEW_VERSION),
LOC_DLG(IDD_CHECKSUM),
LOC_DLG(IDD_LIST),
};

View file

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

View file

@ -437,6 +437,19 @@ static __inline int ComboBox_GetLBTextU(HWND hCtrl, int index, char* lpString)
return size;
}
static __inline DWORD CharUpperBuffU(char* lpString, DWORD len)
{
DWORD ret;
wchar_t *wlpString = calloc(len, sizeof(wchar_t));
if (wlpString == NULL)
return 0;
utf8_to_wchar_no_alloc(lpString, wlpString, len);
ret = CharUpperBuffW(wlpString, len);
wchar_to_utf8_no_alloc(wlpString, lpString, len);
free(wlpString);
return ret;
}
static __inline HANDLE CreateFileU(const char* lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)

View file

@ -74,46 +74,48 @@
#define IDR_TOGO_SAN_POLICY_XML 503
#define IDR_TOGO_UNATTEND_XML 504
#define IDC_DEVICE 1001
#define IDC_FILESYSTEM 1002
#define IDC_FILE_SYSTEM 1002
#define IDC_START 1003
#define IDC_PARTITION_TYPE 1004
#define IDC_CLUSTERSIZE 1005
#define IDC_CLUSTER_SIZE 1005
#define IDC_STATUS 1006
#define IDC_ABOUT 1007
#define IDC_LABEL 1008
#define IDC_QUICKFORMAT 1009
#define IDC_BOOT 1010
#define IDC_BADBLOCKS 1011
#define IDC_PROGRESS 1012
#define IDC_BOOTTYPE 1013
#define IDC_NBPASSES 1014
#define IDC_TEST 1015
#define IDC_SELECT_ISO 1016
#define IDC_SET_ICON 1017
#define IDC_RUFUS_MBR 1018
#define IDC_INFO 1020
#define IDC_DISK_ID 1022
#define IDC_EXTRA_PARTITION 1023
#define IDC_ENABLE_FIXED_DISKS 1024
#define IDC_STATUS_TOOLBAR 1025
#define IDC_HASH 1026
#define IDC_LABEL 1007
#define IDC_QUICK_FORMAT 1008
#define IDC_BAD_BLOCKS 1009
#define IDC_PROGRESS 1010
#define IDC_BOOT_SELECTION 1011
#define IDC_NB_PASSES 1012
#define IDC_TEST 1013
#define IDC_SELECT 1014
#define IDC_EXTENDED_LABEL 1015
#define IDC_RUFUS_MBR 1016
#define IDC_TARGET_SYSTEM 1017
#define IDC_DISK_ID 1020
#define IDC_OLD_BIOS_FIXES 1021
#define IDC_LIST_USB_HDD 1022
#define IDC_STATUS_TOOLBAR 1023
#define IDC_HASH 1024
#define IDC_SAVE 1025
#define IDC_IMAGE_OPTION 1026
#define IDC_ABOUT_LICENSE 1030
#define IDC_ABOUT_ICON 1031
#define IDC_ABOUT_UPDATES 1032
#define IDC_ABOUT_COPYRIGHTS 1033
#define IDC_ABOUT_BLURB 1034
#define IDC_LICENSE_TEXT 1036
#define IDC_ABOUT_COPYRIGHTS 1032
#define IDC_ABOUT_BLURB 1033
#define IDC_LICENSE_TEXT 1034
#define IDC_NOTIFICATION_ICON 1040
#define IDC_NOTIFICATION_TEXT 1041
#define IDC_NOTIFICATION_LINE 1042
#define IDC_ADVANCED 1043
#define IDS_ADVANCED_OPTIONS_GRP 1044
#define IDC_LOG 1045
#define IDC_WINDOWS_INSTALL 1047
#define IDC_WINDOWS_TO_GO 1048
#define IDC_LOG_EDIT 1050
#define IDC_LOG_SAVE 1051
#define IDC_LOG_CLEAR 1052
#define IDC_ADVANCED_DEVICE_TOOLBAR 1043
#define IDC_ADVANCED_FORMAT_TOOLBAR 1044
#define IDC_CHECKSUM_TOOLBAR 1049
#define IDC_MULTI_TOOLBAR 1050
#define IDC_LANG 1051
#define IDC_ABOUT 1052
#define IDC_SETTINGS 1053
#define IDC_LOG 1054
#define IDC_LOG_EDIT 1055
#define IDC_LOG_SAVE 1056
#define IDC_LOG_CLEAR 1057
#define IDC_MORE_INFO 1060
#define IDC_POLICY 1061
#define IDC_UPDATE_FREQUENCY 1062
@ -166,12 +168,14 @@
#define IDC_LIST_ITEM14 1109
#define IDC_LIST_ITEM15 1110
#define IDC_LIST_ITEMMAX 1111
#define IDC_ADVANCED_DRIVE_PROPERTIES 1112
#define IDC_ADVANCED_FORMAT_OPTIONS 1113
#define IDS_DEVICE_TXT 2000
#define IDS_PARTITION_TYPE_TXT 2001
#define IDS_FILESYSTEM_TXT 2002
#define IDS_CLUSTERSIZE_TXT 2003
#define IDS_FILE_SYSTEM_TXT 2002
#define IDS_CLUSTER_SIZE_TXT 2003
#define IDS_LABEL_TXT 2004
#define IDS_FORMAT_OPTIONS_GRP 2005
#define IDS_CSM_HELP_TXT 2005
#define IDS_UPDATE_SETTINGS_GRP 2006
#define IDS_UPDATE_FREQUENCY_TXT 2007
#define IDS_INCLUDE_BETAS_TXT 2008
@ -179,6 +183,12 @@
#define IDS_NEW_VERSION_DOWNLOAD_GRP 2010
#define IDS_NEW_VERSION_NOTES_GRP 2011
#define IDS_CHECK_NOW_GRP 2012
#define IDS_TARGET_SYSTEM_TXT 2013
#define IDS_IMAGE_OPTION_TXT 2014
#define IDS_BOOT_SELECTION_TXT 2015
#define IDS_DRIVE_PROPERTIES_TXT 2016
#define IDS_FORMAT_OPTIONS_TXT 2017
#define IDS_STATUS_TXT 2018
#define MSG_000 3000
#define MSG_001 3001
#define MSG_002 3002
@ -480,7 +490,27 @@
#define MSG_298 3298
#define MSG_299 3299
#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_311 3311
#define MSG_312 3312
#define MSG_313 3313
#define MSG_314 3314
#define MSG_315 3315
#define MSG_316 3316
#define MSG_317 3317
#define MSG_318 3318
#define MSG_319 3319
#define MSG_320 3320
#define MSG_MAX 3321
// Next default values for new objects
//
@ -489,7 +519,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 505
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1079
#define _APS_NEXT_CONTROL_VALUE 1114
#define _APS_NEXT_SYMED_VALUE 4000
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/*
* Rufus: The Reliable USB Formatting Utility
* 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
* it under the terms of the GNU General Public License as published by
@ -152,7 +152,8 @@ enum user_message_type {
UM_PROGRESS_INIT,
UM_PROGRESS_EXIT,
UM_NO_UPDATE,
UM_SET_PARTITION_SCHEME_TOOLTIP,
UM_UPDATE_CSM_TOOLTIP,
UM_RESIZE_BUTTONS,
// Start of the WM IDs for the language menu items
UM_LANGUAGE_MENU = WM_APP + 0x100
};
@ -173,8 +174,7 @@ typedef struct {
/* Status Bar sections */
#define SB_SECTION_LEFT 0
#define SB_SECTION_MIDDLE 1
#define SB_SECTION_RIGHT 2
#define SB_SECTION_RIGHT 1
#define SB_TIMER_SECTION_SIZE 58.0f
/* Timers used throughout the program */
@ -218,14 +218,14 @@ enum fs_type {
enum boot_type {
BT_MSDOS = 0,
BT_FREEDOS,
BT_ISO,
BT_IMG,
BT_IMAGE,
BT_SYSLINUX_V4, // Start of indexes that only display in advanced mode
BT_SYSLINUX_V6,
BT_REACTOS,
BT_GRUB4DOS,
BT_GRUB2,
BT_UEFI_NTFS,
BT_NON_BOOTABLE,
BT_MAX
};
@ -236,8 +236,6 @@ enum target_type {
};
// For the partition types we'll use Microsoft's PARTITION_STYLE_### constants
#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 {
CHECKSUM_MD5 = 0,
@ -384,9 +382,9 @@ enum WindowsVersion {
* Globals
*/
extern HINSTANCE hMainInstance;
extern HWND hMainDialog, hLogDlg, hStatus, hDeviceList, hCapacity;
extern HWND hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
extern HWND hInfo, hProgress, hDiskID, hStatusToolbar;
extern HWND hMainDialog, hLogDialog, hStatus, hDeviceList, hCapacity;
extern HWND hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
extern HWND hInfo, hProgress, hDiskID;
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* image_path;
@ -395,12 +393,13 @@ extern BOOL PromptOnError;
extern unsigned long syslinux_ldlinux_len[2];
extern const int nb_steps[FS_MAX];
extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode;
extern BOOL allow_dual_uefi_bios, togo_mode, large_drive, usb_debug;
extern BOOL allow_dual_uefi_bios, display_togo_option, large_drive, usb_debug;
extern RUFUS_IMG_REPORT img_report;
extern int64_t iso_blocking_status;
extern uint16_t rufus_version[3], embedded_sl_version[2];
extern int nWindowsVersion;
extern int nWindowsBuildNumber;
extern int fs, bt, pt, tt;
extern char WindowsVersionStr[128];
extern size_t ubuffer_pos;
extern char ubuffer[UBUFFER_SIZE];
@ -430,7 +429,9 @@ extern HWND MyCreateDialog(HINSTANCE hInstance, int Dialog_ID, HWND hWndParent,
extern INT_PTR MyDialogBox(HINSTANCE hInstance, int Dialog_ID, HWND hWndParent, DLGPROC lpDialogFunc);
extern void CenterDialog(HWND hDlg);
extern void ResizeMoveCtrl(HWND hDlg, HWND hCtrl, int dx, int dy, int dw, int dh, float scale);
extern void ResizeButtonHeight(HWND hDlg, int id);
extern void CreateStatusBar(void);
extern void CreateStaticFont(HDC hDC, HFONT* hFont, BOOL underlined);
extern void SetTitleBarIcon(HWND hDlg);
extern BOOL CreateTaskbarList(void);
extern BOOL SetTaskbarProgressState(TASKBAR_PROGRESS_FLAGS tbpFlags);
@ -442,7 +443,7 @@ extern void DestroyAllTooltips(void);
extern BOOL Notification(int type, const notification_info* more_info, char* title, char* format, ...);
extern int SelectionDialog(char* title, char* message, char** choices, int size);
extern void ListDialog(char* title, char* message, char** items, int size);
extern SIZE GetTextSize(HWND hCtrl);
extern SIZE GetTextSize(HWND hCtrl, char* txt);
extern BOOL ExtractDOS(const char* path);
extern BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan);
extern int64_t ExtractISOFile(const char* iso, const char* iso_file, const char* dest_file, DWORD attributes);
@ -512,6 +513,7 @@ extern BYTE SearchProcess(char* HandleName, DWORD dwTimeout, BOOL bPartialMatch,
extern BOOL EnablePrivileges(void);
extern void FlashTaskbar(HANDLE handle);
extern DWORD WaitForSingleObjectWithMessages(HANDLE hHandle, DWORD dwMilliseconds);
#define GetTextWidth(hDlg, id) GetTextSize(GetDlgItem(hDlg, id), NULL).cx
DWORD WINAPI FormatThread(void* param);
DWORD WINAPI SaveImageThread(void* param);
@ -541,6 +543,7 @@ typedef struct {
} StrArray;
extern void StrArrayCreate(StrArray* arr, uint32_t initial_size);
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 StrArrayDestroy(StrArray* arr);
#define IsStrArrayEmpty(arr) (arr.Index == 0)

View file

@ -30,67 +30,72 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
// Dialog
//
IDD_DIALOG DIALOGEX 12, 12, 242, 376
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.18.1221"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
CAPTION "Rufus 3.0.1222"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
COMBOBOX IDC_DEVICE,8,17,226,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Partition scheme and target system type",IDS_PARTITION_TYPE_TXT,9,35,222,8
COMBOBOX IDC_PARTITION_TYPE,8,46,226,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "File system",IDS_FILESYSTEM_TXT,9,64,222,10
COMBOBOX IDC_FILESYSTEM,8,75,226,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Cluster size",IDS_CLUSTERSIZE_TXT,9,93,222,10
COMBOBOX IDC_CLUSTERSIZE,8,104,226,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "New volume label",IDS_LABEL_TXT,9,121,222,10
EDITTEXT IDC_LABEL,8,131,226,12,ES_AUTOHSCROLL
GROUPBOX "Format Options",IDS_FORMAT_OPTIONS_GRP,7,149,227,89
PUSHBUTTON "",IDC_ADVANCED,220,148,14,10,BS_ICON
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,112,10
COMBOBOX IDC_NBPASSES,128,159,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,121,10
CONTROL "Create a bootable disk using",IDC_BOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,112,10
COMBOBOX IDC_BOOTTYPE,128,184,75,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SELECT_ISO,207,183,21,14,BS_ICON
CONTROL "Standard Windows installation",IDC_WINDOWS_INSTALL,
"Button",BS_AUTORADIOBUTTON | WS_GROUP,23,198,205,8
CONTROL "Windows To Go",IDC_WINDOWS_TO_GO,"Button",BS_AUTORADIOBUTTON,23,210,205,8
CONTROL "Create extended label and icon files",IDC_SET_ICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,221,216,10
GROUPBOX "Advanced Options",IDS_ADVANCED_OPTIONS_GRP,7,233,227,55
CONTROL "List USB Hard Drives",IDC_ENABLE_FIXED_DISKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,246,216,10
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,258,216,10
CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,271,112,10
COMBOBOX IDC_DISK_ID,128,269,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,298,225,9
EDITTEXT IDC_INFO,8,316,225,12,ES_CENTER | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE
PUSHBUTTON "About...",IDC_ABOUT,8,339,50,14
PUSHBUTTON "Log",IDC_LOG,63,339,21,14
PUSHBUTTON "T",IDC_TEST,90,339,12,14,NOT WS_VISIBLE
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
PUSHBUTTON "Close",IDCANCEL,183,339,50,14
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
LTEXT "Device",IDS_DEVICE_TXT,8,21,216,8
COMBOBOX IDC_DEVICE,8,30,196,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SAVE,210,30,14,12,BS_ICON
LTEXT "Boot selection",IDS_BOOT_SELECTION_TXT,8,43,216,8
COMBOBOX IDC_BOOT_SELECTION,8,52,148,10,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
PUSHBUTTON "#",IDC_HASH,162,52,10,10,BS_ICON
PUSHBUTTON "SELECT",IDC_SELECT,180,52,45,10
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,65,216,8
COMBOBOX IDC_IMAGE_OPTION,8,74,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,87,96,8
COMBOBOX IDC_PARTITION_TYPE,8,96,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Target system",IDS_TARGET_SYSTEM_TXT,128,87,96,8
COMBOBOX IDC_TARGET_SYSTEM,128,96,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "?",IDS_CSM_HELP_TXT,226,97,8,15,SS_NOTIFY | NOT WS_VISIBLE
CONTROL "Show advanced drive properties",IDC_ADVANCED_DRIVE_PROPERTIES,
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,8,109,216,10
CONTROL "List USB Hard Drives",IDC_LIST_USB_HDD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,119,216,10
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_OLD_BIOS_FIXES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,129,216,10
CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,139,110,10
COMBOBOX IDC_DISK_ID,128,139,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Format Options",IDS_FORMAT_OPTIONS_TXT,8,152,57,12,NOT WS_GROUP
LTEXT "Volume label",IDS_LABEL_TXT,8,167,216,8
EDITTEXT IDC_LABEL,8,176,216,12,ES_AUTOHSCROLL
LTEXT "File system",IDS_FILE_SYSTEM_TXT,8,189,96,8
COMBOBOX IDC_FILE_SYSTEM,8,198,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Cluster size",IDS_CLUSTER_SIZE_TXT,128,189,96,8
COMBOBOX IDC_CLUSTER_SIZE,128,198,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Show advanced format options",IDC_ADVANCED_FORMAT_OPTIONS,
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,8,211,216,10
CONTROL "Quick format",IDC_QUICK_FORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,221,216,10
CONTROL "Create extended label and icon files",IDC_EXTENDED_LABEL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,231,216,10
CONTROL "Check device for bad blocks",IDC_BAD_BLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,241,112,10
COMBOBOX IDC_NB_PASSES,128,241,96,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Status",IDS_STATUS_TXT,8,254,23,9,NOT WS_GROUP
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,273,216,9
PUSHBUTTON "Multi Toolbar",IDC_ABOUT,8,294,74,10,NOT WS_VISIBLE
PUSHBUTTON "T",IDC_TEST,90,294,12,10,NOT WS_VISIBLE
DEFPUSHBUTTON "START",IDC_START,124,294,45,10
PUSHBUTTON "CLOSE",IDCANCEL,178,294,45,10
END
IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Rufus"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
ICON IDI_ICON,IDC_ABOUT_ICON,11,8,20,20
CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY,45,7,268,107
CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_TABSTOP,46,115,267,91,WS_EX_STATICEDGE
PUSHBUTTON "License",IDC_ABOUT_LICENSE,46,215,50,14,WS_GROUP
PUSHBUTTON "Updates",IDC_ABOUT_UPDATES,100,215,50,14,NOT WS_VISIBLE | WS_GROUP
DEFPUSHBUTTON "OK",IDOK,251,215,50,14,WS_GROUP
CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",0x884,45,7,268,107
CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",WS_VSCROLL | WS_TABSTOP | 0x804,46,115,267,91,WS_EX_STATICEDGE
PUSHBUTTON "License",IDC_ABOUT_LICENSE,46,216,50,12,WS_GROUP
DEFPUSHBUTTON "OK",IDOK,253,216,50,12,WS_GROUP
END
IDD_CHECKSUM DIALOGEX 0, 0, 301, 70
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Checksums"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "MD5:",IDC_STATIC,9,10,18,8
EDITTEXT IDC_MD5,40,9,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY
@ -98,33 +103,33 @@ BEGIN
EDITTEXT IDC_SHA1,40,25,197,12,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY
LTEXT "SHA256:",IDC_STATIC,9,42,27,8
EDITTEXT IDC_SHA256,40,41,197,22,ES_MULTILINE | ES_LOWERCASE | ES_READONLY
DEFPUSHBUTTON "OK",IDOK,243,49,50,14,WS_GROUP
DEFPUSHBUTTON "OK",IDOK,243,49,50,12,WS_GROUP
END
IDD_LICENSE DIALOGEX 0, 0, 335, 205
IDD_LICENSE DIALOGEX 0, 0, 335, 213
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus License"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",IDCANCEL,278,187,50,14
DEFPUSHBUTTON "Close",IDCANCEL,278,192,50,12
EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_MULTILINE | ES_READONLY | WS_VSCROLL
END
IDD_LOG DIALOGEX 0, 0, 366, 376
IDD_LOG DIALOGEX 0, 0, 366, 326
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Log"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
EDITTEXT IDC_LOG_EDIT,0,0,366,346,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_CLIENTEDGE
PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,354,50,14
PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,354,50,14
DEFPUSHBUTTON "Close Log",IDCANCEL,308,354,50,14
EDITTEXT IDC_LOG_EDIT,0,0,366,296,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_CLIENTEDGE
PUSHBUTTON "Clear",IDC_LOG_CLEAR,192,305,50,12
PUSHBUTTON "Save",IDC_LOG_SAVE,249,305,50,12
DEFPUSHBUTTON "Close",IDCANCEL,306,305,50,12
END
IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63
STYLE DS_SETFONT | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CAPTION "Rufus"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "",IDC_NOTIFICATION_LINE,0,0,263,39
LTEXT "",IDC_STATIC,0,0,263,38
@ -132,20 +137,20 @@ BEGIN
LTEXT "Message",IDC_NOTIFICATION_TEXT,35,10,219,20
DEFPUSHBUTTON "No",IDNO,206,44,50,14
PUSHBUTTON "More information",IDC_MORE_INFO,8,44,76,14,NOT WS_VISIBLE
PUSHBUTTON "Yes",IDYES,154,44,50,14,NOT WS_VISIBLE
PUSHBUTTON "Yes",IDYES,149,44,50,14,NOT WS_VISIBLE
END
IDD_SELECTION DIALOGEX 0, 0, 312, 71
STYLE DS_SETFONT | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CAPTION "Rufus"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "",IDC_SELECTION_LINE,0,0,312,47
LTEXT "",IDC_STATIC,0,0,312,46
ICON IDI_ICON,IDC_SELECTION_ICON,6,6,20,20,0,WS_EX_TRANSPARENT
LTEXT "Message",IDC_SELECTION_TEXT,35,5,269,8
DEFPUSHBUTTON "OK",IDOK,196,52,50,14
PUSHBUTTON "Cancel",IDCANCEL,254,52,50,14
DEFPUSHBUTTON "OK",IDOK,196,53,50,12
PUSHBUTTON "Cancel",IDCANCEL,254,53,50,12
CONTROL "Choice 1",IDC_SELECTION_CHOICE1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,35,18,269,10,WS_EX_TRANSPARENT
CONTROL "Choice 2",IDC_SELECTION_CHOICE2,"Button",BS_AUTORADIOBUTTON,35,31,269,10,WS_EX_TRANSPARENT
CONTROL "Choice 3",IDC_SELECTION_CHOICE3,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,35,44,269,10,WS_EX_TRANSPARENT
@ -165,66 +170,66 @@ BEGIN
END
IDD_LIST DIALOGEX 0, 0, 312, 59
STYLE DS_SETFONT | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CAPTION "Rufus"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "",IDC_LIST_LINE,0,0,312,32
LTEXT "",IDC_STATIC,0,0,312,31
ICON IDI_ICON,IDC_LIST_ICON,6,6,20,20,0,WS_EX_TRANSPARENT
LTEXT "Message",IDC_LIST_TEXT,35,5,269,8
PUSHBUTTON "OK",IDOK,254,39,50,14
PUSHBUTTON "OK",IDOK,254,40,50,12
LTEXT "List 1",IDC_LIST_ITEM1,35,17,269,10,SS_PATHELLIPSIS
LTEXT "List 2",IDC_LIST_ITEM2,35,28,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 3",IDC_LIST_ITEM3,35,39,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 4",IDC_LIST_ITEM4,35,50,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 5",IDC_LIST_ITEM5,35,61,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 6",IDC_LIST_ITEM6,35,72,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 7",IDC_LIST_ITEM7,35,73,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 8",IDC_LIST_ITEM8,35,84,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 9",IDC_LIST_ITEM9,35,95,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 10",IDC_LIST_ITEM10,35,106,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 11",IDC_LIST_ITEM11,35,117,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 12",IDC_LIST_ITEM12,35,128,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 13",IDC_LIST_ITEM13,35,139,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 14",IDC_LIST_ITEM14,35,150,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 15",IDC_LIST_ITEM15,35,161,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 16",IDC_LIST_ITEMMAX,35,172,269,10,NOT WS_VISIBLE|SS_PATHELLIPSIS
LTEXT "List 2",IDC_LIST_ITEM2,35,28,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 3",IDC_LIST_ITEM3,35,39,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 4",IDC_LIST_ITEM4,35,50,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 5",IDC_LIST_ITEM5,35,61,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 6",IDC_LIST_ITEM6,35,72,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 7",IDC_LIST_ITEM7,35,73,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 8",IDC_LIST_ITEM8,35,84,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 9",IDC_LIST_ITEM9,35,95,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 10",IDC_LIST_ITEM10,35,106,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 11",IDC_LIST_ITEM11,35,117,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 12",IDC_LIST_ITEM12,35,128,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 13",IDC_LIST_ITEM13,35,139,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 14",IDC_LIST_ITEM14,35,150,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 15",IDC_LIST_ITEM15,35,161,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
LTEXT "List 16",IDC_LIST_ITEMMAX,35,172,269,10,SS_PATHELLIPSIS | NOT WS_VISIBLE
END
IDD_UPDATE_POLICY DIALOGEX 0, 0, 287, 198
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Update policy and settings"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
ICON IDI_ICON,IDC_ABOUT_ICON,11,8,20,20
DEFPUSHBUTTON "Close",IDCANCEL,221,172,50,14,WS_GROUP
CONTROL "",IDC_POLICY,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_TABSTOP,46,8,235,132,WS_EX_STATICEDGE
CONTROL "",IDC_POLICY,"RichEdit20W",WS_VSCROLL | WS_TABSTOP | 0x804,46,8,235,132,WS_EX_STATICEDGE
GROUPBOX "Settings",IDS_UPDATE_SETTINGS_GRP,45,145,165,46
LTEXT "Check for updates",IDS_UPDATE_FREQUENCY_TXT,51,159,76,11
COMBOBOX IDC_UPDATE_FREQUENCY,133,155,66,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Include beta versions",IDS_INCLUDE_BETAS_TXT,51,174,76,11
COMBOBOX IDC_INCLUDE_BETAS,133,172,36,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Check for updates",IDS_UPDATE_FREQUENCY_TXT,51,158,80,10
COMBOBOX IDC_UPDATE_FREQUENCY,133,158,66,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Include beta versions",IDS_INCLUDE_BETAS_TXT,51,173,80,10
COMBOBOX IDC_INCLUDE_BETAS,133,173,66,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "",IDS_CHECK_NOW_GRP,210,145,71,46
PUSHBUTTON "Check Now",IDC_CHECK_NOW,221,154,50,15
PUSHBUTTON "Check Now",IDC_CHECK_NOW,221,158,50,11
DEFPUSHBUTTON "Close",IDCANCEL,221,173,50,11,WS_GROUP
END
IDD_NEW_VERSION DIALOGEX 0, 0, 384, 268
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Check For Updates - Rufus"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
PUSHBUTTON "Close",IDCANCEL,167,244,50,14,WS_GROUP
PUSHBUTTON "Close",IDCANCEL,167,245,50,12,WS_GROUP
CONTROL "",IDC_RELEASE_NOTES,"RichEdit20W",WS_VSCROLL | 0x804,15,77,352,88,WS_EX_STATICEDGE
DEFPUSHBUTTON "Download",IDC_DOWNLOAD,293,211,74,14,WS_GROUP
CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,15,212,270,11
GROUPBOX "Release Notes",IDS_NEW_VERSION_NOTES_GRP,8,63,367,111
LTEXT "A newer version is available. Please download the latest version!",IDS_NEW_VERSION_AVAIL_TXT,10,32,366,8
LTEXT "[...]",IDC_YOUR_VERSION,10,8,366,8
LTEXT "[...]",IDC_LATEST_VERSION,10,19,366,8
CTEXT "Click here to go to the website",IDC_WEBSITE,10,49,366,9,SS_NOTIFY
GROUPBOX "Download",IDS_NEW_VERSION_DOWNLOAD_GRP,8,177,367,58
EDITTEXT IDC_DOWNLOAD_URL,15,191,351,13,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_DOWNLOAD_URL,15,191,351,11,ES_AUTOHSCROLL | ES_READONLY
CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,15,212,270,11
DEFPUSHBUTTON "Download",IDC_DOWNLOAD,293,212,74,11,WS_GROUP
END
@ -366,8 +371,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,18,1221,0
PRODUCTVERSION 2,18,1221,0
FILEVERSION 2,18,1222,0
PRODUCTVERSION 2,18,1222,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -384,13 +389,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.18.1221"
VALUE "FileVersion", "2.18.1222"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.18.1221"
VALUE "ProductVersion", "2.18.1222"
END
END
BLOCK "VarFileInfo"

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Settings access, through either registry or INI file
* Copyright © 2015-2016 Pete Batard <pete@akeo.ie>
* Copyright © 2015-2016 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,6 +36,8 @@ extern char* ini_file;
#define SETTING_DISABLE_LGP "DisableLGP"
#define SETTING_ADVANCED_MODE "AdvancedMode"
#define SETTING_ADVANCED_MODE_DEVICE "ShowAdvancedDriveProperties"
#define SETTING_ADVANCED_MODE_FORMAT "ShowAdvancedFormatOptions"
#define SETTING_PRESERVE_TIMESTAMPS "PreserveTimestamps"
#define SETTING_USE_PROPER_SIZE_UNITS "UseProperSizeUnits"
#define SETTING_ENABLE_USB_DEBUG "EnableUsbDebug"

View file

@ -312,7 +312,7 @@ static int UsbCypressAtaPassthrough(HANDLE hPhysical, ATA_PASSTHROUGH_CMD* Comma
}
/* The various bridges we will try, in order */
AtaPassThroughType pt[] = {
AtaPassThroughType ata_pt[] = {
{ SatAtaPassthrough, "SAT" },
{ UsbJmicronAtaPassthrough, "JMicron" },
{ UsbProlificAtaPassthrough, "Prolific" },
@ -335,10 +335,10 @@ BOOL Identify(HANDLE hPhysical)
if (idd == NULL)
return FALSE;
for (i=0; i<ARRAYSIZE(pt); i++) {
r = pt[i].fn(hPhysical, &Command, idd, sizeof(IDENTIFY_DEVICE_DATA), SPT_TIMEOUT_VALUE);
for (i=0; i<ARRAYSIZE(ata_pt); i++) {
r = ata_pt[i].fn(hPhysical, &Command, idd, sizeof(IDENTIFY_DEVICE_DATA), SPT_TIMEOUT_VALUE);
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) {
DumpBufferHex(idd, sizeof(IDENTIFY_DEVICE_DATA));
uprintf("SMART support detected!\n");
@ -347,9 +347,9 @@ BOOL Identify(HANDLE hPhysical)
}
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");
_mm_free(idd);

View file

@ -370,9 +370,21 @@ int32_t StrArrayAdd(StrArray* arr, const char* str, BOOL duplicate)
return arr->Index++;
}
int32_t StrArrayFind(StrArray* arr, const char* str)
{
uint32_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 (int32_t)i;
}
return -1;
}
void StrArrayClear(StrArray* arr)
{
size_t i;
uint32_t i;
if ((arr == NULL) || (arr->String == NULL))
return;
for (i=0; i<arr->Index; i++) {
@ -628,19 +640,23 @@ static BOOL CALLBACK EnumFontFamExProc(const LOGFONTA *lpelfe,
return TRUE;
}
BOOL IsFontAvailable(const char* font_name) {
BOOL IsFontAvailable(const char* font_name)
{
BOOL r;
LOGFONTA lf = { 0 };
HDC hDC = GetDC(hMainDialog);
if (font_name == NULL) {
ReleaseDC(hMainDialog, hDC);
safe_release_dc(hMainDialog, hDC);
return FALSE;
}
lf.lfCharSet = DEFAULT_CHARSET;
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

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Standard Dialog Routines (Browse for folder, About, etc)
* 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
* it under the terms of the GNU General Public License as published by
@ -54,12 +54,24 @@ static WNDPROC pOrgBrowseWndproc;
static const SETTEXTEX friggin_microsoft_unicode_amateurs = {ST_DEFAULT, CP_UTF8};
static BOOL notification_is_question;
static const notification_info* notification_more_info;
static BOOL settings_commcheck = FALSE;
static WNDPROC update_original_proc = NULL;
static HWINEVENTHOOK fp_weh = NULL;
static char *fp_title_str = "Microsoft Windows", *fp_button_str = "Format disk";
extern loc_cmd* selected_locale;
extern int cbw, ddw, ddbh, bh;
static int update_settings_reposition_ids[] = {
IDC_POLICY,
IDS_UPDATE_SETTINGS_GRP,
IDS_UPDATE_FREQUENCY_TXT,
IDS_INCLUDE_BETAS_TXT,
IDC_UPDATE_FREQUENCY,
IDC_INCLUDE_BETAS,
IDS_CHECK_NOW_GRP,
IDC_CHECK_NOW,
IDCANCEL,
};
/*
* https://blogs.msdn.microsoft.com/oldnewthing/20040802-00/?p=38283/
@ -390,95 +402,26 @@ fallback:
*/
void CreateStatusBar(void)
{
SIZE sz = {0, 0};
RECT rect;
LONG x, y, width, height;
int edge[3];
TBBUTTON tbbStatusToolbarButtons[1];
TBBUTTONINFO tbi;
int edge[2];
HFONT hFont;
HDC hDC;
// Create the status bar (WS_CLIPSIBLINGS since we have an overlapping button)
hStatus = CreateWindowExW(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS | WS_CLIPSIBLINGS,
// Create the status bar
hStatus = CreateWindowExW(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hMainDialog,
(HMENU)IDC_STATUS, hMainInstance, NULL);
// Keep track of the status bar height
GetClientRect(hStatus, &rect);
height = rect.bottom;
// Set the font we'll use to display the '#' sign in the toolbar button
hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72),
0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
0, 0, PROOF_QUALITY, 0, "Segoe UI");
// Find the width of our hash sign
hDC = GetDC(hMainDialog);
SelectObject(hDC, hFont);
GetTextExtentPoint32W(hDC, L"#", 1, &sz);
if (hDC != NULL)
ReleaseDC(hMainDialog, hDC);
// Create 3 status areas
// Create 2 status areas
GetClientRect(hMainDialog, &rect);
edge[1] = rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale);
edge[0] = edge[1] - (8 + sz.cx + 8 + 1); // There's 8 absolute pixels on right and left of the text
edge[2] = rect.right;
edge[0] = rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale);
edge[1] = rect.right;
SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge);
// NB: To add an icon on the status bar, you can use something like this:
// SendMessage(hStatus, SB_SETICON, (WPARAM) 1, (LPARAM)LoadImage(GetLibraryHandle("rasdlg"),
// MAKEINTRESOURCE(50), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED));
// This is supposed to create a toolips for a statusbar section (when SBARS_TOOLTIPS is in use)... but doesn't :(
// SendMessageLU(hStatus, SB_SETTIPTEXT, (WPARAM)2, (LPARAM)"HELLO");
// Compute the dimensions for the hash button
x = edge[0];
y = rect.bottom - height + 1;
width = edge[1] - edge[0] - 1;
// How I wish there was a way to figure out how to make Windows controls look good
// at all scales, without adding all these crappy empirical adjustments...
if ((fScale > 1.20f) && (fScale <2.40f))
height -= 1;
if (nWindowsVersion <= WINDOWS_7)
height += 1;
// Create the status toolbar
hStatusToolbar = CreateWindowExW(WS_EX_TRANSPARENT, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | WS_DISABLED |
TBSTYLE_LIST | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE,
x, y, width, height, hMainDialog, (HMENU)IDC_STATUS_TOOLBAR, hMainInstance, NULL);
// Set the button properties
SendMessage(hStatusToolbar, WM_SETFONT, (WPARAM)hFont, TRUE);
SendMessage(hStatusToolbar, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_MIXEDBUTTONS);
SendMessage(hStatusToolbar, TB_SETIMAGELIST, 0, (LPARAM)NULL);
SendMessage(hStatusToolbar, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)NULL);
SendMessage(hStatusToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0,0));
// Set our text
memset(tbbStatusToolbarButtons, 0, sizeof(TBBUTTON));
tbbStatusToolbarButtons[0].idCommand = IDC_HASH;
tbbStatusToolbarButtons[0].fsStyle = BTNS_SHOWTEXT;
tbbStatusToolbarButtons[0].fsState = TBSTATE_ENABLED;
tbbStatusToolbarButtons[0].iString = (INT_PTR)L"#";
SendMessage(hStatusToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hStatusToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbbStatusToolbarButtons);
SendMessage(hStatusToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height - 1));
// Yeah, you'd think that TB_SETBUTTONSIZE would work for the width... but you'd be wrong.
// The only working method that actually enforces the requested width is TB_SETBUTTONINFO
tbi.cbSize = sizeof(tbi);
tbi.dwMask = TBIF_SIZE | TBIF_COMMAND;
tbi.cx = (WORD)width;
tbi.idCommand = IDC_HASH;
SendMessage(hStatusToolbar, TB_SETBUTTONINFO, (WPARAM)IDC_HASH, (LPARAM)&tbi);
// Need to resend the positioning for the toolbar to become active... One of Windows' mysteries
// Also use this opportunity to set our Z-order for tab stop
SetWindowPos(hStatusToolbar, GetDlgItem(hMainDialog, IDCANCEL), x, y, width, height, 0);
ShowWindow(hStatusToolbar, SW_SHOWNORMAL);
// Set the font
hFont = CreateFontA(-MulDiv(9, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72),
0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
0, 0, PROOF_QUALITY, 0, "Segoe UI");
SendMessage(hStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
}
/*
@ -545,6 +488,20 @@ void ResizeMoveCtrl(HWND hDlg, HWND hCtrl, int dx, int dy, int dw, int dh, float
InvalidateRect(hCtrl, NULL, TRUE);
}
void ResizeButtonHeight(HWND hDlg, int id)
{
HWND hCtrl;
RECT rc;
int dy = 0;
hCtrl = GetDlgItem(hDlg, id);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
if (rc.bottom - rc.top < bh)
dy = (bh - (rc.bottom - rc.top)) / 2;
SetWindowPos(hCtrl, HWND_TOP, rc.left, rc.top - dy, rc.right - rc.left, bh, 0);
}
/*
* License callback
*/
@ -557,6 +514,7 @@ INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
hLicense = GetDlgItem(hDlg, IDC_LICENSE_TEXT);
apply_localization(IDD_LICENSE, hDlg);
CenterDialog(hDlg);
ResizeButtonHeight(hDlg, IDCANCEL);
// Suppress any inherited RTL flags
style = GetWindowLong(hLicense, GWL_EXSTYLE);
style &= ~(WS_EX_RTLREADING | WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR);
@ -587,10 +545,10 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
const int edit_id[2] = {IDC_ABOUT_BLURB, IDC_ABOUT_COPYRIGHTS};
char about_blurb[2048];
const char* edit_text[2] = {about_blurb, additional_copyrights};
HWND hEdit[2];
HWND hEdit[2], hCtrl;
TEXTRANGEW tr;
ENLINK* enl;
RECT rect;
RECT rc;
REQRESIZE* rsz;
wchar_t wUrl[256];
static BOOL resized_already = TRUE;
@ -602,11 +560,19 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
apply_localization(IDD_ABOUTBOX, hDlg);
SetTitleBarIcon(hDlg);
CenterDialog(hDlg);
if (settings_commcheck)
ShowWindow(GetDlgItem(hDlg, IDC_ABOUT_UPDATES), SW_SHOW);
// Resize the 'License' button
hCtrl = GetDlgItem(hDlg, IDC_ABOUT_LICENSE);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
dy = 0;
if (rc.bottom - rc.top < bh)
dy = (bh - (rc.bottom - rc.top)) / 2;
SetWindowPos(hCtrl, NULL, rc.left, rc.top - dy,
max(rc.right - rc.left, GetTextSize(hCtrl, NULL).cx + cbw), bh, SWP_NOZORDER);
ResizeButtonHeight(hDlg, IDOK);
static_sprintf(about_blurb, about_blurb_format, lmprintf(MSG_174|MSG_RTF),
lmprintf(MSG_175|MSG_RTF, rufus_version[0], rufus_version[1], rufus_version[2]),
right_to_left_mode?"Akeo \\\\ Pete Batard 2011-2017 © Copyright":"Copyright © 2011-2017 Pete Batard / Akeo",
right_to_left_mode?"Akeo \\\\ Pete Batard 2011-2018 © Copyright":"Copyright © 2011-2018 Pete Batard / Akeo",
lmprintf(MSG_176|MSG_RTF), lmprintf(MSG_177|MSG_RTF), lmprintf(MSG_178|MSG_RTF));
for (i=0; i<ARRAYSIZE(hEdit); i++) {
hEdit[i] = GetDlgItem(hDlg, edit_id[i]);
@ -629,8 +595,8 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
case EN_REQUESTRESIZE:
if (!resized_already) {
resized_already = TRUE;
GetWindowRect(GetDlgItem(hDlg, edit_id[0]), &rect);
dy = rect.bottom - rect.top;
GetWindowRect(GetDlgItem(hDlg, edit_id[0]), &rc);
dy = rc.bottom - rc.top;
rsz = (REQRESIZE *)lParam;
dy -= rsz->rc.bottom - rsz->rc.top;
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, edit_id[0]), 0, 0, 0, -dy, 1.0f);
@ -660,9 +626,6 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
case IDC_ABOUT_LICENSE:
MyDialogBox(hMainInstance, IDD_LICENSE, hDlg, LicenseCallback);
break;
case IDC_ABOUT_UPDATES:
MyDialogBox(hMainInstance, IDD_UPDATE_POLICY, hDlg, UpdateCallback);
break;
}
break;
}
@ -692,6 +655,8 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
// To use the system message font
NONCLIENTMETRICS ncm;
HFONT hDlgFont;
HWND hCtrl;
RECT rc;
switch (message) {
case WM_INITDIALOG:
@ -710,6 +675,11 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
SendMessage(GetDlgItem(hDlg, IDC_MORE_INFO), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
SendMessage(GetDlgItem(hDlg, IDYES), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
SendMessage(GetDlgItem(hDlg, IDNO), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
if (bh != 0) {
ResizeButtonHeight(hDlg, IDC_MORE_INFO);
ResizeButtonHeight(hDlg, IDYES);
ResizeButtonHeight(hDlg, IDNO);
}
apply_localization(IDD_NOTIFICATION, hDlg);
background_brush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
@ -731,7 +701,13 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
ShowWindow(GetDlgItem(hDlg, IDYES), SW_SHOW);
}
if ((notification_more_info != NULL) && (notification_more_info->callback != NULL)) {
ShowWindow(GetDlgItem(hDlg, IDC_MORE_INFO), SW_SHOW);
hCtrl = GetDlgItem(hDlg, IDC_MORE_INFO);
// Resize the 'More information' button
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hCtrl, NULL, rc.left, rc.top,
max(rc.right - rc.left, GetTextSize(hCtrl, NULL).cx + cbw), rc.bottom - rc.top, SWP_NOZORDER);
ShowWindow(hCtrl, SW_SHOW);
}
// Set the control text
if (szMessageText != NULL) {
@ -844,16 +820,8 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
nDialogItems, IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1);
nDialogItems = IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1;
}
// TODO: This shouldn't be needed when using DS_SHELLFONT
// Get the system message box font. See http://stackoverflow.com/a/6057761
ncm.cbSize = sizeof(ncm);
// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
// will be the wrong size for previous versions, so we need to adjust it.
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
// In versions of Windows prior to Vista, the iPaddedBorderWidth member
// is not present, so we need to subtract its size from cbSize.
ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth);
#endif
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont));
// Set the dialog to use the system message box font
@ -886,8 +854,7 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
dh = rect.bottom - rect.top;
DrawTextU(hDC, szMessageText, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
dh = rect.bottom - rect.top - dh;
if (hDC != NULL)
ReleaseDC(hCtrl, hDC);
safe_release_dc(hCtrl, hDC);
ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f);
for (i = 0; i < nDialogItems; i++)
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), 0, dh, 0, 0, 1.0f);
@ -901,6 +868,8 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SELECTION_LINE), 0, dh, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDOK), 0, dh, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDCANCEL), 0, dh, 0, 0, 1.0f);
ResizeButtonHeight(hDlg, IDOK);
ResizeButtonHeight(hDlg, IDCANCEL);
// Set the radio selection
Button_SetCheck(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1), BST_CHECKED);
@ -984,16 +953,8 @@ INT_PTR CALLBACK ListCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
nDialogItems, IDC_LIST_ITEMMAX - IDC_LIST_ITEM1);
nDialogItems = IDC_LIST_ITEMMAX - IDC_LIST_ITEM1;
}
// TODO: This shouldn't be needed when using DS_SHELLFONT
// Get the system message box font. See http://stackoverflow.com/a/6057761
ncm.cbSize = sizeof(ncm);
// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
// will be the wrong size for previous versions, so we need to adjust it.
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
// In versions of Windows prior to Vista, the iPaddedBorderWidth member
// is not present, so we need to subtract its size from cbSize.
ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth);
#endif
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont));
// Set the dialog to use the system message box font
@ -1026,8 +987,7 @@ INT_PTR CALLBACK ListCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
dh = rect.bottom - rect.top;
DrawTextU(hDC, szMessageText, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
dh = rect.bottom - rect.top - dh;
if (hDC != NULL)
ReleaseDC(hCtrl, hDC);
safe_release_dc(hCtrl, hDC);
ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f);
for (i = 0; i < nDialogItems; i++)
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_LIST_ITEM1 + i), 0, dh, 0, 0, 1.0f);
@ -1041,6 +1001,8 @@ INT_PTR CALLBACK ListCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_LIST_LINE), 0, dh, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDOK), 0, dh, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDCANCEL), 0, dh, 0, 0, 1.0f);
ResizeButtonHeight(hDlg, IDOK);
ResizeButtonHeight(hDlg, IDCANCEL);
return (INT_PTR)TRUE;
case WM_CTLCOLORSTATIC:
// Change the background colour for static text and icon
@ -1251,8 +1213,7 @@ LONG GetEntryWidth(HWND hDropDown, const char *entry)
if (hFont != NULL)
SelectObject(hDC, hDefFont);
if (hDC != NULL)
ReleaseDC(hDropDown, hDC);
safe_release_dc(hDropDown, hDC);
return size.cx;
}
@ -1289,12 +1250,88 @@ BOOL SetTaskbarProgressValue(ULONGLONG ullCompleted, ULONGLONG ullTotal)
return !FAILED(ptbl->lpVtbl->SetProgressValue(ptbl, hMainDialog, ullCompleted, ullTotal));
}
static void Reposition(HWND hDlg, int id, int dx, int dw)
{
HWND hCtrl;
RECT rc;
hCtrl = GetDlgItem(hDlg, id);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hCtrl, HWND_TOP, rc.left + dx, rc.top, rc.right - rc.left + dw, rc.bottom - rc.top, 0);
}
static void PositionControls(HWND hDlg)
{
RECT rc;
HWND hCtrl;
int i, ow, dw; // original width, delta
// Get the original size of the control
GetWindowRect(GetDlgItem(hDlg, IDS_UPDATE_FREQUENCY_TXT), &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
ow = rc.right - rc.left;
dw = GetTextWidth(hDlg, IDS_UPDATE_FREQUENCY_TXT) - ow;
dw = max(dw, GetTextWidth(hDlg, IDS_INCLUDE_BETAS_TXT) - ow);
if (dw > 0) {
GetWindowRect(hDlg, &rc);
SetWindowPos(hDlg, NULL, -1, -1, rc.right - rc.left + dw, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
for (i = 0; i < ARRAYSIZE(update_settings_reposition_ids); i++)
Reposition(hDlg, update_settings_reposition_ids[i], (i < 4) ? 0 : dw, (i >= 4) ? 0 : dw);
}
hCtrl = GetDlgItem(hDlg, IDC_UPDATE_FREQUENCY);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
ow = rc.right - rc.left;
dw = GetTextSize(hCtrl, lmprintf(MSG_013)).cx;
dw = max(dw, GetTextSize(hCtrl, lmprintf(MSG_030, lmprintf(MSG_014))).cx);
dw = max(dw, GetTextSize(hCtrl, lmprintf(MSG_015)).cx);
dw = max(dw, GetTextSize(hCtrl, lmprintf(MSG_016)).cx);
dw = max(dw, GetTextSize(hCtrl, lmprintf(MSG_008)).cx);
dw = max(dw, GetTextSize(hCtrl, lmprintf(MSG_009)).cx);
dw -= ow - ddw;
if (dw > 0) {
GetWindowRect(hDlg, &rc);
SetWindowPos(hDlg, NULL, -1, -1, rc.right - rc.left + dw, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
for (i = 0; i < ARRAYSIZE(update_settings_reposition_ids); i++) {
if ((i >= 2) && (i <= 3))
continue;
Reposition(hDlg, update_settings_reposition_ids[i], (i < 6) ? 0 : dw, (i >= 6) ? 0 : dw);
}
}
GetWindowRect(GetDlgItem(hDlg, IDC_CHECK_NOW), &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
ow = rc.right - rc.left;
dw = GetTextWidth(hDlg, IDC_CHECK_NOW) - ow + cbw;
dw = max(dw, GetTextWidth(hDlg, IDCANCEL) - ow + cbw);
if (dw > 0) {
GetWindowRect(hDlg, &rc);
SetWindowPos(hDlg, NULL, -1, -1, rc.right - rc.left + dw, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
for (i = 0; i < ARRAYSIZE(update_settings_reposition_ids); i++) {
if ((i >= 1) && (i <= 5))
continue;
Reposition(hDlg, update_settings_reposition_ids[i], 0, dw);
}
}
hCtrl = GetDlgItem(hDlg, IDC_CHECK_NOW);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hCtrl, HWND_TOP, rc.left, rc.top, rc.right - rc.left, ddbh, 0);
hCtrl = GetDlgItem(hDlg, IDCANCEL);
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hCtrl, HWND_TOP, rc.left, rc.top, rc.right - rc.left, ddbh, 0);
}
/*
* Update policy and settings dialog callback
*/
INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int dy;
int i, dy;
RECT rect;
REQRESIZE* rsz;
HWND hPolicy;
@ -1308,6 +1345,7 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
resized_already = FALSE;
hUpdatesDlg = hDlg;
apply_localization(IDD_UPDATE_POLICY, hDlg);
PositionControls(hDlg);
SetTitleBarIcon(hDlg);
CenterDialog(hDlg);
hFrequency = GetDlgItem(hDlg, IDC_UPDATE_FREQUENCY);
@ -1362,14 +1400,8 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
dy -= rsz->rc.bottom - rsz->rc.top + 6; // add the border
ResizeMoveCtrl(hDlg, hDlg, 0, 0, 0, -dy, 1.0f);
ResizeMoveCtrl(hDlg, hPolicy, 0, 0, 0, -dy, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDS_UPDATE_SETTINGS_GRP), 0, -dy, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDS_UPDATE_FREQUENCY_TXT), 0, -dy, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_UPDATE_FREQUENCY), 0, -dy, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDS_INCLUDE_BETAS_TXT), 0, -dy, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_INCLUDE_BETAS), 0, -dy, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDS_CHECK_NOW_GRP), 0, -dy, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_CHECK_NOW), 0, -dy, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDCANCEL), 0, -dy, 0, 0, 1.0f);
for (i = 1; i < ARRAYSIZE(update_settings_reposition_ids); i++)
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, update_settings_reposition_ids[i]), 0, -dy, 0, 0, 1.0f);
}
break;
case WM_COMMAND:
@ -1416,7 +1448,6 @@ BOOL SetUpdateCheck(void)
WriteSetting64(SETTING_COMM_CHECK, commcheck);
if (ReadSetting64(SETTING_COMM_CHECK) != commcheck)
return FALSE;
settings_commcheck = TRUE;
// If the update interval is not set, this is the first time we run so prompt the user
if (ReadSetting32(SETTING_UPDATE_INTERVAL) == 0) {
@ -1448,28 +1479,29 @@ BOOL SetUpdateCheck(void)
return TRUE;
}
static void CreateStaticFont(HDC dc, HFONT* hyperlink_font) {
void CreateStaticFont(HDC hDC, HFONT* hFont, BOOL underlined)
{
TEXTMETRIC tm;
LOGFONT lf;
if (*hyperlink_font != NULL)
if (*hFont != NULL)
return;
GetTextMetrics(dc, &tm);
GetTextMetrics(hDC, &tm);
lf.lfHeight = tm.tmHeight;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = tm.tmWeight;
lf.lfItalic = tm.tmItalic;
lf.lfUnderline = TRUE;
lf.lfUnderline = underlined;
lf.lfStrikeOut = tm.tmStruckOut;
lf.lfCharSet = tm.tmCharSet;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = tm.tmPitchAndFamily;
GetTextFace(dc, LF_FACESIZE, lf.lfFaceName);
*hyperlink_font = CreateFontIndirect(&lf);
GetTextFace(hDC, LF_FACESIZE, lf.lfFaceName);
*hFont = CreateFontIndirect(&lf);
}
/*
@ -1498,11 +1530,11 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
char cmdline[] = APPLICATION_NAME " -w 150";
static char* filepath = NULL;
static int download_status = 0;
static HFONT hyperlink_font = NULL;
LONG i;
HWND hNotes;
STARTUPINFOA si;
PROCESS_INFORMATION pi;
HFONT hyperlink_font = NULL;
EXT_DECL(dl_ext, NULL, __VA_GROUP__("*.exe"), __VA_GROUP__(lmprintf(MSG_037)));
switch (message) {
@ -1526,13 +1558,14 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
SendMessage(GetDlgItem(hDlg, IDC_PROGRESS), PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000);
if (update.download_url == NULL)
EnableWindow(GetDlgItem(hDlg, IDC_DOWNLOAD), FALSE);
ResizeButtonHeight(hDlg, IDCANCEL);
break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam != GetDlgItem(hDlg, IDC_WEBSITE))
return FALSE;
// Change the font for the hyperlink
SetBkMode((HDC)wParam, TRANSPARENT);
CreateStaticFont((HDC)wParam, &hyperlink_font);
CreateStaticFont((HDC)wParam, &hyperlink_font, TRUE);
SelectObject((HDC)wParam, hyperlink_font);
SetTextColor((HDC)wParam, RGB(0,0,125)); // DARK_BLUE
return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
@ -1657,7 +1690,7 @@ void SetTitleBarIcon(HWND hDlg)
}
// Return the onscreen size of the text displayed by a control
SIZE GetTextSize(HWND hCtrl)
SIZE GetTextSize(HWND hCtrl, char* txt)
{
SIZE sz = {0, 0};
HDC hDC;
@ -1673,18 +1706,23 @@ SIZE GetTextSize(HWND hCtrl)
if (hFont == NULL)
goto out;
SelectObject(hDC, hFont);
len = GetWindowTextLengthW(hCtrl);
if (len <= 0)
goto out;
wstr = calloc(len + 1, sizeof(wchar_t));
if (wstr == NULL)
goto out;
if (GetWindowTextW(hCtrl, wstr, len + 1) > 0)
GetTextExtentPoint32W(hDC, wstr, len, &sz);
if (txt == NULL) {
len = GetWindowTextLengthW(hCtrl);
if (len <= 0)
goto out;
wstr = calloc(len + 1, sizeof(wchar_t));
if (wstr == NULL)
goto out;
if (GetWindowTextW(hCtrl, wstr, len + 1) > 0)
GetTextExtentPoint32W(hDC, wstr, len, &sz);
} else {
wstr = utf8_to_wchar(txt);
if (wstr != NULL)
GetTextExtentPoint32W(hDC, wstr, (int)wcslen(wstr), &sz);
}
out:
safe_free(wstr);
if (hDC != NULL)
ReleaseDC(hCtrl, hDC);
safe_release_dc(hCtrl, hDC);
return sz;
}
@ -1692,7 +1730,6 @@ out:
* The following is used to work around dialog template limitations when switching from LTR to RTL
* or switching the font. This avoids having to multiply similar templates in the RC.
* TODO: Can we use http://stackoverflow.com/questions/6057239/which-font-is-the-default-for-mfc-dialog-controls?
* TODO: We are supposed to use Segoe with font size 9 in Vista or later
*/
// Produce a dialog template from our RC, and update its RTL and Font settings dynamically

View file

@ -2,7 +2,7 @@
*
* Copyright 2003 Lars Munch Christensen - 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
*
@ -106,16 +106,15 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
const char* mboot_c32 = "mboot.c32";
char path[MAX_PATH], tmp[64];
const char *errmsg;
struct libfat_filesystem *fs;
struct libfat_filesystem *lf_fs;
libfat_sector_t s, *secp;
libfat_sector_t *sectors = NULL;
int ldlinux_sectors;
uint32_t ldlinux_cluster;
int i, nsectors, sl_fs_stype;
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_ISO) && (SL_MAJOR(img_report.sl_version) >= 5));
BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_IMAGE) && (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 */
SECTOR_SHIFT = 0;
@ -219,7 +218,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
}
uprintf("Successfully wrote '%s'", &path[3]);
if (bt != BT_ISO)
if (bt != BT_IMAGE)
UpdateProgress(OP_DOS, -1.0f);
/* Now flush the media */
@ -266,21 +265,21 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
case FS_FAT16:
case FS_FAT32:
case FS_EXFAT:
fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
if (fs == NULL) {
lf_fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
if (lf_fs == NULL) {
uprintf("Syslinux FAT access error");
goto out;
}
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
ldlinux_cluster = libfat_searchdir(lf_fs, 0, "LDLINUX SYS", NULL);
secp = sectors;
nsectors = 0;
s = libfat_clustertosector(fs, ldlinux_cluster);
s = libfat_clustertosector(lf_fs, ldlinux_cluster);
while (s && nsectors < ldlinux_sectors) {
*secp++ = s;
nsectors++;
s = libfat_nextsector(fs, s);
s = libfat_nextsector(lf_fs, s);
}
libfat_close(fs);
libfat_close(lf_fs);
break;
default:
uprintf("Unsupported Syslinux filesystem");
@ -380,7 +379,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
fclose(fd);
}
if (bt != BT_ISO)
if (bt != BT_IMAGE)
UpdateProgress(OP_DOS, -1.0f);
r = TRUE;

183
src/ui.h Normal file
View file

@ -0,0 +1,183 @@
/*
* Rufus: The Reliable USB Formatting Utility
* UI element lists
* Copyright © 2018 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <windows.h>
#include "resource.h"
#pragma once
static int image_option_move_ids[] = {
IDS_PARTITION_TYPE_TXT,
IDC_PARTITION_TYPE,
IDS_TARGET_SYSTEM_TXT,
IDC_TARGET_SYSTEM,
IDS_CSM_HELP_TXT,
IDC_ADVANCED_DEVICE_TOOLBAR,
IDC_LIST_USB_HDD,
IDC_OLD_BIOS_FIXES,
IDC_RUFUS_MBR,
IDC_DISK_ID,
IDS_FORMAT_OPTIONS_TXT,
IDS_LABEL_TXT,
IDC_LABEL,
IDS_FILE_SYSTEM_TXT,
IDC_FILE_SYSTEM,
IDS_CLUSTER_SIZE_TXT,
IDC_CLUSTER_SIZE,
IDC_ADVANCED_FORMAT_TOOLBAR,
IDC_QUICK_FORMAT,
IDC_BAD_BLOCKS,
IDC_NB_PASSES,
IDC_EXTENDED_LABEL,
IDS_STATUS_TXT,
IDC_PROGRESS,
IDC_ABOUT,
IDC_LOG,
IDC_MULTI_TOOLBAR,
IDC_TEST,
IDC_START,
IDCANCEL,
IDC_STATUS,
IDC_STATUS_TOOLBAR,
};
static int image_option_toggle_ids[] = {
IDS_IMAGE_OPTION_TXT,
IDC_IMAGE_OPTION,
};
static int advanced_device_move_ids[] = {
IDC_LIST_USB_HDD,
IDC_OLD_BIOS_FIXES,
IDC_RUFUS_MBR,
IDS_FORMAT_OPTIONS_TXT,
IDS_LABEL_TXT,
IDC_LABEL,
IDS_FILE_SYSTEM_TXT,
IDC_FILE_SYSTEM,
IDS_CLUSTER_SIZE_TXT,
IDC_CLUSTER_SIZE,
IDC_ADVANCED_FORMAT_TOOLBAR,
IDC_QUICK_FORMAT,
IDC_BAD_BLOCKS,
IDC_NB_PASSES,
IDC_EXTENDED_LABEL,
IDS_STATUS_TXT,
IDC_PROGRESS,
IDC_ABOUT,
IDC_LOG,
IDC_MULTI_TOOLBAR,
IDC_TEST,
IDC_START,
IDCANCEL,
IDC_STATUS,
IDC_STATUS_TOOLBAR,
};
static int advanced_device_toggle_ids[] = {
IDC_SAVE,
IDC_LIST_USB_HDD,
IDC_OLD_BIOS_FIXES,
IDC_RUFUS_MBR,
IDC_DISK_ID,
};
static int advanced_format_move_ids[] = {
IDS_STATUS_TXT,
IDC_PROGRESS,
IDC_ABOUT,
IDC_LOG,
IDC_MULTI_TOOLBAR,
IDC_TEST,
IDC_START,
IDCANCEL,
IDC_STATUS,
IDC_STATUS_TOOLBAR,
};
static int advanced_format_toggle_ids[] = {
IDC_QUICK_FORMAT,
IDC_BAD_BLOCKS,
IDC_NB_PASSES,
IDC_EXTENDED_LABEL,
};
static int main_button_ids[] = {
IDC_SELECT,
IDC_START,
IDCANCEL,
};
static int full_width_controls[] = {
IDS_DEVICE_TXT,
IDS_BOOT_SELECTION_TXT,
IDS_IMAGE_OPTION_TXT,
IDC_IMAGE_OPTION,
IDS_LABEL_TXT,
IDC_LABEL,
IDC_ADVANCED_DRIVE_PROPERTIES,
IDC_LIST_USB_HDD,
IDC_OLD_BIOS_FIXES,
IDC_ADVANCED_FORMAT_OPTIONS,
IDC_QUICK_FORMAT,
IDC_EXTENDED_LABEL,
IDC_PROGRESS,
};
static int full_width_checkboxes[] = {
IDC_LIST_USB_HDD,
IDC_OLD_BIOS_FIXES,
IDC_QUICK_FORMAT,
IDC_EXTENDED_LABEL,
};
static int half_width_ids[] = {
IDC_BAD_BLOCKS,
IDC_RUFUS_MBR,
IDS_PARTITION_TYPE_TXT,
IDC_PARTITION_TYPE,
IDC_FILE_SYSTEM,
IDS_TARGET_SYSTEM_TXT,
IDC_TARGET_SYSTEM,
IDC_DISK_ID,
IDS_CLUSTER_SIZE_TXT,
IDC_CLUSTER_SIZE,
IDC_NB_PASSES,
};
static int adjust_dpi_ids[][5] = {
{IDS_DEVICE_TXT, IDC_DEVICE, IDC_SAVE, 0, 0},
{IDS_BOOT_SELECTION_TXT, IDC_BOOT_SELECTION, IDC_HASH, IDC_SELECT, 0},
{IDS_IMAGE_OPTION_TXT, IDC_IMAGE_OPTION, 0, 0, 0},
{IDS_PARTITION_TYPE_TXT, IDC_PARTITION_TYPE, IDS_TARGET_SYSTEM_TXT, IDC_TARGET_SYSTEM, IDS_CSM_HELP_TXT},
{IDC_ADVANCED_DEVICE_TOOLBAR, 0, 0, 0, 0},
{IDC_LIST_USB_HDD, 0, 0, 0, 0 },
{IDC_OLD_BIOS_FIXES, 0, 0, 0, 0},
{IDC_RUFUS_MBR, IDC_DISK_ID, 0, 0, 0},
{IDS_FORMAT_OPTIONS_TXT, 0, 0, 0, 0},
{IDS_LABEL_TXT, IDC_LABEL, 0, 0, 0},
{IDS_FILE_SYSTEM_TXT, IDC_FILE_SYSTEM, IDS_CLUSTER_SIZE_TXT, IDC_CLUSTER_SIZE, 0},
{IDC_ADVANCED_FORMAT_TOOLBAR, 0, 0, 0, 0},
{IDC_QUICK_FORMAT, 0, 0, 0, 0},
{IDC_EXTENDED_LABEL, 0, 0, 0, 0},
{IDC_BAD_BLOCKS, IDC_NB_PASSES, 0, 0, 0},
{IDS_STATUS_TXT, 0, 0, 0, 0},
{IDC_PROGRESS, 0, 0, 0, 0 },
{IDC_MULTI_TOOLBAR, IDC_TEST, IDC_START, IDCANCEL, 0}
};