mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] detect, report and warn when multiple partitions are in use
* Closes #191 * Also fix various minor warnings
This commit is contained in:
parent
299506056a
commit
3ae7ec4af5
10 changed files with 129 additions and 82 deletions
|
@ -7,9 +7,12 @@ Remember to also update the version number for your translation ('v x.y.z')
|
|||
once you have matched all the changes that occurred for the en-US translation.
|
||||
|
||||
o Version 1.0.8 (2014.01.21)
|
||||
- MSG_234: 'v%d' is replaced with '%s' (change already applied to existing translations)
|
||||
- Changed MSG_047 "%s (%c:)" -> "Multiple Volumes" (non-updated ones have been commented out)
|
||||
- *NEW* MSG_093 "IMPORTANT: THIS DRIVE CONTAINS MULTIPLE PARTITIONS OR VOLUMES!!"
|
||||
- *NEW* MSG_094 "Multiple partitions detected"
|
||||
- *NEW* MSG_114 "This image uses Syslinux %s but this application only includes Syslinux %s
|
||||
- *NEW* MSG_115 "Download required"
|
||||
- Changed MSG_234: 'v%d' is replaced with '%s' (change already applied to existing translations)
|
||||
|
||||
o Version 1.0.7 (2014.01.01)
|
||||
- Added MSG_092 again
|
||||
|
|
|
@ -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.7
|
||||
v 1.0.8
|
||||
|
||||
# Main dialog
|
||||
g IDD_DIALOG
|
||||
|
@ -187,7 +187,8 @@ t MSG_043 "Error: %s"
|
|||
t MSG_044 "File download"
|
||||
t MSG_045 "USB Storage Device (Generic)"
|
||||
t MSG_046 "%s (Disk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# Used when a drive is detected that contains more than one partition
|
||||
t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Flushing buffers"
|
||||
t MSG_049 "Rufus - Cancellation"
|
||||
|
||||
|
@ -253,6 +254,10 @@ 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."
|
||||
t MSG_092 "Unsupported filesystem"
|
||||
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_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."
|
||||
|
@ -559,7 +564,7 @@ t MSG_043 "错误:%s"
|
|||
t MSG_044 "文件下载"
|
||||
t MSG_045 "通用 USB 存储设备"
|
||||
t MSG_046 "%s (磁盘 %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - 刷新缓冲区"
|
||||
t MSG_049 "Rufus - 取消"
|
||||
|
||||
|
@ -907,7 +912,7 @@ t MSG_043 "錯誤: %s"
|
|||
t MSG_044 "檔案下載"
|
||||
t MSG_045 "USB 裝置"
|
||||
t MSG_046 "%s (磁碟 %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - 排清緩衝區"
|
||||
t MSG_049 "Rufus - 取消"
|
||||
|
||||
|
@ -1279,7 +1284,7 @@ t MSG_043 "Fout: %s"
|
|||
t MSG_044 "Bestand download"
|
||||
t MSG_045 "USB Opslag Apparaat (Algemeen)"
|
||||
t MSG_046 "%s (Disk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Buffers aan het legen"
|
||||
t MSG_049 "Rufus - Annulering"
|
||||
|
||||
|
@ -1497,7 +1502,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.7
|
||||
v 1.0.8
|
||||
b "en-US"
|
||||
|
||||
g IDD_DIALOG
|
||||
|
@ -1630,7 +1635,7 @@ 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)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
t MSG_047 "Plusieurs partitions"
|
||||
t MSG_048 "Rufus - Flush de la mémoire tampon"
|
||||
t MSG_049 "Rufus - Annulation"
|
||||
|
||||
|
@ -1694,6 +1699,10 @@ t MSG_090 "Image ISO on supportée"
|
|||
t MSG_091 "Quand UEFI est séelectionné, 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"
|
||||
"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_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."
|
||||
|
@ -2003,7 +2012,7 @@ t MSG_043 "Fehler: %s"
|
|||
t MSG_044 "Dateidownload"
|
||||
t MSG_045 "USB Massenspeichergerät (Allgemein)"
|
||||
t MSG_046 "%s (Disk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Leere Puffer"
|
||||
t MSG_049 "Rufus - Abbrechen"
|
||||
|
||||
|
@ -2405,7 +2414,7 @@ t MSG_043 "Σφάλμα: %s"
|
|||
t MSG_044 "Λήψη αρχείου"
|
||||
t MSG_045 "Συσκευή αποθήκευσης USB(Generic)"
|
||||
t MSG_046 "%s (Δίσκος %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Flushing προσωρινής μνήμης"
|
||||
t MSG_049 "Rufus - Ακύρωση"
|
||||
|
||||
|
@ -2758,7 +2767,7 @@ t MSG_043 "Hiba: %s"
|
|||
t MSG_044 "Fájl letöltése"
|
||||
t MSG_045 "USB Tároló eszköz"
|
||||
t MSG_046 "%s (Lemez: %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Bufferelés"
|
||||
t MSG_049 "Rufus - Megszakítás"
|
||||
|
||||
|
@ -3154,7 +3163,7 @@ t MSG_043 "Kesalahan: %s"
|
|||
t MSG_044 "File download"
|
||||
t MSG_045 "Perangkat Penyimpanan USB(Generic)"
|
||||
t MSG_046 "%s (Disk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Flushing buffers"
|
||||
t MSG_049 "Rufus - Pembatalan"
|
||||
|
||||
|
@ -3531,7 +3540,7 @@ t MSG_043 "Errore: %s"
|
|||
t MSG_044 "Download file"
|
||||
t MSG_045 "Unità memorizzazione USB (generica)"
|
||||
t MSG_046 "%s (disco %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Svuotamento buffer"
|
||||
t MSG_049 "Rufus - Cancellazione"
|
||||
|
||||
|
@ -3887,7 +3896,7 @@ t MSG_043 "오류: %s"
|
|||
t MSG_044 "다운로드 파일"
|
||||
t MSG_045 "USB 저장 장치 (일반)"
|
||||
t MSG_046 "%s (디스크 %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - 버퍼 비움"
|
||||
t MSG_049 "Rufus - 해제"
|
||||
|
||||
|
@ -4285,7 +4294,7 @@ t MSG_043 "Klaida: %s"
|
|||
t MSG_044 "Failo atsisiuntimas"
|
||||
t MSG_045 "USB saugyklos įrenginys (bendrinis)"
|
||||
t MSG_046 "%s (diskas %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - išvalomi buferiai"
|
||||
t MSG_049 "Rufus - atšaukimas"
|
||||
|
||||
|
@ -4687,7 +4696,7 @@ t MSG_043 "Error: %s"
|
|||
t MSG_044 "Muat turun fail"
|
||||
t MSG_045 "Peranti storan USB (Generik)"
|
||||
t MSG_046 "%s (Disk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Mengeflush buffer"
|
||||
t MSG_049 "Rufus - Dibatalkan"
|
||||
|
||||
|
@ -5087,7 +5096,7 @@ t MSG_043 "Błąd: %s"
|
|||
t MSG_044 "Pobieranie pliku"
|
||||
t MSG_045 "Urządzenie pamięci masowej USB (Ogólny)"
|
||||
t MSG_046 "%s (Dysk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Czyszczenie buforów"
|
||||
t MSG_049 "Rufus - Anulowanie"
|
||||
|
||||
|
@ -5490,7 +5499,7 @@ t MSG_043 "Erro: %s"
|
|||
t MSG_044 "Download do arquivo"
|
||||
t MSG_045 "Dispositivo de armazenamento USB (Genérico)"
|
||||
t MSG_046 "%s (Disco %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Limpando os buffers"
|
||||
t MSG_049 "Rufus - Cancelamento"
|
||||
|
||||
|
@ -5875,7 +5884,7 @@ t MSG_043 "Eroare: %s"
|
|||
t MSG_044 "Descărcare fişier"
|
||||
t MSG_045 "Unitate de stocare USB (generic)"
|
||||
t MSG_046 "%s (disc %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Ştergere bufer"
|
||||
t MSG_049 "Rufus - Anulare"
|
||||
|
||||
|
@ -6257,7 +6266,7 @@ t MSG_043 "Ошибка: %s"
|
|||
t MSG_044 "Загрузка файла"
|
||||
t MSG_045 "USB-устройство хранения данных"
|
||||
t MSG_046 "%s (Диск %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Буфер"
|
||||
t MSG_049 "Отмена"
|
||||
|
||||
|
@ -6625,7 +6634,7 @@ t MSG_043 "Napaka: %s"
|
|||
t MSG_044 "Prenos datoteke"
|
||||
t MSG_045 "USB podatkovni nosilec (generičen)"
|
||||
t MSG_046 "%s (disk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - izpiranje medpomnilnika"
|
||||
t MSG_049 "Rufus - preklic"
|
||||
|
||||
|
@ -7021,7 +7030,7 @@ t MSG_043 "Error: %s"
|
|||
t MSG_044 "Descarga de archivo"
|
||||
t MSG_045 "Dispositivo de almacenamiento USB (Genérico)"
|
||||
t MSG_046 "%s (Disco %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Purgando los búfers"
|
||||
t MSG_049 "Rufus - Cancelación"
|
||||
|
||||
|
@ -7422,7 +7431,7 @@ t MSG_043 "Hata: %s"
|
|||
t MSG_044 "Dosya indirme"
|
||||
t MSG_045 "USB Depolama Aygıtı (Genel)"
|
||||
t MSG_046 "%s (Disk %d)"
|
||||
t MSG_047 "%s (%c:)"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Tamponlanıyor"
|
||||
t MSG_049 "Rufus - Vazgeçme"
|
||||
|
||||
|
|
56
src/drive.c
56
src/drive.c
|
@ -263,21 +263,22 @@ HANDLE GetLogicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive)
|
|||
}
|
||||
|
||||
/*
|
||||
* Returns the first drive letter for a volume located on the drive identified by DriveIndex,
|
||||
* Returns the drive letters for all volumes located on the drive identified by DriveIndex,
|
||||
* as well as the drive type. This is used as base for the 2 function calls that follow.
|
||||
*/
|
||||
static BOOL _GetDriveLetterAndType(DWORD DriveIndex, char* drive_letter, UINT* drive_type)
|
||||
static BOOL _GetDriveLettersAndType(DWORD DriveIndex, char* drive_letters, UINT* drive_type)
|
||||
{
|
||||
DWORD size;
|
||||
BOOL r = FALSE;
|
||||
STORAGE_DEVICE_NUMBER_REDEF device_number = {0};
|
||||
HANDLE hDrive = INVALID_HANDLE_VALUE;
|
||||
UINT _drive_type;
|
||||
int i = 0;
|
||||
char *drive, drives[26*4]; /* "D:\", "E:\", etc. */
|
||||
char logical_drive[] = "\\\\.\\#:";
|
||||
|
||||
if (drive_letter != NULL)
|
||||
*drive_letter = ' ';
|
||||
if (drive_letters != NULL)
|
||||
drive_letters[0] = 0;
|
||||
if (drive_type != NULL)
|
||||
*drive_type = DRIVE_UNKNOWN;
|
||||
CheckDriveIndex(DriveIndex);
|
||||
|
@ -324,29 +325,31 @@ static BOOL _GetDriveLetterAndType(DWORD DriveIndex, char* drive_letter, UINT* d
|
|||
uprintf("Could not get device number for device %s: %s\n",
|
||||
logical_drive, WindowsErrorString());
|
||||
} else if (device_number.DeviceNumber == DriveIndex) {
|
||||
if (drive_letter != NULL)
|
||||
*drive_letter = *drive;
|
||||
if (drive_letters != NULL)
|
||||
drive_letters[i++] = *drive;
|
||||
// The drive type should be the same for all volumes, so we can overwrite
|
||||
if (drive_type != NULL)
|
||||
*drive_type = _drive_type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (drive_letters != NULL)
|
||||
drive_letters[i] = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
// Could have used a #define, but this is clearer
|
||||
BOOL GetDriveLetter(DWORD DriveIndex, char* drive_letter)
|
||||
BOOL GetDriveLetters(DWORD DriveIndex, char* drive_letters)
|
||||
{
|
||||
return _GetDriveLetterAndType(DriveIndex, drive_letter, NULL);
|
||||
return _GetDriveLettersAndType(DriveIndex, drive_letters, NULL);
|
||||
}
|
||||
|
||||
// There's already a GetDriveType in the Windows API
|
||||
UINT GetDriveTypeFromIndex(DWORD DriveIndex)
|
||||
{
|
||||
UINT drive_type;
|
||||
_GetDriveLetterAndType(DriveIndex, NULL, &drive_type);
|
||||
_GetDriveLettersAndType(DriveIndex, NULL, &drive_type);
|
||||
return drive_type;
|
||||
}
|
||||
|
||||
|
@ -380,14 +383,14 @@ char GetUnusedDriveLetter(void)
|
|||
}
|
||||
|
||||
out:
|
||||
return (drive_letter>'Z')?' ':drive_letter;
|
||||
return (drive_letter>'Z')?0:drive_letter;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the drive letter and volume label
|
||||
* If the drive doesn't have a volume assigned, space is returned for the letter
|
||||
*/
|
||||
BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label)
|
||||
BOOL GetDriveLabel(DWORD DriveIndex, char* letters, char** label)
|
||||
{
|
||||
HANDLE hPhysical;
|
||||
DWORD size;
|
||||
|
@ -398,14 +401,15 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label)
|
|||
|
||||
*label = STR_NO_LABEL;
|
||||
|
||||
if (!GetDriveLetter(DriveIndex, letter))
|
||||
if (!GetDriveLetters(DriveIndex, letters))
|
||||
return FALSE;
|
||||
if (*letter == ' ') {
|
||||
if (letters[0] == 0) {
|
||||
// Drive without volume assigned - always enabled
|
||||
return TRUE;
|
||||
}
|
||||
AutorunPath[0] = *letter;
|
||||
wDrivePath[0] = *letter;
|
||||
// We only care about an autorun.inf if we have a single volume
|
||||
AutorunPath[0] = letters[0];
|
||||
wDrivePath[0] = letters[0];
|
||||
|
||||
// Try to read an extended label from autorun first. Fallback to regular label if not found.
|
||||
// In the case of card readers with no card, users can get an annoying popup asking them
|
||||
|
@ -414,11 +418,11 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label)
|
|||
if (DeviceIoControl(hPhysical, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, &size, NULL))
|
||||
AutorunLabel = get_token_data_file("label", AutorunPath);
|
||||
else if (GetLastError() == ERROR_NOT_READY)
|
||||
uprintf("Ignoring autorun.inf label for drive %c: %s\n", *letter,
|
||||
uprintf("Ignoring autorun.inf label for drive %c: %s\n", letters[0],
|
||||
(HRESULT_CODE(GetLastError()) == ERROR_NOT_READY)?"No media":WindowsErrorString());
|
||||
safe_closehandle(hPhysical);
|
||||
if (AutorunLabel != NULL) {
|
||||
uprintf("Using autorun.inf label for drive %c: '%s'\n", *letter, AutorunLabel);
|
||||
uprintf("Using autorun.inf label for drive %c: '%s'\n", letters[0], AutorunLabel);
|
||||
strncpy(VolumeLabel, AutorunLabel, sizeof(VolumeLabel));
|
||||
safe_free(AutorunLabel);
|
||||
*label = VolumeLabel;
|
||||
|
@ -550,9 +554,9 @@ BOOL AnalyzePBR(HANDLE hLogicalVolume)
|
|||
/*
|
||||
* Fill the drive properties (size, FS, etc)
|
||||
*/
|
||||
BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize)
|
||||
int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize)
|
||||
{
|
||||
BOOL r;
|
||||
BOOL r, hasRufusExtra = FALSE;
|
||||
HANDLE hPhysical;
|
||||
DWORD size;
|
||||
BYTE geometry[128], layout[4096], part_type;
|
||||
|
@ -574,14 +578,14 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
|
||||
hPhysical = GetPhysicalHandle(DriveIndex, FALSE, FALSE);
|
||||
if (hPhysical == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
return 0;
|
||||
|
||||
r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
|
||||
NULL, 0, geometry, sizeof(geometry), &size, NULL);
|
||||
if (!r || size <= 0) {
|
||||
uprintf("Could not get geometry for drive 0x%02x: %s\n", DriveIndex, WindowsErrorString());
|
||||
safe_closehandle(hPhysical);
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
SelectedDrive.DiskSize = DiskGeometry->DiskSize.QuadPart;
|
||||
memcpy(&SelectedDrive.Geometry, &DiskGeometry->Geometry, sizeof(DISK_GEOMETRY));
|
||||
|
@ -593,7 +597,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
NULL, 0, layout, sizeof(layout), &size, NULL );
|
||||
if (!r || size <= 0) {
|
||||
uprintf("Could not get layout for drive 0x%02x: %s\n", DriveIndex, WindowsErrorString());
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (DriveLayout->PartitionStyle) {
|
||||
|
@ -618,6 +622,8 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
DriveLayout->PartitionEntry[i].PartitionLength, DriveLayout->PartitionEntry[i].Mbr.HiddenSectors,
|
||||
DriveLayout->PartitionEntry[i].Mbr.BootIndicator?"Yes":"No",
|
||||
DriveLayout->PartitionEntry[i].Mbr.RecognizedPartition?"Yes":"No");
|
||||
if (part_type == RUFUS_EXTRA_PARTITION_TYPE) // This is a partition Rufus created => we can safely ignore it
|
||||
hasRufusExtra = TRUE;
|
||||
if (part_type == 0xee) // Flag a protective MBR for non GPT platforms (XP)
|
||||
SelectedDrive.has_protective_mbr = TRUE;
|
||||
}
|
||||
|
@ -648,7 +654,9 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
|
|||
}
|
||||
safe_closehandle(hPhysical);
|
||||
|
||||
return TRUE;
|
||||
if (hasRufusExtra)
|
||||
nb_partitions--;
|
||||
return (int)nb_partitions;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -29,7 +29,7 @@ HANDLE GetPhysicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive);
|
|||
char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent);
|
||||
BOOL WaitForLogical(DWORD DriveIndex);
|
||||
HANDLE GetLogicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive);
|
||||
BOOL GetDriveLetter(DWORD DriveIndex, char* drive_letter);
|
||||
BOOL GetDriveLetters(DWORD DriveIndex, char* drive_letters);
|
||||
UINT GetDriveTypeFromIndex(DWORD DriveIndex);
|
||||
char GetUnusedDriveLetter(void);
|
||||
BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label);
|
||||
|
@ -37,7 +37,7 @@ uint64_t GetDriveSize(DWORD DriveIndex);
|
|||
BOOL IsMediaPresent(DWORD DriveIndex);
|
||||
BOOL AnalyzeMBR(HANDLE hPhysicalDrive);
|
||||
BOOL AnalyzePBR(HANDLE hLogicalVolume);
|
||||
BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize);
|
||||
int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize);
|
||||
BOOL UnmountVolume(HANDLE hDrive);
|
||||
BOOL MountVolume(char* drive_name, char *drive_guid);
|
||||
BOOL RemountVolume(char* drive_name);
|
||||
|
|
18
src/format.c
18
src/format.c
|
@ -1158,7 +1158,7 @@ DWORD WINAPI CloseFormatPromptThread(LPVOID param) {
|
|||
#define CHECK_FOR_USER_CANCEL if (IS_ERROR(FormatStatus)) goto out
|
||||
DWORD WINAPI FormatThread(LPVOID param)
|
||||
{
|
||||
int r, pt, bt, fs, dt;
|
||||
int i, r, pt, bt, fs, dt;
|
||||
BOOL ret, use_large_fat32;
|
||||
DWORD DriveIndex = (DWORD)(uintptr_t)param;
|
||||
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
|
||||
|
@ -1166,6 +1166,7 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
SYSTEMTIME lt;
|
||||
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";
|
||||
|
@ -1189,23 +1190,30 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
}
|
||||
|
||||
// At this stage with have both a handle and a lock to the physical drive...
|
||||
if (!GetDriveLetter(DriveIndex, &drive_name[0])) {
|
||||
if (!GetDriveLetters(DriveIndex, drive_letters)) {
|
||||
uprintf("Failed to get a drive letter\n");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_ASSIGN_LETTER);
|
||||
goto out;
|
||||
}
|
||||
if (drive_name[0] == ' ') {
|
||||
if (drive_letters[0] == 0) {
|
||||
uprintf("No drive letter was assigned...\n");
|
||||
drive_name[0] = GetUnusedDriveLetter();
|
||||
if (drive_name[0] == ' ') {
|
||||
if (drive_name[0] == 0) {
|
||||
uprintf("Could not find a suitable drive letter\n");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_ASSIGN_LETTER);
|
||||
goto out;
|
||||
}
|
||||
} else if (!DeleteVolumeMountPointA(drive_name)) {
|
||||
} else {
|
||||
// Unmount all mounted volumes that belong to this drive
|
||||
// Do it in reverse so that we always end on the first volume letter
|
||||
for (i=(int)safe_strlen(drive_letters); i>0; i--) {
|
||||
drive_name[0] = drive_letters[i-1];
|
||||
if (!DeleteVolumeMountPointA(drive_name)) {
|
||||
uprintf("Failed to delete mountpoint %s: %s\n", drive_name, WindowsErrorString());
|
||||
// Try to continue. We will bail out if this causes an issue.
|
||||
}
|
||||
}
|
||||
}
|
||||
uprintf("Will use '%c:' as volume mountpoint\n", drive_name[0]);
|
||||
|
||||
// ...but we need a lock to the logical drive to be able to write anything to it
|
||||
|
|
|
@ -693,10 +693,10 @@ int64_t ExtractISOFile(const char* iso, const char* iso_file, const char* dest_f
|
|||
{
|
||||
size_t i;
|
||||
ssize_t read_size;
|
||||
int64_t file_length;
|
||||
int64_t file_length, r = 0;
|
||||
char buf[UDF_BLOCKSIZE];
|
||||
DWORD buf_size, wr_size;
|
||||
BOOL s, r = 0;
|
||||
BOOL s;
|
||||
iso9660_t* p_iso = NULL;
|
||||
udf_t* p_udf = NULL;
|
||||
udf_dirent_t *p_udf_root = NULL, *p_udf_file = NULL;
|
||||
|
|
50
src/rufus.c
50
src/rufus.c
|
@ -387,7 +387,8 @@ static BOOL GetDriveInfo(int ComboIndex)
|
|||
memset(&SelectedDrive, 0, sizeof(SelectedDrive));
|
||||
SelectedDrive.DeviceNumber = (DWORD)ComboBox_GetItemData(hDeviceList, ComboIndex);
|
||||
|
||||
if (!GetDrivePartitionData(SelectedDrive.DeviceNumber, fs_type, sizeof(fs_type)))
|
||||
SelectedDrive.nPartitions = GetDrivePartitionData(SelectedDrive.DeviceNumber, fs_type, sizeof(fs_type));
|
||||
if (SelectedDrive.nPartitions == 0)
|
||||
return FALSE;
|
||||
|
||||
if (!DefineClusterSizes()) {
|
||||
|
@ -639,6 +640,7 @@ static BOOL GetUSBDevices(DWORD devnum)
|
|||
// The rest are the vendor UASP drivers I know of so far - list may be incomplete!
|
||||
const char* usbstor_name[] = { "USBSTOR", "UASPSTOR", "VUSBSTOR", "EtronSTOR" };
|
||||
const char* scsi_name = "SCSI";
|
||||
char letter_name[] = " (?:)";
|
||||
BOOL r, found = FALSE, is_SCSI, is_UASP;
|
||||
HDEVINFO dev_info = NULL;
|
||||
SP_DEVINFO_DATA dev_info_data;
|
||||
|
@ -652,7 +654,7 @@ static BOOL GetUSBDevices(DWORD devnum)
|
|||
LONG maxwidth = 0;
|
||||
RECT rect;
|
||||
int s, score;
|
||||
char drive_letter, *devid, *devid_list = NULL;
|
||||
char drive_letters[27], *devid, *devid_list = NULL, entry_msg[128];
|
||||
char *label, *entry, buffer[MAX_PATH], str[sizeof("0000:0000")+1];
|
||||
uint16_t vid, pid;
|
||||
GUID _GUID_DEVINTERFACE_DISK = // only known to some...
|
||||
|
@ -816,7 +818,7 @@ static BOOL GetUSBDevices(DWORD devnum)
|
|||
break;
|
||||
}
|
||||
|
||||
if (GetDriveLabel(drive_index, &drive_letter, &label)) {
|
||||
if (GetDriveLabel(drive_index, drive_letters, &label)) {
|
||||
if ((!enable_HDDs) && ((score = IsHDD(drive_index, vid, pid, buffer)) > 0)) {
|
||||
uprintf("Device eliminated because it was detected as an USB Hard Drive (score %d > 0)\n", score);
|
||||
uprintf("If this device is not an USB Hard Drive, please e-mail the author of this application\n");
|
||||
|
@ -826,17 +828,28 @@ static BOOL GetUSBDevices(DWORD devnum)
|
|||
break;
|
||||
}
|
||||
|
||||
// Drive letter ' ' is returned for drives that don't have a volume assigned yet
|
||||
if (drive_letter == ' ') {
|
||||
// The empty string is returned for drives that don't have any volumes assigned
|
||||
if (drive_letters[0] == 0) {
|
||||
entry = lmprintf(MSG_046, label, device_number.DeviceNumber);
|
||||
} else {
|
||||
if (drive_letter == app_dir[0]) {
|
||||
uprintf("Removing %c: from the list: This is the disk from which " APPLICATION_NAME " is running!\n", drive_letter);
|
||||
// We have multiple volumes assigned to the same device (multiple partitions)
|
||||
// If that is the case, use "Multiple Volumes" instead of the label
|
||||
safe_strcpy(entry_msg, sizeof(entry_msg), ((drive_letters[0] != 0) && (drive_letters[1] != 0))?
|
||||
lmprintf(MSG_047):label);
|
||||
for (k=0; drive_letters[k]; k++) {
|
||||
// Append all the drive letters we detected
|
||||
letter_name[2] = drive_letters[k];
|
||||
safe_strcat(entry_msg, sizeof(entry_msg), letter_name);
|
||||
if (drive_letters[k] == app_dir[0]) break;
|
||||
}
|
||||
// Repeat as we need to break the outside loop
|
||||
if (drive_letters[k] == app_dir[0]) {
|
||||
uprintf("Removing %c: from the list: This is the disk from which " APPLICATION_NAME " is running!\n", app_dir[0]);
|
||||
safe_closehandle(hDrive);
|
||||
safe_free(devint_detail_data);
|
||||
break;
|
||||
}
|
||||
entry = lmprintf(MSG_047, label, drive_letter);
|
||||
entry = entry_msg;
|
||||
}
|
||||
|
||||
// Must ensure that the combo box is UNSORTED for indexes to be the same
|
||||
|
@ -1380,9 +1393,9 @@ static BOOL BootCheck(void)
|
|||
}
|
||||
if ((SL_MAJOR(iso_report.sl_version) >= 5) && (iso_report.sl_version != embedded_sl_version[1])) {
|
||||
// Unlike what was the case for v4 and earlier, Syslinux v5+ versions are INCOMPATIBLE with one another!
|
||||
_chdirU(app_dir);
|
||||
_mkdir(FILES_DIR);
|
||||
_chdir(FILES_DIR);
|
||||
IGNORE_RETVAL(_chdirU(app_dir));
|
||||
IGNORE_RETVAL(_mkdir(FILES_DIR));
|
||||
IGNORE_RETVAL(_chdir(FILES_DIR));
|
||||
for (i=0; i<2; i++) {
|
||||
// Check if we already have the relevant ldlinux_v#.##.sys & ldlinux_v#.##.bss files
|
||||
static_sprintf(tmp, "%s-%s/%s.%s", syslinux, &iso_report.sl_version_str[1], ldlinux, ldlinux_ext[i]);
|
||||
|
@ -1403,7 +1416,7 @@ static BOOL BootCheck(void)
|
|||
return FALSE;
|
||||
for (i=0; i<2; i++) {
|
||||
static_sprintf(tmp, "%s-%s", syslinux, &iso_report.sl_version_str[1]);
|
||||
_mkdir(tmp);
|
||||
IGNORE_RETVAL(_mkdir(tmp));
|
||||
static_sprintf(tmp, "%s.%s %s", ldlinux, ldlinux_ext[i], iso_report.sl_version_str);
|
||||
SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, tmp));
|
||||
static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, &iso_report.sl_version_str[1], ldlinux, ldlinux_ext[i]);
|
||||
|
@ -1417,9 +1430,9 @@ static BOOL BootCheck(void)
|
|||
}
|
||||
}
|
||||
} else if (dt == DT_SYSLINUX_V5) {
|
||||
_chdirU(app_dir);
|
||||
_mkdir(FILES_DIR);
|
||||
_chdir(FILES_DIR);
|
||||
IGNORE_RETVAL(_chdirU(app_dir));
|
||||
IGNORE_RETVAL(_mkdir(FILES_DIR));
|
||||
IGNORE_RETVAL(_chdir(FILES_DIR));
|
||||
static_sprintf(tmp, "%s-%s/%s.%s", syslinux, &embedded_sl_version_str[1][1], ldlinux, ldlinux_ext[2]);
|
||||
fd = fopenU(tmp, "rb");
|
||||
if (fd != NULL) {
|
||||
|
@ -1435,7 +1448,7 @@ static BOOL BootCheck(void)
|
|||
return FALSE;
|
||||
if (r == IDYES) {
|
||||
static_sprintf(tmp, "%s-%s", syslinux, &embedded_sl_version_str[1][1]);
|
||||
_mkdir(tmp);
|
||||
IGNORE_RETVAL(_mkdir(tmp));
|
||||
static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, &embedded_sl_version_str[1][1], ldlinux, ldlinux_ext[2]);
|
||||
SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, tmp));
|
||||
SetWindowTextU(hISOFileName, tmp);
|
||||
|
@ -2037,6 +2050,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
format_op_in_progress = FALSE;
|
||||
break;
|
||||
}
|
||||
if ((SelectedDrive.nPartitions > 1) && (MessageBoxU(hMainDialog, lmprintf(MSG_093),
|
||||
lmprintf(MSG_094), MB_OKCANCEL|MB_ICONWARNING) == IDCANCEL)) {
|
||||
format_op_in_progress = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Disable all controls except cancel
|
||||
EnableControls(FALSE);
|
||||
|
|
|
@ -196,6 +196,7 @@ typedef struct {
|
|||
DWORD FirstSector;
|
||||
char proposed_label[16];
|
||||
int PartitionType;
|
||||
int nPartitions;
|
||||
int FSType;
|
||||
BOOL has_protective_mbr;
|
||||
BOOL has_mbr_uefi_marker;
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,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
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Rufus v1.4.3.386"
|
||||
CAPTION "Rufus v1.4.3.387"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
|
||||
|
@ -288,8 +288,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,4,3,386
|
||||
PRODUCTVERSION 1,4,3,386
|
||||
FILEVERSION 1,4,3,387
|
||||
PRODUCTVERSION 1,4,3,387
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -306,13 +306,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.4.3.386"
|
||||
VALUE "FileVersion", "1.4.3.387"
|
||||
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.3.386"
|
||||
VALUE "ProductVersion", "1.4.3.387"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -104,7 +104,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter)
|
|||
|
||||
/* Access a copy of the ldlinux.sys & ldlinux.bss resources (downloaded or embedded) */
|
||||
if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) {
|
||||
_chdirU(app_dir);
|
||||
IGNORE_RETVAL(_chdirU(app_dir));
|
||||
for (i=0; i<2; i++) {
|
||||
syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]);
|
||||
if (syslinux_ldlinux[i] == NULL)
|
||||
|
@ -237,9 +237,9 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter)
|
|||
uprintf("Successfully wrote Syslinux boot record\n");
|
||||
|
||||
if (dt == DT_SYSLINUX_V5) {
|
||||
_chdirU(app_dir);
|
||||
IGNORE_RETVAL(_chdirU(app_dir));
|
||||
static_sprintf(path, "%s/%s-%s", FILES_DIR, syslinux, &embedded_sl_version_str[1][1]);
|
||||
_chdir(path);
|
||||
IGNORE_RETVAL(_chdir(path));
|
||||
static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]);
|
||||
fd = fopen(&path[3], "rb");
|
||||
if (fd == NULL) {
|
||||
|
|
Loading…
Reference in a new issue