From 05f085c9055fa5bd13bdba40fc40fb3f00d69fab Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 26 Oct 2024 07:59:10 +0200 Subject: IMP: Fixes and improvements. Signed-off-by: Amlal --- dev/zka/CFKit/GUIDWizard.h | 4 ++-- dev/zka/CFKit/LoaderUtils.h | 55 --------------------------------------------- dev/zka/CFKit/Utils.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 57 deletions(-) delete mode 100644 dev/zka/CFKit/LoaderUtils.h create mode 100644 dev/zka/CFKit/Utils.h (limited to 'dev/zka/CFKit') diff --git a/dev/zka/CFKit/GUIDWizard.h b/dev/zka/CFKit/GUIDWizard.h index 4a41cf7f..b4a92249 100644 --- a/dev/zka/CFKit/GUIDWizard.h +++ b/dev/zka/CFKit/GUIDWizard.h @@ -19,6 +19,6 @@ namespace CFKit::XRN::Version1 { using namespace Kernel; - Ref cf_make_sequence(const ArrayList& seq); - ErrorOr> cf_try_guid_to_string(Ref& guid); + Ref cf_make_sequence(const ArrayList& seq); + ErrorOr> cf_try_guid_to_string(Ref& guid); } // namespace CFKit::XRN::Version1 diff --git a/dev/zka/CFKit/LoaderUtils.h b/dev/zka/CFKit/LoaderUtils.h deleted file mode 100644 index edaa38d0..00000000 --- a/dev/zka/CFKit/LoaderUtils.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __CFKIT_LOADER_UTILS_H__ -#define __CFKIT_LOADER_UTILS_H__ - -#include -#include - -namespace CFKit -{ - using namespace Kernel; - - /// @brief Finds the PE header inside the blob. - inline auto ldr_find_exec_header(DosHeaderPtr ptrDos) -> LDR_EXEC_HEADER_PTR - { - if (!ptrDos) - return nullptr; - - if (ptrDos->eMagic[0] != kMagMz0) - return nullptr; - - if (ptrDos->eMagic[1] != kMagMz1) - return nullptr; - - return (LDR_EXEC_HEADER_PTR)(VoidPtr)(&ptrDos->eLfanew + 1); - } - - /// @brief Finds the PE optional header inside the blob. - inline auto ldr_find_opt_exec_header(DosHeaderPtr ptrDos) -> LDR_OPTIONAL_HEADER_PTR - { - if (!ptrDos) - return nullptr; - - auto exec = ldr_find_exec_header(ptrDos); - - if (!exec) - return nullptr; - - return (LDR_OPTIONAL_HEADER_PTR)(VoidPtr)(&exec->mCharacteristics + 1); - } - - /// @brief Finds the PE header inside the blob. - /// @note overloaded function. - inline auto ldr_find_exec_header(const Char* ptrDos) -> LDR_EXEC_HEADER_PTR - { - return ldr_find_exec_header((DosHeaderPtr)ptrDos); - } - - /// @brief Finds the PE header inside the blob. - /// @note overloaded function. - inline auto ldr_find_opt_exec_header(const Char* ptrDos) -> LDR_OPTIONAL_HEADER_PTR - { - return ldr_find_opt_exec_header((DosHeaderPtr)ptrDos); - } -} // namespace CFKit - -#endif // ifndef __CFKIT_LOADER_UTILS_H__ diff --git a/dev/zka/CFKit/Utils.h b/dev/zka/CFKit/Utils.h new file mode 100644 index 00000000..370eca45 --- /dev/null +++ b/dev/zka/CFKit/Utils.h @@ -0,0 +1,55 @@ +#ifndef CFKIT_UTILS_H +#define CFKIT_UTILS_H + +#include +#include + +namespace CFKit +{ + using namespace Kernel; + + /// @brief Finds the PE header inside the blob. + inline auto ldr_find_exec_header(DosHeaderPtr ptrDos) -> LDR_EXEC_HEADER_PTR + { + if (!ptrDos) + return nullptr; + + if (ptrDos->eMagic[0] != kMagMz0) + return nullptr; + + if (ptrDos->eMagic[1] != kMagMz1) + return nullptr; + + return (LDR_EXEC_HEADER_PTR)(VoidPtr)(&ptrDos->eLfanew + 1); + } + + /// @brief Finds the PE optional header inside the blob. + inline auto ldr_find_opt_exec_header(DosHeaderPtr ptrDos) -> LDR_OPTIONAL_HEADER_PTR + { + if (!ptrDos) + return nullptr; + + auto exec = ldr_find_exec_header(ptrDos); + + if (!exec) + return nullptr; + + return (LDR_OPTIONAL_HEADER_PTR)(VoidPtr)(&exec->mCharacteristics + 1); + } + + /// @brief Finds the PE header inside the blob. + /// @note overloaded function. + inline auto ldr_find_exec_header(const Char* ptrDos) -> LDR_EXEC_HEADER_PTR + { + return ldr_find_exec_header((DosHeaderPtr)ptrDos); + } + + /// @brief Finds the PE header inside the blob. + /// @note overloaded function. + inline auto ldr_find_opt_exec_header(const Char* ptrDos) -> LDR_OPTIONAL_HEADER_PTR + { + return ldr_find_opt_exec_header((DosHeaderPtr)ptrDos); + } +} // namespace CFKit + +#endif // ifndef CFKIT_UTILS_H -- cgit v1.2.3