ImageTool: Update RelocateImage internal prototype

This commit is contained in:
Marvin Häuser 2023-06-03 15:53:23 +02:00 committed by MikhailKrichanov
parent c6265d1374
commit e239aed80d
3 changed files with 17 additions and 13 deletions

View File

@ -96,10 +96,10 @@ UefiImageLoaderGetRuntimeContextSizePe (
RETURN_STATUS RETURN_STATUS
UefiImageRelocateImagePe ( UefiImageRelocateImagePe (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context, IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN UINT64 BaseAddress, IN UINT64 BaseAddress,
OUT UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext OPTIONAL, OUT VOID *RuntimeContext OPTIONAL,
IN UINT32 RuntimeContextSize IN UINT32 RuntimeContextSize
) )
{ {
return PeCoffRelocateImage ( return PeCoffRelocateImage (

View File

@ -71,10 +71,10 @@ RETURN_STATUS
typedef typedef
RETURN_STATUS RETURN_STATUS
(*UEFI_IMAGE_RELOCARE_IMAGE) ( (*UEFI_IMAGE_RELOCARE_IMAGE) (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context, IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN UINT64 BaseAddress, IN UINT64 BaseAddress,
OUT UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext OPTIONAL, OUT VOID *RuntimeContext OPTIONAL,
IN UINT32 RuntimeContextSize IN UINT32 RuntimeContextSize
); );
typedef typedef

View File

@ -285,12 +285,16 @@ UefiImageRelocateImage (
) )
{ {
RETURN_STATUS Status; RETURN_STATUS Status;
VOID *FormatContext;
UINT32 FormatContextSize;
FormatContext = RuntimeContext;
FormatContextSize = RuntimeContextSize;
if (RuntimeContext != NULL) { if (RuntimeContext != NULL) {
*(UINT64 *)RuntimeContext = Context->FormatIndex; *(UINT64 *)RuntimeContext = Context->FormatIndex;
RuntimeContext = (UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *)((UINT64 *)RuntimeContext + 1); FormatContext = (VOID *)((UINT64 *)RuntimeContext + 1);
ASSERT (RuntimeContextSize >= 8); ASSERT (FormatContextSize >= 8);
RuntimeContextSize -= 8; FormatContextSize -= 8;
} }
UEFI_IMAGE_EXEC ( UEFI_IMAGE_EXEC (
@ -299,8 +303,8 @@ UefiImageRelocateImage (
RelocateImage, RelocateImage,
Context, Context,
BaseAddress, BaseAddress,
RuntimeContext, FormatContext,
RuntimeContextSize FormatContextSize
); );
if (!RETURN_ERROR (Status)) { if (!RETURN_ERROR (Status)) {