[efi] set UEFI mode when a pure EFI ISO is selected

* Closes #168
* Also fix various VS Code Analysis warnings
This commit is contained in:
Pete Batard 2013-12-22 20:48:57 +00:00
parent 63e1fe3d55
commit 24e73c5e10
7 changed files with 38 additions and 23 deletions

View file

@ -126,7 +126,7 @@ static void log_handler (cdio_log_level_t level, const char *message)
* Scan and set ISO properties * Scan and set ISO properties
* Returns true if the the current file does not need to be processed further * Returns true if the the current file does not need to be processed further
*/ */
static __inline BOOL check_iso_props(const char* psz_dirname, BOOL* is_syslinux_cfg, BOOL* is_old_c32, static BOOL check_iso_props(const char* psz_dirname, BOOL* is_syslinux_cfg, BOOL* is_old_c32,
int64_t i_file_length, const char* psz_basename, const char* psz_fullpath) int64_t i_file_length, const char* psz_basename, const char* psz_fullpath)
{ {
size_t i, j; size_t i, j;

View file

@ -380,12 +380,13 @@ BOOL dispatch_loc_cmd(loc_cmd* lcmd)
if (lcmd->command <= LC_TEXT) { if (lcmd->command <= LC_TEXT) {
// Any command up to LC_TEXT takes a control ID in text[0] // Any command up to LC_TEXT takes a control ID in text[0]
if (safe_strncmp(lcmd->txt[0], msg_prefix, 4) == 0) { if (safe_strncmp(lcmd->txt[0], msg_prefix, 4) == 0) {
if (lcmd->command != LC_TEXT) { // The unneeded NULL check is to silence a VS warning
if ((lcmd->txt[0] == NULL) || (lcmd->command != LC_TEXT)) {
luprint("only the [t]ext command can be applied to a message (MSG_###)\n"); luprint("only the [t]ext command can be applied to a message (MSG_###)\n");
goto err; goto err;
} }
// Try to convert the numeric part of a MSG_#### to a numeric // Try to convert the numeric part of a MSG_#### to a numeric
lcmd->ctrl_id = MSG_000 + atoi(&lcmd->txt[0][4]); lcmd->ctrl_id = MSG_000 + atoi(&(lcmd->txt[0][4]));
if (lcmd->ctrl_id == MSG_000) { if (lcmd->ctrl_id == MSG_000) {
// Conversion could not be performed // Conversion could not be performed
luprintf("failed to convert the numeric value in '%'\n", lcmd->txt[0]); luprintf("failed to convert the numeric value in '%'\n", lcmd->txt[0]);

View file

@ -404,6 +404,10 @@ BOOL get_loc_data_file(const char* filename, loc_cmd* lcmd)
old_loc_line_nr = loc_line_nr; old_loc_line_nr = loc_line_nr;
} }
if (lcmd == NULL) {
uprintf("Spock gone crazy error!\n");
goto out;
}
offset = (long)lcmd->num[0]; offset = (long)lcmd->num[0];
end_offset = (long)lcmd->num[1]; end_offset = (long)lcmd->num[1];
start_line = lcmd->line_nr; start_line = lcmd->line_nr;

View file

@ -165,7 +165,7 @@ static __inline BOOL WriteRegistryKey32(HKEY root, const char* key, int32_t val)
/* Helpers for String registry operations */ /* Helpers for String registry operations */
#define GetRegistryKeyStr(root, key, str, len) _GetRegistryKey(root, key, REG_SZ, (LPBYTE)str, (DWORD)len) #define GetRegistryKeyStr(root, key, str, len) _GetRegistryKey(root, key, REG_SZ, (LPBYTE)str, (DWORD)len)
#define SetRegistryKeyStr(root, key, str) _SetRegistryKey(root, key, REG_SZ, (LPBYTE)str, safe_strlen(str)) #define SetRegistryKeyStr(root, key, str) _SetRegistryKey(root, key, REG_SZ, (LPBYTE)str, (DWORD)safe_strlen(str))
// Use a static buffer - don't allocate // Use a static buffer - don't allocate
static __inline char* ReadRegistryKeyStr(HKEY root, const char* key) { static __inline char* ReadRegistryKeyStr(HKEY root, const char* key) {
static char str[512]; static char str[512];

View file

@ -522,6 +522,22 @@ static void SetPartitionSchemeTooltip(void)
} }
} }
static void SetTargetSystem(void)
{
int ts;
if (SelectedDrive.PartitionType == PARTITION_STYLE_GPT) {
ts = 2; // GPT/UEFI
} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker || (IS_EFI(iso_report) &&
(!iso_report.has_isolinux) && (!iso_report.has_bootmgr) && (!IS_WINPE(iso_report.winpe))) ) {
ts = 1; // MBR/UEFI
} else {
ts = 0; // MBR/BIOS|UEFI
}
IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, ts));
SetPartitionSchemeTooltip();
}
/* /*
* Populate the UI properties * Populate the UI properties
*/ */
@ -544,8 +560,6 @@ static BOOL PopulateProperties(int ComboIndex)
if (!GetDriveInfo(ComboIndex)) // This also populates FS if (!GetDriveInfo(ComboIndex)) // This also populates FS
return FALSE; return FALSE;
SetFSFromISO();
EnableBootOptions(TRUE);
HumanReadableSize = (double)SelectedDrive.DiskSize; HumanReadableSize = (double)SelectedDrive.DiskSize;
for (i=1; i<MAX_SIZE_SUFFIXES; i++) { for (i=1; i<MAX_SIZE_SUFFIXES; i++) {
@ -567,15 +581,10 @@ static BOOL PopulateProperties(int ComboIndex)
} }
if (i >= MAX_SIZE_SUFFIXES) if (i >= MAX_SIZE_SUFFIXES)
uprintf("Could not populate partition scheme data\n"); uprintf("Could not populate partition scheme data\n");
if (SelectedDrive.PartitionType == PARTITION_STYLE_GPT) {
j = 2; SetTargetSystem();
} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker) { SetFSFromISO();
j = 1; EnableBootOptions(TRUE);
} else {
j = 0;
}
IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, j));
SetPartitionSchemeTooltip();
device_tooltip = (char*) malloc(safe_strlen(DriveID.Table[ComboIndex]) + 16); device_tooltip = (char*) malloc(safe_strlen(DriveID.Table[ComboIndex]) + 16);
// Set a proposed label according to the size (eg: "256MB", "8GB") // Set a proposed label according to the size (eg: "256MB", "8GB")
@ -1176,8 +1185,9 @@ DWORD WINAPI ISOScanThread(LPVOID param)
} }
} }
// Enable DOS, set DOS Type to ISO (last item) and set FS accordingly // Enable bootable and set Target System and FS accordingly
CheckDlgButton(hMainDialog, IDC_BOOT, BST_CHECKED); CheckDlgButton(hMainDialog, IDC_BOOT, BST_CHECKED);
SetTargetSystem();
SetFSFromISO(); SetFSFromISO();
SetMBRProps(); SetMBRProps();
for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--);

View file

@ -180,8 +180,8 @@ enum bios_type {
BT_MAX BT_MAX
}; };
// For the partition types we'll use Microsoft's PARTITION_STYLE_### constants // For the partition types we'll use Microsoft's PARTITION_STYLE_### constants
#define GETBIOSTYPE(x) (((x) >> 16) & 0xFFFF) #define GETBIOSTYPE(x) (((x)>0)?(((x) >> 16) & 0xFFFF):0)
#define GETPARTTYPE(x) ((x) & 0xFFFF); #define GETPARTTYPE(x) (((x)>0)?((x) & 0xFFFF):0);
/* Current drive info */ /* Current drive info */
typedef struct { typedef struct {

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329 IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.4.2.361" CAPTION "Rufus v1.4.2.362"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -288,8 +288,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,2,361 FILEVERSION 1,4,2,362
PRODUCTVERSION 1,4,2,361 PRODUCTVERSION 1,4,2,362
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -306,13 +306,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.2.361" VALUE "FileVersion", "1.4.2.362"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.2.361" VALUE "ProductVersion", "1.4.2.362"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"