summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-03-03 06:51:52 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2017-03-03 06:51:52 +0100
commit1823a008fc22a9357ab3e1c9e1478419409bcd83 (patch)
treec2b1813a0588fe6564c363a9298b7f8d8316ac56
parent269d963ccef978d1a34f134f73521af875d7f214 (diff)
Add support for libewf 20160424
-rw-r--r--configure.ac2
-rw-r--r--src/ewf.c22
2 files changed, 23 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 8f17de0..fe000e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -872,7 +872,7 @@ case "$target" in
;;
esac
-AC_CHECK_FUNCS([ atexit atoll chdir chmod delscreen dirname dup2 execv fdatasync fseeko fsync ftello ftruncate getcwd geteuid getpwuid lstat memalign memchr memset mkdir posix_fadvise posix_memalign pwrite readlink setenv setlocale sigaction signal sleep snprintf strcasecmp strcasestr strchr strdup strerror strncasecmp strptime strrchr strstr strtol strtoul strtoull touchwin uname utime vsnprintf wctomb ])
+AC_CHECK_FUNCS([ atexit atoll chdir chmod delscreen dirname dup2 execv fdatasync fseeko fsync ftello ftruncate getcwd geteuid getpwuid libewf_handle_read_buffer_at_offset libewf_handle_write_buffer_at_offset lstat memalign memchr memset mkdir posix_fadvise posix_memalign pwrite readlink setenv setlocale sigaction signal sleep snprintf strcasecmp strcasestr strchr strdup strerror strncasecmp strptime strrchr strstr strtol strtoul strtoull touchwin uname utime vsnprintf wctomb ])
if test "$ac_cv_func_mkdir" = "no"; then
AC_MSG_ERROR(No mkdir function detected)
fi
diff --git a/src/ewf.c b/src/ewf.c
index 4cc084e..7d7c3d6 100644
--- a/src/ewf.c
+++ b/src/ewf.c
@@ -191,7 +191,11 @@ disk_t *fewf_init(const char *device, const int mode)
data->handle,
filenames,
num_files,
+#ifdef LIBEWF_OPEN_READ_WRITE
LIBEWF_OPEN_READ_WRITE,
+#else
+ LIBEWF_OPEN_READ | LIBEWF_OPEN_WRITE,
+#endif
&ewf_error) != 1 )
{
char buffer[4096];
@@ -431,12 +435,21 @@ static int fewf_pread(disk_t *disk, void *buffer, const unsigned int count, cons
struct info_fewf_struct *data=(struct info_fewf_struct *)disk->data;
int64_t taille;
#if defined( HAVE_LIBEWF_V2_API )
+#if defined( HAVE_LIBEWF_HANDLE_READ_BUFFER_AT_OFFSET )
+ taille = libewf_handle_read_buffer_at_offset(
+ data->handle,
+ buffer,
+ count,
+ offset,
+ NULL );
+#else
taille = libewf_handle_read_random(
data->handle,
buffer,
count,
offset,
NULL );
+#endif
#else
taille=libewf_read_random(data->handle, buffer, count, offset);
#endif
@@ -462,12 +475,21 @@ static int fewf_pwrite(disk_t *disk, const void *buffer, const unsigned int coun
struct info_fewf_struct *data=(struct info_fewf_struct *)disk->data;
int64_t taille;
#if defined( HAVE_LIBEWF_V2_API )
+#if defined( HAVE_LIBEWF_HANDLE_WRITE_BUFFER_AT_OFFSET )
+ taille = libewf_handle_write_buffer_at_offset(
+ data->handle,
+ buffer,
+ count,
+ offset,
+ NULL );
+#else
taille = libewf_handle_write_random(
data->handle,
buffer,
count,
offset,
NULL );
+#endif
#else
taille=libewf_write_random(data->handle, buffer, count, offset);
#endif