mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[syslinux] fix dual EFI+BIOS support for tails and other ISOs
* Closes #381
This commit is contained in:
		
							parent
							
								
									91565477ed
								
							
						
					
					
						commit
						0c9c7a9569
					
				
					 3 changed files with 34 additions and 10 deletions
				
			
		
							
								
								
									
										31
									
								
								src/iso.c
									
										
									
									
									
								
							
							
						
						
									
										31
									
								
								src/iso.c
									
										
									
									
									
								
							|  | @ -121,8 +121,11 @@ static BOOL check_iso_props(const char* psz_dirname, BOOL* is_syslinux_cfg, BOOL | ||||||
| 	// Check for an isolinux/syslinux config file anywhere
 | 	// Check for an isolinux/syslinux config file anywhere
 | ||||||
| 	*is_syslinux_cfg = FALSE; | 	*is_syslinux_cfg = FALSE; | ||||||
| 	for (i=0; i<ARRAYSIZE(syslinux_cfg); i++) { | 	for (i=0; i<ARRAYSIZE(syslinux_cfg); i++) { | ||||||
| 		if (safe_stricmp(psz_basename, syslinux_cfg[i]) == 0) | 		if (safe_stricmp(psz_basename, syslinux_cfg[i]) == 0) { | ||||||
| 			*is_syslinux_cfg = TRUE; | 			*is_syslinux_cfg = TRUE; | ||||||
|  | 			if ((scan_only) && (i == 1) && (safe_stricmp(psz_dirname, efi_dirname) == 0)) | ||||||
|  | 				iso_report.has_efi_syslinux = TRUE; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Check for a syslinux v5.0+ file anywhere
 | 	// Check for a syslinux v5.0+ file anywhere
 | ||||||
|  | @ -204,7 +207,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha | ||||||
| 	BOOL r, is_syslinux_cfg, is_old_c32[NB_OLD_C32]; | 	BOOL r, is_syslinux_cfg, is_old_c32[NB_OLD_C32]; | ||||||
| 	int i_length; | 	int i_length; | ||||||
| 	size_t i, nul_pos; | 	size_t i, nul_pos; | ||||||
| 	char tmp[128], *psz_fullpath = NULL; | 	char tmp[128], *psz_fullpath = NULL, *dst; | ||||||
| 	const char* psz_basename; | 	const char* psz_basename; | ||||||
| 	udf_dirent_t *p_udf_dirent2; | 	udf_dirent_t *p_udf_dirent2; | ||||||
| 	uint8_t buf[UDF_BLOCKSIZE]; | 	uint8_t buf[UDF_BLOCKSIZE]; | ||||||
|  | @ -311,6 +314,14 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha | ||||||
| 				// append that may be different from our USB label.
 | 				// append that may be different from our USB label.
 | ||||||
| 				if (replace_in_token_data(psz_fullpath, "append", iso_report.label, iso_report.usb_label, TRUE) != NULL) | 				if (replace_in_token_data(psz_fullpath, "append", iso_report.label, iso_report.usb_label, TRUE) != NULL) | ||||||
| 					uprintf("Patched %s: '%s' -> '%s'\n", psz_fullpath, iso_report.label, iso_report.usb_label); | 					uprintf("Patched %s: '%s' -> '%s'\n", psz_fullpath, iso_report.label, iso_report.usb_label); | ||||||
|  | 				// Fix dual BIOS + EFI support for tails and other ISOs
 | ||||||
|  | 				if ( (safe_stricmp(psz_path, efi_dirname) == 0) && (safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) && | ||||||
|  | 					 (!iso_report.has_efi_syslinux) && (dst = safe_strdup(psz_fullpath)) ) { | ||||||
|  | 					dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's'; | ||||||
|  | 					CopyFileA(psz_fullpath, dst, TRUE); | ||||||
|  | 					uprintf("Duplicated %s to %s\n", psz_fullpath, dst); | ||||||
|  | 					free(dst); | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		safe_free(psz_fullpath); | 		safe_free(psz_fullpath); | ||||||
|  | @ -332,7 +343,7 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) | ||||||
| 	DWORD buf_size, wr_size, err; | 	DWORD buf_size, wr_size, err; | ||||||
| 	BOOL s, is_syslinux_cfg, is_old_c32[NB_OLD_C32], is_symlink; | 	BOOL s, is_syslinux_cfg, is_old_c32[NB_OLD_C32], is_symlink; | ||||||
| 	int i_length, r = 1; | 	int i_length, r = 1; | ||||||
| 	char tmp[128], psz_fullpath[1024], *psz_basename; | 	char tmp[128], psz_fullpath[MAX_PATH], *psz_basename, *dst; | ||||||
| 	const char *psz_iso_name = &psz_fullpath[strlen(psz_extract_dir)]; | 	const char *psz_iso_name = &psz_fullpath[strlen(psz_extract_dir)]; | ||||||
| 	unsigned char buf[ISO_BLOCKSIZE]; | 	unsigned char buf[ISO_BLOCKSIZE]; | ||||||
| 	CdioListNode_t* p_entnode; | 	CdioListNode_t* p_entnode; | ||||||
|  | @ -397,7 +408,8 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) | ||||||
| 			safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, FALSE, FALSE)); | 			safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, FALSE, FALSE)); | ||||||
| 			SetWindowTextU(hISOFileName, psz_fullpath); | 			SetWindowTextU(hISOFileName, psz_fullpath); | ||||||
| 			// ISO9660 cannot handle backslashes
 | 			// ISO9660 cannot handle backslashes
 | ||||||
| 			for (i=0; i<nul_pos; i++) if (psz_fullpath[i] == '\\') psz_fullpath[i] = '/'; | 			for (i=0; i<nul_pos; i++) | ||||||
|  | 				if (psz_fullpath[i] == '\\') psz_fullpath[i] = '/'; | ||||||
| 			psz_fullpath[nul_pos] = 0; | 			psz_fullpath[nul_pos] = 0; | ||||||
| 			for (i=0; i<NB_OLD_C32; i++) { | 			for (i=0; i<NB_OLD_C32; i++) { | ||||||
| 				if (is_old_c32[i] && use_own_c32[i]) { | 				if (is_old_c32[i] && use_own_c32[i]) { | ||||||
|  | @ -456,8 +468,19 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) | ||||||
| 			} | 			} | ||||||
| 			ISO_BLOCKING(safe_closehandle(file_handle)); | 			ISO_BLOCKING(safe_closehandle(file_handle)); | ||||||
| 			if (is_syslinux_cfg) { | 			if (is_syslinux_cfg) { | ||||||
|  | 				nul_pos = safe_strlen(psz_fullpath); | ||||||
|  | 				for (i=0; i<nul_pos; i++) | ||||||
|  | 					if (psz_fullpath[i] == '/') psz_fullpath[i] = '\\'; | ||||||
| 				if (replace_in_token_data(psz_fullpath, "append", iso_report.label, iso_report.usb_label, TRUE) != NULL) | 				if (replace_in_token_data(psz_fullpath, "append", iso_report.label, iso_report.usb_label, TRUE) != NULL) | ||||||
| 					uprintf("Patched %s: '%s' -> '%s'\n", psz_fullpath, iso_report.label, iso_report.usb_label); | 					uprintf("Patched %s: '%s' -> '%s'\n", psz_fullpath, iso_report.label, iso_report.usb_label); | ||||||
|  | 				// Fix dual BIOS + EFI support for tails and other ISOs
 | ||||||
|  | 				if ( (safe_stricmp(psz_path, efi_dirname) == 0) && (safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) && | ||||||
|  | 					 (!iso_report.has_efi_syslinux) && (dst = safe_strdup(psz_fullpath)) ) { | ||||||
|  | 					dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's'; | ||||||
|  | 					CopyFileA(psz_fullpath, dst, TRUE); | ||||||
|  | 					uprintf("Duplicated %s to %s\n", psz_fullpath, dst); | ||||||
|  | 					free(dst); | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -246,6 +246,7 @@ typedef struct { | ||||||
| 	BOOL has_autorun; | 	BOOL has_autorun; | ||||||
| 	BOOL has_old_c32[NB_OLD_C32]; | 	BOOL has_old_c32[NB_OLD_C32]; | ||||||
| 	BOOL has_old_vesamenu; | 	BOOL has_old_vesamenu; | ||||||
|  | 	BOOL has_efi_syslinux; | ||||||
| 	BOOL has_kolibrios; | 	BOOL has_kolibrios; | ||||||
| 	BOOL uses_minint; | 	BOOL uses_minint; | ||||||
| 	BOOL is_bootable_img; | 	BOOL is_bootable_img; | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -32,7 +32,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_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| CAPTION "Rufus 1.4.11.518" | CAPTION "Rufus 1.4.11.519" | ||||||
| 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 | ||||||
|  | @ -165,7 +165,7 @@ END | ||||||
| RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 | RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | ||||||
| CAPTION "Rufus 1.4.11.518" | CAPTION "Rufus 1.4.11.519" | ||||||
| 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 | ||||||
|  | @ -428,8 +428,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 1,4,11,518 |  FILEVERSION 1,4,11,519 | ||||||
|  PRODUCTVERSION 1,4,11,518 |  PRODUCTVERSION 1,4,11,519 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -446,13 +446,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.11.518" |             VALUE "FileVersion", "1.4.11.519" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2014 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.11.518" |             VALUE "ProductVersion", "1.4.11.519" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue