aboutsummaryrefslogtreecommitdiff
path: root/block-raw.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-20 20:40:05 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-20 20:40:05 +0000
commite9c0822655af530f534e0597575b69d5e5f2fa66 (patch)
treefcd62d37979a72cc8029d14a2f39af21580ff3d4 /block-raw.c
parent3f6ffb6ac9709b6b9422e20c29f6bf4556c3af09 (diff)
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
Diffstat (limited to 'block-raw.c')
-rw-r--r--block-raw.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/block-raw.c b/block-raw.c
index 2f2e19f9bb..1e5e5d15ed 100644
--- a/block-raw.c
+++ b/block-raw.c
@@ -1174,7 +1174,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
BDRVRawState *s = bs->opaque;
LARGE_INTEGER l;
ULARGE_INTEGER available, total, total_free;
- DISK_GEOMETRY dg;
+ DISK_GEOMETRY_EX dg;
DWORD count;
BOOL status;
@@ -1190,11 +1190,10 @@ static int64_t raw_getlength(BlockDriverState *bs)
l.QuadPart = total.QuadPart;
break;
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);
- if (status != FALSE) {
- l.QuadPart = dg.Cylinders.QuadPart * dg.TracksPerCylinder
- * dg.SectorsPerTrack * dg.BytesPerSector;
+ if (status != 0) {
+ l = dg.DiskSize;
}
break;
default: