// Portable fixed-image PE32+ loader declarations used by the UEFI bootloader. #pragma once #include #include typedef enum BOOT_PE_STATUS { BootPeSuccess = 0, BootPeInvalidImage, BootPeWrongMachine, BootPeChecksumMissing, BootPeChecksumMismatch, BootPeRelocationsPresent, BootPeBufferTooSmall, BootPeImportsPresent, BootPeUnsupportedImport, BootPeImportNotFound, } BOOT_PE_STATUS; typedef struct BOOT_PE_INFO { uint64_t ImageBase; uint32_t SizeOfImage; uint32_t SizeOfHeaders; uint32_t EntryRva; uint32_t Checksum; } BOOT_PE_INFO; // Validates one fixed AMD64 PE32+ file and returns the image metadata required by the bootloader. BOOT_PE_STATUS BootPeInspect(const void* file, size_t fileSize, BOOT_PE_INFO* infoOut); // Copies a validated fixed image into a zeroed image-sized destination. BOOT_PE_STATUS BootPeMaterialize(const void* file, size_t fileSize, void* image, size_t imageCapacity, BOOT_PE_INFO* infoOut); // Returns whether a materialized image declares any import descriptors. BOOT_PE_STATUS BootPeRequireNoImports(const void* image, size_t imageSize); // Resolves one consumer's named imports against a single fixed provider image. BOOT_PE_STATUS BootPeResolveImports(void* consumerImage, size_t consumerSize, const void* providerImage, size_t providerSize, const char* providerName, uint64_t providerVirtualBase); // Returns a concise diagnostic name for one portable loader status. const char* BootPeStatusName(BOOT_PE_STATUS status);