Skip to content

Commit

Permalink
Code clean up and worked on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Apr 30, 2024
1 parent 0543c7c commit 2a1f9a5
Show file tree
Hide file tree
Showing 64 changed files with 7,252 additions and 2,762 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ coverage:
- "libcthreads/*"
- "libfdatetime/*"
- "libfguid/*"
- "libfvalue/*"
- "libfwnt/*"
- "libuna/*"
- "tests/*"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ stamp-h[1-9]
/setup.cfg
/tests/*.exe
/tests/fwevt_test_channel
/tests/fwevt_test_data_segment
/tests/fwevt_test_date_time
/tests/fwevt_test_error
/tests/fwevt_test_event
Expand Down Expand Up @@ -159,5 +160,5 @@ stamp-h[1-9]
/libcthreads
/libfdatetime
/libfguid
/libfvalue
/libfwnt
/libuna
14 changes: 9 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
TODO
* add pyfwevt_xml_document, pyfwevt_xml_tag and pyfwevt_xml_value
* add support for hexadecimal integers in data_as_integer functions
* improve integer XML value formatting
* add codepage support

* remove deprecated API functions
** libfwevt_template_get_data - Remove the need to create a copy of the template data at worst only have a copy of the BinXML
** libfwevt_xml_tag_get_utf8_value_size and libfwevt_xml_tag_get_utf8_value
** libfwevt_xml_tag_get_utf16_value_size and libfwevt_xml_tag_get_utf16_value
** libfwevt_xml_value_get_utf8_string_size and libfwevt_xml_value_copy_to_utf8_string
** libfwevt_xml_value_get_utf16_string_size and libfwevt_xml_value_copy_to_utf16_string

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

* Remove the need to create a copy of the template data at worst only have a copy of the BinXML
** remove libfwevt_template_get_data
* refactor: move value to XML string from XML tag into XML value

* Rename _read() functions to _read_data()
** libfwevt_manifest_read
Expand Down
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SUBDIRS = \
libuna \
libfdatetime \
libfguid \
libfvalue \
libfwnt \
libfwevt \
pyfwevt \
po \
Expand Down Expand Up @@ -84,7 +84,7 @@ library:
(cd $(srcdir)/libuna && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfdatetime && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfguid && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfvalue && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfwnt && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfwevt && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS))

10 changes: 5 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ AX_LIBFDATETIME_CHECK_ENABLE
dnl Check if libfguid or required headers and functions are available
AX_LIBFGUID_CHECK_ENABLE

dnl Check if libfvalue or required headers and functions are available
AX_LIBFVALUE_CHECK_ENABLE
dnl Check if libfwnt or required headers and functions are available
AX_LIBFWNT_CHECK_ENABLE

dnl Check if libfwevt required headers and functions are available
AX_LIBFWEVT_CHECK_LOCAL
Expand Down Expand Up @@ -116,7 +116,7 @@ CFLAGS="$CFLAGS -Wall";

dnl Check if requires and build requires should be set in spec file
AS_IF(
[test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libfdatetime" = xyes || test "x$ac_cv_libfguid" = xyes || test "x$ac_cv_libfvalue" = xyes],
[test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libfdatetime" = xyes || test "x$ac_cv_libfguid" = xyes || test "x$ac_cv_libfwnt" = xyes],
[AC_SUBST(
[libfwevt_spec_requires],
[Requires:])
Expand All @@ -143,7 +143,7 @@ AC_CONFIG_FILES([libcnotify/Makefile])
AC_CONFIG_FILES([libuna/Makefile])
AC_CONFIG_FILES([libfdatetime/Makefile])
AC_CONFIG_FILES([libfguid/Makefile])
AC_CONFIG_FILES([libfvalue/Makefile])
AC_CONFIG_FILES([libfwnt/Makefile])
AC_CONFIG_FILES([libfwevt/Makefile])
AC_CONFIG_FILES([pyfwevt/Makefile])
AC_CONFIG_FILES([po/Makefile.in])
Expand Down Expand Up @@ -180,7 +180,7 @@ Building:
libuna support: $ac_cv_libuna
libfdatetime support: $ac_cv_libfdatetime
libfguid support: $ac_cv_libfguid
libfvalue support: $ac_cv_libfvalue
libfwnt support: $ac_cv_libfwnt
Features:
Multi-threading support: $ac_cv_libcthreads_multi_threading
Expand Down
84 changes: 50 additions & 34 deletions include/libfwevt.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1077,36 +1077,6 @@ int libfwevt_xml_value_copy_data(
size_t data_size,
libfwevt_error_t **error );

/* Copies the value data to an 8-bit value
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_value_copy_to_8bit(
libfwevt_xml_value_t *xml_value,
uint8_t *value_8bit,
libfwevt_error_t **error );

/* Copies the value data to an 32-bit value
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_value_copy_to_32bit(
libfwevt_xml_value_t *xml_value,
uint32_t *value_32bit,
libfwevt_error_t **error );

/* Copies the value data to an 64-bit value
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_value_copy_to_64bit(
libfwevt_xml_value_t *xml_value,
uint64_t *value_64bit,
libfwevt_error_t **error );

/* Retrieves the value data as a 8-bit integer value
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
*/
Expand Down Expand Up @@ -1144,17 +1114,19 @@ int libfwevt_value_get_data_as_filetime(
libfwevt_error_t **error );

/* Retrieves the size of an UTF-8 encoded string of the value data
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_value_get_utf8_string_size(
libfwevt_xml_value_t *xml_value,
size_t *utf8_string_size,
libfwevt_error_t **error );

/* Copies the value data to an UTF-8 encoded string
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_value_copy_to_utf8_string(
libfwevt_xml_value_t *xml_value,
Expand All @@ -1163,24 +1135,68 @@ int libfwevt_xml_value_copy_to_utf8_string(
libfwevt_error_t **error );

/* Retrieves the size of an UTF-16 encoded string of the value data
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_value_get_utf16_string_size(
libfwevt_xml_value_t *xml_value,
size_t *utf16_string_size,
libfwevt_error_t **error );

/* Copies the value data to an UTF-16 encoded string
* Returns 1 if successful, 0 if value not be retrieved or -1 on error
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_DEPRECATED \
LIBFWEVT_EXTERN \
int libfwevt_xml_value_copy_to_utf16_string(
libfwevt_xml_value_t *xml_value,
uint16_t *utf16_string,
size_t utf16_string_size,
libfwevt_error_t **error );

/* Retrieves the size of the value data formatted as an UTF-8 string
* The string size includes the end of string character
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_EXTERN \
int libfwevt_xml_value_get_data_as_utf8_string_size(
libfwevt_xml_value_t *xml_value,
size_t *utf8_string_size,
libfwevt_error_t **error );

/* Retrieves the data formatted as an UTF-8 string
* The string size should include the end of string character
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_EXTERN \
int libfwevt_xml_value_get_data_as_utf8_string(
libfwevt_xml_value_t *xml_value,
uint8_t *utf8_string,
size_t utf8_string_size,
libfwevt_error_t **error );

/* Retrieves the size of the value data formatted as an UTF-16 string
* The string size includes the end of string character
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_EXTERN \
int libfwevt_xml_value_get_data_as_utf16_string_size(
libfwevt_xml_value_t *xml_value,
size_t *utf16_string_size,
libfwevt_error_t **error );

/* Retrieves the data formatted as an UTF-16 string
* The string size should include the end of string character
* Returns 1 if successful or -1 on error
*/
LIBFWEVT_EXTERN \
int libfwevt_xml_value_get_data_as_utf16_string(
libfwevt_xml_value_t *xml_value,
uint16_t *utf16_string,
size_t utf16_string_size,
libfwevt_error_t **error );

#if defined( __cplusplus )
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion libfwevt.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Name: libfwevt
Description: Library to support the Windows XML Event Log (EVTX) data types
Version: @VERSION@
Libs: -L${libdir} -lfwevt
Libs.private: @ax_libcdata_pc_libs_private@ @ax_libcerror_pc_libs_private@ @ax_libcnotify_pc_libs_private@ @ax_libcthreads_pc_libs_private@ @ax_libfdatetime_pc_libs_private@ @ax_libfguid_pc_libs_private@ @ax_libfvalue_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@
Libs.private: @ax_libcdata_pc_libs_private@ @ax_libcerror_pc_libs_private@ @ax_libcnotify_pc_libs_private@ @ax_libcthreads_pc_libs_private@ @ax_libfdatetime_pc_libs_private@ @ax_libfguid_pc_libs_private@ @ax_libfwnt_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@
Cflags: -I${includedir}

4 changes: 2 additions & 2 deletions libfwevt.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Group: System Environment/Libraries
License: LGPL-3.0-or-later
Source: %{name}-%{version}.tar.gz
URL: https://github.com/libyal/libfwevt
@libfwevt_spec_requires@ @ax_libcdata_spec_requires@ @ax_libcerror_spec_requires@ @ax_libcnotify_spec_requires@ @ax_libcthreads_spec_requires@ @ax_libfdatetime_spec_requires@ @ax_libfguid_spec_requires@ @ax_libfvalue_spec_requires@ @ax_libuna_spec_requires@
BuildRequires: gcc @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libfdatetime_spec_build_requires@ @ax_libfguid_spec_build_requires@ @ax_libfvalue_spec_build_requires@ @ax_libuna_spec_build_requires@
@libfwevt_spec_requires@ @ax_libcdata_spec_requires@ @ax_libcerror_spec_requires@ @ax_libcnotify_spec_requires@ @ax_libcthreads_spec_requires@ @ax_libfdatetime_spec_requires@ @ax_libfguid_spec_requires@ @ax_libfwnt_spec_requires@ @ax_libuna_spec_requires@
BuildRequires: gcc @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libfdatetime_spec_build_requires@ @ax_libfguid_spec_build_requires@ @ax_libfwnt_spec_build_requires@ @ax_libuna_spec_build_requires@

%description -n libfwevt
Library to support the Windows XML Event Log (EVTX) data types
Expand Down
10 changes: 7 additions & 3 deletions libfwevt/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AM_CPPFLAGS = \
@LIBCNOTIFY_CPPFLAGS@ \
@LIBFDATETIME_CPPFLAGS@ \
@LIBFGUID_CPPFLAGS@ \
@LIBFVALUE_CPPFLAGS@ \
@LIBFWNT_CPPFLAGS@ \
@LIBUNA_CPPFLAGS@ \
@PTHREAD_CPPFLAGS@ \
@LIBFWEVT_DLL_EXPORT@
Expand All @@ -18,17 +18,21 @@ libfwevt_la_SOURCES = \
fwevt_template.h \
libfwevt.c \
libfwevt_channel.c libfwevt_channel.h \
libfwevt_data_segment.c libfwevt_data_segment.h \
libfwevt_date_time.c libfwevt_date_time.h \
libfwevt_debug.c libfwevt_debug.h \
libfwevt_definitions.h \
libfwevt_extern.h \
libfwevt_error.c libfwevt_error.h \
libfwevt_event.c libfwevt_event.h \
libfwevt_floating_point.c libfwevt_floating_point.h \
libfwevt_integer.c libfwevt_integer.h \
libfwevt_libcdata.h \
libfwevt_libcerror.h \
libfwevt_libcnotify.h \
libfwevt_libfdatetime.h \
libfwevt_libfguid.h \
libfwevt_libfvalue.h \
libfwevt_libfwnt.h \
libfwevt_libuna.h \
libfwevt_keyword.c libfwevt_keyword.h \
libfwevt_level.c libfwevt_level.h \
Expand Down Expand Up @@ -57,7 +61,7 @@ libfwevt_la_LIBADD = \
@LIBUNA_LIBADD@ \
@LIBFDATETIME_LIBADD@ \
@LIBFGUID_LIBADD@ \
@LIBFVALUE_LIBADD@ \
@LIBFWNT_LIBADD@ \
@PTHREAD_LIBADD@

libfwevt_la_LDFLAGS = -no-undefined -version-info 1:0:0
Expand Down
Loading

0 comments on commit 2a1f9a5

Please sign in to comment.