mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] add uncompressed DD image support
* Also fix an issue with hotplug due to WM_DEVICECHANGE being filtered out * Also improve AnalyzeMBR() and prevent failure on WriteMBR * Also fix a couple issues with ISO and Syslinux handling * Also remove "smart" uncheck of disabled checkboxes - not worth it
This commit is contained in:
		
							parent
							
								
									1e216cddb1
								
							
						
					
					
						commit
						89a7a3deb1
					
				
					 12 changed files with 335 additions and 193 deletions
				
			
		|  | @ -1,3 +1,12 @@ | ||||||
|  | o Version 1.4.4 (2013.02.??) | ||||||
|  |     Add *uncompressed* DD Image support (FreeBSD, FreeNAS, etc.) | ||||||
|  |     Add right-to-left language support | ||||||
|  |     Add NTFS Compression support (unofficial) | ||||||
|  |     Improve Syslinux v5+ support (requires an internet connection) | ||||||
|  |     Improve hotplug detection | ||||||
|  |     Fix detection for Toshiba drives (again) | ||||||
|  |     Fix support for latest gparted, ArchLinux, and other Syslinux v5+ based ISOs  | ||||||
|  | 
 | ||||||
| o Version 1.4.3 (2013.01.21) [BUGFIX RELEASE] | o Version 1.4.3 (2013.01.21) [BUGFIX RELEASE] | ||||||
|     Fix format operation not starting on Windows XP (reported by ank91) |     Fix format operation not starting on Windows XP (reported by ank91) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,13 @@ content. PLEASE, do not just look at this Changelog when updating your | ||||||
| translation, but always use the English section of rufus.loc as your base. | translation, but always use the English section of rufus.loc as your base. | ||||||
| For instance, MSG_114, that was introduced in v1.0.8 is MORE than one line! | For instance, MSG_114, that was introduced in v1.0.8 is MORE than one line! | ||||||
| 
 | 
 | ||||||
|  | o Version 1.0.10 (2014.02.09) | ||||||
|  |   - *NEW* MSG_095 "DD Image" | ||||||
|  |   - *NEW* MSG_261 "Writing image: %0.1f%% completed" | ||||||
|  |   - *NEW* MSG_187 "Invalid image for selected boot option" | ||||||
|  |   - *NEW* MSG_188 "The current image doesn't match the boot option selected..." (see rufus.loc for full text) | ||||||
|  |   - Changed MSG_088 "ISO too big" -> "Image is too big" | ||||||
|  |   - Changed MSG_089 "This ISO image is too big for the selected target." -> "The image is too big for the selected target." | ||||||
| 
 | 
 | ||||||
| o Version 1.0.9 (2014.01.31) | o Version 1.0.9 (2014.01.31) | ||||||
|   - *NEW* MSG_260 "NTFS compression" |   - *NEW* MSG_260 "NTFS compression" | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ | ||||||
| # http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-LCID%5D.pdf | # http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-LCID%5D.pdf | ||||||
| # for the LCID (0x####) codes you should use | # for the LCID (0x####) codes you should use | ||||||
| l "en-US" "English (English)" 0x0409, 0x0809, 0x0c09, 0x1009, 0x1409, 0x1809, 0x1c09, 0x2009, 0x2409, 0x2809, 0x2c09, 0x3009, 0x3409, 0x3809, 0x3c09, 0x4009, 0x4409, 0x4809 | l "en-US" "English (English)" 0x0409, 0x0809, 0x0c09, 0x1009, 0x1409, 0x1809, 0x1c09, 0x2009, 0x2409, 0x2809, 0x2c09, 0x3009, 0x3409, 0x3809, 0x3c09, 0x4009, 0x4409, 0x4809 | ||||||
| v 1.0.9 | v 1.0.10 | ||||||
| 
 | 
 | ||||||
| # Main dialog | # Main dialog | ||||||
| g IDD_DIALOG | g IDD_DIALOG | ||||||
|  | @ -248,8 +248,8 @@ t MSG_086 "No ISO image selected" | ||||||
| # the beginning of the IDC_BOOT text | # the beginning of the IDC_BOOT text | ||||||
| t MSG_087 "Please click on the disc button to select a bootable ISO, " | t MSG_087 "Please click on the disc button to select a bootable ISO, " | ||||||
| 	"or uncheck the \"Create a bootable disk...\" checkbox." | 	"or uncheck the \"Create a bootable disk...\" checkbox." | ||||||
| t MSG_088 "ISO too big" | t MSG_088 "Image is too big" | ||||||
| t MSG_089 "This ISO image is too big for the selected target." | t MSG_089 "The image is too big for the selected target." | ||||||
| t MSG_090 "Unsupported ISO" | t MSG_090 "Unsupported ISO" | ||||||
| t MSG_091 "When using UEFI Target Type, only EFI bootable ISO images are supported. " | t MSG_091 "When using UEFI Target Type, only EFI bootable ISO images are supported. " | ||||||
| 	"Please select an EFI bootable ISO or set the Target Type to BIOS." | 	"Please select an EFI bootable ISO or set the Target Type to BIOS." | ||||||
|  | @ -258,6 +258,7 @@ t MSG_093 "IMPORTANT: THIS DRIVE CONTAINS MULTIPLE PARTITIONS!!\n\n" | ||||||
| 	"This may include partitions/volumes that aren't listed or even visible from Windows. " | 	"This may include partitions/volumes that aren't listed or even visible from Windows. " | ||||||
| 	"Should you wish to proceed, you are responsible for any data loss on these partitions." | 	"Should you wish to proceed, you are responsible for any data loss on these partitions." | ||||||
| t MSG_094 "Multiple partitions detected" | t MSG_094 "Multiple partitions detected" | ||||||
|  | t MSG_095 "DD Image" | ||||||
| t MSG_096 "Only FAT/FAT32 is supported for this type of ISO. Please select FAT/FAT32 as the File system." | t MSG_096 "Only FAT/FAT32 is supported for this type of ISO. Please select FAT/FAT32 as the File system." | ||||||
| t MSG_097 "Only 'bootmgr' or 'WinPE' based ISO images can currently be used with NTFS." | t MSG_097 "Only 'bootmgr' or 'WinPE' based ISO images can currently be used with NTFS." | ||||||
| t MSG_098 "FAT/FAT32 can only be used for isolinux based ISO images or when the Target Type is UEFI." | t MSG_098 "FAT/FAT32 can only be used for isolinux based ISO images or when the Target Type is UEFI." | ||||||
|  | @ -349,6 +350,8 @@ t MSG_184 "For the purpose of generating private usage statistics, we may keep t | ||||||
| t MSG_185 "Update Process:" | t MSG_185 "Update Process:" | ||||||
| t MSG_186 "Rufus does not install or run background services, therefore update checks are performed only when the main application is running.\\line\n" | t MSG_186 "Rufus does not install or run background services, therefore update checks are performed only when the main application is running.\\line\n" | ||||||
| 	"Internet access is of course required when checking for updates." | 	"Internet access is of course required when checking for updates." | ||||||
|  | t MSG_187 "Invalid image for selected boot option" | ||||||
|  | t MSG_188 "The current image doesn't match the boot option selected. Please use a different image or choose a different boot option." | ||||||
| 
 | 
 | ||||||
| # Status messages - these messages will appear on the status bar | # Status messages - these messages will appear on the status bar | ||||||
| t MSG_201 "Cancelling - Please wait..." | t MSG_201 "Cancelling - Please wait..." | ||||||
|  | @ -428,6 +431,7 @@ t MSG_257 "Joliet support" | ||||||
| t MSG_258 "Rock Ridge support" | t MSG_258 "Rock Ridge support" | ||||||
| t MSG_259 "Force update" | t MSG_259 "Force update" | ||||||
| t MSG_260 "NTFS compression" | t MSG_260 "NTFS compression" | ||||||
|  | t MSG_261 "Writing image: %0.1f%% completed" | ||||||
| ################################################################################ | ################################################################################ | ||||||
| ############################# TRANSLATOR END COPY ############################## | ############################# TRANSLATOR END COPY ############################## | ||||||
| ################################################################################ | ################################################################################ | ||||||
|  | @ -1574,7 +1578,7 @@ t MSG_259 "Forceer update" | ||||||
| 
 | 
 | ||||||
| ################################################################################ | ################################################################################ | ||||||
| l "fr-FR" "French (Français)" 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c | l "fr-FR" "French (Français)" 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c | ||||||
| v 1.0.9 | v 1.0.10 | ||||||
| b "en-US" | b "en-US" | ||||||
| 
 | 
 | ||||||
| g IDD_DIALOG | g IDD_DIALOG | ||||||
|  | @ -1629,9 +1633,9 @@ t IDD_UPDATE_POLICY "Paramètres de mises à jour" | ||||||
| s IDC_POLICY +30,0 | s IDC_POLICY +30,0 | ||||||
| t IDS_UPDATE_SETTINGS_GRP "Options" | t IDS_UPDATE_SETTINGS_GRP "Options" | ||||||
| s IDS_UPDATE_SETTINGS_GRP +20,0 | s IDS_UPDATE_SETTINGS_GRP +20,0 | ||||||
| t IDS_UPDATE_FREQUENCY_TXT "Recherche mises à jour:" | t IDS_UPDATE_FREQUENCY_TXT "Recherche mises à jour" | ||||||
| s IDS_UPDATE_FREQUENCY_TXT -3,0 | s IDS_UPDATE_FREQUENCY_TXT -3,0 | ||||||
| t IDS_INCLUDE_BETAS_TXT "Inclure les bétas:" | t IDS_INCLUDE_BETAS_TXT "Inclure les bétas" | ||||||
| m IDC_UPDATE_FREQUENCY -3,0 | m IDC_UPDATE_FREQUENCY -3,0 | ||||||
| m IDC_INCLUDE_BETAS -3,0 | m IDC_INCLUDE_BETAS -3,0 | ||||||
| s IDC_UPDATE_FREQUENCY +25,0 | s IDC_UPDATE_FREQUENCY +25,0 | ||||||
|  | @ -1765,8 +1769,8 @@ t MSG_085 "Téléchargement de %s" | ||||||
| t MSG_086 "Aucune image ISO sélectionnée" | t MSG_086 "Aucune image ISO sélectionnée" | ||||||
| t MSG_087 "Veuillez cliquer sur le bouton avec un disque pour choisir une image ISO démarrable " | t MSG_087 "Veuillez cliquer sur le bouton avec un disque pour choisir une image ISO démarrable " | ||||||
| 	"ou décochez l'option \"Disque de démarrage...\"." | 	"ou décochez l'option \"Disque de démarrage...\"." | ||||||
| t MSG_088 "Image ISO trop large" | t MSG_088 "Image trop large" | ||||||
| t MSG_089 "Cette ISO image est trop large pour le périphérique sélectionné." | t MSG_089 "L'image est trop large pour être copiée sur le périphérique sélectionné." | ||||||
| t MSG_090 "Image ISO on supportée" | t MSG_090 "Image ISO on supportée" | ||||||
| t MSG_091 "Quand UEFI est sélectionné, seules les images ISO basées sur EFI sont supportées. " | t MSG_091 "Quand UEFI est sélectionné, seules les images ISO basées sur EFI sont supportées. " | ||||||
| 	"Veuillez sélectionner une image ISO démarrable avec EFI ou sélectionner BIOS pour le système de destination." | 	"Veuillez sélectionner une image ISO démarrable avec EFI ou sélectionner BIOS pour le système de destination." | ||||||
|  | @ -1775,6 +1779,7 @@ t MSG_093 "IMPORTANT: CE PÉRIPHÉRIQUE CONTIENT PLUSIEURS PARTITIONS !!\n\n" | ||||||
| 	"Ceci peut inclure des partitions/volumes qui ne sont pas listées ou bien visibles depuis Windows. Si vous décidez " | 	"Ceci peut inclure des partitions/volumes qui ne sont pas listées ou bien visibles depuis Windows. Si vous décidez " | ||||||
| 	"de continuer, vous êtes responsable de toute perte de données intervenant sur ces partitions." | 	"de continuer, vous êtes responsable de toute perte de données intervenant sur ces partitions." | ||||||
| t MSG_094 "Partitions multiples détectées" | t MSG_094 "Partitions multiples détectées" | ||||||
|  | t MSG_095 "Image DD" | ||||||
| t MSG_096 "Seul FAT/FAT32 est supporté avec ce type d'image ISO. Veuillez sélectionner FAT/FAT32 pour le système de fichiers." | t MSG_096 "Seul FAT/FAT32 est supporté avec ce type d'image ISO. Veuillez sélectionner FAT/FAT32 pour le système de fichiers." | ||||||
| t MSG_097 "Seules les images ISO utilisant 'bootmgr' ou 'WinPE' peuvent être utilisées avec NTFS." | t MSG_097 "Seules les images ISO utilisant 'bootmgr' ou 'WinPE' peuvent être utilisées avec NTFS." | ||||||
| t MSG_098 "FAT/FAT32 peut seulement être utilisé pour les images ISO utilisant 'isolinux' ou lorsque que le système de destination est UEFI." | t MSG_098 "FAT/FAT32 peut seulement être utilisé pour les images ISO utilisant 'isolinux' ou lorsque que le système de destination est UEFI." | ||||||
|  | @ -1864,6 +1869,8 @@ t MSG_185 "Processus de mise à jour:" | ||||||
| t MSG_186 "Aucun service ou tâche de fond n'est installé ou lancé par Rufus ; la vérification " | t MSG_186 "Aucun service ou tâche de fond n'est installé ou lancé par Rufus ; la vérification " | ||||||
| 	"de mises à jour intervient seulement lorsque l’application principale s'exécute.\\line\n" | 	"de mises à jour intervient seulement lorsque l’application principale s'exécute.\\line\n" | ||||||
| 	"Bien entendu, un accès à internet est requis pour vérifier les mises à jour." | 	"Bien entendu, un accès à internet est requis pour vérifier les mises à jour." | ||||||
|  | t MSG_187 "Image invalide pour l'option de démarrage sélectionnée" | ||||||
|  | t MSG_188 "L'image choisie ne correspond pas à l'option de démarrage sélectionnée. Veuillez utiliser une image ou une option de démarrage différente." | ||||||
| 
 | 
 | ||||||
| # Status messages | # Status messages | ||||||
| t MSG_201 "Annulation - Veuillez patienter..." | t MSG_201 "Annulation - Veuillez patienter..." | ||||||
|  | @ -1882,9 +1889,9 @@ t MSG_213 "Lancement de la nouvelle application..." | ||||||
| t MSG_214 "Echec de lancement de l'application" | t MSG_214 "Echec de lancement de l'application" | ||||||
| t MSG_215 "%s ouvert" | t MSG_215 "%s ouvert" | ||||||
| t MSG_216 "%s sauvegardé" | t MSG_216 "%s sauvegardé" | ||||||
| t MSG_217 "Formatage: %0.1f%% complet" | t MSG_217 "Formatage : %0.1f%% complété" | ||||||
| t MSG_218 "Système de fichiers: Tâche %d/%d complète" | t MSG_218 "Système de fichiers : Tâche %d/%d complétée" | ||||||
| t MSG_219 "Finalisation NTFS: %d%% complète" | t MSG_219 "Finalisation NTFS: %d%% complété" | ||||||
| t MSG_220 "Formatage (%s) - durée estimée %d :%02d..." | t MSG_220 "Formatage (%s) - durée estimée %d :%02d..." | ||||||
| t MSG_221 "Ecriture du label (peut prendre du temps)..." | t MSG_221 "Ecriture du label (peut prendre du temps)..." | ||||||
| t MSG_222 "Formatage (%s)..." | t MSG_222 "Formatage (%s)..." | ||||||
|  | @ -1919,13 +1926,14 @@ t MSG_250 "%s activé" | ||||||
| t MSG_251 "%s désactivé" | t MSG_251 "%s désactivé" | ||||||
| t MSG_252 "Tests de dépassement de taille" | t MSG_252 "Tests de dépassement de taille" | ||||||
| t MSG_253 "Détection de disques fixes" | t MSG_253 "Détection de disques fixes" | ||||||
| t MSG_254 "Force 'large FAT32'" | t MSG_254 "Force large FAT32'" | ||||||
| t MSG_255 "NoDriveTypeAutorun sera effacé en sortie" | t MSG_255 "NoDriveTypeAutorun sera effacé en sortie" | ||||||
| t MSG_256 "Test de contrefaçons" | t MSG_256 "Test de contrefaçons" | ||||||
| t MSG_257 "Support Joliet" | t MSG_257 "Support Joliet" | ||||||
| t MSG_258 "Support Rock Ridge" | t MSG_258 "Support Rock Ridge" | ||||||
| t MSG_259 "Forçage de mise à jour" | t MSG_259 "Forçage de mise à jour" | ||||||
| t MSG_260 "Compression NTFS" | t MSG_260 "Compression NTFS" | ||||||
|  | t MSG_261 "Ecriture d'image : %0.1f%% complété" | ||||||
| 
 | 
 | ||||||
| ################################################################################ | ################################################################################ | ||||||
| l "de-DE" "German (Deutsch)" 0x0407, 0x0807, 0x0c07, 0x1007, 0x1407 | l "de-DE" "German (Deutsch)" 0x0407, 0x0807, 0x0c07, 0x1007, 0x1407 | ||||||
|  |  | ||||||
							
								
								
									
										53
									
								
								src/drive.c
									
										
									
									
									
								
							
							
						
						
									
										53
									
								
								src/drive.c
									
										
									
									
									
								
							|  | @ -476,42 +476,41 @@ BOOL IsMediaPresent(DWORD DriveIndex) | ||||||
| 	return r; | 	return r; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: use an (fn,str) table and simplify this whole thing
 | const struct {int (*fn)(FILE *fp); char* str; BOOL bootable;} known_mbr[] = { | ||||||
| BOOL AnalyzeMBR(HANDLE hPhysicalDrive) | 	{ is_dos_mbr, "DOS/NT/95A", TRUE }, | ||||||
|  | 	{ is_dos_f2_mbr, "DOS/NT/95A (F2)", TRUE }, | ||||||
|  | 	{ is_95b_mbr, "Windows 95B/98/98SE/ME", TRUE }, | ||||||
|  | 	{ is_2000_mbr, "Windows 2000/XP/2003", TRUE }, | ||||||
|  | 	{ is_vista_mbr, "Windows Vista", TRUE }, | ||||||
|  | 	{ is_win7_mbr, "Windows 7", TRUE }, | ||||||
|  | 	{ is_rufus_mbr, "Rufus", TRUE }, | ||||||
|  | 	{ is_syslinux_mbr, "Syslinux", TRUE }, | ||||||
|  | 	{ is_reactos_mbr, "Reactos", TRUE }, | ||||||
|  | 	{ is_zero_mbr, "Zeroed", FALSE }, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | // Returns TRUE if the drive seems bootable, FALSE otherwise
 | ||||||
|  | BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName) | ||||||
| { | { | ||||||
|  | 	const char* mbr_name = "Master Boot Record"; | ||||||
| 	FILE fake_fd = { 0 }; | 	FILE fake_fd = { 0 }; | ||||||
|  | 	int i; | ||||||
| 
 | 
 | ||||||
| 	fake_fd._ptr = (char*)hPhysicalDrive; | 	fake_fd._ptr = (char*)hPhysicalDrive; | ||||||
| 	fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector; | 	fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector; | ||||||
| 
 | 
 | ||||||
| 	if (!is_br(&fake_fd)) { | 	if (!is_br(&fake_fd)) { | ||||||
| 		uprintf("Drive does not have an x86 master boot record\n"); | 		uprintf("%s does not have an x86 %s\n", TargetName, mbr_name); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	} | 	} | ||||||
| 	if (is_dos_mbr(&fake_fd)) { | 	for (i=0; i<ARRAYSIZE(known_mbr); i++) { | ||||||
| 		uprintf("Drive has a DOS/NT/95A master boot record\n"); | 		if (known_mbr[i].fn(&fake_fd)) { | ||||||
| 	} else if (is_dos_f2_mbr(&fake_fd)) { | 			uprintf("%s has a %s %s\n", TargetName, known_mbr[i].str, mbr_name); | ||||||
| 		uprintf("Drive has a DOS/NT/95A master boot record " | 			return known_mbr[i].bootable; | ||||||
| 			"with the undocumented F2 instruction\n"); |  | ||||||
| 	} else if (is_95b_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a Windows 95B/98/98SE/ME master boot record\n"); |  | ||||||
| 	} else if (is_2000_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a Windows 2000/XP/2003 master boot record\n"); |  | ||||||
| 	} else if (is_vista_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a Windows Vista master boot record\n"); |  | ||||||
| 	} else if (is_win7_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a Windows 7 master boot record\n"); |  | ||||||
| 	} else if (is_rufus_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a Rufus master boot record\n"); |  | ||||||
| 	} else if (is_syslinux_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a Syslinux master boot record\n"); |  | ||||||
| 	} else if (is_reactos_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a ReactOS master boot record\n"); |  | ||||||
| 	} else if (is_zero_mbr(&fake_fd)) { |  | ||||||
| 		uprintf("Drive has a zeroed master boot record\n"); |  | ||||||
| 	} else { |  | ||||||
| 		uprintf("Drive has an unknown master boot record\n"); |  | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	uprintf("%s has an unknown %s\n", TargetName, mbr_name); | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -611,7 +610,7 @@ int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSyst | ||||||
| 		uprintf("Partition type: MBR, NB Partitions: %d\n", nb_partitions); | 		uprintf("Partition type: MBR, NB Partitions: %d\n", nb_partitions); | ||||||
| 		SelectedDrive.has_mbr_uefi_marker = (DriveLayout->Mbr.Signature == MBR_UEFI_MARKER); | 		SelectedDrive.has_mbr_uefi_marker = (DriveLayout->Mbr.Signature == MBR_UEFI_MARKER); | ||||||
| 		uprintf("Disk ID: 0x%08X %s\n", DriveLayout->Mbr.Signature, SelectedDrive.has_mbr_uefi_marker?"(UEFI target)":""); | 		uprintf("Disk ID: 0x%08X %s\n", DriveLayout->Mbr.Signature, SelectedDrive.has_mbr_uefi_marker?"(UEFI target)":""); | ||||||
| 		AnalyzeMBR(hPhysical); | 		AnalyzeMBR(hPhysical, "Drive"); | ||||||
| 		for (i=0; i<DriveLayout->PartitionCount; i++) { | 		for (i=0; i<DriveLayout->PartitionCount; i++) { | ||||||
| 			if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) { | 			if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) { | ||||||
| 				uprintf("Partition %d:\n", i+1); | 				uprintf("Partition %d:\n", i+1); | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ char GetUnusedDriveLetter(void); | ||||||
| BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label); | BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label); | ||||||
| uint64_t GetDriveSize(DWORD DriveIndex); | uint64_t GetDriveSize(DWORD DriveIndex); | ||||||
| BOOL IsMediaPresent(DWORD DriveIndex); | BOOL IsMediaPresent(DWORD DriveIndex); | ||||||
| BOOL AnalyzeMBR(HANDLE hPhysicalDrive); | BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName); | ||||||
| BOOL AnalyzePBR(HANDLE hLogicalVolume); | BOOL AnalyzePBR(HANDLE hLogicalVolume); | ||||||
| int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize); | int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize); | ||||||
| BOOL UnmountVolume(HANDLE hDrive); | BOOL UnmountVolume(HANDLE hDrive); | ||||||
|  |  | ||||||
							
								
								
									
										61
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										61
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -827,7 +827,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) | ||||||
| 	FILE fake_fd = { 0 }; | 	FILE fake_fd = { 0 }; | ||||||
| 	const char* using_msg = "Using %s MBR\n"; | 	const char* using_msg = "Using %s MBR\n"; | ||||||
| 
 | 
 | ||||||
| 	if (!AnalyzeMBR(hPhysicalDrive)) return FALSE; | 	AnalyzeMBR(hPhysicalDrive, "Drive"); | ||||||
| 
 | 
 | ||||||
| 	// FormatEx rewrites the MBR and removes the LBA attribute of FAT16
 | 	// FormatEx rewrites the MBR and removes the LBA attribute of FAT16
 | ||||||
| 	// and FAT32 partitions - we need to correct this in the MBR
 | 	// and FAT32 partitions - we need to correct this in the MBR
 | ||||||
|  | @ -1172,21 +1172,26 @@ DWORD WINAPI CloseFormatPromptThread(LPVOID param) { | ||||||
|  *   Close the volume handle. |  *   Close the volume handle. | ||||||
|  */ |  */ | ||||||
| #define CHECK_FOR_USER_CANCEL 	if (IS_ERROR(FormatStatus)) goto out | #define CHECK_FOR_USER_CANCEL 	if (IS_ERROR(FormatStatus)) goto out | ||||||
| DWORD WINAPI FormatThread(LPVOID param) | #define BSIZE 65536	// TODO: dual buffer and overlapped when writing an image
 | ||||||
|  | DWORD WINAPI FormatThread(void* param) | ||||||
| { | { | ||||||
| 	int i, r, pt, bt, fs, dt; | 	int i, r, pt, bt, fs, dt; | ||||||
| 	BOOL ret, use_large_fat32; | 	BOOL s, ret, use_large_fat32; | ||||||
| 	DWORD DriveIndex = (DWORD)(uintptr_t)param; | 	DWORD rSize, wSize, LastRefresh = 0, DriveIndex = (DWORD)(uintptr_t)param; | ||||||
| 	HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE; | 	HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE; | ||||||
| 	HANDLE hLogicalVolume = INVALID_HANDLE_VALUE; | 	HANDLE hLogicalVolume = INVALID_HANDLE_VALUE; | ||||||
|  | 	HANDLE hSourceImage = INVALID_HANDLE_VALUE; | ||||||
| 	SYSTEMTIME lt; | 	SYSTEMTIME lt; | ||||||
|  | 	FILE* log_fd; | ||||||
|  | 	LARGE_INTEGER li; | ||||||
|  | 	uint64_t wb; | ||||||
|  | 	uint8_t buffer[BSIZE]; | ||||||
| 	char *bb_msg, *guid_volume = NULL; | 	char *bb_msg, *guid_volume = NULL; | ||||||
| 	char drive_name[] = "?:\\"; | 	char drive_name[] = "?:\\"; | ||||||
| 	char drive_letters[27]; | 	char drive_letters[27]; | ||||||
| 	char logfile[MAX_PATH], *userdir; | 	char logfile[MAX_PATH], *userdir; | ||||||
| 	char wim_image[] = "?:\\sources\\install.wim"; | 	char wim_image[] = "?:\\sources\\install.wim"; | ||||||
| 	char efi_dst[] = "?:\\efi\\boot\\bootx64.efi"; | 	char efi_dst[] = "?:\\efi\\boot\\bootx64.efi"; | ||||||
| 	FILE* log_fd; |  | ||||||
| 	PF_DECL(GetThreadUILanguage); | 	PF_DECL(GetThreadUILanguage); | ||||||
| 	PF_DECL(SetThreadUILanguage); | 	PF_DECL(SetThreadUILanguage); | ||||||
| 	PF_INIT(GetThreadUILanguage, kernel32); | 	PF_INIT(GetThreadUILanguage, kernel32); | ||||||
|  | @ -1247,7 +1252,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 	CHECK_FOR_USER_CANCEL; | 	CHECK_FOR_USER_CANCEL; | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, MSG_226); | 	PrintStatus(0, TRUE, MSG_226); | ||||||
| 	AnalyzeMBR(hPhysicalDrive); | 	AnalyzeMBR(hPhysicalDrive, "Drive"); | ||||||
| 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | ||||||
| 		AnalyzePBR(hLogicalVolume); | 		AnalyzePBR(hLogicalVolume); | ||||||
| 	} | 	} | ||||||
|  | @ -1316,6 +1321,50 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	// Write an image file
 | ||||||
|  | 	if (dt == DT_IMG) { | ||||||
|  | 		// We poked the MBR, so we need to rewind
 | ||||||
|  | 		li.QuadPart = 0; | ||||||
|  | 		SetFilePointerEx(hPhysicalDrive, li, NULL, FILE_BEGIN); | ||||||
|  | 		hSourceImage = CreateFileU(iso_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); | ||||||
|  | 		if (hSourceImage == INVALID_HANDLE_VALUE) { | ||||||
|  | 			uprintf("Could not open image '%s': %s", iso_path, WindowsErrorString()); | ||||||
|  | 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED; | ||||||
|  | 			goto out; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		uprintf("Writing Image..."); | ||||||
|  | 		for (wb = 0; ; wb += wSize) { | ||||||
|  | 			s = ReadFile(hSourceImage, buffer, BSIZE, &rSize, NULL); | ||||||
|  | 			if (!s) { | ||||||
|  | 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_READ_FAULT; | ||||||
|  | 				uprintf("read error: %s", WindowsErrorString()); | ||||||
|  | 			} | ||||||
|  | 			if (rSize == 0) | ||||||
|  | 				break; | ||||||
|  | 			if (GetTickCount() > LastRefresh + 25) { | ||||||
|  | 				LastRefresh = GetTickCount(); | ||||||
|  | 				format_percent = (100.0f*wb)/(1.0f*iso_report.projected_size); | ||||||
|  | 				PrintStatus(0, FALSE, MSG_261, format_percent); | ||||||
|  | 				UpdateProgress(OP_FORMAT, format_percent); | ||||||
|  | 			} | ||||||
|  | 			CHECK_FOR_USER_CANCEL; | ||||||
|  | 			// TODO: add a retry on write?
 | ||||||
|  | 			s = WriteFile(hPhysicalDrive, buffer, rSize, &wSize, NULL); | ||||||
|  | 			if (!s || wSize != rSize) { | ||||||
|  | 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | ||||||
|  | 				if (s) | ||||||
|  | 					uprintf("write error: Wrote %d bytes, expected %d bytes\n", wSize, rSize); | ||||||
|  | 				else | ||||||
|  | 					uprintf("write error: %s", WindowsErrorString()); | ||||||
|  | 				goto out; | ||||||
|  | 			}	 | ||||||
|  | 		} | ||||||
|  | 		uprintf("Done"); | ||||||
|  | 		goto out; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	// Close the (unmounted) volume before formatting
 | 	// Close the (unmounted) volume before formatting
 | ||||||
| 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | ||||||
| 		PrintStatus(0, TRUE, MSG_227); | 		PrintStatus(0, TRUE, MSG_227); | ||||||
|  |  | ||||||
|  | @ -478,7 +478,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) | ||||||
| 	int j; | 	int j; | ||||||
| 	uint16_t sl_version; | 	uint16_t sl_version; | ||||||
| 	FILE* fd; | 	FILE* fd; | ||||||
| 	BOOL r = FALSE; | 	int r = 1; | ||||||
| 	iso9660_t* p_iso = NULL; | 	iso9660_t* p_iso = NULL; | ||||||
| 	udf_t* p_udf = NULL;  | 	udf_t* p_udf = NULL;  | ||||||
| 	udf_dirent_t* p_udf_root; | 	udf_dirent_t* p_udf_root; | ||||||
|  | @ -557,7 +557,8 @@ try_iso: | ||||||
| 
 | 
 | ||||||
| 	p_iso = iso9660_open_ext(src_iso, iso_extension_mask); | 	p_iso = iso9660_open_ext(src_iso, iso_extension_mask); | ||||||
| 	if (p_iso == NULL) { | 	if (p_iso == NULL) { | ||||||
| 		uprintf("Unable to open image '%s'.\n", src_iso); | 		uprintf("Unable to open '%s' as an ISO image.\n", src_iso); | ||||||
|  | 		r = 1; | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 	uprintf("Disc image is an ISO9660 image\n"); | 	uprintf("Disc image is an ISO9660 image\n"); | ||||||
|  |  | ||||||
|  | @ -359,6 +359,7 @@ const loc_control_id control_id[] = { | ||||||
| 	LOC_CTRL(MSG_258), | 	LOC_CTRL(MSG_258), | ||||||
| 	LOC_CTRL(MSG_259), | 	LOC_CTRL(MSG_259), | ||||||
| 	LOC_CTRL(MSG_260), | 	LOC_CTRL(MSG_260), | ||||||
|  | 	LOC_CTRL(MSG_261), | ||||||
| 	LOC_CTRL(MSG_MAX), | 	LOC_CTRL(MSG_MAX), | ||||||
| 	LOC_CTRL(IDOK), | 	LOC_CTRL(IDOK), | ||||||
| 	LOC_CTRL(IDCANCEL), | 	LOC_CTRL(IDCANCEL), | ||||||
|  |  | ||||||
|  | @ -378,7 +378,8 @@ | ||||||
| #define MSG_258                         3258 | #define MSG_258                         3258 | ||||||
| #define MSG_259                         3259 | #define MSG_259                         3259 | ||||||
| #define MSG_260                         3260 | #define MSG_260                         3260 | ||||||
| #define MSG_MAX                         3261 | #define MSG_261                         3261 | ||||||
|  | #define MSG_MAX                         3262 | ||||||
| 
 | 
 | ||||||
| // Next default values for new objects
 | // Next default values for new objects
 | ||||||
| // 
 | // 
 | ||||||
|  |  | ||||||
							
								
								
									
										227
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										227
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -492,7 +492,7 @@ static void EnableAdvancedBootOptions(BOOL enable) | ||||||
| { | { | ||||||
| 	BOOL actual_enable; | 	BOOL actual_enable; | ||||||
| 	int bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 	int bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
| 	actual_enable = (bt==BT_UEFI)?FALSE:enable; | 	actual_enable = ((bt==BT_UEFI)||(selection_default==DT_IMG))?FALSE:enable; | ||||||
| 
 | 
 | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), actual_enable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), actual_enable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_EXTRA_PARTITION), actual_enable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_EXTRA_PARTITION), actual_enable); | ||||||
|  | @ -503,7 +503,7 @@ static void EnableBootOptions(BOOL enable) | ||||||
| { | { | ||||||
| 	BOOL actual_enable; | 	BOOL actual_enable; | ||||||
| 	int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 	int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 	actual_enable = ((fs != FS_FAT16) && (fs != FS_FAT32) && (fs != FS_NTFS))?FALSE:enable; | 	actual_enable = ((fs != FS_FAT16) && (fs != FS_FAT32) && (fs != FS_NTFS) && (selection_default == DT_IMG))?FALSE:enable; | ||||||
| 
 | 
 | ||||||
| 	EnableWindow(hBoot, actual_enable); | 	EnableWindow(hBoot, actual_enable); | ||||||
| 	EnableWindow(hBootType, actual_enable); | 	EnableWindow(hBootType, actual_enable); | ||||||
|  | @ -896,11 +896,10 @@ static BOOL GetUSBDevices(DWORD devnum) | ||||||
|  */ |  */ | ||||||
| static void InitProgress(void) | static void InitProgress(void) | ||||||
| { | { | ||||||
| 	int i, dt, fs; | 	int i, fs; | ||||||
| 	float last_end = 0.0f, slots_discrete = 0.0f, slots_analog = 0.0f; | 	float last_end = 0.0f, slots_discrete = 0.0f, slots_analog = 0.0f; | ||||||
| 
 | 
 | ||||||
| 	fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 	fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 	dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); |  | ||||||
| 	memset(&nb_slots, 0, sizeof(nb_slots)); | 	memset(&nb_slots, 0, sizeof(nb_slots)); | ||||||
| 	memset(&slot_end, 0, sizeof(slot_end)); | 	memset(&slot_end, 0, sizeof(slot_end)); | ||||||
| 	previous_end = 0.0f; | 	previous_end = 0.0f; | ||||||
|  | @ -910,19 +909,21 @@ static void InitProgress(void) | ||||||
| 	previous_end = 0.0f; | 	previous_end = 0.0f; | ||||||
| 
 | 
 | ||||||
| 	nb_slots[OP_ANALYZE_MBR] = 1; | 	nb_slots[OP_ANALYZE_MBR] = 1; | ||||||
| 	nb_slots[OP_ZERO_MBR] = 1; |  | ||||||
| 	if (IsChecked(IDC_BADBLOCKS)) { | 	if (IsChecked(IDC_BADBLOCKS)) { | ||||||
| 		nb_slots[OP_BADBLOCKS] = -1; | 		nb_slots[OP_BADBLOCKS] = -1; | ||||||
| 	} | 	} | ||||||
| 	if (IsChecked(IDC_BOOT)) { | 	if (IsChecked(IDC_BOOT)) { | ||||||
| 		// 1 extra slot for PBR writing
 | 		// 1 extra slot for PBR writing
 | ||||||
| 		switch (dt) { | 		switch (selection_default) { | ||||||
| 		case DT_WINME: | 		case DT_WINME: | ||||||
| 			nb_slots[OP_DOS] = 3+1; | 			nb_slots[OP_DOS] = 3+1; | ||||||
| 			break; | 			break; | ||||||
| 		case DT_FREEDOS: | 		case DT_FREEDOS: | ||||||
| 			nb_slots[OP_DOS] = 5+1; | 			nb_slots[OP_DOS] = 5+1; | ||||||
| 			break; | 			break; | ||||||
|  | 		case DT_IMG: | ||||||
|  | 			nb_slots[OP_DOS] = 0; | ||||||
|  | 			break; | ||||||
| 		case DT_ISO: | 		case DT_ISO: | ||||||
| 			nb_slots[OP_DOS] = -1; | 			nb_slots[OP_DOS] = -1; | ||||||
| 			break; | 			break; | ||||||
|  | @ -931,6 +932,10 @@ static void InitProgress(void) | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	if (selection_default == DT_IMG) { | ||||||
|  | 		nb_slots[OP_FORMAT] = -1; | ||||||
|  | 	} else { | ||||||
|  | 		nb_slots[OP_ZERO_MBR] = 1; | ||||||
| 		nb_slots[OP_PARTITION] = 1; | 		nb_slots[OP_PARTITION] = 1; | ||||||
| 		nb_slots[OP_FIX_MBR] = 1; | 		nb_slots[OP_FIX_MBR] = 1; | ||||||
| 		nb_slots[OP_CREATE_FS] = | 		nb_slots[OP_CREATE_FS] = | ||||||
|  | @ -939,7 +944,8 @@ static void InitProgress(void) | ||||||
| 		  || ((fs == FS_FAT32) && ((SelectedDrive.DiskSize >= LARGE_FAT32_SIZE) || (force_large_fat32))) ) { | 		  || ((fs == FS_FAT32) && ((SelectedDrive.DiskSize >= LARGE_FAT32_SIZE) || (force_large_fat32))) ) { | ||||||
| 			nb_slots[OP_FORMAT] = -1; | 			nb_slots[OP_FORMAT] = -1; | ||||||
| 		} | 		} | ||||||
| 	nb_slots[OP_FINALIZE] = ((dt == DT_ISO) && (fs == FS_NTFS))?3:2; | 		nb_slots[OP_FINALIZE] = ((selection_default == DT_ISO) && (fs == FS_NTFS))?3:2; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	for (i=0; i<OP_MAX; i++) { | 	for (i=0; i<OP_MAX; i++) { | ||||||
| 		if (nb_slots[i] > 0) { | 		if (nb_slots[i] > 0) { | ||||||
|  | @ -1016,22 +1022,24 @@ void UpdateProgress(int op, float percent) | ||||||
| static void EnableControls(BOOL bEnable) | static void EnableControls(BOOL bEnable) | ||||||
| { | { | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_DEVICE), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_DEVICE), bEnable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_START), bEnable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_ABOUT), bEnable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_BADBLOCKS), bEnable); | ||||||
|  | 	EnableBootOptions(bEnable); | ||||||
|  | 	EnableWindow(hSelectISO, bEnable); | ||||||
|  | 	EnableWindow(hNBPasses, bEnable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_ADVANCED), bEnable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_LANG), bEnable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), bEnable); | ||||||
|  | 	SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable?MSG_006:MSG_007)); | ||||||
|  | 	if (selection_default == DT_IMG) | ||||||
|  | 		return; | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_PARTITION_TYPE), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_PARTITION_TYPE), bEnable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_FILESYSTEM), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_FILESYSTEM), bEnable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_CLUSTERSIZE), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_CLUSTERSIZE), bEnable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_LABEL), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_LABEL), bEnable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), bEnable); | ||||||
| 	EnableBootOptions(bEnable); |  | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_BADBLOCKS), bEnable); |  | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_ABOUT), bEnable); |  | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_START), bEnable); |  | ||||||
| 	EnableWindow(hSelectISO, bEnable); |  | ||||||
| 	EnableWindow(hNBPasses, bEnable); |  | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), bEnable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_ADVANCED), bEnable); |  | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), bEnable); |  | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_LANG), bEnable); |  | ||||||
| 	SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable?MSG_006:MSG_007)); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Callback for the log window */ | /* Callback for the log window */ | ||||||
|  | @ -1111,7 +1119,8 @@ static void CALLBACK ClockTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dw | ||||||
|  */ |  */ | ||||||
| static void CALLBACK RefreshTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) | static void CALLBACK RefreshTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) | ||||||
| { | { | ||||||
| 	SendMessage(hWnd, WM_DEVICECHANGE, DBT_CUSTOMEVENT, 0); | 	// DO NOT USE WM_DEVICECHANGE - IT MAY BE FILTERED OUT BY WINDOWS!
 | ||||||
|  | 	SendMessage(hWnd, UM_MEDIA_CHANGE, 0, 0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -1180,6 +1189,34 @@ BOOL CALLBACK ISOProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | BOOL IsImage(const char* src_img) | ||||||
|  | { | ||||||
|  | 	HANDLE handle = INVALID_HANDLE_VALUE; | ||||||
|  | 	LARGE_INTEGER liImageSize; | ||||||
|  | 
 | ||||||
|  | 	handle = CreateFileU(src_img, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); | ||||||
|  | 	if (handle == INVALID_HANDLE_VALUE) { | ||||||
|  | 		uprintf("Could not open image '%s'", src_img); | ||||||
|  | 		goto out; | ||||||
|  | 	} | ||||||
|  | 	iso_report.is_bootable_img = AnalyzeMBR(handle, "Image"); | ||||||
|  | 
 | ||||||
|  | 	if (!GetFileSizeEx(handle, &liImageSize)) { | ||||||
|  | 		uprintf("Could not get image size: %s", WindowsErrorString()); | ||||||
|  | 		goto out; | ||||||
|  | 	} | ||||||
|  | 	iso_report.projected_size = (uint64_t)liImageSize.QuadPart; | ||||||
|  | 
 | ||||||
|  | 	if (iso_report.is_bootable_img) { | ||||||
|  | 		uprintf("Using bootable disk image: '%s'", src_img); | ||||||
|  | 		selection_default = DT_IMG; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | out: | ||||||
|  | 	safe_closehandle(handle); | ||||||
|  | 	return iso_report.is_bootable_img; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // The scanning process can be blocking for message processing => use a thread
 | // The scanning process can be blocking for message processing => use a thread
 | ||||||
| DWORD WINAPI ISOScanThread(LPVOID param) | DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| { | { | ||||||
|  | @ -1192,7 +1229,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 	PrintStatus(0, TRUE, MSG_202); | 	PrintStatus(0, TRUE, MSG_202); | ||||||
| 	user_notified = FALSE; | 	user_notified = FALSE; | ||||||
| 	EnableControls(FALSE); | 	EnableControls(FALSE); | ||||||
| 	r = ExtractISO(iso_path, "", TRUE); | 	r = ExtractISO(iso_path, "", TRUE) || IsImage(iso_path); | ||||||
| 	EnableControls(TRUE); | 	EnableControls(TRUE); | ||||||
| 	if (!r) { | 	if (!r) { | ||||||
| 		SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0); | 		SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0); | ||||||
|  | @ -1200,6 +1237,8 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 		safe_free(iso_path); | 		safe_free(iso_path); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	if (!iso_report.is_bootable_img) { | ||||||
| 		if (HAS_SYSLINUX(iso_report)) { | 		if (HAS_SYSLINUX(iso_report)) { | ||||||
| 			safe_sprintf(isolinux_str, sizeof(isolinux_str), "Yes (%s)", iso_report.sl_version_str); | 			safe_sprintf(isolinux_str, sizeof(isolinux_str), "Yes (%s)", iso_report.sl_version_str); | ||||||
| 		} | 		} | ||||||
|  | @ -1214,24 +1253,30 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 				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], iso_report.has_old_c32[i]?"Yes":"No"); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 	if ( (!iso_report.has_bootmgr) && (!HAS_SYSLINUX(iso_report)) && (!IS_WINPE(iso_report.winpe))  | 	if ( (!iso_report.has_bootmgr) && (!HAS_SYSLINUX(iso_report)) && (!IS_WINPE(iso_report.winpe))  | ||||||
| 	  && (!iso_report.has_efi) && (!IS_REACTOS(iso_report)) ) { | 		&& (!iso_report.has_efi) && (!IS_REACTOS(iso_report) && (!iso_report.is_bootable_img)) ) { | ||||||
| 		MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); | 		MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); | ||||||
| 		safe_free(iso_path); | 		safe_free(iso_path); | ||||||
| 		SetMBRProps(); | 		SetMBRProps(); | ||||||
| 	} else if (HAS_SYSLINUX(iso_report)) { | 	} 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) { | ||||||
| 			SetTargetSystem(); | 			SetTargetSystem(); | ||||||
| 			SetFSFromISO(); | 			SetFSFromISO(); | ||||||
| 			SetMBRProps(); | 			SetMBRProps(); | ||||||
| 		for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); |  | ||||||
| 		PrintStatus(0, TRUE, MSG_205, &iso_path[i+1]); |  | ||||||
| 			// 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 (iso_report.label[0] != 0) { | ||||||
| 				SetWindowTextU(hLabel, iso_report.label); | 				SetWindowTextU(hLabel, iso_report.label); | ||||||
| 			} | 			} | ||||||
|  | 		} else { | ||||||
|  | 			SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, | ||||||
|  | 				ComboBox_GetCurSel(hFileSystem)); | ||||||
|  | 		} | ||||||
|  | 		for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); | ||||||
|  | 		PrintStatus(0, TRUE, MSG_205, &iso_path[i+1]); | ||||||
| 		// Lose the focus on the select ISO (but place it on Close)
 | 		// Lose the focus on the select ISO (but place it on Close)
 | ||||||
| 		SendMessage(hMainDialog, WM_NEXTDLGCTL,  (WPARAM)FALSE, 0); | 		SendMessage(hMainDialog, WM_NEXTDLGCTL,  (WPARAM)FALSE, 0); | ||||||
| 		// Lose the focus from Close and set it back to Start
 | 		// Lose the focus from Close and set it back to Start
 | ||||||
|  | @ -1312,6 +1357,18 @@ void ToggleAdvanced(void) | ||||||
| 	SendMessage(GetDlgItem(hMainDialog, IDC_ADVANCED), BCM_SETIMAGELIST, 0, (LPARAM)(advanced_mode?&bi_up:&bi_down)); | 	SendMessage(GetDlgItem(hMainDialog, IDC_ADVANCED), BCM_SETIMAGELIST, 0, (LPARAM)(advanced_mode?&bi_up:&bi_down)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // Toggle DD Image mode
 | ||||||
|  | void ToggleImage(BOOL enable) | ||||||
|  | { | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), enable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_PARTITION_TYPE), enable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_FILESYSTEM), enable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_CLUSTERSIZE), enable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_LABEL), enable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), enable); | ||||||
|  | 	EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), enable); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static BOOL BootCheck(void) | static BOOL BootCheck(void) | ||||||
| { | { | ||||||
| 	int i, fs, bt, dt, r; | 	int i, fs, bt, dt, r; | ||||||
|  | @ -1324,7 +1381,7 @@ static BOOL BootCheck(void) | ||||||
| 
 | 
 | ||||||
| 	syslinux_ldlinux_len[0] = 0; syslinux_ldlinux_len[1] = 0; | 	syslinux_ldlinux_len[0] = 0; syslinux_ldlinux_len[1] = 0; | ||||||
| 	dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | 	dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | ||||||
| 	if (dt == DT_ISO) { | 	if ((dt == DT_ISO) || (dt == DT_IMG)) { | ||||||
| 		if (iso_path == NULL) { | 		if (iso_path == NULL) { | ||||||
| 			// Please click on the disc button to select a bootable ISO
 | 			// Please click on the disc button to select a bootable ISO
 | ||||||
| 			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); | ||||||
|  | @ -1335,6 +1392,12 @@ static BOOL BootCheck(void) | ||||||
| 			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 (dt == DT_IMG) { | ||||||
|  | 			if (!iso_report.is_bootable_img) | ||||||
|  | 			// 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); | ||||||
|  | 			return (iso_report.is_bootable_img); | ||||||
|  | 		} | ||||||
| 		fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 		fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 		bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 		bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
| 		if (bt == BT_UEFI) { | 		if (bt == BT_UEFI) { | ||||||
|  | @ -1687,6 +1750,43 @@ void ShowLanguageMenu(HWND hDlg) | ||||||
| 	DestroyMenu(menu); | 	DestroyMenu(menu); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void SetBoot(int fs, int bt) | ||||||
|  | { | ||||||
|  | 	int i; | ||||||
|  | 
 | ||||||
|  | 	IGNORE_RETVAL(ComboBox_ResetContent(hBootType)); | ||||||
|  | 	if ((bt == BT_BIOS) && ((fs == FS_FAT16) || (fs == FS_FAT32))) { | ||||||
|  | 		IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), DT_WINME)); | ||||||
|  | 		IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), DT_FREEDOS)); | ||||||
|  | 	} | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), DT_ISO)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), DT_IMG)); | ||||||
|  | 	// If needed (advanced mode) also append a Syslinux option
 | ||||||
|  | 	if ( (bt == BT_BIOS) && (((fs == FS_FAT16) || (fs == FS_FAT32)) && (advanced_mode)) ) { | ||||||
|  | 		IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "Syslinux 4"), DT_SYSLINUX_V4)); | ||||||
|  | 		IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "Syslinux 5"), DT_SYSLINUX_V5)); | ||||||
|  | 		IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "ReactOS"), DT_REACTOS)); | ||||||
|  | 	} | ||||||
|  | 	if ((!advanced_mode) && (selection_default >= DT_SYSLINUX_V4)) { | ||||||
|  | 		selection_default = DT_FREEDOS; | ||||||
|  | 		CheckDlgButton(hMainDialog, IDC_DISK_ID, BST_UNCHECKED); | ||||||
|  | 	} | ||||||
|  | 	for (i=0; i<ComboBox_GetCount(hBootType); i++) { | ||||||
|  | 		if (ComboBox_GetItemData(hBootType, i) == selection_default) { | ||||||
|  | 			IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, i)); | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	if (i == ComboBox_GetCount(hBootType)) | ||||||
|  | 		IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0)); | ||||||
|  | 
 | ||||||
|  | 	if (!IsWindowEnabled(hBoot)) { | ||||||
|  | 		EnableWindow(hBoot, TRUE); | ||||||
|  | 		EnableWindow(hBootType, TRUE); | ||||||
|  | 		EnableWindow(hSelectISO, TRUE); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Main dialog callback |  * Main dialog callback | ||||||
|  */ |  */ | ||||||
|  | @ -1698,7 +1798,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 	int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices, selected_language; | 	int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices, selected_language; | ||||||
| 	static DWORD DeviceNum = 0, LastRefresh = 0; | 	static DWORD DeviceNum = 0, LastRefresh = 0; | ||||||
| 	char tmp[128]; | 	char tmp[128]; | ||||||
| 	static UINT uBootChecked = BST_CHECKED, uQFChecked; |  | ||||||
| 	static BOOL first_log_display = TRUE, user_changed_label = FALSE; | 	static BOOL first_log_display = TRUE, user_changed_label = FALSE; | ||||||
| 	static ULONG ulRegister = 0; | 	static ULONG ulRegister = 0; | ||||||
| 	static LPITEMIDLIST pidlDesktop = NULL; | 	static LPITEMIDLIST pidlDesktop = NULL; | ||||||
|  | @ -1720,6 +1819,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		// can't really issue a refresh for each one we receive
 | 		// can't really issue a refresh for each one we receive
 | ||||||
| 		// What we do then is arm a timer on DBT_DEVNODES_CHANGED, if it's been more than 1 second
 | 		// What we do then is arm a timer on DBT_DEVNODES_CHANGED, if it's been more than 1 second
 | ||||||
| 		// since last refresh/arm timer, and have that timer send DBT_CUSTOMEVENT when it expires.
 | 		// since last refresh/arm timer, and have that timer send DBT_CUSTOMEVENT when it expires.
 | ||||||
|  | 		// DO *NOT* USE WM_DEVICECHANGE AS THE MESSAGE FROM THE TIMER PROC, as it may be filtered!
 | ||||||
|  | 		// For instance filtering will occur when (un)plugging in a FreeBSD UFD on Windows 8.
 | ||||||
|  | 		// Intead, use a custom user message, such as UM_MEDIA_CHANGE, to set DBT_CUSTOMEVENT.
 | ||||||
| 		if (format_thid == NULL) { | 		if (format_thid == NULL) { | ||||||
| 			switch (wParam) { | 			switch (wParam) { | ||||||
| 			case DBT_DEVICEARRIVAL: | 			case DBT_DEVICEARRIVAL: | ||||||
|  | @ -1731,7 +1833,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				user_changed_label = FALSE; | 				user_changed_label = FALSE; | ||||||
| 				return (INT_PTR)TRUE; | 				return (INT_PTR)TRUE; | ||||||
| 			case DBT_DEVNODES_CHANGED: | 			case DBT_DEVNODES_CHANGED: | ||||||
| 				// TODO: figure out what the deal is with extra events when FILE_SHARE_WRITE is not enabled
 |  | ||||||
| 				// If it's been more than a second since last device refresh, arm a refresh timer
 | 				// If it's been more than a second since last device refresh, arm a refresh timer
 | ||||||
| 				if (GetTickCount() > LastRefresh + 1000) { | 				if (GetTickCount() > LastRefresh + 1000) { | ||||||
| 					LastRefresh = GetTickCount(); | 					LastRefresh = GetTickCount(); | ||||||
|  | @ -1922,20 +2023,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				break; | 				break; | ||||||
| 			fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 			fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 			bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 			bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
|  | 			if (selection_default == DT_IMG) { | ||||||
|  | 				ToggleImage(FALSE); | ||||||
|  | 				EnableAdvancedBootOptions(FALSE); | ||||||
|  | 				SetBoot(fs, bt); | ||||||
|  | 				break; | ||||||
|  | 			} | ||||||
| 			SetClusterSizes(fs); | 			SetClusterSizes(fs); | ||||||
| 			// Disable/restore the quick format control depending on large FAT32
 | 			// Disable/restore the quick format control depending on large FAT32
 | ||||||
| 			if ((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) { | 			EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), | ||||||
| 				if (IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) { | 				!((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)))); | ||||||
| 					uQFChecked = IsDlgButtonChecked(hMainDialog, IDC_QUICKFORMAT); |  | ||||||
| 					CheckDlgButton(hMainDialog, IDC_QUICKFORMAT, BST_CHECKED); |  | ||||||
| 					EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), FALSE); |  | ||||||
| 				} |  | ||||||
| 			} else { |  | ||||||
| 				if (!IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) { |  | ||||||
| 					CheckDlgButton(hMainDialog, IDC_QUICKFORMAT, uQFChecked); |  | ||||||
| 					EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), TRUE); |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 			if (fs < 0) { | 			if (fs < 0) { | ||||||
| 				EnableBootOptions(TRUE); | 				EnableBootOptions(TRUE); | ||||||
| 				SetMBRProps(); | 				SetMBRProps(); | ||||||
|  | @ -1948,61 +2045,26 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 			if ((fs == FS_EXFAT) || (fs == FS_UDF)) { | 			if ((fs == FS_EXFAT) || (fs == FS_UDF)) { | ||||||
| 				if (IsWindowEnabled(hBoot)) { | 				if (IsWindowEnabled(hBoot)) | ||||||
| 					// unlikely to be supported by BIOSes => don't bother
 |  | ||||||
| 					IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0)); |  | ||||||
| 					uBootChecked = IsDlgButtonChecked(hMainDialog, IDC_BOOT); |  | ||||||
| 					CheckDlgButton(hDlg, IDC_BOOT, BST_UNCHECKED); |  | ||||||
| 					EnableBootOptions(FALSE); | 					EnableBootOptions(FALSE); | ||||||
| 				} else if (IsDlgButtonChecked(hMainDialog, IDC_BOOT)) { |  | ||||||
| 					uBootChecked = TRUE; |  | ||||||
| 					CheckDlgButton(hDlg, IDC_BOOT, BST_UNCHECKED); |  | ||||||
| 				} |  | ||||||
| 				SetMBRProps(); | 				SetMBRProps(); | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 			EnableAdvancedBootOptions(TRUE); | 			EnableAdvancedBootOptions(TRUE); | ||||||
| 			IGNORE_RETVAL(ComboBox_ResetContent(hBootType)); | 			SetBoot(fs, bt); | ||||||
| 			if ((bt == BT_BIOS) && ((fs == FS_FAT16) || (fs == FS_FAT32))) { |  | ||||||
| 				IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), DT_WINME)); |  | ||||||
| 				IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), DT_FREEDOS)); |  | ||||||
| 			} |  | ||||||
| 			IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), DT_ISO)); |  | ||||||
| 			// If needed (advanced mode) also append a Syslinux option
 |  | ||||||
| 			if ( (bt == BT_BIOS) && (((fs == FS_FAT16) || (fs == FS_FAT32)) && (advanced_mode)) ) { |  | ||||||
| 				IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "Syslinux 4"), DT_SYSLINUX_V4)); |  | ||||||
| 				IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "Syslinux 5"), DT_SYSLINUX_V5)); |  | ||||||
| 				IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "ReactOS"), DT_REACTOS)); |  | ||||||
| 			} |  | ||||||
| 			if ((!advanced_mode) && (selection_default >= DT_SYSLINUX_V4)) { |  | ||||||
| 				selection_default = DT_FREEDOS; |  | ||||||
| 				CheckDlgButton(hDlg, IDC_DISK_ID, BST_UNCHECKED); |  | ||||||
| 			} |  | ||||||
| 			for (i=0; i<ComboBox_GetCount(hBootType); i++) { |  | ||||||
| 				if (ComboBox_GetItemData(hBootType, i) == selection_default) { |  | ||||||
| 					IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, i)); |  | ||||||
| 					break; |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 			if (i == ComboBox_GetCount(hBootType)) |  | ||||||
| 				IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0)); |  | ||||||
| 			if (!IsWindowEnabled(hBoot)) { |  | ||||||
| 				EnableWindow(hBoot, TRUE); |  | ||||||
| 				EnableWindow(hBootType, TRUE); |  | ||||||
| 				EnableWindow(hSelectISO, TRUE); |  | ||||||
| 				CheckDlgButton(hDlg, IDC_BOOT, uBootChecked); |  | ||||||
| 			} |  | ||||||
| 			SetMBRProps(); | 			SetMBRProps(); | ||||||
| 			break; | 			break; | ||||||
| 		case IDC_BOOTTYPE: | 		case IDC_BOOTTYPE: | ||||||
| 			if (HIWORD(wParam) != CBN_SELCHANGE) | 			if (HIWORD(wParam) != CBN_SELCHANGE) | ||||||
| 				break; | 				break; | ||||||
| 			selection_default = (int) ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | 			selection_default = (int) ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | ||||||
|  | 			ToggleImage(selection_default != DT_IMG); | ||||||
| 			// The Rufus MBR can't apply for Syslinux or ReactOS
 | 			// The Rufus MBR can't apply for Syslinux or ReactOS
 | ||||||
| 			// TODO: we should also disable this for isolinux based ISOs
 | 			// TODO: we should also disable this for isolinux based ISOs
 | ||||||
| 			EnableWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), selection_default < DT_SYSLINUX_V4); | 			EnableWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), selection_default < DT_IMG); | ||||||
| 			EnableWindow(hDiskID, selection_default < DT_SYSLINUX_V4); | 			EnableWindow(GetDlgItem(hMainDialog, IDC_EXTRA_PARTITION), selection_default < DT_IMG); | ||||||
| 			if (selection_default == DT_ISO) { | 			EnableWindow(hDiskID, selection_default < DT_IMG); | ||||||
|  | 			if ((selection_default == DT_ISO) || (selection_default == DT_IMG)) { | ||||||
| 				if ((iso_path == NULL) || (iso_report.label[0] == 0)) { | 				if ((iso_path == NULL) || (iso_report.label[0] == 0)) { | ||||||
| 					// Set focus to the Select ISO button
 | 					// Set focus to the Select ISO button
 | ||||||
| 					SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0); | 					SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0); | ||||||
|  | @ -2024,10 +2086,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			return (INT_PTR)TRUE; | 			return (INT_PTR)TRUE; | ||||||
| 		case IDC_SELECT_ISO: | 		case IDC_SELECT_ISO: | ||||||
| 			if (iso_provided) { | 			if (iso_provided) { | ||||||
| 				uprintf("Commandline ISO image provided: '%s'\n", iso_path); | 				uprintf("Commandline Image provided: '%s'\n", iso_path); | ||||||
| 				iso_provided = FALSE;	// One off thing...
 | 				iso_provided = FALSE;	// One off thing...
 | ||||||
| 			} else { | 			} else { | ||||||
| 				safe_free(iso_path); | 				safe_free(iso_path); | ||||||
|  | 				if (selection_default == DT_IMG) | ||||||
|  | 					iso_path = FileDialog(FALSE, NULL, "*.img", "img", "DD Image"); | ||||||
|  | 				else | ||||||
| 					iso_path = FileDialog(FALSE, NULL, "*.iso", "iso", lmprintf(MSG_036)); | 					iso_path = FileDialog(FALSE, NULL, "*.iso", "iso", lmprintf(MSG_036)); | ||||||
| 				if (iso_path == NULL) { | 				if (iso_path == NULL) { | ||||||
| 					CreateTooltip(hSelectISO, lmprintf(MSG_173), -1); | 					CreateTooltip(hSelectISO, lmprintf(MSG_173), -1); | ||||||
|  |  | ||||||
|  | @ -177,6 +177,7 @@ enum dos_type { | ||||||
| 	DT_WINME = 0, | 	DT_WINME = 0, | ||||||
| 	DT_FREEDOS, | 	DT_FREEDOS, | ||||||
| 	DT_ISO, | 	DT_ISO, | ||||||
|  | 	DT_IMG, | ||||||
| 	DT_SYSLINUX_V4,		// Start of indexes that only display in advanced mode
 | 	DT_SYSLINUX_V4,		// Start of indexes that only display in advanced mode
 | ||||||
| 	DT_SYSLINUX_V5, | 	DT_SYSLINUX_V5, | ||||||
| 	DT_REACTOS, | 	DT_REACTOS, | ||||||
|  | @ -240,6 +241,7 @@ typedef struct { | ||||||
| 	BOOL has_old_c32[NB_OLD_C32]; | 	BOOL has_old_c32[NB_OLD_C32]; | ||||||
| 	BOOL has_old_vesamenu; | 	BOOL has_old_vesamenu; | ||||||
| 	BOOL uses_minint; | 	BOOL uses_minint; | ||||||
|  | 	BOOL is_bootable_img; | ||||||
| 	uint16_t sl_version;	// Syslinux/Isolinux version
 | 	uint16_t sl_version;	// Syslinux/Isolinux version
 | ||||||
| 	char sl_version_str[12]; | 	char sl_version_str[12]; | ||||||
| } RUFUS_ISO_REPORT; | } RUFUS_ISO_REPORT; | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| 
 | 
 | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 206, 329 | IDD_DIALOG DIALOGEX 12, 12, 206, 329 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| CAPTION "Rufus 1.4.4.404" | CAPTION "Rufus 1.4.4.405" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,291,50,14 |     DEFPUSHBUTTON   "Start",IDC_START,94,291,50,14 | ||||||
|  | @ -165,7 +165,7 @@ END | ||||||
| RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 | RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | ||||||
| CAPTION "Rufus 1.4.4.404" | CAPTION "Rufus 1.4.4.405" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,291,50,14 |     DEFPUSHBUTTON   "Start",IDC_START,94,291,50,14 | ||||||
|  | @ -427,8 +427,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 1,4,4,404 |  FILEVERSION 1,4,4,405 | ||||||
|  PRODUCTVERSION 1,4,4,404 |  PRODUCTVERSION 1,4,4,405 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -445,13 +445,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" |             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "1.4.4.404" |             VALUE "FileVersion", "1.4.4.405" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus.exe" |             VALUE "OriginalFilename", "rufus.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "1.4.4.404" |             VALUE "ProductVersion", "1.4.4.405" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue