From dcdb8d34250b8f763f6be582190a4eea5acc1dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Ha=CC=88user?= <8659494+mhaeuser@users.noreply.github.com> Date: Sun, 23 Apr 2023 23:48:15 +0200 Subject: [PATCH] MdePkg/UefiImageLib: Add API for the image format ID --- MdePkg/Include/Library/UefiImageLib.h | 12 ++++++++++++ MdePkg/Library/BaseUefiImageLib/UefiImageLibPeCoff.c | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/MdePkg/Include/Library/UefiImageLib.h b/MdePkg/Include/Library/UefiImageLib.h index 58573746a7..ecdb706fd9 100644 --- a/MdePkg/Include/Library/UefiImageLib.h +++ b/MdePkg/Include/Library/UefiImageLib.h @@ -125,6 +125,18 @@ UefiImageInitializeContext ( IN UINT32 FileSize ); +/** + Retrieves the UefiImageLib Image format identifier. + + @param[out] Context The context describing the Image. + + @returns The UefiImageLib format identifier. +**/ +UINT8 +UefiImageGetFormat ( + IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context + ); + /** Hashes the Image using the format's default hashing algorithm. diff --git a/MdePkg/Library/BaseUefiImageLib/UefiImageLibPeCoff.c b/MdePkg/Library/BaseUefiImageLib/UefiImageLibPeCoff.c index 7c7666c077..78f3419177 100644 --- a/MdePkg/Library/BaseUefiImageLib/UefiImageLibPeCoff.c +++ b/MdePkg/Library/BaseUefiImageLib/UefiImageLibPeCoff.c @@ -46,6 +46,14 @@ UefiImageInitializeContextPostHash ( return RETURN_SUCCESS; } +UINT8 +UefiImageGetFormat ( + IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context + ) +{ + return UefiImageFormatPe; +} + BOOLEAN UefiImageHashImageDefault ( IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,