From 1818c06e9aae4e48aed3de202b49ba2b48bf4109 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sun, 17 Mar 2019 19:36:25 +0300 Subject: [PATCH] Add forgotten prelink size update after injection --- Tests/KernelTest/KernelTest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Tests/KernelTest/KernelTest.c b/Tests/KernelTest/KernelTest.c index 45e9e41b..d7fd276f 100644 --- a/Tests/KernelTest/KernelTest.c +++ b/Tests/KernelTest/KernelTest.c @@ -12958,16 +12958,16 @@ CalculateReserveSize ( STATIC EFI_STATUS -CheckPrelinked ( +TestInjectPrelinked ( IN OUT UINT8 *Kernel, - IN UINT32 KernelSize, + IN UINT32 *KernelSize, IN UINT32 AllocatedSize ) { EFI_STATUS Status; PRELINKED_CONTEXT Context; - Status = PrelinkedContextInit (&Context, Kernel, KernelSize, AllocatedSize); + Status = PrelinkedContextInit (&Context, Kernel, *KernelSize, AllocatedSize); if (!EFI_ERROR (Status)) { Status = PrelinkedInjectPrepare (&Context); @@ -13005,6 +13005,8 @@ CheckPrelinked ( DEBUG ((DEBUG_WARN, "Plist inject prepare error - %r\n", Status)); } + *KernelSize = Context.PrelinkedSize; + PrelinkedContextFree (&Context); } @@ -13067,7 +13069,7 @@ TestFileOpen ( // TODO: patches, dropping, and injection here. // - PrelinkedStatus = CheckPrelinked (Kernel, KernelSize, AllocatedSize); + PrelinkedStatus = TestInjectPrelinked (Kernel, &KernelSize, AllocatedSize); DEBUG ((DEBUG_WARN, "Prelinked status - %r\n", PrelinkedStatus));