From 78608c35fedac8f4e59497e53c1326799b3b2a58 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 15 Jul 2024 17:35:08 +0100 Subject: [PATCH] [wue] fix TimeZone option not being applied to the right parent * Closes #2519. * Also update MinGW's base WINVER to Windows 10. --- configure | 2 +- configure.ac | 2 +- src/rufus.h | 2 +- src/rufus.rc | 10 +++++----- src/vhd.h | 4 ---- src/wue.c | 14 ++++++++++---- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 0c1f38d5..667af6b2 100755 --- a/configure +++ b/configure @@ -4638,7 +4638,7 @@ esac printf "%s\n" "#define _GNU_SOURCE /**/" >>confdefs.h -AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800" +AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 -D_WIN32_IE=0x0A00" # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) # "-Wl,--dynamicbase" to enable ASLR (Address Space Layout Randomization) AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp -Wl,--dynamicbase" diff --git a/configure.ac b/configure.ac index 2d757d0a..513ab26d 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ AC_CHECK_TOOL(WINDRES, windres, :) AC_C_INLINE AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) -AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800" +AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 -D_WIN32_IE=0x0A00" # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) # "-Wl,--dynamicbase" to enable ASLR (Address Space Layout Randomization) AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat -Wl,--no-insert-timestamp -Wl,--dynamicbase" diff --git a/src/rufus.h b/src/rufus.h index 86e09a77..5007f9bd 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -627,7 +627,7 @@ typedef struct { #define UNATTEND_WINPE_SETUP_MASK (UNATTEND_SECUREBOOT_TPM_MINRAM) #define UNATTEND_SPECIALIZE_DEPLOYMENT_MASK (UNATTEND_NO_ONLINE_ACCOUNT) -#define UNATTEND_OOBE_SHELL_SETUP_MASK (UNATTEND_NO_DATA_COLLECTION | UNATTEND_SET_USER) +#define UNATTEND_OOBE_SHELL_SETUP_MASK (UNATTEND_NO_DATA_COLLECTION | UNATTEND_SET_USER | UNATTEND_DUPLICATE_LOCALE) #define UNATTEND_OOBE_INTERNATIONAL_MASK (UNATTEND_DUPLICATE_LOCALE) #define UNATTEND_OOBE_MASK (UNATTEND_OOBE_SHELL_SETUP_MASK | UNATTEND_OOBE_INTERNATIONAL_MASK | UNATTEND_DISABLE_BITLOCKER) #define UNATTEND_OFFLINE_SERVICING_MASK (UNATTEND_OFFLINE_INTERNAL_DRIVES | UNATTEND_FORCE_S_MODE) diff --git a/src/rufus.rc b/src/rufus.rc index 38356a1e..8392db42 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 4.6.2188" +CAPTION "Rufus 4.6.2189" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -397,8 +397,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,2188,0 - PRODUCTVERSION 4,6,2188,0 + FILEVERSION 4,6,2189,0 + PRODUCTVERSION 4,6,2189,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -416,13 +416,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "4.6.2188" + VALUE "FileVersion", "4.6.2189" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "� 2011-2024 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-4.6.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "4.6.2188" + VALUE "ProductVersion", "4.6.2189" END END BLOCK "VarFileInfo" diff --git a/src/vhd.h b/src/vhd.h index 75fa1c03..07e2c74e 100644 --- a/src/vhd.h +++ b/src/vhd.h @@ -60,10 +60,6 @@ #define MBR_SIZE 512 // Might need to review this once we see bootable 4k systems -// TODO: Remove this once MinGW has been updated -#ifndef VIRTUAL_STORAGE_TYPE_DEVICE_VHDX -#define VIRTUAL_STORAGE_TYPE_DEVICE_VHDX 3 -#endif #define VIRTUAL_STORAGE_TYPE_DEVICE_FFU 99 #define CREATE_VIRTUAL_DISK_VERSION_2 2 #define CREATE_VIRTUAL_DISK_FLAG_CREATE_BACKING_STORAGE 8 diff --git a/src/wue.c b/src/wue.c index 2cb78396..b257cb67 100644 --- a/src/wue.c +++ b/src/wue.c @@ -64,6 +64,7 @@ char* CreateUnattendXml(int arch, int flags) const static char* xml_arch_names[5] = { "x86", "amd64", "arm", "arm64" }; const static char* unallowed_account_names[] = { "Administrator", "Guest", "KRBTGT", "Local" }; static char path[MAX_PATH]; + char* tzstr; FILE* fd; TIME_ZONE_INFORMATION tz_info; int i, order; @@ -152,6 +153,15 @@ char* CreateUnattendXml(int arch, int flags) fprintf(fd, " 3\n"); fprintf(fd, " \n"); } + if (flags & UNATTEND_DUPLICATE_LOCALE) { + if ((GetTimeZoneInformation(&tz_info) == TIME_ZONE_ID_INVALID) || + ((tzstr = wchar_to_utf8(tz_info.StandardName)) == NULL)) { + uprintf("WARNING: Could not retrieve current timezone: %s", WindowsErrorString()); + } else { + fprintf(fd, " %s\n", tzstr); + free(tzstr); + } + } if (flags & UNATTEND_SET_USER) { for (i = 0; (i < ARRAYSIZE(unallowed_account_names)) && (stricmp(unattend_username, unallowed_account_names[i]) != 0); i++); if (i < ARRAYSIZE(unallowed_account_names)) { @@ -201,10 +211,6 @@ char* CreateUnattendXml(int arch, int flags) ReadRegistryKeyStr(REGKEY_HKCU, "Keyboard Layout\\Preload\\1")); fprintf(fd, " %s\n", ToLocaleName(GetSystemDefaultLCID())); fprintf(fd, " %s\n", ToLocaleName(GetUserDefaultLCID())); - if (GetTimeZoneInformation(&tz_info) == TIME_ZONE_ID_INVALID) - uprintf("WARNING: Could not retrieve current timezone: %s", WindowsErrorString()); - else - fprintf(fd, " %S\n", tz_info.StandardName); fprintf(fd, " %s\n", ToLocaleName(GetUserDefaultUILanguage())); fprintf(fd, " %s\n", // NB: Officially, this is a REG_MULTI_SZ string