mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ui] display size in the dropdown entry
* Also remove the "(Default)" from the FS selected, in the log messages
This commit is contained in:
parent
9927cc2619
commit
94ce19d11f
8 changed files with 101 additions and 90 deletions
|
@ -186,7 +186,7 @@ t MSG_042 "Error"
|
|||
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_046 "%s (Disk %d) [%s]"
|
||||
# Used when a drive is detected that contains more than one partition
|
||||
t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Flushing buffers"
|
||||
|
@ -628,7 +628,7 @@ t MSG_042 "错误"
|
|||
t MSG_043 "错误:%s"
|
||||
t MSG_044 "文件下载"
|
||||
t MSG_045 "通用 USB 存储设备"
|
||||
t MSG_046 "%s (磁盘 %d)"
|
||||
t MSG_046 "%s (磁盘 %d) [%s]"
|
||||
t MSG_047 "多分区磁盘"
|
||||
t MSG_048 "Rufus - 刷新缓冲区"
|
||||
t MSG_049 "Rufus - 取消"
|
||||
|
@ -999,7 +999,7 @@ t MSG_042 "錯誤"
|
|||
t MSG_043 "錯誤: %s"
|
||||
t MSG_044 "檔案下載"
|
||||
t MSG_045 "USB 裝置"
|
||||
t MSG_046 "%s (磁碟 %d)"
|
||||
t MSG_046 "%s (磁碟 %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - 排清緩衝區"
|
||||
t MSG_049 "Rufus - 取消"
|
||||
|
@ -1384,7 +1384,7 @@ t MSG_042 "Fout"
|
|||
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_046 "%s (Disk %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Buffers aan het legen"
|
||||
t MSG_049 "Rufus - Annulering"
|
||||
|
@ -1752,7 +1752,7 @@ t MSG_042 "Virhe"
|
|||
t MSG_043 "Virhe: %s"
|
||||
t MSG_044 "Tiedoston lataus"
|
||||
t MSG_045 "USB-tallennuslaite (Yleinen)"
|
||||
t MSG_046 "%s (Levy %d)"
|
||||
t MSG_046 "%s (Levy %d) [%s]"
|
||||
# Used when a drive is detected that contains more than one partition
|
||||
t MSG_047 "Useita osioita"
|
||||
t MSG_048 "Rufus - Tyhjennetään puskuria"
|
||||
|
@ -2133,7 +2133,7 @@ t MSG_042 "Erreur"
|
|||
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_046 "%s (Disque %d) [%s]"
|
||||
t MSG_047 "Plusieurs partitions"
|
||||
t MSG_048 "Rufus - Flush de la mémoire tampon"
|
||||
t MSG_049 "Rufus - Annulation"
|
||||
|
@ -2514,7 +2514,7 @@ t MSG_042 "Fehler"
|
|||
t MSG_043 "Fehler: %s"
|
||||
t MSG_044 "Dateidownload"
|
||||
t MSG_045 "USB Massenspeichergerät (Allgemein)"
|
||||
t MSG_046 "%s (Disk %d)"
|
||||
t MSG_046 "%s (Disk %d) [%s]"
|
||||
t MSG_047 "Mehrere Partitionen"
|
||||
t MSG_048 "Rufus - Leere Puffer"
|
||||
t MSG_049 "Rufus - Abbrechen"
|
||||
|
@ -2932,7 +2932,7 @@ t MSG_042 "Σφάλμα"
|
|||
t MSG_043 "Σφάλμα: %s"
|
||||
t MSG_044 "Λήψη αρχείου"
|
||||
t MSG_045 "Συσκευή αποθήκευσης USB(Generic)"
|
||||
t MSG_046 "%s (Δίσκος %d)"
|
||||
t MSG_046 "%s (Δίσκος %d) [%s]"
|
||||
t MSG_047 "Πολλαπλοί Διαμερισμοί"
|
||||
t MSG_048 "Rufus - Flushing προσωρινής μνήμης"
|
||||
t MSG_049 "Rufus - Ακύρωση"
|
||||
|
@ -3300,7 +3300,7 @@ t MSG_042 "Hiba"
|
|||
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_046 "%s (Lemez: %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Bufferelés"
|
||||
t MSG_049 "Rufus - Megszakítás"
|
||||
|
@ -3696,7 +3696,7 @@ t MSG_042 "Kesalahan"
|
|||
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_046 "%s (Disk %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Flushing buffers"
|
||||
t MSG_049 "Rufus - Pembatalan"
|
||||
|
@ -4073,7 +4073,7 @@ t MSG_042 "Errore"
|
|||
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_046 "%s (disco %d) [%s]"
|
||||
t MSG_047 "Partizioni multiple"
|
||||
t MSG_048 "Rufus - Svuotamento buffer"
|
||||
t MSG_049 "Rufus - Cancellazione"
|
||||
|
@ -4448,7 +4448,7 @@ t MSG_042 "오류"
|
|||
t MSG_043 "오류: %s"
|
||||
t MSG_044 "다운로드 파일"
|
||||
t MSG_045 "USB 저장 장치 (일반)"
|
||||
t MSG_046 "%s (디스크 %d)"
|
||||
t MSG_046 "%s (디스크 %d) [%s]"
|
||||
t MSG_047 "다중 파티션"
|
||||
t MSG_048 "Rufus - 버퍼 비움"
|
||||
t MSG_049 "Rufus - 해제"
|
||||
|
@ -4862,7 +4862,7 @@ t MSG_042 "Klaida"
|
|||
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_046 "%s (diskas %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - išvalomi buferiai"
|
||||
t MSG_049 "Rufus - atšaukimas"
|
||||
|
@ -5264,7 +5264,7 @@ t MSG_042 "Error"
|
|||
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_046 "%s (Disk %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Mengeflush buffer"
|
||||
t MSG_049 "Rufus - Dibatalkan"
|
||||
|
@ -5664,7 +5664,7 @@ t MSG_042 "Błąd"
|
|||
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_046 "%s (Dysk %d) [%s]"
|
||||
t MSG_047 "Wiele Partycji"
|
||||
t MSG_048 "Rufus - Czyszczenie buforów"
|
||||
t MSG_049 "Rufus - Anulowanie"
|
||||
|
@ -6085,7 +6085,7 @@ t MSG_042 "Erro"
|
|||
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_046 "%s (Disco %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Limpando os buffers"
|
||||
t MSG_049 "Rufus - Cancelamento"
|
||||
|
@ -6470,7 +6470,7 @@ t MSG_042 "Eroare"
|
|||
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_046 "%s (disc %d) [%s]"
|
||||
t MSG_047 "Volume multiple"
|
||||
t MSG_048 "Rufus - Ştergere bufer"
|
||||
t MSG_049 "Rufus - Anulare"
|
||||
|
@ -6866,7 +6866,7 @@ t MSG_042 "Ошибка"
|
|||
t MSG_043 "Ошибка: %s"
|
||||
t MSG_044 "Скачивание файла"
|
||||
t MSG_045 "USB-устройство хранения данных"
|
||||
t MSG_046 "%s (Диск %d)"
|
||||
t MSG_046 "%s (Диск %d) [%s]"
|
||||
t MSG_047 "Несколько разделов"
|
||||
t MSG_048 "Буфер"
|
||||
t MSG_049 "Отмена"
|
||||
|
@ -7250,7 +7250,7 @@ t MSG_042 "Napaka"
|
|||
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_046 "%s (disk %d) [%s]"
|
||||
t MSG_047 "več particij"
|
||||
t MSG_048 "Rufus - izpiranje medpomnilnika"
|
||||
t MSG_049 "Rufus - preklic"
|
||||
|
@ -7663,7 +7663,7 @@ t MSG_042 "Error"
|
|||
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_046 "%s (Disco %d) [%s]"
|
||||
# t MSG_047 "Multiple Partitions"
|
||||
t MSG_048 "Rufus - Purgando los búfers"
|
||||
t MSG_049 "Rufus - Cancelación"
|
||||
|
@ -8064,7 +8064,7 @@ t MSG_042 "Hata"
|
|||
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_046 "%s (Disk %d) [%s]"
|
||||
t MSG_047 "Çoklu Disk Birimleri"
|
||||
t MSG_048 "Rufus - Tamponlanıyor"
|
||||
t MSG_049 "Rufus - Vazgeçme"
|
||||
|
|
|
@ -647,7 +647,7 @@ int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSyst
|
|||
part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType;
|
||||
uprintf(" Type: %s (0x%02x)\r\n Size: %s (%lld bytes)\r\n Start Sector: %d, Boot: %s, Recognized: %s\n",
|
||||
((part_type==0x07)&&(FileSystemName[0]!=0))?FileSystemName:GetPartitionType(part_type), part_type,
|
||||
SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE),
|
||||
SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE, FALSE),
|
||||
DriveLayout->PartitionEntry[i].PartitionLength, DriveLayout->PartitionEntry[i].Mbr.HiddenSectors,
|
||||
DriveLayout->PartitionEntry[i].Mbr.BootIndicator?"Yes":"No",
|
||||
DriveLayout->PartitionEntry[i].Mbr.RecognizedPartition?"Yes":"No");
|
||||
|
@ -671,7 +671,7 @@ int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSyst
|
|||
uprintf("Partition %d:\r\n Type: %s\r\n Name: '%s'\n", DriveLayout->PartitionEntry[i].PartitionNumber,
|
||||
GuidToString(&DriveLayout->PartitionEntry[i].Gpt.PartitionType), tmp);
|
||||
uprintf(" ID: %s\r\n Size: %s (%lld bytes)\r\n Start Sector: %lld, Attributes: 0x%016llX\n",
|
||||
GuidToString(&DriveLayout->PartitionEntry[i].Gpt.PartitionId), SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE),
|
||||
GuidToString(&DriveLayout->PartitionEntry[i].Gpt.PartitionId), SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE, FALSE),
|
||||
DriveLayout->PartitionEntry[i].PartitionLength, DriveLayout->PartitionEntry[i].StartingOffset.QuadPart / DiskGeometry->Geometry.BytesPerSector,
|
||||
DriveLayout->PartitionEntry[i].Gpt.Attributes);
|
||||
}
|
||||
|
|
|
@ -569,7 +569,7 @@ static BOOL FormatFAT32(DWORD DriveIndex)
|
|||
}
|
||||
|
||||
// Now we're committed - print some info first
|
||||
uprintf("Size : %s %u sectors\n", SizeToHumanReadable(piDrive.PartitionLength.QuadPart, TRUE), TotalSectors);
|
||||
uprintf("Size : %s %u sectors\n", SizeToHumanReadable(piDrive.PartitionLength.QuadPart, TRUE, FALSE), TotalSectors);
|
||||
uprintf("Cluster size %d bytes, %d Bytes Per Sector\n", SectorsPerCluster*BytesPerSect, BytesPerSect);
|
||||
uprintf("Volume ID is %x:%x\n", VolumeId>>16, VolumeId&0xffff);
|
||||
uprintf("%d Reserved Sectors, %d Sectors per FAT, %d FATs\n", ReservedSectCount, FatSize, NumFATs);
|
||||
|
@ -673,6 +673,13 @@ static BOOL FormatDrive(DWORD DriveIndex)
|
|||
int fs;
|
||||
|
||||
GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType));
|
||||
// Might have a (Default) suffix => remove it
|
||||
for (i=strlen(FSType); i>2; i--) {
|
||||
if (FSType[i] == '(') {
|
||||
FSType[i-1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) {
|
||||
PrintStatus(0, TRUE, MSG_220, FSType, dur_mins, dur_secs);
|
||||
|
|
|
@ -241,9 +241,9 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
|
|||
nul_pos = safe_strlen(psz_fullpath);
|
||||
for (i=0; i<nul_pos; i++)
|
||||
if (psz_fullpath[i] == '/') psz_fullpath[i] = '\\';
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, TRUE));
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, TRUE, FALSE));
|
||||
uprintf("Extracting: %s\n", psz_fullpath);
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, FALSE));
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, FALSE, FALSE));
|
||||
SetWindowTextU(hISOFileName, psz_fullpath);
|
||||
// Remove the appended size for extraction
|
||||
psz_fullpath[nul_pos] = 0;
|
||||
|
@ -388,9 +388,9 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
|
|||
nul_pos = safe_strlen(psz_fullpath);
|
||||
for (i=0; i<nul_pos; i++)
|
||||
if (psz_fullpath[i] == '/') psz_fullpath[i] = '\\';
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, TRUE));
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, TRUE, FALSE));
|
||||
uprintf("Extracting: %s\n", psz_fullpath);
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, FALSE));
|
||||
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, FALSE, FALSE));
|
||||
SetWindowTextU(hISOFileName, psz_fullpath);
|
||||
// ISO9660 cannot handle backslashes
|
||||
for (i=0; i<nul_pos; i++) if (psz_fullpath[i] == '\\') psz_fullpath[i] = '/';
|
||||
|
|
75
src/rufus.c
75
src/rufus.c
|
@ -380,9 +380,10 @@ static BOOL SetClusterSizes(int FSType)
|
|||
/*
|
||||
* Fill the drive properties (size, FS, etc)
|
||||
*/
|
||||
static BOOL GetDriveInfo(int ComboIndex)
|
||||
static BOOL SetDriveInfo(int ComboIndex)
|
||||
{
|
||||
DWORD i;
|
||||
int pt, bt;
|
||||
char fs_type[32];
|
||||
|
||||
memset(&SelectedDrive, 0, sizeof(SelectedDrive));
|
||||
|
@ -426,6 +427,17 @@ static BOOL GetDriveInfo(int ComboIndex)
|
|||
}
|
||||
}
|
||||
|
||||
for (i=0; i<3; i++) {
|
||||
// Populate MBR/BIOS, MBR/UEFI and GPT/UEFI targets, with an exception
|
||||
// for XP, as it doesn't support GPT at all
|
||||
if ((i == 2) && (nWindowsVersion <= WINDOWS_XP))
|
||||
continue;
|
||||
bt = (i==0)?BT_BIOS:BT_UEFI;
|
||||
pt = (i==2)?PARTITION_STYLE_GPT:PARTITION_STYLE_MBR;
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme, ComboBox_AddStringU(hPartitionScheme,
|
||||
lmprintf((i==0)?MSG_031:MSG_033, PartitionTypeLabel[pt])), (bt<<16)|pt));
|
||||
}
|
||||
|
||||
// At least one filesystem is go => enable formatting
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_START), TRUE);
|
||||
|
||||
|
@ -548,9 +560,7 @@ static void SetTargetSystem(void)
|
|||
*/
|
||||
static BOOL PopulateProperties(int ComboIndex)
|
||||
{
|
||||
double HumanReadableSize;
|
||||
char no_label[] = STR_NO_LABEL;
|
||||
int i, j, pt, bt;
|
||||
const char no_label[] = STR_NO_LABEL;
|
||||
char* device_tooltip;
|
||||
|
||||
IGNORE_RETVAL(ComboBox_ResetContent(hPartitionScheme));
|
||||
|
@ -563,59 +573,24 @@ static BOOL PopulateProperties(int ComboIndex)
|
|||
if (ComboIndex < 0)
|
||||
return TRUE;
|
||||
|
||||
if (!GetDriveInfo(ComboIndex)) // This also populates FS
|
||||
if (!SetDriveInfo(ComboIndex)) // This also populates FS
|
||||
return FALSE;
|
||||
|
||||
HumanReadableSize = (double)SelectedDrive.DiskSize;
|
||||
for (i=1; i<MAX_SIZE_SUFFIXES; i++) {
|
||||
HumanReadableSize /= 1024.0;
|
||||
if (HumanReadableSize < 512.0) {
|
||||
for (j=0; j<3; j++) {
|
||||
// Populate MBR/BIOS, MBR/UEFI and GPT/UEFI targets, with an exception
|
||||
// for XP, as it doesn't support GPT at all
|
||||
if ((j == 2) && (nWindowsVersion <= WINDOWS_XP))
|
||||
continue;
|
||||
bt = (j==0)?BT_BIOS:BT_UEFI;
|
||||
pt = (j==2)?PARTITION_STYLE_GPT:PARTITION_STYLE_MBR;
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme, ComboBox_AddStringU(hPartitionScheme,
|
||||
lmprintf((j==0)?MSG_031:MSG_033, PartitionTypeLabel[pt])), (bt<<16)|pt));
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= MAX_SIZE_SUFFIXES)
|
||||
uprintf("Could not populate partition scheme data\n");
|
||||
|
||||
SetTargetSystem();
|
||||
SetFSFromISO();
|
||||
EnableBootOptions(TRUE);
|
||||
device_tooltip = (char*) malloc(safe_strlen(DriveID.String[ComboIndex]) + 16);
|
||||
|
||||
// Set a proposed label according to the size (eg: "256MB", "8GB")
|
||||
if (HumanReadableSize < 1.0) {
|
||||
HumanReadableSize *= 1024.0;
|
||||
i--;
|
||||
}
|
||||
// If we're beneath the tolerance, round proposed label to an integer, if not, show two decimal points
|
||||
if (fabs(HumanReadableSize / ceil(HumanReadableSize) - 1.0) < PROPOSEDLABEL_TOLERANCE) {
|
||||
safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label),
|
||||
"%0.0f%s", ceil(HumanReadableSize), lmprintf(MSG_020+i));
|
||||
if (device_tooltip != NULL)
|
||||
safe_sprintf(device_tooltip, safe_strlen(DriveID.String[ComboIndex]) + 16,
|
||||
"%s (%0.0f%s)", DriveID.String[ComboIndex], ceil(HumanReadableSize), lmprintf(MSG_020+i));
|
||||
} else {
|
||||
safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label),
|
||||
"%0.2f%s", HumanReadableSize, lmprintf(MSG_020+i));
|
||||
if (device_tooltip != NULL)
|
||||
safe_sprintf(device_tooltip, safe_strlen(DriveID.String[ComboIndex]) + 16,
|
||||
"%s (%0.2f%s)", DriveID.String[ComboIndex], HumanReadableSize, lmprintf(MSG_020+i));
|
||||
}
|
||||
safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label),
|
||||
SizeToHumanReadable(SelectedDrive.DiskSize, FALSE, TRUE));
|
||||
|
||||
// Add a tooltip (with the size of the device in parenthesis)
|
||||
if (device_tooltip != NULL)
|
||||
device_tooltip = (char*) malloc(safe_strlen(DriveID.String[ComboIndex]) + 16);
|
||||
if (device_tooltip != NULL) {
|
||||
safe_sprintf(device_tooltip, safe_strlen(DriveID.String[ComboIndex]) + 16, "%s (%s)",
|
||||
DriveID.String[ComboIndex], SizeToHumanReadable(SelectedDrive.DiskSize, FALSE, FALSE));
|
||||
CreateTooltip(hDeviceList, device_tooltip, -1);
|
||||
safe_free(device_tooltip);
|
||||
free(device_tooltip);
|
||||
}
|
||||
|
||||
// If no existing label is available and no ISO is selected, propose one according to the size (eg: "256MB", "8GB")
|
||||
if ((iso_path == NULL) || (iso_report.label[0] == 0)) {
|
||||
|
@ -821,7 +796,7 @@ static BOOL GetUSBDevices(DWORD devnum)
|
|||
|
||||
// The empty string is returned for drives that don't have any volumes assigned
|
||||
if (drive_letters[0] == 0) {
|
||||
entry = lmprintf(MSG_046, label, drive_number);
|
||||
entry = lmprintf(MSG_046, label, drive_number, SizeToHumanReadable(GetDriveSize(drive_index), FALSE, TRUE));
|
||||
} else {
|
||||
// We have multiple volumes assigned to the same device (multiple partitions)
|
||||
// If that is the case, use "Multiple Volumes" instead of the label
|
||||
|
@ -842,6 +817,8 @@ static BOOL GetUSBDevices(DWORD devnum)
|
|||
safe_free(devint_detail_data);
|
||||
break;
|
||||
}
|
||||
safe_sprintf(&entry_msg[strlen(entry_msg)], sizeof(entry_msg) - strlen(entry_msg),
|
||||
" [%s]", SizeToHumanReadable(GetDriveSize(drive_index), FALSE, TRUE));
|
||||
entry = entry_msg;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#define MAX_GPT_PARTITIONS 128
|
||||
#define MAX_SECTORS_TO_CLEAR 128 // nb sectors to zap when clearing the MBR/GPT (must be >34)
|
||||
#define MBR_UEFI_MARKER 0x49464555 // 'U', 'E', 'F', 'I', as a 32 bit little endian longword
|
||||
#define PROPOSEDLABEL_TOLERANCE 0.10
|
||||
#define WRITE_RETRIES 3
|
||||
#define FS_DEFAULT FS_FAT32
|
||||
#define BADBLOCK_PATTERNS {0xaa, 0x55, 0xff, 0x00}
|
||||
|
@ -319,7 +318,7 @@ extern void PrintStatus(unsigned int duration, BOOL debug, int msg_id, ...);
|
|||
extern void UpdateProgress(int op, float percent);
|
||||
extern const char* StrError(DWORD error_code, BOOL use_default_locale);
|
||||
extern char* GuidToString(const GUID* guid);
|
||||
extern char* SizeToHumanReadable(uint64_t size, BOOL log);
|
||||
extern char* SizeToHumanReadable(uint64_t size, BOOL log, BOOL fake_units);
|
||||
extern void CenterDialog(HWND hDlg);
|
||||
extern void ResizeMoveCtrl(HWND hDlg, HWND hCtrl, int dx, int dy, int dw, int dh);
|
||||
extern void CreateStatusBar(void);
|
||||
|
|
12
src/rufus.rc
12
src/rufus.rc
|
@ -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.5.429"
|
||||
CAPTION "Rufus 1.4.5.430"
|
||||
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.5.429"
|
||||
CAPTION "Rufus 1.4.5.430"
|
||||
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,5,429
|
||||
PRODUCTVERSION 1,4,5,429
|
||||
FILEVERSION 1,4,5,430
|
||||
PRODUCTVERSION 1,4,5,430
|
||||
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.5.429"
|
||||
VALUE "FileVersion", "1.4.5.430"
|
||||
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.5.429"
|
||||
VALUE "ProductVersion", "1.4.5.430"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
38
src/stdio.c
38
src/stdio.c
|
@ -27,6 +27,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "msapi_utf8.h"
|
||||
#include "rufus.h"
|
||||
|
@ -146,19 +147,46 @@ char* GuidToString(const GUID* guid)
|
|||
return guid_string;
|
||||
}
|
||||
|
||||
// Convert a file size to human readable
|
||||
char* SizeToHumanReadable(uint64_t size, BOOL log)
|
||||
// find upper power of 2
|
||||
static __inline uint16_t upo2(uint16_t v)
|
||||
{
|
||||
v--;
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v++;
|
||||
return v;
|
||||
}
|
||||
|
||||
// Convert a size to human readable
|
||||
char* SizeToHumanReadable(uint64_t size, BOOL log, BOOL fake_units)
|
||||
{
|
||||
int suffix = 0;
|
||||
static char str_size[32];
|
||||
double hr_size = (double)size;
|
||||
double t;
|
||||
uint16_t i_size;
|
||||
char **_msg_table = log?default_msg_table:msg_table;
|
||||
while ((suffix < MAX_SIZE_SUFFIXES) && (hr_size >= 1024.0)) {
|
||||
hr_size /= 1024.0;
|
||||
suffix++;
|
||||
const double divider = fake_units?1000.0:1024.0;
|
||||
|
||||
for (suffix=1; suffix<MAX_SIZE_SUFFIXES; suffix++) {
|
||||
hr_size /= divider;
|
||||
if (hr_size < divider) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (suffix == 0) {
|
||||
safe_sprintf(str_size, sizeof(str_size), "%d %s", (int)hr_size, _msg_table[MSG_020-MSG_000]);
|
||||
} else if (fake_units) {
|
||||
if (hr_size < 8) {
|
||||
safe_sprintf(str_size, sizeof(str_size), (fabs((hr_size*10.0)-(floor(hr_size + 0.5)*10.0)) < 0.5)?"%0.0f%s":"%0.1f%s",
|
||||
hr_size, _msg_table[MSG_020+suffix-MSG_000]);
|
||||
} else {
|
||||
t = (double)upo2((uint16_t)hr_size);
|
||||
i_size = (uint16_t)((fabs(1.0f-(hr_size / t)) < 0.05f)?t:hr_size);
|
||||
safe_sprintf(str_size, sizeof(str_size), "%d%s", i_size, _msg_table[MSG_020+suffix-MSG_000]);
|
||||
}
|
||||
} else {
|
||||
safe_sprintf(str_size, sizeof(str_size), "%0.1f %s", hr_size, _msg_table[MSG_020+suffix-MSG_000]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue