diff options
author | Dave Chapman <dave@dchapman.com> | 2006-12-13 08:59:58 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-12-13 08:59:58 +0000 |
commit | 8a55822ae3e6150e57bd80fc225e196761453bfc (patch) | |
tree | a7ad1515996e21d6f3806a9e6a7b0c6ddc2cdd58 /tools/ipodpatcher/ipodpatcher.c | |
parent | 206238d947ae1727a994e9cb8cf6401f40763a48 (diff) | |
download | rockbox-8a55822ae3e6150e57bd80fc225e196761453bfc.tar.gz rockbox-8a55822ae3e6150e57bd80fc225e196761453bfc.zip |
Version 0.4b from 11 Dec 2006 - 0.4 broke win2k/winnt support, this patch restores it
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11747 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/ipodpatcher/ipodpatcher.c')
-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 | ||