diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ipodpatcher/ipodpatcher.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tools/ipodpatcher/ipodpatcher.c b/tools/ipodpatcher/ipodpatcher.c index 2614849260..32c1291ab4 100644 --- a/tools/ipodpatcher/ipodpatcher.c +++ b/tools/ipodpatcher/ipodpatcher.c | |||
@@ -311,13 +311,14 @@ int main(int argc, char* argv[]) | |||
311 | int p = 0; | 311 | int p = 0; |
312 | int diskno = -1; | 312 | int diskno = -1; |
313 | int sector_size; | 313 | int sector_size; |
314 | DISK_GEOMETRY_EX diskgeometry; | 314 | DISK_GEOMETRY_EX diskgeometry_ex; |
315 | DISK_GEOMETRY diskgeometry; | ||
315 | char diskname[32]; | 316 | char diskname[32]; |
316 | HANDLE dh; | 317 | HANDLE dh; |
317 | char* filename = NULL; | 318 | char* filename = NULL; |
318 | off_t inputsize; | 319 | off_t inputsize; |
319 | 320 | ||
320 | fprintf(stderr,"ipodpatcher v0.4 - (C) Dave Chapman 2006\n"); | 321 | fprintf(stderr,"ipodpatcher v0.4b - (C) Dave Chapman 2006\n"); |
321 | fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n"); | 322 | fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n"); |
322 | fprintf(stderr,"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); | 323 | fprintf(stderr,"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); |
323 | 324 | ||
@@ -385,16 +386,27 @@ int main(int argc, char* argv[]) | |||
385 | IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, | 386 | IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, |
386 | NULL, | 387 | NULL, |
387 | 0, | 388 | 0, |
388 | &diskgeometry, | 389 | &diskgeometry_ex, |
389 | sizeof(diskgeometry), | 390 | sizeof(diskgeometry_ex), |
390 | &n, | 391 | &n, |
391 | NULL)) { | 392 | NULL)) { |
392 | error(" Error reading disk geometry: "); | 393 | if (!DeviceIoControl(dh, |
393 | return 2; | 394 | IOCTL_DISK_GET_DRIVE_GEOMETRY, |
395 | NULL, | ||
396 | 0, | ||
397 | &diskgeometry, | ||
398 | sizeof(diskgeometry), | ||
399 | &n, | ||
400 | NULL)) { | ||
401 | error(" Error reading disk geometry: "); | ||
402 | return 2; | ||
403 | } else { | ||
404 | sector_size=diskgeometry.BytesPerSector; | ||
405 | } | ||
406 | } else { | ||
407 | sector_size=diskgeometry_ex.Geometry.BytesPerSector; | ||
394 | } | 408 | } |
395 | 409 | ||
396 | sector_size=diskgeometry.Geometry.BytesPerSector; | ||
397 | |||
398 | fprintf(stderr,"[INFO] Reading partition table from %s\n",diskname); | 410 | fprintf(stderr,"[INFO] Reading partition table from %s\n",diskname); |
399 | fprintf(stderr,"[INFO] Sector size is %d bytes\n",sector_size); | 411 | fprintf(stderr,"[INFO] Sector size is %d bytes\n",sector_size); |
400 | 412 | ||