diff --git a/ChangeLog.txt b/ChangeLog.txt index 589bc8c4..e11a63a3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,10 +2,11 @@ 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 to download extra files) Improve hotplug detection - Fix detection for Toshiba drives (again) + Improve Syslinux v5+ support (requires an internet connection to download extra files) Fix support for latest gparted, ArchLinux, and other Syslinux v5+ based ISOs + Fix detection for Toshiba drives (again) + Fix UDF Unicode support o Version 1.4.3 (2013.01.21) [BUGFIX RELEASE] Fix format operation not starting on Windows XP (reported by ank91) diff --git a/src/drive.c b/src/drive.c index 0687125a..0c797087 100644 --- a/src/drive.c +++ b/src/drive.c @@ -617,7 +617,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), + SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE), DriveLayout->PartitionEntry[i].PartitionLength, DriveLayout->PartitionEntry[i].Mbr.HiddenSectors, DriveLayout->PartitionEntry[i].Mbr.BootIndicator?"Yes":"No", DriveLayout->PartitionEntry[i].Mbr.RecognizedPartition?"Yes":"No"); @@ -641,7 +641,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), + GuidToString(&DriveLayout->PartitionEntry[i].Gpt.PartitionId), SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE), DriveLayout->PartitionEntry[i].PartitionLength, DriveLayout->PartitionEntry[i].StartingOffset.QuadPart / DiskGeometry->Geometry.BytesPerSector, DriveLayout->PartitionEntry[i].Gpt.Attributes); } diff --git a/src/format.c b/src/format.c index dfe8c432..8d3a18a8 100644 --- a/src/format.c +++ b/src/format.c @@ -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), TotalSectors); + uprintf("Size : %s %u sectors\n", SizeToHumanReadable(piDrive.PartitionLength.QuadPart, TRUE), 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); @@ -1184,7 +1184,7 @@ DWORD WINAPI FormatThread(void* param) FILE* log_fd; LARGE_INTEGER li; uint64_t wb; - uint8_t buffer[65536]; + uint8_t *buffer = NULL; char *bb_msg, *guid_volume = NULL; char drive_name[] = "?:\\"; char drive_letters[27]; @@ -1334,11 +1334,18 @@ DWORD WINAPI FormatThread(void* param) } uprintf("Writing Image..."); + buffer = (uint8_t*)malloc(DD_BUFFER_SIZE); + if (buffer == NULL) { + FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY; + uprintf("could not allocate DD buffer"); + goto out; + } + // Don't bother trying for something clever, using double buffering overlapped and whatnot: // With Windows' default optimizations, sync read + sync write for sequential operations // will be as fast, if not faster, than whatever async scheme you can come up with. for (wb = 0; ; wb += wSize) { - s = ReadFile(hSourceImage, buffer, sizeof(buffer), &rSize, NULL); + s = ReadFile(hSourceImage, buffer, DD_BUFFER_SIZE, &rSize, NULL); if (!s) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_READ_FAULT; uprintf("read error: %s", WindowsErrorString()); @@ -1561,6 +1568,7 @@ DWORD WINAPI FormatThread(void* param) out: safe_free(guid_volume); + safe_free(buffer); SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0); safe_closehandle(hSourceImage); safe_unlockclose(hLogicalVolume); diff --git a/src/iso.c b/src/iso.c index ebd44455..43a8af6e 100644 --- a/src/iso.c +++ b/src/iso.c @@ -78,26 +78,6 @@ static uint64_t total_blocks, nb_blocks; static BOOL scan_only = FALSE; static StrArray config_path, isolinux_path; -// TODO: Timestamp & permissions preservation - -// Convert a file size to human readable -static __inline char* size_to_hr(int64_t size) -{ - int suffix = 0; - static char str_size[24]; - double hr_size = (double)size; - while ((suffix < MAX_SIZE_SUFFIXES) && (hr_size >= 1024.0)) { - hr_size /= 1024.0; - suffix++; - } - if (suffix == 0) { - safe_sprintf(str_size, sizeof(str_size), " (%d %s)", (int)hr_size, lmprintf(MSG_020)); - } else { - safe_sprintf(str_size, sizeof(str_size), " (%0.1f %s)", hr_size, lmprintf(MSG_020+suffix)); - } - return str_size; -} - // Ensure filenames do not contain invalid FAT32 or NTFS characters static __inline BOOL sanitize_filename(char* filename) { @@ -261,8 +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= 1024.0)) { hr_size /= 1024.0; suffix++; } if (suffix == 0) { - safe_sprintf(str_size, sizeof(str_size), "%d %s", (int)hr_size, lmprintf(MSG_020)); + safe_sprintf(str_size, sizeof(str_size), "%d %s", (int)hr_size, _msg_table[MSG_020-MSG_000]); } else { - safe_sprintf(str_size, sizeof(str_size), "%0.1f %s", hr_size, lmprintf(MSG_020 + suffix)); + safe_sprintf(str_size, sizeof(str_size), "%0.1f %s", hr_size, _msg_table[MSG_020+suffix-MSG_000]); } return str_size; }