diff --git a/include/libewf.h.in b/include/libewf.h.in index 80d5412b6..50c4dfaa2 100644 --- a/include/libewf.h.in +++ b/include/libewf.h.in @@ -2215,6 +2215,17 @@ int libewf_extent_free( libewf_extent_t **extent, libewf_error_t **error ); +/* Retrieves the extent offset, size and flags + * Returns 1 if successful or -1 on error + */ +LIBEWF_EXTERN \ +int libewf_extent_get_values( + libewf_extent_t *extent, + off64_t *offset, + size64_t *size, + uint32_t *flags, + libewf_error_t **error ); + /* ------------------------------------------------------------------------- * Source functions * ------------------------------------------------------------------------- */ diff --git a/libewf/libewf_extent.c b/libewf/libewf_extent.c index 287a47310..93857dcfd 100644 --- a/libewf/libewf_extent.c +++ b/libewf/libewf_extent.c @@ -183,3 +183,89 @@ int libewf_extent_free( return( result ); } +/* Retrieves the extent offset, size and flags + * Returns 1 if successful or -1 on error + */ +int libewf_extent_get_values( + libewf_extent_t *extent, + off64_t *offset, + size64_t *size, + uint32_t *flags, + libcerror_error_t **error ) +{ + libewf_internal_extent_t *internal_extent = NULL; + static char *function = "libewf_extent_get_values"; + + if( extent == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid extent.", + function ); + + return( -1 ); + } + if( ( offset == NULL ) + || ( size == NULL ) + || ( flags == NULL ) ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid offset, size or flags.", + function ); + + return( -1 ); + } + internal_extent = (libewf_internal_extent_t *) extent; + + if( internal_extent->lef_extent == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, + "%s: invalid extent - missing LEF extent.", + function ); + + return( -1 ); + } +#if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) + if( libcthreads_read_write_lock_grab_for_read( + internal_extent->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + *offset = internal_extent->lef_extent->data_offset; + *size = internal_extent->lef_extent->data_size; + *flags = internal_extent->lef_extent->data_flags; + +#if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) + if( libcthreads_read_write_lock_release_for_read( + internal_extent->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + return( 1 ); +} diff --git a/libewf/libewf_extent.h b/libewf/libewf_extent.h index 0bdcbfcc4..4f3195a30 100644 --- a/libewf/libewf_extent.h +++ b/libewf/libewf_extent.h @@ -60,6 +60,14 @@ int libewf_extent_free( libewf_extent_t **extent, libcerror_error_t **error ); +LIBEWF_EXTERN \ +int libewf_extent_get_values( + libewf_extent_t *extent, + off64_t *offset, + size64_t *size, + uint32_t *flags, + libcerror_error_t **error ); + #if defined( __cplusplus ) } #endif diff --git a/msvscpp/bzip2/bzip2.vcproj b/msvscpp/bzip2/bzip2.vcproj index a98ff6c2f..666cb6245 100644 --- a/msvscpp/bzip2/bzip2.vcproj +++ b/msvscpp/bzip2/bzip2.vcproj @@ -56,8 +56,9 @@ /> + +