"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/rufus.c" between
rufus-3.12.tar.gz and rufus-3.13.tar.gz

About: Rufus is a utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc (for Linux and Windows).

rufus.c  (rufus-3.12):rufus.c  (rufus-3.13)
skipping to change at line 121 skipping to change at line 121
DWORD MainThreadId; DWORD MainThreadId;
HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hL abel, hBootType, hNBPasses, hLog = NULL; HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hL abel, hBootType, hNBPasses, hLog = NULL;
HWND hImageOption, hLogDialog = NULL, hProgress = NULL, hDiskID; HWND hImageOption, hLogDialog = NULL, hProgress = NULL, hDiskID;
HANDLE dialog_handle = NULL; HANDLE dialog_handle = NULL;
BOOL is_x86_32, use_own_c32[NB_OLD_C32] = { FALSE, FALSE }, mbr_selected_by_user = FALSE; BOOL is_x86_32, use_own_c32[NB_OLD_C32] = { FALSE, FALSE }, mbr_selected_by_user = FALSE;
BOOL op_in_progress = TRUE, right_to_left_mode = FALSE, has_uefi_csm = FALSE, it s_a_me_mario = FALSE; BOOL op_in_progress = TRUE, right_to_left_mode = FALSE, has_uefi_csm = FALSE, it s_a_me_mario = FALSE;
BOOL enable_HDDs = FALSE, enable_VHDs = TRUE, enable_ntfs_compression = FALSE, n o_confirmation_on_cancel = FALSE, lock_drive = TRUE; BOOL enable_HDDs = FALSE, enable_VHDs = TRUE, enable_ntfs_compression = FALSE, n o_confirmation_on_cancel = FALSE, lock_drive = TRUE;
BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fa kes, enable_vmdk, force_large_fat32, usb_debug; BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fa kes, enable_vmdk, force_large_fat32, usb_debug;
BOOL use_fake_units, preserve_timestamps = FALSE, fast_zeroing = FALSE, app_chan ged_size = FALSE; BOOL use_fake_units, preserve_timestamps = FALSE, fast_zeroing = FALSE, app_chan ged_size = FALSE;
BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_inde xing, large_drive = FALSE; BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_inde xing, large_drive = FALSE;
BOOL write_as_image = FALSE, write_as_esp = FALSE, installed_uefi_ntfs = FALSE, use_vds = FALSE; BOOL write_as_image = FALSE, write_as_esp = FALSE, installed_uefi_ntfs = FALSE, use_vds = FALSE, ignore_boot_marker = FALSE;
BOOL windows_to_go_selected = FALSE; BOOL windows_to_go_selected = FALSE;
float fScale = 1.0f; float fScale = 1.0f;
int dialog_showing = 0, selection_default = BT_IMAGE, persistence_unit_selection = -1; int dialog_showing = 0, selection_default = BT_IMAGE, persistence_unit_selection = -1;
int default_fs, fs_type, boot_type, partition_type, target_type; // file system, boot type, partition type, target type int default_fs, fs_type, boot_type, partition_type, target_type; // file system, boot type, partition type, target type
int force_update = 0, default_thread_priority = THREAD_PRIORITY_ABOVE_NORMAL; int force_update = 0, default_thread_priority = THREAD_PRIORITY_ABOVE_NORMAL;
char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[M AX_PATH], sysnative_dir[MAX_PATH]; char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[M AX_PATH], sysnative_dir[MAX_PATH];
char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
char embedded_sl_version_ext[2][32]; char embedded_sl_version_ext[2][32];
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; char ClusterSizeLabel[MAX_CLUSTER_SIZES][64];
char msgbox[1024], msgbox_title[32], *ini_file = NULL, *image_path = NULL, *shor t_image_path; char msgbox[1024], msgbox_title[32], *ini_file = NULL, *image_path = NULL, *shor t_image_path;
skipping to change at line 900 skipping to change at line 900
if (!SetFileSystemAndClusterSize((selected_fs == FS_UNKNOWN) ? fs_name : NULL)) { if (!SetFileSystemAndClusterSize((selected_fs == FS_UNKNOWN) ? fs_name : NULL)) {
SetProposedLabel(-1); SetProposedLabel(-1);
uprintf("No file system is selectable for this drive\n"); uprintf("No file system is selectable for this drive\n");
return FALSE; return FALSE;
} }
EnableControls(TRUE, FALSE); EnableControls(TRUE, FALSE);
// Set a proposed label according to the size (eg: "256MB", "8GB") // Set a proposed label according to the size (eg: "256MB", "8GB")
static_sprintf(SelectedDrive.proposed_label, "%s", static_sprintf(SelectedDrive.proposed_label, "%s",
SizeToHumanReadable(SelectedDrive.DiskSize, FALSE, use_fake_units )); SizeToHumanReadable(SelectedDrive.DiskSize, FALSE, TRUE));
// Add a tooltip (with the size of the device in parenthesis) // Add a tooltip (with the size of the device in parenthesis)
device_tooltip = (char*) malloc(safe_strlen(DriveName.String[device_index ]) + 32); device_tooltip = (char*) malloc(safe_strlen(DriveName.String[device_index ]) + 32);
if (device_tooltip != NULL) { if (device_tooltip != NULL) {
if (right_to_left_mode) if (right_to_left_mode)
safe_sprintf(device_tooltip, safe_strlen(DriveName.String [device_index]) + 32, "(%s) %s", safe_sprintf(device_tooltip, safe_strlen(DriveName.String [device_index]) + 32, "(%s) %s",
SizeToHumanReadable(SelectedDrive.DiskSize, FALSE , FALSE), DriveName.String[device_index]); SizeToHumanReadable(SelectedDrive.DiskSize, FALSE , FALSE), DriveName.String[device_index]);
else else
safe_sprintf(device_tooltip, safe_strlen(DriveName.String [device_index]) + 32, "%s (%s)", safe_sprintf(device_tooltip, safe_strlen(DriveName.String [device_index]) + 32, "%s (%s)",
DriveName.String[device_index], SizeToHumanReadab le(SelectedDrive.DiskSize, FALSE, FALSE)); DriveName.String[device_index], SizeToHumanReadab le(SelectedDrive.DiskSize, FALSE, FALSE));
skipping to change at line 1211 skipping to change at line 1211
uint8_t arch; uint8_t arch;
char tmp_path[MAX_PATH]; char tmp_path[MAX_PATH];
if (image_path == NULL) if (image_path == NULL)
goto out; goto out;
PrintInfoDebug(0, MSG_202); PrintInfoDebug(0, MSG_202);
user_notified = FALSE; user_notified = FALSE;
EnableControls(FALSE, FALSE); EnableControls(FALSE, FALSE);
memset(&img_report, 0, sizeof(img_report)); memset(&img_report, 0, sizeof(img_report));
img_report.is_iso = (BOOLEAN)ExtractISO(image_path, "", TRUE); img_report.is_iso = (BOOLEAN)ExtractISO(image_path, "", TRUE);
img_report.is_bootable_img = (BOOLEAN)IsBootableImage(image_path); img_report.is_bootable_img = IsBootableImage(image_path);
ComboBox_ResetContent(hImageOption); ComboBox_ResetContent(hImageOption);
if ((FormatStatus == (ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERRO R_CANCELLED)) || if ((FormatStatus == (ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERRO R_CANCELLED)) ||
(img_report.image_size == 0) || (img_report.image_size == 0) ||
(!img_report.is_iso && !img_report.is_bootable_img && !img_report .is_windows_img)) { (!img_report.is_iso && !img_report.is_bootable_img && !img_report .is_windows_img)) {
// Failed to scan image // Failed to scan image
SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0);
safe_free(image_path); safe_free(image_path);
UpdateImage(FALSE); UpdateImage(FALSE);
SetMBRProps(); SetMBRProps();
PopulateProperties(); PopulateProperties();
PrintInfoDebug(0, MSG_203); PrintInfoDebug(0, MSG_203);
PrintStatus(0, MSG_203); PrintStatus(0, MSG_203);
EnableControls(TRUE, FALSE); EnableControls(TRUE, FALSE);
MessageBoxExU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK | MB_ICONINFORMATION | MB_IS_RTL, selected_langid);
goto out; goto out;
} }
if (img_report.is_windows_img) { if (img_report.is_windows_img) {
selection_default = BT_IMAGE; selection_default = BT_IMAGE;
// coverity[swapped_arguments] // coverity[swapped_arguments]
if (GetTempFileNameU(temp_dir, APPLICATION_NAME, 0, tmp_path) != 0) { if (GetTempFileNameU(temp_dir, APPLICATION_NAME, 0, tmp_path) != 0) {
// Only look at index 1 for now. If people complain, we m ay look for more. // Only look at index 1 for now. If people complain, we m ay look for more.
if (WimExtractFile(image_path, 1, "Windows\\Boot\\EFI\\bo otmgr.efi", tmp_path, TRUE)) { if (WimExtractFile(image_path, 1, "Windows\\Boot\\EFI\\bo otmgr.efi", tmp_path, TRUE)) {
arch = FindArch(tmp_path); arch = FindArch(tmp_path);
skipping to change at line 1249 skipping to change at line 1250
img_report.has_bootmgr_efi = TRUE; img_report.has_bootmgr_efi = TRUE;
img_report.wininst_index = 1; img_report.wininst_index = 1;
} else { } else {
uprintf(" Image does not contain an EFI boot manager"); uprintf(" Image does not contain an EFI boot manager");
} }
} }
DeleteFileU(tmp_path); DeleteFileU(tmp_path);
} }
uprintf(" Image is %sa UEFI bootable Windows installation image" , img_report.has_efi ? "" : "NOT "); uprintf(" Image is %sa UEFI bootable Windows installation image" , img_report.has_efi ? "" : "NOT ");
} else if (img_report.is_bootable_img) { } else if (img_report.is_bootable_img) {
uprintf(" Image is a %sbootable %s image", if (img_report.is_bootable_img == 2)
(img_report.compression_type != BLED_COMPRESSION_NONE) ? uprintf(" Image is a FORCED non-bootable image");
"compressed " : "", img_report.is_vhd ? "VHD" : "disk"); else
uprintf(" Image is a %sbootable %s image",
(img_report.compression_type != BLED_COMPRESSION_
NONE) ? "compressed " : "", img_report.is_vhd ? "VHD" : "disk");
selection_default = BT_IMAGE; selection_default = BT_IMAGE;
} }
if (img_report.is_iso) { if (img_report.is_iso) {
DisplayISOProps(); DisplayISOProps();
// If we have an ISOHybrid, but without an ISO method we support, disable ISO support altogether // If we have an ISOHybrid, but without an ISO method we support, disable ISO support altogether
if (IS_DD_BOOTABLE(img_report) && (img_report.disable_iso || if (IS_DD_BOOTABLE(img_report) && (img_report.disable_iso ||
(!IS_BIOS_BOOTABLE(img_report) && !IS_EFI_BOOTABL E(img_report)))) { (!IS_BIOS_BOOTABLE(img_report) && !IS_EFI_BOOTABL E(img_report)))) {
uprintf("Note: ISO mode will be disabled because this ISO Hybrid is not compatible with ISO boot."); uprintf("Note: ISO mode will be disabled because this ISO Hybrid is not compatible with ISO boot.");
img_report.is_iso = FALSE; img_report.is_iso = FALSE;
skipping to change at line 2762 skipping to change at line 2766
PostQuitMessage(0); PostQuitMessage(0);
} else { } else {
// ...but we must simulate Cancel on shutdown requests, e lse the app freezes. // ...but we must simulate Cancel on shutdown requests, e lse the app freezes.
SendMessage(hDlg, WM_COMMAND, (WPARAM)IDCANCEL, (LPARAM)0 ); SendMessage(hDlg, WM_COMMAND, (WPARAM)IDCANCEL, (LPARAM)0 );
} }
break; break;
case UM_PROGRESS_INIT: case UM_PROGRESS_INIT:
isMarquee = (wParam == PBS_MARQUEE); isMarquee = (wParam == PBS_MARQUEE);
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0); SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);
if (isMarquee) if (isMarquee) {
SendMessage(hProgress, PBM_SETMARQUEE, TRUE, 0); SendMessage(hProgress, PBM_SETMARQUEE, TRUE, 0);
else SetTaskbarProgressState(TASKBAR_INDETERMINATE);
} else {
SendMessage(hProgress, PBM_SETPOS, 0, 0); SendMessage(hProgress, PBM_SETPOS, 0, 0);
SetTaskbarProgressState(TASKBAR_NORMAL); SetTaskbarProgressState(TASKBAR_NORMAL);
SetTaskbarProgressValue(0, MAX_PROGRESS); SetTaskbarProgressValue(0, MAX_PROGRESS);
}
break; break;
case UM_PROGRESS_EXIT: case UM_PROGRESS_EXIT:
tb_state = PBST_NORMAL; tb_state = PBST_NORMAL;
tb_flags = TASKBAR_NORMAL; tb_flags = TASKBAR_NORMAL;
if (isMarquee) { if (isMarquee) {
SendMessage(hProgress, PBM_SETMARQUEE, FALSE, 0); SendMessage(hProgress, PBM_SETMARQUEE, FALSE, 0);
SetTaskbarProgressValue(0, MAX_PROGRESS); SetTaskbarProgressValue(0, MAX_PROGRESS);
} else if (!IS_ERROR(FormatStatus)) { } else if (!IS_ERROR(FormatStatus)) {
SetTaskbarProgressValue(MAX_PROGRESS, MAX_PROGRESS); SetTaskbarProgressValue(MAX_PROGRESS, MAX_PROGRESS);
skipping to change at line 3294 skipping to change at line 3300
use_vds = ReadSettingBool(SETTING_USE_VDS); use_vds = ReadSettingBool(SETTING_USE_VDS);
usb_debug = ReadSettingBool(SETTING_ENABLE_USB_DEBUG); usb_debug = ReadSettingBool(SETTING_ENABLE_USB_DEBUG);
cdio_loglevel_default = usb_debug ? CDIO_LOG_DEBUG : CDIO_LOG_WARN; cdio_loglevel_default = usb_debug ? CDIO_LOG_DEBUG : CDIO_LOG_WARN;
detect_fakes = !ReadSettingBool(SETTING_DISABLE_FAKE_DRIVES_CHECK); detect_fakes = !ReadSettingBool(SETTING_DISABLE_FAKE_DRIVES_CHECK);
allow_dual_uefi_bios = ReadSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS); allow_dual_uefi_bios = ReadSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS);
force_large_fat32 = ReadSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT); force_large_fat32 = ReadSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT);
enable_vmdk = ReadSettingBool(SETTING_ENABLE_VMDK_DETECTION); enable_vmdk = ReadSettingBool(SETTING_ENABLE_VMDK_DETECTION);
enable_file_indexing = ReadSettingBool(SETTING_ENABLE_FILE_INDEXING); enable_file_indexing = ReadSettingBool(SETTING_ENABLE_FILE_INDEXING);
enable_VHDs = !ReadSettingBool(SETTING_DISABLE_VHDS); enable_VHDs = !ReadSettingBool(SETTING_DISABLE_VHDS);
enable_extra_hashes = ReadSettingBool(SETTING_ENABLE_EXTRA_HASHES); enable_extra_hashes = ReadSettingBool(SETTING_ENABLE_EXTRA_HASHES);
ignore_boot_marker = ReadSettingBool(SETTING_IGNORE_BOOT_MARKER);
// We want above normal priority by default, so we offset the value. // We want above normal priority by default, so we offset the value.
default_thread_priority = ReadSetting32(SETTING_DEFAULT_THREAD_PRIORITY) + THREAD_PRIORITY_ABOVE_NORMAL; default_thread_priority = ReadSetting32(SETTING_DEFAULT_THREAD_PRIORITY) + THREAD_PRIORITY_ABOVE_NORMAL;
// Initialize the global scaling, in case we need it before we initialize the dialog // Initialize the global scaling, in case we need it before we initialize the dialog
hDC = GetDC(NULL); hDC = GetDC(NULL);
fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f;
safe_release_dc(NULL, hDC); safe_release_dc(NULL, hDC);
// Init localization // Init localization
init_localization(); init_localization();
skipping to change at line 3463 skipping to change at line 3470
if (!SetAlertPromptHook()) if (!SetAlertPromptHook())
uprintf("Warning: Could not set alert prompt hook"); uprintf("Warning: Could not set alert prompt hook");
ShowWindow(hDlg, SW_SHOWNORMAL); ShowWindow(hDlg, SW_SHOWNORMAL);
UpdateWindow(hDlg); UpdateWindow(hDlg);
// Do our own event processing and process "magic" commands // Do our own event processing and process "magic" commands
while(GetMessage(&msg, NULL, 0, 0)) { while(GetMessage(&msg, NULL, 0, 0)) {
static BOOL ctrl_without_focus = FALSE; static BOOL ctrl_without_focus = FALSE;
BOOL no_focus = (msg.message == WM_SYSKEYDOWN) && !(msg.lParam & 0x20000000); BOOL no_focus = (msg.message == WM_SYSKEYDOWN) && !(msg.lParam & 0x20000000);
// ** *********** *************** // ** ***************************
// .,ABCDEFGHIJKLMNOPQRSTUVWXYZ+- // .,ABCDEFGHIJKLMNOPQRSTUVWXYZ+-
// Sigh... The things one need to do to detect standalone use of the 'Alt' key. // Sigh... The things one need to do to detect standalone use of the 'Alt' key.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam != VK_MENU)) if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam != VK_MENU))
alt_command = TRUE; alt_command = TRUE;
else if (GetKeyState(VK_MENU) & 0x8000) else if (GetKeyState(VK_MENU) & 0x8000)
alt_pressed = TRUE; alt_pressed = TRUE;
// Ctrl-A => Select the log data // Ctrl-A => Select the log data
if ((IsWindowVisible(hLogDialog)) && (GetKeyState(VK_CONTROL) & 0 x8000) && if ((IsWindowVisible(hLogDialog)) && (GetKeyState(VK_CONTROL) & 0 x8000) &&
skipping to change at line 3503 skipping to change at line 3510
ctrl_without_focus = FALSE; ctrl_without_focus = FALSE;
SendMessage(hMainDialog, WM_COMMAND, IDC_LOG, 0); SendMessage(hMainDialog, WM_COMMAND, IDC_LOG, 0);
continue; continue;
} }
#if defined(_DEBUG) || defined(TEST) #if defined(_DEBUG) || defined(TEST)
// Ctrl-T => Alternate Test mode that doesn't require a full rebu ild // Ctrl-T => Alternate Test mode that doesn't require a full rebu ild
if ((ctrl_without_focus || ((GetKeyState(VK_CONTROL) & 0x8000) && (msg.message == WM_KEYDOWN))) if ((ctrl_without_focus || ((GetKeyState(VK_CONTROL) & 0x8000) && (msg.message == WM_KEYDOWN)))
&& (msg.wParam == 'T')) { && (msg.wParam == 'T')) {
//extern int TestChecksum(void); //extern int TestChecksum(void);
//TestChecksum(); //TestChecksum();
ListVdsVolumes(FALSE);
continue; continue;
} }
#endif #endif
if (no_focus && (msg.wParam != VK_CONTROL)) if (no_focus && (msg.wParam != VK_CONTROL))
ctrl_without_focus = FALSE; ctrl_without_focus = FALSE;
if (no_focus) if (no_focus)
continue; continue;
skipping to change at line 3643 skipping to change at line 3651
continue; continue;
} }
// Alt-L => Force Large FAT32 format to be used on < 32 G B drives // Alt-L => Force Large FAT32 format to be used on < 32 G B drives
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'L') ) { if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'L') ) {
force_large_fat32 = !force_large_fat32; force_large_fat32 = !force_large_fat32;
WriteSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT , force_large_fat32); WriteSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT , force_large_fat32);
PrintStatusTimeout(lmprintf(MSG_254), force_large _fat32); PrintStatusTimeout(lmprintf(MSG_254), force_large _fat32);
GetDevices(0); GetDevices(0);
continue; continue;
} }
// Alt-M => Toggle the check for the 0x55 0xAA boot marke
r at offset 0x1fe.
// This means that Rufus treats anything selected as a wr
iteable DD image.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'M')
) {
ignore_boot_marker = !ignore_boot_marker;
WriteSettingBool(SETTING_IGNORE_BOOT_MARKER, igno
re_boot_marker);
PrintStatusTimeout(lmprintf(MSG_319), ignore_boot
_marker);
continue;
}
// Alt N => Enable NTFS compression // Alt N => Enable NTFS compression
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'N') ) { if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'N') ) {
enable_ntfs_compression = !enable_ntfs_compressio n; enable_ntfs_compression = !enable_ntfs_compressio n;
PrintStatusTimeout(lmprintf(MSG_260), enable_ntfs _compression); PrintStatusTimeout(lmprintf(MSG_260), enable_ntfs _compression);
continue; continue;
} }
// Alt-O => Save from Optical drive to ISO // Alt-O => Save from Optical drive to ISO
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'O') ) { if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'O') ) {
SaveISO(); SaveISO();
continue; continue;
 End of changes. 12 change blocks. 
11 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)