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