mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] add support for Windows XP x64 and Server 2003 x64 ISOs
* Closes #1167
This commit is contained in:
		
							parent
							
								
									16cddefff9
								
							
						
					
					
						commit
						dbc92e3adc
					
				
					 4 changed files with 36 additions and 31 deletions
				
			
		
							
								
								
									
										38
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										38
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -1167,10 +1167,11 @@ static BOOL WritePBR(HANDLE hLogicalVolume) | ||||||
| static BOOL SetupWinPE(char drive_letter) | static BOOL SetupWinPE(char drive_letter) | ||||||
| { | { | ||||||
| 	char src[64], dst[32]; | 	char src[64], dst[32]; | ||||||
| 	const char* basedir[] = { "i386", "minint" }; | 	const char* basedir[3] = { "i386", "amd64", "minint" }; | ||||||
| 	const char* patch_str_org[] = { "\\minint\\txtsetup.sif", "\\minint\\system32\\" }; | 	const char* patch_str_org[2] = { "\\minint\\txtsetup.sif", "\\minint\\system32\\" }; | ||||||
| 	const char* patch_str_rep[] = { "\\i386\\txtsetup.sif", "\\i386\\system32\\" }; | 	const char* patch_str_rep[2][2] = { { "\\i386\\txtsetup.sif", "\\i386\\system32\\" } , | ||||||
| 	const char *win_nt_bt_org = "$win_nt$.~bt", *win_nt_bt_rep = "i386"; | 										{ "\\amd64\\txtsetup.sif", "\\amd64\\system32\\" } }; | ||||||
|  | 	const char *win_nt_bt_org = "$win_nt$.~bt"; | ||||||
| 	const char *rdisk_zero = "rdisk(0)"; | 	const char *rdisk_zero = "rdisk(0)"; | ||||||
| 	const LARGE_INTEGER liZero = { {0, 0} }; | 	const LARGE_INTEGER liZero = { {0, 0} }; | ||||||
| 	char setupsrcdev[64]; | 	char setupsrcdev[64]; | ||||||
|  | @ -1179,16 +1180,19 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 	BOOL r = FALSE; | 	BOOL r = FALSE; | ||||||
| 	char* buffer = NULL; | 	char* buffer = NULL; | ||||||
| 
 | 
 | ||||||
| 	index = ((img_report.winpe&WINPE_I386) == WINPE_I386)?0:1; | 	if ((img_report.winpe & WINPE_AMD64) == WINPE_AMD64) | ||||||
|  | 		index = 1; | ||||||
|  | 	else if ((img_report.winpe & WINPE_MININT) == WINPE_MININT) | ||||||
|  | 		index = 2; | ||||||
| 	// 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
 | ||||||
| 	static_sprintf(setupsrcdev, "SetupSourceDevice = \"\\device\\harddisk%d\\partition1\"", | 	static_sprintf(setupsrcdev, "SetupSourceDevice = \"\\device\\harddisk%d\\partition1\"", | ||||||
| 		ComboBox_GetCurSel(hDiskID)); | 		ComboBox_GetCurSel(hDiskID)); | ||||||
| 	// Copy of ntdetect.com in root
 | 	// Copy of ntdetect.com in root
 | ||||||
| 	static_sprintf(src, "%c:\\%s\\ntdetect.com", drive_letter, basedir[index]); | 	static_sprintf(src, "%c:\\%s\\ntdetect.com", drive_letter, basedir[2*(index/2)]); | ||||||
| 	static_sprintf(dst, "%c:\\ntdetect.com", drive_letter); | 	static_sprintf(dst, "%c:\\ntdetect.com", drive_letter); | ||||||
| 	CopyFileA(src, dst, TRUE); | 	CopyFileA(src, dst, TRUE); | ||||||
| 	if (!img_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/amd64 files unmodified
 | ||||||
| 		static_sprintf(src, "%c:\\%s\\txtsetup.sif", drive_letter, basedir[index]); | 		static_sprintf(src, "%c:\\%s\\txtsetup.sif", drive_letter, basedir[index]); | ||||||
| 		static_sprintf(dst, "%c:\\txtsetup.sif", drive_letter); | 		static_sprintf(dst, "%c:\\txtsetup.sif", drive_letter); | ||||||
| 		if (!CopyFileA(src, dst, TRUE)) { | 		if (!CopyFileA(src, dst, TRUE)) { | ||||||
|  | @ -1201,7 +1205,7 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 		uprintf("Successfully added '%s' to %s\n", setupsrcdev, dst); | 		uprintf("Successfully added '%s' to %s\n", setupsrcdev, dst); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	static_sprintf(src, "%c:\\%s\\setupldr.bin", drive_letter,  basedir[index]); | 	static_sprintf(src, "%c:\\%s\\setupldr.bin", drive_letter,  basedir[2*(index/2)]); | ||||||
| 	static_sprintf(dst, "%c:\\BOOTMGR", drive_letter); | 	static_sprintf(dst, "%c:\\BOOTMGR", drive_letter); | ||||||
| 	if (!CopyFileA(src, dst, TRUE)) { | 	if (!CopyFileA(src, dst, TRUE)) { | ||||||
| 		uprintf("Did not copy %s as %s: %s\n", src, dst, WindowsErrorString()); | 		uprintf("Did not copy %s as %s: %s\n", src, dst, WindowsErrorString()); | ||||||
|  | @ -1213,7 +1217,7 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 		if (img_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 (!(img_report.winpe&WINPE_I386)) { | 		} else if (!(img_report.winpe&(WINPE_I386|WINPE_AMD64))) { | ||||||
| 			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; | ||||||
|  | @ -1254,9 +1258,9 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 	for (i=1; i<size-32; i++) { | 	for (i=1; i<size-32; i++) { | ||||||
| 		for (j=0; j<ARRAYSIZE(patch_str_org); j++) { | 		for (j=0; j<ARRAYSIZE(patch_str_org); j++) { | ||||||
| 			if (safe_strnicmp(&buffer[i], patch_str_org[j], strlen(patch_str_org[j])-1) == 0) { | 			if (safe_strnicmp(&buffer[i], patch_str_org[j], strlen(patch_str_org[j])-1) == 0) { | ||||||
| 				uprintf("  0x%08X: '%s' -> '%s'\n", i, &buffer[i], patch_str_rep[j]); | 				uprintf("  0x%08X: '%s' -> '%s'\n", i, &buffer[i], patch_str_rep[index][j]); | ||||||
| 				strcpy(&buffer[i], patch_str_rep[j]); | 				strcpy(&buffer[i], patch_str_rep[index][j]); | ||||||
| 				i += (DWORD)max(strlen(patch_str_org[j]), strlen(patch_str_rep[j]));	// in case org is a substring of rep
 | 				i += (DWORD)max(strlen(patch_str_org[j]), strlen(patch_str_rep[index][j]));	// in case org is a substring of rep
 | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | @ -1270,13 +1274,13 @@ static BOOL SetupWinPE(char drive_letter) | ||||||
| 				buffer[i+6] = 0x30 + ComboBox_GetCurSel(hDiskID); | 				buffer[i+6] = 0x30 + ComboBox_GetCurSel(hDiskID); | ||||||
| 				uprintf("  0x%08X: '%s' -> 'rdisk(%c)'\n", i, rdisk_zero, buffer[i+6]); | 				uprintf("  0x%08X: '%s' -> 'rdisk(%c)'\n", i, rdisk_zero, buffer[i+6]); | ||||||
| 			} | 			} | ||||||
| 			// $WIN_NT$_~BT -> i386
 | 			// $WIN_NT$_~BT -> i386/amd64
 | ||||||
| 			if (safe_strnicmp(&buffer[i], win_nt_bt_org, strlen(win_nt_bt_org)-1) == 0) { | 			if (safe_strnicmp(&buffer[i], win_nt_bt_org, strlen(win_nt_bt_org)-1) == 0) { | ||||||
| 				uprintf("  0x%08X: '%s' -> '%s%s'\n", i, &buffer[i], win_nt_bt_rep, &buffer[i+strlen(win_nt_bt_org)]); | 				uprintf("  0x%08X: '%s' -> '%s%s'\n", i, &buffer[i], basedir[index], &buffer[i+strlen(win_nt_bt_org)]); | ||||||
| 				strcpy(&buffer[i], win_nt_bt_rep); | 				strcpy(&buffer[i], basedir[index]); | ||||||
| 				// This ensures that we keep the terminator backslash
 | 				// This ensures that we keep the terminator backslash
 | ||||||
| 				buffer[i+strlen(win_nt_bt_rep)] = buffer[i+strlen(win_nt_bt_org)]; | 				buffer[i+strlen(basedir[index])] = buffer[i+strlen(win_nt_bt_org)]; | ||||||
| 				buffer[i+strlen(win_nt_bt_rep)+1] = 0; | 				buffer[i+strlen(basedir[index])+1] = 0; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/iso.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/iso.c
									
										
									
									
									
								
							|  | @ -84,7 +84,7 @@ static const char* grub_dirname = "/boot/grub/i386-pc"; | ||||||
| static const char* grub_cfg = "grub.cfg"; | static const char* grub_cfg = "grub.cfg"; | ||||||
| static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf" }; | static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf" }; | ||||||
| static const char* isolinux_bin[] = { "isolinux.bin", "boot.bin" }; | static const char* isolinux_bin[] = { "isolinux.bin", "boot.bin" }; | ||||||
| static const char* pe_dirname[] = { "/i386", "/minint" }; | static const char* pe_dirname[] = { "/i386", "/amd64", "/minint" }; | ||||||
| static const char* pe_file[] = { "ntdetect.com", "setupldr.bin", "txtsetup.sif" }; | static const char* pe_file[] = { "ntdetect.com", "setupldr.bin", "txtsetup.sif" }; | ||||||
| static const char* reactos_name = "setupldr.sys"; // TODO: freeldr.sys doesn't seem to work
 | static const char* reactos_name = "setupldr.sys"; // TODO: freeldr.sys doesn't seem to work
 | ||||||
| static const char* kolibri_name = "kolibri.img"; | static const char* kolibri_name = "kolibri.img"; | ||||||
|  | @ -222,12 +222,12 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const | ||||||
| 					static_sprintf(img_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", "/amd64" or "/minint"
 | ||||||
| 		for (i=0; i<ARRAYSIZE(pe_dirname); i++) | 		for (i=0; i<ARRAYSIZE(pe_dirname); i++) | ||||||
| 			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) | ||||||
| 						img_report.winpe |= (1<<i)<<(ARRAYSIZE(pe_dirname)*j); | 						img_report.winpe |= (1<<j)<<(ARRAYSIZE(pe_dirname)*i); | ||||||
| 
 | 
 | ||||||
| 		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
 | ||||||
|  | @ -664,7 +664,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) | ||||||
| 	udf_dirent_t* p_udf_root; | 	udf_dirent_t* p_udf_root; | ||||||
| 	char *tmp, *buf, *ext; | 	char *tmp, *buf, *ext; | ||||||
| 	char path[MAX_PATH], path2[16]; | 	char path[MAX_PATH], path2[16]; | ||||||
| 	const char* basedir[] = { "i386", "minint" }; | 	const char* basedir[] = { "i386", "amd64", "minint" }; | ||||||
| 	const char* tmp_sif = ".\\txtsetup.sif~"; | 	const char* tmp_sif = ".\\txtsetup.sif~"; | ||||||
| 	iso_extension_mask_t iso_extension_mask = ISO_EXTENSION_ALL; | 	iso_extension_mask_t iso_extension_mask = ISO_EXTENSION_ALL; | ||||||
| 	char* spacing = "  "; | 	char* spacing = "  "; | ||||||
|  | @ -859,7 +859,7 @@ out: | ||||||
| 			// 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
 | ||||||
| 			static_sprintf(path, "/%s/txtsetup.sif", | 			static_sprintf(path, "/%s/txtsetup.sif", | ||||||
| 				basedir[((img_report.winpe&WINPE_I386) == WINPE_I386)?0:1]); | 				basedir[((img_report.winpe&WINPE_I386) == WINPE_I386)?0:((img_report.winpe&WINPE_AMD64) == WINPE_AMD64?1:2)]); | ||||||
| 			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) { | ||||||
|  |  | ||||||
|  | @ -254,8 +254,9 @@ enum checksum_type { | ||||||
| #define OLD_C32_THRESHOLD   { 53500, 148000 } | #define OLD_C32_THRESHOLD   { 53500, 148000 } | ||||||
| 
 | 
 | ||||||
| /* ISO details that the application may want */ | /* ISO details that the application may want */ | ||||||
| #define WINPE_MININT        0x2A | #define WINPE_I386          0x0007 | ||||||
| #define WINPE_I386          0x15 | #define WINPE_AMD64         0x0023 | ||||||
|  | #define WINPE_MININT        0x01C0 | ||||||
| #define MAX_WIM_VERSION     0x000E0000 | #define MAX_WIM_VERSION     0x000E0000 | ||||||
| #define HAS_KOLIBRIOS(r)    (r.has_kolibrios) | #define HAS_KOLIBRIOS(r)    (r.has_kolibrios) | ||||||
| #define HAS_REACTOS(r)      (r.reactos_path[0] != 0) | #define HAS_REACTOS(r)      (r.reactos_path[0] != 0) | ||||||
|  | @ -263,7 +264,7 @@ enum checksum_type { | ||||||
| #define HAS_SYSLINUX(r)     (r.sl_version != 0) | #define HAS_SYSLINUX(r)     (r.sl_version != 0) | ||||||
| #define HAS_BOOTMGR(r)      (r.has_bootmgr) | #define HAS_BOOTMGR(r)      (r.has_bootmgr) | ||||||
| #define HAS_INSTALL_WIM(r)  (r.install_wim_path[0] != 0) | #define HAS_INSTALL_WIM(r)  (r.install_wim_path[0] != 0) | ||||||
| #define HAS_WINPE(r)        (((r.winpe & WINPE_MININT) == WINPE_MININT)||((r.winpe & WINPE_I386) == WINPE_I386)) | #define HAS_WINPE(r)        (((r.winpe & WINPE_I386) == WINPE_I386)||((r.winpe & WINPE_AMD64) == WINPE_AMD64)||((r.winpe & WINPE_MININT) == WINPE_MININT)) | ||||||
| #define HAS_WINDOWS(r)      (HAS_BOOTMGR(r) || (r.uses_minint) || HAS_WINPE(r)) | #define HAS_WINDOWS(r)      (HAS_BOOTMGR(r) || (r.uses_minint) || HAS_WINPE(r)) | ||||||
| #define HAS_WIN7_EFI(r)     ((r.has_efi == 1) && HAS_INSTALL_WIM(r)) | #define HAS_WIN7_EFI(r)     ((r.has_efi == 1) && HAS_INSTALL_WIM(r)) | ||||||
| #define HAS_EFI_IMG(r)      (r.efi_img_path[0] != 0) | #define HAS_EFI_IMG(r)      (r.efi_img_path[0] != 0) | ||||||
|  | @ -286,7 +287,7 @@ typedef struct { | ||||||
| 	uint32_t install_wim_version; | 	uint32_t install_wim_version; | ||||||
| 	BOOLEAN is_iso; | 	BOOLEAN is_iso; | ||||||
| 	BOOLEAN is_bootable_img; | 	BOOLEAN is_bootable_img; | ||||||
| 	uint8_t winpe; | 	uint16_t winpe; | ||||||
| 	uint8_t has_efi; | 	uint8_t has_efi; | ||||||
| 	BOOLEAN has_4GB_file; | 	BOOLEAN has_4GB_file; | ||||||
| 	BOOLEAN has_long_filename; | 	BOOLEAN has_long_filename; | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 3.1.1321" | CAPTION "Rufus 3.1.1322" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -389,8 +389,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,1,1321,0 |  FILEVERSION 3,1,1322,0 | ||||||
|  PRODUCTVERSION 3,1,1321,0 |  PRODUCTVERSION 3,1,1322,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -407,13 +407,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", "3.1.1321" |             VALUE "FileVersion", "3.1.1322" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2018 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", "3.1.1321" |             VALUE "ProductVersion", "3.1.1322" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue