]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/LoadPe32Image.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / LoadPe32Image.h
1 /** @file
2
3 Load Pe32 Image protocol enables loading and unloading EFI images into memory and executing those images.
4 This protocol uses File Device Path to get an EFI image.
5
6 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef __LOAD_PE32_IMAGE_H__
12 #define __LOAD_PE32_IMAGE_H__
13
14 #define PE32_IMAGE_PROTOCOL_GUID \
15 {0x5cb5c776,0x60d5,0x45ee,{0x88,0x3c,0x45,0x27,0x8,0xcd,0x74,0x3f }}
16
17 #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00
18 #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01
19 #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02
20
21 typedef struct _EFI_PE32_IMAGE_PROTOCOL EFI_PE32_IMAGE_PROTOCOL;
22
23 /**
24
25 Loads an EFI image into memory and returns a handle to the image with extended parameters.
26
27 @param This The pointer to the LoadPe32Image protocol instance
28 @param ParentImageHandle The caller's image handle.
29 @param FilePath The specific file path from which the image is loaded.
30 @param SourceBuffer If not NULL, a pointer to the memory location containing a copy of
31 the image to be loaded.
32 @param SourceSize The size in bytes of SourceBuffer.
33 @param DstBuffer The buffer to store the image.
34 @param NumberOfPages For input, specifies the space size of the image by caller if not NULL.
35 For output, specifies the actual space size needed.
36 @param ImageHandle The image handle for output.
37 @param EntryPoint The image entry point for output.
38 @param Attribute The bit mask of attributes to set for the load PE image.
39
40 @retval EFI_SUCCESS The image was loaded into memory.
41 @retval EFI_NOT_FOUND The FilePath was not found.
42 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
43 @retval EFI_UNSUPPORTED The image type is not supported, or the device path cannot be
44 parsed to locate the proper protocol for loading the file.
45 @retval EFI_OUT_OF_RESOURCES The image was not loaded due to insufficient memory resources.
46 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
47 understood.
48 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
49 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
50 image from being loaded. NULL is returned in *ImageHandle.
51 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
52 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
53 platform policy specifies that the image should not be started.
54 **/
55 typedef
56 EFI_STATUS
57 (EFIAPI *LOAD_PE_IMAGE)(
58 IN EFI_PE32_IMAGE_PROTOCOL *This,
59 IN EFI_HANDLE ParentImageHandle,
60 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
61 IN VOID *SourceBuffer OPTIONAL,
62 IN UINTN SourceSize,
63 IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
64 IN OUT UINTN *NumberOfPages OPTIONAL,
65 OUT EFI_HANDLE *ImageHandle,
66 OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
67 IN UINT32 Attribute
68 );
69
70 /**
71
72 Unload the specified image.
73
74 @param This The pointer to the LoadPe32Image protocol instance
75 @param ImageHandle The specified image handle to be unloaded.
76
77 @retval EFI_INVALID_PARAMETER Image handle is NULL.
78 @retval EFI_UNSUPPORTED Attempted to unload an unsupported image.
79 @retval EFI_SUCCESS The image successfully unloaded.
80
81 --*/
82 typedef
83 EFI_STATUS
84 (EFIAPI *UNLOAD_PE_IMAGE)(
85 IN EFI_PE32_IMAGE_PROTOCOL *This,
86 IN EFI_HANDLE ImageHandle
87 );
88
89 struct _EFI_PE32_IMAGE_PROTOCOL {
90 LOAD_PE_IMAGE LoadPeImage;
91 UNLOAD_PE_IMAGE UnLoadPeImage;
92 };
93
94 extern EFI_GUID gEfiLoadPeImageProtocolGuid;
95
96 #endif
97