Skip to content
Snippets Groups Projects
Commit fef6484e authored by Eugene Livis's avatar Eugene Livis
Browse files

Added support to identify and open VHD images as part of tsk_img_open()

parent c349a3fc
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
#if HAVE_LIBVMDK #if HAVE_LIBVMDK
#include "tsk/img/vmdk.h" #include "tsk/img/vmdk.h"
#endif #endif
#if HAVE_LIBVHDI
#include "tsk/img/vhd.h"
#endif
#include <string.h> #include <string.h>
#include <algorithm> #include <algorithm>
......
...@@ -31,6 +31,9 @@ typedef int bool; ...@@ -31,6 +31,9 @@ typedef int bool;
#include "vmdk.h" #include "vmdk.h"
#endif #endif
#if HAVE_LIBVHDI
#include "vhd.h"
#endif
/** /**
* \ingroup imglib * \ingroup imglib
...@@ -117,7 +120,7 @@ tsk_img_open(int num_img, ...@@ -117,7 +120,7 @@ tsk_img_open(int num_img,
*/ */
if (type == TSK_IMG_TYPE_DETECT) { if (type == TSK_IMG_TYPE_DETECT) {
TSK_IMG_INFO *img_set = NULL; TSK_IMG_INFO *img_set = NULL;
#if HAVE_LIBAFFLIB || HAVE_LIBEWF || HAVE_LIBVMDK #if HAVE_LIBAFFLIB || HAVE_LIBEWF || HAVE_LIBVMDK || HAVE_LIBVHDI
char *set = NULL; char *set = NULL;
#endif #endif
...@@ -186,6 +189,26 @@ tsk_img_open(int num_img, ...@@ -186,6 +189,26 @@ tsk_img_open(int num_img,
} }
#endif #endif
#if HAVE_LIBVHDI
if ((img_info = vhdi_open(num_img, images, a_ssize)) != NULL) {
if (set == NULL) {
set = "VHD";
img_set = img_info;
}
else {
img_set->close(img_set);
img_info->close(img_info);
tsk_error_reset();
tsk_error_set_errno(TSK_ERR_IMG_UNKTYPE);
tsk_error_set_errstr("VHD or %s", set);
return NULL;
}
}
else {
tsk_error_reset();
}
#endif
// if any of the non-raw formats were detected, then use it. // if any of the non-raw formats were detected, then use it.
if (img_set != NULL) if (img_set != NULL)
return img_set; return img_set;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment