Commit e9c0822655af530f534e0597575b69d5e5f2fa66
1 parent
3f6ffb6a
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
Showing
1 changed file
with
4 additions
and
5 deletions
block-raw.c
... | ... | @@ -1174,7 +1174,7 @@ static int64_t raw_getlength(BlockDriverState *bs) |
1174 | 1174 | BDRVRawState *s = bs->opaque; |
1175 | 1175 | LARGE_INTEGER l; |
1176 | 1176 | ULARGE_INTEGER available, total, total_free; |
1177 | - DISK_GEOMETRY dg; | |
1177 | + DISK_GEOMETRY_EX dg; | |
1178 | 1178 | DWORD count; |
1179 | 1179 | BOOL status; |
1180 | 1180 | |
... | ... | @@ -1190,11 +1190,10 @@ static int64_t raw_getlength(BlockDriverState *bs) |
1190 | 1190 | l.QuadPart = total.QuadPart; |
1191 | 1191 | break; |
1192 | 1192 | case FTYPE_HARDDISK: |
1193 | - status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY, | |
1193 | + status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, | |
1194 | 1194 | NULL, 0, &dg, sizeof(dg), &count, NULL); |
1195 | - if (status != FALSE) { | |
1196 | - l.QuadPart = dg.Cylinders.QuadPart * dg.TracksPerCylinder | |
1197 | - * dg.SectorsPerTrack * dg.BytesPerSector; | |
1195 | + if (status != 0) { | |
1196 | + l = dg.DiskSize; | |
1198 | 1197 | } |
1199 | 1198 | break; |
1200 | 1199 | default: | ... | ... |