[iso] fix detection of GRUB version

* Commit 77d319267f broke lookup of ISO filenames since iso9660_open()
  enabled the Rock Ridge extensions by default, despite using ISO_EXTENSION_NONE
  for the internal call, and we addressed a FIXME related to this.
* This resulted in Rufus not being able to lookup 'boot/grub/i386-pc/normal.mod' to parse GRUB's
  version, since without Rock Ridge, 'i386-pc/' is unable to match the ISO-9660 'I386_PC/' dir.
* Closes #1573 and addresses part of #1616.
* Also fix a MinGW compilation warning.
This commit is contained in:
Pete Batard 2020-09-11 22:42:20 +01:00
parent 2d63a10920
commit a8f3c6c572
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
4 changed files with 16 additions and 11 deletions

View File

@ -406,7 +406,7 @@ char* AltGetLogicalName(DWORD DriveIndex, uint64_t PartitionOffset, BOOL bKeepTr
static_strcpy(volume_name, groot_name);
if (!QueryDosDeviceA(path, &volume_name[groot_len], (DWORD)(MAX_PATH - groot_len)) || (strlen(volume_name) < 20)) {
suprintf("Could not find a DOS volume name for '%s': %s", path, WindowsErrorString());
goto out;
goto out;
} else if (bKeepTrailingBackslash) {
static_strcat(volume_name, "\\");
}

View File

@ -59,6 +59,10 @@
#define S_IFLNK 0xA000
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
// Set the iso_open_ext() extension mask according to our global options
#define ISO_EXTENSION_MASK (ISO_EXTENSION_ALL & (enable_joliet ? ISO_EXTENSION_ALL : ~ISO_EXTENSION_JOLIET) & \
(enable_rockridge ? ISO_EXTENSION_ALL : ~ISO_EXTENSION_ROCK_RIDGE))
// Needed for UDF ISO access
CdIo_t* cdio_open (const char* psz_source, driver_id_t driver_id) {return NULL;}
void cdio_destroy (CdIo_t* p_cdio) {}
@ -1181,7 +1185,9 @@ int64_t ExtractISOFile(const char* iso, const char* iso_file, const char* dest_f
goto out;
try_iso:
p_iso = iso9660_open(iso);
// Make sure to enable extensions, else we may not match the name of the file we are looking
// for since Rock Ridge may be needed to translate something like 'I386_PC' into 'i386-pc'...
p_iso = iso9660_open_ext(iso, ISO_EXTENSION_MASK);
if (p_iso == NULL) {
uprintf("Unable to open image '%s'", iso);
goto out;
@ -1266,7 +1272,7 @@ uint32_t GetInstallWimVersion(const char* iso)
goto out;
try_iso:
p_iso = iso9660_open(iso);
p_iso = iso9660_open_ext(iso, ISO_EXTENSION_MASK);
if (p_iso == NULL) {
uprintf("Could not open image '%s'", iso);
goto out;
@ -1353,7 +1359,7 @@ BOOL HasEfiImgBootLoaders(void)
if ((image_path == NULL) || !HAS_EFI_IMG(img_report))
return FALSE;
p_iso = iso9660_open(image_path);
p_iso = iso9660_open_ext(image_path, ISO_EXTENSION_MASK);
if (p_iso == NULL) {
uprintf("Could not open image '%s' as an ISO-9660 file system", image_path);
goto out;
@ -1444,7 +1450,7 @@ BOOL DumpFatDir(const char* path, int32_t cluster)
// Root dir => Perform init stuff
if (image_path == NULL)
return FALSE;
p_iso = iso9660_open(image_path);
p_iso = iso9660_open_ext(image_path, ISO_EXTENSION_MASK);
if (p_iso == NULL) {
uprintf("Could not open image '%s' as an ISO-9660 file system", image_path);
goto out;

View File

@ -482,7 +482,6 @@ extern char *image_path, *fido_url;
/*
* Shared prototypes
*/
extern uint8_t popcnt8(uint8_t val);
extern void GetWindowsVersion(void);
extern BOOL is_x64(void);
extern BOOL GetCpuArch(void);

View File

@ -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 3.12.1701"
CAPTION "Rufus 3.12.1702"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,12,1701,0
PRODUCTVERSION 3,12,1701,0
FILEVERSION 3,12,1702,0
PRODUCTVERSION 3,12,1702,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.12.1701"
VALUE "FileVersion", "3.12.1702"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.12.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.12.1701"
VALUE "ProductVersion", "3.12.1702"
END
END
BLOCK "VarFileInfo"