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

[uefi] fix path of SKUSiPolicy.p7b for WOW

* 32-bit x86 running on 64-bit x86 Windows needs to get SKUSiPolicy.p7b from sysnative.
* Also fix automatic extension switching in file dialog and a small MinGW warning in Bled.
This commit is contained in:
Pete Batard 2023-07-01 20:22:10 +01:00
parent c47ee4c435
commit 1476e9cd8b
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 18 additions and 8 deletions

View file

@ -209,7 +209,7 @@ do { if (BB_BIG_ENDIAN) { \
(c64).fmt.cdf_offset = SWAP_LE64((c64).fmt.cdf_offset); \ (c64).fmt.cdf_offset = SWAP_LE64((c64).fmt.cdf_offset); \
}} while (0) }} while (0)
inline void BUG() { inline void BUG(void) {
/* Check the offset of the last element, not the length. This leniency /* Check the offset of the last element, not the length. This leniency
* allows for poor packing, whereby the overall struct may be too long, * allows for poor packing, whereby the overall struct may be too long,
* even though the elements are all in the right place. * even though the elements are all in the right place.

View file

@ -812,7 +812,8 @@ BOOL ParseSKUSiPolicy(void)
pe256ssp_size = 0; pe256ssp_size = 0;
safe_free(pe256ssp); safe_free(pe256ssp);
static_sprintf(path, "%s\\SecureBootUpdates\\SKUSiPolicy.p7b", system_dir); // Must use sysnative for WOW
static_sprintf(path, "%s\\SecureBootUpdates\\SKUSiPolicy.p7b", sysnative_dir);
wpath = utf8_to_wchar(path); wpath = utf8_to_wchar(path);
if (wpath == NULL) if (wpath == NULL)
goto out; goto out;

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 4.2.2058" CAPTION "Rufus 4.2.2059"
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 4,2,2058,0 FILEVERSION 4,2,2059,0
PRODUCTVERSION 4,2,2058,0 PRODUCTVERSION 4,2,2059,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", "4.2.2058" VALUE "FileVersion", "4.2.2059"
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-4.2.exe" VALUE "OriginalFilename", "rufus-4.2.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.2.2058" VALUE "ProductVersion", "4.2.2059"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -103,7 +103,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options)
IFileDialog *pfd = NULL; IFileDialog *pfd = NULL;
IShellItem *psiResult; IShellItem *psiResult;
COMDLG_FILTERSPEC* filter_spec = NULL; COMDLG_FILTERSPEC* filter_spec = NULL;
wchar_t *wpath = NULL, *wfilename = NULL; wchar_t *wpath = NULL, *wfilename = NULL, *wext = NULL;
IShellItem *si_path = NULL; // Automatically freed IShellItem *si_path = NULL; // Automatically freed
if ((ext == NULL) || (ext->count == 0) || (ext->extension == NULL) || (ext->description == NULL)) if ((ext == NULL) || (ext->count == 0) || (ext->extension == NULL) || (ext->description == NULL))
@ -162,11 +162,20 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options)
if (wfilename != NULL) { if (wfilename != NULL) {
IFileDialog_SetFileName(pfd, wfilename); IFileDialog_SetFileName(pfd, wfilename);
} }
// Set a default extension so that when the user switches filters it gets
// automatically updated. Note that the IFileDialog::SetDefaultExtension()
// doc says the extension shouldn't be prefixed with unwanted characters
// but it appears to work regardless so we don't bother cleaning it.
wext = utf8_to_wchar((ext->extension == NULL) ? "" : ext->extension[0]);
if (wext != NULL) {
IFileDialog_SetDefaultExtension(pfd, wext);
}
// Display the dialog // Display the dialog
hr = IFileDialog_Show(pfd, hMainDialog); hr = IFileDialog_Show(pfd, hMainDialog);
// Cleanup // Cleanup
safe_free(wext);
safe_free(wfilename); safe_free(wfilename);
for (i = 0; i < ext->count; i++) { for (i = 0; i < ext->count; i++) {
safe_free(filter_spec[i].pszSpec); safe_free(filter_spec[i].pszSpec);