Skip to content

Commit

Permalink
Worked on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Apr 26, 2024
1 parent b33e398 commit 7eaa314
Show file tree
Hide file tree
Showing 15 changed files with 1,115 additions and 202 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ stamp-h[1-9]
/tests/fwevt_test_xml_tag
/tests/fwevt_test_xml_template_value
/tests/fwevt_test_xml_token
/tests/fwevt_test_xml_value
/tests/notify_stream.log
/tests/tmp*

Expand Down
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
TODO
* add pyfwevt_xml_value

* Replace libfvalue by native functions
** Check use of libfwevt_xml_tag_get_value

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.71])

AC_INIT(
[libfwevt],
[20240425],
[20240426],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(
Expand Down
13 changes: 13 additions & 0 deletions include/libfwevt.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,19 @@ int libfwevt_xml_tag_get_utf16_name(
size_t utf16_string_size,
libfwevt_error_t **error );

/* Retrieves the XML value
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_EXTERN \
int libfwevt_xml_tag_get_value(
libfwevt_xml_tag_t *xml_tag,
libfwevt_xml_value_t **xml_value,
libfwevt_error_t **error );

/* Retrieves the size of the UTF-8 formatted value
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_tag_get_utf8_value_size(
libfwevt_xml_tag_t *xml_tag,
Expand All @@ -916,6 +926,7 @@ int libfwevt_xml_tag_get_utf8_value_size(
/* Retrieves the UTF-8 formatted value
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_tag_get_utf8_value(
libfwevt_xml_tag_t *xml_tag,
Expand All @@ -926,6 +937,7 @@ int libfwevt_xml_tag_get_utf8_value(
/* Retrieves the size of the UTF-16 formatted value
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_tag_get_utf16_value_size(
libfwevt_xml_tag_t *xml_tag,
Expand All @@ -935,6 +947,7 @@ int libfwevt_xml_tag_get_utf16_value_size(
/* Retrieves the UTF-16 formatted value
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_tag_get_utf16_value(
libfwevt_xml_tag_t *xml_tag,
Expand Down
80 changes: 40 additions & 40 deletions libfwevt/libfwevt_xml_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,46 +437,6 @@ int libfwevt_xml_tag_set_name_data(
return( -1 );
}

/* Retrieves the value
* Returns 1 if successful or -1 on error
*/
int libfwevt_xml_tag_get_value(
libfwevt_xml_tag_t *xml_tag,
libfwevt_xml_value_t **xml_value,
libcerror_error_t **error )
{
libfwevt_internal_xml_tag_t *internal_xml_tag = NULL;
static char *function = "libfwevt_xml_tag_get_value";

if( xml_tag == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid XML tag.",
function );

return( -1 );
}
internal_xml_tag = (libfwevt_internal_xml_tag_t *) xml_tag;

if( xml_value == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid XML value.",
function );

return( -1 );
}
*xml_value = internal_xml_tag->value;

return( 1 );
}

/* Sets the value type
* Returns 1 if successful or -1 on error
*/
Expand Down Expand Up @@ -952,6 +912,46 @@ int libfwevt_xml_tag_get_utf16_name(
return( 1 );
}

/* Retrieves the value
* Returns 1 if successful or -1 on error
*/
int libfwevt_xml_tag_get_value(
libfwevt_xml_tag_t *xml_tag,
libfwevt_xml_value_t **xml_value,
libcerror_error_t **error )
{
libfwevt_internal_xml_tag_t *internal_xml_tag = NULL;
static char *function = "libfwevt_xml_tag_get_value";

if( xml_tag == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid XML tag.",
function );

return( -1 );
}
internal_xml_tag = (libfwevt_internal_xml_tag_t *) xml_tag;

if( xml_value == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid XML value.",
function );

return( -1 );
}
*xml_value = internal_xml_tag->value;

return( 1 );
}

/* Retrieves the size of the UTF-8 formatted value
* Returns 1 if successful or -1 on error
*/
Expand Down
11 changes: 6 additions & 5 deletions libfwevt/libfwevt_xml_tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ int libfwevt_xml_tag_set_name_data(
size_t data_size,
libcerror_error_t **error );

int libfwevt_xml_tag_get_value(
libfwevt_xml_tag_t *xml_tag,
libfwevt_xml_value_t **xml_value,
libcerror_error_t **error );

int libfwevt_xml_tag_set_value_type(
libfwevt_xml_tag_t *xml_tag,
int value_type,
Expand Down Expand Up @@ -164,6 +159,12 @@ int libfwevt_xml_tag_get_utf16_name(
size_t utf16_string_size,
libcerror_error_t **error );

LIBFWEVT_EXTERN \
int libfwevt_xml_tag_get_value(
libfwevt_xml_tag_t *xml_tag,
libfwevt_xml_value_t **xml_value,
libcerror_error_t **error );

LIBFWEVT_EXTERN \
int libfwevt_xml_tag_get_utf8_value_size(
libfwevt_xml_tag_t *xml_tag,
Expand Down
10 changes: 2 additions & 8 deletions manuals/libfwevt.3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd April 25, 2024
.Dd April 26, 2024
.Dt libfwevt 3
.Os libfwevt
.Sh NAME
Expand Down Expand Up @@ -211,13 +211,7 @@ XML tag functions
.Ft int
.Fn libfwevt_xml_tag_get_utf16_name "libfwevt_xml_tag_t *xml_tag" "uint16_t *utf16_string" "size_t utf16_string_size" "libfwevt_error_t **error"
.Ft int
.Fn libfwevt_xml_tag_get_utf8_value_size "libfwevt_xml_tag_t *xml_tag" "size_t *utf8_string_size" "libfwevt_error_t **error"
.Ft int
.Fn libfwevt_xml_tag_get_utf8_value "libfwevt_xml_tag_t *xml_tag" "uint8_t *utf8_string" "size_t utf8_string_size" "libfwevt_error_t **error"
.Ft int
.Fn libfwevt_xml_tag_get_utf16_value_size "libfwevt_xml_tag_t *xml_tag" "size_t *utf16_string_size" "libfwevt_error_t **error"
.Ft int
.Fn libfwevt_xml_tag_get_utf16_value "libfwevt_xml_tag_t *xml_tag" "uint16_t *utf16_string" "size_t utf16_string_size" "libfwevt_error_t **error"
.Fn libfwevt_xml_tag_get_value "libfwevt_xml_tag_t *xml_tag" "libfwevt_xml_value_t **xml_value" "libfwevt_error_t **error"
.Ft int
.Fn libfwevt_xml_tag_get_number_of_attributes "libfwevt_xml_tag_t *xml_tag" "int *number_of_attributes" "libfwevt_error_t **error"
.Ft int
Expand Down
1 change: 1 addition & 0 deletions msvscpp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ MSVSCPP_FILES = \
fwevt_test_xml_tag/fwevt_test_xml_tag.vcproj \
fwevt_test_xml_template_value/fwevt_test_xml_template_value.vcproj \
fwevt_test_xml_token/fwevt_test_xml_token.vcproj \
fwevt_test_xml_value/fwevt_test_xml_value.vcproj \
libcdata/libcdata.vcproj \
libcerror/libcerror.vcproj \
libcnotify/libcnotify.vcproj \
Expand Down
Loading

0 comments on commit 7eaa314

Please sign in to comment.