From a692c1bbbcfd1577461b586cfffca06cf4106359 Mon Sep 17 00:00:00 2001 From: Eugene Livis <elivis@basistech.com> Date: Tue, 15 Dec 2015 10:24:45 -0500 Subject: [PATCH] libtsk no longer includes common.h and doesn't use libcsrting or libcerror libraries --- tsk/img/vmdk.c | 14 +++++++------- tsk/img/vmdk.h | 32 ++++---------------------------- win32/libtsk/libtsk.vcxproj | 4 ++-- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/tsk/img/vmdk.c b/tsk/img/vmdk.c index 8dacdc371..371406f11 100644 --- a/tsk/img/vmdk.c +++ b/tsk/img/vmdk.c @@ -26,12 +26,12 @@ * @returns 1 if error message was not set */ static uint8_t -getError(libcerror_error_t * vmdk_error, +getError(libvmdk_error_t * vmdk_error, char error_string[TSK_VMDK_ERROR_STRING_SIZE]) { int retval; error_string[0] = '\0'; - retval = libcerror_error_backtrace_sprint(vmdk_error, + retval = libvmdk_error_backtrace_sprint(vmdk_error, error_string, TSK_VMDK_ERROR_STRING_SIZE); if (retval) return 1; @@ -44,7 +44,7 @@ vmdk_image_read(TSK_IMG_INFO * img_info, TSK_OFF_T offset, char *buf, size_t len) { char error_string[TSK_VMDK_ERROR_STRING_SIZE]; - libcerror_error_t *vmdk_error = NULL; + libvmdk_error_t *vmdk_error = NULL; ssize_t cnt; IMG_VMDK_INFO *vmdk_info = (IMG_VMDK_INFO *) img_info; @@ -105,7 +105,7 @@ static void { int i; char error_string[TSK_VMDK_ERROR_STRING_SIZE]; - libcerror_error_t *vmdk_error = NULL; + libvmdk_error_t *vmdk_error = NULL; char *errmsg = NULL; IMG_VMDK_INFO *vmdk_info = (IMG_VMDK_INFO *) img_info; @@ -149,7 +149,7 @@ vmdk_open(int a_num_img, const TSK_TCHAR * const a_images[], unsigned int a_ssize) { char error_string[TSK_VMDK_ERROR_STRING_SIZE]; - libcerror_error_t *vmdk_error = NULL; + libvmdk_error_t *vmdk_error = NULL; int result = 0; int i; @@ -232,11 +232,11 @@ vmdk_open(int a_num_img, } #if defined( TSK_WIN32 ) if (libvmdk_handle_open_wide(vmdk_info->handle, - (libcstring_system_character_t *) vmdk_info->images[0], + (const wchar_t *) vmdk_info->images[0], LIBVMDK_OPEN_READ, &vmdk_error) != 1) #else if (libvmdk_handle_open(vmdk_info->handle, - (libcstring_system_character_t*) vmdk_info->images, + (const char *) vmdk_info->images, LIBVMDK_OPEN_READ, &vmdk_error) != 1) #endif { diff --git a/tsk/img/vmdk.h b/tsk/img/vmdk.h index a3b6f4016..60a6bfe2f 100644 --- a/tsk/img/vmdk.h +++ b/tsk/img/vmdk.h @@ -24,34 +24,10 @@ #endif // ELTODO perhaps undefine HAVE_MULTI_THREAD_SUPPORT -// ELTODO - are all of these neccessary? I guess there is no downside to having them... -#define HAVE_LOCAL_LIBCSTRING 1 -#define HAVE_LOCAL_LIBCERROR 1 -#define HAVE_LOCAL_LIBCTHREADS 1 -#define HAVE_LOCAL_LIBCDATA 1 -#define HAVE_LOCAL_LIBCLOCALE 1 -#define HAVE_LOCAL_LIBCNOTIFY 1 -#define HAVE_LOCAL_LIBCSPLIT 1 -#define HAVE_LOCAL_LIBUNA 1 -#define HAVE_LOCAL_LIBCFILE 1 -#define HAVE_LOCAL_LIBCPATH 1 -#define HAVE_LOCAL_LIBBFIO 1 -#define HAVE_LOCAL_LIBFCACHE 1 -#define HAVE_LOCAL_LIBFDATA 1 -#define HAVE_LOCAL_LIBFVALUE 1 -#define ZLIB_DLL 1 -#define LIBVMDK_DLL_EXPORT 1 +#if defined( TSK_WIN32 ) +#define LIBVMDK_HAVE_WIDE_CHARACTER_TYPE 1 +#endif -#include <common.h> -#include <libcerror_definitions.h> -#include <libcerror_error.h> -#include <libcerror_system.h> -#include <libcerror_types.h> -#include <libcstring_definitions.h> -#include <libcstring_narrow_string.h> -#include <libcstring_system_string.h> -#include <libcstring_types.h> -#include <libcstring_wide_string.h> #include <libvmdk.h> // libvmdk.h needs to be last to take into account all #defines from other header files #ifdef __cplusplus @@ -66,7 +42,7 @@ extern "C" { libvmdk_handle_t *handle; TSK_TCHAR **images; int num_imgs; - tsk_lock_t read_lock; ///< Lock for reads since libvmdk is not thread safe -- only works if you have a single instance of VMDK_INFO for all threads. + tsk_lock_t read_lock; ///< ELTODO: Lock for reads since libvmdk is not thread safe -- only works if you have a single instance of VMDK_INFO for all threads. } IMG_VMDK_INFO; #ifdef __cplusplus diff --git a/win32/libtsk/libtsk.vcxproj b/win32/libtsk/libtsk.vcxproj index eda34a0ec..476298aac 100755 --- a/win32/libtsk/libtsk.vcxproj +++ b/win32/libtsk/libtsk.vcxproj @@ -240,7 +240,7 @@ copy "$(SolutionDir)\PostgreSQL_CRT\win32\msvcr120.dll" "$(OutDir)" <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\;$(LIBVMDK_HOME);$(LIBVMDK_HOME)\include;$(LIBVMDK_HOME)\common;$(LIBVMDK_HOME)\libcerror;$(LIBVMDK_HOME)\libcstring;$(LIBEWF_HOME)\common;$(LIBEWF_HOME)\include;$(LIBEWF_HOME)\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..\;$(LIBVMDK_HOME)\include;$(LIBEWF_HOME)\include;$(LIBEWF_HOME)\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;HAVE_LIBEWF;HAVE_LIBVMDK;HAVE_LIBZ;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -353,7 +353,7 @@ copy "$(SolutionDir)\PostgreSQL_CRT\win32\msvcr120.dll" "$(OutDir)" </Command> <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\;$(LIBVMDK_HOME);$(LIBVMDK_HOME)\include;$(LIBVMDK_HOME)\common;$(LIBVMDK_HOME)\libcerror;$(LIBVMDK_HOME)\libcstring;$(LIBEWF_HOME)\common;$(LIBEWF_HOME)\include;$(LIBEWF_HOME)\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..\;$(LIBVMDK_HOME)\include;$(LIBEWF_HOME)\include;$(LIBEWF_HOME)\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;HAVE_LIBEWF_EL;HAVE_LIBVMDK;HAVE_LIBZ;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> -- GitLab