From 29f0db9b82ae826eb3bfa8b87efe53c3105ac456 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 8 Jun 2025 09:27:19 +0200 Subject: fix: cf/utils: Fix MSDOS header jump on anything else than AMD64. why? - This quirk of adding `+ 1` at the end is something related to the x64 ISA only. Signed-off-by: Amlal El Mahrouss --- dev/kernel/CFKit/Utils.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'dev/kernel/CFKit') diff --git a/dev/kernel/CFKit/Utils.h b/dev/kernel/CFKit/Utils.h index a5df8097..97b0ee53 100644 --- a/dev/kernel/CFKit/Utils.h +++ b/dev/kernel/CFKit/Utils.h @@ -16,7 +16,11 @@ inline auto ldr_find_exec_header(DosHeaderPtr ptrDos) -> LDR_EXEC_HEADER_PTR { 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. -- cgit v1.2.3