]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | Load Pe32 Image protocol enables loading and unloading EFI images into memory and executing those images.\r | |
4 | This protocol uses File Device Path to get EFI image.\r | |
5 | \r | |
6 | Copyright (c) 2006 - 2009, Intel Corporation\r | |
7 | All rights reserved. This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
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 | |
33 | @param This Pointer to the LoadPe32Image protocol instance\r | |
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 | |
42 | @param ImageHandle Image handle for output.\r | |
43 | @param EntryPoint Image entry point for output.\r | |
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 | |
51 | @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient memory resources.\r | |
52 | **/\r | |
53 | typedef\r | |
54 | EFI_STATUS\r | |
55 | (EFIAPI *LOAD_PE_IMAGE)(\r | |
56 | IN EFI_PE32_IMAGE_PROTOCOL *This,\r | |
57 | IN EFI_HANDLE ParentImageHandle,\r | |
58 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r | |
59 | IN VOID *SourceBuffer OPTIONAL,\r | |
60 | IN UINTN SourceSize,\r | |
61 | IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r | |
62 | IN OUT UINTN *NumberOfPages OPTIONAL,\r | |
63 | OUT EFI_HANDLE *ImageHandle,\r | |
64 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r | |
65 | IN UINT32 Attribute\r | |
66 | );\r | |
67 | \r | |
68 | /**\r | |
69 | \r | |
70 | Unload the specified image.\r | |
71 | \r | |
72 | @param This Pointer to the LoadPe32Image protocol instance\r | |
73 | @param ImageHandle The specified image handle to be unloaded.\r | |
74 | \r | |
75 | @retval EFI_INVALID_PARAMETER Image handle is NULL.\r | |
76 | @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.\r | |
77 | @retval EFI_SUCCESS Image is successfully unloaded.\r | |
78 | \r | |
79 | --*/\r | |
80 | typedef\r | |
81 | EFI_STATUS\r | |
82 | (EFIAPI *UNLOAD_PE_IMAGE)(\r | |
83 | IN EFI_PE32_IMAGE_PROTOCOL *This,\r | |
84 | IN EFI_HANDLE ImageHandle\r | |
85 | );\r | |
86 | \r | |
87 | struct _EFI_PE32_IMAGE_PROTOCOL {\r | |
88 | LOAD_PE_IMAGE LoadPeImage;\r | |
89 | UNLOAD_PE_IMAGE UnLoadPeImage;\r | |
90 | };\r | |
91 | \r | |
92 | extern EFI_GUID gEfiLoadPeImageProtocolGuid;\r | |
93 | \r | |
94 | #endif\r | |
95 | \r |