[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:
Pete Batard 2014-02-09 02:54:07 +00:00
parent 1e216cddb1
commit 89a7a3deb1
12 changed files with 335 additions and 193 deletions

View File

@ -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]
Fix format operation not starting on Windows XP (reported by ank91)

View File

@ -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.
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)
- *NEW* MSG_260 "NTFS compression"

View File

@ -53,7 +53,7 @@
# 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
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
g IDD_DIALOG
@ -248,8 +248,8 @@ t MSG_086 "No ISO image selected"
# the beginning of the IDC_BOOT text
t MSG_087 "Please click on the disc button to select a bootable ISO, "
"or uncheck the \"Create a bootable disk...\" checkbox."
t MSG_088 "ISO too big"
t MSG_089 "This ISO image is too big for the selected target."
t MSG_088 "Image is too big"
t MSG_089 "The image is too big for the selected target."
t MSG_090 "Unsupported ISO"
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."
@ -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. "
"Should you wish to proceed, you are responsible for any data loss on these partitions."
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_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."
@ -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_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."
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
t MSG_201 "Cancelling - Please wait..."
@ -428,6 +431,7 @@ t MSG_257 "Joliet support"
t MSG_258 "Rock Ridge support"
t MSG_259 "Force update"
t MSG_260 "NTFS compression"
t MSG_261 "Writing image: %0.1f%% completed"
################################################################################
############################# 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
v 1.0.9
v 1.0.10
b "en-US"
g IDD_DIALOG
@ -1629,9 +1633,9 @@ t IDD_UPDATE_POLICY "Paramètres de mises à jour"
s IDC_POLICY +30,0
t IDS_UPDATE_SETTINGS_GRP "Options"
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
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_INCLUDE_BETAS -3,0
s IDC_UPDATE_FREQUENCY +25,0
@ -1661,7 +1665,7 @@ t IDC_ISO_ABORT "Annuler"
t MSG_001 "Autre instance détectée"
t MSG_002 "Une autre instance de Rufus est en cours d'exécution.\n"
"Veuillez fermer la première instance avant d'en lancer une seconde."
t MSG_003 "ATTENTION: TOUTES LES DONNEES DU VOLUME '%s' VONT ETRE EFFACEES.\n"
t MSG_003 "ATTENTION : TOUTES LES DONNEES DU VOLUME '%s' VONT ETRE EFFACEES.\n"
"Pour continuer cette opération, cliquez sur OK.\nPour quitter cliquez sur ANNULER."
t MSG_004 "Mises à jour"
t MSG_005 "Voulez-vous autoriser Rufus à chercher des mises à jour en ligne?"
@ -1670,16 +1674,16 @@ t MSG_007 "Annuler"
t MSG_008 "Oui"
t MSG_009 "Non"
t MSG_010 "Blocs défectueux détectés"
t MSG_011 "Vérification complète: %u bloc(s) défectueux détecté(s)\n"
t MSG_011 "Vérification complète : %u bloc(s) défectueux détecté(s)\n"
" %d erreur(s) de lecture\n %d erreur(s) d'écriture\n %d erreur(s) de corruption\n"
t MSG_012 "%s\nUn rapport plus détaillé peut être obtenu à:\n%s"
t MSG_012 "%s\nUn rapport plus détaillé peut être obtenu à :\n%s"
t MSG_013 "Jamais"
t MSG_014 "Quotidienne"
t MSG_015 "Hebdomadaire"
t MSG_016 "Mensuelle"
t MSG_017 "Personnalisée"
t MSG_018 "Votre version: %d.%d.%d (Build %d)"
t MSG_019 "Dernière version: %d.%d.%d (Build %d)"
t MSG_018 "Votre version : %d.%d.%d (Build %d)"
t MSG_019 "Dernière version : %d.%d.%d (Build %d)"
t MSG_020 "octets"
t MSG_021 "Ko"
t MSG_022 "Mo"
@ -1703,7 +1707,7 @@ t MSG_039 "Lancer"
t MSG_040 "Télécharger"
t MSG_041 "Opération annulée par l'utilisateur"
t MSG_042 "Erreur"
t MSG_043 "Erreur: %s"
t MSG_043 "Erreur : %s"
t MSG_044 "Téléchargement de fichier"
t MSG_045 "Pérpih. de stockage USB (Générique)"
t MSG_046 "%s (Disque %d)"
@ -1755,26 +1759,27 @@ t MSG_082 "Cette version de Rufus supporte uniquement les ISOs démarrables à b
t MSG_083 "Remplacer %s?"
t MSG_084 "Cette image ISO utilise une version obsolète du fichier '%s'.\n"
"Les menus de démarrage peuvent de pas fonctionner à cause de cela.\n\n"
"Rufus peut télécharger une nouvelle version du fichier pour résoudre ce problème:\n"
"Rufus peut télécharger une nouvelle version du fichier pour résoudre ce problème :\n"
"- Choisissez 'Oui' pour télécharger le fichier depuis Internet\n"
"- Choisissez 'Non' pour garder le fichier de l'image ISO\n"
"Si vous ne savez pas quoi faire, sélectionnez 'Oui'.\n\n"
"Note: Le nouveau fichier sera téléchargé dans le répertoire courant. "
"Note : Le nouveau fichier sera téléchargé dans le répertoire courant. "
"Si un '%s' existe à cet endroit, il sera réutilisé automatiquement."
t MSG_085 "Téléchargement de %s"
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 "
"ou décochez l'option \"Disque de démarrage...\"."
t MSG_088 "Image ISO trop large"
t MSG_089 "Cette ISO image est trop large pour le périphérique sélectionné."
t MSG_088 "Image trop large"
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_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."
t MSG_092 "Système de fichiers non supporté"
t MSG_093 "IMPORTANT: CE PÉRIPHÉRIQUE CONTIENT PLUSIEURS PARTITIONS !!\n\n"
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 "
"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_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_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."
@ -1788,10 +1793,10 @@ t MSG_102 "Votre plateforme ne peut pas extraire les fichiers depuis les archive
t MSG_103 "Télécharger %s?"
t MSG_104 "Syslinux v5.0 ou plus récent requiert l'installation d'un fichier '%s'.\n"
"Puisque ce fichier fait plus de 100 Ko et est toujours présent sur les images ISO à base de Syslinux v5+, "
"il n'est pas inclus dans l'application.\n\nRufus peut télécharger ce fichier pour vous:\n"
"il n'est pas inclus dans l'application.\n\nRufus peut télécharger ce fichier pour vous :\n"
"- Choisissez 'Oui' pour télécharger le fichier depuis Internet\n"
"- Choisissez 'Non' si vous compter copier ce fichier manuellement\n"
"Note: Ce fichier est téléchargé dans le répertoire courant. Une fois qu'un fichier"
"Note : Ce fichier est téléchargé dans le répertoire courant. Une fois qu'un fichier"
"'%s' existe à cet endroit, il sera réutilisé automatiquement."
t MSG_105 "Annuler peut laisser le périphérique dans un état inutilisable.\n"
"Si vous êtes sûr de vouloir annuler, sélectionnez OUI. Sinon, sélectionnez NON."
@ -1803,14 +1808,14 @@ t MSG_110 "MS-DOS ne peut pas être utilisé sur un disque avec une Taille de cl
"Veuillez changer la Taille de clusters ou utilisez FreeDOS."
t MSG_111 "Taille de clusters incompatible"
t MSG_112 "Le formatage d'un volume UDF de grande taille peut prendre beaucoup de temps. Aux vitesses USB 2.0, "
"la durée de formatage estimée est %d:%02d, pendant laquelle la barre de progrès semblera gelée. Veuillez être patient !"
"la durée de formatage estimée est %d :%02d, pendant laquelle la barre de progrès semblera gelée. Veuillez être patient !"
t MSG_113 "Volume UDF de grand taille"
t MSG_114 "Cette image utilise Syslinux %s mais l'application inclus seulement les fichiers d'installation pour Syslinux %s.\n\n"
"Comme les nouvelles versions de Syslinux sont incompatibles entre elles, et il n'est pas possible à Rufus de toutes "
"les inclure, deux fichiers supplémentaires ('ldlinux.sys' et 'ldlinux.bss') doivent être téléchargés:\n"
"les inclure, deux fichiers supplémentaires ('ldlinux.sys' et 'ldlinux.bss') doivent être téléchargés :\n"
"- Choisissez 'Oui' pour télécharger ces fichier depuis Internet\n"
"- Choisissez 'Non' pour annuler l'opération\n"
"Note: Ces fichier seront téléchargés dans le répertoire courant et réutilisés automatiquement une fois présents."
"Note : Ces fichier seront téléchargés dans le répertoire courant et réutilisés automatiquement une fois présents."
t MSG_115 "Téléchargement nécessaire"
# Tootips
@ -1820,10 +1825,10 @@ t MSG_151 "Choisissez cette option si vous voulez installer un Système dexpl
"mais aurez aussi besoin daccéder au média depuis Windows XP"
t MSG_152 "Option préférée pour installer un Système dexploitation en mode EFI, "
"quand laccès au média depuis Windows XP nest pas nécessaire"
t MSG_153 "Motif de test: 0x%02X"
t MSG_154 "Motif de test: 0x%02X, 0x%02X"
t MSG_155 "Motif de test: 0x%02X, 0x%02X, 0x%02X"
t MSG_156 "Motif de test: 0x%02X, 0x%02X, 0x%02X, 0x%02X"
t MSG_153 "Motif de test : 0x%02X"
t MSG_154 "Motif de test : 0x%02X, 0x%02X"
t MSG_155 "Motif de test : 0x%02X, 0x%02X, 0x%02X"
t MSG_156 "Motif de test : 0x%02X, 0x%02X, 0x%02X, 0x%02X"
t MSG_157 "Sélectionne le système de fichiers"
t MSG_158 "Taille minimum quun bloc de données occupera sur le système de fichiers"
t MSG_159 "Utilisez ce champ pour mettre à jour le nom du volume.\n"
@ -1848,10 +1853,10 @@ t MSG_172 "Licence et remerciements"
t MSG_173 "Cliquez pour sélectionner..."
t MSG_174 "Rufus - The Reliable USB Formatting Utility"
t MSG_175 "Version %d.%d.%d (Build %d)"
t MSG_176 "Traduction Française: Pete Batard <mailto:pete@akeo.ie>"
t MSG_177 "Soumettre un bug ou une demande d'amélioration à:"
t MSG_178 "Copyrights supplémentaires:"
t MSG_179 "Politique de mises à jour:"
t MSG_176 "Traduction Française : Pete Batard <mailto:pete@akeo.ie>"
t MSG_177 "Soumettre un bug ou une demande d'amélioration à :"
t MSG_178 "Copyrights supplémentaires :"
t MSG_179 "Politique de mises à jour :"
t MSG_180 "Si vous autorisez ce programme à chercher les mises à jour, vous acceptez "
"que les informations suivantes peuvent être collectées sur nos serveurs :"
t MSG_181 "Larchitecture de votre système dexploitation ainsi que sa version"
@ -1860,17 +1865,19 @@ t MSG_183 "Votre adresse IP"
t MSG_184 "Afin de générer des statistiques dutilisation privées, il se peut que nous gardions "
"les informations ainsi obtenues \\b au plus un an\\b0 . A moins dy être contraint par la loi, "
"nous nous engageons aussi à ne pas diffuser ces informations à de tierce parties."
t MSG_185 "Processus de mise à jour:"
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 "
"de mises à jour intervient seulement lorsque lapplication principale s'exécute.\\line\n"
"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
t MSG_201 "Annulation - Veuillez patienter..."
t MSG_202 "Analyse de l'image ISO..."
t MSG_203 "Echec d'analyse de l'image ISO"
t MSG_204 "Fichier %s obsolète détecté"
t MSG_205 "ISO utilisée: %s"
t MSG_205 "ISO utilisée : %s"
t MSG_206 "Fichier %s manquant"
t MSG_207 "Nouveau volume"
t MSG_208 "%d périphérique détecté"
@ -1882,10 +1889,10 @@ t MSG_213 "Lancement de la nouvelle application..."
t MSG_214 "Echec de lancement de l'application"
t MSG_215 "%s ouvert"
t MSG_216 "%s sauvegardé"
t MSG_217 "Formatage: %0.1f%% complet"
t MSG_218 "Système de fichiers: Tâche %d/%d complète"
t MSG_219 "Finalisation NTFS: %d%% complète"
t MSG_220 "Formatage (%s) - durée estimée %d:%02d..."
t MSG_217 "Formatage : %0.1f%% complété"
t MSG_218 "Système de fichiers : Tâche %d/%d complétée"
t MSG_219 "Finalisation NTFS: %d%% complété"
t MSG_220 "Formatage (%s) - durée estimée %d :%02d..."
t MSG_221 "Ecriture du label (peut prendre du temps)..."
t MSG_222 "Formatage (%s)..."
t MSG_223 "Finalisation NTFS (Checkdisk)..."
@ -1900,17 +1907,17 @@ t MSG_231 "Copie des fichiers ISO..."
t MSG_232 "Ecriture boot Win7 EFI (peut prendre du temps)..."
t MSG_233 "Finalisation, veuillez patienter..."
t MSG_234 "Installation de Syslinux %s..."
t MSG_235 "Défauts: PASSE %d/%d - %0.2f%% (%d/%d/%d erreurs)"
t MSG_236 "Défauts: Test avec motif aléatoire"
t MSG_237 "Défauts: Test avec motif 0x%02X"
t MSG_235 "Défauts : PASSE %d/%d - %0.2f%% (%d/%d/%d erreurs)"
t MSG_236 "Défauts : Test avec motif aléatoire"
t MSG_237 "Défauts : Test avec motif 0x%02X"
t MSG_238 "Partitionage (%s)..."
t MSG_239 "Effacement des partitions..."
t MSG_240 "Téléchargement de %s: Connexion..."
t MSG_240 "Téléchargement de %s : Connexion..."
t MSG_241 "Téléchargement: %0.1f%%"
t MSG_242 "Echec de téléchargement du fichier"
t MSG_243 "Recherche des mises à jour..."
t MSG_244 "MAJ: Impossible de se connecter"
t MSG_245 "MAJ: Pas d'accès aux données de mises à jour"
t MSG_244 "MAJ : Impossible de se connecter"
t MSG_245 "MAJ : Pas d'accès aux données de mises à jour"
t MSG_246 "Une nouvelle version de Rufus est disponible !"
t MSG_247 "Pas de nouvelle mise à jour"
t MSG_248 "Clés de registre supprimées"
@ -1919,13 +1926,14 @@ t MSG_250 "%s activé"
t MSG_251 "%s désactivé"
t MSG_252 "Tests de dépassement de taille"
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_256 "Test de contrefaçons"
t MSG_257 "Support Joliet"
t MSG_258 "Support Rock Ridge"
t MSG_259 "Forçage de mise à jour"
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

View File

@ -476,42 +476,41 @@ BOOL IsMediaPresent(DWORD DriveIndex)
return r;
}
// TODO: use an (fn,str) table and simplify this whole thing
BOOL AnalyzeMBR(HANDLE hPhysicalDrive)
const struct {int (*fn)(FILE *fp); char* str; BOOL bootable;} known_mbr[] = {
{ 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 };
int i;
fake_fd._ptr = (char*)hPhysicalDrive;
fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
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;
}
if (is_dos_mbr(&fake_fd)) {
uprintf("Drive has a DOS/NT/95A master boot record\n");
} else if (is_dos_f2_mbr(&fake_fd)) {
uprintf("Drive has a DOS/NT/95A master boot record "
"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");
for (i=0; i<ARRAYSIZE(known_mbr); i++) {
if (known_mbr[i].fn(&fake_fd)) {
uprintf("%s has a %s %s\n", TargetName, known_mbr[i].str, mbr_name);
return known_mbr[i].bootable;
}
}
uprintf("%s has an unknown %s\n", TargetName, mbr_name);
return TRUE;
}
@ -611,7 +610,7 @@ int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSyst
uprintf("Partition type: MBR, NB Partitions: %d\n", nb_partitions);
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)":"");
AnalyzeMBR(hPhysical);
AnalyzeMBR(hPhysical, "Drive");
for (i=0; i<DriveLayout->PartitionCount; i++) {
if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) {
uprintf("Partition %d:\n", i+1);

View File

@ -35,7 +35,7 @@ char GetUnusedDriveLetter(void);
BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label);
uint64_t GetDriveSize(DWORD DriveIndex);
BOOL IsMediaPresent(DWORD DriveIndex);
BOOL AnalyzeMBR(HANDLE hPhysicalDrive);
BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName);
BOOL AnalyzePBR(HANDLE hLogicalVolume);
int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize);
BOOL UnmountVolume(HANDLE hDrive);

View File

@ -827,7 +827,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
FILE fake_fd = { 0 };
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
// and FAT32 partitions - we need to correct this in the MBR
@ -1172,21 +1172,26 @@ DWORD WINAPI CloseFormatPromptThread(LPVOID param) {
* Close the volume handle.
*/
#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;
BOOL ret, use_large_fat32;
DWORD DriveIndex = (DWORD)(uintptr_t)param;
BOOL s, ret, use_large_fat32;
DWORD rSize, wSize, LastRefresh = 0, DriveIndex = (DWORD)(uintptr_t)param;
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
HANDLE hLogicalVolume = INVALID_HANDLE_VALUE;
HANDLE hSourceImage = INVALID_HANDLE_VALUE;
SYSTEMTIME lt;
FILE* log_fd;
LARGE_INTEGER li;
uint64_t wb;
uint8_t buffer[BSIZE];
char *bb_msg, *guid_volume = NULL;
char drive_name[] = "?:\\";
char drive_letters[27];
char logfile[MAX_PATH], *userdir;
char wim_image[] = "?:\\sources\\install.wim";
char efi_dst[] = "?:\\efi\\boot\\bootx64.efi";
FILE* log_fd;
PF_DECL(GetThreadUILanguage);
PF_DECL(SetThreadUILanguage);
PF_INIT(GetThreadUILanguage, kernel32);
@ -1247,7 +1252,7 @@ DWORD WINAPI FormatThread(LPVOID param)
CHECK_FOR_USER_CANCEL;
PrintStatus(0, TRUE, MSG_226);
AnalyzeMBR(hPhysicalDrive);
AnalyzeMBR(hPhysicalDrive, "Drive");
if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) {
AnalyzePBR(hLogicalVolume);
}
@ -1316,6 +1321,50 @@ DWORD WINAPI FormatThread(LPVOID param)
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
if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) {
PrintStatus(0, TRUE, MSG_227);

View File

@ -478,7 +478,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan)
int j;
uint16_t sl_version;
FILE* fd;
BOOL r = FALSE;
int r = 1;
iso9660_t* p_iso = NULL;
udf_t* p_udf = NULL;
udf_dirent_t* p_udf_root;
@ -557,7 +557,8 @@ try_iso:
p_iso = iso9660_open_ext(src_iso, iso_extension_mask);
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;
}
uprintf("Disc image is an ISO9660 image\n");

View File

@ -359,6 +359,7 @@ const loc_control_id control_id[] = {
LOC_CTRL(MSG_258),
LOC_CTRL(MSG_259),
LOC_CTRL(MSG_260),
LOC_CTRL(MSG_261),
LOC_CTRL(MSG_MAX),
LOC_CTRL(IDOK),
LOC_CTRL(IDCANCEL),

View File

@ -378,7 +378,8 @@
#define MSG_258 3258
#define MSG_259 3259
#define MSG_260 3260
#define MSG_MAX 3261
#define MSG_261 3261
#define MSG_MAX 3262
// Next default values for new objects
//

View File

@ -492,7 +492,7 @@ static void EnableAdvancedBootOptions(BOOL enable)
{
BOOL actual_enable;
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_EXTRA_PARTITION), actual_enable);
@ -503,7 +503,7 @@ static void EnableBootOptions(BOOL enable)
{
BOOL actual_enable;
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(hBootType, actual_enable);
@ -896,11 +896,10 @@ static BOOL GetUSBDevices(DWORD devnum)
*/
static void InitProgress(void)
{
int i, dt, fs;
int i, fs;
float last_end = 0.0f, slots_discrete = 0.0f, slots_analog = 0.0f;
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
memset(&nb_slots, 0, sizeof(nb_slots));
memset(&slot_end, 0, sizeof(slot_end));
previous_end = 0.0f;
@ -910,19 +909,21 @@ static void InitProgress(void)
previous_end = 0.0f;
nb_slots[OP_ANALYZE_MBR] = 1;
nb_slots[OP_ZERO_MBR] = 1;
if (IsChecked(IDC_BADBLOCKS)) {
nb_slots[OP_BADBLOCKS] = -1;
}
if (IsChecked(IDC_BOOT)) {
// 1 extra slot for PBR writing
switch (dt) {
switch (selection_default) {
case DT_WINME:
nb_slots[OP_DOS] = 3+1;
break;
case DT_FREEDOS:
nb_slots[OP_DOS] = 5+1;
break;
case DT_IMG:
nb_slots[OP_DOS] = 0;
break;
case DT_ISO:
nb_slots[OP_DOS] = -1;
break;
@ -931,15 +932,20 @@ static void InitProgress(void)
break;
}
}
nb_slots[OP_PARTITION] = 1;
nb_slots[OP_FIX_MBR] = 1;
nb_slots[OP_CREATE_FS] =
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))];
if ( (!IsChecked(IDC_QUICKFORMAT))
|| ((fs == FS_FAT32) && ((SelectedDrive.DiskSize >= LARGE_FAT32_SIZE) || (force_large_fat32))) ) {
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_FIX_MBR] = 1;
nb_slots[OP_CREATE_FS] =
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))];
if ( (!IsChecked(IDC_QUICKFORMAT))
|| ((fs == FS_FAT32) && ((SelectedDrive.DiskSize >= LARGE_FAT32_SIZE) || (force_large_fat32))) ) {
nb_slots[OP_FORMAT] = -1;
}
nb_slots[OP_FINALIZE] = ((selection_default == DT_ISO) && (fs == FS_NTFS))?3:2;
}
nb_slots[OP_FINALIZE] = ((dt == DT_ISO) && (fs == FS_NTFS))?3:2;
for (i=0; i<OP_MAX; i++) {
if (nb_slots[i] > 0) {
@ -1016,22 +1022,24 @@ void UpdateProgress(int op, float percent)
static void EnableControls(BOOL 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_FILESYSTEM), bEnable);
EnableWindow(GetDlgItem(hMainDialog, IDC_CLUSTERSIZE), bEnable);
EnableWindow(GetDlgItem(hMainDialog, IDC_LABEL), 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_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 */
@ -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)
{
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;
}
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
DWORD WINAPI ISOScanThread(LPVOID param)
{
@ -1192,7 +1229,7 @@ DWORD WINAPI ISOScanThread(LPVOID param)
PrintStatus(0, TRUE, MSG_202);
user_notified = FALSE;
EnableControls(FALSE);
r = ExtractISO(iso_path, "", TRUE);
r = ExtractISO(iso_path, "", TRUE) || IsImage(iso_path);
EnableControls(TRUE);
if (!r) {
SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0);
@ -1200,38 +1237,46 @@ DWORD WINAPI ISOScanThread(LPVOID param)
safe_free(iso_path);
goto out;
}
if (HAS_SYSLINUX(iso_report)) {
safe_sprintf(isolinux_str, sizeof(isolinux_str), "Yes (%s)", iso_report.sl_version_str);
}
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >64 chars filename: %s\r\n Has a >4GB file: %s\r\n"
" ReactOS: %s\r\n Uses EFI: %s%s\r\n Uses Bootmgr: %s\r\n Uses WinPE: %s%s\r\n Uses isolinux: %s\r\n",
iso_report.label, iso_report.projected_size, iso_report.has_long_filename?"Yes":"No", iso_report.has_4GB_file?"Yes":"No",
IS_REACTOS(iso_report)?"Yes":"No", (iso_report.has_efi || iso_report.has_win7_efi)?"Yes":"No",
(iso_report.has_win7_efi && (!iso_report.has_efi))?" (win7_x64)":"", iso_report.has_bootmgr?"Yes":"No",
IS_WINPE(iso_report.winpe)?"Yes":"No", (iso_report.uses_minint)?" (with /minint)":"", isolinux_str);
if (HAS_SYSLINUX(iso_report) && (SL_MAJOR(iso_report.sl_version) < 5)) {
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");
if (!iso_report.is_bootable_img) {
if (HAS_SYSLINUX(iso_report)) {
safe_sprintf(isolinux_str, sizeof(isolinux_str), "Yes (%s)", iso_report.sl_version_str);
}
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >64 chars filename: %s\r\n Has a >4GB file: %s\r\n"
" ReactOS: %s\r\n Uses EFI: %s%s\r\n Uses Bootmgr: %s\r\n Uses WinPE: %s%s\r\n Uses isolinux: %s\r\n",
iso_report.label, iso_report.projected_size, iso_report.has_long_filename?"Yes":"No", iso_report.has_4GB_file?"Yes":"No",
IS_REACTOS(iso_report)?"Yes":"No", (iso_report.has_efi || iso_report.has_win7_efi)?"Yes":"No",
(iso_report.has_win7_efi && (!iso_report.has_efi))?" (win7_x64)":"", iso_report.has_bootmgr?"Yes":"No",
IS_WINPE(iso_report.winpe)?"Yes":"No", (iso_report.uses_minint)?" (with /minint)":"", isolinux_str);
if (HAS_SYSLINUX(iso_report) && (SL_MAJOR(iso_report.sl_version) < 5)) {
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");
}
}
}
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);
safe_free(iso_path);
SetMBRProps();
} else if (HAS_SYSLINUX(iso_report)) {
} else {
// Enable bootable and set Target System and FS accordingly
CheckDlgButton(hMainDialog, IDC_BOOT, BST_CHECKED);
SetTargetSystem();
SetFSFromISO();
SetMBRProps();
if (!iso_report.is_bootable_img) {
SetTargetSystem();
SetFSFromISO();
SetMBRProps();
// 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
if (iso_report.label[0] != 0) {
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]);
// 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
if (iso_report.label[0] != 0) {
SetWindowTextU(hLabel, iso_report.label);
}
// Lose the focus on the select ISO (but place it on Close)
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
// 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));
}
// 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)
{
int i, fs, bt, dt, r;
@ -1324,7 +1381,7 @@ static BOOL BootCheck(void)
syslinux_ldlinux_len[0] = 0; syslinux_ldlinux_len[1] = 0;
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
if (dt == DT_ISO) {
if ((dt == DT_ISO) || (dt == DT_IMG)) {
if (iso_path == NULL) {
// 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);
@ -1335,6 +1392,12 @@ static BOOL BootCheck(void)
MessageBoxU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR|MB_IS_RTL);
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));
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
if (bt == BT_UEFI) {
@ -1687,6 +1750,43 @@ void ShowLanguageMenu(HWND hDlg)
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
*/
@ -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;
static DWORD DeviceNum = 0, LastRefresh = 0;
char tmp[128];
static UINT uBootChecked = BST_CHECKED, uQFChecked;
static BOOL first_log_display = TRUE, user_changed_label = FALSE;
static ULONG ulRegister = 0;
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
// 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.
// 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) {
switch (wParam) {
case DBT_DEVICEARRIVAL:
@ -1731,7 +1833,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
user_changed_label = FALSE;
return (INT_PTR)TRUE;
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 (GetTickCount() > LastRefresh + 1000) {
LastRefresh = GetTickCount();
@ -1922,20 +2023,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
if (selection_default == DT_IMG) {
ToggleImage(FALSE);
EnableAdvancedBootOptions(FALSE);
SetBoot(fs, bt);
break;
}
SetClusterSizes(fs);
// Disable/restore the quick format control depending on large FAT32
if ((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) {
if (IsWindowEnabled(GetDlgItem(hMainDialog, IDC_QUICKFORMAT))) {
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);
}
}
EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT),
!((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))));
if (fs < 0) {
EnableBootOptions(TRUE);
SetMBRProps();
@ -1948,61 +2045,26 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
}
if ((fs == FS_EXFAT) || (fs == FS_UDF)) {
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);
if (IsWindowEnabled(hBoot))
EnableBootOptions(FALSE);
} else if (IsDlgButtonChecked(hMainDialog, IDC_BOOT)) {
uBootChecked = TRUE;
CheckDlgButton(hDlg, IDC_BOOT, BST_UNCHECKED);
}
SetMBRProps();
break;
}
EnableAdvancedBootOptions(TRUE);
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));
// 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);
}
SetBoot(fs, bt);
SetMBRProps();
break;
case IDC_BOOTTYPE:
if (HIWORD(wParam) != CBN_SELCHANGE)
break;
selection_default = (int) ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
ToggleImage(selection_default != DT_IMG);
// The Rufus MBR can't apply for Syslinux or ReactOS
// TODO: we should also disable this for isolinux based ISOs
EnableWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), selection_default < DT_SYSLINUX_V4);
EnableWindow(hDiskID, selection_default < DT_SYSLINUX_V4);
if (selection_default == DT_ISO) {
EnableWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), selection_default < DT_IMG);
EnableWindow(GetDlgItem(hMainDialog, IDC_EXTRA_PARTITION), selection_default < DT_IMG);
EnableWindow(hDiskID, selection_default < DT_IMG);
if ((selection_default == DT_ISO) || (selection_default == DT_IMG)) {
if ((iso_path == NULL) || (iso_report.label[0] == 0)) {
// Set focus to the Select ISO button
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
@ -2024,11 +2086,14 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
return (INT_PTR)TRUE;
case IDC_SELECT_ISO:
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...
} else {
safe_free(iso_path);
iso_path = FileDialog(FALSE, NULL, "*.iso", "iso", lmprintf(MSG_036));
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));
if (iso_path == NULL) {
CreateTooltip(hSelectISO, lmprintf(MSG_173), -1);
break;
@ -2064,7 +2129,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
SetTaskbarProgressState(TASKBAR_NORMAL);
SetTaskbarProgressValue(0, MAX_PROGRESS);
SendMessage(hProgress, PBM_SETPOS, 0, 0);
selection_default = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
selection_default = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
nDeviceIndex = ComboBox_GetCurSel(hDeviceList);
if (nDeviceIndex != CB_ERR) {
if ((IsChecked(IDC_BOOT)) && (!BootCheck())) {

View File

@ -177,6 +177,7 @@ enum dos_type {
DT_WINME = 0,
DT_FREEDOS,
DT_ISO,
DT_IMG,
DT_SYSLINUX_V4, // Start of indexes that only display in advanced mode
DT_SYSLINUX_V5,
DT_REACTOS,
@ -240,6 +241,7 @@ typedef struct {
BOOL has_old_c32[NB_OLD_C32];
BOOL has_old_vesamenu;
BOOL uses_minint;
BOOL is_bootable_img;
uint16_t sl_version; // Syslinux/Isolinux version
char sl_version_str[12];
} RUFUS_ISO_REPORT;

View File

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329
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
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -165,7 +165,7 @@ END
RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329
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
CAPTION "Rufus 1.4.4.404"
CAPTION "Rufus 1.4.4.405"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -427,8 +427,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,4,404
PRODUCTVERSION 1,4,4,404
FILEVERSION 1,4,4,405
PRODUCTVERSION 1,4,4,405
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -445,13 +445,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.4.404"
VALUE "FileVersion", "1.4.4.405"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.4.404"
VALUE "ProductVersion", "1.4.4.405"
END
END
BLOCK "VarFileInfo"