diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-08 09:27:19 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-08 09:27:26 +0200 |
| commit | 29f0db9b82ae826eb3bfa8b87efe53c3105ac456 (patch) | |
| tree | fd15275a1570b9d8ee97c99103b6d8f1f2095dbd | |
| parent | 142e7465b98b01eef5c592b054f1f80b8eb47779 (diff) | |
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 <amlal@nekernel.org>
| -rw-r--r-- | dev/kernel/CFKit/Utils.h | 4 |
1 files changed, 4 insertions, 0 deletions
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. |
