1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2026-10-22 22:34:26 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
Pete Batard
b4a62a4e01
[net] Don't remove an existing file in case of a download failure 2026-09-08 16:50:01 +01:00
Pete Batard
482cdb53e7
[dev] add more exceptions to the UFD vs HDD list
* Closes #3035.
* Closes #3036.
2026-09-08 12:59:29 +01:00
Pete Batard
a4c37ac34a
[wue] fix silent option being potentially applied when its dependencies aren't met
* Also add a warning sign to the log report when the option is used.
* Closes #3008.
2026-09-08 12:42:38 +01:00
6 changed files with 28 additions and 14 deletions

View file

@ -420,9 +420,9 @@ BOOL GetOpticalMedia(IMG_SAVE* img_save)
/* For debugging user reports of HDDs vs UFDs */ /* For debugging user reports of HDDs vs UFDs */
//#define FORCED_DEVICE //#define FORCED_DEVICE
#ifdef FORCED_DEVICE #ifdef FORCED_DEVICE
#define FORCED_VID 0x0781 #define FORCED_VID 0x1058
#define FORCED_PID 0x55A9 #define FORCED_PID 0x0702
#define FORCED_NAME " USB SanDisk 3.2Gen1 UAS Device" #define FORCED_NAME "WD 1200BEVExternal USB Device"
#endif #endif
void ClearDrives(void) void ClearDrives(void)

View file

@ -88,6 +88,7 @@ static str_score_t str_score[] = {
}; };
static str_score_t str_adjust[] = { static str_score_t str_adjust[] = {
{ "SSK Port able", -20 },
{ "Gadget", -10 }, { "Gadget", -10 },
{ "Flash", -10 }, { "Flash", -10 },
{ "SD-CARD", -10 }, { "SD-CARD", -10 },
@ -95,7 +96,7 @@ static str_score_t str_adjust[] = {
{ "HDD", +20 }, { "HDD", +20 },
{ "SATA", +20 }, { "SATA", +20 },
{ "SCSI", +20 }, { "SCSI", +20 },
{ "SSD", +20 } { "SSD", +20 },
}; };
/* The lists belows set a score according to VID & VID:PID /* The lists belows set a score according to VID & VID:PID
@ -209,6 +210,7 @@ static vidpid_score_t vidpid_score[] = {
{ 0x0c0b, 0xb159, 10 }, // Dura Micro 509 { 0x0c0b, 0xb159, 10 }, // Dura Micro 509
// Meh // Meh
{ 0x0e21, 0x0510, 5 }, // Cowon iAudio X5 { 0x0e21, 0x0510, 5 }, // Cowon iAudio X5
{ 0x1058, 0x0702, 5 }, // WD 1200BEVExternal HDD
{ 0x11b0, 0x6298, 10 }, // Enclosure from Kingston SSDNow notebook upgrade kit { 0x11b0, 0x6298, 10 }, // Enclosure from Kingston SSDNow notebook upgrade kit
// NOT in VID list as plenty of UFDs // NOT in VID list as plenty of UFDs
{ 0x125f, 0xa93a, 10 }, // A-DATA SH93 { 0x125f, 0xa93a, 10 }, // A-DATA SH93

View file

@ -173,7 +173,7 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
const char* accept_types[] = {"*/*\0", NULL}; const char* accept_types[] = {"*/*\0", NULL};
const char* short_name; const char* short_name;
unsigned char buf[DOWNLOAD_BUFFER_SIZE]; unsigned char buf[DOWNLOAD_BUFFER_SIZE];
char hostname[64], urlpath[128], strsize[32]; char hostname[64], urlpath[128], strsize[32], *bak_file = NULL;
BOOL r = FALSE; BOOL r = FALSE;
DWORD dwSize, dwWritten, dwDownloaded; DWORD dwSize, dwWritten, dwDownloaded;
HANDLE hFile = INVALID_HANDLE_VALUE; HANDLE hFile = INVALID_HANDLE_VALUE;
@ -198,6 +198,13 @@ uint64_t DownloadToFileOrBufferEx(const char* url, const char* file, const char*
uprintf("Downloading %s", url); uprintf("Downloading %s", url);
} }
// If an old file with the same name exists, rename it so we can restore it in case of failure
if (file != NULL && PathFileExistsU((char*)file) && (bak_file = calloc(1, strlen(file) + 6)) != NULL) {
strcpy(bak_file, file);
strcat(bak_file, ".bak");
MoveFileU(file, bak_file);
}
if ( (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts)) if ( (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts))
|| (UrlParts.lpszHostName == NULL) || (UrlParts.lpszUrlPath == NULL)) { || (UrlParts.lpszHostName == NULL) || (UrlParts.lpszUrlPath == NULL)) {
uprintf("Unable to decode URL: %s", WindowsErrorString()); uprintf("Unable to decode URL: %s", WindowsErrorString());
@ -327,8 +334,12 @@ out:
if (!r) { if (!r) {
if (file != NULL) if (file != NULL)
DeleteFileU(file); DeleteFileU(file);
if (bak_file != NULL)
MoveFileU(bak_file, file);
if (buffer != NULL) if (buffer != NULL)
safe_free(*buffer); safe_free(*buffer);
} else if (bak_file != NULL) {
DeleteFileU(bak_file);
} }
if (hRequest) if (hRequest)
InternetCloseHandle(hRequest); InternetCloseHandle(hRequest);

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.15.2400" CAPTION "Rufus 4.15.2403"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -409,8 +409,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,15,2400,0 FILEVERSION 4,15,2403,0
PRODUCTVERSION 4,15,2400,0 PRODUCTVERSION 4,15,2403,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -428,13 +428,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.15.2400" VALUE "FileVersion", "4.15.2403"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2026 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2026 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.15.exe" VALUE "OriginalFilename", "rufus-4.15.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.15.2400" VALUE "ProductVersion", "4.15.2403"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1080,8 +1080,8 @@ static INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam
} else switch (LOWORD(wParam)) { } else switch (LOWORD(wParam)) {
case IDOK: case IDOK:
// Produce a big scary warning if the silent install option was selected // Produce a big scary warning if the silent install option was selected
if (selection_data[s].options->edition_index > 0 && hCtrl = GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + selection_data[s].options->edition_index - 1);
Button_GetCheck(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + selection_data[s].options->edition_index - 1))) { if (selection_data[s].options->edition_index > 0 && IsWindowVisible(hCtrl) && Button_GetCheck(hCtrl)) {
selection_dialog_options_t selection = { 0 }; selection_dialog_options_t selection = { 0 };
selection.style = BS_AUTOCHECKBOX; selection.style = BS_AUTOCHECKBOX;
selection.flags = SELECTION_NEEDS_ALL_TO_PROCEED | SELECTION_USE_WARNING_ICON; selection.flags = SELECTION_NEEDS_ALL_TO_PROCEED | SELECTION_USE_WARNING_ICON;
@ -1095,7 +1095,8 @@ static INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam
break; break;
} }
for (r = 0, i = 0, m = 1; i < nDialogItems; i++, m <<= 1) for (r = 0, i = 0, m = 1; i < nDialogItems; i++, m <<= 1)
if (Button_GetCheck(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i)) == BST_CHECKED) if (Button_GetCheck(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i)) == BST_CHECKED &&
IsWindowVisible(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i)))
r += m; r += m;
if (selection_data[s].options->username_index > 0) { if (selection_data[s].options->username_index > 0) {
GetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_USERNAME), unattend_username, MAX_USERNAME_LENGTH); GetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_USERNAME), unattend_username, MAX_USERNAME_LENGTH);

View file

@ -150,7 +150,7 @@ char* CreateUnattendXml(int arch, int flags)
fprintf(fd, " </ProductKey>\n"); fprintf(fd, " </ProductKey>\n");
fprintf(fd, " </UserData>\n"); fprintf(fd, " </UserData>\n");
if (flags & UNATTEND_SILENT_INSTALL) { if (flags & UNATTEND_SILENT_INSTALL) {
uprintf("• Silent Install"); uprintf("• ⚠Silent Install⚠");
// Automatically partition the disk and set the installation target // Automatically partition the disk and set the installation target
fprintf(fd, " <DiskConfiguration>\n"); fprintf(fd, " <DiskConfiguration>\n");
fprintf(fd, " <WillShowUI>OnError</WillShowUI>\n"); fprintf(fd, " <WillShowUI>OnError</WillShowUI>\n");