Physical hard disk drive for win32, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3420 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
3f6ffb6ac9
commit
e9c0822655
@ -1174,7 +1174,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
|
|||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
LARGE_INTEGER l;
|
LARGE_INTEGER l;
|
||||||
ULARGE_INTEGER available, total, total_free;
|
ULARGE_INTEGER available, total, total_free;
|
||||||
DISK_GEOMETRY dg;
|
DISK_GEOMETRY_EX dg;
|
||||||
DWORD count;
|
DWORD count;
|
||||||
BOOL status;
|
BOOL status;
|
||||||
|
|
||||||
@ -1190,11 +1190,10 @@ static int64_t raw_getlength(BlockDriverState *bs)
|
|||||||
l.QuadPart = total.QuadPart;
|
l.QuadPart = total.QuadPart;
|
||||||
break;
|
break;
|
||||||
case FTYPE_HARDDISK:
|
case FTYPE_HARDDISK:
|
||||||
status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
|
||||||
NULL, 0, &dg, sizeof(dg), &count, NULL);
|
NULL, 0, &dg, sizeof(dg), &count, NULL);
|
||||||
if (status != FALSE) {
|
if (status != 0) {
|
||||||
l.QuadPart = dg.Cylinders.QuadPart * dg.TracksPerCylinder
|
l = dg.DiskSize;
|
||||||
* dg.SectorsPerTrack * dg.BytesPerSector;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user