From a9ac78b47dd040e04afc4990dace2472df2302e4 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 13 Feb 2024 15:41:34 +0100 Subject: HCR-15: fix GApplication class, add static on Shared() function. Signed-off-by: Amlal El Mahrouss --- Private/KernelKit/MSDOS.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Private/KernelKit') 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 +#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__ */ -- cgit v1.2.3