diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-13 16:21:59 +0000 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-13 16:21:59 +0000 |
| commit | ddc819e396d7b9626b832b092f6298c0faaccde4 (patch) | |
| tree | 81527a21bdf4ae8f14fb8acd0ff04d9d127f24d3 /Private/KernelKit/MSDOS.hpp | |
| parent | a4af4dc720a0ba8d4c3a23e05825989329a48a2f (diff) | |
| parent | b75417b44d5f63ea0ead68cbe8f62bd76df62229 (diff) | |
Merge branch 'HCR-15' into 'trunk'
HCR-15: Load Kernel into memory.
See merge request mahrouss-logic/micro-kernel!5
Diffstat (limited to 'Private/KernelKit/MSDOS.hpp')
| -rw-r--r-- | Private/KernelKit/MSDOS.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Private/KernelKit/MSDOS.hpp b/Private/KernelKit/MSDOS.hpp index 4f098249..2276f3cb 100644 --- a/Private/KernelKit/MSDOS.hpp +++ b/Private/KernelKit/MSDOS.hpp @@ -16,6 +16,8 @@ #include <NewKit/Defines.hpp> +#include "PE.hpp" + typedef HCore::UInt32 DosWord; typedef HCore::Long DosLong; @@ -41,4 +43,15 @@ typedef struct _DosHeader { DosLong eLfanew; } DosHeader, *DosHeaderPtr; +namespace HCore { +/// @brief Find the PE header inside the the blob. +inline auto rt_find_exec_header(DosHeaderPtr ptrDos) -> VoidPtr { + if (!ptrDos) return nullptr; + if (ptrDos->eMagic[0] != kMagMz0) return nullptr; + if (ptrDos->eMagic[0] != kMagMz1) return nullptr; + + return (VoidPtr)(&ptrDos->eLfanew + 1); +} +} // namespace HCore + #endif /* ifndef __MSDOS_EXEC__ */ |
