Skip to content

Commit a0d6692

Browse files
committed
[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*.
1 parent 9690742 commit a0d6692

File tree

11 files changed

+316
-178
lines changed

11 files changed

+316
-178
lines changed

res/loc/ChangeLog.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ To edit a translation, please make sure to follow:
55
https://github.com/pbatard/rufus/wiki/Localization#Editing_an_existing_translation
66
Or simply download https://rufus-web.akeo.ie/locale/pollock.exe and follow its directions.
77

8-
o v3.?? (????.??.??)
9-
- *UPDATED* MSG_305 Reworked the message to mention the new Windows 11 Extended option
10-
- *NEW* MSG_322 "Standard Windows 11 Installation (TPM 2.0 + Secure Boot)"
11-
- *NEW* MSG_323 "Extended Windows 11 Installation (no TPM / no Secure Boot)"
12-
- *NEW* MSG_324 "Removing Windows 11 installation restrictions: %s"
13-
- *NEW* MSG_325 "Unable to open or read '%s'"
8+
o v3.20 (2022.??.??)
9+
- *NEW* MSG_323 "Unable to open or read '%s'"
10+
- *NEW* MSG_325 "Applying Windows customization: %s"
11+
- *NEW* MSG_326 "Windows User Experience"
12+
- *NEW* MSG_327 "Customize Windows installation?"
13+
- *NEW* MSG_328 "Remove requirement for Secure Boot and TPM 2.0"
14+
- *NEW* MSG_329 "Remove requirement for 4GB+ RAM and 64GB+ disk"
15+
- *NEW* MSG_330 "Remove requirement for an online Microsoft account"
16+
- *NEW* MSG_331 "Remove \"unsupported hardware\" desktop watermark"
17+
- *NEW* MSG_332 "Disable data collection (Skip privacy questions)"
1418

1519
o v3.14 (2021.03.31)
1620
- *UPDATED* MSG_068 "Error while partitioning drive." -> "Could not partition drive."

res/loc/rufus.loc

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,7 @@ t MSG_301 "Show application settings"
559559
t MSG_302 "Show information about this application"
560560
t MSG_303 "Show the log"
561561
t MSG_304 "Create a disk image of the selected device"
562-
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 "
563-
"directly from this drive (Windows To Go).\r\nIn 'Extended Windows 11 Installation' mode, Rufus will patch the "
564-
"media so that Windows 11 can be installed on platforms that don't meet the TPM 2.0 or Secure Boot requirements."
562+
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)."
565563
# You can see this status message by pressing <Ctrl>-<Alt>-<Z> and then selecting START.
566564
# It's the same as MSG_286 but with a process that *may* be faster, hence the name.
567565
t MSG_306 "Fast-zeroing drive: %s"
@@ -583,10 +581,15 @@ t MSG_319 "Ignore Boot Marker"
583581
t MSG_320 "Refreshing partition layout (%s)..."
584582
t MSG_321 "The image you have selected is an ISOHybrid, but its creators have not made it compatible with ISO/File "
585583
"copy mode.\nAs a result, DD image writing mode will be enforced."
586-
t MSG_322 "Standard Windows 11 Installation (TPM 2.0 + Secure Boot)"
587-
t MSG_323 "Extended Windows 11 Installation (no TPM / no Secure Boot)"
588-
t MSG_324 "Removing Windows 11 installation restrictions: %s"
589-
t MSG_325 "Unable to open or read '%s'"
584+
t MSG_322 "Unable to open or read '%s'"
585+
t MSG_325 "Applying Windows customization: %s"
586+
t MSG_326 "Windows User Experience"
587+
t MSG_327 "Customize Windows installation?"
588+
t MSG_328 "Remove requirement for Secure Boot and TPM 2.0"
589+
t MSG_329 "Remove requirement for 4GB+ RAM and 64GB+ disk"
590+
t MSG_330 "Remove requirement for an online Microsoft account"
591+
t MSG_331 "Remove \"unsupported hardware\" desktop watermark"
592+
t MSG_332 "Disable data collection (Skip privacy questions)"
590593

591594
#########################################################################
592595
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 "顯示應用程式設定"
20612064
t MSG_302 "顯示此應用程式資訊"
20622065
t MSG_303 "顯示記錄檔"
20632066
t MSG_304 "建立選擇的裝置的磁碟映像"
2064-
t MSG_305 "是否要使用此裝置來安裝 Windows 在另一個磁碟上,或是要直接在此磁碟上執行 Windows (Windows To Go)。\r\n在「擴充 Windows 11 安裝」模式中,Rufus 將修補裝置,以使 Windows 11 能夠安裝在不符合 TPM 2.0 或安全開機要求的系統上。"
2067+
t MSG_305 "是否要使用此裝置來安裝 Windows 在另一個磁碟上,或是要直接在此磁碟上執行 Windows (Windows To Go)。"
20652068
t MSG_306 "正在快速寫入零: %s"
20662069
t MSG_307 "可能需要一段時間"
20672070
t MSG_308 "虛擬硬碟偵測"
@@ -2078,10 +2081,7 @@ t MSG_318 "預設執行緒優先順序: %d"
20782081
t MSG_319 "忽略 Boot Marker"
20792082
t MSG_320 "正在重新整理磁區分割 (%s)..."
20802083
t MSG_321 "你選擇的映像檔是 ISOHybrid,但是檔案作者沒有使之與 ISO/檔案複製模式相容。\n因此強制使用 DD 映像寫入模式。"
2081-
t MSG_322 "標準 Windows 11 安裝 (TPM 2.0 + 安全開機)"
2082-
t MSG_323 "擴充 Windows 11 安裝 (無 TPM 和安全開機)"
2083-
t MSG_324 "正在移除 Windows 11 安裝限制: %s"
2084-
t MSG_325 "無法開啟或讀取 '%s'"
2084+
t MSG_322 "無法開啟或讀取 '%s'"
20852085

20862086
#########################################################################
20872087
l "hr-HR" "Croatian (Hrvatski)" 0x041a, 0x081a, 0x101a
@@ -4285,7 +4285,7 @@ t MSG_301 "Affiche les paramètres de l'application"
42854285
t MSG_302 "Affiche des informations à propos de cette application"
42864286
t MSG_303 "Affiche le log"
42874287
t MSG_304 "Crée une image disque à partir du périphérique sélectionné"
4288-
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."
4288+
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)."
42894289
t MSG_306 "Effacement 'rapide' à zéro : %s"
42904290
t MSG_307 "peut prendre du temps"
42914291
t MSG_308 "Détection VHD"
@@ -4302,9 +4302,6 @@ t MSG_318 "Priorité de thread part default : %d"
43024302
t MSG_319 "Ignorer le marqueur de démarrage"
43034303
t MSG_320 "Rafraichissement du schéma de partition (%s)..."
43044304
t MSG_321 "L’image que vous avez sélectionnée est de type ISOHybrid, mais ses créateurs ne l’ont pas rendue compatible avec le mode ISO (i.e. copie de fichier).\nA cause de cela, seule l’écriture en mode DD est applicable."
4305-
t MSG_322 "Installation standard de Windows 11 (TPM 2.0 + Secure Boot)"
4306-
t MSG_323 "Installation Windows 11 étendue (sans TPM / sans Secure Boot)"
4307-
t MSG_324 "Elimination des restrictions d’installation de Windows 11: %s"
43084305

43094306
#########################################################################
43104307
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"
57745771
t MSG_302 "Az alkalmazás névjegyének megjelenítése"
57755772
t MSG_303 "Napló megjelenítése"
57765773
t MSG_304 "Lemezkép készítése a kiválasztott eszközről"
5777-
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."
5774+
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)."
57785775
t MSG_306 "Meghajtó gyors-nullázása: %s"
57795776
t MSG_307 "ez eltarthat egy kis ideig"
57805777
t MSG_308 "VHD észlelés"
@@ -5791,10 +5788,7 @@ t MSG_318 "Alapértelmezett szál prioritás: %d"
57915788
t MSG_319 "Boot Marker figyelmen kívül hagyása"
57925789
t MSG_320 "Partíció elrendezés frissítése (%s)..."
57935790
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."
5794-
t MSG_322 "Alapértelmezett Windows 11 telepítés (TPM 2.0 + Secure Boot)"
5795-
t MSG_323 "Kiterjesztett Windows 11 telepítés (nincs TPM / nincs Secure Boot)"
5796-
t MSG_324 "Windows 11 telepítési korlátozások eltávolítása: %s"
5797-
t MSG_325 "Nem lehet megnyitni vagy olvasni ezt: '%s'"
5791+
t MSG_322 "Nem lehet megnyitni vagy olvasni ezt: '%s'"
57985792

57995793
#########################################################################
58005794
l "id-ID" "Indonesian (Bahasa Indonesia)" 0x0421
@@ -9878,9 +9872,6 @@ t MSG_318 "Prioridade padrão da thread: %d"
98789872
t MSG_319 "Ignorar marcador de inicialização"
98799873
t MSG_320 "Atualizando o layout da partição (%s)..."
98809874
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."
9881-
t MSG_322 "Instalação padrão do Windows 11 (TPM 2.0 + Secure Boot)"
9882-
t MSG_323 "Instalação estendida do Windows 11 (sem TPM / sem Secure Boot)"
9883-
t MSG_324 "Removendo as restrições de instalação do Windows 11: %s"
98849875

98859876
#########################################################################
98869877
l "pt-PT" "Portuguese Standard (Português)" 0x0816
@@ -10253,9 +10244,6 @@ t MSG_318 "Prioridade padrão do thread: %d"
1025310244
t MSG_319 "Ignorar marcador de arranque"
1025410245
t MSG_320 "A atualizar a estrutura da partição (%s)..."
1025510246
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."
10256-
t MSG_322 "Instalação padrão do Windows 11 (TPM 2.0 + Secure Boot)"
10257-
t MSG_323 "Instalação alterada do Windows 11 (sem TPM / sem Secure Boot)"
10258-
t MSG_324 "A remover as restrições de instalação do Windows 11: %s"
1025910247

1026010248
#########################################################################
1026110249
l "ro-RO" "Romanian (Română)" 0x0418, 0x0818
@@ -10613,7 +10601,7 @@ t MSG_301 "Afișați setările aplicației"
1061310601
t MSG_302 "Afișați informații despre această aplicație"
1061410602
t MSG_303 "Afișați jurnalul"
1061510603
t MSG_304 "Generați o imagine de disc după dispozitivul selectat"
10616-
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."
10604+
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)."
1061710605
t MSG_306 "Se scriu rapid zerouri pe unitate: %s"
1061810606
t MSG_307 "poate dura mai mult timp"
1061910607
t MSG_308 "Detectare VHD"
@@ -10630,9 +10618,6 @@ t MSG_318 "Prioritate implicită pentru firul de execuție: %d"
1063010618
t MSG_319 "Ignorare Boot Marker"
1063110619
t MSG_320 "Se reîmprospătează așezarea partițiilor (%s)..."
1063210620
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."
10633-
t MSG_322 "Instalare Windows 11 standard (TPM 2.0 + Secure Boot)"
10634-
t MSG_323 "Instalare Windows 11 extinsă (fără TPM / fără Secure Boot)"
10635-
t MSG_324 "Se elimină restricțiile pentru instalarea Windows 11: %s"
1063610621

1063710622
#########################################################################
1063810623
l "ru-RU" "Russian (Русский)" 0x0419, 0x0819

src/format.c

Lines changed: 57 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ extern const int nb_steps[FS_MAX];
7171
extern uint32_t dur_mins, dur_secs;
7272
extern uint32_t wim_nb_files, wim_proc_files, wim_extra_files;
7373
static int actual_fs_type, wintogo_index = -1, wininst_index = 0;
74-
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, fast_zeroing, enable_file_indexing, write_as_image;
75-
extern BOOL use_vds, write_as_esp, is_vds_available;
74+
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, fast_zeroing, enable_file_indexing;
75+
extern BOOL write_as_image, use_vds, write_as_esp, is_vds_available, enable_inplace;
7676
extern const grub_patch_t grub_patch[2];
77+
extern char* unattend_xml_path;
7778
uint8_t *grub2_buf = NULL, *sec_buf = NULL;
7879
long grub2_len;
7980

@@ -1468,80 +1469,69 @@ static BOOL SetupWinToGo(DWORD DriveIndex, const char* drive_name, BOOL use_esp)
14681469
}
14691470

14701471
/*
1471-
* Edit sources/boot.wim registry to remove Windows 11 install restrictions
1472+
* Add unattend.xml to 'sources\boot.wim' (install) or 'Windows\Panther\' (Windows To Go)
14721473
*/
1473-
BOOL RemoveWindows11Restrictions(char drive_letter)
1474+
BOOL ApplyWindowsCustomization(char drive_letter, BOOL windows_to_go)
14741475
{
1475-
BOOL r = FALSE, is_hive_mounted = FALSE;
1476-
int i;
1476+
BOOL r = FALSE;
14771477
const int wim_index = 2;
1478-
const char* offline_hive_name = "RUFUS_OFFLINE_HIVE";
1479-
const char* key_name[] = { "BypassTPMCheck", "BypassSecureBootCheck" };
1480-
char boot_wim_path[] = "#:\\sources\\boot.wim", key_path[64];
1481-
char* mount_path = NULL;
1482-
char path[MAX_PATH];
1483-
HKEY hKey = NULL, hSubKey = NULL;
1484-
LSTATUS status;
1485-
DWORD dwDisp, dwVal = 1;
1486-
1487-
boot_wim_path[0] = drive_letter;
1488-
1489-
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 0, PATCH_PROGRESS_TOTAL);
1490-
uprintf("Mounting '%s'...", boot_wim_path);
1491-
1492-
mount_path = WimMountImage(boot_wim_path, wim_index);
1493-
if (mount_path == NULL)
1494-
goto out;
1495-
1496-
static_sprintf(path, "%s\\Windows\\System32\\config\\SYSTEM", mount_path);
1497-
if (!MountRegistryHive(HKEY_LOCAL_MACHINE, offline_hive_name, path))
1498-
goto out;
1499-
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 102, PATCH_PROGRESS_TOTAL);
1500-
is_hive_mounted = TRUE;
1501-
1502-
static_sprintf(key_path, "%s\\Setup", offline_hive_name);
1503-
status = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key_path, 0, KEY_READ | KEY_CREATE_SUB_KEY, &hKey);
1504-
if (status != ERROR_SUCCESS) {
1505-
SetLastError(status);
1506-
uprintf("Could not open 'HKLM\\SYSTEM\\Setup' registry key: %s", WindowsErrorString());
1507-
goto out;
1508-
}
1478+
char boot_wim_path[] = "?:\\sources\\boot.wim";
1479+
char appraiserres_dll_src[] = "?:\\sources\\appraiserres.dll";
1480+
char appraiserres_dll_dst[] = "?:\\sources\\appraiserres.bak";
1481+
char *mount_path = NULL, path[MAX_PATH];
1482+
1483+
assert(unattend_xml_path != NULL);
1484+
uprintf("Applying Windows customization:");
1485+
if (windows_to_go) {
1486+
static_sprintf(path, "%c:\\Windows\\Panther", drive_letter);
1487+
if (!CreateDirectoryA(path, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
1488+
uprintf("Could not create '%s' : %s", path, WindowsErrorString());
1489+
goto out;
1490+
}
1491+
static_sprintf(path, "%c:\\Windows\\Panther\\unattend.xml", drive_letter);
1492+
if (!CopyFileA(unattend_xml_path, path, TRUE)) {
1493+
uprintf("Could not create '%s' : %s", path, WindowsErrorString());
1494+
goto out;
1495+
}
1496+
uprintf("Added '%s'", path);
1497+
} else {
1498+
boot_wim_path[0] = drive_letter;
1499+
if (enable_inplace) {
1500+
// Create a backup of sources\appraiserres.dll and then create an empty file to
1501+
// allow in-place upgrades without TPM/SB. Note that we need to create an empty,
1502+
// appraiserres.dll otherwise setup.exe extracts its own.
1503+
appraiserres_dll_src[0] = drive_letter;
1504+
appraiserres_dll_dst[0] = drive_letter;
1505+
if (!MoveFileExU(appraiserres_dll_src, appraiserres_dll_dst, MOVEFILE_REPLACE_EXISTING))
1506+
uprintf("Could not rename '%s': %s", appraiserres_dll_src, WindowsErrorString());
1507+
else
1508+
CloseHandle(CreateFileU(appraiserres_dll_src, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
1509+
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
1510+
uprintf("Renamed '%s' → '%s'", appraiserres_dll_src, appraiserres_dll_dst);
1511+
}
15091512

1510-
status = RegCreateKeyExA(hKey, "LabConfig", 0, NULL, 0,
1511-
KEY_SET_VALUE | KEY_QUERY_VALUE | KEY_CREATE_SUB_KEY, NULL, &hSubKey, &dwDisp);
1512-
if (status != ERROR_SUCCESS) {
1513-
SetLastError(status);
1514-
uprintf("Could not create 'HKLM\\SYSTEM\\Setup\\LabConfig' registry key: %s", WindowsErrorString());
1515-
goto out;
1516-
}
1513+
UpdateProgressWithInfoForce(OP_PATCH, MSG_325, 0, PATCH_PROGRESS_TOTAL);
1514+
uprintf("Mounting '%s'...", boot_wim_path);
1515+
mount_path = WimMountImage(boot_wim_path, wim_index);
1516+
if (mount_path == NULL)
1517+
goto out;
15171518

1518-
for (i = 0; i < ARRAYSIZE(key_name); i++) {
1519-
status = RegSetValueExA(hSubKey, key_name[i], 0, REG_DWORD, (LPBYTE)&dwVal, sizeof(DWORD));
1520-
if (status != ERROR_SUCCESS) {
1521-
SetLastError(status);
1522-
uprintf("Could not set 'HKLM\\SYSTEM\\Setup\\LabConfig\\%s' registry key: %s",
1523-
key_name[i], WindowsErrorString());
1519+
static_sprintf(path, "%s\\Autounattend.xml", mount_path);
1520+
if (!CopyFileU(unattend_xml_path, path, TRUE)) {
1521+
uprintf("Could not create boot.wim 'Autounattend.xml': %s", WindowsErrorString());
15241522
goto out;
15251523
}
1526-
uprintf("Created 'HKLM\\SYSTEM\\Setup\\LabConfig\\%s' registry key", key_name[i]);
1524+
uprintf("Added 'Autounattend.xml' to '%s'", boot_wim_path);
1525+
UpdateProgressWithInfoForce(OP_PATCH, MSG_325, 103, PATCH_PROGRESS_TOTAL);
15271526
}
1528-
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 103, PATCH_PROGRESS_TOTAL);
15291527
r = TRUE;
15301528

15311529
out:
1532-
if (hSubKey != NULL)
1533-
RegCloseKey(hSubKey);
1534-
if (hKey != NULL)
1535-
RegCloseKey(hKey);
1536-
if (is_hive_mounted) {
1537-
UnmountRegistryHive(HKEY_LOCAL_MACHINE, offline_hive_name);
1538-
UpdateProgressWithInfoForce(OP_PATCH, MSG_324, 104, PATCH_PROGRESS_TOTAL);
1539-
}
15401530
if (mount_path) {
15411531
uprintf("Unmounting '%s'...", boot_wim_path, wim_index);
15421532
WimUnmountImage(boot_wim_path, wim_index);
1533+
UpdateProgressWithInfo(OP_PATCH, MSG_325, PATCH_PROGRESS_TOTAL, PATCH_PROGRESS_TOTAL);
15431534
}
1544-
UpdateProgressWithInfo(OP_PATCH, MSG_324, PATCH_PROGRESS_TOTAL, PATCH_PROGRESS_TOTAL);
15451535
free(mount_path);
15461536
return r;
15471537
}
@@ -1900,8 +1890,6 @@ DWORD WINAPI FormatThread(void* param)
19001890
char drive_letters[27], fs_name[32], label[64];
19011891
char logfile[MAX_PATH], *userdir;
19021892
char efi_dst[] = "?:\\efi\\boot\\bootx64.efi";
1903-
char appraiserres_dll_src[] = "?:\\sources\\appraiserres.dll";
1904-
char appraiserres_dll_dst[] = "?:\\sources\\appraiserres.bak";
19051893
char kolibri_dst[] = "?:\\MTLD_F32";
19061894
char grub4dos_dst[] = "?:\\grldr";
19071895

@@ -2336,6 +2324,10 @@ DWORD WINAPI FormatThread(void* param)
23362324
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_ISO_EXTRACT);
23372325
goto out;
23382326
}
2327+
if (unattend_xml_path != NULL) {
2328+
if (!ApplyWindowsCustomization(drive_name[0], TRUE))
2329+
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_PATCH);
2330+
}
23392331
} else {
23402332
assert(!img_report.is_windows_img);
23412333
if (!ExtractISO(image_path, drive_name, FALSE)) {
@@ -2374,20 +2366,8 @@ DWORD WINAPI FormatThread(void* param)
23742366
if (!SetupWinPE(drive_name[0]))
23752367
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH);
23762368
}
2377-
if (ComboBox_GetCurItemData(hImageOption) == IMOP_WIN_EXTENDED) {
2378-
// Create a backup of sources\appraiserres.dll and then create an empty file to
2379-
// allow in-place upgrades without TPM/SB. Note that we need to create an empty,
2380-
// appraiserres.dll otherwise setup.exe extracts its own.
2381-
appraiserres_dll_src[0] = drive_name[0];
2382-
appraiserres_dll_dst[0] = drive_name[0];
2383-
uprintf("Renaming: '%s' → '%s'", appraiserres_dll_src, appraiserres_dll_dst);
2384-
if (!MoveFileExU(appraiserres_dll_src, appraiserres_dll_dst, MOVEFILE_REPLACE_EXISTING))
2385-
uprintf(" Rename failed: %s", WindowsErrorString());
2386-
else
2387-
CloseHandle(CreateFileU(appraiserres_dll_src, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
2388-
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
2389-
// Now patch for boot-time TPM/SB checks.
2390-
if (!RemoveWindows11Restrictions(drive_name[0]))
2369+
if (unattend_xml_path != NULL) {
2370+
if (!ApplyWindowsCustomization(drive_name[0], FALSE))
23912371
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_PATCH);
23922372
}
23932373
}

0 commit comments

Comments
 (0)