summaryrefslogtreecommitdiffhomepage
path: root/Boot/Sources/ProgramLoader.cxx
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-31 08:48:01 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-31 08:48:01 +0200
commit2d11ddee665e8425708bbda876060b2958de5d07 (patch)
treebaeb55c221705e1c84ccd89644204bb17d40c365 /Boot/Sources/ProgramLoader.cxx
parent5dc33d9a22207b8b664ea83f88280911a22d0c52 (diff)
[newosldr] Running kernel as separate image instead.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Boot/Sources/ProgramLoader.cxx')
-rw-r--r--Boot/Sources/ProgramLoader.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/Boot/Sources/ProgramLoader.cxx b/Boot/Sources/ProgramLoader.cxx
index 4ea0d4c6..fabd1c63 100644
--- a/Boot/Sources/ProgramLoader.cxx
+++ b/Boot/Sources/ProgramLoader.cxx
@@ -39,13 +39,13 @@ namespace Boot
if (firstBytes[0] == kMagMz0 &&
firstBytes[1] == kMagMz1)
{
- writer.Write("newosldr: MZ executable detected.\r");
+ writer.Write("newosldr: Windows executable detected.\r");
ExecHeaderPtr hdrPtr = (ldr_find_exec_header(firstBytes));
ExecOptionalHeaderPtr optHdr = (ldr_find_opt_exec_header(firstBytes));
// Parse PE32+
- fStartAddress = (VoidPtr)((UIntPtr)optHdr->mImageBase + optHdr->mBaseOfCode + optHdr->mAddressOfEntryPoint);
+ fStartAddress = (VoidPtr)(optHdr->mAddressOfEntryPoint);
fStackPtr = new Char[optHdr->mSizeOfStackReserve];
writer.Write("newosldr: Major Linker: ").Write(optHdr->mMajorLinkerVersion).Write("\r");
@@ -112,4 +112,9 @@ namespace Boot
{
CopyMem(fBlobName, name, StrLen(name));
}
+
+ bool ProgramLoader::IsValid()
+ {
+ return fStartAddress != nullptr;
+ }
} // namespace Boot