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

[wue] display user-selected WUE options in the log

* Also fix a Coverity warning
This commit is contained in:
Pete Batard 2023-02-17 22:42:45 +00:00
parent 506274687b
commit 12bab09a9f
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 17 additions and 8 deletions

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 3.22.1972" CAPTION "Rufus 3.22.1973"
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
@ -392,8 +392,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,22,1972,0 FILEVERSION 3,22,1973,0
PRODUCTVERSION 3,22,1972,0 PRODUCTVERSION 3,22,1973,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -411,13 +411,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", "3.22.1972" VALUE "FileVersion", "3.22.1973"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2023 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-3.22.exe" VALUE "OriginalFilename", "rufus-3.22.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.22.1972" VALUE "ProductVersion", "3.22.1973"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -515,7 +515,7 @@ int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid)
if (usb_debug) { if (usb_debug) {
static_strcat(str, "Device score: "); static_strcat(str, "Device score: ");
for (i = 0; i < score_list_size; i++) for (i = 0; i < score_list_size; i++)
static_sprintf(&str[strlen(str)], "%+d", score_list[i]); safe_sprintf(&str[strlen(str)], sizeof(str) - strlen(str), "%+d", score_list[i]);
uprintf("%s=%+d → Detected as %s", str, score, (score > 0) ? "HDD" : "UFD"); uprintf("%s=%+d → Detected as %s", str, score, (score > 0) ? "HDD" : "UFD");
} }

View file

@ -61,8 +61,10 @@ char* CreateUnattendXml(int arch, int flags)
int i, order; int i, order;
const char* xml_arch_names[5] = { "x86", "amd64", "arm", "arm64" }; const char* xml_arch_names[5] = { "x86", "amd64", "arm", "arm64" };
unattend_xml_flags = flags; unattend_xml_flags = flags;
if (arch < ARCH_X86_32 || arch > ARCH_ARM_64 || flags == 0) if (arch < ARCH_X86_32 || arch > ARCH_ARM_64 || flags == 0) {
uprintf("Note: No Windows User Experience options selected");
return NULL; return NULL;
}
arch--; arch--;
// coverity[swapped_arguments] // coverity[swapped_arguments]
if (GetTempFileNameU(temp_dir, APPLICATION_NAME, 0, path) == 0) if (GetTempFileNameU(temp_dir, APPLICATION_NAME, 0, path) == 0)
@ -71,6 +73,7 @@ char* CreateUnattendXml(int arch, int flags)
if (fd == NULL) if (fd == NULL)
return NULL; return NULL;
uprintf("Selected Windows User Experience options:");
fprintf(fd, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); fprintf(fd, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
fprintf(fd, "<unattend xmlns=\"urn:schemas-microsoft-com:unattend\">\n"); fprintf(fd, "<unattend xmlns=\"urn:schemas-microsoft-com:unattend\">\n");
@ -91,6 +94,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_SECUREBOOT_TPM_MINRAM) { if (flags & UNATTEND_SECUREBOOT_TPM_MINRAM) {
uprintf("• Bypass SB/TPM/RAM");
fprintf(fd, " <RunSynchronous>\n"); fprintf(fd, " <RunSynchronous>\n");
for (i = 0; i < ARRAYSIZE(bypass_name); i++) { for (i = 0; i < ARRAYSIZE(bypass_name); i++) {
fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n"); fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n");
@ -113,6 +117,7 @@ char* CreateUnattendXml(int arch, int flags)
fprintf(fd, " <RunSynchronous>\n"); fprintf(fd, " <RunSynchronous>\n");
// This part was picked from https://github.com/AveYo/MediaCreationTool.bat/blob/main/bypass11/AutoUnattend.xml // This part was picked from https://github.com/AveYo/MediaCreationTool.bat/blob/main/bypass11/AutoUnattend.xml
if (flags & UNATTEND_NO_ONLINE_ACCOUNT) { if (flags & UNATTEND_NO_ONLINE_ACCOUNT) {
uprintf("• Bypass online account requirement");
fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n"); fprintf(fd, " <RunSynchronousCommand wcm:action=\"add\">\n");
fprintf(fd, " <Order>%d</Order>\n", order++); 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, " <Path>reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\OOBE /v BypassNRO /t REG_DWORD /d 1 /f</Path>\n");
@ -134,6 +139,7 @@ char* CreateUnattendXml(int arch, int flags)
// It is really super insidous of Microsoft to call this option "ProtectYourPC", when it's really only about // 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... // data collection. But of course, if it was called "AllowDataCollection", everyone would turn it off...
if (flags & UNATTEND_NO_DATA_COLLECTION) { if (flags & UNATTEND_NO_DATA_COLLECTION) {
uprintf("• Disable data collection");
fprintf(fd, " <OOBE>\n"); fprintf(fd, " <OOBE>\n");
fprintf(fd, " <ProtectYourPC>3</ProtectYourPC>\n"); fprintf(fd, " <ProtectYourPC>3</ProtectYourPC>\n");
fprintf(fd, " </OOBE>\n"); fprintf(fd, " </OOBE>\n");
@ -143,7 +149,7 @@ char* CreateUnattendXml(int arch, int flags)
(stricmp(unattend_username, "Guest") == 0)) { (stricmp(unattend_username, "Guest") == 0)) {
uprintf("WARNING: '%s' is not allowed as local account name - Option ignored", unattend_username); uprintf("WARNING: '%s' is not allowed as local account name - Option ignored", unattend_username);
} else { } else {
uprintf("Will use '%s' for local account name", unattend_username); uprintf("• Use '%s' for local account name", unattend_username);
// If we create a local account in unattend.xml, then we can get Windows 11 // If we create a local account in unattend.xml, then we can get Windows 11
// 22H2 to skip MSA even if the network is connected during installation. // 22H2 to skip MSA even if the network is connected during installation.
fprintf(fd, " <UserAccounts>\n"); fprintf(fd, " <UserAccounts>\n");
@ -176,6 +182,7 @@ char* CreateUnattendXml(int arch, int flags)
fprintf(fd, " </component>\n"); fprintf(fd, " </component>\n");
} }
if (flags & UNATTEND_OOBE_INTERNATIONAL_MASK) { if (flags & UNATTEND_OOBE_INTERNATIONAL_MASK) {
uprintf("• Use the same regional options as this user's");
fprintf(fd, " <component name=\"Microsoft-Windows-International-Core\" processorArchitecture=\"%s\" language=\"neutral\" " fprintf(fd, " <component name=\"Microsoft-Windows-International-Core\" processorArchitecture=\"%s\" language=\"neutral\" "
"xmlns:wcm=\"http://schemas.microsoft.com/WMIConfig/2002/State\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " "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]); "publicKeyToken=\"31bf3856ad364e35\" versionScope=\"nonSxS\">\n", xml_arch_names[arch]);
@ -193,6 +200,7 @@ char* CreateUnattendXml(int arch, int flags)
fprintf(fd, " </component>\n"); fprintf(fd, " </component>\n");
} }
if (flags & UNATTEND_DISABLE_BITLOCKER) { if (flags & UNATTEND_DISABLE_BITLOCKER) {
uprintf("• Disable bitlocker");
fprintf(fd, " <component name=\"Microsoft-Windows-SecureStartup-FilterDriver\" processorArchitecture=\"%s\" language=\"neutral\" " fprintf(fd, " <component name=\"Microsoft-Windows-SecureStartup-FilterDriver\" processorArchitecture=\"%s\" language=\"neutral\" "
"xmlns:wcm=\"http://schemas.microsoft.com/WMIConfig/2002/State\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " "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]); "publicKeyToken=\"31bf3856ad364e35\" versionScope=\"nonSxS\">\n", xml_arch_names[arch]);
@ -205,6 +213,7 @@ char* CreateUnattendXml(int arch, int flags)
if (flags & UNATTEND_OFFLINE_SERVICING_MASK) { if (flags & UNATTEND_OFFLINE_SERVICING_MASK) {
fprintf(fd, " <settings pass=\"offlineServicing\">\n"); fprintf(fd, " <settings pass=\"offlineServicing\">\n");
if (flags & UNATTEND_OFFLINE_INTERNAL_DRIVES) { if (flags & UNATTEND_OFFLINE_INTERNAL_DRIVES) {
uprintf("• Set internal drives offline");
fprintf(fd, " <component name=\"Microsoft-Windows-PartitionManager\" processorArchitecture=\"%s\" language=\"neutral\" " fprintf(fd, " <component name=\"Microsoft-Windows-PartitionManager\" processorArchitecture=\"%s\" language=\"neutral\" "
"xmlns:wcm=\"http://schemas.microsoft.com/WMIConfig/2002/State\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " "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]); "publicKeyToken=\"31bf3856ad364e35\" versionScope=\"nonSxS\">\n", xml_arch_names[arch]);