diff --git a/res/loc/ChangeLog.txt b/res/loc/ChangeLog.txt index baeb197d..86c9cb11 100644 --- a/res/loc/ChangeLog.txt +++ b/res/loc/ChangeLog.txt @@ -13,8 +13,7 @@ o v3.20 (2022.??.??) - *NEW* MSG_328 "Remove requirement for Secure Boot and TPM 2.0" - *NEW* MSG_329 "Remove requirement for 4GB+ RAM and 64GB+ disk" - *NEW* MSG_330 "Remove requirement for an online Microsoft account" - - *NEW* MSG_331 "Remove \"unsupported hardware\" desktop watermark" - - *NEW* MSG_332 "Disable data collection (Skip privacy questions)" + - *NEW* MSG_331 "Disable data collection (Skip privacy questions)" o v3.14 (2021.03.31) - *UPDATED* MSG_068 "Error while partitioning drive." -> "Could not partition drive." diff --git a/res/loc/rufus.loc b/res/loc/rufus.loc index 1ebc33bd..8237af9b 100644 --- a/res/loc/rufus.loc +++ b/res/loc/rufus.loc @@ -588,8 +588,7 @@ t MSG_327 "Customize Windows installation?" t MSG_328 "Remove requirement for Secure Boot and TPM 2.0" t MSG_329 "Remove requirement for 4GB+ RAM and 64GB+ disk" t MSG_330 "Remove requirement for an online Microsoft account" -t MSG_331 "Remove \"unsupported hardware\" desktop watermark" -t MSG_332 "Disable data collection (Skip privacy questions)" +t MSG_331 "Disable data collection (Skip privacy questions)" ######################################################################### l "ar-SA" "Arabic (العربية)" 0x0401, 0x0801, 0x0c01, 0x1001, 0x1401, 0x1801, 0x1c01, 0x2001, 0x2401, 0x2801, 0x2c01, 0x3001, 0x3401, 0x3801, 0x3c01, 0x4001 diff --git a/src/dev.c b/src/dev.c index 227fbd85..14ca0b52 100644 --- a/src/dev.c +++ b/src/dev.c @@ -807,8 +807,10 @@ BOOL GetDevices(DWORD devnum) continue; if ((props.vid == 0x0781) && (props.pid == 0x75a0)) continue; + if ((props.vid == 0x10d6) && (props.pid == 0x1101)) + continue; } - // Also ignore USB devices that have been specifically flaggged by the user + // Also ignore USB devices that have been specifically flagged by the user for (s = 0; s < ARRAYSIZE(ignore_vid_pid); s++) { if ((props.vid == (ignore_vid_pid[s] >> 16)) && (props.pid == (ignore_vid_pid[s] & 0xffff))) { uprintf("Ignoring '%s' (%s), per user settings", buffer, str); diff --git a/src/format.c b/src/format.c index 414cf1fc..e801d422 100644 --- a/src/format.c +++ b/src/format.c @@ -1250,11 +1250,11 @@ out: // Returns -2 on user cancel, -1 on other error, >=0 on success. int SetWinToGoIndex(void) { - char *mounted_iso, *build, mounted_image_path[128]; + char *mounted_iso, *val, mounted_image_path[128]; char xml_file[MAX_PATH] = ""; char *install_names[MAX_WININST]; StrArray version_name, version_index; - int i, build_nr = 0; + int i; BOOL bNonStandard = FALSE; // Sanity checks @@ -1334,21 +1334,34 @@ int SetWinToGoIndex(void) else wintogo_index = atoi(version_index.String[i - 1]); if (i > 0) { - // Get the build version - build = get_token_data_file_indexed("BUILD", xml_file, i); - if (build != NULL) - build_nr = atoi(build); - free(build); + // Get the version data from the XML index + val = get_token_data_file_indexed("MAJOR", xml_file, i); + img_report.win_version.major = (uint16_t)safe_atoi(val); + free(val); + val = get_token_data_file_indexed("MINOR", xml_file, i); + img_report.win_version.minor = (uint16_t)safe_atoi(val); + free(val); + val = get_token_data_file_indexed("BUILD", xml_file, i); + img_report.win_version.build = (uint16_t)safe_atoi(val); + free(val); + val = get_token_data_file_indexed("SPBUILD", xml_file, i); + img_report.win_version.revision = (uint16_t)safe_atoi(val); + free(val); + if ((img_report.win_version.major == 10) && (img_report.win_version.build > 20000)) + img_report.win_version.major = 11; + // If we couldn't obtain the major and build, we have a problem + if (img_report.win_version.major == 0 || img_report.win_version.build == 0) + uprintf("Warning: Could not obtain version information from XML index (Nonstandard Windows image?)"); uprintf("Will use '%s' (Build: %d, Index %s) for Windows To Go", - version_name.String[i - 1], build_nr, version_index.String[i - 1]); + version_name.String[i - 1], img_report.win_version.build, version_index.String[i - 1]); // Need Windows 10 Creator Update or later for boot on REMOVABLE to work - if ((build_nr < 15000) && (SelectedDrive.MediaType != FixedMedia)) { + if ((img_report.win_version.build < 15000) && (SelectedDrive.MediaType != FixedMedia)) { if (MessageBoxExU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_190), MB_YESNO | MB_ICONWARNING | MB_IS_RTL, selected_langid) != IDYES) wintogo_index = -2; } // Display a notice about WppRecorder.sys for 1809 ISOs - if (build_nr == 17763) { + if (img_report.win_version.build == 17763) { notification_info more_info; more_info.id = MORE_INFO_URL; more_info.url = WPPRECORDER_MORE_INFO_URL; diff --git a/src/missing.h b/src/missing.h index 04539604..a204d1b0 100644 --- a/src/missing.h +++ b/src/missing.h @@ -115,6 +115,22 @@ static __inline int _log2(register int val) return ret; } +// Remap bits from a byte according to an 8x8 bit matrix +static __inline uint8_t remap8(uint8_t src, uint8_t* map, const BOOL reverse) +{ + uint8_t i, m = 1, r = 0; + for (i = 0, m = 1; i < 8; i++, m <<= 1) { + if (reverse) { + if (src & map[i]) + r |= m; + } else { + if (src & m) + r |= map[i]; + } + } + return r; +} + /* Why oh why does Microsoft have to make everybody suffer with their braindead use of Unicode? */ #define _RT_ICON MAKEINTRESOURCEA(3) #define _RT_DIALOG MAKEINTRESOURCEA(5) diff --git a/src/rufus.c b/src/rufus.c index eb5ea313..7d8ad72a 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -63,12 +63,11 @@ enum bootcheck_return { #define UNATTEND_SECUREBOOT_TPM_MASK 0x01 #define UNATTEND_MINRAM_MINDISK_MASK 0x02 #define UNATTEND_NO_ONLINE_ACCOUNT_MASK 0x04 -#define UNATTEND_REMOVE_WATERMARK_MASK 0x08 -#define UNATTEND_NO_DATA_COLLECTION_MASK 0x10 +#define UNATTEND_NO_DATA_COLLECTION_MASK 0x08 #define UNATTEND_WINPE_SETUP_MASK (UNATTEND_SECUREBOOT_TPM_MASK | UNATTEND_MINRAM_MINDISK_MASK) -#define UNATTEND_SPECIALIZE_DEPLOYMENT_MASK (UNATTEND_NO_ONLINE_ACCOUNT_MASK | UNATTEND_REMOVE_WATERMARK_MASK) -#define UNATTEND_OOBE_SHELL_SETUP (UNATTEND_REMOVE_WATERMARK_MASK | UNATTEND_NO_DATA_COLLECTION_MASK) +#define UNATTEND_SPECIALIZE_DEPLOYMENT_MASK (UNATTEND_NO_ONLINE_ACCOUNT_MASK) +#define UNATTEND_OOBE_SHELL_SETUP (UNATTEND_NO_DATA_COLLECTION_MASK) static const char* cmdline_hogger = "rufus.com"; static const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"; @@ -89,8 +88,7 @@ static BOOL allowed_filesystem[FS_MAX] = { 0 }; static int64_t last_iso_blocking_status; static int selected_pt = -1, selected_fs = FS_UNKNOWN, preselected_fs = FS_UNKNOWN; static int image_index = 0, select_index = 0; -static int unattend_xml_mask = (UNATTEND_SECUREBOOT_TPM_MASK | UNATTEND_NO_ONLINE_ACCOUNT_MASK | - UNATTEND_REMOVE_WATERMARK_MASK); +static int unattend_xml_mask = (UNATTEND_SECUREBOOT_TPM_MASK | UNATTEND_NO_ONLINE_ACCOUNT_MASK); static RECT relaunch_rc = { -65536, -65536, 0, 0}; static UINT uMBRChecked = BST_UNCHECKED; static HANDLE format_thread = NULL; @@ -1266,7 +1264,6 @@ static char* CreateUnattendXml(int arch, int mask) static char path[MAX_PATH]; FILE* fd; int i, order; - // I don't believe there's a version of Windows 11 for ARM32 but whatever... const char* xml_arch_names[5] = { "x86", "amd64", "arm", "arm64" }; const char* bypass_name[4] = { "BypassTPMCheck", "BypassSecureBootCheck", "BypassRAMCheck", "BypassStorageCheck" }; if (arch < ARCH_X86_32 || arch >= ARCH_ARM_64 || mask == 0) @@ -1311,7 +1308,6 @@ static char* CreateUnattendXml(int arch, int mask) fprintf(fd, " \n"); } - // This part and some of OOBE was picked from https://github.com/AveYo/MediaCreationTool.bat/blob/main/bypass11/AutoUnattend.xml if (mask & UNATTEND_SPECIALIZE_DEPLOYMENT_MASK) { order = 1; fprintf(fd, " \n"); @@ -1319,22 +1315,13 @@ static char* CreateUnattendXml(int arch, int mask) "xmlns:wcm=\"http://schemas.microsoft.com/WMIConfig/2002/State\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " "publicKeyToken=\"31bf3856ad364e35\" versionScope=\"nonSxS\">\n", xml_arch_names[arch]); fprintf(fd, " \n"); + // This part was picked from https://github.com/AveYo/MediaCreationTool.bat/blob/main/bypass11/AutoUnattend.xml if (mask & UNATTEND_NO_ONLINE_ACCOUNT_MASK) { fprintf(fd, " \n"); fprintf(fd, " %d\n", order++); fprintf(fd, " reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\OOBE /v BypassNRO /t REG_DWORD /d 1 /f\n"); fprintf(fd, " \n"); } - if (mask & UNATTEND_SPECIALIZE_DEPLOYMENT_MASK) { - fprintf(fd, " \n"); - fprintf(fd, " %d\n", order++); - fprintf(fd, " reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate /v TargetReleaseVersion /t REG_DWORD /d 1 /f\n"); - fprintf(fd, " \n"); - fprintf(fd, " \n"); - fprintf(fd, " %d\n", order++); - fprintf(fd, " reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate /v TargetReleaseVersionInfo /t REG_SZ /d 25H1 /f\n"); - fprintf(fd, " \n"); - } fprintf(fd, " \n"); fprintf(fd, " \n"); fprintf(fd, " \n"); @@ -1346,18 +1333,6 @@ static char* CreateUnattendXml(int arch, int mask) fprintf(fd, " \n", xml_arch_names[arch]); - if (mask & UNATTEND_REMOVE_WATERMARK_MASK) { - fprintf(fd, " \n"); - fprintf(fd, " \n"); - fprintf(fd, " %d\n", order++); - fprintf(fd, " reg add \"HKCU\\Control Panel\\UnsupportedHardwareNotificationCache\" /v SV1 /t REG_DWORD /d 0 /f\n"); - fprintf(fd, " \n"); - fprintf(fd, " \n"); - fprintf(fd, " %d\n", order++); - fprintf(fd, " reg add \"HKCU\\Control Panel\\UnsupportedHardwareNotificationCache\" /v SV2 /t REG_DWORD /d 0 /f\n"); - fprintf(fd, " \n"); - fprintf(fd, " \n"); - } // https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-oobe-protectyourpc // It is really super insidous of Microsoft to call this option "ProtectYourPC", when it's really only about // data collection. But of course, if it was called "AllowDataCollection", everyone would turn it off... @@ -1525,6 +1500,8 @@ out: ExitThread(0); } +#define MAP_BIT(bit) do { map[_log2(bit)] = b; b <<= 1; } while(0) + // Likewise, boot check will block message processing => use a thread static DWORD WINAPI BootCheckThread(LPVOID param) { @@ -1621,20 +1598,29 @@ static DWORD WINAPI BootCheckThread(LPVOID param) default: break; } - if ((nWindowsVersion >= WINDOWS_8) && IS_WINDOWS_11(img_report) && (img_report.win_version.build >= 22500)) { + if ((nWindowsVersion >= WINDOWS_8) && IS_WINDOWS_11(img_report)) { StrArray options; int arch = _log2(img_report.has_efi >> 1); - StrArrayCreate(&options, 4); - StrArrayAdd(&options, lmprintf(MSG_330), TRUE); + uint8_t map[8] = { 0 }, b = 1; + StrArrayCreate(&options, 2); + if (img_report.win_version.build >= 22500) { + StrArrayAdd(&options, lmprintf(MSG_330), TRUE); + MAP_BIT(UNATTEND_NO_ONLINE_ACCOUNT_MASK); + } StrArrayAdd(&options, lmprintf(MSG_331), TRUE); - StrArrayAdd(&options, lmprintf(MSG_332), TRUE); - i = SelectionDialog(BS_AUTOCHECKBOX, lmprintf(MSG_326), lmprintf(MSG_327), options.String, options.Index, unattend_xml_mask >> 2); + MAP_BIT(UNATTEND_NO_DATA_COLLECTION_MASK); + i = SelectionDialog(BS_AUTOCHECKBOX, lmprintf(MSG_326), lmprintf(MSG_327), + options.String, options.Index, remap8(unattend_xml_mask, map, FALSE)); StrArrayDestroy(&options); if (i < 0) goto out; - i <<= 2; + // Remap i to the correct bit positions before calling CreateUnattendXml() + i = remap8(i, map, TRUE); unattend_xml_path = CreateUnattendXml(arch, i); - unattend_xml_mask = (unattend_xml_mask & 0x03) | (i & (~0x03)); + // Keep the bits we didn't process + unattend_xml_mask &= ~(remap8(0xff, map, TRUE)); + // And add back the bits we did process + unattend_xml_mask |= i; } } else if (target_type == TT_UEFI) { if (!IS_EFI_BOOTABLE(img_report)) { @@ -1651,24 +1637,29 @@ static DWORD WINAPI BootCheckThread(LPVOID param) if ((nWindowsVersion >= WINDOWS_8) && IS_WINDOWS_11(img_report)) { StrArray options; int arch = _log2(img_report.has_efi >> 1); - StrArrayCreate(&options, 5); + uint8_t map[8] = { 0 }, b = 1; + StrArrayCreate(&options, 4); StrArrayAdd(&options, lmprintf(MSG_328), TRUE); + MAP_BIT(UNATTEND_SECUREBOOT_TPM_MASK); StrArrayAdd(&options, lmprintf(MSG_329), TRUE); + MAP_BIT(UNATTEND_MINRAM_MINDISK_MASK); if (img_report.win_version.build >= 22500) { StrArrayAdd(&options, lmprintf(MSG_330), TRUE); - StrArrayAdd(&options, lmprintf(MSG_331), TRUE); + MAP_BIT(UNATTEND_NO_ONLINE_ACCOUNT_MASK); } - StrArrayAdd(&options, lmprintf(MSG_332), TRUE); - i = SelectionDialog(BS_AUTOCHECKBOX, lmprintf(MSG_326), lmprintf(MSG_327), options.String, options.Index, unattend_xml_mask); + StrArrayAdd(&options, lmprintf(MSG_331), TRUE); + MAP_BIT(UNATTEND_NO_DATA_COLLECTION_MASK); + i = SelectionDialog(BS_AUTOCHECKBOX, lmprintf(MSG_326), lmprintf(MSG_327), + options.String, options.Index, remap8(unattend_xml_mask, map, FALSE)); StrArrayDestroy(&options); if (i < 0) goto out; + i = remap8(i, map, TRUE); unattend_xml_path = CreateUnattendXml(arch, i); // Remember the user preferences for the current session. // TODO: Do we want to save the current mask as a permanent setting? - unattend_xml_mask = (unattend_xml_mask & (~0x3)) | (i & 0x03); - if (img_report.win_version.build >= 22500) - unattend_xml_mask = (unattend_xml_mask & 0x03) | (i & (~0x3)); + unattend_xml_mask &= ~(remap8(0xff, map, TRUE)); + unattend_xml_mask |= i; } } else if ( ((fs_type == FS_NTFS) && !HAS_WINDOWS(img_report) && !HAS_GRUB(img_report) && (!HAS_SYSLINUX(img_report) || (SL_MAJOR(img_report.sl_version) <= 5))) diff --git a/src/rufus.h b/src/rufus.h index 68bcca75..2f3598d4 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -85,11 +85,7 @@ #define STATUS_MSG_TIMEOUT 3500 // How long should cheat mode messages appear for on the status bar #define WRITE_RETRIES 4 #define WRITE_TIMEOUT 5000 // How long we should wait between write retries (in ms) -#if defined(_DEBUG) -#define SEARCH_PROCESS_TIMEOUT 60000 -#else #define SEARCH_PROCESS_TIMEOUT 10000 // How long we should search for conflicting processes before giving up (in ms) -#endif #define NET_SESSION_TIMEOUT 3500 // How long we should wait to connect, send or receive internet data #define MARQUEE_TIMER_REFRESH 10 // Time between progress bar marquee refreshes, in ms #define FS_DEFAULT FS_FAT32 @@ -161,6 +157,7 @@ #define safe_release_dc(hDlg, hDC) do {if ((hDC != INVALID_HANDLE_VALUE) && (hDC != NULL)) {ReleaseDC(hDlg, hDC); hDC = NULL;}} while(0) #define safe_sprintf(dst, count, ...) do {_snprintf(dst, count, __VA_ARGS__); (dst)[(count)-1] = 0; } while(0) #define static_sprintf(dst, ...) safe_sprintf(dst, sizeof(dst), __VA_ARGS__) +#define safe_atoi(str) ((((char*)(str))==NULL)?0:atoi(str)) #define safe_strlen(str) ((((char*)(str))==NULL)?0:strlen(str)) #define safe_strdup _strdup #define to_windows_path(str) do { size_t __i; for (__i = 0; __i < safe_strlen(str); __i++) if (str[__i] == '/') str[__i] = '\\'; } while(0) diff --git a/src/rufus.rc b/src/rufus.rc index a9850617..ec70f56d 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 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 3.19.1903" +CAPTION "Rufus 3.19.1904" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -159,7 +159,7 @@ BEGIN 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 2",IDC_SELECTION_CHOICE2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,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 CONTROL "Choice 4",IDC_SELECTION_CHOICE4,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,35,57,269,10,WS_EX_TRANSPARENT CONTROL "Choice 5",IDC_SELECTION_CHOICE5,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,35,70,269,10,WS_EX_TRANSPARENT @@ -395,8 +395,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,19,1903,0 - PRODUCTVERSION 3,19,1903,0 + FILEVERSION 3,19,1904,0 + PRODUCTVERSION 3,19,1904,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -414,13 +414,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.19.1903" + VALUE "FileVersion", "3.19.1904" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.19.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.19.1903" + VALUE "ProductVersion", "3.19.1904" END END BLOCK "VarFileInfo"