]>
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 LG |
6 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
7 | This program and the accompanying materials are licensed and made available under\r | |
8 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
64a80549 | 9 | The full text of the license may be found at\r |
d1102dba | 10 | http://opensource.org/licenses/bsd-license.php.\r |
023c0fec | 11 | \r |
d1102dba | 12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
023c0fec | 13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef __LOAD_PE32_IMAGE_H__\r | |
18 | #define __LOAD_PE32_IMAGE_H__\r | |
19 | \r | |
20 | #define PE32_IMAGE_PROTOCOL_GUID \\r | |
21 | {0x5cb5c776,0x60d5,0x45ee,{0x88,0x3c,0x45,0x27,0x8,0xcd,0x74,0x3f }}\r | |
22 | \r | |
23 | #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00\r | |
24 | #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01\r | |
25 | #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02\r | |
26 | \r | |
27 | typedef struct _EFI_PE32_IMAGE_PROTOCOL EFI_PE32_IMAGE_PROTOCOL;\r | |
28 | \r | |
29 | /**\r | |
30 | \r | |
31 | Loads an EFI image into memory and returns a handle to the image with extended parameters.\r | |
32 | \r | |
64a80549 | 33 | @param This The pointer to the LoadPe32Image protocol instance\r |
023c0fec | 34 | @param ParentImageHandle The caller's image handle.\r |
35 | @param FilePath The specific file path from which the image is loaded.\r | |
36 | @param SourceBuffer If not NULL, a pointer to the memory location containing a copy of\r | |
37 | the image to be loaded.\r | |
38 | @param SourceSize The size in bytes of SourceBuffer.\r | |
39 | @param DstBuffer The buffer to store the image.\r | |
40 | @param NumberOfPages For input, specifies the space size of the image by caller if not NULL.\r | |
41 | For output, specifies the actual space size needed.\r | |
64a80549 | 42 | @param ImageHandle The image handle for output.\r |
43 | @param EntryPoint The image entry point for output.\r | |
023c0fec | 44 | @param Attribute The bit mask of attributes to set for the load PE image.\r |
45 | \r | |
46 | @retval EFI_SUCCESS The image was loaded into memory.\r | |
47 | @retval EFI_NOT_FOUND The FilePath was not found.\r | |
48 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r | |
49 | @retval EFI_UNSUPPORTED The image type is not supported, or the device path cannot be\r | |
50 | parsed to locate the proper protocol for loading the file.\r | |
64a80549 | 51 | @retval EFI_OUT_OF_RESOURCES The image was not loaded due to insufficient memory resources.\r |
b695e7ff LG |
52 | @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r |
53 | understood.\r | |
54 | @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r | |
d1102dba | 55 | @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the\r |
b695e7ff | 56 | image from being loaded. NULL is returned in *ImageHandle.\r |
d1102dba LG |
57 | @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a\r |
58 | valid EFI_LOADED_IMAGE_PROTOCOL. However, the current\r | |
b695e7ff | 59 | platform policy specifies that the image should not be started.\r |
023c0fec | 60 | **/\r |
61 | typedef\r | |
62 | EFI_STATUS\r | |
63 | (EFIAPI *LOAD_PE_IMAGE)(\r | |
64 | IN EFI_PE32_IMAGE_PROTOCOL *This,\r | |
65 | IN EFI_HANDLE ParentImageHandle,\r | |
66 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r | |
67 | IN VOID *SourceBuffer OPTIONAL,\r | |
68 | IN UINTN SourceSize,\r | |
69 | IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r | |
1b954bea | 70 | IN OUT UINTN *NumberOfPages OPTIONAL,\r |
023c0fec | 71 | OUT EFI_HANDLE *ImageHandle,\r |
72 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r | |
73 | IN UINT32 Attribute\r | |
74 | );\r | |
75 | \r | |
76 | /**\r | |
77 | \r | |
78 | Unload the specified image.\r | |
79 | \r | |
64a80549 | 80 | @param This The pointer to the LoadPe32Image protocol instance\r |
023c0fec | 81 | @param ImageHandle The specified image handle to be unloaded.\r |
82 | \r | |
83 | @retval EFI_INVALID_PARAMETER Image handle is NULL.\r | |
64a80549 | 84 | @retval EFI_UNSUPPORTED Attempted to unload an unsupported image.\r |
85 | @retval EFI_SUCCESS The image successfully unloaded.\r | |
023c0fec | 86 | \r |
87 | --*/\r | |
88 | typedef\r | |
89 | EFI_STATUS\r | |
90 | (EFIAPI *UNLOAD_PE_IMAGE)(\r | |
91 | IN EFI_PE32_IMAGE_PROTOCOL *This,\r | |
92 | IN EFI_HANDLE ImageHandle\r | |
93 | );\r | |
94 | \r | |
95 | struct _EFI_PE32_IMAGE_PROTOCOL {\r | |
96 | LOAD_PE_IMAGE LoadPeImage;\r | |
97 | UNLOAD_PE_IMAGE UnLoadPeImage;\r | |
98 | };\r | |
99 | \r | |
100 | extern EFI_GUID gEfiLoadPeImageProtocolGuid;\r | |
101 | \r | |
102 | #endif\r | |
103 | \r |