definitions.h   definitions.h 
/* /*
* Definitions for libewf * Definitions for libewf
* *
* Copyright (c) 2006-2008, Joachim Metz <forensics@hoffmannbv.nl>, * Copyright (c) 2006-2009, Joachim Metz <forensics@hoffmannbv.nl>,
* Hoffmann Investigations. All rights reserved. * Hoffmann Investigations.
* *
* Refer to AUTHORS for acknowledgements. * Refer to AUTHORS for acknowledgements.
* *
* Redistribution and use in source and binary forms, with or without modif * This software is free software: you can redistribute it and/or modify
ication, * it under the terms of the GNU Lesser General Public License as published
* are permitted provided that the following conditions are met: by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* - Redistributions of source code must retain the above copyright notice, * This software is distributed in the hope that it will be useful,
* this list of conditions and the following disclaimer. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* - Redistributions in binary form must reproduce the above copyright noti * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce, * GNU General Public License for more details.
* this list of conditions and the following disclaimer in the documentat
ion
* and/or other materials provided with the distribution.
* - Neither the name of the creator, related organisations, nor the names
of
* its contributors may be used to endorse or promote products derived fr
om
* this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, COMPANY AND CONTRIBUT * You should have received a copy of the GNU Lesser General Public License
ORS * along with this software. If not, see <http://www.gnu.org/licenses/>.
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITE
D TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P
URPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF T
HE
* POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined( _LIBEWF_DEFINIONS_H ) #if !defined( _LIBEWF_DEFINITIONS_H )
#define _LIBEWF_DEFINIONS_H #define _LIBEWF_DEFINITIONS_H
#include <libewf/types.h> #include <libewf/types.h>
#define LIBEWF_VERSION 20080501 #define LIBEWF_VERSION 20091114
/* The libewf version string /* The libewf version string
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define LIBEWF_VERSION_STRING "20091114"
#define LIBEWF_VERSION_STRING L"20080501"
#else
#define LIBEWF_VERSION_STRING "20080501"
#endif
/* The libewf file access /* The libewf file access
* bit 1 set to 1 for read access * bit 1 set to 1 for read access
* bit 2 set to 1 for write access * bit 2 set to 1 for write access
* bit 3-8 not used * bit 3-4 not used
* bit 5 set to 1 to resume write
* bit 6-8 not used
*/ */
#define LIBEWF_FLAG_READ (uint8_t) 0x01 #define LIBEWF_FLAG_READ (uint8_t) 0x01
#define LIBEWF_FLAG_WRITE (uint8_t) 0x02 #define LIBEWF_FLAG_WRITE (uint8_t) 0x02
#define LIBEWF_FLAG_RESUME (uint8_t) 0x10
/* The libewf file access macros /* The libewf file access macros
*/ */
#define LIBEWF_OPEN_READ ( LIBEWF_FLAG_READ ) #define LIBEWF_OPEN_READ ( LIBEWF_FLAG_READ )
#define LIBEWF_OPEN_WRITE ( LIBEWF_FLAG_WRITE )
#define LIBEWF_OPEN_READ_WRITE ( LIBEWF_FLAG_READ | LIBEWF_ FLAG_WRITE ) #define LIBEWF_OPEN_READ_WRITE ( LIBEWF_FLAG_READ | LIBEWF_ FLAG_WRITE )
#define LIBEWF_OPEN_WRITE ( LIBEWF_FLAG_WRITE )
#define LIBEWF_OPEN_WRITE_RESUME ( LIBEWF_FLAG_WRITE | LIBEWF
_FLAG_RESUME )
/* The levels are ordered from zero tollerance to full tollerance of non fa /* The file formats
tal errors
* fatal error cannot be tollerated
*/ */
#define LIBEWF_ERROR_TOLLERANCE_NONE (uint8_t) 0x00 enum LIBEWF_FORMAT
#define LIBEWF_ERROR_TOLLERANCE_DATA_ONLY (uint8_t) 0x03 {
#define LIBEWF_ERROR_TOLLERANCE_COMPENSATE (uint8_t) 0x0C LIBEWF_FORMAT_UNKNOWN = 0x00,
#define LIBEWF_ERROR_TOLLERANCE_NON_FATAL (uint8_t) 0x0F LIBEWF_FORMAT_ENCASE1 = 0x01,
LIBEWF_FORMAT_ENCASE2 = 0x02,
LIBEWF_FORMAT_ENCASE3 = 0x03,
LIBEWF_FORMAT_ENCASE4 = 0x04,
LIBEWF_FORMAT_ENCASE5 = 0x05,
LIBEWF_FORMAT_ENCASE6 = 0x06,
LIBEWF_FORMAT_SMART = 0x0E,
LIBEWF_FORMAT_FTK = 0x0F,
LIBEWF_FORMAT_LVF = 0x10,
LIBEWF_FORMAT_LINEN5 = 0x25,
LIBEWF_FORMAT_LINEN6 = 0x26,
/* Libewf file formats /* The format as specified by Andrew Rosen
*/ */
#define LIBEWF_FORMAT_UNKNOWN 0x00 LIBEWF_FORMAT_EWF = 0x70,
#define LIBEWF_FORMAT_ENCASE1 0x01
#define LIBEWF_FORMAT_ENCASE2 0x02
#define LIBEWF_FORMAT_ENCASE3 0x03
#define LIBEWF_FORMAT_ENCASE4 0x04
#define LIBEWF_FORMAT_ENCASE5 0x05
#define LIBEWF_FORMAT_ENCASE6 0x06
#define LIBEWF_FORMAT_SMART 0x0E
#define LIBEWF_FORMAT_FTK 0x0F
#define LIBEWF_FORMAT_LVF 0x10
#define LIBEWF_FORMAT_LINEN5 0x25
#define LIBEWF_FORMAT_LINEN6 0x26
/* The format as specified by Andrew Rosen /* Libewf eXtended EWF format
*/
LIBEWF_FORMAT_EWFX = 0x71
};
/* The default segment file size
*/ */
#define LIBEWF_FORMAT_EWF 0x70 #define LIBEWF_DEFAULT_SEGMENT_FILE_SIZE ( 1500 * 1024 * 1024 )
/* Libewf eXtended EWF format /* The compression level definitions
*/ */
#define LIBEWF_FORMAT_EWFX 0x71 enum LIBEWF_COMPRESSION_LEVELS
{
LIBEWF_COMPRESSION_NONE = 0,
LIBEWF_COMPRESSION_FAST = 1,
LIBEWF_COMPRESSION_BEST = 2,
};
/* Libewf compression level definitions /* The libewf compression flags
* bit 1 set to 1 for emtpy block compression
* bit 2-8 not used
*/ */
#define LIBEWF_COMPRESSION_NONE 0 #define LIBEWF_FLAG_COMPRESS_EMPTY_BLOCK (uint8_t) 0x01
#define LIBEWF_COMPRESSION_FAST 1
#define LIBEWF_COMPRESSION_BEST 2
/* Libewf media type definitions /* The media type definitions
*/ */
#define LIBEWF_MEDIA_TYPE_REMOVABLE 0x00 enum LIBEWF_MEDIA_TYPES
#define LIBEWF_MEDIA_TYPE_FIXED 0x01 {
LIBEWF_MEDIA_TYPE_REMOVABLE = 0x00,
LIBEWF_MEDIA_TYPE_FIXED = 0x01,
LIBEWF_MEDIA_TYPE_OPTICAL = 0x03,
LIBEWF_MEDIA_TYPE_MEMORY = 0x10
};
#define LIBEWF_MEDIA_TYPE_CD 0x03 /* The media flags definitions
*/
enum LIBEWF_MEDIA_FLAGS
{
LIBEWF_MEDIA_FLAG_PHYSICAL = 0x02,
LIBEWF_MEDIA_FLAG_FASTBLOC = 0x04,
LIBEWF_MEDIA_FLAG_TABLEAU = 0x08
};
/* Libewf volume type definitions #if 1
/* The volume type definitions
*/ */
#define LIBEWF_VOLUME_TYPE_LOGICAL 0x00 enum LIBEWF_VOLUME_TYPES
#define LIBEWF_VOLUME_TYPE_PHYSICAL 0x01 {
LIBEWF_VOLUME_TYPE_LOGICAL = 0x00,
LIBEWF_VOLUME_TYPE_PHYSICAL = 0x01
};
#endif
/* Libwef date representation format /* The date representation formats
*/ */
#define LIBEWF_DATE_FORMAT_DAYMONTH 0x01 enum LIBEWF_DATE_FORMATS
#define LIBEWF_DATE_FORMAT_MONTHDAY 0x02 {
#define LIBEWF_DATE_FORMAT_ISO8601 0x03 LIBEWF_DATE_FORMAT_DAYMONTH = 0x01,
#define LIBEWF_DATE_FORMAT_CTIME 0x04 LIBEWF_DATE_FORMAT_MONTHDAY = 0x02,
LIBEWF_DATE_FORMAT_ISO8601 = 0x03,
LIBEWF_DATE_FORMAT_CTIME = 0x04
};
/* Libewf compression types /* The compression types
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE )
#define LIBEWF_COMPRESSION_TYPE_NONE L"n"
#define LIBEWF_COMPRESSION_TYPE_FAST L"f"
#define LIBEWF_COMPRESSION_TYPE_BEST L"b"
#else
#define LIBEWF_COMPRESSION_TYPE_NONE "n" #define LIBEWF_COMPRESSION_TYPE_NONE "n"
#define LIBEWF_COMPRESSION_TYPE_FAST "f" #define LIBEWF_COMPRESSION_TYPE_FAST "f"
#define LIBEWF_COMPRESSION_TYPE_BEST "b" #define LIBEWF_COMPRESSION_TYPE_BEST "b"
#endif
/* Libewf default segment file size
*/
#define LIBEWF_DEFAULT_SEGMENT_FILE_SIZE ( 1500 * 1024 * 1024 )
/* Libewf segment file type definitions /* The segment file type definitions
*/ */
#define LIBEWF_SEGMENT_FILE_TYPE_DWF (uint8_t) 'd' enum LIBEWF_SEGMENT_FILE_TYPES
#define LIBEWF_SEGMENT_FILE_TYPE_EWF (uint8_t) 'E' {
#define LIBEWF_SEGMENT_FILE_TYPE_LWF (uint8_t) 'L' LIBEWF_SEGMENT_FILE_TYPE_DWF = (int) 'd',
LIBEWF_SEGMENT_FILE_TYPE_EWF = (int) 'E',
LIBEWF_SEGMENT_FILE_TYPE_LWF = (int) 'L'
};
#endif #endif
 End of changes. 32 change blocks. 
98 lines changed or deleted 100 lines changed or added


 extern.h   extern.h 
/* /*
* The extern definition * The extern definition
* This header should be included in header files that export or import * This header should be included in header files that export or import
* library functions * library functions
* *
* Copyright (c) 2006-2008, Joachim Metz <forensics@hoffmannbv.nl>, * Copyright (c) 2006-2009, Joachim Metz <forensics@hoffmannbv.nl>,
* Hoffmann Investigations. All rights reserved. * Hoffmann Investigations.
* *
* Refer to AUTHORS for acknowledgements. * Refer to AUTHORS for acknowledgements.
* *
* Redistribution and use in source and binary forms, with or without modif * This software is free software: you can redistribute it and/or modify
ication, * it under the terms of the GNU Lesser General Public License as published
* are permitted provided that the following conditions are met: by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* - Redistributions of source code must retain the above copyright notice, * This software is distributed in the hope that it will be useful,
* this list of conditions and the following disclaimer. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* - Redistributions in binary form must reproduce the above copyright noti * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce, * GNU General Public License for more details.
* this list of conditions and the following disclaimer in the documentat
ion
* and/or other materials provided with the distribution.
* - Neither the name of the creator, related organisations, nor the names
of
* its contributors may be used to endorse or promote products derived fr
om
* this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, COMPANY AND CONTRIBUT * You should have received a copy of the GNU Lesser General Public License
ORS * along with this software. If not, see <http://www.gnu.org/licenses/>.
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITE
D TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P
URPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF T
HE
* POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined( _LIBEWF_EXTERN_H ) #if !defined( _LIBEWF_EXTERN_H )
#define _LIBEWF_EXTERN_H #define _LIBEWF_EXTERN_H
/* To export functions from the libewf DLL define LIBEWF_DLL_EXPORT /* To export functions from the libewf DLL define LIBEWF_DLL_EXPORT
* To import functions from the libewf DLL define LIBEWF_DLL_IMPORT * To import functions from the libewf DLL define LIBEWF_DLL_IMPORT
* Otherwise use default extern statement * Otherwise use default extern statement
*/ */
#if defined( LIBEWF_DLL_EXPORT ) #if defined( LIBEWF_DLL_EXPORT )
 End of changes. 4 change blocks. 
32 lines changed or deleted 13 lines changed or added


 handle.h   handle.h 
/* /*
* The external handle, hides internal data structures * The external handle, hides internal data structures
* *
* Copyright (c) 2006-2008, Joachim Metz <forensics@hoffmannbv.nl>, * Copyright (c) 2006-2009, Joachim Metz <forensics@hoffmannbv.nl>,
* Hoffmann Investigations. All rights reserved. * Hoffmann Investigations.
* *
* Refer to AUTHORS for acknowledgements. * Refer to AUTHORS for acknowledgements.
* *
* Redistribution and use in source and binary forms, with or without modif * This software is free software: you can redistribute it and/or modify
ication, * it under the terms of the GNU Lesser General Public License as published
* are permitted provided that the following conditions are met: by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* - Redistributions of source code must retain the above copyright notice, * This software is distributed in the hope that it will be useful,
* this list of conditions and the following disclaimer. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* - Redistributions in binary form must reproduce the above copyright noti * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce, * GNU General Public License for more details.
* this list of conditions and the following disclaimer in the documentat
ion
* and/or other materials provided with the distribution.
* - Neither the name of the creator, related organisations, nor the names
of
* its contributors may be used to endorse or promote products derived fr
om
* this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, COMPANY AND CONTRIBUT * You should have received a copy of the GNU Lesser General Public License
ORS * along with this software. If not, see <http://www.gnu.org/licenses/>.
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITE
D TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P
URPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF T
HE
* POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined( _LIBEWF_HANDLE_H ) #if !defined( _LIBEWF_HANDLE_H )
#define _LIBEWF_HANDLE_H #define _LIBEWF_HANDLE_H
#include <libewf/types.h> #include <libewf/types.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* TODO remove definition in v2 of API
* HAVE_V2_API
*/
#define LIBEWF_HANDLE libewf_handle_t #define LIBEWF_HANDLE libewf_handle_t
typedef intptr_t libewf_handle_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 6 change blocks. 
34 lines changed or deleted 16 lines changed or added


 libewf.h   libewf.h 
/* /*
* Library for the Expert Witness Compression Format Support (EWF) * Library for the Expert Witness Compression Format Support (EWF)
* The file format both used by EnCase and FTK are based upon EWF
* *
* Copyright (c) 2006-2008, Joachim Metz <forensics@hoffmannbv.nl>, * Copyright (c) 2006-2009, Joachim Metz <forensics@hoffmannbv.nl>,
* Hoffmann Investigations. All rights reserved. * Hoffmann Investigations.
* *
* Refer to AUTHORS for acknowledgements. * Refer to AUTHORS for acknowledgements.
* *
* Redistribution and use in source and binary forms, with or without modif * This software is free software: you can redistribute it and/or modify
ication, * it under the terms of the GNU Lesser General Public License as published
* are permitted provided that the following conditions are met: by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* - Redistributions of source code must retain the above copyright notice, * This software is distributed in the hope that it will be useful,
* this list of conditions and the following disclaimer. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* - Redistributions in binary form must reproduce the above copyright noti * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce, * GNU General Public License for more details.
* this list of conditions and the following disclaimer in the documentat
ion
* and/or other materials provided with the distribution.
* - Neither the name of the creator, related organisations, nor the names
of
* its contributors may be used to endorse or promote products derived fr
om
* this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, COMPANY AND CONTRIBUT * You should have received a copy of the GNU Lesser General Public License
ORS * along with this software. If not, see <http://www.gnu.org/licenses/>.
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITE
D TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P
URPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF T
HE
* POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined( _LIBEWF_H ) #if !defined( _LIBEWF_H )
#define _LIBEWF_H #define _LIBEWF_H
#include <libewf/codepage.h>
#include <libewf/definitions.h> #include <libewf/definitions.h>
#include <libewf/error.h>
#include <libewf/extern.h> #include <libewf/extern.h>
#include <libewf/handle.h> #include <libewf/features.h>
#include <libewf/types.h> #include <libewf/types.h>
#if 1 || defined( HAVE_V1_API )
#include <libewf/handle.h>
#endif
#include <stdio.h> #include <stdio.h>
#if defined( LIBEWF_HAVE_BFIO )
#include <libbfio.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* ------------------------------------------------------------------------
-
* Support functions
* ------------------------------------------------------------------------
- */
/* Returns the library version /* Returns the library version
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE )
LIBEWF_EXTERN const wchar_t *libewf_get_version(
void );
#else
LIBEWF_EXTERN const char *libewf_get_version( LIBEWF_EXTERN const char *libewf_get_version(
void ); void );
#endif
/* Returns the flags for reading /* Returns the flags for reading
*/ */
LIBEWF_EXTERN uint8_t libewf_get_flags_read( LIBEWF_EXTERN uint8_t libewf_get_flags_read(
void ); void );
/* Returns the flags for reading and writing /* Returns the flags for reading and writing
*/ */
LIBEWF_EXTERN uint8_t libewf_get_flags_read_write( LIBEWF_EXTERN uint8_t libewf_get_flags_read_write(
void ); void );
/* Returns the flags for writing /* Returns the flags for writing
*/ */
LIBEWF_EXTERN uint8_t libewf_get_flags_write( LIBEWF_EXTERN uint8_t libewf_get_flags_write(
void ); void );
/* Detects if a file is an EWF file (check for the EWF file signature) /* Returns the flags for resume writing
*/
LIBEWF_EXTERN uint8_t libewf_get_flags_write_resume(
void );
/* Determines if a file is an EWF file (check for the EWF file signature)
* Returns 1 if true, 0 if not or -1 on error * Returns 1 if true, 0 if not or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS ) #if 0 || defined( HAVE_V2_API )
LIBEWF_EXTERN int libewf_check_file_signature( LIBEWF_EXTERN int libewf_check_file_signature(
const wchar_t *filename ); const char *filename,
libewf_error_t **error );
#else #else
LIBEWF_EXTERN int libewf_check_file_signature( LIBEWF_EXTERN int libewf_check_file_signature(
const char *filename ); const char *filename );
#endif #endif
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Determines if a file is an EWF file (check for the EWF file signature)
* Returns 1 if true, 0 if not or -1 on error
*/
#if 0 || defined( HAVE_V2_API )
LIBEWF_EXTERN int libewf_check_file_signature_wide(
const wchar_t *filename,
libewf_error_t **error );
#else
LIBEWF_EXTERN int libewf_check_file_signature_wide(
const wchar_t *filename );
#endif
#endif
#if 0 || defined( HAVE_V2_API )
#if defined( LIBEWF_HAVE_BFIO )
/* Determines if a file is an EWF file (check for the EWF file signature) u
sing a Basic File IO (bfio) handle
* Returns 1 if true, 0 if not or -1 on error
*/
LIBEWF_EXTERN int libewf_check_file_signature_file_io_handle(
libbfio_handle_t *file_io_handle,
libewf_error_t **error );
#endif
#endif
/* Globs the segment files according to the EWF naming schema /* Globs the segment files according to the EWF naming schema
* if the format is known the filename should contain the base of the filen ame * if the format is known the filename should contain the base of the filen ame
* otherwise the function will try to determine the format based on the ext ension * otherwise the function will try to determine the format based on the ext ension
* Returns the amount of filenames if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS ) #if 0 || defined( HAVE_V2_API )
LIBEWF_EXTERN int libewf_glob( LIBEWF_EXTERN int libewf_glob(
const wchar_t *filename, const char *filename,
size_t length, size_t filename_length,
uint8_t format, uint8_t format,
wchar_t **filenames[] ); char **filenames[],
int *amount_of_filenames,
libewf_error_t **error );
#else #else
/* Globs the segment files according to the EWF naming schema
* if the format is known the filename should contain the base of the filen
ame
* otherwise the function will try to determine the format based on the ext
ension
* Returns the amount of filenames if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_glob( LIBEWF_EXTERN int libewf_glob(
const char *filename, const char *filename,
size_t length, size_t filename_length,
uint8_t format, uint8_t format,
char **filenames[] ); char **filenames[] );
#endif #endif
#if 0 || defined( HAVE_V2_API )
/* Frees the globbed filenames
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_glob_free(
char *filenames[],
int amount_of_filenames,
libewf_error_t **error );
#endif
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Globs the segment files according to the EWF naming schema
* if the format is known the filename should contain the base of the filen
ame
* otherwise the function will try to determine the format based on the ext
ension
* Returns 1 if successful or -1 on error
*/
#if 0 || defined( HAVE_V2_API )
LIBEWF_EXTERN int libewf_glob_wide(
const wchar_t *filename,
size_t filename_length,
uint8_t format,
wchar_t **filenames[],
int *amount_of_filenames,
libewf_error_t **error );
#else
/* Globs the segment files according to the EWF naming schema
* if the format is known the filename should contain the base of the filen
ame
* otherwise the function will try to determine the format based on the ext
ension
* Returns the amount of filenames if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_glob_wide(
const wchar_t *filename,
size_t filename_length,
uint8_t format,
wchar_t **filenames[] );
#endif
#if 0 || defined( HAVE_V2_API )
/* Frees the globbed filenames
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_glob_free(
char *filenames[],
int amount_of_filenames,
libewf_error_t **error );
#endif
#endif
/* ------------------------------------------------------------------------
-
* Notify functions (APIv1)
* ------------------------------------------------------------------------
- */
#if 1 || defined( HAVE_V1_API )
/* Set the notify values
*/
LIBEWF_EXTERN void libewf_set_notify_values(
FILE *stream,
uint8_t verbose );
#endif
/* ------------------------------------------------------------------------
-
* Notify functions (APIv2)
* ------------------------------------------------------------------------
- */
#if 0 || defined( HAVE_V2_API )
/* Set the verbose notification
*/
LIBEWF_EXTERN void libewf_notify_set_verbose(
int verbose );
/* Set the notification stream
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_notify_set_stream(
FILE *stream,
libewf_error_t **error );
/* Opens the notification stream using a filename
* The stream is opened in append mode
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_notify_stream_open(
const char *filename,
libewf_error_t **error );
/* Closes the notification stream if opened using a filename
* Returns 0 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_notify_stream_close(
libewf_error_t **error );
#endif
/* ------------------------------------------------------------------------
-
* Error functions (APIv2)
* ------------------------------------------------------------------------
- */
#if 0 || defined( HAVE_V2_API )
/* Frees the error including elements
*/
LIBEWF_EXTERN void libewf_error_free(
libewf_error_t **error );
/* Prints a descriptive string of the error to the stream
* Returns the amount of printed characters if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_error_fprint(
libewf_error_t *error,
FILE *stream );
/* Prints a descriptive string of the error to the string
* Returns the amount of printed characters if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_error_sprint(
libewf_error_t *error,
char *string,
size_t size );
/* Prints a backtrace of the error to the stream
* Returns the amount of printed characters if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_error_backtrace_fprint(
libewf_error_t *error,
FILE *stream );
/* Prints a backtrace of the error to the string
* Returns the amount of printed characters if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_error_backtrace_sprint(
libewf_error_t *error,
char *string,
size_t size );
#endif
/* ------------------------------------------------------------------------
-
* File/Handle functions (APIv1)
* ------------------------------------------------------------------------
- */
#if 1 || defined( HAVE_V1_API )
/* Signals the libewf handle to abort its current activity /* Signals the libewf handle to abort its current activity
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_signal_abort( LIBEWF_EXTERN int libewf_signal_abort(
LIBEWF_HANDLE *handle ); libewf_handle_t *handle );
/* Opens a set of EWF file(s) /* Opens a set of EWF file(s)
* For reading files should contain all filenames that make up an EWF image * For reading files should contain all filenames that make up an EWF image
* For writing files should contain the base of the filename, extentions li ke .e01 will be automatically added * For writing files should contain the base of the filename, extentions li ke .e01 will be automatically added
* Returns a pointer to the new instance of handle, NULL on error * Returns a pointer to the new instance of handle, NULL on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS ) LIBEWF_EXTERN libewf_handle_t *libewf_open(
LIBEWF_EXTERN LIBEWF_HANDLE *libewf_open( char * const filenames[],
wchar_t * const filenames[], int amount_of_filenames,
uint16_t amount_of_files, uint8_t flags );
uint8_t flags );
#else #if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
LIBEWF_EXTERN LIBEWF_HANDLE *libewf_open( /* Opens a set of EWF file(s)
char * const filenames[], * For reading files should contain all filenames that make up an EWF image
uint16_t amount_of_files, * For writing files should contain the base of the filename, extentions li
uint8_t flags ); ke .e01 will be automatically added
* Returns a pointer to the new instance of handle, NULL on error
*/
LIBEWF_EXTERN libewf_handle_t *libewf_open_wide(
wchar_t * const filenames[],
int amount_of_filenames,
uint8_t flags );
#endif #endif
/* Closes the EWF handle and frees memory used within the handle
* Returns 0 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_close(
libewf_handle_t *handle );
/* Seeks a certain offset of the media data within the EWF file(s) /* Seeks a certain offset of the media data within the EWF file(s)
* It will set the related file offset to the specific chunk offset * It will set the related file offset to the specific chunk offset
* Returns the offset if seek is successful or -1 on error * Returns the offset if seek is successful or -1 on error
*/ */
LIBEWF_EXTERN off64_t libewf_seek_offset( LIBEWF_EXTERN off64_t libewf_seek_offset(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
off64_t offset ); off64_t offset );
/* Retrieves the current offset of the media data within the EWF file(s)
* Returns the offset if successful or -1 on error
*/
LIBEWF_EXTERN off64_t libewf_get_offset(
libewf_handle_t *handle );
/* Prepares a buffer with chunk data after reading it according to the hand le settings /* Prepares a buffer with chunk data after reading it according to the hand le settings
* intended for raw read * intended for raw read
* The buffer size cannot be larger than the chunk size * The buffer size cannot be larger than the chunk size
* Returns the resulting chunk size or -1 on error * Returns the resulting chunk size or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_raw_read_prepare_buffer( LIBEWF_EXTERN ssize_t libewf_raw_read_prepare_buffer(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t buffer_size, size_t buffer_size,
void *uncompressed_buffer, void *uncompressed_buffer,
size_t *uncompressed_buffer_size, size_t *uncompressed_buffer_size,
int8_t is_compressed, int8_t is_compressed,
uint32_t chunk_crc, uint32_t chunk_crc,
int8_t read_crc ); int8_t read_crc );
/* Reads 'raw' data from the curent offset into a buffer /* Reads 'raw' data from the curent offset into a buffer
* size contains the size of the buffer * size contains the size of the buffer
* The function sets the chunk crc, is compressed and read crc values * The function sets the chunk crc, is compressed and read crc values
* Returns the amount of bytes read or -1 on error * Returns the amount of bytes read or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_raw_read_buffer( LIBEWF_EXTERN ssize_t libewf_raw_read_buffer(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t size, size_t buffer_size,
int8_t *is_compressed, int8_t *is_compressed,
uint32_t *chunk_crc, uint32_t *chunk_crc,
int8_t *read_crc ); int8_t *read_crc );
/* Reads data from the curent offset into a buffer /* Reads data from the curent offset into a buffer
* Returns the amount of bytes read or -1 on error * Returns the amount of bytes read or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_read_buffer( LIBEWF_EXTERN ssize_t libewf_read_buffer(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t size ); size_t buffer_size );
/* Reads media data from an offset into a buffer /* Reads media data from an offset into a buffer
* Returns the amount of bytes read or -1 on error * Returns the amount of bytes read or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_read_random( LIBEWF_EXTERN ssize_t libewf_read_random(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t size, size_t buffer_size,
off64_t offset ); off64_t offset );
/* Prepares a buffer with chunk data before writing according to the handle settings /* Prepares a buffer with chunk data before writing according to the handle settings
* intended for raw write * intended for raw write
* The buffer size cannot be larger than the chunk size * The buffer size cannot be larger than the chunk size
* The function sets the chunk crc, is compressed and write crc values * The function sets the chunk crc, is compressed and write crc values
* Returns the resulting chunk size or -1 on error * Returns the resulting chunk size or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_raw_write_prepare_buffer( LIBEWF_EXTERN ssize_t libewf_raw_write_prepare_buffer(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t buffer_size, size_t buffer_size,
void *compressed_buffer, void *compressed_buffer,
size_t *compressed_buffer_size, size_t *compressed_buffer_size,
int8_t *is_compressed, int8_t *is_compressed,
uint32_t *chunk_crc, uint32_t *chunk_crc,
int8_t *write_crc ); int8_t *write_crc );
/* Writes 'raw' data in EWF format from a buffer at the current offset /* Writes 'raw' data in EWF format from a buffer at the current offset
* the necessary settings of the write values must have been made * the necessary settings of the write values must have been made
* size contains the size of the data within the buffer while * size contains the size of the data within the buffer while
* data size contains the size of the actual input data * data size contains the size of the actual input data
* Will initialize write if necessary * Will initialize write if necessary
* Returns the amount of input bytes written, 0 when no longer bytes can be written or -1 on error * Returns the amount of input bytes written, 0 when no longer bytes can be written or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_raw_write_buffer( LIBEWF_EXTERN ssize_t libewf_raw_write_buffer(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t size, size_t buffer_size,
size_t data_size, size_t data_size,
int8_t is_compressed, int8_t is_compressed,
uint32_t chunk_crc, uint32_t chunk_crc,
int8_t write_crc ); int8_t write_crc );
/* Writes data in EWF format from a buffer at the current offset /* Writes data in EWF format from a buffer at the current offset
* the necessary settings of the write values must have been made * the necessary settings of the write values must have been made
* Will initialize write if necessary * Will initialize write if necessary
* Returns the amount of input bytes written, 0 when no longer bytes can be written or -1 on error * Returns the amount of input bytes written, 0 when no longer bytes can be written or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_write_buffer( LIBEWF_EXTERN ssize_t libewf_write_buffer(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t size ); size_t buffer_size );
/* Writes data in EWF format from a buffer at an specific offset, /* Writes data in EWF format from a buffer at an specific offset,
* the necessary settings of the write values must have been made * the necessary settings of the write values must have been made
* Will initialize write if necessary * Will initialize write if necessary
* Returns the amount of input bytes written, 0 when no longer bytes can be written or -1 on error * Returns the amount of input bytes written, 0 when no longer bytes can be written or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_write_random( LIBEWF_EXTERN ssize_t libewf_write_random(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
void *buffer, void *buffer,
size_t size, size_t buffer_size,
off64_t offset ); off64_t offset );
/* Finalizes the write by correcting the EWF the meta data in the segment f iles /* Finalizes the write by correcting the EWF the meta data in the segment f iles
* This function is required after writing from stream * This function is required after writing from stream
* Returns the amount of input bytes written or -1 on error * Returns the amount of input bytes written or -1 on error
*/ */
LIBEWF_EXTERN ssize_t libewf_write_finalize( LIBEWF_EXTERN ssize_t libewf_write_finalize(
LIBEWF_HANDLE *handle ); libewf_handle_t *handle );
/* Retrieves the segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_segment_filename(
libewf_handle_t *handle,
char *filename,
size_t filename_size );
/* Sets the segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_segment_filename(
libewf_handle_t *handle,
const char *filename,
size_t filename_length );
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Retrieves the segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_segment_filename_wide(
libewf_handle_t *handle,
wchar_t *filename,
size_t filename_size );
/* Sets the segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_segment_filename_wide(
libewf_handle_t *handle,
const wchar_t *filename,
size_t filename_length );
#endif
/* Retrieves the segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_get_segment_file_size(
libewf_handle_t *handle,
size64_t *segment_file_size );
/* Sets the segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_segment_file_size(
libewf_handle_t *handle,
size64_t segment_file_size );
/* Retrieves the delta segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_delta_segment_filename(
libewf_handle_t *handle,
char *filename,
size_t filename_size );
/* Sets the delta segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_delta_segment_filename(
libewf_handle_t *handle,
const char *filename,
size_t filename_length );
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Retrieves the delta segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_delta_segment_filename_wide(
libewf_handle_t *handle,
wchar_t *filename,
size_t filename_size );
/* Sets the delta segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_delta_segment_filename_wide(
libewf_handle_t *handle,
const wchar_t *filename,
size_t filename_length );
#endif
/* Retrieves the delta segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_get_delta_segment_file_size(
libewf_handle_t *handle,
size64_t *delta_segment_file_size );
/* Sets the delta segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_delta_segment_file_size(
libewf_handle_t *handle,
size64_t delta_segment_file_size );
#endif
/* ------------------------------------------------------------------------
-
* File/Handle functions (APIv2)
* ------------------------------------------------------------------------
- */
#if 0 || defined( HAVE_V2_API )
/* Initialize the handle
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_initialize(
libewf_handle_t **handle,
libewf_error_t **error );
/* Frees the handle including elements
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_free(
libewf_handle_t **handle,
libewf_error_t **error );
/* Signals the libewf handle to abort its current activity
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_signal_abort(
libewf_handle_t *handle,
libewf_error_t **error );
/* Opens a set of EWF file(s)
* For reading files should contain all filenames that make up an EWF image
* For writing files should contain the base of the filename, extentions li
ke .e01 will be automatically added
* Returns a pointer to the new instance of handle, NULL on error
*/
LIBEWF_EXTERN int libewf_handle_open(
libewf_handle_t *handle,
char * const filenames[],
int amount_of_filenames,
uint8_t flags,
libewf_error_t **error );
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Opens a set of EWF file(s)
* For reading files should contain all filenames that make up an EWF image
* For writing files should contain the base of the filename, extentions li
ke .e01 will be automatically added
* Returns a pointer to the new instance of handle, NULL on error
*/
LIBEWF_EXTERN int libewf_handle_open_wide(
libewf_handle_t *handle,
wchar_t * const filenames[],
int amount_of_filenames,
uint8_t flags,
libewf_error_t **error );
#endif
#if defined( LIBEWF_HAVE_BFIO )
/* Opens a set of EWF file(s) using a Basic File IO (bfio) pool
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_open_file_io_pool(
libewf_handle_t *handle,
libbfio_pool_t *file_io_pool,
uint8_t flags,
libewf_error_t **error );
#endif
/* Closes the EWF handle and frees memory used within the handle /* Closes the EWF handle and frees memory used within the handle
* Returns 0 if successful or -1 on error * Returns 0 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_close( LIBEWF_EXTERN int libewf_handle_close(
LIBEWF_HANDLE *handle ); libewf_handle_t *handle,
libewf_error_t **error );
/* Seeks a certain offset of the media data within the EWF file(s)
* It will set the related file offset to the specific chunk offset
* Returns the offset if seek is successful or -1 on error
*/
LIBEWF_EXTERN off64_t libewf_handle_seek_offset(
libewf_handle_t *handle,
off64_t offset,
int whence,
libewf_error_t **error );
/* Retrieves the current offset of the media data within the EWF file(s)
* Returns the offset if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_offset(
libewf_handle_t *handle,
off64_t *offset,
libewf_error_t **error );
/* Prepares chunk data after reading it according to the handle settings
* This function should be used after libewf_handle_read_chunk
* The chunk buffer size should contain the actual chunk size
* Returns the resulting chunk size or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_prepare_read_chunk(
libewf_handle_t *handle,
void *chunk_buffer,
size_t chunk_buffer_size,
void *uncompressed_buffer,
size_t *uncompressed_buffer_size,
int8_t is_compressed,
uint32_t chunk_crc,
int8_t read_crc,
libewf_error_t **error );
/* Reads a chunk from the curent offset into a buffer
* size contains the size of the chunk buffer
* The function sets the chunk crc, is compressed and read crc values
* Returns the amount of bytes read or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_read_chunk(
libewf_handle_t *handle,
void *chunk_buffer,
size_t chunk_buffer_size,
int8_t *is_compressed,
void *crc_buffer,
uint32_t *chunk_crc,
int8_t *read_crc,
libewf_error_t **error );
/* Reads data from the curent offset into a buffer
* Returns the amount of bytes read or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_read_buffer(
libewf_handle_t *handle,
void *buffer,
size_t buffer_size,
libewf_error_t **error );
/* Reads media data from an offset into a buffer
* Returns the amount of bytes read or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_read_random(
libewf_handle_t *handle,
void *buffer,
size_t buffer_size,
off64_t offset,
libewf_error_t **error );
/* Prepares a buffer with chunk data before writing according to the handle
settings
* This function should be used before libewf_handle_write_chunk
* The chunk buffer size should contain the actual chunk size
* The function sets the chunk crc, is compressed and write crc values
* Returns the resulting chunk size or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_prepare_write_chunk(
libewf_handle_t *handle,
void *buffer,
size_t buffer_size,
void *compressed_buffer,
size_t *compressed_buffer_size,
int8_t *is_compressed,
uint32_t *chunk_crc,
int8_t *write_crc,
libewf_error_t **error );
/* Writes a chunk in EWF format from a buffer at the current offset
* the necessary settings of the write values must have been made
* size contains the size of the data within the buffer while
* data size contains the size of the actual input data
* Will initialize write if necessary
* Returns the amount of input bytes written, 0 when no longer bytes can be
written or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_write_chunk(
libewf_handle_t *handle,
void *chunk_buffer,
size_t chunk_buffer_size,
size_t data_size,
int8_t is_compressed,
void *crc_buffer,
uint32_t chunk_crc,
int8_t write_crc,
libewf_error_t **error );
/* Writes data in EWF format from a buffer at the current offset
* the necessary settings of the write values must have been made
* Will initialize write if necessary
* Returns the amount of input bytes written, 0 when no longer bytes can be
written or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_write_buffer(
libewf_handle_t *handle,
void *buffer,
size_t buffer_size,
libewf_error_t **error );
/* Writes data in EWF format from a buffer at an specific offset,
* the necessary settings of the write values must have been made
* Will initialize write if necessary
* Returns the amount of input bytes written, 0 when no longer bytes can be
written or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_write_random(
libewf_handle_t *handle,
void *buffer,
size_t buffer_size,
off64_t offset,
libewf_error_t **error );
/* Finalizes the write by correcting the EWF the meta data in the segment f
iles
* This function is required after writing from stream
* Returns the amount of input bytes written or -1 on error
*/
LIBEWF_EXTERN ssize_t libewf_handle_write_finalize(
libewf_handle_t *handle,
libewf_error_t **error );
/* Retrieves the segment filename size
* The filename size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_segment_filename_size(
libewf_handle_t *handle,
size_t *filename_size,
libewf_error_t **error );
/* Retrieves the segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_segment_filename(
libewf_handle_t *handle,
char *filename,
size_t filename_size,
libewf_error_t **error );
/* Sets the segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_segment_filename(
libewf_handle_t *handle,
const char *filename,
size_t filename_length,
libewf_error_t **error );
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Retrieves the segment filename size
* The filename size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_segment_filename_size_wide(
libewf_handle_t *handle,
size_t *filename_size,
libewf_error_t **error );
/* Retrieves the segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_segment_filename_wide(
libewf_handle_t *handle,
wchar_t *filename,
size_t filename_size,
libewf_error_t **error );
/* Sets the segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_segment_filename_wide(
libewf_handle_t *handle,
const wchar_t *filename,
size_t filename_length,
libewf_error_t **error );
#endif
/* Retrieves the segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_segment_file_size(
libewf_handle_t *handle,
size64_t *segment_file_size,
libewf_error_t **error );
/* Sets the segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_segment_file_size(
libewf_handle_t *handle,
size64_t segment_file_size,
libewf_error_t **error );
/* Retrieves the delta segment filename size
* The filename size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_delta_segment_filename_size(
libewf_handle_t *handle,
size_t *filename_size,
libewf_error_t **error );
/* Retrieves the delta segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_delta_segment_filename(
libewf_handle_t *handle,
char *filename,
size_t filename_size,
libewf_error_t **error );
/* Sets the delta segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_delta_segment_filename(
libewf_handle_t *handle,
const char *filename,
size_t filename_length,
libewf_error_t **error );
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Retrieves the delta segment filename size
* The filename size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_delta_segment_filename_size_wide(
libewf_handle_t *handle,
size_t *filename_size,
libewf_error_t **error );
/* Retrieves the delta segment filename
* The filename size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_delta_segment_filename_wide(
libewf_handle_t *handle,
wchar_t *filename,
size_t filename_size,
libewf_error_t **error );
/* Sets the delta segment filename
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_delta_segment_filename_wide(
libewf_handle_t *handle,
const wchar_t *filename,
size_t filename_length,
libewf_error_t **error );
#endif
/* Retrieves the delta segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_delta_segment_file_size(
libewf_handle_t *handle,
size64_t *delta_segment_file_size,
libewf_error_t **error );
/* Sets the delta segment file size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_delta_segment_file_size(
libewf_handle_t *handle,
size64_t delta_segment_file_size,
libewf_error_t **error );
/* Retrieves the filename size of the (delta) segment file of the current c
hunk
* The filename size includes the end of string character
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_filename_size(
libewf_handle_t *handle,
size_t *filename_size,
libewf_error_t **error );
/* Retrieves the filename of the (delta) segment file of the current chunk
* The filename size should include the end of string character
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_filename(
libewf_handle_t *handle,
char *filename,
size_t filename_size,
libewf_error_t **error );
#if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
/* Retrieves the filename size of the (delta) segment file of the current c
hunk
* The filename size includes the end of string character
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_filename_size_wide(
libewf_handle_t *handle,
size_t *filename_size,
libewf_error_t **error );
/* Retrieves the filename of the (delta) segment file of the current chunk
* The filename size should include the end of string character
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_filename_wide(
libewf_handle_t *handle,
wchar_t *filename,
size_t filename_size,
libewf_error_t **error );
#endif
#if defined( LIBEWF_HAVE_BFIO )
/* Retrieves the file io handle of the (delta) segment file of the current
chunk
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_file_io_handle(
libewf_handle_t *handle,
libbfio_handle_t **file_io_handle,
libewf_error_t **error );
#endif
#endif
/* ------------------------------------------------------------------------
-
* Meta data functions (APIv1)
* ------------------------------------------------------------------------
- */
#if 1 || defined( HAVE_V1_API )
/* Retrieves the amount of sectors per chunk from the media information /* Retrieves the amount of sectors per chunk from the media information
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_sectors_per_chunk( LIBEWF_EXTERN int libewf_get_sectors_per_chunk(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *sectors_per_chunk ); uint32_t *sectors_per_chunk );
/* Sets the amount of sectors per chunk in the media information
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_sectors_per_chunk(
libewf_handle_t *handle,
uint32_t sectors_per_chunk );
/* Retrieves the amount of bytes per sector from the media information /* Retrieves the amount of bytes per sector from the media information
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_bytes_per_sector( LIBEWF_EXTERN int libewf_get_bytes_per_sector(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *bytes_per_sector ); uint32_t *bytes_per_sector );
/* Sets the amount of bytes per sector in the media information
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_bytes_per_sector(
libewf_handle_t *handle,
uint32_t bytes_per_sector );
/* Retrieves the amount of sectors from the media information /* Retrieves the amount of sectors from the media information
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_amount_of_sectors( LIBEWF_EXTERN int libewf_get_amount_of_sectors(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *amount_of_sectors ); uint32_t *amount_of_sectors );
/* Retrieves the chunk size from the media information /* Retrieves the chunk size from the media information
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_chunk_size( LIBEWF_EXTERN int libewf_get_chunk_size(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
size32_t *chunk_size ); size32_t *chunk_size );
/* Retrieves the error granularity from the media information /* Retrieves the error granularity from the media information
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_error_granularity( LIBEWF_EXTERN int libewf_get_error_granularity(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *error_granularity ); uint32_t *error_granularity );
/* Sets the error granularity
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_error_granularity(
libewf_handle_t *handle,
uint32_t error_granularity );
/* Retrieves the compression values /* Retrieves the compression values
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_compression_values( LIBEWF_EXTERN int libewf_get_compression_values(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
int8_t *compression_level, int8_t *compression_level,
uint8_t *compress_empty_block ); uint8_t *compress_empty_block );
/* Sets the compression values
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_compression_values(
libewf_handle_t *handle,
int8_t compression_level,
uint8_t compress_empty_block );
/* Retrieves the size of the contained media data /* Retrieves the size of the contained media data
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_media_size( LIBEWF_EXTERN int libewf_get_media_size(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
size64_t *media_size ); size64_t *media_size );
/* Sets the media size
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_media_size(
libewf_handle_t *handle,
size64_t media_size );
/* Retrieves the media type value /* Retrieves the media type value
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_media_type( LIBEWF_EXTERN int libewf_get_media_type(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
int8_t *media_type ); uint8_t *media_type );
/* Sets the media type
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_media_type(
libewf_handle_t *handle,
uint8_t media_type );
/* Retrieves the media flags /* Retrieves the media flags
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_media_flags( LIBEWF_EXTERN int libewf_get_media_flags(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
int8_t *media_flags ); uint8_t *media_flags );
/* Sets the media flags
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_media_flags(
libewf_handle_t *handle,
uint8_t media_flags );
/* Retrieves the volume type value /* Retrieves the volume type value
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_volume_type( LIBEWF_EXTERN int libewf_get_volume_type(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
int8_t *volume_type ); uint8_t *volume_type );
/* Sets the volume type
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_volume_type(
libewf_handle_t *handle,
uint8_t volume_type );
/* Retrieves the format type value /* Retrieves the format type value
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_format( LIBEWF_EXTERN int libewf_get_format(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t *format ); uint8_t *format );
/* Sets the output format
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_format(
libewf_handle_t *handle,
uint8_t format );
/* Retrieves the GUID /* Retrieves the GUID
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_guid( LIBEWF_EXTERN int libewf_get_guid(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t *guid,
size_t size );
/* Sets the GUID
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_guid(
libewf_handle_t *handle,
uint8_t *guid, uint8_t *guid,
size_t size ); size_t size );
/* Retrieves the MD5 hash /* Retrieves the MD5 hash
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_md5_hash( LIBEWF_EXTERN int libewf_get_md5_hash(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t *md5_hash, uint8_t *md5_hash,
size_t size ); size_t size );
/* Retrieves the segment filename /* Sets the MD5 hash
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS ) LIBEWF_EXTERN int libewf_set_md5_hash(
LIBEWF_EXTERN int libewf_get_segment_filename( libewf_handle_t *handle,
LIBEWF_HANDLE *handle, uint8_t *md5_hash,
wchar_t *filename, size_t size );
size_t length );
#else
LIBEWF_EXTERN int libewf_get_segment_filename(
LIBEWF_HANDLE *handle,
char *filename,
size_t length );
#endif
/* Retrieves the delta segment filename /* Retrieves the SHA1 hash
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS ) LIBEWF_EXTERN int libewf_get_sha1_hash(
LIBEWF_EXTERN int libewf_get_delta_segment_filename( libewf_handle_t *handle,
LIBEWF_HANDLE *handle, uint8_t *sha1_hash,
wchar_t *filename, size_t size );
size_t length );
#else /* Sets the SHA1 hash
LIBEWF_EXTERN int libewf_get_delta_segment_filename( * Returns 1 if successful, 0 if value not present or -1 on error
LIBEWF_HANDLE *handle, */
char *filename, LIBEWF_EXTERN int libewf_set_sha1_hash(
size_t length ); libewf_handle_t *handle,
#endif uint8_t *sha1_hash,
size_t size );
/* Retrieves the amount of chunks written
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_get_write_amount_of_chunks(
libewf_handle_t *handle,
uint32_t *amount_of_chunks );
/* Sets the read wipe chunk on error
* The chunk is not wiped if read raw is used
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_read_wipe_chunk_on_error(
libewf_handle_t *handle,
uint8_t wipe_on_error );
/* Copies the media values from the source to the destination handle
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_copy_media_values(
libewf_handle_t *destination_handle,
libewf_handle_t *source_handle );
/* Retrieves the amount of acquiry errors /* Retrieves the amount of acquiry errors
* Returns 1 if successful, 0 if no acquiry errors are present or -1 on err or * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_amount_of_acquiry_errors( LIBEWF_EXTERN int libewf_get_amount_of_acquiry_errors(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *amount_of_errors ); uint32_t *amount_of_errors );
/* Retrieves the information of an acquiry error /* Retrieves the information of an acquiry error
* Returns 1 if successful, 0 if no acquiry error could be found or -1 on e rror * Returns 1 if successful, 0 if no acquiry error could be found or -1 on e rror
*/ */
LIBEWF_EXTERN int libewf_get_acquiry_error( LIBEWF_EXTERN int libewf_get_acquiry_error(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t index, uint32_t index,
off64_t *first_sector, off64_t *first_sector,
uint32_t *amount_of_sectors ); uint32_t *amount_of_sectors );
/* Add an acquiry error
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_add_acquiry_error(
libewf_handle_t *handle,
off64_t first_sector,
uint32_t amount_of_sectors );
/* Retrieves the amount of CRC errors /* Retrieves the amount of CRC errors
* Returns 1 if successful, 0 if no CRC errors are present or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_amount_of_crc_errors( LIBEWF_EXTERN int libewf_get_amount_of_crc_errors(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *amount_of_errors ); uint32_t *amount_of_errors );
/* Retrieves the information of a CRC error /* Retrieves the information of a CRC error
* Returns 1 if successful, 0 if no CRC error could be found or -1 on error * Returns 1 if successful, 0 if no CRC error could be found or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_crc_error( LIBEWF_EXTERN int libewf_get_crc_error(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t index, uint32_t index,
off64_t *first_sector, off64_t *first_sector,
uint32_t *amount_of_sectors ); uint32_t *amount_of_sectors );
/* Add a CRC error
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_add_crc_error(
libewf_handle_t *handle,
off64_t first_sector,
uint32_t amount_of_sectors );
/* Retrieves the amount of sessions /* Retrieves the amount of sessions
* Returns 1 if successful, 0 if no sessions are present or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_amount_of_sessions( LIBEWF_EXTERN int libewf_get_amount_of_sessions(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *amount_of_sessions ); uint32_t *amount_of_sessions );
/* Retrieves the information of a session /* Retrieves the information of a session
* Returns 1 if successful, 0 if no sessions could be found or -1 on error * Returns 1 if successful, 0 if no sessions could be found or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_session( LIBEWF_EXTERN int libewf_get_session(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t index, uint32_t index,
off64_t *first_sector, off64_t *first_sector,
uint32_t *amount_of_sectors ); uint32_t *amount_of_sectors );
/* Retrieves the amount of chunks written /* Add a session
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_write_amount_of_chunks( LIBEWF_EXTERN int libewf_add_session(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *amount_of_chunks ); off64_t first_sector,
uint32_t amount_of_sectors );
/* Retrieves the header codepage
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_get_header_codepage(
libewf_handle_t *handle,
int *header_codepage );
/* Sets the header codepage
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_header_codepage(
libewf_handle_t *handle,
int header_codepage );
/* Retrieves the amount of header values /* Retrieves the amount of header values
* Returns 1 if successful, 0 if no header values are present or -1 on erro r * Returns 1 if successful, 0 if no header values are present or -1 on erro r
*/ */
LIBEWF_EXTERN int libewf_get_amount_of_header_values( LIBEWF_EXTERN int libewf_get_amount_of_header_values(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *amount_of_values ); uint32_t *amount_of_values );
/* Retrieves the header value identifier specified by its index /* Retrieves the header value identifier size specified by its index
* The identifier size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) LIBEWF_EXTERN int libewf_get_header_value_identifier_size(
LIBEWF_EXTERN int libewf_get_header_value_identifier( libewf_handle_t *handle,
LIBEWF_HANDLE *handle,
uint32_t index, uint32_t index,
wchar_t *value, size_t *identifier_size );
size_t length );
#else /* Retrieves the header value identifier specified by its index
* The strings are encoded in UTF-8
* The identifier size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_header_value_identifier( LIBEWF_EXTERN int libewf_get_header_value_identifier(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t index, uint32_t index,
char *value, char *identifier,
size_t length ); size_t identifier_size );
#endif
/* Retrieves the header value size specified by the identifier
* The value size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_header_value_size(
libewf_handle_t *handle,
const char *identifier,
size_t *value_size );
/* Retrieves the header value specified by the identifier /* Retrieves the header value specified by the identifier
* The strings are encoded in UTF-8
* The value size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE )
LIBEWF_EXTERN int libewf_get_header_value( LIBEWF_EXTERN int libewf_get_header_value(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
wchar_t *identifier, const char *identifier,
wchar_t *value,
size_t length );
#else
LIBEWF_EXTERN int libewf_get_header_value(
LIBEWF_HANDLE *handle,
char *identifier,
char *value, char *value,
size_t length ); size_t value_size );
#endif
/* Retrieves the header value case number /* Retrieves the header value case number
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_case_number( handle, value, value_size ) \
#define libewf_get_header_value_case_number( handle, value, length ) \ libewf_get_header_value( handle, "case_number", value, value_size )
libewf_get_header_value( handle, L"case_number", value, length )
#else
#define libewf_get_header_value_case_number( handle, value, length ) \
libewf_get_header_value( handle, "case_number", value, length )
#endif
/* Retrieves the header value description /* Retrieves the header value description
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_description( handle, value, value_size ) \
#define libewf_get_header_value_description( handle, value, length ) \ libewf_get_header_value( handle, "description", value, value_size )
libewf_get_header_value( handle, L"description", value, length )
#else
#define libewf_get_header_value_description( handle, value, length ) \
libewf_get_header_value( handle, "description", value, length )
#endif
/* Retrieves the header value examiner name /* Retrieves the header value examiner name
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_examiner_name( handle, value, value_size )
#define libewf_get_header_value_examiner_name( handle, value, length ) \ \
libewf_get_header_value( handle, L"examiner_name", value, length ) libewf_get_header_value( handle, "examiner_name", value, value_size
#else )
#define libewf_get_header_value_examiner_name( handle, value, length ) \
libewf_get_header_value( handle, "examiner_name", value, length )
#endif
/* Retrieves the header value evidence number /* Retrieves the header value evidence number
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_evidence_number( handle, value, value_size
#define libewf_get_header_value_evidence_number( handle, value, length ) \ ) \
libewf_get_header_value( handle, L"evidence_number", value, length libewf_get_header_value( handle, "evidence_number", value, value_si
) ze )
#else
#define libewf_get_header_value_evidence_number( handle, value, length ) \
libewf_get_header_value( handle, "evidence_number", value, length )
#endif
/* Retrieves the header value notes /* Retrieves the header value notes
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_notes( handle, value, value_size ) \
#define libewf_get_header_value_notes( handle, value, length ) \ libewf_get_header_value( handle, "notes", value, value_size )
libewf_get_header_value( handle, L"notes", value, length )
#else
#define libewf_get_header_value_notes( handle, value, length ) \
libewf_get_header_value( handle, "notes", value, length )
#endif
/* Retrieves the header value acquiry date /* Retrieves the header value acquiry date
* The string is formatted according to the date format
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_acquiry_date( handle, value, value_size ) \
#define libewf_get_header_value_acquiry_date( handle, value, length ) \ libewf_get_header_value( handle, "acquiry_date", value, value_size
libewf_get_header_value( handle, L"acquiry_date", value, length ) )
#else
#define libewf_get_header_value_acquiry_date( handle, value, length ) \
libewf_get_header_value( handle, "acquiry_date", value, length )
#endif
/* Retrieves the header value system date /* Retrieves the header value system date
* The string is formatted according to the date format
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_system_date( handle, value, value_size ) \
#define libewf_get_header_value_system_date( handle, value, length ) \ libewf_get_header_value( handle, "system_date", value, value_size )
libewf_get_header_value( handle, L"system_date", value, length )
#else
#define libewf_get_header_value_system_date( handle, value, length ) \
libewf_get_header_value( handle, "system_date", value, length )
#endif
/* Retrieves the header value acquiry operating system /* Retrieves the header value acquiry operating system
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_acquiry_operating_system( handle, value, va
#define libewf_get_header_value_acquiry_operating_system( handle, value, le lue_size ) \
ngth ) \ libewf_get_header_value( handle, "acquiry_operating_system", value,
libewf_get_header_value( handle, L"acquiry_operating_system", value value_size )
, length )
#else
#define libewf_get_header_value_acquiry_operating_system( handle, value, le
ngth ) \
libewf_get_header_value( handle, "acquiry_operating_system", value,
length )
#endif
/* Retrieves the header value acquiry software version /* Retrieves the header value acquiry software version
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_acquiry_software_version( handle, value, va
#define libewf_get_header_value_acquiry_software_version( handle, value, le lue_size ) \
ngth ) \ libewf_get_header_value( handle, "acquiry_software_version", value,
libewf_get_header_value( handle, L"acquiry_software_version", value value_size )
, length )
#else
#define libewf_get_header_value_acquiry_software_version( handle, value, le
ngth ) \
libewf_get_header_value( handle, "acquiry_software_version", value,
length )
#endif
/* Retrieves the header value password /* Retrieves the header value password
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_password( handle, value, value_size ) \
#define libewf_get_header_value_password( handle, value, length ) \ libewf_get_header_value( handle, "password", value, value_size )
libewf_get_header_value( handle, L"password", value, length )
#else
#define libewf_get_header_value_password( handle, value, length ) \
libewf_get_header_value( handle, "password", value, length )
#endif
/* Retrieves the header value compression type /* Retrieves the header value compression type
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_compression_type( handle, value, value_size
#define libewf_get_header_value_compression_type( handle, value, length ) \ ) \
libewf_get_header_value( handle, L"compression_type", value, length libewf_get_header_value( handle, "compression_type", value, value_s
) ize )
#else
#define libewf_get_header_value_compression_type( handle, value, length ) \
libewf_get_header_value( handle, "compression_type", value, length
)
#endif
/* Retrieves the header value model /* Retrieves the header value model
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_model( handle, value, value_size ) \
#define libewf_get_header_value_model( handle, value, length ) \ libewf_get_header_value( handle, "model", value, value_size )
libewf_get_header_value( handle, L"model", value, length )
#else
#define libewf_get_header_value_model( handle, value, length ) \
libewf_get_header_value( handle, "model", value, length )
#endif
/* Retrieves the header value serial number /* Retrieves the header value serial number
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_header_value_serial_number( handle, value, value_size )
#define libewf_get_header_value_serial_number( handle, value, length ) \ \
libewf_get_header_value( handle, L"serial_number", value, length ) libewf_get_header_value( handle, "serial_number", value, value_size
#else )
#define libewf_get_header_value_serial_number( handle, value, length ) \
libewf_get_header_value( handle, "serial_number", value, length ) /* Sets the header value specified by the identifier
#endif * The strings are encoded in UTF-8
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_header_value(
libewf_handle_t *handle,
const char *identifier,
const char *value,
size_t value_length );
/* Sets the header value case number
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_case_number( handle, value, value_length )
\
libewf_set_header_value( handle, "case_number", value, value_length
)
/* Sets the header value description
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_description( handle, value, value_length )
\
libewf_set_header_value( handle, "description", value, value_length
)
/* Sets the header value examiner name
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_examiner_name( handle, value, value_length
) \
libewf_set_header_value( handle, "examiner_name", value, value_leng
th )
/* Sets the header value evidence number
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_evidence_number( handle, value, value_lengt
h ) \
libewf_set_header_value( handle, "evidence_number", value, value_le
ngth )
/* Sets the header value notes
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_notes( handle, value, value_length ) \
libewf_set_header_value( handle, "notes", value, value_length )
/* Sets the header value acquiry date
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_acquiry_date( handle, value, value_length )
\
libewf_set_header_value( handle, "acquiry_date", value, value_lengt
h )
/* Sets the header value system date
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_system_date( handle, value, value_length )
\
libewf_set_header_value( handle, "system_date", value, value_length
)
/* Sets the header value acquiry operating system
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_acquiry_operating_system( handle, value, va
lue_length ) \
libewf_set_header_value( handle, "acquiry_operating_system", value,
value_length )
/* Sets the header value acquiry software version
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_acquiry_software_version( handle, value, va
lue_length ) \
libewf_set_header_value( handle, "acquiry_software_version", value,
value_length )
/* Sets the header value password
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_password( handle, value, value_length ) \
libewf_set_header_value( handle, "password", value, value_length )
/* Sets the header value compression type
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_compression_type( handle, value, value_leng
th ) \
libewf_set_header_value( handle, "compression_type", value, value_l
ength )
/* Sets the header value model
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_model( handle, value, value_length ) \
libewf_set_header_value( handle, "model", value, value_length )
/* Sets the header value serial number
* Returns 1 if successful or -1 on error
*/
#define libewf_set_header_value_serial_number( handle, value, value_length
) \
libewf_set_header_value( handle, "serial_number", value, value_leng
th )
/* Parses the header values from the xheader, header2 or header section
* Will parse the first available header in order mentioned above
* Returns 1 if successful, 0 if already parsed or -1 on error
*/
LIBEWF_EXTERN int libewf_parse_header_values(
libewf_handle_t *handle,
uint8_t date_format );
/* Copies the header values from the source to the destination handle
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_copy_header_values(
libewf_handle_t *destination_handle,
libewf_handle_t *source_handle );
/* Retrieves the amount of hash values /* Retrieves the amount of hash values
* Returns 1 if successful, 0 if no hash values are present or -1 on error * Returns 1 if successful, 0 if no hash values are present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_get_amount_of_hash_values( LIBEWF_EXTERN int libewf_get_amount_of_hash_values(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t *amount_of_values ); uint32_t *amount_of_values );
/* Retrieves the hash value identifier specified by its index /* Retrieves the hash value identifier size specified by its index
* The identifier size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) LIBEWF_EXTERN int libewf_get_hash_value_identifier_size(
LIBEWF_EXTERN int libewf_get_hash_value_identifier( libewf_handle_t *handle,
LIBEWF_HANDLE *handle,
uint32_t index, uint32_t index,
wchar_t *value, size_t *identifier_size );
size_t length );
#else /* Retrieves the hash value identifier specified by its index
* The strings are encoded in UTF-8
* The identifier size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_hash_value_identifier( LIBEWF_EXTERN int libewf_get_hash_value_identifier(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t index, uint32_t index,
char *value, char *identifier,
size_t length ); size_t identifier_size );
#endif
/* Retrieves the hash value size specified by the identifier
* The value size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_get_hash_value_size(
libewf_handle_t *handle,
const char *identifier,
size_t *value_size );
/* Retrieves the hash value specified by the identifier /* Retrieves the hash value specified by the identifier
* The strings are encoded in UTF-8
* The value size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE )
LIBEWF_EXTERN int libewf_get_hash_value( LIBEWF_EXTERN int libewf_get_hash_value(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
wchar_t *identifier, const char *identifier,
wchar_t *value,
size_t length );
#else
LIBEWF_EXTERN int libewf_get_hash_value(
LIBEWF_HANDLE *handle,
char *identifier,
char *value, char *value,
size_t length ); size_t value_size );
#endif
/* Retrieves the hash value MD5 /* Retrieves the hash value MD5
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_hash_value_md5( handle, value, value_size ) \
#define libewf_get_hash_value_md5( handle, value, length ) \ libewf_get_hash_value( handle, "MD5", value, value_size )
libewf_get_hash_value( handle, L"MD5", value, length )
#else
#define libewf_get_hash_value_md5( handle, value, length ) \
libewf_get_hash_value( handle, "MD5", value, length )
#endif
/* Retrieves the hash value SHA1 /* Retrieves the hash value SHA1
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_get_hash_value_sha1( handle, value, value_size ) \
#define libewf_get_hash_value_sha1( handle, value, length ) \ libewf_get_hash_value( handle, "SHA1", value, value_size )
libewf_get_hash_value( handle, L"SHA1", value, length )
#else /* Sets the hash value specified by the identifier
#define libewf_get_hash_value_sha1( handle, value, length ) \ * The strings are encoded in UTF-8
libewf_get_hash_value( handle, "SHA1", value, length ) * Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_set_hash_value(
libewf_handle_t *handle,
const char *identifier,
const char *value,
size_t value_length );
/* Sets the hash value MD5
* Returns 1 if successful or -1 on error
*/
#define libewf_set_hash_value_md5( handle, value, value_length ) \
libewf_set_hash_value( handle, "MD5", value, value_length )
/* Sets the hash value SHA1
* Returns 1 if successful or -1 on error
*/
#define libewf_set_hash_value_sha1( handle, value, value_length ) \
libewf_set_hash_value( handle, "SHA1", value, value_length )
/* Parses the hash values from the xhash section
* Returns 1 if successful, 0 if already parsed or -1 on error
*/
LIBEWF_EXTERN int libewf_parse_hash_values(
libewf_handle_t *handle );
#endif #endif
/* ------------------------------------------------------------------------
-
* Meta data functions (APIv2)
* ------------------------------------------------------------------------
- */
#if 0 || defined( HAVE_V2_API )
/* Retrieves the amount of sectors per chunk from the media information
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_sectors_per_chunk(
libewf_handle_t *handle,
uint32_t *sectors_per_chunk,
libewf_error_t **error );
/* Sets the amount of sectors per chunk in the media information /* Sets the amount of sectors per chunk in the media information
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_sectors_per_chunk( LIBEWF_EXTERN int libewf_handle_set_sectors_per_chunk(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t sectors_per_chunk ); uint32_t sectors_per_chunk,
libewf_error_t **error );
/* Retrieves the amount of bytes per sector from the media information
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_bytes_per_sector(
libewf_handle_t *handle,
uint32_t *bytes_per_sector,
libewf_error_t **error );
/* Sets the amount of bytes per sector in the media information /* Sets the amount of bytes per sector in the media information
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_bytes_per_sector( LIBEWF_EXTERN int libewf_handle_set_bytes_per_sector(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t bytes_per_sector ); uint32_t bytes_per_sector,
libewf_error_t **error );
/* Retrieves the amount of sectors from the media information
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_amount_of_sectors(
libewf_handle_t *handle,
uint64_t *amount_of_sectors,
libewf_error_t **error );
/* Retrieves the chunk size from the media information
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_chunk_size(
libewf_handle_t *handle,
size32_t *chunk_size,
libewf_error_t **error );
/* Retrieves the error granularity from the media information
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_error_granularity(
libewf_handle_t *handle,
uint32_t *error_granularity,
libewf_error_t **error );
/* Sets the error granularity /* Sets the error granularity
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_error_granularity( LIBEWF_EXTERN int libewf_handle_set_error_granularity(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint32_t error_granularity ); uint32_t error_granularity,
libewf_error_t **error );
/* Retrieves the compression values
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_compression_values(
libewf_handle_t *handle,
int8_t *compression_level,
uint8_t *compression_flags,
libewf_error_t **error );
/* Sets the compression values /* Sets the compression values
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_compression_values( LIBEWF_EXTERN int libewf_handle_set_compression_values(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
int8_t compression_level, int8_t compression_level,
uint8_t compress_empty_block ); uint8_t compression_flags,
libewf_error_t **error );
/* Sets the media size /* Retrieves the size of the contained media data
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_media_size( LIBEWF_EXTERN int libewf_handle_get_media_size(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
size64_t media_size ); size64_t *media_size,
libewf_error_t **error );
/* Sets the segment file size /* Sets the media size
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_segment_file_size( LIBEWF_EXTERN int libewf_handle_set_media_size(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
size64_t segment_file_size ); size64_t media_size,
libewf_error_t **error );
/* Sets the delta segment file size /* Retrieves the media type value
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_delta_segment_file_size( LIBEWF_EXTERN int libewf_handle_get_media_type(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
size64_t delta_segment_file_size ); uint8_t *media_type,
libewf_error_t **error );
/* Sets the media type /* Sets the media type
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_media_type( LIBEWF_EXTERN int libewf_handle_set_media_type(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t media_type ); uint8_t media_type,
libewf_error_t **error );
/* Sets the volume type /* Retrieves the media flags
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_volume_type( LIBEWF_EXTERN int libewf_handle_get_media_flags(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t volume_type ); uint8_t *media_flags,
libewf_error_t **error );
/* Sets the media flags
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_media_flags(
libewf_handle_t *handle,
uint8_t media_flags,
libewf_error_t **error );
/* Retrieves the format type value
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_format(
libewf_handle_t *handle,
uint8_t *format,
libewf_error_t **error );
/* Sets the output format /* Sets the output format
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_format( LIBEWF_EXTERN int libewf_handle_set_format(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t format ); uint8_t format,
libewf_error_t **error );
/* Retrieves the GUID
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_guid(
libewf_handle_t *handle,
uint8_t *guid,
size_t size,
libewf_error_t **error );
/* Sets the GUID /* Sets the GUID
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_guid( LIBEWF_EXTERN int libewf_handle_set_guid(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t *guid, uint8_t *guid,
size_t size ); size_t size,
libewf_error_t **error );
/* Retrieves the MD5 hash
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_md5_hash(
libewf_handle_t *handle,
uint8_t *md5_hash,
size_t size,
libewf_error_t **error );
/* Sets the MD5 hash /* Sets the MD5 hash
* Returns 1 if successful, 0 if value not present or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_md5_hash( LIBEWF_EXTERN int libewf_handle_set_md5_hash(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t *md5_hash, uint8_t *md5_hash,
size_t size ); size_t size,
libewf_error_t **error );
/* Sets the segment filename /* Retrieves the SHA1 hash
* Returns 1 if successful or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS ) LIBEWF_EXTERN int libewf_handle_get_sha1_hash(
LIBEWF_EXTERN int libewf_set_segment_filename( libewf_handle_t *handle,
LIBEWF_HANDLE *handle, uint8_t *sha1_hash,
wchar_t *filename, size_t size,
size_t length ); libewf_error_t **error );
#else
LIBEWF_EXTERN int libewf_set_segment_filename(
LIBEWF_HANDLE *handle,
char *filename,
size_t length );
#endif
/* Sets the delta segment filename /* Sets the SHA1 hash
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_sha1_hash(
libewf_handle_t *handle,
uint8_t *sha1_hash,
size_t size,
libewf_error_t **error );
/* Retrieves the amount of chunks written
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS ) LIBEWF_EXTERN int libewf_handle_get_write_amount_of_chunks(
LIBEWF_EXTERN int libewf_set_delta_segment_filename( libewf_handle_t *handle,
LIBEWF_HANDLE *handle, uint32_t *amount_of_chunks,
wchar_t *filename, libewf_error_t **error );
size_t length );
#else
LIBEWF_EXTERN int libewf_set_delta_segment_filename(
LIBEWF_HANDLE *handle,
char *filename,
size_t length );
#endif
/* Sets the read wipe chunk on error /* Sets the read wipe chunk on error
* The chunk is not wiped if read raw is used * The chunk is not wiped if read raw is used
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_set_read_wipe_chunk_on_error( LIBEWF_EXTERN int libewf_handle_set_read_wipe_chunk_on_error(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t wipe_on_error ); uint8_t wipe_on_error,
libewf_error_t **error );
/* Copies the media values from the source to the destination handle
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_copy_media_values(
libewf_handle_t *destination_handle,
libewf_handle_t *source_handle,
libewf_error_t **error );
/* Retrieves the amount of acquiry errors
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_amount_of_acquiry_errors(
libewf_handle_t *handle,
uint32_t *amount_of_errors,
libewf_error_t **error );
/* Retrieves the information of an acquiry error
* Returns 1 if successful, 0 if no acquiry error could be found or -1 on e
rror
*/
LIBEWF_EXTERN int libewf_handle_get_acquiry_error(
libewf_handle_t *handle,
uint32_t index,
uint64_t *first_sector,
uint64_t *amount_of_sectors,
libewf_error_t **error );
/* Add an acquiry error
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_add_acquiry_error(
libewf_handle_t *handle,
uint64_t first_sector,
uint64_t amount_of_sectors,
libewf_error_t **error );
/* Retrieves the amount of CRC errors
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_amount_of_crc_errors(
libewf_handle_t *handle,
uint32_t *amount_of_errors,
libewf_error_t **error );
/* Retrieves the information of a CRC error
* Returns 1 if successful, 0 if no CRC error could be found or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_crc_error(
libewf_handle_t *handle,
uint32_t index,
uint64_t *first_sector,
uint64_t *amount_of_sectors,
libewf_error_t **error );
/* Add a CRC error
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_add_crc_error(
libewf_handle_t *handle,
uint64_t first_sector,
uint64_t amount_of_sectors,
libewf_error_t **error );
/* Retrieves the amount of sessions
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_amount_of_sessions(
libewf_handle_t *handle,
uint32_t *amount_of_sessions,
libewf_error_t **error );
/* Retrieves the information of a session
* Returns 1 if successful, 0 if no sessions could be found or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_session(
libewf_handle_t *handle,
uint32_t index,
uint64_t *first_sector,
uint64_t *amount_of_sectors,
libewf_error_t **error );
/* Add a session
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_add_session(
libewf_handle_t *handle,
uint64_t first_sector,
uint64_t amount_of_sectors,
libewf_error_t **error );
/* Retrieves the header codepage
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_header_codepage(
libewf_handle_t *handle,
int *header_codepage,
libewf_error_t **error );
/* Sets the header codepage
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_header_codepage(
libewf_handle_t *handle,
int header_codepage,
libewf_error_t **error );
/* Retrieves the header values date format
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_header_values_date_format(
libewf_handle_t *handle,
int *date_format,
libewf_error_t **error );
/* Sets the header values date format
* Returns 1 if successful or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_set_header_values_date_format(
libewf_handle_t *handle,
int date_format,
libewf_error_t **error );
/* Retrieves the amount of header values
* Returns 1 if successful, 0 if no header values are present or -1 on erro
r
*/
LIBEWF_EXTERN int libewf_handle_get_amount_of_header_values(
libewf_handle_t *handle,
uint32_t *amount_of_values,
libewf_error_t **error );
/* Retrieves the header value identifier size specified by its index
* The identifier size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_header_value_identifier_size(
libewf_handle_t *handle,
uint32_t index,
size_t *identifier_size,
libewf_error_t **error );
/* Retrieves the header value identifier specified by its index
* The strings are encoded in UTF-8
* The identifier size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_header_value_identifier(
libewf_handle_t *handle,
uint32_t index,
uint8_t *identifier,
size_t identifier_size,
libewf_error_t **error );
/* Retrieves the header value size specified by the identifier
* The value size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_header_value_size(
libewf_handle_t *handle,
const uint8_t *identifier,
size_t identifier_length,
size_t *value_size,
libewf_error_t **error );
/* Retrieves the header value specified by the identifier
* The strings are encoded in UTF-8
* The value size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/
LIBEWF_EXTERN int libewf_handle_get_header_value(
libewf_handle_t *handle,
const uint8_t *identifier,
size_t identifier_length,
uint8_t *value,
size_t value_size,
libewf_error_t **error );
/* Retrieves the header value case number
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_case_number( handle, value, value_si
ze, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "case_number",
11, value, value_size, error )
/* Retrieves the header value description
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_description( handle, value, value_si
ze, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "description",
11, value, value_size, error )
/* Retrieves the header value examiner name
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_examiner_name( handle, value, value_
size, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "examiner_name"
, 13, value, value_size, error )
/* Retrieves the header value evidence number
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_evidence_number( handle, value, valu
e_size, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "evidence_numbe
r", 15, value, value_size, error )
/* Retrieves the header value notes
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_notes( handle, value, lengt, error )
\
libewf_handle_get_header_value( handle, (uint8_t *) "notes", 5, val
ue, value_size, error )
/* Retrieves the header value acquiry date
* The string is formatted according to the date format
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_acquiry_date( handle, value, value_s
ize, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "acquiry_date",
12, value, value_size, error )
/* Retrieves the header value system date
* The string is formatted according to the date format
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_system_date( handle, value, value_si
ze, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "system_date",
11, value, value_size, error )
/* Retrieves the header value acquiry operating system
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_acquiry_operating_system( handle, va
lue, value_size, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "acquiry_operat
ing_system", 24, value, value_size, error )
/* Retrieves the header value acquiry software version
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_acquiry_software_version( handle, va
lue, value_size, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "acquiry_softwa
re_version", 24, value, value_size, error )
/* Retrieves the header value password
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_password( handle, value, value_size,
error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "password", 8,
value, value_size, error )
/* Retrieves the header value compression type
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_compression_type( handle, value, val
ue_size, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "compression_ty
pe", 16, value, value_size, error )
/* Retrieves the header value model
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_model( handle, value, value_size, er
ror ) \
libewf_handle_get_header_value( handle, (uint8_t *) "model", 5, val
ue, value_size, error )
/* Retrieves the header value serial number
* Returns 1 if successful, 0 if value not present or -1 on error
*/
#define libewf_handle_get_header_value_serial_number( handle, value, value_
size, error ) \
libewf_handle_get_header_value( handle, (uint8_t *) "serial_number"
, 13, value, value_size, error )
/* Sets the header value specified by the identifier /* Sets the header value specified by the identifier
* The strings are encoded in UTF-8
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) LIBEWF_EXTERN int libewf_handle_set_header_value(
LIBEWF_EXTERN int libewf_set_header_value( libewf_handle_t *handle,
LIBEWF_HANDLE *handle, const uint8_t *identifier,
wchar_t *identifier, size_t identifier_length,
wchar_t *value, const uint8_t *value,
size_t length ); size_t value_length,
#else libewf_error_t **error );
LIBEWF_EXTERN int libewf_set_header_value(
LIBEWF_HANDLE *handle,
char *identifier,
char *value,
size_t length );
#endif
/* Sets the header value case number /* Sets the header value case number
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_case_number( handle, value, value_le
#define libewf_set_header_value_case_number( handle, value, length ) \ ngth, error ) \
libewf_set_header_value( handle, L"case_number", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "case_number",
#else 11, value, value_length, error )
#define libewf_set_header_value_case_number( handle, value, length ) \
libewf_set_header_value( handle, "case_number", value, length )
#endif
/* Sets the header value description /* Sets the header value description
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_description( handle, value, value_le
#define libewf_set_header_value_description( handle, value, length ) \ ngth, error ) \
libewf_set_header_value( handle, L"description", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "description",
#else 11, value, value_length, error )
#define libewf_set_header_value_description( handle, value, length ) \
libewf_set_header_value( handle, "description", value, length )
#endif
/* Sets the header value examiner name /* Sets the header value examiner name
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_examiner_name( handle, value, value_
#define libewf_set_header_value_examiner_name( handle, value, length ) \ length, error ) \
libewf_set_header_value( handle, L"examiner_name", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "examiner_name"
#else , 13, value, value_length, error )
#define libewf_set_header_value_examiner_name( handle, value, length ) \
libewf_set_header_value( handle, "examiner_name", value, length )
#endif
/* Sets the header value evidence number /* Sets the header value evidence number
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_evidence_number( handle, value, valu
#define libewf_set_header_value_evidence_number( handle, value, length ) \ e_length, error ) \
libewf_set_header_value( handle, L"evidence_number", value, length libewf_handle_set_header_value( handle, (uint8_t *) "evidence_numbe
) r", 15, value, value_length, error )
#else
#define libewf_set_header_value_evidence_number( handle, value, length ) \
libewf_set_header_value( handle, "evidence_number", value, length )
#endif
/* Sets the header value notes /* Sets the header value notes
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_notes( handle, value, value_length,
#define libewf_set_header_value_notes( handle, value, length ) \ error ) \
libewf_set_header_value( handle, L"notes", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "notes", 5, val
#else ue, value_length, error )
#define libewf_set_header_value_notes( handle, value, length ) \
libewf_set_header_value( handle, "notes", value, length )
#endif
/* Sets the header value acquiry date /* Sets the header value acquiry date
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_acquiry_date( handle, value, value_l
#define libewf_set_header_value_acquiry_date( handle, value, length ) \ ength, error ) \
libewf_set_header_value( handle, L"acquiry_date", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "acquiry_date",
#else 12, value, value_length, error )
#define libewf_set_header_value_acquiry_date( handle, value, length ) \
libewf_set_header_value( handle, "acquiry_date", value, length )
#endif
/* Sets the header value system date /* Sets the header value system date
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_system_date( handle, value, value_le
#define libewf_set_header_value_system_date( handle, value, length ) \ ngth, error ) \
libewf_set_header_value( handle, L"system_date", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "system_date",
#else 11, value, value_length, error )
#define libewf_set_header_value_system_date( handle, value, length ) \
libewf_set_header_value( handle, "system_date", value, length )
#endif
/* Sets the header value acquiry operating system /* Sets the header value acquiry operating system
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_acquiry_operating_system( handle, va
#define libewf_set_header_value_acquiry_operating_system( handle, value, le lue, value_length, error ) \
ngth ) \ libewf_handle_set_header_value( handle, (uint8_t *) "acquiry_operat
libewf_set_header_value( handle, L"acquiry_operating_system", value ing_system", 24, value, value_length, error )
, length )
#else
#define libewf_set_header_value_acquiry_operating_system( handle, value, le
ngth ) \
libewf_set_header_value( handle, "acquiry_operating_system", value,
length )
#endif
/* Sets the header value acquiry software version /* Sets the header value acquiry software version
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_acquiry_software_version( handle, va
#define libewf_set_header_value_acquiry_software_version( handle, value, le lue, value_length, error ) \
ngth ) \ libewf_handle_set_header_value( handle, (uint8_t *) "acquiry_softwa
libewf_set_header_value( handle, L"acquiry_software_version", value re_version", 24, value, value_length, error )
, length )
#else
#define libewf_set_header_value_acquiry_software_version( handle, value, le
ngth ) \
libewf_set_header_value( handle, "acquiry_software_version", value,
length )
#endif
/* Sets the header value password /* Sets the header value password
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_password( handle, value, value_lengt
#define libewf_set_header_value_password( handle, value, length ) \ h, error ) \
libewf_set_header_value( handle, L"password", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "password", 8,
#else value, value_length, error )
#define libewf_set_header_value_password( handle, value, length ) \
libewf_set_header_value( handle, "password", value, length )
#endif
/* Sets the header value compression type /* Sets the header value compression type
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_compression_type( handle, value, val
#define libewf_set_header_value_compression_type( handle, value, length ) \ ue_length, error ) \
libewf_set_header_value( handle, L"compression_type", value, length libewf_handle_set_header_value( handle, (uint8_t *) "compression_ty
) pe", 16, value, value_length, error )
#else
#define libewf_set_header_value_compression_type( handle, value, length ) \
libewf_set_header_value( handle, "compression_type", value, length
)
#endif
/* Sets the header value model /* Sets the header value model
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_model( handle, value, value_length,
#define libewf_set_header_value_model( handle, value, length ) \ error ) \
libewf_set_header_value( handle, L"model", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "model", 5, val
#else ue, value_length, error )
#define libewf_set_header_value_model( handle, value, length ) \
libewf_set_header_value( handle, "model", value, length )
#endif
/* Sets the header value serial number /* Sets the header value serial number
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #define libewf_handle_set_header_value_serial_number( handle, value, value_
#define libewf_set_header_value_serial_number( handle, value, length ) \ length, error ) \
libewf_set_header_value( handle, L"serial_number", value, length ) libewf_handle_set_header_value( handle, (uint8_t *) "serial_number"
#else , 13, value, value_length, error )
#define libewf_set_header_value_serial_number( handle, value, length ) \
libewf_set_header_value( handle, "serial_number", value, length )
#endif
/* Sets the hash value specified by the identifier /* Copies the header values from the source to the destination handle
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) LIBEWF_EXTERN int libewf_handle_copy_header_values(
LIBEWF_EXTERN int libewf_set_hash_value( libewf_handle_t *destination_handle,
LIBEWF_HANDLE *handle, libewf_handle_t *source_handle,
wchar_t *identifier, libewf_error_t **error );
wchar_t *value,
size_t length );
#else
LIBEWF_EXTERN int libewf_set_hash_value(
LIBEWF_HANDLE *handle,
char *identifier,
char *value,
size_t length );
#endif
/* Sets the hash value MD5 /* Retrieves the amount of hash values
* Returns 1 if successful or -1 on error * Returns 1 if successful, 0 if no hash values are present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) LIBEWF_EXTERN int libewf_handle_get_amount_of_hash_values(
#define libewf_set_hash_value_md5( handle, value, length ) \ libewf_handle_t *handle,
libewf_set_hash_value( handle, L"MD5", value, length ) uint32_t *amount_of_values,
#else libewf_error_t **error );
#define libewf_set_hash_value_md5( handle, value, length ) \
libewf_set_hash_value( handle, "MD5", value, length )
#endif
/* Sets the hash value SHA1 /* Retrieves the hash value identifier size specified by its index
* Returns 1 if successful or -1 on error * The identifier size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/ */
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) LIBEWF_EXTERN int libewf_handle_get_hash_value_identifier_size(
#define libewf_set_hash_value_sha1( handle, value, length ) \ libewf_handle_t *handle,
libewf_set_hash_value( handle, L"SHA1", value, length ) uint32_t index,
#else size_t *identifier_size,
#define libewf_set_hash_value_sha1( handle, value, length ) \ libewf_error_t **error );
libewf_set_hash_value( handle, "SHA1", value, length )
#endif
/* Parses the header values from the xheader, header2 or header section /* Retrieves the hash value identifier specified by its index
* Will parse the first available header in order mentioned above * The strings are encoded in UTF-8
* Returns 1 if successful, 0 if already parsed or -1 on error * The identifier size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_parse_header_values( LIBEWF_EXTERN int libewf_handle_get_hash_value_identifier(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
uint8_t date_format ); uint32_t index,
uint8_t *identifier,
size_t identifier_size,
libewf_error_t **error );
/* Parses the hash values from the xhash section /* Retrieves the hash value size specified by the identifier
* Returns 1 if successful, 0 if already parsed or -1 on error * The value size includes the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_parse_hash_values( LIBEWF_EXTERN int libewf_handle_get_hash_value_size(
LIBEWF_HANDLE *handle ); libewf_handle_t *handle,
const uint8_t *identifier,
size_t identifier_length,
size_t *value_size,
libewf_error_t **error );
/* Add an acquiry error /* Retrieves the hash value specified by the identifier
* Returns 1 if successful or -1 on error * The strings are encoded in UTF-8
* The value size should include the end of string character
* Returns 1 if successful, 0 if value not present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_add_acquiry_error( LIBEWF_EXTERN int libewf_handle_get_hash_value(
LIBEWF_HANDLE *handle, libewf_handle_t *handle,
off64_t first_sector, const uint8_t *identifier,
uint32_t amount_of_sectors ); size_t identifier_length,
uint8_t *value,
size_t value_size,
libewf_error_t **error );
/* Add a CRC error /* Retrieves the hash value MD5
* Returns 1 if successful or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_add_crc_error( #define libewf_handle_get_hash_value_md5( handle, value, value_size, error
LIBEWF_HANDLE *handle, ) \
off64_t first_sector, libewf_handle_get_hash_value( handle, "MD5", 3, value, value_size,
uint32_t amount_of_sectors ); error )
/* Add a session /* Retrieves the hash value SHA1
* Returns 1 if successful or -1 on error * Returns 1 if successful, 0 if value not present or -1 on error
*/ */
LIBEWF_EXTERN int libewf_add_session( #define libewf_handle_get_hash_value_sha1( handle, value, value_size, error
LIBEWF_HANDLE *handle, ) \
off64_t first_sector, libewf_handle_get_hash_value( handle, "SHA1", 4, value, value_size,
uint32_t amount_of_sectors ); error )
/* Copies the header values from the source to the destination handle /* Sets the hash value specified by the identifier
* The strings are encoded in UTF-8
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_copy_header_values( LIBEWF_EXTERN int libewf_handle_set_hash_value(
LIBEWF_HANDLE *destination_handle, libewf_handle_t *handle,
LIBEWF_HANDLE *source_handle ); const uint8_t *identifier,
size_t identifier_length,
const uint8_t *value,
size_t value_length,
libewf_error_t **error );
/* Copies the media values from the source to the destination handle /* Sets the hash value MD5
* Returns 1 if successful or -1 on error * Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN int libewf_copy_media_values( #define libewf_handle_set_hash_value_md5( handle, value, value_length, erro
LIBEWF_HANDLE *destination_handle, r ) \
LIBEWF_HANDLE *source_handle ); libewf_handle_set_hash_value( handle, "MD5", 3, value, value_length
, error )
/* Set the notify values /* Sets the hash value SHA1
* Returns 1 if successful or -1 on error
*/ */
LIBEWF_EXTERN void libewf_set_notify_values( #define libewf_handle_set_hash_value_sha1( handle, value, value_length, err
FILE *stream, or ) \
uint8_t verbose ); libewf_handle_set_hash_value( handle, "SHA1", 4, value, value_lengt
h, error )
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 180 change blocks. 
546 lines changed or deleted 1826 lines changed or added


 types.h   types.h 
/* /*
* Type definitions for libewf * Type definitions for libewf
* *
* Copyright (c) 2006-2008, Joachim Metz <forensics@hoffmannbv.nl>, * Copyright (c) 2006-2009, Joachim Metz <forensics@hoffmannbv.nl>,
* Hoffmann Investigations. All rights reserved. * Hoffmann Investigations.
* *
* Refer to AUTHORS for acknowledgements. * Refer to AUTHORS for acknowledgements.
* *
* Redistribution and use in source and binary forms, with or without modif * This software is free software: you can redistribute it and/or modify
ication, * it under the terms of the GNU Lesser General Public License as published
* are permitted provided that the following conditions are met: by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* - Redistributions of source code must retain the above copyright notice, * This software is distributed in the hope that it will be useful,
* this list of conditions and the following disclaimer. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* - Redistributions in binary form must reproduce the above copyright noti * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce, * GNU General Public License for more details.
* this list of conditions and the following disclaimer in the documentat
ion
* and/or other materials provided with the distribution.
* - Neither the name of the creator, related organisations, nor the names
of
* its contributors may be used to endorse or promote products derived fr
om
* this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, COMPANY AND CONTRIBUT * You should have received a copy of the GNU Lesser General Public License
ORS * along with this software. If not, see <http://www.gnu.org/licenses/>.
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITE
D TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P
URPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF T
HE
* POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined( _LIBEWF_TYPES_H ) #if !defined( _LIBEWF_TYPES_H )
#define _LIBEWF_TYPES_H #define _LIBEWF_TYPES_H
#include <libewf/features.h>
#if 1 || defined( HAVE_SYS_TYPES_H ) #if 1 || defined( HAVE_SYS_TYPES_H )
#include <sys/types.h> #include <sys/types.h>
#else #else
#error Missing system type definitions (sys/types.h) #error Missing system type definitions (sys/types.h)
#endif #endif
#if defined( HAVE_WINDOWS_API ) && !defined( HAVE_INTTYPES_H ) && !defined( /* Type definitions for the Microsoft Visual Studio C++ compiler
HAVE_STDINT_H ) */
#if defined( _MSC_VER )
/* Define LIBEWF_DEFINITION_INTEGER_TYPES to avoid conflict if types are al ready defined /* Define LIBEWF_DEFINITION_INTEGER_TYPES to avoid conflict
*/ */
#if !defined( LIBEWF_DEFINITION_INTEGER_TYPES ) #if !defined( LIBEWF_DEFINITION_INTEGER_TYPES )
#define LIBEWF_DEFINITION_INTEGER_TYPES #define LIBEWF_DEFINITION_INTEGER_TYPES
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Windows does not have <inttypes.h> or <stdint.h> and therefore does not /* The Microsoft Visual Studio C++ compiler does not have <inttypes.h> or <
support the stdint.h>
* (u)int#_t type definitions it has __int# defintions instead * therefore it does not support the (u)int#_t type definitions
* it has __int# defintions instead
*/ */
typedef __int8 int8_t; typedef __int8 int8_t;
typedef unsigned __int8 uint8_t; typedef unsigned __int8 uint8_t;
typedef __int16 int16_t; typedef __int16 int16_t;
typedef unsigned __int16 uint16_t; typedef unsigned __int16 uint16_t;
typedef __int32 int32_t; typedef __int32 int32_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef __int64 int64_t; typedef __int64 int64_t;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64_t;
typedef int ssize_t;
typedef unsigned __int64 size64_t; #if defined( _WIN64 )
typedef __int64 ssize64_t; typedef __int64 ssize_t;
typedef __int64 off64_t; #else
typedef __int32 ssize_t;
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
#elif 1 || defined( HAVE_INTTYPES_H ) #elif defined( __BORLANDC__ )
#include <inttypes.h>
#elif 1 || defined( HAVE_STDINT_H ) #if __BORLANDC__ >= 0x0560
#include <stdint.h> #include <stdint.h>
#else #else
#error Missing integer type definitions (inttypes.h, stdint.h)
/* Define LIBEWF_DEFINITION_INTEGER_TYPES to avoid conflict
*/
#if !defined( LIBEWF_DEFINITION_INTEGER_TYPES )
#define LIBEWF_DEFINITION_INTEGER_TYPES
#ifdef __cplusplus
extern "C" {
#endif #endif
#if 0 || defined( HAVE_WIDE_CHARACTER_TYPE ) /* Earlier versions of the Borland/CodeGear C++ Builder compiler
#define LIBEWF_WIDE_CHARACTER_TYPE 1 * do not have the intptr_t
*/
#if defined( _WIN64 )
typedef unsigned __int64 intptr_t;
#else
typedef unsigned __int32 intptr_t;
#endif
#if 0 || defined( HAVE_WIDE_CHARACTER_SUPPORT_FUNCTIONS ) #ifdef __cplusplus
#define LIBEWF_WIDE_CHARACTER_FILE_FUNCTIONS 1 }
#endif #endif
#endif /* LIBEWF_DEFINITION_INTEGER_TYPES */
#endif /* __BORLANDC__ >= 0x0560 */
/* Type definitions for compilers that have access to
* <inttypes.h> or <stdint.h>
*/
#elif 1 || defined( HAVE_INTTYPES_H )
#include <inttypes.h>
#elif 1 || defined( HAVE_STDINT_H )
#include <stdint.h>
#else
#error Missing integer type definitions (inttypes.h, stdint.h)
#endif #endif
#if defined( LIBEWF_WIDE_CHARACTER_TYPE ) #if defined( LIBEWF_HAVE_WIDE_CHARACTER_TYPE )
#if 0 || defined( HAVE_WCHAR_H ) #if 0 || defined( HAVE_WCHAR_H )
/* __USE_UNIX98 is required to add swprintf definition /* __USE_UNIX98 is required to add swprintf definition
*/ */
#if !defined( __USE_UNIX98 ) #if !defined( __USE_UNIX98 )
#define __USE_UNIX98 #define __USE_UNIX98
#define LIBEWF_DEFINITION_UNIX98 #define LIBEWF_DEFINITION_UNIX98
#endif #endif
skipping to change at line 157 skipping to change at line 179
#endif #endif
#if ! 0 || ! HAVE_SSIZE64_T #if ! 0 || ! HAVE_SSIZE64_T
typedef int64_t ssize64_t; typedef int64_t ssize64_t;
#endif #endif
#if ! 0 || ! HAVE_OFF64_T #if ! 0 || ! HAVE_OFF64_T
typedef int64_t off64_t; typedef int64_t off64_t;
#endif #endif
/* The following type definitions hide internal data structures
*/
typedef intptr_t libewf_handle_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 18 change blocks. 
52 lines changed or deleted 69 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/