Skip to content

Commit

Permalink
[wue] fix TimeZone option not being applied to the right parent
Browse files Browse the repository at this point in the history
* Closes #2519.
* Also update MinGW's base WINVER to Windows 10.
  • Loading branch information
pbatard committed Jul 15, 2024
1 parent 9b3c111 commit 78608c3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/rufus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/rufus.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions src/vhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions src/wue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -152,6 +153,15 @@ char* CreateUnattendXml(int arch, int flags)
fprintf(fd, " <ProtectYourPC>3</ProtectYourPC>\n");
fprintf(fd, " </OOBE>\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, " <TimeZone>%s</TimeZone>\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)) {
Expand Down Expand Up @@ -201,10 +211,6 @@ char* CreateUnattendXml(int arch, int flags)
ReadRegistryKeyStr(REGKEY_HKCU, "Keyboard Layout\\Preload\\1"));
fprintf(fd, " <SystemLocale>%s</SystemLocale>\n", ToLocaleName(GetSystemDefaultLCID()));
fprintf(fd, " <UserLocale>%s</UserLocale>\n", ToLocaleName(GetUserDefaultLCID()));
if (GetTimeZoneInformation(&tz_info) == TIME_ZONE_ID_INVALID)
uprintf("WARNING: Could not retrieve current timezone: %s", WindowsErrorString());
else
fprintf(fd, " <TimeZone>%S</TimeZone>\n", tz_info.StandardName);
fprintf(fd, " <UILanguage>%s</UILanguage>\n", ToLocaleName(GetUserDefaultUILanguage()));
fprintf(fd, " <UILanguageFallback>%s</UILanguageFallback>\n",
// NB: Officially, this is a REG_MULTI_SZ string
Expand Down

0 comments on commit 78608c3

Please sign in to comment.