mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
Merge 54a1333274
into 92631d1204
This commit is contained in:
commit
c9376c6966
2 changed files with 539 additions and 503 deletions
220
src/rufus.c
220
src/rufus.c
|
@ -687,7 +687,11 @@ static BOOL PopulateProperties(int ComboIndex)
|
|||
SetWindowTextU(hLabel, DriveLabel.String[ComboIndex]);
|
||||
}
|
||||
} else {
|
||||
if (IsChecked(IDC_BOOT)) {
|
||||
SetWindowTextU(hLabel, img_report.label);
|
||||
} else {
|
||||
SetWindowTextU(hLabel, DriveLabel.String[ComboIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -2079,8 +2083,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
EXT_DECL(img_ext, NULL, __VA_GROUP__("*.img;*.vhd;*.gz;*.bzip2;*.xz;*.lzma;*.Z;*.zip"), __VA_GROUP__(lmprintf(MSG_095)));
|
||||
EXT_DECL(iso_ext, NULL, __VA_GROUP__("*.iso"), __VA_GROUP__(lmprintf(MSG_036)));
|
||||
LPNMTOOLBAR lpnmtb;
|
||||
HDROP droppedFileInfo;
|
||||
|
||||
switch (message) {
|
||||
switch(message) {
|
||||
|
||||
case UM_MEDIA_CHANGE:
|
||||
wParam = DBT_CUSTOMEVENT;
|
||||
|
@ -2096,8 +2101,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
// DO *NOT* USE WM_DEVICECHANGE AS THE MESSAGE FROM THE TIMER PROC, as it may be filtered!
|
||||
// For instance filtering will occur when (un)plugging in a FreeBSD UFD on Windows 8.
|
||||
// Instead, use a custom user message, such as UM_MEDIA_CHANGE, to set DBT_CUSTOMEVENT.
|
||||
if (format_thid == NULL) {
|
||||
switch (wParam) {
|
||||
if(format_thid == NULL) {
|
||||
switch(wParam) {
|
||||
case DBT_DEVICEARRIVAL:
|
||||
case DBT_DEVICEREMOVECOMPLETE:
|
||||
case DBT_CUSTOMEVENT: // Sent by our timer refresh function or for card reader media change
|
||||
|
@ -2108,7 +2113,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
return (INT_PTR)TRUE;
|
||||
case DBT_DEVNODES_CHANGED:
|
||||
// If it's been more than a second since last device refresh, arm a refresh timer
|
||||
if (GetTickCount() > LastRefresh + 1000) {
|
||||
if(GetTickCount() > LastRefresh + 1000) {
|
||||
LastRefresh = GetTickCount();
|
||||
SetTimer(hMainDialog, TID_REFRESH_TIMER, 1000, RefreshTimer);
|
||||
}
|
||||
|
@ -2124,7 +2129,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
// Make sure fScale is set before the first call to apply localization, so that move/resize scale appropriately
|
||||
hDC = GetDC(hDlg);
|
||||
fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f;
|
||||
if (hDC != NULL)
|
||||
if(hDC != NULL)
|
||||
ReleaseDC(hDlg, hDC);
|
||||
apply_localization(IDD_DIALOG, hDlg);
|
||||
SetUpdateCheck();
|
||||
|
@ -2137,18 +2142,18 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
GetUSBDevices(0);
|
||||
CheckForUpdates(FALSE);
|
||||
// Register MEDIA_INSERTED/MEDIA_REMOVED notifications for card readers
|
||||
if ((pfSHChangeNotifyRegister != NULL) && (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlDesktop)))) {
|
||||
if((pfSHChangeNotifyRegister != NULL) && (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlDesktop)))) {
|
||||
NotifyEntry.pidl = pidlDesktop;
|
||||
NotifyEntry.fRecursive = TRUE;
|
||||
// NB: The following only works if the media is already formatted.
|
||||
// If you insert a blank card, notifications will not be sent... :(
|
||||
ulRegister = pfSHChangeNotifyRegister(hDlg, 0x0001|0x0002|0x8000,
|
||||
SHCNE_MEDIAINSERTED|SHCNE_MEDIAREMOVED, UM_MEDIA_CHANGE, 1, &NotifyEntry);
|
||||
ulRegister = pfSHChangeNotifyRegister(hDlg, 0x0001 | 0x0002 | 0x8000,
|
||||
SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED, UM_MEDIA_CHANGE, 1, &NotifyEntry);
|
||||
}
|
||||
// Bring our Window on top. We have to go through all *THREE* of these, or Far Manager hides our window :(
|
||||
SetWindowPos(hMainDialog, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
SetWindowPos(hMainDialog, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
SetWindowPos(hMainDialog, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
SetWindowPos(hMainDialog, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
||||
SetWindowPos(hMainDialog, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
||||
SetWindowPos(hMainDialog, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
||||
|
||||
// Set 'Start' as the selected button if it's enabled, otherwise use 'Select ISO', instead
|
||||
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)(IsWindowEnabled(hStart) ? hStart : hSelectISO), TRUE);
|
||||
|
@ -2166,16 +2171,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
|
||||
// The things one must do to get an ellipsis and text alignment on the status bar...
|
||||
case WM_DRAWITEM:
|
||||
if (wParam == IDC_STATUS) {
|
||||
if(wParam == IDC_STATUS) {
|
||||
pDI = (DRAWITEMSTRUCT*)lParam;
|
||||
pDI->rcItem.top -= (int)((4.0f * fScale) - 6.0f);
|
||||
pDI->rcItem.left += (int)(((pDI->itemID == SB_SECTION_MIDDLE)?-2.0f:4.0f) * fScale);
|
||||
pDI->rcItem.left += (int)(((pDI->itemID == SB_SECTION_MIDDLE) ? -2.0f : 4.0f) * fScale);
|
||||
SetBkMode(pDI->hDC, TRANSPARENT);
|
||||
switch(pDI->itemID) {
|
||||
case SB_SECTION_LEFT:
|
||||
SetTextColor(pDI->hDC, GetSysColor(COLOR_BTNTEXT));
|
||||
DrawTextExU(pDI->hDC, szStatusMessage, -1, &pDI->rcItem,
|
||||
DT_LEFT|DT_END_ELLIPSIS|DT_PATH_ELLIPSIS, NULL);
|
||||
DT_LEFT | DT_END_ELLIPSIS | DT_PATH_ELLIPSIS, NULL);
|
||||
return (INT_PTR)TRUE;
|
||||
case SB_SECTION_RIGHT:
|
||||
SetTextColor(pDI->hDC, GetSysColor(COLOR_3DSHADOW));
|
||||
|
@ -2186,12 +2191,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
if ((LOWORD(wParam) >= UM_LANGUAGE_MENU) && (LOWORD(wParam) < UM_LANGUAGE_MENU_MAX)) {
|
||||
if((LOWORD(wParam) >= UM_LANGUAGE_MENU) && (LOWORD(wParam) < UM_LANGUAGE_MENU_MAX)) {
|
||||
selected_language = LOWORD(wParam) - UM_LANGUAGE_MENU;
|
||||
i = 0;
|
||||
list_for_each_entry(lcmd, &locale_list, loc_cmd, list) {
|
||||
if (i++ == selected_language) {
|
||||
if (selected_locale != lcmd) {
|
||||
if(i++ == selected_language) {
|
||||
if(selected_locale != lcmd) {
|
||||
selected_locale = lcmd;
|
||||
selected_langid = get_language_id(lcmd);
|
||||
relaunch = TRUE;
|
||||
|
@ -2206,16 +2211,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case IDCANCEL:
|
||||
PF_INIT(SHChangeNotifyDeregister, Shell32);
|
||||
EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE);
|
||||
if (format_thid != NULL) {
|
||||
if ((no_confirmation_on_cancel) || (MessageBoxExU(hMainDialog, lmprintf(MSG_105), lmprintf(MSG_049),
|
||||
MB_YESNO|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDYES)) {
|
||||
if(format_thid != NULL) {
|
||||
if((no_confirmation_on_cancel) || (MessageBoxExU(hMainDialog, lmprintf(MSG_105), lmprintf(MSG_049),
|
||||
MB_YESNO | MB_ICONWARNING | MB_IS_RTL, selected_langid) == IDYES)) {
|
||||
// Operation may have completed in the meantime
|
||||
if (format_thid != NULL) {
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED;
|
||||
if(format_thid != NULL) {
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_CANCELLED;
|
||||
PrintInfo(0, MSG_201);
|
||||
uprintf("Cancelling");
|
||||
// Start a timer to detect blocking operations during ISO file extraction
|
||||
if (iso_blocking_status >= 0) {
|
||||
if(iso_blocking_status >= 0) {
|
||||
last_iso_blocking_status = iso_blocking_status;
|
||||
SetTimer(hMainDialog, TID_BLOCKING_TIMER, 3000, BlockingTimer);
|
||||
}
|
||||
|
@ -2226,7 +2231,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
no_confirmation_on_cancel = FALSE;
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
if ((pfSHChangeNotifyDeregister != NULL) && (ulRegister != 0))
|
||||
if((pfSHChangeNotifyDeregister != NULL) && (ulRegister != 0))
|
||||
pfSHChangeNotifyDeregister(ulRegister);
|
||||
PostQuitMessage(0);
|
||||
StrArrayDestroy(&DriveID);
|
||||
|
@ -2241,16 +2246,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
break;
|
||||
case IDC_LOG:
|
||||
// Place the log Window to the right (or left for RTL) of our dialog on first display
|
||||
if (first_log_display) {
|
||||
if(first_log_display) {
|
||||
GetClientRect(GetDesktopWindow(), &DesktopRect);
|
||||
GetWindowRect(hLogDlg, &DialogRect);
|
||||
nWidth = DialogRect.right - DialogRect.left;
|
||||
nHeight = DialogRect.bottom - DialogRect.top;
|
||||
GetWindowRect(hDlg, &DialogRect);
|
||||
offset = GetSystemMetrics(SM_CXSIZEFRAME) + (int)(2.0f * fScale);
|
||||
if (nWindowsVersion >= WINDOWS_10)
|
||||
if(nWindowsVersion >= WINDOWS_10)
|
||||
offset += (int)(-14.0f * fScale);
|
||||
if (right_to_left_mode)
|
||||
if(right_to_left_mode)
|
||||
Point.x = max(DialogRect.left - offset - nWidth, 0);
|
||||
else
|
||||
Point.x = min(DialogRect.right + offset, DesktopRect.right - nWidth);
|
||||
|
@ -2260,12 +2265,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
// The log may have been recentered to fit the screen, in which case, try to shift our main dialog left (or right for RTL)
|
||||
nWidth = DialogRect.right - DialogRect.left;
|
||||
nHeight = DialogRect.bottom - DialogRect.top;
|
||||
if (right_to_left_mode) {
|
||||
if(right_to_left_mode) {
|
||||
Point.x = DialogRect.left;
|
||||
GetWindowRect(hLogDlg, &DialogRect);
|
||||
Point.x = max(Point.x, DialogRect.right - DialogRect.left + offset);
|
||||
} else {
|
||||
Point.x = max((DialogRect.left<0)?DialogRect.left:0, Point.x - offset - nWidth);
|
||||
Point.x = max((DialogRect.left < 0) ? DialogRect.left : 0, Point.x - offset - nWidth);
|
||||
}
|
||||
MoveWindow(hDlg, Point.x, Point.y, nWidth, nHeight, TRUE);
|
||||
first_log_display = FALSE;
|
||||
|
@ -2276,7 +2281,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hStart, TRUE);
|
||||
// Must come last for the log window to get focus
|
||||
ShowWindow(hLogDlg, log_displayed?SW_SHOW:SW_HIDE);
|
||||
ShowWindow(hLogDlg, log_displayed ? SW_SHOW : SW_HIDE);
|
||||
break;
|
||||
#ifdef RUFUS_TEST
|
||||
case IDC_TEST:
|
||||
|
@ -2286,39 +2291,39 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
advanced_mode = !advanced_mode;
|
||||
WriteSettingBool(SETTING_ADVANCED_MODE, advanced_mode);
|
||||
ToggleAdvanced(advanced_mode);
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE << 16) | IDC_FILESYSTEM,
|
||||
ComboBox_GetCurSel(hFileSystem));
|
||||
break;
|
||||
case IDC_LABEL:
|
||||
if (HIWORD(wParam) == EN_CHANGE)
|
||||
if(HIWORD(wParam) == EN_CHANGE)
|
||||
user_changed_label = TRUE;
|
||||
break;
|
||||
case IDC_DEVICE:
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
if(HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
nb_devices = ComboBox_GetCount(hDeviceList);
|
||||
PrintStatusDebug(0, (nb_devices==1)?MSG_208:MSG_209, nb_devices);
|
||||
PrintStatusDebug(0, (nb_devices == 1) ? MSG_208 : MSG_209, nb_devices);
|
||||
PopulateProperties(ComboBox_GetCurSel(hDeviceList));
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE << 16) | IDC_FILESYSTEM,
|
||||
ComboBox_GetCurSel(hFileSystem));
|
||||
break;
|
||||
case IDC_NBPASSES:
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
if(HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
SetPassesTooltip();
|
||||
break;
|
||||
case IDC_PARTITION_TYPE:
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
if(HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
SetPartitionSchemeTooltip();
|
||||
SetFSFromISO();
|
||||
// fall-through
|
||||
case IDC_FILESYSTEM:
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
if(HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
if ((selection_default == BT_IMG) && IsChecked(IDC_BOOT)) {
|
||||
if((selection_default == BT_IMG) && IsChecked(IDC_BOOT)) {
|
||||
ToggleImage(FALSE);
|
||||
EnableAdvancedBootOptions(FALSE, TRUE);
|
||||
SetBoot(fs, tt);
|
||||
|
@ -2327,37 +2332,37 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
SetClusterSizes(fs);
|
||||
// Disable/restore the quick format control depending on large FAT32 or ReFS
|
||||
if ( ((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) || (fs == FS_REFS) ) {
|
||||
if (IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) {
|
||||
if(((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) || (fs == FS_REFS)) {
|
||||
if(IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) {
|
||||
uQFChecked = IsChecked(IDC_QUICKFORMAT);
|
||||
CheckDlgButton(hMainDialog, IDC_QUICKFORMAT, BST_CHECKED);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), FALSE);
|
||||
}
|
||||
} else {
|
||||
if (!IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) {
|
||||
if(!IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) {
|
||||
CheckDlgButton(hMainDialog, IDC_QUICKFORMAT, uQFChecked);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), TRUE);
|
||||
}
|
||||
}
|
||||
if (fs < 0) {
|
||||
if(fs < 0) {
|
||||
EnableBootOptions(TRUE, TRUE);
|
||||
SetMBRProps();
|
||||
// Remove the SysLinux and ReactOS options if they exists
|
||||
if (ComboBox_GetItemData(hBootType, ComboBox_GetCount(hBootType)-1) == (BT_MAX-1)) {
|
||||
for (i=BT_SYSLINUX_V4; i<BT_MAX; i++)
|
||||
IGNORE_RETVAL(ComboBox_DeleteString(hBootType, ComboBox_GetCount(hBootType)-1));
|
||||
if(ComboBox_GetItemData(hBootType, ComboBox_GetCount(hBootType) - 1) == (BT_MAX - 1)) {
|
||||
for(i = BT_SYSLINUX_V4; i < BT_MAX; i++)
|
||||
IGNORE_RETVAL(ComboBox_DeleteString(hBootType, ComboBox_GetCount(hBootType) - 1));
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((fs == FS_EXFAT) || (fs == FS_UDF) || (fs == FS_REFS)) {
|
||||
if (IsWindowEnabled(hBoot)) {
|
||||
if((fs == FS_EXFAT) || (fs == FS_UDF) || (fs == FS_REFS)) {
|
||||
if(IsWindowEnabled(hBoot)) {
|
||||
// unlikely to be supported by BIOSes => don't bother
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0));
|
||||
uBootChecked = IsChecked(IDC_BOOT);
|
||||
CheckDlgButton(hDlg, IDC_BOOT, BST_UNCHECKED);
|
||||
EnableBootOptions(FALSE, TRUE);
|
||||
} else if (IsChecked(IDC_BOOT)) {
|
||||
} else if(IsChecked(IDC_BOOT)) {
|
||||
uBootChecked = TRUE;
|
||||
CheckDlgButton(hDlg, IDC_BOOT, BST_UNCHECKED);
|
||||
}
|
||||
|
@ -2371,81 +2376,87 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
break;
|
||||
case IDC_BOOT:
|
||||
EnableAdvancedBootOptions(TRUE, TRUE);
|
||||
if (selection_default == BT_IMG)
|
||||
if(selection_default == BT_IMG)
|
||||
ToggleImage(!IsChecked(IDC_BOOT));
|
||||
|
||||
if(IsChecked(IDC_BOOT)) {
|
||||
SetWindowTextU(hLabel, img_report.label);
|
||||
} else {
|
||||
SetWindowTextU(hLabel, DriveLabel.String[ComboBox_GetCurSel(hDeviceList)]);
|
||||
}
|
||||
break;
|
||||
case IDC_BOOTTYPE:
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
if(HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
selection_default = (int) ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
selection_default = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
EnableAdvancedBootOptions(TRUE, TRUE);
|
||||
ToggleImage(!IsChecked(IDC_BOOT) || (selection_default != BT_IMG));
|
||||
SetToGo();
|
||||
if ((selection_default == BT_ISO) || (selection_default == BT_IMG)) {
|
||||
if ((image_path != NULL) && (img_report.label[0] != 0)) {
|
||||
if((selection_default == BT_ISO) || (selection_default == BT_IMG)) {
|
||||
if((image_path != NULL) && (img_report.label[0] != 0)) {
|
||||
// Some distros (eg. Arch Linux) want to see a specific label => ignore user one
|
||||
SetWindowTextU(hLabel, img_report.label);
|
||||
}
|
||||
} else {
|
||||
if (selection_default == BT_UEFI_NTFS) {
|
||||
if(selection_default == BT_UEFI_NTFS) {
|
||||
// Try to select NTFS as default
|
||||
for (i=0; i<ComboBox_GetCount(hFileSystem); i++) {
|
||||
for(i = 0; i < ComboBox_GetCount(hFileSystem); i++) {
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, i);
|
||||
if (fs == FS_NTFS)
|
||||
if(fs == FS_NTFS)
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, i));
|
||||
}
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE << 16) | IDC_FILESYSTEM,
|
||||
ComboBox_GetCurSel(hFileSystem));
|
||||
}
|
||||
// For non ISO, if the user manually set a label, try to preserve it
|
||||
if (!user_changed_label)
|
||||
if(!user_changed_label)
|
||||
SetWindowTextU(hLabel, SelectedDrive.proposed_label);
|
||||
// Reset disk ID to 0x80 if Rufus MBR is used
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0));
|
||||
}
|
||||
return (INT_PTR)TRUE;
|
||||
case IDC_SELECT_ISO:
|
||||
if (iso_provided) {
|
||||
if(iso_provided) {
|
||||
uprintf("Image provided: '%s'\n", image_path);
|
||||
iso_provided = FALSE; // One off thing...
|
||||
} else {
|
||||
safe_free(image_path);
|
||||
EnableWindow(hStatusToolbar, FALSE);
|
||||
image_path = FileDialog(FALSE, NULL, (selection_default == BT_IMG)?&img_ext:&iso_ext, 0);
|
||||
if (image_path == NULL) {
|
||||
image_path = FileDialog(FALSE, NULL, (selection_default == BT_IMG) ? &img_ext : &iso_ext, 0);
|
||||
if(image_path == NULL) {
|
||||
CreateTooltip(hSelectISO, lmprintf(MSG_173), -1);
|
||||
PrintStatus(0, MSG_086);
|
||||
break;
|
||||
}
|
||||
}
|
||||
FormatStatus = 0;
|
||||
if (CreateThread(NULL, 0, ISOScanThread, NULL, 0, NULL) == NULL) {
|
||||
if(CreateThread(NULL, 0, ISOScanThread, NULL, 0, NULL) == NULL) {
|
||||
uprintf("Unable to start ISO scanning thread");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_START_THREAD);
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD);
|
||||
}
|
||||
break;
|
||||
case IDC_WINDOWS_INSTALL:
|
||||
case IDC_WINDOWS_TO_GO:
|
||||
if ( (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_INSTALL)) == BST_CHECKED) ||
|
||||
(Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED) ) {
|
||||
if((Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_INSTALL)) == BST_CHECKED) ||
|
||||
(Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) {
|
||||
SetFSFromISO();
|
||||
SetMBRProps();
|
||||
SetMBRForUEFI(TRUE);
|
||||
}
|
||||
break;
|
||||
case IDC_RUFUS_MBR:
|
||||
if ((HIWORD(wParam)) == BN_CLICKED)
|
||||
if((HIWORD(wParam)) == BN_CLICKED)
|
||||
mbr_selected_by_user = IsChecked(IDC_RUFUS_MBR);
|
||||
break;
|
||||
case IDC_ENABLE_FIXED_DISKS:
|
||||
if ((HIWORD(wParam)) == BN_CLICKED) {
|
||||
if((HIWORD(wParam)) == BN_CLICKED) {
|
||||
enable_HDDs = !enable_HDDs;
|
||||
PrintStatus2000(lmprintf(MSG_253), enable_HDDs);
|
||||
GetUSBDevices(0);
|
||||
}
|
||||
break;
|
||||
case IDC_START:
|
||||
if (format_thid != NULL) {
|
||||
if(format_thid != NULL) {
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
FormatStatus = 0;
|
||||
|
@ -2458,18 +2469,18 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
SendMessage(hProgress, PBM_SETPOS, 0, 0);
|
||||
selection_default = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
nDeviceIndex = ComboBox_GetCurSel(hDeviceList);
|
||||
if (nDeviceIndex != CB_ERR) {
|
||||
if (!zero_drive) {
|
||||
if ((IsChecked(IDC_BOOT)) && (!BootCheck())) {
|
||||
if(nDeviceIndex != CB_ERR) {
|
||||
if(!zero_drive) {
|
||||
if((IsChecked(IDC_BOOT)) && (!BootCheck())) {
|
||||
format_op_in_progress = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Display a warning about UDF formatting times
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
if (fs == FS_UDF) {
|
||||
if(fs == FS_UDF) {
|
||||
dur_secs = (uint32_t)(((double)SelectedDrive.DiskSize) / 1073741824.0f / UDF_FORMAT_SPEED);
|
||||
if (dur_secs > UDF_FORMAT_WARN) {
|
||||
if(dur_secs > UDF_FORMAT_WARN) {
|
||||
dur_mins = dur_secs / 60;
|
||||
dur_secs -= dur_mins * 60;
|
||||
MessageBoxExU(hMainDialog, lmprintf(MSG_112, dur_mins, dur_secs), lmprintf(MSG_113),
|
||||
|
@ -2481,16 +2492,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
|
||||
// Ask users how they want to write ISOHybrid images
|
||||
if ((IsChecked(IDC_BOOT)) && (img_report.is_bootable_img) &&
|
||||
if((IsChecked(IDC_BOOT)) && (img_report.is_bootable_img) &&
|
||||
(ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)) == BT_ISO)) {
|
||||
char* iso_image = lmprintf(MSG_036);
|
||||
char* dd_image = lmprintf(MSG_095);
|
||||
i = Selection(lmprintf(MSG_274), lmprintf(MSG_275, iso_image, dd_image, iso_image, dd_image),
|
||||
lmprintf(MSG_276, iso_image), lmprintf(MSG_277, dd_image));
|
||||
if (i < 0) { // Cancel
|
||||
if(i < 0) { // Cancel
|
||||
format_op_in_progress = FALSE;
|
||||
break;
|
||||
} else if (i == 2) {
|
||||
} else if(i == 2) {
|
||||
selection_default = BT_IMG;
|
||||
SetComboEntry(hBootType, selection_default);
|
||||
}
|
||||
|
@ -2498,21 +2509,21 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
|
||||
GetWindowTextU(hDeviceList, tmp, ARRAYSIZE(tmp));
|
||||
if (MessageBoxExU(hMainDialog, lmprintf(MSG_003, tmp),
|
||||
APPLICATION_NAME, MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDCANCEL) {
|
||||
if(MessageBoxExU(hMainDialog, lmprintf(MSG_003, tmp),
|
||||
APPLICATION_NAME, MB_OKCANCEL | MB_ICONWARNING | MB_IS_RTL, selected_langid) == IDCANCEL) {
|
||||
format_op_in_progress = FALSE;
|
||||
zero_drive = FALSE;
|
||||
break;
|
||||
}
|
||||
if ((SelectedDrive.nPartitions > 1) && (MessageBoxExU(hMainDialog, lmprintf(MSG_093),
|
||||
lmprintf(MSG_094), MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDCANCEL)) {
|
||||
if((SelectedDrive.nPartitions > 1) && (MessageBoxExU(hMainDialog, lmprintf(MSG_093),
|
||||
lmprintf(MSG_094), MB_OKCANCEL | MB_ICONWARNING | MB_IS_RTL, selected_langid) == IDCANCEL)) {
|
||||
format_op_in_progress = FALSE;
|
||||
zero_drive = FALSE;
|
||||
break;
|
||||
}
|
||||
if ((!zero_drive) && (IsChecked(IDC_BOOT)) && (SelectedDrive.Geometry.BytesPerSector != 512) &&
|
||||
if((!zero_drive) && (IsChecked(IDC_BOOT)) && (SelectedDrive.Geometry.BytesPerSector != 512) &&
|
||||
(MessageBoxExU(hMainDialog, lmprintf(MSG_196, SelectedDrive.Geometry.BytesPerSector),
|
||||
lmprintf(MSG_197), MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDCANCEL)) {
|
||||
lmprintf(MSG_197), MB_OKCANCEL | MB_ICONWARNING | MB_IS_RTL, selected_langid) == IDCANCEL)) {
|
||||
format_op_in_progress = FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -2522,9 +2533,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, nDeviceIndex);
|
||||
InitProgress(zero_drive);
|
||||
format_thid = CreateThread(NULL, 0, FormatThread, (LPVOID)(uintptr_t)DeviceNum, 0, NULL);
|
||||
if (format_thid == NULL) {
|
||||
if(format_thid == NULL) {
|
||||
uprintf("Unable to start formatting thread");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_START_THREAD);
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD);
|
||||
PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0);
|
||||
}
|
||||
uprintf("\r\nFormat operation started");
|
||||
|
@ -2534,13 +2545,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
SendMessageA(hStatus, SB_SETTEXTA, SBT_OWNERDRAW | SB_SECTION_RIGHT, (LPARAM)szTimer);
|
||||
SetTimer(hMainDialog, TID_APP_TIMER, 1000, ClockTimer);
|
||||
}
|
||||
if (format_thid == NULL) {
|
||||
if(format_thid == NULL) {
|
||||
format_op_in_progress = FALSE;
|
||||
zero_drive = FALSE;
|
||||
}
|
||||
break;
|
||||
case IDC_HASH:
|
||||
if ((format_thid == NULL) && (image_path != NULL)) {
|
||||
if((format_thid == NULL) && (image_path != NULL)) {
|
||||
FormatStatus = 0;
|
||||
format_op_in_progress = TRUE;
|
||||
no_confirmation_on_cancel = TRUE;
|
||||
|
@ -2553,7 +2564,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
EnableControls(FALSE);
|
||||
InitProgress(FALSE);
|
||||
format_thid = CreateThread(NULL, 0, SumThread, NULL, 0, NULL);
|
||||
if (format_thid != NULL) {
|
||||
if(format_thid != NULL) {
|
||||
PrintInfo(0, -1);
|
||||
timer = 0;
|
||||
safe_sprintf(szTimer, sizeof(szTimer), "00:00:00");
|
||||
|
@ -2573,12 +2584,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
return (INT_PTR)TRUE;
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
switch(((LPNMHDR)lParam)->code) {
|
||||
case TBN_DROPDOWN:
|
||||
lpnmtb = (LPNMTOOLBAR)lParam;
|
||||
|
||||
// We only care about the language button on the language toolbar
|
||||
if (lpnmtb->hdr.hwndFrom == hLangToolbar
|
||||
if(lpnmtb->hdr.hwndFrom == hLangToolbar
|
||||
&& lpnmtb->iItem == lang_button_id) {
|
||||
// Get toolbar button rect and map it to actual screen pixels
|
||||
SendMessage(lpnmtb->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmtb->iItem, (LPARAM)&LangToolbarRect);
|
||||
|
@ -2595,12 +2606,34 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
|
||||
case WM_CLOSE:
|
||||
case WM_ENDSESSION:
|
||||
if (format_thid != NULL) {
|
||||
if(format_thid != NULL) {
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_DROPFILES:
|
||||
droppedFileInfo = (HDROP)wParam;
|
||||
char buffer[MAX_PATH];
|
||||
|
||||
DragQueryFileA(droppedFileInfo, 0, buffer, MAX_PATH);
|
||||
|
||||
safe_free(image_path);
|
||||
image_path = safe_strdup(buffer);
|
||||
|
||||
if(image_path == NULL) {
|
||||
CreateTooltip(hSelectISO, lmprintf(MSG_173), -1);
|
||||
PrintStatus(0, MSG_086);
|
||||
break;
|
||||
} else {
|
||||
FormatStatus = 0;
|
||||
if(CreateThread(NULL, 0, ISOScanThread, NULL, 0, NULL) == NULL) {
|
||||
uprintf("Unable to start ISO scanning thread");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case UM_PROGRESS_INIT:
|
||||
isMarquee = (wParam == PBS_MARQUEE);
|
||||
if (isMarquee) {
|
||||
|
@ -3020,6 +3053,11 @@ relaunch:
|
|||
ShowWindow(hDlg, SW_SHOWNORMAL);
|
||||
UpdateWindow(hDlg);
|
||||
|
||||
// Have to call these to let the drag-n-drop through the message filter
|
||||
ChangeWindowMessageFilterEx(hDlg, WM_DROPFILES, MSGFLT_ALLOW, NULL);
|
||||
ChangeWindowMessageFilterEx(hDlg, WM_COPYDATA, MSGFLT_ALLOW, NULL);
|
||||
ChangeWindowMessageFilterEx(hDlg, 0x49, MSGFLT_ALLOW, NULL);
|
||||
|
||||
// Do our own event processing and process "magic" commands
|
||||
while(GetMessage(&msg, NULL, 0, 0)) {
|
||||
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -32,6 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
|
||||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 2.7.825"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
|
@ -79,8 +80,8 @@ CAPTION "About Rufus"
|
|||
FONT 8, "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
|
||||
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,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
|
||||
|
@ -156,7 +157,7 @@ FONT 8, "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
|
||||
|
@ -361,11 +362,8 @@ END
|
|||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON ICON "../res/rufus.ico"
|
||||
|
||||
IDI_UP ICON "../res/up.ico"
|
||||
|
||||
IDI_DOWN ICON "../res/down.ico"
|
||||
|
||||
#endif // Neutral resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue