Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F6779581
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
30 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/trunk/CMakeLists.txt b/trunk/CMakeLists.txt
new file mode 100644
index 0000000..ad0dd6a
--- /dev/null
+++ b/trunk/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8)
+project(xmount)
+set(CMAKE_C_FLAGS "-std=c99 -Wall")
+add_subdirectory(libxmount_input)
+#add_subdirectory(src)
diff --git a/trunk/cmake_modules/FindLibAFF.cmake b/trunk/cmake_modules/FindLibAFF.cmake
new file mode 100644
index 0000000..5418a9a
--- /dev/null
+++ b/trunk/cmake_modules/FindLibAFF.cmake
@@ -0,0 +1,21 @@
+find_package(PkgConfig)
+pkg_check_modules(PC_LIBAFF QUIET afflib)
+set(LIBAFF_DEFINITIONS ${PC_LIBAFF_CFLAGS_OTHER})
+
+find_path(LIBAFF_INCLUDE_DIR afflib/afflib.h
+ HINTS ${PC_LIBAFF_INCLUDEDIR} ${PC_LIBAFF_INCLUDE_DIRS}
+ PATH_SUFFIXES afflib)
+
+find_library(LIBAFF_LIBRARY NAMES afflib libafflib
+ HINTS ${PC_LIBAFF_LIBDIR} ${PC_LIBAFF_LIBRARY_DIRS} )
+
+set(LIBAFF_LIBRARIES ${LIBAFF_LIBRARY})
+set(LIBAFF_INCLUDE_DIRS ${LIBAFF_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(LibAFF DEFAULT_MSG LIBAFF_LIBRARY LIBAFF_INCLUDE_DIR)
+
+mark_as_advanced(LIBAFF_INCLUDE_DIR LIBAFF_LIBRARY)
+
diff --git a/trunk/cmake_modules/FindLibEWF.cmake b/trunk/cmake_modules/FindLibEWF.cmake
new file mode 100644
index 0000000..eddf49d
--- /dev/null
+++ b/trunk/cmake_modules/FindLibEWF.cmake
@@ -0,0 +1,20 @@
+find_package(PkgConfig)
+pkg_check_modules(PC_LIBEWF QUIET libewf)
+set(LIBEWF_DEFINITIONS ${PC_LIBEWF_CFLAGS_OTHER})
+
+find_path(LIBEWF_INCLUDE_DIR libewf.h
+ HINTS ${PC_LIBEWF_INCLUDEDIR} ${PC_LIBEWF_INCLUDE_DIRS}
+ PATH_SUFFIXES libewf )
+
+find_library(LIBEWF_LIBRARY NAMES ewf libewf
+ HINTS ${PC_LIBEWF_LIBDIR} ${PC_LIBEWF_LIBRARY_DIRS} )
+
+set(LIBEWF_LIBRARIES ${LIBEWF_LIBRARY})
+set(LIBEWF_INCLUDE_DIRS ${LIBEWF_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(LibEWF DEFAULT_MSG LIBEWF_LIBRARY LIBEWF_INCLUDE_DIR)
+
+mark_as_advanced(LIBEWF_INCLUDE_DIR LIBEWF_LIBRARY)
diff --git a/trunk/libxmount_input/CMakeLists.txt b/trunk/libxmount_input/CMakeLists.txt
new file mode 100644
index 0000000..3310462
--- /dev/null
+++ b/trunk/libxmount_input/CMakeLists.txt
@@ -0,0 +1,12 @@
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules/")
+
+find_package(LibEWF)
+if(LIBEWF_FOUND)
+ add_subdirectory(libxmount_input_ewf)
+endif(LIBEWF_FOUND)
+
+find_package(LibAFF)
+if(LIBAFF_FOUND)
+ add_subdirectory(libxmount_input_aff)
+endif(LIBAFF_FOUND)
+
diff --git a/trunk/libxmount_input/libxmount_input.h b/trunk/libxmount_input/libxmount_input.h
index cdb0f67..a6f5040 100644
--- a/trunk/libxmount_input/libxmount_input.h
+++ b/trunk/libxmount_input/libxmount_input.h
@@ -1,119 +1,127 @@
/*******************************************************************************
* xmount Copyright (c) 2008-2014 by Gillen Daniel <gillen.dan@pinguin.lu> *
* *
* xmount is a small tool to "fuse mount" various image formats and enable *
* virtual write access. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the Free *
* Software Foundation, either version 3 of the License, or (at your option) *
* any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
* more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************/
#ifndef LIBXMOUNT_INPUT_H
#define LIBXMOUNT_INPUT_H
#define LIBXMOUNT_INPUT_API_VERSION 1
+#include <stdint.h>
+
//! Structure containing pointers to the lib's functions
typedef struct s_LibXmountInputFunctions {
/*!
* Function to open input image
*
* \param pp_handle Pointer to store handle of opened image to
* \param pp_filename_arr Array containing all specified input images
* \param filename_arr_len Length of pp_filename_arr
* \return 0 on success or error code
*/
int (*Open)(void **pp_handle,
const char **pp_filename_arr,
uint64_t filename_arr_len);
/*!
* Function to get the input image's size
*
* \param p_handle Handle to the opened image
* \param p_size Pointer to store input image's size to
* \return 0 on success or error code
*/
int (*Size)(void *p_handle,
uint64_t *p_size);
/*!
* Function to read data from input image
*
* \param p_handle Handle to the opened image
* \param offset Position at which to start reading
* \param p_buf Buffer to store read data to
* \param count Amount of bytes to read
* \return 0 on success or error code
*/
int (*Read)(void *p_handle,
uint64_t offset,
unsigned char *p_buf,
uint32_t count);
/*!
* Function to close an opened input image
*
* \param pp_handle Pointer to the handle of the opened image
* \return 0 on success or error code
*/
int (*Close)(void **pp_handle);
/*!
* Function to return a string containing help messages for any supported
* lib-specific options
*
* \param pp_help Pointer to a string to store null-terminated help text
* \return 0 on success or error code
*/
int (*OptionsHelp)(const char **pp_help);
/*!
* Function to parse any lib-specific options
*
* \param p_handle Handle to the opened image
* \param p_options String with specified options
* \param pp_error Pointer to a string with error message
* \return 0 on success or error code and error message
*/
int (*OptionsParse)(void *p_handle,
char *p_options,
char **pp_error);
/*!
* Function to get content to add to the info file
*
* \param p_handle Handle to the opened image
* \param pp_info_buf Pointer to store the null-terminated content
* \return 0 on success or error code
*/
int (*GetInfofileContent)(void *p_handle,
const char **pp_info_buf);
+ /*!
+ * Function to free buffers that were allocated by lib
+ *
+ * \param p_buf Buffer to free
+ */
+ void (*FreeBuffer)(void *p_buf);
} ts_LibXmountInputFunctions, *pts_LibXmountInputFunctions;
//! Get library API version
/*!
* \param p_ver Supported version
*/
void LibXmount_Input_GetApiVersion(uint8_t *p_ver);
//! Get a list of supported formats
/*!
* Gets a list of supported input image formats. These are the strings
* specified with xmount's --in <string> command line option.
*
* \param ppp_arr Array containing supported format strings
* \param p_arr_len Length of pp_arr
*/
void LibXmount_Input_GetSupportedFormats(char ***ppp_arr, uint8_t *p_arr_len);
//! Get the lib's s_LibXmountInputFunctions structure
/*!
* \param pp_functions Functions
*/
-void LibXmount_Input_GetFunctions(tsLibXmountInputFunctions **pp_functions);
+void LibXmount_Input_GetFunctions(ts_LibXmountInputFunctions **pp_functions);
#endif // LIBXMOUNT_INPUT_H
diff --git a/trunk/libxmount_input/libxmount_input_aff/CMakeLists.txt b/trunk/libxmount_input/libxmount_input_aff/CMakeLists.txt
new file mode 100644
index 0000000..a9e9c4c
--- /dev/null
+++ b/trunk/libxmount_input/libxmount_input_aff/CMakeLists.txt
@@ -0,0 +1,9 @@
+# TODO: https://www.mail-archive.com/cmake@cmake.org/msg32933.html
+
+cmake_minimum_required(VERSION 2.8)
+project(libxmount_input_aff)
+add_library(xmount_input_aff SHARED libxmount_input_aff.c)
+install(TARGETS xmount_input_aff DESTINATION lib/xmount)
+include_directories(${LIBAFF_INCLUDE_DIRS})
+set(LIBS ${LIBS} ${LIBAFF_LIBRARIES})
+target_link_libraries(xmount_input_aff ${LIBS})
diff --git a/trunk/libxmount_input/libxmount_input_aff/libxmount_input_aff.c b/trunk/libxmount_input/libxmount_input_aff/libxmount_input_aff.c
new file mode 100644
index 0000000..9f5e128
--- /dev/null
+++ b/trunk/libxmount_input/libxmount_input_aff/libxmount_input_aff.c
@@ -0,0 +1,205 @@
+/*******************************************************************************
+* xmount Copyright (c) 2008-2014 by Gillen Daniel <gillen.dan@pinguin.lu> *
+* *
+* xmount is a small tool to "fuse mount" various image formats and enable *
+* virtual write access. *
+* *
+* This program is free software: you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the Free *
+* Software Foundation, either version 3 of the License, or (at your option) *
+* any later version. *
+* *
+* This program is distributed in the hope that it will be useful, but WITHOUT *
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
+* more details. *
+* *
+* You should have received a copy of the GNU General Public License along with *
+* this program. If not, see <http://www.gnu.org/licenses/>. *
+*******************************************************************************/
+
+#undef HAVE_LIBAFF_STATIC
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "../libxmount_input.h"
+
+#ifndef HAVE_LIBAFF_STATIC
+ #include <afflib/afflib.h>
+#else
+ #include "libaff/lib/afflib.h"
+#endif
+
+/*******************************************************************************
+ * Forward declarations
+ ******************************************************************************/
+int AffOpen(void **pp_handle,
+ const char **pp_filename_arr,
+ uint64_t filename_arr_len);
+int AffSize(void *p_handle,
+ uint64_t *p_size);
+int AffRead(void *p_handle,
+ uint64_t seek,
+ unsigned char *p_buf,
+ uint32_t count);
+int AffClose(void **pp_handle);
+int AffOptionsHelp(const char **pp_help);
+int AffOptionsParse(void *p_handle,
+ char *p_options,
+ char **pp_error);
+int AffGetInfofileContent(void *p_handle,
+ const char **pp_info_buf);
+void AffFreeBuffer(void *p_buf);
+
+/*******************************************************************************
+ * LibXmount_Input API implementation
+ ******************************************************************************/
+/*
+ * LibXmount_Input_GetApiVersion
+ */
+void LibXmount_Input_GetApiVersion(uint8_t *p_ver) {
+ *p_ver=LIBXMOUNT_INPUT_API_VERSION;
+}
+
+/*
+ * LibXmount_Input_GetSupportedFormats
+ */
+void LibXmount_Input_GetSupportedFormats(char ***ppp_arr, uint8_t *p_arr_len) {
+ // Alloc array containing 1 element with content "aff"
+ *ppp_arr=(char**)malloc(sizeof(char*));
+ if(*ppp_arr==NULL) {
+ *p_arr_len=0;
+ return;
+ }
+ **ppp_arr=(char*)malloc(sizeof(char)*4);
+ if(**ppp_arr==NULL) {
+ free(*ppp_arr);
+ *ppp_arr=NULL;
+ *p_arr_len=0;
+ return;
+ }
+ strcpy(**ppp_arr,"aff");
+ *p_arr_len=1;
+}
+
+/*
+ * LibXmount_Input_GetFunctions
+ */
+void LibXmount_Input_GetFunctions(ts_LibXmountInputFunctions **pp_functions) {
+ *pp_functions=
+ (pts_LibXmountInputFunctions)malloc(sizeof(ts_LibXmountInputFunctions));
+ if(*pp_functions==NULL) return;
+
+ (*pp_functions)->Open=&AffOpen;
+ (*pp_functions)->Size=&AffSize;
+ (*pp_functions)->Read=&AffRead;
+ (*pp_functions)->Close=&AffClose;
+ (*pp_functions)->OptionsHelp=&AffOptionsHelp;
+ (*pp_functions)->OptionsParse=&AffOptionsParse;
+ (*pp_functions)->GetInfofileContent=&AffGetInfofileContent;
+ (*pp_functions)->FreeBuffer=&AffFreeBuffer;
+}
+
+/*******************************************************************************
+ * Private
+ ******************************************************************************/
+/*
+ * AffOpen
+ */
+int AffOpen(void **pp_handle,
+ const char **pp_filename_arr,
+ uint64_t filename_arr_len)
+{
+ // We need at least one file
+ if(filename_arr_len==0) return 1;
+
+ // Open AFF file
+ *pp_handle=(void*)af_open(pp_filename_arr[0],O_RDONLY,0);
+ if(!*pp_handle) {
+ // LOG_ERROR("Couldn't open AFF file!\n")
+ return 1;
+ }
+
+ // Encrypted images aren't supported for now
+ if(af_cannot_decrypt((AFFILE*)*p_handle)) {
+ // LOG_ERROR("Encrypted AFF input images aren't supported yet!\n")
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+ * AffSize
+ */
+int AffSize(void *p_handle, uint64_t *p_size) {
+ *p_size=af_seek((AFFILE*)p_handle,0,SEEK_END);
+ // TODO: Check for error
+ return 0;
+}
+
+/*
+ * AffRead
+ */
+int AffRead(void *p_handle,
+ uint64_t offset,
+ unsigned char *p_buf,
+ uint32_t count)
+{
+ af_seek((AFFILE*)p_handle,offset,SEEK_SET);
+ // TODO: Check for error
+ if(af_read((AFFILE*)p_handle,p_buf,count)!=count) {
+ // LOG_ERROR("Couldn't read %zd bytes from offset %" PRIu64
+ // "!\n",ToRead,offset);
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * AffClose
+ */
+int AffClose(void **pp_handle) {
+ af_close((AFFILE*)*p_handle);
+ // TODO: Check for error
+ return 0;
+}
+
+/*
+ * AffOptionsHelp
+ */
+int AffOptionsHelp(const char **pp_help) {
+ *pp_help=NULL;
+ return 0;
+}
+
+/*
+ * AffOptionsParse
+ */
+int AffOptionsParse(void *p_handle, char *p_options, char **pp_error) {
+ return 0;
+}
+
+/*
+ * AffGetInfofileContent
+ */
+int AffGetInfofileContent(void *p_handle, const char **pp_info_buf) {
+ // TODO
+ *pp_info_buf=NULL;
+ return 0;
+}
+
+/*
+ * AffFreeBuffer
+ */
+void AffFreeBuffer(void *p_buf) {
+ free(p_buf);
+}
+
+/*
+ ----- Change history -----
+ 20140724: * Initial version implementing AffOpen, AffSize, AffRead, AffClose,
+ AffOptionsHelp, AffOptionsParse and AffFreeBuffer
+*/
+
diff --git a/trunk/libxmount_input/libxmount_input_ewf/CMakeLists.txt b/trunk/libxmount_input/libxmount_input_ewf/CMakeLists.txt
new file mode 100644
index 0000000..f9f35e5
--- /dev/null
+++ b/trunk/libxmount_input/libxmount_input_ewf/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8)
+project(libxmount_input_ewf)
+add_library(xmount_input_ewf SHARED libxmount_input_ewf.c)
+install(TARGETS xmount_input_ewf DESTINATION lib/xmount)
+include_directories(${LIBEWF_INCLUDE_DIRS})
+set(LIBS ${LIBS} ${LIBEWF_LIBRARIES})
+target_link_libraries(xmount_input_ewf ${LIBS})
diff --git a/trunk/libxmount_input/libxmount_input_ewf/libxmount_input_ewf.c b/trunk/libxmount_input/libxmount_input_ewf/libxmount_input_ewf.c
index 5c277b1..d01c5f0 100644
--- a/trunk/libxmount_input/libxmount_input_ewf/libxmount_input_ewf.c
+++ b/trunk/libxmount_input/libxmount_input_ewf/libxmount_input_ewf.c
@@ -1,280 +1,297 @@
/*******************************************************************************
* xmount Copyright (c) 2008-2014 by Gillen Daniel <gillen.dan@pinguin.lu> *
* *
* xmount is a small tool to "fuse mount" various image formats and enable *
* virtual write access. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the Free *
* Software Foundation, either version 3 of the License, or (at your option) *
* any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
* more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************/
#undef HAVE_LIBEWF_STATIC
-#include "config.h"
-
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_LIBEWF
+#include "../libxmount_input.h"
+
+#ifndef HAVE_LIBEWF_STATIC
#include <libewf.h>
-#endif
-#ifdef HAVE_LIBEWF_STATIC
+#else
#include "libewf/include/libewf.h"
#endif
-#include "../libxmount_input.h"
-
/*******************************************************************************
* Forward declarations
******************************************************************************/
int EwfOpen(void **pp_handle,
const char **pp_filename_arr,
uint64_t filename_arr_len);
int EwfSize(void *p_handle,
uint64_t *p_size);
int EwfRead(void *p_handle,
uint64_t seek,
unsigned char *p_buf,
uint32_t count);
int EwfClose(void **pp_handle);
int EwfOptionsHelp(const char **pp_help);
int EwfOptionsParse(void *p_handle,
char *p_options,
char **pp_error);
int EwfGetInfofileContent(void *p_handle,
const char **pp_info_buf);
+void EwfFreeBuffer(void *p_buf);
/*******************************************************************************
* LibXmount_Input API implementation
******************************************************************************/
+/*
+ * LibXmount_Input_GetApiVersion
+ */
void LibXmount_Input_GetApiVersion(uint8_t *p_ver) {
*p_ver=LIBXMOUNT_INPUT_API_VERSION;
}
+/*
+ * LibXmount_Input_GetSupportedFormats
+ */
void LibXmount_Input_GetSupportedFormats(char ***ppp_arr, uint8_t *p_arr_len) {
- *ppp_arr=(char*)malloc(sizeof(char*));
+ // Alloc array containing 1 element with content "ewf"
+ *ppp_arr=(char**)malloc(sizeof(char*));
if(*ppp_arr==NULL) {
*p_arr_len=0;
return;
}
-
**ppp_arr=(char*)malloc(sizeof(char)*4);
if(**ppp_arr==NULL) {
free(*ppp_arr);
*ppp_arr=NULL;
*p_arr_len=0;
return;
}
-
strcpy(**ppp_arr,"ewf");
*p_arr_len=1;
}
-void LibXmount_Input_GetFunctions(tsLibXmountInputFunctions **pp_functions) {
+/*
+ * LibXmount_Input_GetFunctions
+ */
+void LibXmount_Input_GetFunctions(ts_LibXmountInputFunctions **pp_functions) {
*pp_functions=
- (ptsLibXmountInputFunctions)malloc(sizeof(tsLibXmountInputFunctions));
+ (pts_LibXmountInputFunctions)malloc(sizeof(ts_LibXmountInputFunctions));
if(*pp_functions==NULL) return;
(*pp_functions)->Open=&EwfOpen;
(*pp_functions)->Size=&EwfSize;
(*pp_functions)->Read=&EwfRead;
(*pp_functions)->Close=&EwfClose;
(*pp_functions)->OptionsHelp=&EwfOptionsHelp;
(*pp_functions)->OptionsParse=&EwfOptionsParse;
(*pp_functions)->GetInfofileContent=&EwfGetInfofileContent;
+ (*pp_functions)->FreeBuffer=&EwfFreeBuffer;
}
/*******************************************************************************
* Private
******************************************************************************/
+/*
+ * EwfOpen
+ */
int EwfOpen(void **pp_handle,
const char **pp_filename_arr,
uint64_t filename_arr_len)
{
-#if defined( HAVE_LIBEWF_V2_API )
- static libewf_handle_t *hEwfFile=NULL;
-#else
- static LIBEWF_HANDLE *hEwfFile=NULL;
-#endif
+ // We need at least one file
+ if(filename_arr_len==0) return 1;
+ // Make sure all files are EWF files
+ for(uint64_t i=0;i<filename_arr_len;i++) {
+ if(libewf_check_file_signature(pp_filename_arr[i],NULL)!=1) return 1;
+ }
-#if defined( HAVE_LIBEWF_V2_API )
- if(libewf_check_file_signature(ppInputFilenames[i],NULL)!=1) {
-#else
- if(libewf_check_file_signature(ppInputFilenames[i])!=1) {
-#endif
+ // Init handle
+ *pp_handle=NULL;
+ if(libewf_handle_initialize((libewf_handle_t**)pp_handle,NULL)!=1) {
+ // LOG_ERROR("Couldn't create EWF handle!\n")
+ return 1;
+ }
-#if defined( HAVE_LIBEWF_V2_API )
- if( libewf_handle_initialize(
- &hEwfFile,
- NULL ) != 1 )
- {
- LOG_ERROR("Couldn't create EWF handle!\n")
- return 1;
- }
- if( libewf_handle_open(
- hEwfFile,
- ppInputFilenames,
- InputFilenameCount,
- libewf_get_access_flags_read(),
- NULL ) != 1 )
- {
- LOG_ERROR("Couldn't open EWF file(s)!\n")
- return 1;
- }
-#else
- hEwfFile=libewf_open(ppInputFilenames,
- InputFilenameCount,
- libewf_get_flags_read());
- if(hEwfFile==NULL) {
- LOG_ERROR("Couldn't open EWF file(s)!\n")
- return 1;
- }
- // Parse EWF header
- if(libewf_parse_header_values(hEwfFile,LIBEWF_DATE_FORMAT_ISO8601)!=1) {
- LOG_ERROR("Couldn't parse ewf header values!\n")
- return 1;
- }
-#endif
+ // Open EWF file
+ if(libewf_handle_open((libewf_handle_t*)*pp_handle,
+ (char* const*)pp_filename_arr,
+ filename_arr_len,
+ libewf_get_access_flags_read(),
+ NULL)!=1)
+ {
+ // LOG_ERROR("Couldn't open EWF file(s)!\n")
+ return 1;
+ }
- return 1;
+ return 0;
}
+/*
+ * EwfSize
+ */
int EwfSize(void *p_handle, uint64_t *p_size) {
-#if defined( HAVE_LIBEWF_V2_API )
- if(libewf_handle_get_media_size((libewf_handle_t*)p_handle,p_size,NULL)!=1)
-#else
- if(libewf_get_media_size((LIBEWF_HANDLE*)p_handle,p_size)!=1)
-#endif
+ if(libewf_handle_get_media_size((libewf_handle_t*)p_handle,p_size,NULL)!=1) {
return 1;
}
return 0;
}
+/*
+ * EwfRead
+ */
int EwfRead(void *p_handle,
uint64_t offset,
unsigned char *p_buf,
uint32_t count)
{
-#if defined( HAVE_LIBEWF_V2_API )
if(libewf_handle_seek_offset((libewf_handle_t*)p_handle,
offset,
SEEK_SET,
NULL)!=-1)
{
if(libewf_handle_read_buffer((libewf_handle_t*)p_handle,
p_buf,
count,
NULL)!=count)
{
-#else
- if(libewf_seek_offset((LIBEWF_HANDLE*)p_handle,offset)!=-1) {
- if(libewf_read_buffer((LIBEWF_HANDLE*)p_handle,p_buf,count)!=count) {
-#endif
return 1;
}
} else {
return 1;
}
return 0;
}
+/*
+ * EwfClose
+ */
int EwfClose(void **pp_handle) {
-#if defined( HAVE_LIBEWF_V2_API )
- libewf_handle_close((libewf_handle_t*)*pp_handle,NULL);
- libewf_handle_free((libewf_handle_t*)pp_handle,NULL);
-#else
- libewf_close((LIBEWF_HANDLE*)*pp_handle);
-#endif
+ // Close EWF handle
+ if(libewf_handle_close((libewf_handle_t*)*pp_handle,NULL)!=0) {
+ return 1;
+ }
+
+ // Free EWF handle
+ if(libewf_handle_free((libewf_handle_t**)pp_handle,NULL)!=1) {
+ return 1;
+ }
+
+ *pp_handle=NULL;
return 0;
}
+/*
+ * EwfOptionsHelp
+ */
int EwfOptionsHelp(const char **pp_help) {
*pp_help=NULL;
return 0;
}
+/*
+ * EwfOptionsParse
+ */
int EwfOptionsParse(void *p_handle, char *p_options, char **pp_error) {
return 0;
}
+/*
+ * EwfGetInfofileContent
+ */
int EwfGetInfofileContent(void *p_handle, const char **pp_info_buf) {
/*
#define M_SAVE_VALUE(DESC,SHORT_DESC) { \
if(ret==1) { \
XMOUNT_REALLOC(pVirtualImageInfoFile,char*, \
(strlen(pVirtualImageInfoFile)+strlen(buf)+strlen(DESC)+2)) \
strncpy((pVirtualImageInfoFile+strlen(pVirtualImageInfoFile)),DESC,strlen(DESC)+1); \
strncpy((pVirtualImageInfoFile+strlen(pVirtualImageInfoFile)),buf,strlen(buf)+1); \
strncpy((pVirtualImageInfoFile+strlen(pVirtualImageInfoFile)),"\n",2); \
} else if(ret==-1) { \
LOG_WARNING("Couldn't query EWF image header value '%s'\n",SHORT_DESC) \
} \
}
case TOrigImageType_EWF:
// Original image is an EWF file. Extract various infos from ewf file and
// add them to the virtual image info file content.
#if defined( HAVE_LIBEWF_V2_API )
ret=libewf_handle_get_utf8_header_value_case_number(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Case number: ","Case number")
ret=libewf_handle_get_utf8_header_value_description(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Description: ","Description")
ret=libewf_handle_get_utf8_header_value_examiner_name(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Examiner: ","Examiner")
ret=libewf_handle_get_utf8_header_value_evidence_number(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Evidence number: ","Evidence number")
ret=libewf_handle_get_utf8_header_value_notes(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Notes: ","Notes")
ret=libewf_handle_get_utf8_header_value_acquiry_date(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Acquiry date: ","Acquiry date")
ret=libewf_handle_get_utf8_header_value_system_date(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("System date: ","System date")
ret=libewf_handle_get_utf8_header_value_acquiry_operating_system(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Acquiry os: ","Acquiry os")
ret=libewf_handle_get_utf8_header_value_acquiry_software_version(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("Acquiry sw version: ","Acquiry sw version")
ret=libewf_handle_get_utf8_hash_value_md5(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("MD5 hash: ","MD5 hash")
ret=libewf_handle_get_utf8_hash_value_sha1(hEwfFile,buf,sizeof(buf),NULL);
M_SAVE_VALUE("SHA1 hash: ","SHA1 hash")
#else
ret=libewf_get_header_value_case_number(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Case number: ","Case number")
ret=libewf_get_header_value_description(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Description: ","Description")
ret=libewf_get_header_value_examiner_name(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Examiner: ","Examiner")
ret=libewf_get_header_value_evidence_number(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Evidence number: ","Evidence number")
ret=libewf_get_header_value_notes(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Notes: ","Notes")
ret=libewf_get_header_value_acquiry_date(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Acquiry date: ","Acquiry date")
ret=libewf_get_header_value_system_date(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("System date: ","System date")
ret=libewf_get_header_value_acquiry_operating_system(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Acquiry os: ","Acquiry os")
ret=libewf_get_header_value_acquiry_software_version(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("Acquiry sw version: ","Acquiry sw version")
ret=libewf_get_hash_value_md5(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("MD5 hash: ","MD5 hash")
ret=libewf_get_hash_value_sha1(hEwfFile,buf,sizeof(buf));
M_SAVE_VALUE("SHA1 hash: ","SHA1 hash")
#endif
break;
#undef M_SAVE_VALUE
*/
*pp_info_buf=NULL;
return 0;
}
+/*
+ * EwfFreeBuffer
+ */
+void EwfFreeBuffer(void *p_buf) {
+ free(p_buf);
+}
+
+/*
+ ----- Change history -----
+ 20140724: * Initial version implementing EwfOpen, EwfSize, EwfRead, EwfClose,
+ EwfOptionsHelp, EwfOptionsParse and EwfFreeBuffer
+*/
+
diff --git a/trunk/Makefile.am b/trunk/old_build/Makefile.am
similarity index 100%
rename from trunk/Makefile.am
rename to trunk/old_build/Makefile.am
diff --git a/trunk/Makefile.in b/trunk/old_build/Makefile.in
similarity index 100%
rename from trunk/Makefile.in
rename to trunk/old_build/Makefile.in
diff --git a/trunk/aclocal.m4 b/trunk/old_build/aclocal.m4
similarity index 100%
rename from trunk/aclocal.m4
rename to trunk/old_build/aclocal.m4
diff --git a/trunk/compile b/trunk/old_build/compile
similarity index 100%
rename from trunk/compile
rename to trunk/old_build/compile
diff --git a/trunk/config.guess b/trunk/old_build/config.guess
similarity index 100%
rename from trunk/config.guess
rename to trunk/old_build/config.guess
diff --git a/trunk/config.h.in b/trunk/old_build/config.h.in
similarity index 100%
rename from trunk/config.h.in
rename to trunk/old_build/config.h.in
diff --git a/trunk/config.sub b/trunk/old_build/config.sub
similarity index 100%
rename from trunk/config.sub
rename to trunk/old_build/config.sub
diff --git a/trunk/configure b/trunk/old_build/configure
similarity index 100%
rename from trunk/configure
rename to trunk/old_build/configure
diff --git a/trunk/configure.ac b/trunk/old_build/configure.ac
similarity index 100%
rename from trunk/configure.ac
rename to trunk/old_build/configure.ac
diff --git a/trunk/depcomp b/trunk/old_build/depcomp
similarity index 100%
rename from trunk/depcomp
rename to trunk/old_build/depcomp
diff --git a/trunk/install-sh b/trunk/old_build/install-sh
similarity index 100%
rename from trunk/install-sh
rename to trunk/old_build/install-sh
diff --git a/trunk/missing b/trunk/old_build/missing
similarity index 100%
rename from trunk/missing
rename to trunk/old_build/missing
diff --git a/trunk/src/CMakeLists.txt b/trunk/src/CMakeLists.txt
new file mode 100644
index 0000000..d02f0dd
--- /dev/null
+++ b/trunk/src/CMakeLists.txt
@@ -0,0 +1 @@
+add_executable(xmount xmount.c md5.c)
diff --git a/trunk/md5.c b/trunk/src/md5.c
similarity index 100%
rename from trunk/md5.c
rename to trunk/src/md5.c
diff --git a/trunk/md5.h b/trunk/src/md5.h
similarity index 100%
rename from trunk/md5.h
rename to trunk/src/md5.h
diff --git a/trunk/xmount.c b/trunk/src/xmount.c
similarity index 100%
rename from trunk/xmount.c
rename to trunk/src/xmount.c
diff --git a/trunk/xmount.h b/trunk/src/xmount.h
similarity index 100%
rename from trunk/xmount.h
rename to trunk/src/xmount.h
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Sep 15, 10:19 AM (23 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1318461
Default Alt Text
(30 KB)
Attached To
Mode
rXMOUNT xmount
Attached
Detach File
Event Timeline
Log In to Comment