getNumberOfSectors() returns incorrect number
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Image Writer |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The function getNumberOfSectors is not returning the actual sector count. For example, on one of my 32 GB sd-cards with 64845824 sectors the function returns 64838340. This means that the whole disk is not read when doing an image read from the SD card.
Below is a version of getNumberOfSectors that returns the correct number:
unsigned long long getNumberOfSect
{
DWORD junk;
DISK_GEOMETRY geometry;
PARTITION_
BOOL bResult;
bResult = DeviceIoControl
DeviceIoCont
if (!bResult)
{
char *errormessage=NULL;
FormatMessage
QMessageBox:
LocalFree(
return 0;
}
if (sectorsize != NULL)
*sectorsize = (unsigned long long)geometry.
return (unsigned long long)part.
}
Related branches
Changed in win32-image-writer: | |
status: | New → Fix Released |
Thanks for the patch. So the length of a partition (in sectors) is not necessarily equal to the cylinders * tracks * sectors given in the DISK_GEOMETRY struct. Good to know, I guess.
I wonder if using the "disk size (in bytes)" field of the DISK_GEOMETRY_EX structure would report the same as C*T*S*Bytes (per sector), or the same as the partition info.
At any rate - thanks again for the patch, and I'll get it incorporated for a future release.