1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] add a new selection dialog for Windows 11 setup customization

* This moves the extended Windows 11 options (bypass TPM & Secure Boot) away from
  "Image options" into a new explicit dialog, along with supplementary customization
  such as enabling offline account (for Windows 11 22H2) and skipping all data
  collection questions.
* This customization is now enacted through an unattend.xml file rather than offline
  registry manipulation, so that this *should* also work with the Windows Store version.
* Also update arch detection and rework/reorganize upcoming translation changes.
* Note: The 'Remove "unsupported hardware" desktop watermark' option is *UNTESTED*.
This commit is contained in:
Pete Batard 2022-06-23 13:34:24 +01:00
parent 9690742d91
commit a0d669232c
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
11 changed files with 317 additions and 179 deletions

View file

@ -5,12 +5,16 @@ To edit a translation, please make sure to follow:
https://github.com/pbatard/rufus/wiki/Localization#Editing_an_existing_translation
Or simply download https://rufus-web.akeo.ie/locale/pollock.exe and follow its directions.
o v3.?? (????.??.??)
- *UPDATED* MSG_305 Reworked the message to mention the new Windows 11 Extended option
- *NEW* MSG_322 "Standard Windows 11 Installation (TPM 2.0 + Secure Boot)"
- *NEW* MSG_323 "Extended Windows 11 Installation (no TPM / no Secure Boot)"
- *NEW* MSG_324 "Removing Windows 11 installation restrictions: %s"
- *NEW* MSG_325 "Unable to open or read '%s'"
o v3.20 (2022.??.??)
- *NEW* MSG_323 "Unable to open or read '%s'"
- *NEW* MSG_325 "Applying Windows customization: %s"
- *NEW* MSG_326 "Windows User Experience"
- *NEW* MSG_327 "Customize Windows installation?"
- *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)"
o v3.14 (2021.03.31)
- *UPDATED* MSG_068 "Error while partitioning drive." -> "Could not partition drive."

View file

@ -559,9 +559,7 @@ t MSG_301 "Show application settings"
t MSG_302 "Show information about this application"
t MSG_303 "Show the log"
t MSG_304 "Create a disk image of the selected device"
t MSG_305 "Use this option to indicate if you plan to install Windows to a different disk, or if you want to run Windows "
"directly from this drive (Windows To Go).\r\nIn 'Extended Windows 11 Installation' mode, Rufus will patch the "
"media so that Windows 11 can be installed on platforms that don't meet the TPM 2.0 or Secure Boot requirements."
t MSG_305 "Use this option to indicate if you plan to install Windows to a different disk, or if you want to run Windows directly from this drive (Windows To Go)."
# You can see this status message by pressing <Ctrl>-<Alt>-<Z> and then selecting START.
# It's the same as MSG_286 but with a process that *may* be faster, hence the name.
t MSG_306 "Fast-zeroing drive: %s"
@ -583,10 +581,15 @@ t MSG_319 "Ignore Boot Marker"
t MSG_320 "Refreshing partition layout (%s)..."
t MSG_321 "The image you have selected is an ISOHybrid, but its creators have not made it compatible with ISO/File "
"copy mode.\nAs a result, DD image writing mode will be enforced."
t MSG_322 "Standard Windows 11 Installation (TPM 2.0 + Secure Boot)"
t MSG_323 "Extended Windows 11 Installation (no TPM / no Secure Boot)"
t MSG_324 "Removing Windows 11 installation restrictions: %s"
t MSG_325 "Unable to open or read '%s'"
t MSG_322 "Unable to open or read '%s'"
t MSG_325 "Applying Windows customization: %s"
t MSG_326 "Windows User Experience"
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)"
#########################################################################
l "ar-SA" "Arabic (العربية)" 0x0401, 0x0801, 0x0c01, 0x1001, 0x1401, 0x1801, 0x1c01, 0x2001, 0x2401, 0x2801, 0x2c01, 0x3001, 0x3401, 0x3801, 0x3c01, 0x4001
@ -2061,7 +2064,7 @@ t MSG_301 "顯示應用程式設定"
t MSG_302 "顯示此應用程式資訊"
t MSG_303 "顯示記錄檔"
t MSG_304 "建立選擇的裝置的磁碟映像"
t MSG_305 "是否要使用此裝置來安裝 Windows 在另一個磁碟上,或是要直接在此磁碟上執行 Windows (Windows To Go)。\r\n在「擴充 Windows 11 安裝」模式中Rufus 將修補裝置,以使 Windows 11 能夠安裝在不符合 TPM 2.0 或安全開機要求的系統上。"
t MSG_305 "是否要使用此裝置來安裝 Windows 在另一個磁碟上,或是要直接在此磁碟上執行 Windows (Windows To Go)。"
t MSG_306 "正在快速寫入零: %s"
t MSG_307 "可能需要一段時間"
t MSG_308 "虛擬硬碟偵測"
@ -2078,10 +2081,7 @@ t MSG_318 "預設執行緒優先順序: %d"
t MSG_319 "忽略 Boot Marker"
t MSG_320 "正在重新整理磁區分割 (%s)..."
t MSG_321 "你選擇的映像檔是 ISOHybrid但是檔案作者沒有使之與 ISO/檔案複製模式相容。\n因此強制使用 DD 映像寫入模式。"
t MSG_322 "標準 Windows 11 安裝 (TPM 2.0 + 安全開機)"
t MSG_323 "擴充 Windows 11 安裝 (無 TPM 和安全開機)"
t MSG_324 "正在移除 Windows 11 安裝限制: %s"
t MSG_325 "無法開啟或讀取 '%s'"
t MSG_322 "無法開啟或讀取 '%s'"
#########################################################################
l "hr-HR" "Croatian (Hrvatski)" 0x041a, 0x081a, 0x101a
@ -4285,7 +4285,7 @@ t MSG_301 "Affiche les paramètres de l'application"
t MSG_302 "Affiche des informations à propos de cette application"
t MSG_303 "Affiche le log"
t MSG_304 "Crée une image disque à partir du périphérique sélectionné"
t MSG_305 "Utilisez cette option pour indiquer si vous voulez installer Windows sur un autre disque, ou bien exécuter Windows directement depuis ce périphérique (Windows To Go).\r\nEn mode 'Installation Windows 11 étendue', Rufus modifiera le périphérique de manière à ce que Windows 11 puisse être installé sur les plateformes qui ne sont pas compatibles avec les exigences matérielles TPM 2.0 ou Secure Boot."
t MSG_305 "Utilisez cette option pour indiquer si vous voulez installer Windows sur un autre disque, ou bien exécuter Windows directement depuis ce périphérique (Windows To Go)."
t MSG_306 "Effacement 'rapide' à zéro : %s"
t MSG_307 "peut prendre du temps"
t MSG_308 "Détection VHD"
@ -4302,9 +4302,6 @@ t MSG_318 "Priorité de thread part default : %d"
t MSG_319 "Ignorer le marqueur de démarrage"
t MSG_320 "Rafraichissement du schéma de partition (%s)..."
t MSG_321 "Limage que vous avez sélectionnée est de type ISOHybrid, mais ses créateurs ne lont pas rendue compatible avec le mode ISO (i.e. copie de fichier).\nA cause de cela, seule lécriture en mode DD est applicable."
t MSG_322 "Installation standard de Windows 11 (TPM 2.0 + Secure Boot)"
t MSG_323 "Installation Windows 11 étendue (sans TPM / sans Secure Boot)"
t MSG_324 "Elimination des restrictions dinstallation de Windows 11: %s"
#########################################################################
l "de-DE" "German (Deutsch)" 0x0407, 0x0807, 0x0c07, 0x1007, 0x1407
@ -5774,7 +5771,7 @@ t MSG_301 "Az alkalmazás beállításainak megjelenítése"
t MSG_302 "Az alkalmazás névjegyének megjelenítése"
t MSG_303 "Napló megjelenítése"
t MSG_304 "Lemezkép készítése a kiválasztott eszközről"
t MSG_305 "Ezzel a beállítással jelezheted, ha a Windows rendszert egy másik lemezre szeretnéd telepíteni, vagy közvetlenül erről a meghajtóról szeretnéd futtatni a Windows rendszert (Windows To Go).\n„Kiterjesztett Windows 11 telepítés” módban a Rufus úgy módosítja az adathordozót, hogy a Windows 11 olyan platformokon is telepíthető legyen, amelyek nem felelnek meg a TPM 2.0 vagy a Secure Boot követelményeinek."
t MSG_305 "Ezzel a beállítással jelezheted, ha a Windows rendszert egy másik lemezre szeretnéd telepíteni, vagy közvetlenül erről a meghajtóról szeretnéd futtatni a Windows rendszert (Windows To Go)."
t MSG_306 "Meghajtó gyors-nullázása: %s"
t MSG_307 "ez eltarthat egy kis ideig"
t MSG_308 "VHD észlelés"
@ -5791,10 +5788,7 @@ t MSG_318 "Alapértelmezett szál prioritás: %d"
t MSG_319 "Boot Marker figyelmen kívül hagyása"
t MSG_320 "Partíció elrendezés frissítése (%s)..."
t MSG_321 "A kiválasztott képfájl egy ISOHybrid képfájl, de a készítői nem tették kompatibilissé az ISO (fájlmásolás) móddal.\nEmiatt a DD képfájl írási mód lesz kényszerítve."
t MSG_322 "Alapértelmezett Windows 11 telepítés (TPM 2.0 + Secure Boot)"
t MSG_323 "Kiterjesztett Windows 11 telepítés (nincs TPM / nincs Secure Boot)"
t MSG_324 "Windows 11 telepítési korlátozások eltávolítása: %s"
t MSG_325 "Nem lehet megnyitni vagy olvasni ezt: '%s'"
t MSG_322 "Nem lehet megnyitni vagy olvasni ezt: '%s'"
#########################################################################
l "id-ID" "Indonesian (Bahasa Indonesia)" 0x0421
@ -9878,9 +9872,6 @@ t MSG_318 "Prioridade padrão da thread: %d"
t MSG_319 "Ignorar marcador de inicialização"
t MSG_320 "Atualizando o layout da partição (%s)..."
t MSG_321 "A imagem que você selecionou é uma ISOHybrid, mas os criadores não a tornaram compatível com o modo de cópia ISO/Arquivo.\nComo resultado, o modo de gravação de imagem DD será aplicado."
t MSG_322 "Instalação padrão do Windows 11 (TPM 2.0 + Secure Boot)"
t MSG_323 "Instalação estendida do Windows 11 (sem TPM / sem Secure Boot)"
t MSG_324 "Removendo as restrições de instalação do Windows 11: %s"
#########################################################################
l "pt-PT" "Portuguese Standard (Português)" 0x0816
@ -10253,9 +10244,6 @@ t MSG_318 "Prioridade padrão do thread: %d"
t MSG_319 "Ignorar marcador de arranque"
t MSG_320 "A atualizar a estrutura da partição (%s)..."
t MSG_321 "A imagem que selecionou é ISOHybrid mas os criadores não a tornaram compatível com o modo de cópia ISO/Ficheiro.\nComo resultado, será aplicado o modo de gravação da imagem DD."
t MSG_322 "Instalação padrão do Windows 11 (TPM 2.0 + Secure Boot)"
t MSG_323 "Instalação alterada do Windows 11 (sem TPM / sem Secure Boot)"
t MSG_324 "A remover as restrições de instalação do Windows 11: %s"
#########################################################################
l "ro-RO" "Romanian (Română)" 0x0418, 0x0818
@ -10613,7 +10601,7 @@ t MSG_301 "Afișați setările aplicației"
t MSG_302 "Afișați informații despre această aplicație"
t MSG_303 "Afișați jurnalul"
t MSG_304 "Generați o imagine de disc după dispozitivul selectat"
t MSG_305 "Utilizați această opțiune pentru a indica dacă planificați să instalați Windows pe un alt disc, sau dacă doriți să rulați Windows direct de pe această unitate (Windows To Go).\nÎn modul 'Instalare Windows 11 extinsă', Rufus va aplica un patch astfel încât Windows 11 să poată fi instalat pe platforme care nu îndeplinesc cerințele TPM 2.0 sau Secure Boot."
t MSG_305 "Utilizați această opțiune pentru a indica dacă planificați să instalați Windows pe un alt disc, sau dacă doriți să rulați Windows direct de pe această unitate (Windows To Go)."
t MSG_306 "Se scriu rapid zerouri pe unitate: %s"
t MSG_307 "poate dura mai mult timp"
t MSG_308 "Detectare VHD"
@ -10630,9 +10618,6 @@ t MSG_318 "Prioritate implicită pentru firul de execuție: %d"
t MSG_319 "Ignorare Boot Marker"
t MSG_320 "Se reîmprospătează așezarea partițiilor (%s)..."
t MSG_321 "Imaginea selectată este de tip ISOHybrid, însă creatorii acesteia nu au făcut-o să fie compatibilă cu modul ISO/Copiere fișiere.\nDrept urmare, modul imagine DD va fi aplicat."
t MSG_322 "Instalare Windows 11 standard (TPM 2.0 + Secure Boot)"
t MSG_323 "Instalare Windows 11 extinsă (fără TPM / fără Secure Boot)"
t MSG_324 "Se elimină restricțiile pentru instalarea Windows 11: %s"
#########################################################################
l "ru-RU" "Russian (Русский)" 0x0419, 0x0819

View file

@ -71,9 +71,10 @@ extern const int nb_steps[FS_MAX];
extern uint32_t dur_mins, dur_secs;
extern uint32_t wim_nb_files, wim_proc_files, wim_extra_files;
static int actual_fs_type, wintogo_index = -1, wininst_index = 0;
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, fast_zeroing, enable_file_indexing, write_as_image;
extern BOOL use_vds, write_as_esp, is_vds_available;
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, fast_zeroing, enable_file_indexing;
extern BOOL write_as_image, use_vds, write_as_esp, is_vds_available, enable_inplace;
extern const grub_patch_t grub_patch[2];
extern char* unattend_xml_path;
uint8_t *grub2_buf = NULL, *sec_buf = NULL;
long grub2_len;
@ -1468,80 +1469,69 @@ static BOOL SetupWinToGo(DWORD DriveIndex, const char* drive_name, BOOL use_esp)
}
/*
* Edit sources/boot.wim registry to remove Windows 11 install restrictions
* Add unattend.xml to 'sources\boot.wim' (install) or 'Windows\Panther\' (Windows To Go)
*/
BOOL RemoveWindows11Restrictions(char drive_letter)
BOOL ApplyWindowsCustomization(char drive_letter, BOOL windows_to_go)
{
BOOL r = FALSE, is_hive_mounted = FALSE;
int i;
BOOL r = FALSE;
const int wim_index = 2;
const char* offline_hive_name = "RUFUS_OFFLINE_HIVE";
const char* key_name[] = { "BypassTPMCheck", "BypassSecureBootCheck" };
char boot_wim_path[] = "#:\\sources\\boot.wim", key_path[64];
char* mount_path = NULL;
char path[MAX_PATH];
HKEY hKey = NULL, hSubKey = NULL;
LSTATUS status;
DWORD dwDisp, dwVal = 1;
char boot_wim_path[] = "?:\\sources\\boot.wim";
char appraiserres_dll_src[] = "?:\\sources\\appraiserres.dll";
char appraiserres_dll_dst[] = "?:\\sources\\appraiserres.bak";
char *mount_path = NULL, path[MAX_PATH];
assert(unattend_xml_path != NULL);
uprintf("Applying Windows customization:");
if (windows_to_go) {
static_sprintf(path, "%c:\\Windows\\Panther", drive_letter);
if (!CreateDirectoryA(path, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
uprintf("Could not create '%s' : %s", path, WindowsErrorString());
goto out;
}
static_sprintf(path, "%c:\\Windows\\Panther\\unattend.xml", drive_letter);
if (!CopyFileA(unattend_xml_path, path, TRUE)) {
uprintf("Could not create '%s' : %s", path, WindowsErrorString());
goto out;
}
uprintf("Added '%s'", path);
} else {
boot_wim_path[0] = drive_letter;
if (enable_inplace) {
// Create a backup of sources\appraiserres.dll and then create an empty file to
// allow in-place upgrades without TPM/SB. Note that we need to create an empty,
// appraiserres.dll otherwise setup.exe extracts its own.
appraiserres_dll_src[0] = drive_letter;
appraiserres_dll_dst[0] = drive_letter;
if (!MoveFileExU(appraiserres_dll_src, appraiserres_dll_dst, MOVEFILE_REPLACE_EXISTING))
uprintf("Could not rename '%s': %s", appraiserres_dll_src, WindowsErrorString());
else
CloseHandle(CreateFileU(appraiserres_dll_src, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
uprintf("Renamed '%s' → '%s'", appraiserres_dll_src, appraiserres_dll_dst);
}
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 0, PATCH_PROGRESS_TOTAL);
UpdateProgressWithInfoForce(OP_PATCH, MSG_325, 0, PATCH_PROGRESS_TOTAL);
uprintf("Mounting '%s'...", boot_wim_path);
mount_path = WimMountImage(boot_wim_path, wim_index);
if (mount_path == NULL)
goto out;
static_sprintf(path, "%s\\Windows\\System32\\config\\SYSTEM", mount_path);
if (!MountRegistryHive(HKEY_LOCAL_MACHINE, offline_hive_name, path))
goto out;
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 102, PATCH_PROGRESS_TOTAL);
is_hive_mounted = TRUE;
static_sprintf(key_path, "%s\\Setup", offline_hive_name);
status = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key_path, 0, KEY_READ | KEY_CREATE_SUB_KEY, &hKey);
if (status != ERROR_SUCCESS) {
SetLastError(status);
uprintf("Could not open 'HKLM\\SYSTEM\\Setup' registry key: %s", WindowsErrorString());
static_sprintf(path, "%s\\Autounattend.xml", mount_path);
if (!CopyFileU(unattend_xml_path, path, TRUE)) {
uprintf("Could not create boot.wim 'Autounattend.xml': %s", WindowsErrorString());
goto out;
}
status = RegCreateKeyExA(hKey, "LabConfig", 0, NULL, 0,
KEY_SET_VALUE | KEY_QUERY_VALUE | KEY_CREATE_SUB_KEY, NULL, &hSubKey, &dwDisp);
if (status != ERROR_SUCCESS) {
SetLastError(status);
uprintf("Could not create 'HKLM\\SYSTEM\\Setup\\LabConfig' registry key: %s", WindowsErrorString());
goto out;
uprintf("Added 'Autounattend.xml' to '%s'", boot_wim_path);
UpdateProgressWithInfoForce(OP_PATCH, MSG_325, 103, PATCH_PROGRESS_TOTAL);
}
for (i = 0; i < ARRAYSIZE(key_name); i++) {
status = RegSetValueExA(hSubKey, key_name[i], 0, REG_DWORD, (LPBYTE)&dwVal, sizeof(DWORD));
if (status != ERROR_SUCCESS) {
SetLastError(status);
uprintf("Could not set 'HKLM\\SYSTEM\\Setup\\LabConfig\\%s' registry key: %s",
key_name[i], WindowsErrorString());
goto out;
}
uprintf("Created 'HKLM\\SYSTEM\\Setup\\LabConfig\\%s' registry key", key_name[i]);
}
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 103, PATCH_PROGRESS_TOTAL);
r = TRUE;
out:
if (hSubKey != NULL)
RegCloseKey(hSubKey);
if (hKey != NULL)
RegCloseKey(hKey);
if (is_hive_mounted) {
UnmountRegistryHive(HKEY_LOCAL_MACHINE, offline_hive_name);
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 104, PATCH_PROGRESS_TOTAL);
}
if (mount_path) {
uprintf("Unmounting '%s'...", boot_wim_path, wim_index);
WimUnmountImage(boot_wim_path, wim_index);
UpdateProgressWithInfo(OP_PATCH, MSG_325, PATCH_PROGRESS_TOTAL, PATCH_PROGRESS_TOTAL);
}
UpdateProgressWithInfo(OP_PATCH, MSG_324, PATCH_PROGRESS_TOTAL, PATCH_PROGRESS_TOTAL);
free(mount_path);
return r;
}
@ -1900,8 +1890,6 @@ DWORD WINAPI FormatThread(void* param)
char drive_letters[27], fs_name[32], label[64];
char logfile[MAX_PATH], *userdir;
char efi_dst[] = "?:\\efi\\boot\\bootx64.efi";
char appraiserres_dll_src[] = "?:\\sources\\appraiserres.dll";
char appraiserres_dll_dst[] = "?:\\sources\\appraiserres.bak";
char kolibri_dst[] = "?:\\MTLD_F32";
char grub4dos_dst[] = "?:\\grldr";
@ -2336,6 +2324,10 @@ DWORD WINAPI FormatThread(void* param)
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_ISO_EXTRACT);
goto out;
}
if (unattend_xml_path != NULL) {
if (!ApplyWindowsCustomization(drive_name[0], TRUE))
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_PATCH);
}
} else {
assert(!img_report.is_windows_img);
if (!ExtractISO(image_path, drive_name, FALSE)) {
@ -2374,20 +2366,8 @@ DWORD WINAPI FormatThread(void* param)
if (!SetupWinPE(drive_name[0]))
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH);
}
if (ComboBox_GetCurItemData(hImageOption) == IMOP_WIN_EXTENDED) {
// Create a backup of sources\appraiserres.dll and then create an empty file to
// allow in-place upgrades without TPM/SB. Note that we need to create an empty,
// appraiserres.dll otherwise setup.exe extracts its own.
appraiserres_dll_src[0] = drive_name[0];
appraiserres_dll_dst[0] = drive_name[0];
uprintf("Renaming: '%s' → '%s'", appraiserres_dll_src, appraiserres_dll_dst);
if (!MoveFileExU(appraiserres_dll_src, appraiserres_dll_dst, MOVEFILE_REPLACE_EXISTING))
uprintf(" Rename failed: %s", WindowsErrorString());
else
CloseHandle(CreateFileU(appraiserres_dll_src, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
// Now patch for boot-time TPM/SB checks.
if (!RemoveWindows11Restrictions(drive_name[0]))
if (unattend_xml_path != NULL) {
if (!ApplyWindowsCustomization(drive_name[0], FALSE))
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_PATCH);
}
}

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* ISO file extraction
* Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2022 Pete Batard <pete@akeo.ie>
* Based on libcdio's iso & udf samples:
* Copyright © 2003-2014 Rocky Bernstein <rocky@gnu.org>
*
@ -95,9 +95,9 @@ static const char* md5sum_name[] = { "MD5SUMS", "md5sum.txt" };
static const char* casper_dirname = "/casper";
static const char* proxmox_dirname = "/proxmox";
static const char* efi_dirname = "/efi/boot";
static const char* efi_bootname[MAX_ARCHS] = {
"bootia32.efi", "bootia64.efi", "bootx64.efi", "bootarm.efi", "bootaa64.efi",
"bootebc.efi", "bootriscv32.efi", "bootriscv64.efi", "bootriscv128.efi" };
static const char* efi_bootname[ARCH_MAX] = {
"boot.efi", "bootia32.efi", "bootx64.efi", "bootarm.efi", "bootaa64.efi", "bootia64.efi",
"bootriscv32.efi", "bootriscv64.efi", "bootriscv128.efi", "bootebc.efi" };
static const char* sources_str = "/sources";
static const char* wininst_name[] = { "install.wim", "install.esd", "install.swm" };
// We only support GRUB/BIOS (x86) that uses a standard config dir (/boot/grub/i386-pc/)

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Elementary Unicode compliant find/replace parser
* Copyright © 2012-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2012-2022 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
@ -914,7 +914,7 @@ void parse_update(char* buf, size_t len)
char allowed_rtf_chars[] = "abcdefghijklmnopqrstuvwxyz|~-_:*'";
char allowed_std_chars[] = "\r\n ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"$%^&+=<>(){}[].,;#@/?";
char download_url_name[24];
char *arch_names[CPU_ARCH_MAX] = { "x86", "x64", "arm", "arm64", "none" };
char *arch_names[5] = { "unknown", "x86", "x64", "arm", "arm64" };
// strchr includes the NUL terminator in the search, so take care of backslash before NUL
if ((buf == NULL) || (len < 2) || (len > 64 * KB) || (buf[len-1] != 0) || (buf[len-2] == '\\'))

View file

@ -60,11 +60,21 @@ enum bootcheck_return {
BOOTCHECK_GENERAL_ERROR = -3,
};
#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_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)
static const char* cmdline_hogger = "rufus.com";
static const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer";
static const char* vs_reg = "Software\\Microsoft\\VisualStudio";
static const char* arch_name[MAX_ARCHS] = {
"x86_32", "Itanic", "x86_64", "ARM", "ARM64", "EBC","Risc-V 32", "Risc-V 64", "Risc-V 128" };
static const char* arch_name[ARCH_MAX] = {
"unknown", "x86_32", "x86_64", "ARM", "ARM64", "Itanic", "RISC-V 32", "RISC-V 64", "RISC-V 128", "EBC" };
static BOOL existing_key = FALSE; // For LGP set/restore
static BOOL size_check = TRUE;
static BOOL log_displayed = FALSE;
@ -79,6 +89,8 @@ 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 RECT relaunch_rc = { -65536, -65536, 0, 0};
static UINT uMBRChecked = BST_UNCHECKED;
static HANDLE format_thread = NULL;
@ -116,7 +128,7 @@ HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hL
HWND hImageOption, hLogDialog = NULL, hProgress = NULL, hDiskID;
HANDLE dialog_handle = NULL;
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, its_a_me_mario = FALSE;
BOOL op_in_progress = TRUE, right_to_left_mode = FALSE, has_uefi_csm = FALSE, its_a_me_mario = FALSE, enable_inplace;
BOOL enable_HDDs = FALSE, enable_VHDs = TRUE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE;
BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug;
BOOL use_fake_units, preserve_timestamps = FALSE, fast_zeroing = FALSE, app_changed_size = FALSE;
@ -125,7 +137,7 @@ BOOL write_as_image = FALSE, write_as_esp = FALSE, use_vds = FALSE, ignore_boot_
BOOL appstore_version = FALSE, is_vds_available = TRUE;
float fScale = 1.0f;
int dialog_showing = 0, selection_default = BT_IMAGE, persistence_unit_selection = -1, imop_win_sel = 0;
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;
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[MAX_PATH], sysnative_dir[MAX_PATH];
char app_data_dir[MAX_PATH], user_dir[MAX_PATH];
@ -133,7 +145,7 @@ char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
char embedded_sl_version_ext[2][32];
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64];
char msgbox[1024], msgbox_title[32], *ini_file = NULL, *image_path = NULL, *short_image_path;
char *archive_path = NULL, image_option_txt[128], *fido_url = NULL;
char *archive_path = NULL, image_option_txt[128], *fido_url = NULL, *unattend_xml_path = NULL;
StrArray BlockingProcess, ImageList;
// Number of steps for each FS for FCC_STRUCTURE_PROGRESS
const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10, 1, 1, 1, 1 };
@ -1168,22 +1180,15 @@ static void UpdateImage(BOOL update_image_option_only)
ComboBox_ResetContent(hImageOption);
if (!img_report.is_windows_img) { // Straight install.wim/install.esd only have Windows To Go option
// Can't remove restrictions if running on Windows 7 or when running the appstore version
if (nWindowsVersion >= WINDOWS_8 && !appstore_version && img_report.win_version.major == 11) {
IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_322)), IMOP_WIN_STANDARD));
IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_323)), IMOP_WIN_EXTENDED));
} else {
if (!img_report.is_windows_img) // Straight install.wim/install.esd only have Windows To Go option
IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_117)), IMOP_WIN_STANDARD));
}
}
IGNORE_RETVAL(ComboBox_SetItemData(hImageOption, ComboBox_AddStringU(hImageOption, lmprintf(MSG_118)), IMOP_WIN_TO_GO));
IGNORE_RETVAL(ComboBox_SetCurSel(hImageOption, imop_win_sel));
}
static uint8_t FindArch(const char* filename)
{
uint8_t ret = 0;
uint8_t ret = ARCH_UNKNOWN;
HANDLE hFile = NULL, hFileMapping = NULL;
PIMAGE_DOS_HEADER pImageDOSHeader = NULL;
// NB: The field we are after is at the same location for 32 and 64-bit
@ -1219,31 +1224,31 @@ static uint8_t FindArch(const char* filename)
switch (pImageNTHeader->FileHeader.Machine) {
case IMAGE_FILE_MACHINE_I386:
ret = 1;
break;
case IMAGE_FILE_MACHINE_IA64:
ret = 2;
ret = ARCH_X86_32;
break;
case IMAGE_FILE_MACHINE_AMD64:
ret = 3;
ret = ARCH_X86_64;
break;
case IMAGE_FILE_MACHINE_ARM:
ret = 4;
ret = ARCH_ARM_32;
break;
case IMAGE_FILE_MACHINE_ARM64:
ret = 5;
ret = ARCH_ARM_64;
break;
case IMAGE_FILE_MACHINE_EBC:
ret = 6;
case IMAGE_FILE_MACHINE_IA64:
ret = ARCH_IA_64;
break;
case IMAGE_FILE_MACHINE_RISCV32:
ret = 7;
ret = ARCH_RISCV_32;
break;
case IMAGE_FILE_MACHINE_RISCV64:
ret = 8;
ret = ARCH_RISCV_64;
break;
case IMAGE_FILE_MACHINE_RISCV128:
ret = 9;
ret = ARCH_RISCV_128;
break;
case IMAGE_FILE_MACHINE_EBC:
ret = ARCH_EBC;
break;
}
@ -1252,10 +1257,123 @@ out:
UnmapViewOfFile(pImageDOSHeader);
safe_closehandle(hFileMapping);
safe_closehandle(hFile);
assert(ret <= MAX_ARCHS);
assert(ret < ARCH_MAX);
return ret;
}
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)
return NULL;
arch--;
if (GetTempFileNameU(temp_dir, APPLICATION_NAME, 0, path) == 0)
return NULL;
fd = fopen(path, "w");
if (fd == NULL)
return NULL;
enable_inplace = mask & UNATTEND_WINPE_SETUP_MASK;
fprintf(fd, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
fprintf(fd, "<unattend xmlns=\"urn:schemas-microsoft-com:unattend\">\n");
// This part produces the unbecoming display of a command prompt window during initial setup, which
// may scare users... But the Windows Store version doesn't allow us to edit an offline registry...
if (mask & UNATTEND_WINPE_SETUP_MASK) {
order = 1;
fprintf(fd, " <settings pass=\"windowsPE\">\n");
fprintf(fd, " <component name=\"Microsoft-Windows-Setup\" processorArchitecture=\"%s\" language=\"neutral\" "
"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]);
// WinPE will complain if we don't provide a product key. *Any* product key. This is soooo idiotic...
fprintf(fd, " <UserData>\n");
fprintf(fd, " <ProductKey>\n");
fprintf(fd, " <Key>xxxxx-xxxxx-xxxxx-xxxxx-xxxxx</Key>\n");
fprintf(fd, " </ProductKey>\n");
fprintf(fd, " </UserData>\n");
fprintf(fd, " <RunSynchronous>\n");
for (i = 0; i < ARRAYSIZE(bypass_name); i++) {
if (!(mask & (1 << (i/2))))
continue;
fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n");
fprintf(fd, " <Order>%d</Order>\n", order++);
fprintf(fd, " <Path>reg add HKLM\\SYSTEM\\Setup\\LabConfig /v %s /t REG_DWORD /d 1 /f</Path>\n", bypass_name[i]);
fprintf(fd, " </RunSynchronousCommand>\n");
}
fprintf(fd, " </RunSynchronous>\n");
fprintf(fd, " </component>\n");
fprintf(fd, " </settings>\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, " <settings pass=\"specialize\">\n");
fprintf(fd, " <component name=\"Microsoft-Windows-Deployment\" processorArchitecture=\"%s\" language=\"neutral\" "
"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, " <RunSynchronous>\n");
if (mask & UNATTEND_NO_ONLINE_ACCOUNT_MASK) {
fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n");
fprintf(fd, " <Order>%d</Order>\n", order++);
fprintf(fd, " <Path>reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\OOBE /v BypassNRO /t REG_DWORD /d 1 /f</Path>\n");
fprintf(fd, " </RunSynchronousCommand>\n");
}
if (mask & UNATTEND_SPECIALIZE_DEPLOYMENT_MASK) {
fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n");
fprintf(fd, " <Order>%d</Order>\n", order++);
fprintf(fd, " <Path>reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate /v TargetReleaseVersion /t REG_DWORD /d 1 /f</Path>\n");
fprintf(fd, " </RunSynchronousCommand>\n");
fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n");
fprintf(fd, " <Order>%d</Order>\n", order++);
fprintf(fd, " <Path>reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate /v TargetReleaseVersionInfo /t REG_SZ /d 25H1 /f</Path>\n");
fprintf(fd, " </RunSynchronousCommand>\n");
}
fprintf(fd, " </RunSynchronous>\n");
fprintf(fd, " </component>\n");
fprintf(fd, " </settings>\n");
}
if (mask & UNATTEND_OOBE_SHELL_SETUP) {
order = 1;
fprintf(fd, " <settings pass=\"oobeSystem\">\n");
fprintf(fd, " <component name=\"Microsoft-Windows-Shell-Setup\" processorArchitecture=\"%s\" language=\"neutral\" "
"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]);
if (mask & UNATTEND_REMOVE_WATERMARK_MASK) {
fprintf(fd, " <FirstLogonCommands>\n");
fprintf(fd, " <SynchronousCommand wcm:action=\"add\">\n");
fprintf(fd, " <Order>%d</Order>\n", order++);
fprintf(fd, " <CommandLine>reg add \"HKCU\\Control Panel\\UnsupportedHardwareNotificationCache\" /v SV1 /t REG_DWORD /d 0 /f</CommandLine>\n");
fprintf(fd, " </SynchronousCommand>\n");
fprintf(fd, " <SynchronousCommand wcm:action=\"add\">\n");
fprintf(fd, " <Order>%d</Order>\n", order++);
fprintf(fd, " <CommandLine>reg add \"HKCU\\Control Panel\\UnsupportedHardwareNotificationCache\" /v SV2 /t REG_DWORD /d 0 /f</CommandLine>\n");
fprintf(fd, " </SynchronousCommand>\n");
fprintf(fd, " </FirstLogonCommands>\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...
if (mask & UNATTEND_NO_DATA_COLLECTION_MASK) {
fprintf(fd, " <OOBE>\n");
fprintf(fd, " <ProtectYourPC>3</ProtectYourPC>\n");
fprintf(fd, " </OOBE>\n");
}
fprintf(fd, " </component>\n");
fprintf(fd, " </settings>\n");
}
fprintf(fd, "</unattend>\n");
fclose(fd);
return path;
}
// The scanning process can be blocking for message processing => use a thread
DWORD WINAPI ImageScanThread(LPVOID param)
{
@ -1291,7 +1409,7 @@ DWORD WINAPI ImageScanThread(LPVOID param)
(!img_report.is_iso && (img_report.is_bootable_img <= 0) && !img_report.is_windows_img)) {
// Failed to scan image
if (img_report.is_bootable_img < 0)
MessageBoxExU(hMainDialog, lmprintf(MSG_325, image_path), lmprintf(MSG_042), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
MessageBoxExU(hMainDialog, lmprintf(MSG_322, image_path), lmprintf(MSG_042), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
else
MessageBoxExU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK | MB_ICONINFORMATION | MB_IS_RTL, selected_langid);
// Make sure to relinquish image_path before we call UpdateImage
@ -1315,7 +1433,8 @@ DWORD WINAPI ImageScanThread(LPVOID param)
if (WimExtractFile(image_path, 1, "Windows\\Boot\\EFI\\bootmgr.efi", tmp_path, TRUE)) {
arch = FindArch(tmp_path);
if (arch != 0) {
uprintf(" Image contains a%s %s EFI boot manager", arch_name[arch - 1], (arch < 7) ? "n" : "");
uprintf(" Image contains a%s %s EFI boot manager",
(arch >= ARCH_RISCV_32 && arch <= ARCH_RISCV_128) ? "" : "n", arch_name[arch]);
img_report.has_efi = 1 | (1 << arch);
img_report.has_bootmgr_efi = TRUE;
img_report.wininst_index = 1;
@ -1501,6 +1620,21 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
default:
break;
}
if ((nWindowsVersion >= WINDOWS_8) && IS_WINDOWS_11(img_report) && (img_report.win_version.build >= 22500)) {
StrArray options;
int arch = _log2(img_report.has_efi >> 1);
StrArrayCreate(&options, 4);
StrArrayAdd(&options, lmprintf(MSG_330), TRUE);
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);
StrArrayDestroy(&options);
if (i < 0)
goto out;
i <<= 2;
unattend_xml_path = CreateUnattendXml(arch, i);
unattend_xml_mask = (unattend_xml_mask & 0x03) | (i & (~0x03));
}
} else if (target_type == TT_UEFI) {
if (!IS_EFI_BOOTABLE(img_report)) {
// Unsupported ISO
@ -1513,6 +1647,28 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL);
goto out;
}
if ((nWindowsVersion >= WINDOWS_8) && IS_WINDOWS_11(img_report)) {
StrArray options;
int arch = _log2(img_report.has_efi >> 1);
StrArrayCreate(&options, 5);
StrArrayAdd(&options, lmprintf(MSG_328), TRUE);
StrArrayAdd(&options, lmprintf(MSG_329), TRUE);
if (img_report.win_version.build >= 22500) {
StrArrayAdd(&options, lmprintf(MSG_330), TRUE);
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);
StrArrayDestroy(&options);
if (i < 0)
goto out;
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));
}
} 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)))
|| ((IS_FAT(fs_type)) && (!HAS_SYSLINUX(img_report)) && (!allow_dual_uefi_bios) && !IS_EFI_BOOTABLE(img_report) &&
@ -2188,7 +2344,7 @@ out:
}
#ifdef RUFUS_TEST
extern BOOL RemoveWindows11Restrictions(char drive_letter);
extern BOOL ApplyWindowsCustomization(char drive_letter);
static DWORD WINAPI TestThread(LPVOID param)
{
@ -2199,7 +2355,7 @@ static DWORD WINAPI TestThread(LPVOID param)
ExitThread(1);
}
processing = TRUE;
RemoveWindows11Restrictions('B');
ApplyWindowsCustomization('B');
processing = FALSE;
ExitThread(0);
}
@ -3032,6 +3188,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (queued_hotplug_event)
SendMessage(hDlg, UM_MEDIA_CHANGE, 0, 0);
if (wParam == BOOTCHECK_CANCEL) {
if (unattend_xml_path != NULL) {
DeleteFileU(unattend_xml_path);
unattend_xml_path = NULL;
}
EnableControls(TRUE, FALSE);
break;
}
@ -3042,6 +3202,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
case UM_FORMAT_COMPLETED:
zero_drive = FALSE;
format_thread = NULL;
if (unattend_xml_path != NULL) {
DeleteFileU(unattend_xml_path);
unattend_xml_path = NULL;
}
// Stop the timer
KillTimer(hMainDialog, TID_APP_TIMER);
// Close the cancel MessageBox and Blocking notification if active

View file

@ -63,7 +63,6 @@
#define MIN_DRIVE_SIZE 8 // Minimum size a drive must have, to be formattable (in MB)
#define MIN_EXTRA_PART_SIZE (1024*1024) // Minimum size of the extra partition, in bytes
#define MIN_EXT_SIZE (256*1024*1024) // Minimum size we allow for ext formatting
#define MAX_ARCHS 9 // Number of arhitectures we recognize
#define MAX_DRIVES (DRIVE_INDEX_MAX - DRIVE_INDEX_MIN)
#define MAX_TOOLTIPS 128
#define MAX_SIZE_SUFFIXES 6 // bytes, KB, MB, GB, TB, PB
@ -333,6 +332,7 @@ enum checksum_type {
#define HAS_WINPE(r) (((r.winpe & WINPE_I386) == WINPE_I386)||((r.winpe & WINPE_AMD64) == WINPE_AMD64)||((r.winpe & WINPE_MININT) == WINPE_MININT))
#define HAS_WINDOWS(r) (HAS_BOOTMGR(r) || (r.uses_minint) || HAS_WINPE(r))
#define HAS_WIN7_EFI(r) ((r.has_efi == 1) && HAS_WININST(r))
#define IS_WINDOWS_11(r) (r.has_bootmgr_efi && (r.win_version.major >= 11))
#define HAS_EFI_IMG(r) (r.efi_img_path[0] != 0)
#define IS_DD_BOOTABLE(r) (r.is_bootable_img > 0)
#define IS_DD_ONLY(r) ((r.is_bootable_img > 0) && (!r.is_iso || r.disable_iso))
@ -483,13 +483,18 @@ enum WindowsVersion {
WINDOWS_MAX
};
enum CpuArch {
CPU_ARCH_X86_32 = 0,
CPU_ARCH_X86_64,
CPU_ARCH_ARM_32,
CPU_ARCH_ARM_64,
CPU_ARCH_UNDEFINED,
CPU_ARCH_MAX
enum ArchType {
ARCH_UNKNOWN = 0,
ARCH_X86_32,
ARCH_X86_64,
ARCH_ARM_32,
ARCH_ARM_64,
ARCH_IA_64,
ARCH_RISCV_32,
ARCH_RISCV_64,
ARCH_RISCV_128,
ARCH_EBC,
ARCH_MAX
};
/*
@ -524,7 +529,7 @@ extern char app_data_dir[MAX_PATH], *image_path, *fido_url;
*/
extern void GetWindowsVersion(void);
extern BOOL is_x64(void);
extern BOOL GetCpuArch(void);
extern int GetCpuArch(void);
extern const char *WindowsErrorString(void);
extern void DumpBufferHex(void *buf, size_t size);
extern void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, ...);

View file

@ -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.1899"
CAPTION "Rufus 3.19.1900"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,19,1899,0
PRODUCTVERSION 3,19,1899,0
FILEVERSION 3,19,1900,0
PRODUCTVERSION 3,19,1900,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.1899"
VALUE "FileVersion", "3.19.1900"
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.1899"
VALUE "ProductVersion", "3.19.1900"
END
END
BLOCK "VarFileInfo"

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Standard Windows function calls
* Copyright © 2013-2021 Pete Batard <pete@akeo.ie>
* Copyright © 2013-2022 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
@ -229,15 +229,15 @@ int GetCpuArch(void)
GetNativeSystemInfo(&info);
switch (info.wProcessorArchitecture) {
case PROCESSOR_ARCHITECTURE_AMD64:
return CPU_ARCH_X86_64;
return ARCH_X86_64;
case PROCESSOR_ARCHITECTURE_INTEL:
return CPU_ARCH_X86_64;
return ARCH_X86_64;
case PROCESSOR_ARCHITECTURE_ARM64:
return CPU_ARCH_ARM_64;
return ARCH_ARM_64;
case PROCESSOR_ARCHITECTURE_ARM:
return CPU_ARCH_ARM_32;
return ARCH_ARM_32;
default:
return CPU_ARCH_UNDEFINED;
return ARCH_UNKNOWN;
}
}

View file

@ -46,6 +46,7 @@ UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
HIMAGELIST hUpImageList, hDownImageList;
extern BOOL use_vds, appstore_version;
extern int imop_win_sel;
extern char* unattend_xml_path;
int update_progress_type = UPT_PERCENT;
int advanced_device_section_height, advanced_format_section_height;
// (empty) check box width, (empty) drop down width, button height (for and without dropdown match)
@ -274,8 +275,6 @@ void GetFullWidth(HWND hDlg)
// Go through the Image Options for Windows To Go
fw = max(fw, GetTextSize(hImageOption, lmprintf(MSG_117)).cx);
fw = max(fw, GetTextSize(hImageOption, lmprintf(MSG_118)).cx);
fw = max(fw, GetTextSize(hImageOption, lmprintf(MSG_322)).cx);
fw = max(fw, GetTextSize(hImageOption, lmprintf(MSG_323)).cx);
// Now deal with full length checkbox lines
for (i = 0; i<ARRAYSIZE(full_width_checkboxes); i++)
@ -1182,7 +1181,8 @@ void InitProgress(BOOL bOnlyFormat)
break;
case BT_IMAGE:
nb_slots[OP_FILE_COPY] = (img_report.is_iso || img_report.is_windows_img) ? -1 : 0;
if (HAS_WINDOWS(img_report) && ComboBox_GetCurItemData(hImageOption) == IMOP_WIN_EXTENDED)
if (HAS_WINDOWS(img_report) && (unattend_xml_path != NULL) &&
(ComboBox_GetCurItemData(hImageOption) != IMOP_WIN_TO_GO))
nb_slots[OP_PATCH] = -1;
break;
default:

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Virtual Disk Handling functions
* Copyright © 2013-2016 Pete Batard <pete@akeo.ie>
* Copyright © 2013-2022 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
@ -548,7 +548,7 @@ static DWORD WINAPI WimMountImageThread(LPVOID param)
progress_report_mask = WIM_REPORT_PROGRESS;
progress_op = OP_PATCH;
progress_msg = MSG_324;
progress_msg = MSG_325;
progress_offset = 1;
progress_total = PATCH_PROGRESS_TOTAL;
if (pfWIMRegisterMessageCallback(NULL, (FARPROC)WimProgressCallback, NULL) == INVALID_CALLBACK_VALUE) {
@ -607,7 +607,7 @@ static DWORD WINAPI WimUnmountImageThread(LPVOID param)
progress_report_mask = WIM_REPORT_PROGRESS;
progress_op = OP_PATCH;
progress_msg = MSG_324;
progress_msg = MSG_325;
progress_offset = 105;
progress_total = PATCH_PROGRESS_TOTAL;
if (pfWIMRegisterMessageCallback(NULL, (FARPROC)WimProgressCallback, NULL) == INVALID_CALLBACK_VALUE) {