diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-23 21:06:27 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-23 21:06:27 -0500 |
| commit | 23040fad647634c08697451fc22ee2ca999629c8 (patch) | |
| tree | 72888f88c7728c82f3f6df1f4f70591de15eab36 /dev/kernel/CFKit/Utils.h | |
| parent | e5cc7351f0577b54c528fb827a7c7e6306c3e843 (diff) | |
| parent | 83d870e58457a1d335a1d9b9966a6a1887cc297b (diff) | |
Merge pull request #81 from nekernel-org/dev
feat! breaking changes on kernel sources.
Diffstat (limited to 'dev/kernel/CFKit/Utils.h')
| -rw-r--r-- | dev/kernel/CFKit/Utils.h | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/dev/kernel/CFKit/Utils.h b/dev/kernel/CFKit/Utils.h deleted file mode 100644 index 247ad5fb..00000000 --- a/dev/kernel/CFKit/Utils.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef CFKIT_UTILS_H -#define CFKIT_UTILS_H - -#include <KernelKit/MSDOS.h> -#include <KernelKit/PE.h> - -/// @brief CFKit -namespace Kernel::CF { -/// @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; - -#ifdef __NE_AMD64__ - return (LDR_EXEC_HEADER_PTR) (VoidPtr) (&ptrDos->eLfanew + 1); -#else - return (LDR_EXEC_HEADER_PTR) (VoidPtr) (&ptrDos->eLfanew); -#endif -} - -/// @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->Characteristics + 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 Kernel::CF - -#endif // ifndef CFKIT_UTILS_H |
