mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[internal] refactor iso_report -> img_report
* Also set rufus-next to 2.4
This commit is contained in:
		
							parent
							
								
									102e17699a
								
							
						
					
					
						commit
						5024e7f65e
					
				
					 10 changed files with 241 additions and 240 deletions
				
			
		
							
								
								
									
										20
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -1,6 +1,6 @@ | ||||||
| #! /bin/sh | #! /bin/sh | ||||||
| # Guess values for system-dependent variables and create Makefiles. | # Guess values for system-dependent variables and create Makefiles. | ||||||
| # Generated by GNU Autoconf 2.69 for rufus 2.3. | # Generated by GNU Autoconf 2.69 for rufus 2.4. | ||||||
| # | # | ||||||
| # Report bugs to <https://github.com/pbatard/rufus/issues>. | # Report bugs to <https://github.com/pbatard/rufus/issues>. | ||||||
| # | # | ||||||
|  | @ -580,8 +580,8 @@ MAKEFLAGS= | ||||||
| # Identity of this package. | # Identity of this package. | ||||||
| PACKAGE_NAME='rufus' | PACKAGE_NAME='rufus' | ||||||
| PACKAGE_TARNAME='rufus' | PACKAGE_TARNAME='rufus' | ||||||
| PACKAGE_VERSION='2.3' | PACKAGE_VERSION='2.4' | ||||||
| PACKAGE_STRING='rufus 2.3' | PACKAGE_STRING='rufus 2.4' | ||||||
| PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' | PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' | ||||||
| PACKAGE_URL='http://rufus.akeo.ie' | PACKAGE_URL='http://rufus.akeo.ie' | ||||||
| 
 | 
 | ||||||
|  | @ -1228,7 +1228,7 @@ if test "$ac_init_help" = "long"; then | ||||||
|   # Omit some internal or obsolete options to make the list less imposing. |   # Omit some internal or obsolete options to make the list less imposing. | ||||||
|   # This message is too long to be a string in the A/UX 3.1 sh. |   # This message is too long to be a string in the A/UX 3.1 sh. | ||||||
|   cat <<_ACEOF |   cat <<_ACEOF | ||||||
| \`configure' configures rufus 2.3 to adapt to many kinds of systems. | \`configure' configures rufus 2.4 to adapt to many kinds of systems. | ||||||
| 
 | 
 | ||||||
| Usage: $0 [OPTION]... [VAR=VALUE]... | Usage: $0 [OPTION]... [VAR=VALUE]... | ||||||
| 
 | 
 | ||||||
|  | @ -1294,7 +1294,7 @@ fi | ||||||
| 
 | 
 | ||||||
| if test -n "$ac_init_help"; then | if test -n "$ac_init_help"; then | ||||||
|   case $ac_init_help in |   case $ac_init_help in | ||||||
|      short | recursive ) echo "Configuration of rufus 2.3:";; |      short | recursive ) echo "Configuration of rufus 2.4:";; | ||||||
|    esac |    esac | ||||||
|   cat <<\_ACEOF |   cat <<\_ACEOF | ||||||
| 
 | 
 | ||||||
|  | @ -1385,7 +1385,7 @@ fi | ||||||
| test -n "$ac_init_help" && exit $ac_status | test -n "$ac_init_help" && exit $ac_status | ||||||
| if $ac_init_version; then | if $ac_init_version; then | ||||||
|   cat <<\_ACEOF |   cat <<\_ACEOF | ||||||
| rufus configure 2.3 | rufus configure 2.4 | ||||||
| generated by GNU Autoconf 2.69 | generated by GNU Autoconf 2.69 | ||||||
| 
 | 
 | ||||||
| Copyright (C) 2012 Free Software Foundation, Inc. | Copyright (C) 2012 Free Software Foundation, Inc. | ||||||
|  | @ -1440,7 +1440,7 @@ cat >config.log <<_ACEOF | ||||||
| This file contains any messages produced by compilers while | This file contains any messages produced by compilers while | ||||||
| running configure, to aid debugging if configure makes a mistake. | running configure, to aid debugging if configure makes a mistake. | ||||||
| 
 | 
 | ||||||
| It was created by rufus $as_me 2.3, which was | It was created by rufus $as_me 2.4, which was | ||||||
| generated by GNU Autoconf 2.69.  Invocation command line was | generated by GNU Autoconf 2.69.  Invocation command line was | ||||||
| 
 | 
 | ||||||
|   $ $0 $@ |   $ $0 $@ | ||||||
|  | @ -2303,7 +2303,7 @@ fi | ||||||
| 
 | 
 | ||||||
| # Define the identity of the package. | # Define the identity of the package. | ||||||
|  PACKAGE='rufus' |  PACKAGE='rufus' | ||||||
|  VERSION='2.3' |  VERSION='2.4' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| cat >>confdefs.h <<_ACEOF | cat >>confdefs.h <<_ACEOF | ||||||
|  | @ -4480,7 +4480,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | ||||||
| # report actual input values of CONFIG_FILES etc. instead of their | # report actual input values of CONFIG_FILES etc. instead of their | ||||||
| # values after options handling. | # values after options handling. | ||||||
| ac_log=" | ac_log=" | ||||||
| This file was extended by rufus $as_me 2.3, which was | This file was extended by rufus $as_me 2.4, which was | ||||||
| generated by GNU Autoconf 2.69.  Invocation command line was | generated by GNU Autoconf 2.69.  Invocation command line was | ||||||
| 
 | 
 | ||||||
|   CONFIG_FILES    = $CONFIG_FILES |   CONFIG_FILES    = $CONFIG_FILES | ||||||
|  | @ -4534,7 +4534,7 @@ _ACEOF | ||||||
| cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | ||||||
| ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" | ||||||
| ac_cs_version="\\ | ac_cs_version="\\ | ||||||
| rufus config.status 2.3 | rufus config.status 2.4 | ||||||
| configured by $0, generated by GNU Autoconf 2.69, | configured by $0, generated by GNU Autoconf 2.69, | ||||||
|   with options \\"\$ac_cs_config\\" |   with options \\"\$ac_cs_config\\" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| AC_INIT([rufus], [2.3], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) | AC_INIT([rufus], [2.4], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) | ||||||
| AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) | AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) | ||||||
| AC_CONFIG_SRCDIR([src/rufus.c]) | AC_CONFIG_SRCDIR([src/rufus.c]) | ||||||
| AC_CONFIG_MACRO_DIR([m4]) | AC_CONFIG_MACRO_DIR([m4]) | ||||||
|  |  | ||||||
|  | @ -626,10 +626,10 @@ DWORD WINAPI SumThread(void* param) | ||||||
| 	for (rb = 0; ; rb += rSize) { | 	for (rb = 0; ; rb += rSize) { | ||||||
| 		if (GetTickCount() > LastRefresh + 25) { | 		if (GetTickCount() > LastRefresh + 25) { | ||||||
| 			LastRefresh = GetTickCount(); | 			LastRefresh = GetTickCount(); | ||||||
| 			format_percent = (100.0f*rb) / (1.0f*iso_report.projected_size); | 			format_percent = (100.0f*rb) / (1.0f*img_report.projected_size); | ||||||
| 			PrintInfo(0, MSG_271, format_percent); | 			PrintInfo(0, MSG_271, format_percent); | ||||||
| 			SendMessage(hProgress, PBM_SETPOS, (WPARAM)((format_percent/100.0f)*MAX_PROGRESS), 0); | 			SendMessage(hProgress, PBM_SETPOS, (WPARAM)((format_percent/100.0f)*MAX_PROGRESS), 0); | ||||||
| 			SetTaskbarProgressValue(rb, iso_report.projected_size); | 			SetTaskbarProgressValue(rb, img_report.projected_size); | ||||||
| 		} | 		} | ||||||
| 		CHECK_FOR_USER_CANCEL; | 		CHECK_FOR_USER_CANCEL; | ||||||
| 		if (!ReadFile(h, buffer, sizeof(buffer), &rSize, NULL)) { | 		if (!ReadFile(h, buffer, sizeof(buffer), &rSize, NULL)) { | ||||||
|  |  | ||||||
							
								
								
									
										68
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										68
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -303,7 +303,7 @@ static void ToValidLabel(WCHAR* name, BOOL bFAT) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Needed for disk by label isolinux.cfg workaround
 | 	// Needed for disk by label isolinux.cfg workaround
 | ||||||
| 	wchar_to_utf8_no_alloc(name, iso_report.usb_label, sizeof(iso_report.usb_label)); | 	wchar_to_utf8_no_alloc(name, img_report.usb_label, sizeof(img_report.usb_label)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -929,21 +929,21 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) | ||||||
| 	 | 	 | ||||||
| 	// Syslinux
 | 	// Syslinux
 | ||||||
| 	if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || | 	if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || | ||||||
| 		 ((bt == BT_ISO) && (HAS_SYSLINUX(iso_report)) && (IS_FAT(fs))) ) { | 		 ((bt == BT_ISO) && (HAS_SYSLINUX(img_report)) && (IS_FAT(fs))) ) { | ||||||
| 		uprintf(using_msg, "Syslinux"); | 		uprintf(using_msg, "Syslinux"); | ||||||
| 		r = write_syslinux_mbr(fp); | 		r = write_syslinux_mbr(fp); | ||||||
| 		goto notify; | 		goto notify; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Grub 2.0
 | 	// Grub 2.0
 | ||||||
| 	if ( ((bt == BT_ISO) && (iso_report.has_grub2)) || (bt == BT_GRUB2) ) { | 	if ( ((bt == BT_ISO) && (img_report.has_grub2)) || (bt == BT_GRUB2) ) { | ||||||
| 		uprintf(using_msg, "Grub 2.0"); | 		uprintf(using_msg, "Grub 2.0"); | ||||||
| 		r = write_grub2_mbr(fp); | 		r = write_grub2_mbr(fp); | ||||||
| 		goto notify; | 		goto notify; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Grub4DOS
 | 	// Grub4DOS
 | ||||||
| 	if ( ((bt == BT_ISO) && (iso_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) { | 	if ( ((bt == BT_ISO) && (img_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) { | ||||||
| 		uprintf(using_msg, "Grub4DOS"); | 		uprintf(using_msg, "Grub4DOS"); | ||||||
| 		r = write_grub_mbr(fp); | 		r = write_grub_mbr(fp); | ||||||
| 		goto notify; | 		goto notify; | ||||||
|  | @ -957,7 +957,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) | ||||||
| 	}  | 	}  | ||||||
| 
 | 
 | ||||||
| 	// KolibriOS
 | 	// KolibriOS
 | ||||||
| 	if ( (bt == BT_ISO) && (iso_report.has_kolibrios) && (IS_FAT(fs))) { | 	if ( (bt == BT_ISO) && (img_report.has_kolibrios) && (IS_FAT(fs))) { | ||||||
| 		uprintf(using_msg, "KolibriOS"); | 		uprintf(using_msg, "KolibriOS"); | ||||||
| 		r = write_kolibri_mbr(fp); | 		r = write_kolibri_mbr(fp); | ||||||
| 		goto notify; | 		goto notify; | ||||||
|  | @ -965,7 +965,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) | ||||||
| 
 | 
 | ||||||
| 	// If everything else failed, fall back to a conventional Windows/Rufus MBR
 | 	// If everything else failed, fall back to a conventional Windows/Rufus MBR
 | ||||||
| windows_mbr: | windows_mbr: | ||||||
| 	if ((IS_WINPE(iso_report.winpe) && !iso_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) { | 	if ((IS_WINPE(img_report.winpe) && !img_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) { | ||||||
| 		uprintf(using_msg, APPLICATION_NAME); | 		uprintf(using_msg, APPLICATION_NAME); | ||||||
| 		r = write_rufus_mbr(fp); | 		r = write_rufus_mbr(fp); | ||||||
| 	} else { | 	} else { | ||||||
|  | @ -1002,10 +1002,10 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive) | ||||||
| 		(DWORD)(SelectedDrive.Geometry.BytesPerSector * SelectedDrive.Geometry.SectorsPerTrack) : 1024 * 1024; | 		(DWORD)(SelectedDrive.Geometry.BytesPerSector * SelectedDrive.Geometry.SectorsPerTrack) : 1024 * 1024; | ||||||
| 	max_size -= mbr_size; | 	max_size -= mbr_size; | ||||||
| 	// Syslinux has precedence over Grub
 | 	// Syslinux has precedence over Grub
 | ||||||
| 	if ((bt == BT_ISO) && (!HAS_SYSLINUX(iso_report))) { | 	if ((bt == BT_ISO) && (!HAS_SYSLINUX(img_report))) { | ||||||
| 		if (iso_report.has_grub4dos) | 		if (img_report.has_grub4dos) | ||||||
| 			bt = BT_GRUB4DOS; | 			bt = BT_GRUB4DOS; | ||||||
| 		if (iso_report.has_grub2) | 		if (img_report.has_grub2) | ||||||
| 			bt = BT_GRUB2; | 			bt = BT_GRUB2; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1056,7 +1056,7 @@ static __inline const char* bt_to_name(int bt) { | ||||||
| 	case BT_FREEDOS: return "FreeDOS"; | 	case BT_FREEDOS: return "FreeDOS"; | ||||||
| 	case BT_REACTOS: return "ReactOS"; | 	case BT_REACTOS: return "ReactOS"; | ||||||
| 	default: | 	default: | ||||||
| 		return ((bt==BT_ISO)&&(iso_report.has_kolibrios))?"KolibriOS":"Standard"; | 		return ((bt==BT_ISO)&&(img_report.has_kolibrios))?"KolibriOS":"Standard"; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| static BOOL WritePBR(HANDLE hLogicalVolume) | static BOOL WritePBR(HANDLE hLogicalVolume) | ||||||
|  | @ -1082,7 +1082,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume) | ||||||
| 			if (!write_fat_16_fd_br(fp, 0)) break; | 			if (!write_fat_16_fd_br(fp, 0)) break; | ||||||
| 		} else if (bt == BT_REACTOS) { | 		} else if (bt == BT_REACTOS) { | ||||||
| 			if (!write_fat_16_ros_br(fp, 0)) break; | 			if (!write_fat_16_ros_br(fp, 0)) break; | ||||||
| 		} else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) { | 		} else if ((bt == BT_ISO) && (img_report.has_kolibrios)) { | ||||||
| 			uprintf("FAT16 is not supported for KolibriOS\n"); break; | 			uprintf("FAT16 is not supported for KolibriOS\n"); break; | ||||||
| 		} else { | 		} else { | ||||||
| 			if (!write_fat_16_br(fp, 0)) break; | 			if (!write_fat_16_br(fp, 0)) break; | ||||||
|  | @ -1104,7 +1104,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume) | ||||||
| 				if (!write_fat_32_fd_br(fp, 0)) break; | 				if (!write_fat_32_fd_br(fp, 0)) break; | ||||||
| 			} else if (bt == BT_REACTOS) { | 			} else if (bt == BT_REACTOS) { | ||||||
| 				if (!write_fat_32_ros_br(fp, 0)) break; | 				if (!write_fat_32_ros_br(fp, 0)) break; | ||||||
| 			} else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) { | 			} else if ((bt == BT_ISO) && (img_report.has_kolibrios)) { | ||||||
| 				if (!write_fat_32_kos_br(fp, 0)) break; | 				if (!write_fat_32_kos_br(fp, 0)) break; | ||||||
| 			} else { | 			} else { | ||||||
| 				if (!write_fat_32_br(fp, 0)) break; | 				if (!write_fat_32_br(fp, 0)) break; | ||||||
|  | @ -1152,7 +1152,7 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 	BOOL r = FALSE; | 	BOOL r = FALSE; | ||||||
| 	char* buf = NULL; | 	char* buf = NULL; | ||||||
| 
 | 
 | ||||||
| 	index = ((iso_report.winpe&WINPE_I386) == WINPE_I386)?0:1; | 	index = ((img_report.winpe&WINPE_I386) == WINPE_I386)?0:1; | ||||||
| 	// Allow other values than harddisk 1, as per user choice for disk ID
 | 	// Allow other values than harddisk 1, as per user choice for disk ID
 | ||||||
| 	safe_sprintf(setupsrcdev, sizeof(setupsrcdev), | 	safe_sprintf(setupsrcdev, sizeof(setupsrcdev), | ||||||
| 		"SetupSourceDevice = \"\\device\\harddisk%d\\partition1\"", ComboBox_GetCurSel(hDiskID)); | 		"SetupSourceDevice = \"\\device\\harddisk%d\\partition1\"", ComboBox_GetCurSel(hDiskID)); | ||||||
|  | @ -1160,7 +1160,7 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 	safe_sprintf(src, sizeof(src), "%c:\\%s\\ntdetect.com", drive_letter, basedir[index]); | 	safe_sprintf(src, sizeof(src), "%c:\\%s\\ntdetect.com", drive_letter, basedir[index]); | ||||||
| 	safe_sprintf(dst, sizeof(dst), "%c:\\ntdetect.com", drive_letter); | 	safe_sprintf(dst, sizeof(dst), "%c:\\ntdetect.com", drive_letter); | ||||||
| 	CopyFileA(src, dst, TRUE); | 	CopyFileA(src, dst, TRUE); | ||||||
| 	if (!iso_report.uses_minint) { | 	if (!img_report.uses_minint) { | ||||||
| 		// Create a copy of txtsetup.sif, as we want to keep the i386 files unmodified
 | 		// Create a copy of txtsetup.sif, as we want to keep the i386 files unmodified
 | ||||||
| 		safe_sprintf(src, sizeof(src), "%c:\\%s\\txtsetup.sif", drive_letter, basedir[index]); | 		safe_sprintf(src, sizeof(src), "%c:\\%s\\txtsetup.sif", drive_letter, basedir[index]); | ||||||
| 		safe_sprintf(dst, sizeof(dst), "%c:\\txtsetup.sif", drive_letter); | 		safe_sprintf(dst, sizeof(dst), "%c:\\txtsetup.sif", drive_letter); | ||||||
|  | @ -1182,11 +1182,11 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 
 | 
 | ||||||
| 	// \minint with /minint option doesn't require further processing => return true
 | 	// \minint with /minint option doesn't require further processing => return true
 | ||||||
| 	// \minint and no \i386 without /minint is unclear => return error
 | 	// \minint and no \i386 without /minint is unclear => return error
 | ||||||
| 	if (iso_report.winpe&WINPE_MININT) { | 	if (img_report.winpe&WINPE_MININT) { | ||||||
| 		if (iso_report.uses_minint) { | 		if (img_report.uses_minint) { | ||||||
| 			uprintf("Detected \\minint directory with /minint option: nothing to patch\n"); | 			uprintf("Detected \\minint directory with /minint option: nothing to patch\n"); | ||||||
| 			r = TRUE; | 			r = TRUE; | ||||||
| 		} else if (!(iso_report.winpe&WINPE_I386)) { | 		} else if (!(img_report.winpe&WINPE_I386)) { | ||||||
| 			uprintf("Detected \\minint directory only but no /minint option: not sure what to do\n"); | 			uprintf("Detected \\minint directory only but no /minint option: not sure what to do\n"); | ||||||
| 		} | 		} | ||||||
| 		goto out; | 		goto out; | ||||||
|  | @ -1231,7 +1231,7 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!iso_report.uses_minint) { | 	if (!img_report.uses_minint) { | ||||||
| 		// Additional setupldr.bin/bootmgr patching
 | 		// Additional setupldr.bin/bootmgr patching
 | ||||||
| 		for (i=0; i<size-32; i++) { | 		for (i=0; i<size-32; i++) { | ||||||
| 			// rdisk(0) -> rdisk(#) disk masquerading
 | 			// rdisk(0) -> rdisk(#) disk masquerading
 | ||||||
|  | @ -1310,7 +1310,7 @@ BOOL SetupWinToGo(const char* drive_name, BOOL use_ms_efi) | ||||||
| 	uprintf("Mounted ISO as '%s'", mounted_iso); | 	uprintf("Mounted ISO as '%s'", mounted_iso); | ||||||
| 
 | 
 | ||||||
| 	// Now we use the WIM API to apply that image
 | 	// Now we use the WIM API to apply that image
 | ||||||
| 	static_sprintf(image, "%s%s", mounted_iso, &iso_report.install_wim_path[2]); | 	static_sprintf(image, "%s%s", mounted_iso, &img_report.install_wim_path[2]); | ||||||
| 	if (!WimApplyImage(image, 1, drive_name)) { | 	if (!WimApplyImage(image, 1, drive_name)) { | ||||||
| 		uprintf("Failed to apply Windows To Go image"); | 		uprintf("Failed to apply Windows To Go image"); | ||||||
| 		if (!IS_ERROR(FormatStatus)) | 		if (!IS_ERROR(FormatStatus)) | ||||||
|  | @ -1460,7 +1460,7 @@ void update_progress(const uint64_t processed_bytes) | ||||||
| { | { | ||||||
| 	if (GetTickCount() > LastRefresh + 25) { | 	if (GetTickCount() > LastRefresh + 25) { | ||||||
| 		LastRefresh = GetTickCount(); | 		LastRefresh = GetTickCount(); | ||||||
| 		format_percent = (100.0f*processed_bytes)/(1.0f*iso_report.projected_size); | 		format_percent = (100.0f*processed_bytes)/(1.0f*img_report.projected_size); | ||||||
| 		PrintInfo(0, MSG_261, format_percent); | 		PrintInfo(0, MSG_261, format_percent); | ||||||
| 		UpdateProgress(OP_FORMAT, format_percent); | 		UpdateProgress(OP_FORMAT, format_percent); | ||||||
| 	} | 	} | ||||||
|  | @ -1509,14 +1509,14 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 	pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 	pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
| 	tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 	tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
| 	use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); | 	use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); | ||||||
| 	windows_to_go = (togo_mode) && HAS_TOGO(iso_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); | 	windows_to_go = (togo_mode) && HAS_TOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); | ||||||
| 	// Find out if we need to add any extra partitions
 | 	// Find out if we need to add any extra partitions
 | ||||||
| 	if ((windows_to_go) && (tt == TT_UEFI) && (pt == PARTITION_STYLE_GPT)) | 	if ((windows_to_go) && (tt == TT_UEFI) && (pt == PARTITION_STYLE_GPT)) | ||||||
| 		// According to Microsoft, every GPT disk (we RUN Windows from) must have an MSR due to not having hidden sectors
 | 		// According to Microsoft, every GPT disk (we RUN Windows from) must have an MSR due to not having hidden sectors
 | ||||||
| 		// http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr
 | 		// http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr
 | ||||||
| 		extra_partitions = XP_MSR | XP_EFI; | 		extra_partitions = XP_MSR | XP_EFI; | ||||||
| 	else if ( (fs == FS_NTFS) && ((bt == BT_UEFI_NTFS) || | 	else if ( (fs == FS_NTFS) && ((bt == BT_UEFI_NTFS) || | ||||||
| 			  ((bt == BT_ISO) && (iso_report.has_efi) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) ) | 			  ((bt == BT_ISO) && (img_report.has_efi) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) ) | ||||||
| 		extra_partitions = XP_UEFI_NTFS; | 		extra_partitions = XP_UEFI_NTFS; | ||||||
| 	else if (IsChecked(IDC_EXTRA_PARTITION)) | 	else if (IsChecked(IDC_EXTRA_PARTITION)) | ||||||
| 		extra_partitions = XP_COMPAT; | 		extra_partitions = XP_COMPAT; | ||||||
|  | @ -1674,10 +1674,10 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 		} | 		} | ||||||
| 		LastRefresh = 0; | 		LastRefresh = 0; | ||||||
| 
 | 
 | ||||||
| 		if (iso_report.compression_type != BLED_COMPRESSION_NONE) { | 		if (img_report.compression_type != BLED_COMPRESSION_NONE) { | ||||||
| 			uprintf("Writing Compressed Image..."); | 			uprintf("Writing Compressed Image..."); | ||||||
| 			bled_init(_uprintf, update_progress, &FormatStatus); | 			bled_init(_uprintf, update_progress, &FormatStatus); | ||||||
| 			bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, iso_report.compression_type); | 			bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type); | ||||||
| 			bled_exit(); | 			bled_exit(); | ||||||
| 		} else { | 		} else { | ||||||
| 			uprintf("Writing Image..."); | 			uprintf("Writing Image..."); | ||||||
|  | @ -1706,13 +1706,13 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 					break; | 					break; | ||||||
| 				if (GetTickCount() > LastRefresh + 25) { | 				if (GetTickCount() > LastRefresh + 25) { | ||||||
| 					LastRefresh = GetTickCount(); | 					LastRefresh = GetTickCount(); | ||||||
| 					format_percent = (100.0f*wb)/(1.0f*iso_report.projected_size); | 					format_percent = (100.0f*wb)/(1.0f*img_report.projected_size); | ||||||
| 					PrintInfo(0, MSG_261, format_percent); | 					PrintInfo(0, MSG_261, format_percent); | ||||||
| 					UpdateProgress(OP_FORMAT, format_percent); | 					UpdateProgress(OP_FORMAT, format_percent); | ||||||
| 				} | 				} | ||||||
| 				// Don't overflow our projected size (mostly for VHDs)
 | 				// Don't overflow our projected size (mostly for VHDs)
 | ||||||
| 				if (wb + rSize > iso_report.projected_size) { | 				if (wb + rSize > img_report.projected_size) { | ||||||
| 					rSize = (DWORD)(iso_report.projected_size - wb); | 					rSize = (DWORD)(img_report.projected_size - wb); | ||||||
| 				} | 				} | ||||||
| 				// WriteFile fails unless the size is a multiple of sector size
 | 				// WriteFile fails unless the size is a multiple of sector size
 | ||||||
| 				if (rSize % SectorSize != 0) | 				if (rSize % SectorSize != 0) | ||||||
|  | @ -1826,13 +1826,13 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 			// All good
 | 			// All good
 | ||||||
| 		} else if (tt == TT_UEFI) { | 		} else if (tt == TT_UEFI) { | ||||||
| 			// For once, no need to do anything - just check our sanity
 | 			// For once, no need to do anything - just check our sanity
 | ||||||
| 			if ( (bt != BT_ISO) || (!iso_report.has_efi) || (fs > FS_NTFS) ) { | 			if ( (bt != BT_ISO) || (!img_report.has_efi) || (fs > FS_NTFS) ) { | ||||||
| 				uprintf("Spock gone crazy error!\n"); | 				uprintf("Spock gone crazy error!\n"); | ||||||
| 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; | 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; | ||||||
| 				goto out; | 				goto out; | ||||||
| 			} | 			} | ||||||
| 		} else if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || | 		} else if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || | ||||||
| 			((bt == BT_ISO) && (HAS_SYSLINUX(iso_report) || IS_REACTOS(iso_report)) && | 			((bt == BT_ISO) && (HAS_SYSLINUX(img_report) || IS_REACTOS(img_report)) && | ||||||
| 				(!allow_dual_uefi_bios) && (IS_FAT(fs))) ) { | 				(!allow_dual_uefi_bios) && (IS_FAT(fs))) ) { | ||||||
| 			if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) { | 			if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) { | ||||||
| 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; | 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; | ||||||
|  | @ -1902,7 +1902,7 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_EXTRACT); | 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_EXTRACT); | ||||||
| 					goto out; | 					goto out; | ||||||
| 				} | 				} | ||||||
| 				if (iso_report.has_kolibrios) { | 				if (img_report.has_kolibrios) { | ||||||
| 					kolibri_dst[0] = drive_name[0]; | 					kolibri_dst[0] = drive_name[0]; | ||||||
| 					uprintf("Installing: %s (KolibriOS loader)\n", kolibri_dst); | 					uprintf("Installing: %s (KolibriOS loader)\n", kolibri_dst); | ||||||
| 					if (ExtractISOFile(image_path, "HD_Load/USB_Boot/MTLD_F32", kolibri_dst, | 					if (ExtractISOFile(image_path, "HD_Load/USB_Boot/MTLD_F32", kolibri_dst, | ||||||
|  | @ -1911,9 +1911,9 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				// EFI mode selected, with no 'boot###.efi' but Windows 7 x64's 'bootmgr.efi' (bit #0)
 | 				// EFI mode selected, with no 'boot###.efi' but Windows 7 x64's 'bootmgr.efi' (bit #0)
 | ||||||
| 				if ((tt == TT_UEFI) && IS_WIN7_EFI(iso_report)) { | 				if ((tt == TT_UEFI) && IS_WIN7_EFI(img_report)) { | ||||||
| 					PrintInfoDebug(0, MSG_232); | 					PrintInfoDebug(0, MSG_232); | ||||||
| 					iso_report.install_wim_path[0] = drive_name[0]; | 					img_report.install_wim_path[0] = drive_name[0]; | ||||||
| 					efi_dst[0] = drive_name[0]; | 					efi_dst[0] = drive_name[0]; | ||||||
| 					efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; | 					efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; | ||||||
| 					if (!CreateDirectoryA(efi_dst, 0)) { | 					if (!CreateDirectoryA(efi_dst, 0)) { | ||||||
|  | @ -1921,13 +1921,13 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); | 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); | ||||||
| 					} else { | 					} else { | ||||||
| 						efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = '\\'; | 						efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = '\\'; | ||||||
| 						if (!WimExtractFile(iso_report.install_wim_path, 1, "Windows\\Boot\\EFI\\bootmgfw.efi", efi_dst)) { | 						if (!WimExtractFile(img_report.install_wim_path, 1, "Windows\\Boot\\EFI\\bootmgfw.efi", efi_dst)) { | ||||||
| 							uprintf("Failed to setup Win7 EFI boot\n"); | 							uprintf("Failed to setup Win7 EFI boot\n"); | ||||||
| 							FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); | 							FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				if ( (tt == TT_BIOS) && (IS_WINPE(iso_report.winpe)) ) { | 				if ( (tt == TT_BIOS) && (IS_WINPE(img_report.winpe)) ) { | ||||||
| 					// Apply WinPe fixup
 | 					// Apply WinPe fixup
 | ||||||
| 					if (!SetupWinPE(drive_name[0])) | 					if (!SetupWinPE(drive_name[0])) | ||||||
| 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); | 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); | ||||||
|  |  | ||||||
							
								
								
									
										152
									
								
								src/iso.c
									
										
									
									
									
								
							
							
						
						
									
										152
									
								
								src/iso.c
									
										
									
									
									
								
							|  | @ -60,7 +60,7 @@ typedef struct { | ||||||
| 	BOOLEAN is_old_c32[NB_OLD_C32]; | 	BOOLEAN is_old_c32[NB_OLD_C32]; | ||||||
| } EXTRACT_PROPS; | } EXTRACT_PROPS; | ||||||
| 
 | 
 | ||||||
| RUFUS_ISO_REPORT iso_report; | RUFUS_IMG_REPORT img_report; | ||||||
| int64_t iso_blocking_status = -1; | int64_t iso_blocking_status = -1; | ||||||
| BOOL enable_iso = TRUE, enable_joliet = TRUE, enable_rockridge = TRUE, preserve_timestamps = FALSE, has_ldlinux_c32; | BOOL enable_iso = TRUE, enable_joliet = TRUE, enable_rockridge = TRUE, preserve_timestamps = FALSE, has_ldlinux_c32; | ||||||
| #define ISO_BLOCKING(x) do {x; iso_blocking_status++; } while(0) | #define ISO_BLOCKING(x) do {x; iso_blocking_status++; } while(0) | ||||||
|  | @ -144,7 +144,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons | ||||||
| 		if (safe_stricmp(psz_basename, syslinux_cfg[i]) == 0) { | 		if (safe_stricmp(psz_basename, syslinux_cfg[i]) == 0) { | ||||||
| 			props->is_syslinux_cfg = TRUE; | 			props->is_syslinux_cfg = TRUE; | ||||||
| 			if ((scan_only) && (i == 1) && (safe_stricmp(psz_dirname, efi_dirname) == 0)) | 			if ((scan_only) && (i == 1) && (safe_stricmp(psz_dirname, efi_dirname) == 0)) | ||||||
| 				iso_report.has_efi_syslinux = TRUE; | 				img_report.has_efi_syslinux = TRUE; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -157,7 +157,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons | ||||||
| 	// Check for the Grub config file
 | 	// Check for the Grub config file
 | ||||||
| 	if (scan_only) { | 	if (scan_only) { | ||||||
| 		if ((safe_stricmp(psz_dirname, grub_dirname) == 0) && (safe_stricmp(psz_basename, grub_cfg) == 0)) | 		if ((safe_stricmp(psz_dirname, grub_dirname) == 0) && (safe_stricmp(psz_basename, grub_cfg) == 0)) | ||||||
| 			iso_report.has_grub2 = TRUE; | 			img_report.has_grub2 = TRUE; | ||||||
| 	} else if (safe_stricmp(psz_basename, grub_cfg) == 0) { | 	} else if (safe_stricmp(psz_basename, grub_cfg) == 0) { | ||||||
| 		props->is_grub_cfg = TRUE; | 		props->is_grub_cfg = TRUE; | ||||||
| 	} | 	} | ||||||
|  | @ -171,35 +171,35 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons | ||||||
| 		// Check for various files in root (psz_dirname = "")
 | 		// Check for various files in root (psz_dirname = "")
 | ||||||
| 		if (*psz_dirname == 0) { | 		if (*psz_dirname == 0) { | ||||||
| 			if (safe_strnicmp(psz_basename, bootmgr_efi_name, safe_strlen(bootmgr_efi_name)-5) == 0) { | 			if (safe_strnicmp(psz_basename, bootmgr_efi_name, safe_strlen(bootmgr_efi_name)-5) == 0) { | ||||||
| 				iso_report.has_bootmgr = TRUE; | 				img_report.has_bootmgr = TRUE; | ||||||
| 			} | 			} | ||||||
| 			if (safe_stricmp(psz_basename, grldr_name) == 0) { | 			if (safe_stricmp(psz_basename, grldr_name) == 0) { | ||||||
| 				iso_report.has_grub4dos = TRUE; | 				img_report.has_grub4dos = TRUE; | ||||||
| 			} | 			} | ||||||
| 			if (safe_stricmp(psz_basename, kolibri_name) == 0) { | 			if (safe_stricmp(psz_basename, kolibri_name) == 0) { | ||||||
| 				iso_report.has_kolibrios = TRUE; | 				img_report.has_kolibrios = TRUE; | ||||||
| 			} | 			} | ||||||
| 			if (safe_stricmp(psz_basename, bootmgr_efi_name) == 0) { | 			if (safe_stricmp(psz_basename, bootmgr_efi_name) == 0) { | ||||||
| 				iso_report.has_efi |= 1; | 				img_report.has_efi |= 1; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Check for ReactOS' setupldr.sys anywhere
 | 		// Check for ReactOS' setupldr.sys anywhere
 | ||||||
| 		if ((iso_report.reactos_path[0] == 0) && (safe_stricmp(psz_basename, reactos_name) == 0)) | 		if ((img_report.reactos_path[0] == 0) && (safe_stricmp(psz_basename, reactos_name) == 0)) | ||||||
| 			safe_strcpy(iso_report.reactos_path, sizeof(iso_report.reactos_path), psz_fullpath); | 			safe_strcpy(img_report.reactos_path, sizeof(img_report.reactos_path), psz_fullpath); | ||||||
| 
 | 
 | ||||||
| 		// Check for the EFI boot entries
 | 		// Check for the EFI boot entries
 | ||||||
| 		if (safe_stricmp(psz_dirname, efi_dirname) == 0) { | 		if (safe_stricmp(psz_dirname, efi_dirname) == 0) { | ||||||
| 			for (i=0; i<ARRAYSIZE(efi_bootname); i++) | 			for (i=0; i<ARRAYSIZE(efi_bootname); i++) | ||||||
| 				if (safe_stricmp(psz_basename, efi_bootname[i]) == 0) | 				if (safe_stricmp(psz_basename, efi_bootname[i]) == 0) | ||||||
| 					iso_report.has_efi |= (2<<i);	// start at 2 since "bootmgr.efi" is bit 0
 | 					img_report.has_efi |= (2<<i);	// start at 2 since "bootmgr.efi" is bit 0
 | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Check for "install.wim" or "install.swm" in "/sources"
 | 		// Check for "install.wim" or "install.swm" in "/sources"
 | ||||||
| 		if ((install_wim_path != NULL) && (safe_stricmp(psz_dirname, install_wim_path) == 0)) { | 		if ((install_wim_path != NULL) && (safe_stricmp(psz_dirname, install_wim_path) == 0)) { | ||||||
| 			for (i=0; i<ARRAYSIZE(install_wim_name); i++) | 			for (i=0; i<ARRAYSIZE(install_wim_name); i++) | ||||||
| 				if (safe_stricmp(psz_basename, install_wim_name[i]) == 0) | 				if (safe_stricmp(psz_basename, install_wim_name[i]) == 0) | ||||||
| 					static_sprintf(iso_report.install_wim_path, "?:\\%s\\%s", &install_wim_path[1], install_wim_name[i]); | 					static_sprintf(img_report.install_wim_path, "?:\\%s\\%s", &install_wim_path[1], install_wim_name[i]); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Check for PE (XP) specific files in "/i386" or "/minint"
 | 		// Check for PE (XP) specific files in "/i386" or "/minint"
 | ||||||
|  | @ -207,7 +207,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons | ||||||
| 			if (safe_stricmp(psz_dirname, pe_dirname[i]) == 0) | 			if (safe_stricmp(psz_dirname, pe_dirname[i]) == 0) | ||||||
| 				for (j=0; j<ARRAYSIZE(pe_file); j++) | 				for (j=0; j<ARRAYSIZE(pe_file); j++) | ||||||
| 					if (safe_stricmp(psz_basename, pe_file[j]) == 0) | 					if (safe_stricmp(psz_basename, pe_file[j]) == 0) | ||||||
| 						iso_report.winpe |= (1<<i)<<(ARRAYSIZE(pe_dirname)*j); | 						img_report.winpe |= (1<<i)<<(ARRAYSIZE(pe_dirname)*j); | ||||||
| 
 | 
 | ||||||
| 		if (props->is_syslinux_cfg) { | 		if (props->is_syslinux_cfg) { | ||||||
| 			// Maintain a list of all the isolinux/syslinux configs identified so far
 | 			// Maintain a list of all the isolinux/syslinux configs identified so far
 | ||||||
|  | @ -220,10 +220,10 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons | ||||||
| 
 | 
 | ||||||
| 		for (i=0; i<NB_OLD_C32; i++) { | 		for (i=0; i<NB_OLD_C32; i++) { | ||||||
| 			if (props->is_old_c32[i]) | 			if (props->is_old_c32[i]) | ||||||
| 				iso_report.has_old_c32[i] = TRUE; | 				img_report.has_old_c32[i] = TRUE; | ||||||
| 		} | 		} | ||||||
| 		if (i_file_length >= FOUR_GIGABYTES) | 		if (i_file_length >= FOUR_GIGABYTES) | ||||||
| 			iso_report.has_4GB_file = TRUE; | 			img_report.has_4GB_file = TRUE; | ||||||
| 		// Compute projected size needed
 | 		// Compute projected size needed
 | ||||||
| 		total_blocks += i_file_length/UDF_BLOCKSIZE; | 		total_blocks += i_file_length/UDF_BLOCKSIZE; | ||||||
| 		// NB: ISO_BLOCKSIZE = UDF_BLOCKSIZE
 | 		// NB: ISO_BLOCKSIZE = UDF_BLOCKSIZE
 | ||||||
|  | @ -255,8 +255,8 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha | ||||||
| 	// Workaround for config files requiring an ISO label for kernel append that may be
 | 	// Workaround for config files requiring an ISO label for kernel append that may be
 | ||||||
| 	// different from our USB label. Oh, and these labels must have spaces converted to \x20.
 | 	// different from our USB label. Oh, and these labels must have spaces converted to \x20.
 | ||||||
| 	if ((props->is_syslinux_cfg) || (props->is_grub_cfg)) { | 	if ((props->is_syslinux_cfg) || (props->is_grub_cfg)) { | ||||||
| 		iso_label = replace_char(iso_report.label, ' ', "\\x20"); | 		iso_label = replace_char(img_report.label, ' ', "\\x20"); | ||||||
| 		usb_label = replace_char(iso_report.usb_label, ' ', "\\x20"); | 		usb_label = replace_char(img_report.usb_label, ' ', "\\x20"); | ||||||
| 		if ((iso_label != NULL) && (usb_label != NULL)) { | 		if ((iso_label != NULL) && (usb_label != NULL)) { | ||||||
| 			if (replace_in_token_data(src, (props->is_syslinux_cfg) ? "append" : "linuxefi", iso_label, usb_label, TRUE) != NULL) | 			if (replace_in_token_data(src, (props->is_syslinux_cfg) ? "append" : "linuxefi", iso_label, usb_label, TRUE) != NULL) | ||||||
| 				uprintf("  Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); | 				uprintf("  Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); | ||||||
|  | @ -268,7 +268,7 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha | ||||||
| 	// Fix dual BIOS + EFI support for tails and other ISOs
 | 	// Fix dual BIOS + EFI support for tails and other ISOs
 | ||||||
| 	if ( (props->is_syslinux_cfg) && (safe_stricmp(psz_path, efi_dirname) == 0) && | 	if ( (props->is_syslinux_cfg) && (safe_stricmp(psz_path, efi_dirname) == 0) && | ||||||
| 		 (safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) && | 		 (safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) && | ||||||
| 		 (!iso_report.has_efi_syslinux) && (dst = safe_strdup(src)) ) { | 		 (!img_report.has_efi_syslinux) && (dst = safe_strdup(src)) ) { | ||||||
| 		dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's'; | 		dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's'; | ||||||
| 		CopyFileA(src, dst, TRUE); | 		CopyFileA(src, dst, TRUE); | ||||||
| 		uprintf("Duplicated %s to %s\n", src, dst); | 		uprintf("Duplicated %s to %s\n", src, dst); | ||||||
|  | @ -280,8 +280,8 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha | ||||||
| 		iso_label = malloc(MAX_PATH); | 		iso_label = malloc(MAX_PATH); | ||||||
| 		usb_label = malloc(MAX_PATH); | 		usb_label = malloc(MAX_PATH); | ||||||
| 		if ((iso_label != NULL) && (usb_label != NULL)) { | 		if ((iso_label != NULL) && (usb_label != NULL)) { | ||||||
| 			safe_sprintf(iso_label, MAX_PATH, "cd9660:/dev/iso9660/%s", iso_report.label); | 			safe_sprintf(iso_label, MAX_PATH, "cd9660:/dev/iso9660/%s", img_report.label); | ||||||
| 			safe_sprintf(usb_label, MAX_PATH, "msdosfs:/dev/msdosfs/%s", iso_report.usb_label); | 			safe_sprintf(usb_label, MAX_PATH, "msdosfs:/dev/msdosfs/%s", img_report.usb_label); | ||||||
| 			if (replace_in_token_data(src, "set", iso_label, usb_label, TRUE) != NULL) | 			if (replace_in_token_data(src, "set", iso_label, usb_label, TRUE) != NULL) | ||||||
| 				uprintf("  Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); | 				uprintf("  Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); | ||||||
| 		} | 		} | ||||||
|  | @ -513,12 +513,12 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) | ||||||
| 		if ((p_statbuf->rr.b3_rock == yep) && enable_rockridge) { | 		if ((p_statbuf->rr.b3_rock == yep) && enable_rockridge) { | ||||||
| 			safe_strcpy(psz_basename, sizeof(psz_fullpath)-i_length-1, p_statbuf->filename); | 			safe_strcpy(psz_basename, sizeof(psz_fullpath)-i_length-1, p_statbuf->filename); | ||||||
| 			if (safe_strlen(p_statbuf->filename) > 64) | 			if (safe_strlen(p_statbuf->filename) > 64) | ||||||
| 				iso_report.has_long_filename = TRUE; | 				img_report.has_long_filename = TRUE; | ||||||
| 			// libcdio has a memleak for Rock Ridge symlinks. It doesn't look like there's an easy fix there as
 | 			// libcdio has a memleak for Rock Ridge symlinks. It doesn't look like there's an easy fix there as
 | ||||||
| 			// a generic list that's unaware of RR extensions is being used, so we prevent that memleak ourselves
 | 			// a generic list that's unaware of RR extensions is being used, so we prevent that memleak ourselves
 | ||||||
| 			is_symlink = (p_statbuf->rr.psz_symlink != NULL); | 			is_symlink = (p_statbuf->rr.psz_symlink != NULL); | ||||||
| 			if (is_symlink) | 			if (is_symlink) | ||||||
| 				iso_report.has_symlinks = TRUE; | 				img_report.has_symlinks = TRUE; | ||||||
| 			if (scan_only) | 			if (scan_only) | ||||||
| 				safe_free(p_statbuf->rr.psz_symlink); | 				safe_free(p_statbuf->rr.psz_symlink); | ||||||
| 		} else { | 		} else { | ||||||
|  | @ -623,12 +623,12 @@ void GetGrubVersion(char* buf, size_t buf_size) | ||||||
| 
 | 
 | ||||||
| 	for (i=0; i<buf_size; i++) { | 	for (i=0; i<buf_size; i++) { | ||||||
| 		if (memcmp(&buf[i], grub_version_str, sizeof(grub_version_str)) == 0) { | 		if (memcmp(&buf[i], grub_version_str, sizeof(grub_version_str)) == 0) { | ||||||
| 			safe_strcpy(iso_report.grub2_version, sizeof(iso_report.grub2_version), &buf[i + sizeof(grub_version_str)]); | 			safe_strcpy(img_report.grub2_version, sizeof(img_report.grub2_version), &buf[i + sizeof(grub_version_str)]); | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	// Sanitize the string
 | 	// Sanitize the string
 | ||||||
| 	for (p = &iso_report.grub2_version[0]; *p; p++) { | 	for (p = &img_report.grub2_version[0]; *p; p++) { | ||||||
| 		for (i=0; i<sizeof(unauthorized); i++) { | 		for (i=0; i<sizeof(unauthorized); i++) { | ||||||
| 			if (*p == unauthorized[i]) | 			if (*p == unauthorized[i]) | ||||||
| 				*p = '_'; | 				*p = '_'; | ||||||
|  | @ -636,8 +636,8 @@ void GetGrubVersion(char* buf, size_t buf_size) | ||||||
| 	} | 	} | ||||||
| 	// <Shakes fist angrily> "KASPERSKYYYYYY!!!..." (https://github.com/pbatard/rufus/issues/467)
 | 	// <Shakes fist angrily> "KASPERSKYYYYYY!!!..." (https://github.com/pbatard/rufus/issues/467)
 | ||||||
| 	// But seriously, these guys should know better than "security" through obscurity...
 | 	// But seriously, these guys should know better than "security" through obscurity...
 | ||||||
| 	if (iso_report.grub2_version[0] == '0') | 	if (img_report.grub2_version[0] == '0') | ||||||
| 		iso_report.grub2_version[0] = 0; | 		img_report.grub2_version[0] = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) | BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) | ||||||
|  | @ -670,7 +670,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) | ||||||
| 		uprintf("ISO analysis:"); | 		uprintf("ISO analysis:"); | ||||||
| 		SendMessage(hMainDialog, UM_PROGRESS_INIT, PBS_MARQUEE, 0); | 		SendMessage(hMainDialog, UM_PROGRESS_INIT, PBS_MARQUEE, 0); | ||||||
| 		total_blocks = 0; | 		total_blocks = 0; | ||||||
| 		memset(&iso_report, 0, sizeof(iso_report)); | 		memset(&img_report, 0, sizeof(img_report)); | ||||||
| 		has_ldlinux_c32 = FALSE; | 		has_ldlinux_c32 = FALSE; | ||||||
| 		// String array of all isolinux/syslinux locations
 | 		// String array of all isolinux/syslinux locations
 | ||||||
| 		StrArrayCreate(&config_path, 8); | 		StrArrayCreate(&config_path, 8); | ||||||
|  | @ -701,8 +701,8 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 	if (scan_only) { | 	if (scan_only) { | ||||||
| 		if (udf_get_logical_volume_id(p_udf, iso_report.label, sizeof(iso_report.label)) <= 0) | 		if (udf_get_logical_volume_id(p_udf, img_report.label, sizeof(img_report.label)) <= 0) | ||||||
| 			iso_report.label[0] = 0; | 			img_report.label[0] = 0; | ||||||
| 	} | 	} | ||||||
| 	r = udf_extract_files(p_udf, p_udf_root, ""); | 	r = udf_extract_files(p_udf, p_udf_root, ""); | ||||||
| 	goto out; | 	goto out; | ||||||
|  | @ -711,7 +711,7 @@ try_iso: | ||||||
| 	// Perform our first scan with Joliet disabled (if Rock Ridge is enabled), so that we can find if
 | 	// Perform our first scan with Joliet disabled (if Rock Ridge is enabled), so that we can find if
 | ||||||
| 	// there exists a Rock Ridge file with a name > 64 chars or if there are symlinks. If that is the
 | 	// there exists a Rock Ridge file with a name > 64 chars or if there are symlinks. If that is the
 | ||||||
| 	// case then we also disable Joliet during the extract phase.
 | 	// case then we also disable Joliet during the extract phase.
 | ||||||
| 	if ((!enable_joliet) || (enable_rockridge && (scan_only || iso_report.has_long_filename || iso_report.has_symlinks))) { | 	if ((!enable_joliet) || (enable_rockridge && (scan_only || img_report.has_long_filename || img_report.has_symlinks))) { | ||||||
| 		iso_extension_mask &= ~ISO_EXTENSION_JOLIET; | 		iso_extension_mask &= ~ISO_EXTENSION_JOLIET; | ||||||
| 	} | 	} | ||||||
| 	if (!enable_rockridge) { | 	if (!enable_rockridge) { | ||||||
|  | @ -728,10 +728,10 @@ try_iso: | ||||||
| 	i_joliet_level = iso9660_ifs_get_joliet_level(p_iso); | 	i_joliet_level = iso9660_ifs_get_joliet_level(p_iso); | ||||||
| 	if (scan_only) { | 	if (scan_only) { | ||||||
| 		if (iso9660_ifs_get_volume_id(p_iso, &tmp)) { | 		if (iso9660_ifs_get_volume_id(p_iso, &tmp)) { | ||||||
| 			safe_strcpy(iso_report.label, sizeof(iso_report.label), tmp); | 			safe_strcpy(img_report.label, sizeof(img_report.label), tmp); | ||||||
| 			safe_free(tmp); | 			safe_free(tmp); | ||||||
| 		} else | 		} else | ||||||
| 			iso_report.label[0] = 0; | 			img_report.label[0] = 0; | ||||||
| 	} else { | 	} else { | ||||||
| 		if (iso_extension_mask & (ISO_EXTENSION_JOLIET|ISO_EXTENSION_ROCK_RIDGE)) | 		if (iso_extension_mask & (ISO_EXTENSION_JOLIET|ISO_EXTENSION_ROCK_RIDGE)) | ||||||
| 			uprintf("%sThis image will be extracted using %s extensions (if present)", spacing, | 			uprintf("%sThis image will be extracted using %s extensions (if present)", spacing, | ||||||
|  | @ -745,18 +745,18 @@ out: | ||||||
| 	iso_blocking_status = -1; | 	iso_blocking_status = -1; | ||||||
| 	if (scan_only) { | 	if (scan_only) { | ||||||
| 		// Remove trailing spaces from the label
 | 		// Remove trailing spaces from the label
 | ||||||
| 		for (j=(int)safe_strlen(iso_report.label)-1; ((j>=0)&&(isspaceU(iso_report.label[j]))); j--) | 		for (j=(int)safe_strlen(img_report.label)-1; ((j>=0)&&(isspaceU(img_report.label[j]))); j--) | ||||||
| 			iso_report.label[j] = 0; | 			img_report.label[j] = 0; | ||||||
| 		// We use the fact that UDF_BLOCKSIZE and ISO_BLOCKSIZE are the same here
 | 		// We use the fact that UDF_BLOCKSIZE and ISO_BLOCKSIZE are the same here
 | ||||||
| 		iso_report.projected_size = total_blocks * ISO_BLOCKSIZE; | 		img_report.projected_size = total_blocks * ISO_BLOCKSIZE; | ||||||
| 		// We will link the existing isolinux.cfg from a syslinux.cfg we create
 | 		// We will link the existing isolinux.cfg from a syslinux.cfg we create
 | ||||||
| 		// If multiple config files exist, choose the one with the shortest path
 | 		// If multiple config files exist, choose the one with the shortest path
 | ||||||
| 		// (so that a '/syslinux.cfg' is preferred over a '/isolinux/isolinux.cfg')
 | 		// (so that a '/syslinux.cfg' is preferred over a '/isolinux/isolinux.cfg')
 | ||||||
| 		if (!IsStrArrayEmpty(config_path)) { | 		if (!IsStrArrayEmpty(config_path)) { | ||||||
| 			// Set the iso_report.cfg_path string to maximum length, so that we don't have to
 | 			// Set the img_report.cfg_path string to maximum length, so that we don't have to
 | ||||||
| 			// do a special case for StrArray entry 0.
 | 			// do a special case for StrArray entry 0.
 | ||||||
| 			memset(iso_report.cfg_path, '_', sizeof(iso_report.cfg_path)-1); | 			memset(img_report.cfg_path, '_', sizeof(img_report.cfg_path)-1); | ||||||
| 			iso_report.cfg_path[sizeof(iso_report.cfg_path)-1] = 0; | 			img_report.cfg_path[sizeof(img_report.cfg_path)-1] = 0; | ||||||
| 			for (i=0; i<config_path.Index; i++) { | 			for (i=0; i<config_path.Index; i++) { | ||||||
| 				// OpenSuse based Live image have a /syslinux.cfg that doesn't work, so we enforce
 | 				// OpenSuse based Live image have a /syslinux.cfg that doesn't work, so we enforce
 | ||||||
| 				// the use of the one in '/boot/[i386|x86_64]/loader/isolinux.cfg' if present.
 | 				// the use of the one in '/boot/[i386|x86_64]/loader/isolinux.cfg' if present.
 | ||||||
|  | @ -765,8 +765,8 @@ out: | ||||||
| 				// See https://github.com/openSUSE/kiwi/issues/354
 | 				// See https://github.com/openSUSE/kiwi/issues/354
 | ||||||
| 				if ( (_stricmp(config_path.String[i], "/boot/i386/loader/isolinux.cfg") == 0) || | 				if ( (_stricmp(config_path.String[i], "/boot/i386/loader/isolinux.cfg") == 0) || | ||||||
| 					 (_stricmp(config_path.String[i], "/boot/x86_64/loader/isolinux.cfg") == 0)) { | 					 (_stricmp(config_path.String[i], "/boot/x86_64/loader/isolinux.cfg") == 0)) { | ||||||
| 					safe_strcpy(iso_report.cfg_path, sizeof(iso_report.cfg_path), config_path.String[i]); | 					safe_strcpy(img_report.cfg_path, sizeof(img_report.cfg_path), config_path.String[i]); | ||||||
| 					iso_report.needs_syslinux_overwrite = TRUE; | 					img_report.needs_syslinux_overwrite = TRUE; | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 				// Tails uses an '/EFI/BOOT/isolinux.cfg' along with a '/isolinux/isolinux.cfg'
 | 				// Tails uses an '/EFI/BOOT/isolinux.cfg' along with a '/isolinux/isolinux.cfg'
 | ||||||
|  | @ -774,10 +774,10 @@ out: | ||||||
| 				// so for now, at equal length, always pick the latest.
 | 				// so for now, at equal length, always pick the latest.
 | ||||||
| 				// We may have to revisit this and prefer a path that contains '/isolinux' if
 | 				// We may have to revisit this and prefer a path that contains '/isolinux' if
 | ||||||
| 				// this hack is not enough for other images.
 | 				// this hack is not enough for other images.
 | ||||||
| 				if (safe_strlen(iso_report.cfg_path) >= safe_strlen(config_path.String[i])) | 				if (safe_strlen(img_report.cfg_path) >= safe_strlen(config_path.String[i])) | ||||||
| 					safe_strcpy(iso_report.cfg_path, sizeof(iso_report.cfg_path), config_path.String[i]); | 					safe_strcpy(img_report.cfg_path, sizeof(img_report.cfg_path), config_path.String[i]); | ||||||
| 			} | 			} | ||||||
| 			uprintf("  Will use '%s' for Syslinux", iso_report.cfg_path); | 			uprintf("  Will use '%s' for Syslinux", img_report.cfg_path); | ||||||
| 			// Extract all of the isolinux.bin files we found to identify their versions
 | 			// Extract all of the isolinux.bin files we found to identify their versions
 | ||||||
| 			for (i=0; i<isolinux_path.Index; i++) { | 			for (i=0; i<isolinux_path.Index; i++) { | ||||||
| 				size = (size_t)ExtractISOFile(src_iso, isolinux_path.String[i], dot_isolinux_bin, FILE_ATTRIBUTE_NORMAL); | 				size = (size_t)ExtractISOFile(src_iso, isolinux_path.String[i], dot_isolinux_bin, FILE_ATTRIBUTE_NORMAL); | ||||||
|  | @ -794,59 +794,59 @@ out: | ||||||
| 					fread(buf, 1, size, fd); | 					fread(buf, 1, size, fd); | ||||||
| 					fclose(fd); | 					fclose(fd); | ||||||
| 					sl_version = GetSyslinuxVersion(buf, size, &ext); | 					sl_version = GetSyslinuxVersion(buf, size, &ext); | ||||||
| 					if (iso_report.sl_version == 0) { | 					if (img_report.sl_version == 0) { | ||||||
| 						safe_strcpy(iso_report.sl_version_ext, sizeof(iso_report.sl_version_ext), ext); | 						safe_strcpy(img_report.sl_version_ext, sizeof(img_report.sl_version_ext), ext); | ||||||
| 						iso_report.sl_version = sl_version; | 						img_report.sl_version = sl_version; | ||||||
| 						j = (int)i; | 						j = (int)i; | ||||||
| 					} else if ((iso_report.sl_version != sl_version) || (safe_strcmp(iso_report.sl_version_ext, ext) != 0)) { | 					} else if ((img_report.sl_version != sl_version) || (safe_strcmp(img_report.sl_version_ext, ext) != 0)) { | ||||||
| 						uprintf("  Found conflicting %s versions:\n  '%s' (%d.%02d%s) vs '%s' (%d.%02d%s)", isolinux_bin, | 						uprintf("  Found conflicting %s versions:\n  '%s' (%d.%02d%s) vs '%s' (%d.%02d%s)", isolinux_bin, | ||||||
| 							isolinux_path.String[j], SL_MAJOR(iso_report.sl_version), SL_MINOR(iso_report.sl_version), | 							isolinux_path.String[j], SL_MAJOR(img_report.sl_version), SL_MINOR(img_report.sl_version), | ||||||
| 							iso_report.sl_version_ext, isolinux_path.String[i], SL_MAJOR(sl_version), SL_MINOR(sl_version), ext); | 							img_report.sl_version_ext, isolinux_path.String[i], SL_MAJOR(sl_version), SL_MINOR(sl_version), ext); | ||||||
| 					} | 					} | ||||||
| 					free(buf); | 					free(buf); | ||||||
| 					_unlink(dot_isolinux_bin); | 					_unlink(dot_isolinux_bin); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			if (iso_report.sl_version != 0) { | 			if (img_report.sl_version != 0) { | ||||||
| 				static_sprintf(iso_report.sl_version_str, "%d.%02d", | 				static_sprintf(img_report.sl_version_str, "%d.%02d", | ||||||
| 					SL_MAJOR(iso_report.sl_version), SL_MINOR(iso_report.sl_version)); | 					SL_MAJOR(img_report.sl_version), SL_MINOR(img_report.sl_version)); | ||||||
| 				uprintf("  Detected Syslinux version: %s%s (from '%s')", | 				uprintf("  Detected Syslinux version: %s%s (from '%s')", | ||||||
| 					iso_report.sl_version_str, iso_report.sl_version_ext, isolinux_path.String[j]); | 					img_report.sl_version_str, img_report.sl_version_ext, isolinux_path.String[j]); | ||||||
| 				if ( (has_ldlinux_c32 && (SL_MAJOR(iso_report.sl_version) < 5)) | 				if ( (has_ldlinux_c32 && (SL_MAJOR(img_report.sl_version) < 5)) | ||||||
| 				  || (!has_ldlinux_c32 && (SL_MAJOR(iso_report.sl_version) >= 5)) ) | 				  || (!has_ldlinux_c32 && (SL_MAJOR(img_report.sl_version) >= 5)) ) | ||||||
| 					uprintf("  Warning: Conflict between Isolinux version and the presence of ldlinux.c32..."); | 					uprintf("  Warning: Conflict between Isolinux version and the presence of ldlinux.c32..."); | ||||||
| 			} else { | 			} else { | ||||||
| 				// Couldn't find a version from isolinux.bin. Force set to the versions we embed
 | 				// Couldn't find a version from isolinux.bin. Force set to the versions we embed
 | ||||||
| 				iso_report.sl_version = embedded_sl_version[has_ldlinux_c32?1:0]; | 				img_report.sl_version = embedded_sl_version[has_ldlinux_c32?1:0]; | ||||||
| 				static_sprintf(iso_report.sl_version_str, "%d.%02d", | 				static_sprintf(img_report.sl_version_str, "%d.%02d", | ||||||
| 					SL_MAJOR(iso_report.sl_version), SL_MINOR(iso_report.sl_version)); | 					SL_MAJOR(img_report.sl_version), SL_MINOR(img_report.sl_version)); | ||||||
| 				uprintf("  Warning: Could not detect Isolinux version - Forcing to %s (embedded)", | 				uprintf("  Warning: Could not detect Isolinux version - Forcing to %s (embedded)", | ||||||
| 					iso_report.sl_version_str); | 					img_report.sl_version_str); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (IS_WINPE(iso_report.winpe)) { | 		if (IS_WINPE(img_report.winpe)) { | ||||||
| 			// In case we have a WinPE 1.x based iso, we extract and parse txtsetup.sif
 | 			// In case we have a WinPE 1.x based iso, we extract and parse txtsetup.sif
 | ||||||
| 			// during scan, to see if /minint was provided for OsLoadOptions, as it decides
 | 			// during scan, to see if /minint was provided for OsLoadOptions, as it decides
 | ||||||
| 			// whether we should use 0x80 or 0x81 as the disk ID in the MBR
 | 			// whether we should use 0x80 or 0x81 as the disk ID in the MBR
 | ||||||
| 			safe_sprintf(path, sizeof(path), "/%s/txtsetup.sif",  | 			safe_sprintf(path, sizeof(path), "/%s/txtsetup.sif",  | ||||||
| 				basedir[((iso_report.winpe&WINPE_I386) == WINPE_I386)?0:1]); | 				basedir[((img_report.winpe&WINPE_I386) == WINPE_I386)?0:1]); | ||||||
| 			ExtractISOFile(src_iso, path, tmp_sif, FILE_ATTRIBUTE_NORMAL); | 			ExtractISOFile(src_iso, path, tmp_sif, FILE_ATTRIBUTE_NORMAL); | ||||||
| 			tmp = get_token_data_file("OsLoadOptions", tmp_sif); | 			tmp = get_token_data_file("OsLoadOptions", tmp_sif); | ||||||
| 			if (tmp != NULL) { | 			if (tmp != NULL) { | ||||||
| 				for (i=0; i<strlen(tmp); i++) | 				for (i=0; i<strlen(tmp); i++) | ||||||
| 					tmp[i] = (char)tolower(tmp[i]); | 					tmp[i] = (char)tolower(tmp[i]); | ||||||
| 				uprintf("  Checking txtsetup.sif:\n  OsLoadOptions = %s", tmp); | 				uprintf("  Checking txtsetup.sif:\n  OsLoadOptions = %s", tmp); | ||||||
| 				iso_report.uses_minint = (strstr(tmp, "/minint") != NULL); | 				img_report.uses_minint = (strstr(tmp, "/minint") != NULL); | ||||||
| 			} | 			} | ||||||
| 			_unlink(tmp_sif); | 			_unlink(tmp_sif); | ||||||
| 			safe_free(tmp); | 			safe_free(tmp); | ||||||
| 		} | 		} | ||||||
| 		if (HAS_INSTALL_WIM(iso_report)) { | 		if (HAS_INSTALL_WIM(img_report)) { | ||||||
| 			iso_report.install_wim_version = GetInstallWimVersion(src_iso); | 			img_report.install_wim_version = GetInstallWimVersion(src_iso); | ||||||
| 		} | 		} | ||||||
| 		if (iso_report.has_grub2) { | 		if (img_report.has_grub2) { | ||||||
| 			// In case we have a GRUB2 based iso, we extract boot/grub/i386-pc/normal.mod to parse its version
 | 			// In case we have a GRUB2 based iso, we extract boot/grub/i386-pc/normal.mod to parse its version
 | ||||||
| 			iso_report.grub2_version[0] = 0; | 			img_report.grub2_version[0] = 0; | ||||||
| 			if ((GetTempPathU(sizeof(path), path) != 0) && (GetTempFileNameU(path, APPLICATION_NAME, 0, path) != 0)) { | 			if ((GetTempPathU(sizeof(path), path) != 0) && (GetTempFileNameU(path, APPLICATION_NAME, 0, path) != 0)) { | ||||||
| 				size = (size_t)ExtractISOFile(src_iso, "boot/grub/i386-pc/normal.mod", path, FILE_ATTRIBUTE_NORMAL); | 				size = (size_t)ExtractISOFile(src_iso, "boot/grub/i386-pc/normal.mod", path, FILE_ATTRIBUTE_NORMAL); | ||||||
| 				buf = (char*)calloc(size, 1); | 				buf = (char*)calloc(size, 1); | ||||||
|  | @ -861,21 +861,21 @@ out: | ||||||
| 				free(buf); | 				free(buf); | ||||||
| 				_unlink(path); | 				_unlink(path); | ||||||
| 			} | 			} | ||||||
| 			if (iso_report.grub2_version[0] != 0) | 			if (img_report.grub2_version[0] != 0) | ||||||
| 				uprintf("  Detected Grub version: %s", iso_report.grub2_version); | 				uprintf("  Detected Grub version: %s", img_report.grub2_version); | ||||||
| 			else { | 			else { | ||||||
| 				uprintf("  Could not detect Grub version"); | 				uprintf("  Could not detect Grub version"); | ||||||
| 				iso_report.has_grub2 = FALSE; | 				img_report.has_grub2 = FALSE; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		StrArrayDestroy(&config_path); | 		StrArrayDestroy(&config_path); | ||||||
| 		StrArrayDestroy(&isolinux_path); | 		StrArrayDestroy(&isolinux_path); | ||||||
| 		SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); | 		SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); | ||||||
| 	} else if (HAS_SYSLINUX(iso_report)) { | 	} else if (HAS_SYSLINUX(img_report)) { | ||||||
| 		safe_sprintf(path, sizeof(path), "%s\\syslinux.cfg", dest_dir); | 		safe_sprintf(path, sizeof(path), "%s\\syslinux.cfg", dest_dir); | ||||||
| 		// Create a /syslinux.cfg (if none exists) that points to the existing isolinux cfg
 | 		// Create a /syslinux.cfg (if none exists) that points to the existing isolinux cfg
 | ||||||
| 		fd = fopen(path, "r"); | 		fd = fopen(path, "r"); | ||||||
| 		if (fd != NULL && iso_report.needs_syslinux_overwrite) { | 		if (fd != NULL && img_report.needs_syslinux_overwrite) { | ||||||
| 			fclose(fd); | 			fclose(fd); | ||||||
| 			fd = NULL; | 			fd = NULL; | ||||||
| 			safe_sprintf(path2, sizeof(path2), "%s\\syslinux.org", dest_dir); | 			safe_sprintf(path2, sizeof(path2), "%s\\syslinux.org", dest_dir); | ||||||
|  | @ -888,12 +888,12 @@ out: | ||||||
| 				uprintf("Unable to create %s - booting from USB will not work", path); | 				uprintf("Unable to create %s - booting from USB will not work", path); | ||||||
| 				r = 1; | 				r = 1; | ||||||
| 			} else { | 			} else { | ||||||
| 				fprintf(fd, "DEFAULT loadconfig\n\nLABEL loadconfig\n  CONFIG %s\n", iso_report.cfg_path); | 				fprintf(fd, "DEFAULT loadconfig\n\nLABEL loadconfig\n  CONFIG %s\n", img_report.cfg_path); | ||||||
| 				for (i=safe_strlen(iso_report.cfg_path); (i>0)&&(iso_report.cfg_path[i]!='/'); i--); | 				for (i=safe_strlen(img_report.cfg_path); (i>0)&&(img_report.cfg_path[i]!='/'); i--); | ||||||
| 				if (i>0) { | 				if (i>0) { | ||||||
| 					iso_report.cfg_path[i] = 0; | 					img_report.cfg_path[i] = 0; | ||||||
| 					fprintf(fd, "  APPEND %s/\n", iso_report.cfg_path); | 					fprintf(fd, "  APPEND %s/\n", img_report.cfg_path); | ||||||
| 					iso_report.cfg_path[i] = '/'; | 					img_report.cfg_path[i] = '/'; | ||||||
| 				} | 				} | ||||||
| 				uprintf("Created: %s", path); | 				uprintf("Created: %s", path); | ||||||
| 			} | 			} | ||||||
|  | @ -1022,7 +1022,7 @@ uint32_t GetInstallWimVersion(const char* iso) | ||||||
| 	udf_dirent_t *p_udf_root = NULL, *p_udf_file = NULL; | 	udf_dirent_t *p_udf_root = NULL, *p_udf_file = NULL; | ||||||
| 	iso9660_stat_t *p_statbuf = NULL; | 	iso9660_stat_t *p_statbuf = NULL; | ||||||
| 
 | 
 | ||||||
| 	wim_path = safe_strdup(&iso_report.install_wim_path[2]); | 	wim_path = safe_strdup(&img_report.install_wim_path[2]); | ||||||
| 	for (p = wim_path; p != 0; p++) | 	for (p = wim_path; p != 0; p++) | ||||||
| 		if (*p == '\\') *p = '/'; | 		if (*p == '\\') *p = '/'; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										177
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										177
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -415,7 +415,7 @@ static void SetMBRForUEFI(BOOL replace) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	if (image_path != NULL) { | 	if (image_path != NULL) { | ||||||
| 		if ( (!iso_report.has_efi) || ((iso_report.has_bootmgr) && (!allow_dual_uefi_bios) && | 		if ( (!img_report.has_efi) || ((img_report.has_bootmgr) && (!allow_dual_uefi_bios) && | ||||||
| 			 (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) != BST_CHECKED)) ) | 			 (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) != BST_CHECKED)) ) | ||||||
| 			useCSM = TRUE; | 			useCSM = TRUE; | ||||||
| 	} | 	} | ||||||
|  | @ -501,7 +501,7 @@ static void SetFSFromISO(void) | ||||||
| 	int i, fs, selected_fs = FS_UNKNOWN; | 	int i, fs, selected_fs = FS_UNKNOWN; | ||||||
| 	uint32_t fs_mask = 0; | 	uint32_t fs_mask = 0; | ||||||
| 	int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 	int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
| 	BOOL windows_to_go = (togo_mode) && HAS_TOGO(iso_report) && | 	BOOL windows_to_go = (togo_mode) && HAS_TOGO(img_report) && | ||||||
| 		(Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); | 		(Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); | ||||||
| 
 | 
 | ||||||
| 	if (image_path == NULL) | 	if (image_path == NULL) | ||||||
|  | @ -514,14 +514,14 @@ static void SetFSFromISO(void) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Syslinux and EFI have precedence over bootmgr (unless the user selected BIOS as target type)
 | 	// Syslinux and EFI have precedence over bootmgr (unless the user selected BIOS as target type)
 | ||||||
| 	if ((HAS_SYSLINUX(iso_report)) || (IS_REACTOS(iso_report)) || (iso_report.has_kolibrios) || | 	if ((HAS_SYSLINUX(img_report)) || (IS_REACTOS(img_report)) || (img_report.has_kolibrios) || | ||||||
| 		((iso_report.has_efi) && (tt == TT_UEFI) && (!iso_report.has_4GB_file) && (!windows_to_go))) { | 		((img_report.has_efi) && (tt == TT_UEFI) && (!img_report.has_4GB_file) && (!windows_to_go))) { | ||||||
| 		if (fs_mask & (1<<FS_FAT32)) { | 		if (fs_mask & (1<<FS_FAT32)) { | ||||||
| 			selected_fs = FS_FAT32; | 			selected_fs = FS_FAT32; | ||||||
| 		} else if ((fs_mask & (1<<FS_FAT16)) && (!iso_report.has_kolibrios)) { | 		} else if ((fs_mask & (1<<FS_FAT16)) && (!img_report.has_kolibrios)) { | ||||||
| 			selected_fs = FS_FAT16; | 			selected_fs = FS_FAT16; | ||||||
| 		} | 		} | ||||||
| 	} else if ((windows_to_go) || (iso_report.has_bootmgr) || (IS_WINPE(iso_report.winpe))) { | 	} else if ((windows_to_go) || (img_report.has_bootmgr) || (IS_WINPE(img_report.winpe))) { | ||||||
| 		if (fs_mask & (1<<FS_NTFS)) { | 		if (fs_mask & (1<<FS_NTFS)) { | ||||||
| 			selected_fs = FS_NTFS; | 			selected_fs = FS_NTFS; | ||||||
| 		} | 		} | ||||||
|  | @ -542,16 +542,16 @@ static void SetMBRProps(void) | ||||||
| { | { | ||||||
| 	int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 	int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 	int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | 	int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | ||||||
| 	BOOL needs_masquerading = (IS_WINPE(iso_report.winpe) && (!iso_report.uses_minint)); | 	BOOL needs_masquerading = (IS_WINPE(img_report.winpe) && (!img_report.uses_minint)); | ||||||
| 
 | 
 | ||||||
| 	if ((!mbr_selected_by_user) && ((image_path == NULL) || (bt != BT_ISO) || (fs != FS_NTFS) || IS_GRUB(iso_report) || | 	if ((!mbr_selected_by_user) && ((image_path == NULL) || (bt != BT_ISO) || (fs != FS_NTFS) || IS_GRUB(img_report) || | ||||||
| 		((togo_mode) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) )) { | 		((togo_mode) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) )) { | ||||||
| 		CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, BST_UNCHECKED); | 		CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, BST_UNCHECKED); | ||||||
| 		IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0)); | 		IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0)); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	uMBRChecked = (needs_masquerading || iso_report.has_bootmgr || mbr_selected_by_user)?BST_CHECKED:BST_UNCHECKED; | 	uMBRChecked = (needs_masquerading || img_report.has_bootmgr || mbr_selected_by_user)?BST_CHECKED:BST_UNCHECKED; | ||||||
| 	if (IsWindowEnabled(GetDlgItem(hMainDialog, IDC_RUFUS_MBR))) | 	if (IsWindowEnabled(GetDlgItem(hMainDialog, IDC_RUFUS_MBR))) | ||||||
| 		CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, uMBRChecked); | 		CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, uMBRChecked); | ||||||
| 	IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0)); | 	IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0)); | ||||||
|  | @ -560,7 +560,7 @@ static void SetMBRProps(void) | ||||||
| static void SetToGo(void) | static void SetToGo(void) | ||||||
| { | { | ||||||
| 	int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | 	int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | ||||||
| 	if ( ((bt != BT_ISO) && (togo_mode)) || ((bt == BT_ISO) && (HAS_TOGO(iso_report)) && (!togo_mode)) ) | 	if ( ((bt != BT_ISO) && (togo_mode)) || ((bt == BT_ISO) && (HAS_TOGO(img_report)) && (!togo_mode)) ) | ||||||
| 		ToggleToGo(); | 		ToggleToGo(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -571,7 +571,7 @@ static void EnableAdvancedBootOptions(BOOL enable, BOOL remove_checkboxes) | ||||||
| 	BOOL actual_enable_fix = ((tt==TT_UEFI)||(selection_default==BT_IMG)||!IsChecked(IDC_BOOT))?FALSE:enable; | 	BOOL actual_enable_fix = ((tt==TT_UEFI)||(selection_default==BT_IMG)||!IsChecked(IDC_BOOT))?FALSE:enable; | ||||||
| 	static UINT uXPartChecked = BST_UNCHECKED; | 	static UINT uXPartChecked = BST_UNCHECKED; | ||||||
| 
 | 
 | ||||||
| 	if ((selection_default == BT_ISO) && (iso_report.has_kolibrios || IS_GRUB(iso_report) || IS_REACTOS(iso_report) || HAS_SYSLINUX(iso_report))) { | 	if ((selection_default == BT_ISO) && (img_report.has_kolibrios || IS_GRUB(img_report) || IS_REACTOS(img_report) || HAS_SYSLINUX(img_report))) { | ||||||
| 		actual_enable_mbr = FALSE; | 		actual_enable_mbr = FALSE; | ||||||
| 		mbr_selected_by_user = FALSE; | 		mbr_selected_by_user = FALSE; | ||||||
| 	} | 	} | ||||||
|  | @ -628,9 +628,9 @@ static void SetTargetSystem(void) | ||||||
| 	SetMBRForUEFI(TRUE); | 	SetMBRForUEFI(TRUE); | ||||||
| 	if (SelectedDrive.PartitionType == PARTITION_STYLE_GPT) { | 	if (SelectedDrive.PartitionType == PARTITION_STYLE_GPT) { | ||||||
| 		ts = 2;	// GPT/UEFI
 | 		ts = 2;	// GPT/UEFI
 | ||||||
| 	} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker || ((iso_report.has_efi) && | 	} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker || ((img_report.has_efi) && | ||||||
| 		(!HAS_SYSLINUX(iso_report)) && (!iso_report.has_bootmgr) && (!IS_REACTOS(iso_report)) &&  | 		(!HAS_SYSLINUX(img_report)) && (!img_report.has_bootmgr) && (!IS_REACTOS(img_report)) &&  | ||||||
| 		(!iso_report.has_kolibrios) && (!IS_GRUB(iso_report)) && (!IS_WINPE(iso_report.winpe))) ) { | 		(!img_report.has_kolibrios) && (!IS_GRUB(img_report)) && (!IS_WINPE(img_report.winpe))) ) { | ||||||
| 		ts = 1;	// MBR/UEFI
 | 		ts = 1;	// MBR/UEFI
 | ||||||
| 	} else { | 	} else { | ||||||
| 		ts = 0;	// MBR/BIOS|UEFI
 | 		ts = 0;	// MBR/BIOS|UEFI
 | ||||||
|  | @ -677,7 +677,7 @@ static BOOL PopulateProperties(int ComboIndex) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// If no existing label is available and no ISO is selected, propose one according to the size (eg: "256MB", "8GB")
 | 	// If no existing label is available and no ISO is selected, propose one according to the size (eg: "256MB", "8GB")
 | ||||||
| 	if ((image_path == NULL) || (iso_report.label[0] == 0)) { | 	if ((image_path == NULL) || (img_report.label[0] == 0)) { | ||||||
| 		if ( (safe_stricmp(no_label, DriveLabel.String[ComboIndex]) == 0) | 		if ( (safe_stricmp(no_label, DriveLabel.String[ComboIndex]) == 0) | ||||||
| 		  || (safe_stricmp(lmprintf(MSG_207), DriveLabel.String[ComboIndex]) == 0) ) { | 		  || (safe_stricmp(lmprintf(MSG_207), DriveLabel.String[ComboIndex]) == 0) ) { | ||||||
| 			SetWindowTextU(hLabel, SelectedDrive.proposed_label); | 			SetWindowTextU(hLabel, SelectedDrive.proposed_label); | ||||||
|  | @ -685,7 +685,7 @@ static BOOL PopulateProperties(int ComboIndex) | ||||||
| 			SetWindowTextU(hLabel, DriveLabel.String[ComboIndex]); | 			SetWindowTextU(hLabel, DriveLabel.String[ComboIndex]); | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		SetWindowTextU(hLabel, iso_report.label); | 		SetWindowTextU(hLabel, img_report.label); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
|  | @ -979,42 +979,42 @@ static void DisplayISOProps(void) | ||||||
| 	int i; | 	int i; | ||||||
| 	char isolinux_str[16] = "No"; | 	char isolinux_str[16] = "No"; | ||||||
| 
 | 
 | ||||||
| 	if (HAS_SYSLINUX(iso_report)) { | 	if (HAS_SYSLINUX(img_report)) { | ||||||
| 		safe_sprintf(isolinux_str, sizeof(isolinux_str), "Yes (%s)", iso_report.sl_version_str); | 		safe_sprintf(isolinux_str, sizeof(isolinux_str), "Yes (%s)", img_report.sl_version_str); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// TODO: Only report features that are present
 | 	// TODO: Only report features that are present
 | ||||||
| 	uprintf("ISO label: '%s'", iso_report.label); | 	uprintf("ISO label: '%s'", img_report.label); | ||||||
| 	uprintf("  Size: %" PRIu64 " bytes", iso_report.projected_size); | 	uprintf("  Size: %" PRIu64 " bytes", img_report.projected_size); | ||||||
| 	uprintf("  Has a >64 chars filename: %s", YesNo(iso_report.has_long_filename)); | 	uprintf("  Has a >64 chars filename: %s", YesNo(img_report.has_long_filename)); | ||||||
| 	uprintf("  Has Symlinks: %s", YesNo(iso_report.has_symlinks)); | 	uprintf("  Has Symlinks: %s", YesNo(img_report.has_symlinks)); | ||||||
| 	uprintf("  Has a >4GB file: %s", YesNo(iso_report.has_4GB_file)); | 	uprintf("  Has a >4GB file: %s", YesNo(img_report.has_4GB_file)); | ||||||
| 	uprintf("  Uses Bootmgr: %s", YesNo(iso_report.has_bootmgr)); | 	uprintf("  Uses Bootmgr: %s", YesNo(img_report.has_bootmgr)); | ||||||
| 	uprintf("  Uses EFI: %s%s", YesNo(iso_report.has_efi), IS_WIN7_EFI(iso_report) ? " (win7_x64)" : ""); | 	uprintf("  Uses EFI: %s%s", YesNo(img_report.has_efi), IS_WIN7_EFI(img_report) ? " (win7_x64)" : ""); | ||||||
| 	uprintf("  Uses Grub 2: %s", YesNo(iso_report.has_grub2)); | 	uprintf("  Uses Grub 2: %s", YesNo(img_report.has_grub2)); | ||||||
| 	uprintf("  Uses Grub4DOS: %s", YesNo(iso_report.has_grub4dos)); | 	uprintf("  Uses Grub4DOS: %s", YesNo(img_report.has_grub4dos)); | ||||||
| 	uprintf("  Uses isolinux: %s", isolinux_str); | 	uprintf("  Uses isolinux: %s", isolinux_str); | ||||||
| 	if (HAS_SYSLINUX(iso_report) && (SL_MAJOR(iso_report.sl_version) < 5)) { | 	if (HAS_SYSLINUX(img_report) && (SL_MAJOR(img_report.sl_version) < 5)) { | ||||||
| 		for (i = 0; i<NB_OLD_C32; i++) { | 		for (i = 0; i<NB_OLD_C32; i++) { | ||||||
| 			uprintf("    With an old %s: %s\n", old_c32_name[i], iso_report.has_old_c32[i] ? "Yes" : "No"); | 			uprintf("    With an old %s: %s\n", old_c32_name[i], img_report.has_old_c32[i] ? "Yes" : "No"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	uprintf("  Uses KolibriOS: %s", YesNo(iso_report.has_kolibrios)); | 	uprintf("  Uses KolibriOS: %s", YesNo(img_report.has_kolibrios)); | ||||||
| 	uprintf("  Uses ReactOS: %s", YesNo(IS_REACTOS(iso_report))); | 	uprintf("  Uses ReactOS: %s", YesNo(IS_REACTOS(img_report))); | ||||||
| 	uprintf("  Uses WinPE: %s%s", YesNo(IS_WINPE(iso_report.winpe)), (iso_report.uses_minint) ? " (with /minint)" : ""); | 	uprintf("  Uses WinPE: %s%s", YesNo(IS_WINPE(img_report.winpe)), (img_report.uses_minint) ? " (with /minint)" : ""); | ||||||
| 	if (HAS_INSTALL_WIM(iso_report)) { | 	if (HAS_INSTALL_WIM(img_report)) { | ||||||
| 		uprintf("  Uses Install.wim: Yes (version %d.%d.%d)", (iso_report.install_wim_version >> 24) & 0xff, | 		uprintf("  Uses Install.wim: Yes (version %d.%d.%d)", (img_report.install_wim_version >> 24) & 0xff, | ||||||
| 			(iso_report.install_wim_version >> 16) & 0xff, (iso_report.install_wim_version >> 8) & 0xff); | 			(img_report.install_wim_version >> 16) & 0xff, (img_report.install_wim_version >> 8) & 0xff); | ||||||
| 		// Microsoft somehow managed to make their ESD WIMs incompatible with their own APIs
 | 		// Microsoft somehow managed to make their ESD WIMs incompatible with their own APIs
 | ||||||
| 		// (yes, EVEN the Windows 10 APIs), so we must filter them out...
 | 		// (yes, EVEN the Windows 10 APIs), so we must filter them out...
 | ||||||
| 		if (iso_report.install_wim_version >= MAX_WIM_VERSION) | 		if (img_report.install_wim_version >= MAX_WIM_VERSION) | ||||||
| 			uprintf("  Note: This WIM version is NOT compatible with Windows To Go"); | 			uprintf("  Note: This WIM version is NOT compatible with Windows To Go"); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// We don't support ToGo on Windows 7 or earlier, for lack of ISO mount capabilities
 | 	// We don't support ToGo on Windows 7 or earlier, for lack of ISO mount capabilities
 | ||||||
| 	// TODO: add install.wim extraction workaround for Windows 7
 | 	// TODO: add install.wim extraction workaround for Windows 7
 | ||||||
| 	if (nWindowsVersion >= WINDOWS_8) | 	if (nWindowsVersion >= WINDOWS_8) | ||||||
| 		if ( ((!togo_mode) && (HAS_TOGO(iso_report))) || ((togo_mode) && (!HAS_TOGO(iso_report))) ) | 		if ( ((!togo_mode) && (HAS_TOGO(img_report))) || ((togo_mode) && (!HAS_TOGO(img_report))) ) | ||||||
| 			ToggleToGo(); | 			ToggleToGo(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1022,16 +1022,15 @@ static void DisplayISOProps(void) | ||||||
| DWORD WINAPI ISOScanThread(LPVOID param) | DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	BOOL is_iso, is_img; |  | ||||||
| 
 | 
 | ||||||
| 	if (image_path == NULL) | 	if (image_path == NULL) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	PrintInfoDebug(0, MSG_202); | 	PrintInfoDebug(0, MSG_202); | ||||||
| 	user_notified = FALSE; | 	user_notified = FALSE; | ||||||
| 	EnableControls(FALSE); | 	EnableControls(FALSE); | ||||||
| 	is_iso = ExtractISO(image_path, "", TRUE); | 	img_report.is_iso = ExtractISO(image_path, "", TRUE); | ||||||
| 	is_img = IsHDImage(image_path); | 	img_report.is_bootable_img = IsBootableImage(image_path); | ||||||
| 	if (!is_iso && !is_img) { | 	if (!img_report.is_iso && !img_report.is_bootable_img) { | ||||||
| 		SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); | 		SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); | ||||||
| 		PrintInfoDebug(0, MSG_203); | 		PrintInfoDebug(0, MSG_203); | ||||||
| 		safe_free(image_path); | 		safe_free(image_path); | ||||||
|  | @ -1042,20 +1041,20 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (is_img) { | 	if (img_report.is_bootable_img) { | ||||||
| 		uprintf("  Image is a %sbootable %s image", | 		uprintf("  Image is a %sbootable %s image", | ||||||
| 			(iso_report.compression_type != BLED_COMPRESSION_NONE) ? "compressed " : "", iso_report.is_vhd ? "VHD" : "disk"); | 			(img_report.compression_type != BLED_COMPRESSION_NONE) ? "compressed " : "", img_report.is_vhd ? "VHD" : "disk"); | ||||||
| 		selection_default = BT_IMG; | 		selection_default = BT_IMG; | ||||||
| 	} | 	} | ||||||
| 	if (is_iso) { | 	if (img_report.is_iso) { | ||||||
| 		// Will override BT_IMG above for ISOHybrid
 | 		// Will override BT_IMG above for ISOHybrid
 | ||||||
| 		selection_default = BT_ISO; | 		selection_default = BT_ISO; | ||||||
| 		DisplayISOProps(); | 		DisplayISOProps(); | ||||||
| 	} | 	} | ||||||
| 	// Only enable AFTER we have determined the image type
 | 	// Only enable AFTER we have determined the image type
 | ||||||
| 	EnableControls(TRUE); | 	EnableControls(TRUE); | ||||||
| 	if ( (!iso_report.has_bootmgr) && (!HAS_SYSLINUX(iso_report)) && (!IS_WINPE(iso_report.winpe)) && (!IS_GRUB(iso_report)) | 	if ( (!img_report.has_bootmgr) && (!HAS_SYSLINUX(img_report)) && (!IS_WINPE(img_report.winpe)) && (!IS_GRUB(img_report)) | ||||||
| 	  && (!iso_report.has_efi) && (!IS_REACTOS(iso_report) && (!iso_report.has_kolibrios) && (!iso_report.is_bootable_img)) ) { | 	  && (!img_report.has_efi) && (!IS_REACTOS(img_report) && (!img_report.has_kolibrios) && (!img_report.is_bootable_img)) ) { | ||||||
| 		PrintInfo(0, MSG_081); | 		PrintInfo(0, MSG_081); | ||||||
| 		safe_free(image_path); | 		safe_free(image_path); | ||||||
| 		EnableWindow(hStatusToolbar, FALSE); | 		EnableWindow(hStatusToolbar, FALSE); | ||||||
|  | @ -1065,14 +1064,14 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 	} else { | 	} else { | ||||||
| 		// Enable bootable and set Target System and FS accordingly
 | 		// Enable bootable and set Target System and FS accordingly
 | ||||||
| 		CheckDlgButton(hMainDialog, IDC_BOOT, BST_CHECKED); | 		CheckDlgButton(hMainDialog, IDC_BOOT, BST_CHECKED); | ||||||
| 		if (!iso_report.is_bootable_img) { | 		if (!img_report.is_bootable_img) { | ||||||
| 			SetTargetSystem(); | 			SetTargetSystem(); | ||||||
| 			SetFSFromISO(); | 			SetFSFromISO(); | ||||||
| 			SetMBRProps(); | 			SetMBRProps(); | ||||||
| 			// Some Linux distros, such as Arch Linux, require the USB drive to have
 | 			// Some Linux distros, such as Arch Linux, require the USB drive to have
 | ||||||
| 			// a specific label => copy the one we got from the ISO image
 | 			// a specific label => copy the one we got from the ISO image
 | ||||||
| 			if (iso_report.label[0] != 0) { | 			if (img_report.label[0] != 0) { | ||||||
| 				SetWindowTextU(hLabel, iso_report.label); | 				SetWindowTextU(hLabel, img_report.label); | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, | 			SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, | ||||||
|  | @ -1289,16 +1288,16 @@ static BOOL BootCheck(void) | ||||||
| 			MessageBoxU(hMainDialog, lmprintf(MSG_087), lmprintf(MSG_086), MB_OK|MB_ICONERROR|MB_IS_RTL); | 			MessageBoxU(hMainDialog, lmprintf(MSG_087), lmprintf(MSG_086), MB_OK|MB_ICONERROR|MB_IS_RTL); | ||||||
| 			return FALSE; | 			return FALSE; | ||||||
| 		} | 		} | ||||||
| 		if ((size_check) && (iso_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) { | 		if ((size_check) && (img_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) { | ||||||
| 			// This ISO image is too big for the selected target
 | 			// This ISO image is too big for the selected target
 | ||||||
| 			MessageBoxU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR|MB_IS_RTL); | 			MessageBoxU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR|MB_IS_RTL); | ||||||
| 			return FALSE; | 			return FALSE; | ||||||
| 		} | 		} | ||||||
| 		if (bt == BT_IMG) { | 		if (bt == BT_IMG) { | ||||||
| 			if (!iso_report.is_bootable_img) | 			if (!img_report.is_bootable_img) | ||||||
| 			// The selected image doesn't match the boot option selected.
 | 			// The selected image doesn't match the boot option selected.
 | ||||||
| 				MessageBoxU(hMainDialog, lmprintf(MSG_188), lmprintf(MSG_187), MB_OK|MB_ICONERROR|MB_IS_RTL); | 				MessageBoxU(hMainDialog, lmprintf(MSG_188), lmprintf(MSG_187), MB_OK|MB_ICONERROR|MB_IS_RTL); | ||||||
| 			return (iso_report.is_bootable_img); | 			return (img_report.is_bootable_img); | ||||||
| 		} | 		} | ||||||
| 		fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 		fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 		tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 		tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
|  | @ -1320,46 +1319,46 @@ static BOOL BootCheck(void) | ||||||
| 					return FALSE; | 					return FALSE; | ||||||
| 			} | 			} | ||||||
| 		} else if (tt == TT_UEFI) { | 		} else if (tt == TT_UEFI) { | ||||||
| 			if (!iso_report.has_efi) { | 			if (!img_report.has_efi) { | ||||||
| 				// Unsupported ISO
 | 				// Unsupported ISO
 | ||||||
| 				MessageBoxU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL); | 				MessageBoxU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL); | ||||||
| 				return FALSE; | 				return FALSE; | ||||||
| 			} | 			} | ||||||
| 			if (IS_WIN7_EFI(iso_report) && (!WimExtractCheck())) { | 			if (IS_WIN7_EFI(img_report) && (!WimExtractCheck())) { | ||||||
| 				// Your platform cannot extract files from WIM archives => download 7-zip?
 | 				// Your platform cannot extract files from WIM archives => download 7-zip?
 | ||||||
| 				if (MessageBoxU(hMainDialog, lmprintf(MSG_102), lmprintf(MSG_101), MB_YESNO|MB_ICONERROR|MB_IS_RTL) == IDYES) | 				if (MessageBoxU(hMainDialog, lmprintf(MSG_102), lmprintf(MSG_101), MB_YESNO|MB_ICONERROR|MB_IS_RTL) == IDYES) | ||||||
| 					ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL); | 					ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL); | ||||||
| 				return FALSE; | 				return FALSE; | ||||||
| 			} | 			} | ||||||
| 		} else if ( ((fs == FS_NTFS) && (!iso_report.has_bootmgr) && (!IS_WINPE(iso_report.winpe)) && (!IS_GRUB(iso_report))) | 		} else if ( ((fs == FS_NTFS) && (!img_report.has_bootmgr) && (!IS_WINPE(img_report.winpe)) && (!IS_GRUB(img_report))) | ||||||
| 				 || ((IS_FAT(fs)) && (!HAS_SYSLINUX(iso_report)) && (!allow_dual_uefi_bios) && | 				 || ((IS_FAT(fs)) && (!HAS_SYSLINUX(img_report)) && (!allow_dual_uefi_bios) && | ||||||
| 					 (!IS_REACTOS(iso_report)) && (!iso_report.has_kolibrios) && (!IS_GRUB(iso_report))) ) { | 					 (!IS_REACTOS(img_report)) && (!img_report.has_kolibrios) && (!IS_GRUB(img_report))) ) { | ||||||
| 			// Incompatible FS and ISO
 | 			// Incompatible FS and ISO
 | ||||||
| 			MessageBoxU(hMainDialog, lmprintf(MSG_096), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL); | 			MessageBoxU(hMainDialog, lmprintf(MSG_096), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL); | ||||||
| 			return FALSE; | 			return FALSE; | ||||||
| 		} else if ((fs == FS_FAT16) && (iso_report.has_kolibrios)) { | 		} else if ((fs == FS_FAT16) && (img_report.has_kolibrios)) { | ||||||
| 			// KolibriOS doesn't support FAT16
 | 			// KolibriOS doesn't support FAT16
 | ||||||
| 			MessageBoxU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); | 			MessageBoxU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); | ||||||
| 			return FALSE; | 			return FALSE; | ||||||
| 		} | 		} | ||||||
| 		if ((IS_FAT(fs)) && (iso_report.has_4GB_file)) { | 		if ((IS_FAT(fs)) && (img_report.has_4GB_file)) { | ||||||
| 			// This ISO image contains a file larger than 4GB file (FAT32)
 | 			// This ISO image contains a file larger than 4GB file (FAT32)
 | ||||||
| 			MessageBoxU(hMainDialog, lmprintf(MSG_100), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); | 			MessageBoxU(hMainDialog, lmprintf(MSG_100), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); | ||||||
| 			return FALSE; | 			return FALSE; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if ((iso_report.has_grub2) && (iso_report.grub2_version[0] != 0) && | 		if ((img_report.has_grub2) && (img_report.grub2_version[0] != 0) && | ||||||
| 			(strcmp(iso_report.grub2_version, GRUB2_PACKAGE_VERSION) != 0)) { | 			(strcmp(img_report.grub2_version, GRUB2_PACKAGE_VERSION) != 0)) { | ||||||
| 			// We may have to download a different Grub2 version if we can find one
 | 			// We may have to download a different Grub2 version if we can find one
 | ||||||
| 			IGNORE_RETVAL(_chdirU(app_dir)); | 			IGNORE_RETVAL(_chdirU(app_dir)); | ||||||
| 			IGNORE_RETVAL(_mkdir(FILES_DIR)); | 			IGNORE_RETVAL(_mkdir(FILES_DIR)); | ||||||
| 			IGNORE_RETVAL(_chdir(FILES_DIR)); | 			IGNORE_RETVAL(_chdir(FILES_DIR)); | ||||||
| 			static_sprintf(tmp, "%s-%s/%s", grub, iso_report.grub2_version, core_img); | 			static_sprintf(tmp, "%s-%s/%s", grub, img_report.grub2_version, core_img); | ||||||
| 			fd = fopen(tmp, "rb"); | 			fd = fopen(tmp, "rb"); | ||||||
| 			if (fd != NULL) { | 			if (fd != NULL) { | ||||||
| 				// If a file already exists in the current directory, use that one
 | 				// If a file already exists in the current directory, use that one
 | ||||||
| 				uprintf("Will reuse '%s' from './" FILES_DIR "/%s-%s/' for Grub 2.x installation\n", | 				uprintf("Will reuse '%s' from './" FILES_DIR "/%s-%s/' for Grub 2.x installation\n", | ||||||
| 					core_img, grub, iso_report.grub2_version); | 					core_img, grub, img_report.grub2_version); | ||||||
| 				fseek(fd, 0, SEEK_END); | 				fseek(fd, 0, SEEK_END); | ||||||
| 				grub2_len = ftell(fd); | 				grub2_len = ftell(fd); | ||||||
| 				fseek(fd, 0, SEEK_SET); | 				fseek(fd, 0, SEEK_SET); | ||||||
|  | @ -1373,14 +1372,14 @@ static BOOL BootCheck(void) | ||||||
| 				} | 				} | ||||||
| 				fclose(fd); | 				fclose(fd); | ||||||
| 			} else { | 			} else { | ||||||
| 				r = MessageBoxU(hMainDialog, lmprintf(MSG_116, iso_report.grub2_version, GRUB2_PACKAGE_VERSION), | 				r = MessageBoxU(hMainDialog, lmprintf(MSG_116, img_report.grub2_version, GRUB2_PACKAGE_VERSION), | ||||||
| 					lmprintf(MSG_115), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); | 					lmprintf(MSG_115), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); | ||||||
| 				if (r == IDCANCEL) | 				if (r == IDCANCEL) | ||||||
| 					return FALSE; | 					return FALSE; | ||||||
| 				else if (r == IDYES) { | 				else if (r == IDYES) { | ||||||
| 					static_sprintf(tmp, "%s-%s", grub, iso_report.grub2_version); | 					static_sprintf(tmp, "%s-%s", grub, img_report.grub2_version); | ||||||
| 					IGNORE_RETVAL(_mkdir(tmp)); | 					IGNORE_RETVAL(_mkdir(tmp)); | ||||||
| 					static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, iso_report.grub2_version, core_img); | 					static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, img_report.grub2_version, core_img); | ||||||
| 					PrintInfoDebug(0, MSG_085, tmp); | 					PrintInfoDebug(0, MSG_085, tmp); | ||||||
| 					PromptOnError = FALSE; | 					PromptOnError = FALSE; | ||||||
| 					grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | 					grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | ||||||
|  | @ -1403,11 +1402,11 @@ static BOOL BootCheck(void) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (HAS_SYSLINUX(iso_report)) { | 		if (HAS_SYSLINUX(img_report)) { | ||||||
| 			if (SL_MAJOR(iso_report.sl_version) < 5) { | 			if (SL_MAJOR(img_report.sl_version) < 5) { | ||||||
| 				IGNORE_RETVAL(_chdirU(app_dir)); | 				IGNORE_RETVAL(_chdirU(app_dir)); | ||||||
| 				for (i=0; i<NB_OLD_C32; i++) { | 				for (i=0; i<NB_OLD_C32; i++) { | ||||||
| 					if (iso_report.has_old_c32[i]) { | 					if (img_report.has_old_c32[i]) { | ||||||
| 						if (!in_files_dir) { | 						if (!in_files_dir) { | ||||||
| 							IGNORE_RETVAL(_mkdir(FILES_DIR)); | 							IGNORE_RETVAL(_mkdir(FILES_DIR)); | ||||||
| 							IGNORE_RETVAL(_chdir(FILES_DIR)); | 							IGNORE_RETVAL(_chdir(FILES_DIR)); | ||||||
|  | @ -1438,16 +1437,16 @@ static BOOL BootCheck(void) | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} else if ((iso_report.sl_version != embedded_sl_version[1]) || | 			} else if ((img_report.sl_version != embedded_sl_version[1]) || | ||||||
| 				(safe_strcmp(iso_report.sl_version_ext, embedded_sl_version_ext[1]) != 0)) { | 				(safe_strcmp(img_report.sl_version_ext, embedded_sl_version_ext[1]) != 0)) { | ||||||
| 				// Unlike what was the case for v4 and earlier, Syslinux v5+ versions are INCOMPATIBLE with one another!
 | 				// Unlike what was the case for v4 and earlier, Syslinux v5+ versions are INCOMPATIBLE with one another!
 | ||||||
| 				IGNORE_RETVAL(_chdirU(app_dir)); | 				IGNORE_RETVAL(_chdirU(app_dir)); | ||||||
| 				IGNORE_RETVAL(_mkdir(FILES_DIR)); | 				IGNORE_RETVAL(_mkdir(FILES_DIR)); | ||||||
| 				IGNORE_RETVAL(_chdir(FILES_DIR)); | 				IGNORE_RETVAL(_chdir(FILES_DIR)); | ||||||
| 				for (i=0; i<2; i++) { | 				for (i=0; i<2; i++) { | ||||||
| 					// Check if we already have the relevant ldlinux_v#.##.sys & ldlinux_v#.##.bss files
 | 					// Check if we already have the relevant ldlinux_v#.##.sys & ldlinux_v#.##.bss files
 | ||||||
| 					static_sprintf(tmp, "%s-%s%s/%s.%s", syslinux, iso_report.sl_version_str, | 					static_sprintf(tmp, "%s-%s%s/%s.%s", syslinux, img_report.sl_version_str, | ||||||
| 						iso_report.sl_version_ext, ldlinux, ldlinux_ext[i]); | 						img_report.sl_version_ext, ldlinux, ldlinux_ext[i]); | ||||||
| 					fd = fopen(tmp, "rb"); | 					fd = fopen(tmp, "rb"); | ||||||
| 					if (fd != NULL) { | 					if (fd != NULL) { | ||||||
| 						fseek(fd, 0, SEEK_END); | 						fseek(fd, 0, SEEK_END); | ||||||
|  | @ -1458,39 +1457,39 @@ static BOOL BootCheck(void) | ||||||
| 				if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) { | 				if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) { | ||||||
| 					uprintf("Will reuse '%s.%s' and '%s.%s' from './" FILES_DIR "/%s/%s-%s%s/' for Syslinux installation\n", | 					uprintf("Will reuse '%s.%s' and '%s.%s' from './" FILES_DIR "/%s/%s-%s%s/' for Syslinux installation\n", | ||||||
| 						ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], FILES_DIR, syslinux, | 						ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], FILES_DIR, syslinux, | ||||||
| 						iso_report.sl_version_str, iso_report.sl_version_ext); | 						img_report.sl_version_str, img_report.sl_version_ext); | ||||||
| 				} else { | 				} else { | ||||||
| 					r = MessageBoxU(hMainDialog, lmprintf(MSG_114, iso_report.sl_version_str, iso_report.sl_version_ext, | 					r = MessageBoxU(hMainDialog, lmprintf(MSG_114, img_report.sl_version_str, img_report.sl_version_ext, | ||||||
| 						embedded_sl_version_str[1], embedded_sl_version_ext[1]), | 						embedded_sl_version_str[1], embedded_sl_version_ext[1]), | ||||||
| 						lmprintf(MSG_115), MB_YESNO|MB_ICONWARNING|MB_IS_RTL); | 						lmprintf(MSG_115), MB_YESNO|MB_ICONWARNING|MB_IS_RTL); | ||||||
| 					if (r != IDYES) | 					if (r != IDYES) | ||||||
| 						return FALSE; | 						return FALSE; | ||||||
| 					for (i=0; i<2; i++) { | 					for (i=0; i<2; i++) { | ||||||
| 						static_sprintf(tmp, "%s-%s", syslinux, iso_report.sl_version_str); | 						static_sprintf(tmp, "%s-%s", syslinux, img_report.sl_version_str); | ||||||
| 						IGNORE_RETVAL(_mkdir(tmp)); | 						IGNORE_RETVAL(_mkdir(tmp)); | ||||||
| 						if (*iso_report.sl_version_ext != 0) { | 						if (*img_report.sl_version_ext != 0) { | ||||||
| 							IGNORE_RETVAL(_chdir(tmp)); | 							IGNORE_RETVAL(_chdir(tmp)); | ||||||
| 							IGNORE_RETVAL(_mkdir(&iso_report.sl_version_ext[1])); | 							IGNORE_RETVAL(_mkdir(&img_report.sl_version_ext[1])); | ||||||
| 							IGNORE_RETVAL(_chdir("..")); | 							IGNORE_RETVAL(_chdir("..")); | ||||||
| 						} | 						} | ||||||
| 						static_sprintf(tmp, "%s/%s-%s%s/%s.%s", FILES_URL, syslinux, iso_report.sl_version_str, | 						static_sprintf(tmp, "%s/%s-%s%s/%s.%s", FILES_URL, syslinux, img_report.sl_version_str, | ||||||
| 							iso_report.sl_version_ext, ldlinux, ldlinux_ext[i]); | 							img_report.sl_version_ext, ldlinux, ldlinux_ext[i]); | ||||||
| 						PrintInfo(0, MSG_085, tmp); | 						PrintInfo(0, MSG_085, tmp); | ||||||
| 						PromptOnError = (*iso_report.sl_version_ext == 0); | 						PromptOnError = (*img_report.sl_version_ext == 0); | ||||||
| 						syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | 						syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | ||||||
| 						PromptOnError = TRUE; | 						PromptOnError = TRUE; | ||||||
| 						if ((syslinux_ldlinux_len[i] == 0) && (DownloadStatus == 404) && (*iso_report.sl_version_ext != 0)) { | 						if ((syslinux_ldlinux_len[i] == 0) && (DownloadStatus == 404) && (*img_report.sl_version_ext != 0)) { | ||||||
| 							// Couldn't locate the file on the server => try to download without the version extra
 | 							// Couldn't locate the file on the server => try to download without the version extra
 | ||||||
| 							uprintf("Extended version was not found, trying main version\n"); | 							uprintf("Extended version was not found, trying main version\n"); | ||||||
| 							static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, iso_report.sl_version_str, | 							static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, img_report.sl_version_str, | ||||||
| 								ldlinux, ldlinux_ext[i]); | 								ldlinux, ldlinux_ext[i]); | ||||||
| 							PrintInfo(0, MSG_085, tmp); | 							PrintInfo(0, MSG_085, tmp); | ||||||
| 							syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | 							syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | ||||||
| 							if (syslinux_ldlinux_len[i] != 0) { | 							if (syslinux_ldlinux_len[i] != 0) { | ||||||
| 								// Duplicate the file so that the user won't be prompted to download again
 | 								// Duplicate the file so that the user won't be prompted to download again
 | ||||||
| 								static_sprintf(tmp, "%s-%s\\%s.%s", syslinux, iso_report.sl_version_str, ldlinux, ldlinux_ext[i]); | 								static_sprintf(tmp, "%s-%s\\%s.%s", syslinux, img_report.sl_version_str, ldlinux, ldlinux_ext[i]); | ||||||
| 								static_sprintf(tmp2, "%s-%s\\%s\\%s.%s", syslinux, iso_report.sl_version_str,  | 								static_sprintf(tmp2, "%s-%s\\%s\\%s.%s", syslinux, img_report.sl_version_str,  | ||||||
| 									&iso_report.sl_version_ext[1], ldlinux, ldlinux_ext[i]); | 									&img_report.sl_version_ext[1], ldlinux, ldlinux_ext[i]); | ||||||
| 								CopyFileA(tmp, tmp2, FALSE); | 								CopyFileA(tmp, tmp2, FALSE); | ||||||
| 							} | 							} | ||||||
| 						} | 						} | ||||||
|  | @ -2365,9 +2364,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			ToggleImage(!IsChecked(IDC_BOOT) || (selection_default != BT_IMG)); | 			ToggleImage(!IsChecked(IDC_BOOT) || (selection_default != BT_IMG)); | ||||||
| 			SetToGo(); | 			SetToGo(); | ||||||
| 			if ((selection_default == BT_ISO) || (selection_default == BT_IMG)) { | 			if ((selection_default == BT_ISO) || (selection_default == BT_IMG)) { | ||||||
| 				if ((image_path != NULL) && (iso_report.label[0] != 0)) { | 				if ((image_path != NULL) && (img_report.label[0] != 0)) { | ||||||
| 					// Some distros (eg. Arch Linux) want to see a specific label => ignore user one
 | 					// Some distros (eg. Arch Linux) want to see a specific label => ignore user one
 | ||||||
| 					SetWindowTextU(hLabel, iso_report.label); | 					SetWindowTextU(hLabel, img_report.label); | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				if (selection_default == BT_UEFI_NTFS) { | 				if (selection_default == BT_UEFI_NTFS) { | ||||||
|  | @ -2462,7 +2461,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				// Ask users how they want to write ISOHybrid images
 | 				// Ask users how they want to write ISOHybrid images
 | ||||||
| 				if ((IsChecked(IDC_BOOT)) && (iso_report.is_bootable_img) && | 				if ((IsChecked(IDC_BOOT)) && (img_report.is_bootable_img) && | ||||||
| 					(ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)) == BT_ISO)) { | 					(ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)) == BT_ISO)) { | ||||||
| 					char* iso_image = lmprintf(MSG_036); | 					char* iso_image = lmprintf(MSG_036); | ||||||
| 					char* dd_image = lmprintf(MSG_095); | 					char* dd_image = lmprintf(MSG_095); | ||||||
|  |  | ||||||
|  | @ -260,6 +260,8 @@ typedef struct { | ||||||
| 	char install_wim_path[64];	/* path to install.wim or install.swm */ | 	char install_wim_path[64];	/* path to install.wim or install.swm */ | ||||||
| 	uint64_t projected_size; | 	uint64_t projected_size; | ||||||
| 	uint32_t install_wim_version; | 	uint32_t install_wim_version; | ||||||
|  | 	BOOLEAN is_iso; | ||||||
|  | 	BOOLEAN is_bootable_img; | ||||||
| 	uint8_t winpe; | 	uint8_t winpe; | ||||||
| 	uint8_t has_efi; | 	uint8_t has_efi; | ||||||
| 	BOOLEAN has_4GB_file; | 	BOOLEAN has_4GB_file; | ||||||
|  | @ -275,14 +277,13 @@ typedef struct { | ||||||
| 	BOOLEAN has_grub2; | 	BOOLEAN has_grub2; | ||||||
| 	BOOLEAN has_kolibrios; | 	BOOLEAN has_kolibrios; | ||||||
| 	BOOLEAN uses_minint; | 	BOOLEAN uses_minint; | ||||||
| 	BOOLEAN is_bootable_img; |  | ||||||
| 	BOOLEAN compression_type; | 	BOOLEAN compression_type; | ||||||
| 	BOOLEAN is_vhd; | 	BOOLEAN is_vhd; | ||||||
| 	uint16_t sl_version;	// Syslinux/Isolinux version
 | 	uint16_t sl_version;	// Syslinux/Isolinux version
 | ||||||
| 	char sl_version_str[12]; | 	char sl_version_str[12]; | ||||||
| 	char sl_version_ext[32]; | 	char sl_version_ext[32]; | ||||||
| 	char grub2_version[32]; | 	char grub2_version[32]; | ||||||
| } RUFUS_ISO_REPORT; | } RUFUS_IMG_REPORT; | ||||||
| 
 | 
 | ||||||
| /* Isolate the Syslinux version numbers */ | /* Isolate the Syslinux version numbers */ | ||||||
| #define SL_MAJOR(x) ((uint8_t)((x)>>8)) | #define SL_MAJOR(x) ((uint8_t)((x)>>8)) | ||||||
|  | @ -366,7 +367,7 @@ extern RUFUS_DRIVE_INFO SelectedDrive; | ||||||
| extern const int nb_steps[FS_MAX]; | extern const int nb_steps[FS_MAX]; | ||||||
| extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode; | extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode; | ||||||
| extern BOOL allow_dual_uefi_bios, togo_mode; | extern BOOL allow_dual_uefi_bios, togo_mode; | ||||||
| extern RUFUS_ISO_REPORT iso_report; | extern RUFUS_IMG_REPORT img_report; | ||||||
| extern int64_t iso_blocking_status; | extern int64_t iso_blocking_status; | ||||||
| extern uint16_t rufus_version[3], embedded_sl_version[2]; | extern uint16_t rufus_version[3], embedded_sl_version[2]; | ||||||
| extern int nWindowsVersion; | extern int nWindowsVersion; | ||||||
|  | @ -442,7 +443,7 @@ extern void parse_update(char* buf, size_t len); | ||||||
| extern uint8_t WimExtractCheck(void); | extern uint8_t WimExtractCheck(void); | ||||||
| extern BOOL WimExtractFile(const char* wim_image, int index, const char* src, const char* dst); | extern BOOL WimExtractFile(const char* wim_image, int index, const char* src, const char* dst); | ||||||
| extern BOOL WimApplyImage(const char* image, int index, const char* dst); | extern BOOL WimApplyImage(const char* image, int index, const char* dst); | ||||||
| extern BOOL IsHDImage(const char* path); | extern BOOL IsBootableImage(const char* path); | ||||||
| extern BOOL AppendVHDFooter(const char* vhd_path); | extern BOOL AppendVHDFooter(const char* vhd_path); | ||||||
| extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid); | extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid); | ||||||
| extern void LostTranslatorCheck(void); | extern void LostTranslatorCheck(void); | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| 
 | 
 | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 376 | IDD_DIALOG DIALOGEX 12, 12, 242, 376 | ||||||
| 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 | ||||||
| CAPTION "Rufus 2.3.711" | CAPTION "Rufus 2.4.712" | ||||||
| FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -317,8 +317,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,3,711,0 |  FILEVERSION 2,4,712,0 | ||||||
|  PRODUCTVERSION 2,3,711,0 |  PRODUCTVERSION 2,4,712,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -335,13 +335,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", "2.3.711" |             VALUE "FileVersion", "2.4.712" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2015 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", "2.3.711" |             VALUE "ProductVersion", "2.4.712" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -105,9 +105,9 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) | ||||||
| 	uint32_t ldlinux_cluster; | 	uint32_t ldlinux_cluster; | ||||||
| 	int i, nsectors; | 	int i, nsectors; | ||||||
| 	int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | 	int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | ||||||
| 	BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_ISO) && (SL_MAJOR(iso_report.sl_version) >= 5)); | 	BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_ISO) && (SL_MAJOR(img_report.sl_version) >= 5)); | ||||||
| 
 | 
 | ||||||
| 	PrintInfoDebug(0, MSG_234, (bt == BT_ISO)?iso_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]); | 	PrintInfoDebug(0, MSG_234, (bt == BT_ISO)?img_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]); | ||||||
| 
 | 
 | ||||||
| 	// 4K sector size workaround
 | 	// 4K sector size workaround
 | ||||||
| 	SECTOR_SHIFT = 0; | 	SECTOR_SHIFT = 0; | ||||||
|  | @ -133,8 +133,8 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) | ||||||
| 			syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]); | 			syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]); | ||||||
| 			if (syslinux_ldlinux[i] == NULL) | 			if (syslinux_ldlinux[i] == NULL) | ||||||
| 				goto out; | 				goto out; | ||||||
| 			static_sprintf(path, "%s/%s-%s%s/%s.%s", FILES_DIR, syslinux, iso_report.sl_version_str, | 			static_sprintf(path, "%s/%s-%s%s/%s.%s", FILES_DIR, syslinux, img_report.sl_version_str, | ||||||
| 				iso_report.sl_version_ext, ldlinux, i==0?"sys":"bss"); | 				img_report.sl_version_ext, ldlinux, i==0?"sys":"bss"); | ||||||
| 			fd = fopen(path, "rb"); | 			fd = fopen(path, "rb"); | ||||||
| 			if (fd == NULL) { | 			if (fd == NULL) { | ||||||
| 				uprintf("Could not open %s\n", path); | 				uprintf("Could not open %s\n", path); | ||||||
|  | @ -315,7 +315,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) | ||||||
| 				uprintf("Failed to create '%s': %s\n", path, WindowsErrorString()); | 				uprintf("Failed to create '%s': %s\n", path, WindowsErrorString()); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} else if (IS_REACTOS(iso_report)) { | 	} else if (IS_REACTOS(img_report)) { | ||||||
| 		uprintf("Setting up ReactOS...\n"); | 		uprintf("Setting up ReactOS...\n"); | ||||||
| 		syslinux_mboot = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_SL_MBOOT_C32), | 		syslinux_mboot = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_SL_MBOOT_C32), | ||||||
| 			_RT_RCDATA, "mboot.c32", &syslinux_mboot_len, FALSE); | 			_RT_RCDATA, "mboot.c32", &syslinux_mboot_len, FALSE); | ||||||
|  | @ -346,7 +346,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) | ||||||
| 		} | 		} | ||||||
| 		/* Write the syslinux.cfg for ReactOS */ | 		/* Write the syslinux.cfg for ReactOS */ | ||||||
| 		fprintf(fd, "DEFAULT ReactOS\nLABEL ReactOS\n  KERNEL %s\n  APPEND %s\n", | 		fprintf(fd, "DEFAULT ReactOS\nLABEL ReactOS\n  KERNEL %s\n  APPEND %s\n", | ||||||
| 			mboot_c32, iso_report.reactos_path); | 			mboot_c32, img_report.reactos_path); | ||||||
| 		fclose(fd); | 		fclose(fd); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										27
									
								
								src/vhd.c
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								src/vhd.c
									
										
									
									
									
								
							|  | @ -243,7 +243,7 @@ BOOL IsCompressedBootableImage(const char* path) | ||||||
| 	BOOL r = FALSE; | 	BOOL r = FALSE; | ||||||
| 	int64_t dc; | 	int64_t dc; | ||||||
| 
 | 
 | ||||||
| 	iso_report.compression_type = BLED_COMPRESSION_NONE; | 	img_report.compression_type = BLED_COMPRESSION_NONE; | ||||||
| 	for (p = (char*)&path[strlen(path)-1]; (*p != '.') && (p != path); p--); | 	for (p = (char*)&path[strlen(path)-1]; (*p != '.') && (p != path); p--); | ||||||
| 
 | 
 | ||||||
| 	if (p == path) | 	if (p == path) | ||||||
|  | @ -251,7 +251,7 @@ BOOL IsCompressedBootableImage(const char* path) | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i<ARRAYSIZE(file_assoc); i++) { | 	for (i = 0; i<ARRAYSIZE(file_assoc); i++) { | ||||||
| 		if (strcmp(p, file_assoc[i].ext) == 0) { | 		if (strcmp(p, file_assoc[i].ext) == 0) { | ||||||
| 			iso_report.compression_type = file_assoc[i].type; | 			img_report.compression_type = file_assoc[i].type; | ||||||
| 			buf = malloc(MBR_SIZE); | 			buf = malloc(MBR_SIZE); | ||||||
| 			if (buf == NULL) | 			if (buf == NULL) | ||||||
| 				return FALSE; | 				return FALSE; | ||||||
|  | @ -273,7 +273,7 @@ BOOL IsCompressedBootableImage(const char* path) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| BOOL IsHDImage(const char* path) | BOOL IsBootableImage(const char* path) | ||||||
| { | { | ||||||
| 	HANDLE handle = INVALID_HANDLE_VALUE; | 	HANDLE handle = INVALID_HANDLE_VALUE; | ||||||
| 	LARGE_INTEGER liImageSize; | 	LARGE_INTEGER liImageSize; | ||||||
|  | @ -282,6 +282,7 @@ BOOL IsHDImage(const char* path) | ||||||
| 	size_t i; | 	size_t i; | ||||||
| 	uint32_t checksum, old_checksum; | 	uint32_t checksum, old_checksum; | ||||||
| 	LARGE_INTEGER ptr; | 	LARGE_INTEGER ptr; | ||||||
|  | 	BOOL is_bootable_img = FALSE; | ||||||
| 
 | 
 | ||||||
| 	uprintf("Disk image analysis:"); | 	uprintf("Disk image analysis:"); | ||||||
| 	handle = CreateFileU(path, GENERIC_READ, FILE_SHARE_READ, NULL, | 	handle = CreateFileU(path, GENERIC_READ, FILE_SHARE_READ, NULL, | ||||||
|  | @ -291,31 +292,31 @@ BOOL IsHDImage(const char* path) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	iso_report.is_bootable_img = (BOOLEAN)IsCompressedBootableImage(path); | 	is_bootable_img = (BOOLEAN)IsCompressedBootableImage(path); | ||||||
| 	if (iso_report.compression_type == BLED_COMPRESSION_NONE) | 	if (img_report.compression_type == BLED_COMPRESSION_NONE) | ||||||
| 		iso_report.is_bootable_img = (BOOLEAN)AnalyzeMBR(handle, "  Image"); | 		is_bootable_img = (BOOLEAN)AnalyzeMBR(handle, "  Image"); | ||||||
| 
 | 
 | ||||||
| 	if (!GetFileSizeEx(handle, &liImageSize)) { | 	if (!GetFileSizeEx(handle, &liImageSize)) { | ||||||
| 		uprintf("  Could not get image size: %s", WindowsErrorString()); | 		uprintf("  Could not get image size: %s", WindowsErrorString()); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 	iso_report.projected_size = (uint64_t)liImageSize.QuadPart; | 	img_report.projected_size = (uint64_t)liImageSize.QuadPart; | ||||||
| 
 | 
 | ||||||
| 	size = sizeof(vhd_footer); | 	size = sizeof(vhd_footer); | ||||||
| 	if ((iso_report.compression_type == BLED_COMPRESSION_NONE) && (iso_report.projected_size >= (512 + size))) { | 	if ((img_report.compression_type == BLED_COMPRESSION_NONE) && (img_report.projected_size >= (512 + size))) { | ||||||
| 		footer = (vhd_footer*)malloc(size); | 		footer = (vhd_footer*)malloc(size); | ||||||
| 		ptr.QuadPart = iso_report.projected_size - size; | 		ptr.QuadPart = img_report.projected_size - size; | ||||||
| 		if ( (footer == NULL) || (!SetFilePointerEx(handle, ptr, NULL, FILE_BEGIN)) || | 		if ( (footer == NULL) || (!SetFilePointerEx(handle, ptr, NULL, FILE_BEGIN)) || | ||||||
| 			 (!ReadFile(handle, footer, size, &size, NULL)) || (size != sizeof(vhd_footer)) ) { | 			 (!ReadFile(handle, footer, size, &size, NULL)) || (size != sizeof(vhd_footer)) ) { | ||||||
| 			uprintf("  Could not read VHD footer"); | 			uprintf("  Could not read VHD footer"); | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
| 		if (memcmp(footer->cookie, conectix_str, sizeof(footer->cookie)) == 0) { | 		if (memcmp(footer->cookie, conectix_str, sizeof(footer->cookie)) == 0) { | ||||||
| 			iso_report.projected_size -= sizeof(vhd_footer); | 			img_report.projected_size -= sizeof(vhd_footer); | ||||||
| 			if ( (bswap_uint32(footer->file_format_version) != VHD_FOOTER_FILE_FORMAT_V1_0) | 			if ( (bswap_uint32(footer->file_format_version) != VHD_FOOTER_FILE_FORMAT_V1_0) | ||||||
| 			  || (bswap_uint32(footer->disk_type) != VHD_FOOTER_TYPE_FIXED_HARD_DISK)) { | 			  || (bswap_uint32(footer->disk_type) != VHD_FOOTER_TYPE_FIXED_HARD_DISK)) { | ||||||
| 				uprintf("  Unsupported type of VHD image"); | 				uprintf("  Unsupported type of VHD image"); | ||||||
| 				iso_report.is_bootable_img = FALSE; | 				is_bootable_img = FALSE; | ||||||
| 				goto out; | 				goto out; | ||||||
| 			} | 			} | ||||||
| 			// Might as well validate the checksum while we're at it
 | 			// Might as well validate the checksum while we're at it
 | ||||||
|  | @ -328,14 +329,14 @@ BOOL IsHDImage(const char* path) | ||||||
| 				uprintf("  Warning: VHD footer seems corrupted (checksum: %04X, expected: %04X)", old_checksum, checksum); | 				uprintf("  Warning: VHD footer seems corrupted (checksum: %04X, expected: %04X)", old_checksum, checksum); | ||||||
| 			// Need to remove the footer from our payload
 | 			// Need to remove the footer from our payload
 | ||||||
| 			uprintf("  Image is a Fixed Hard Disk VHD file"); | 			uprintf("  Image is a Fixed Hard Disk VHD file"); | ||||||
| 			iso_report.is_vhd = TRUE; | 			img_report.is_vhd = TRUE; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| out: | out: | ||||||
| 	safe_free(footer); | 	safe_free(footer); | ||||||
| 	safe_closehandle(handle); | 	safe_closehandle(handle); | ||||||
| 	return iso_report.is_bootable_img; | 	return is_bootable_img; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #define WIM_HAS_API_EXTRACT 1 | #define WIM_HAS_API_EXTRACT 1 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue