summaryrefslogtreecommitdiffstats
path: root/src/ewf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-03-14 08:57:10 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2008-03-14 08:57:10 +0100
commit5148a5273b97c61a5625a9d900b835d41954c101 (patch)
tree49cf194e13515ca08e97a4da64d56c72f505f6f8 /src/ewf.c
parent12e2a801d6d465ce4bc73abefec04aa96d83fb00 (diff)
In latest libewf beta, libewf_get_bytes_per_sector() and libewf_get_media_size() take 2 arguments
Diffstat (limited to 'src/ewf.c')
-rw-r--r--src/ewf.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/ewf.c b/src/ewf.c
index 4152f73..ed45d5d 100644
--- a/src/ewf.c
+++ b/src/ewf.c
@@ -124,13 +124,33 @@ disk_t *fewf_init(const char *device, const int verbose, const arch_fnct_t *arch
}
disk_car=(disk_t *)MALLOC(sizeof(*disk_car));
disk_car->arch=arch;
+#ifdef LIBEWF_GET_BYTES_PER_SECTOR_HAVE_TWO_ARGUMENTS
+ {
+ uint32_t bytes_per_sector;
+ if(libewf_get_bytes_per_sector(data->handle, &bytes_per_sector)<0)
+ disk_car->sector_size=DEFAULT_SECTOR_SIZE;
+ else
+ disk_car->sector_size=bytes_per_sector;
+ }
+#else
disk_car->sector_size=libewf_get_bytes_per_sector(data->handle);
+#endif
// printf("libewf_get_bytes_per_sector %u\n",disk_car->sector_size);
if(disk_car->sector_size==0)
disk_car->sector_size=DEFAULT_SECTOR_SIZE;
+#ifdef LIBEWF_GET_MEDIA_SIZE_HAVE_TWO_ARGUMENTS
+ {
+ size64_t media_size;
+ if(libewf_get_media_size(data->handle, &media_size)<0)
+ disk_car->disk_size=0;
+ else
+ disk_car->disk_size=media_size;
+ }
+#else
disk_car->disk_size=libewf_get_media_size(data->handle);
- disk_car->disk_real_size=disk_car->disk_size;
+#endif
// printf("libewf_get_media_size %llu\n",(long long unsigned) (disk_car->sector_size/disk_car->sector_size));
+ disk_car->disk_real_size=disk_car->disk_size;
disk_car->CHS.head=255-1;
disk_car->CHS.sector=63;
disk_car->CHS.cylinder=(disk_car->disk_size/(disk_car->CHS.head+1))/disk_car->CHS.sector/disk_car->sector_size-1;