]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/Image/Image.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Image / Image.h
CommitLineData
23c98c94 1/** @file\r
504214c4 2 Data structure and functions to load and unload PeImage.\r
23c98c94 3\r
d1102dba 4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
28a00297 6\r
504214c4 7**/\r
28a00297 8\r
9\r
10#ifndef _IMAGE_H_\r
11#define _IMAGE_H_\r
12\r
023c0fec 13#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','p','e','i')\r
14\r
15typedef struct {\r
853adefc 16 UINTN Signature;\r
17 /// Image handle\r
d1102dba 18 EFI_HANDLE Handle;\r
853adefc 19 EFI_PE32_IMAGE_PROTOCOL Pe32Image;\r
023c0fec 20} LOAD_PE32_IMAGE_PRIVATE_DATA;\r
21\r
22#define LOAD_PE32_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
23 CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE)\r
24\r
25\r
28a00297 26//\r
27// Private Data Types\r
28//\r
f3f2e05d 29#define IMAGE_FILE_HANDLE_SIGNATURE SIGNATURE_32('i','m','g','f')\r
28a00297 30typedef struct {\r
31 UINTN Signature;\r
32 BOOLEAN FreeBuffer;\r
33 VOID *Source;\r
34 UINTN SourceSize;\r
35} IMAGE_FILE_HANDLE;\r
36\r
023c0fec 37/**\r
38 Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
39\r
40 @param This Calling context\r
41 @param ParentImageHandle The caller's image handle.\r
42 @param FilePath The specific file path from which the image is\r
43 loaded.\r
44 @param SourceBuffer If not NULL, a pointer to the memory location\r
45 containing a copy of the image to be loaded.\r
46 @param SourceSize The size in bytes of SourceBuffer.\r
47 @param DstBuffer The buffer to store the image.\r
48 @param NumberOfPages For input, specifies the space size of the\r
49 image by caller if not NULL. For output,\r
50 specifies the actual space size needed.\r
51 @param ImageHandle Image handle for output.\r
52 @param EntryPoint Image entry point for output.\r
53 @param Attribute The bit mask of attributes to set for the load\r
54 PE image.\r
55\r
56 @retval EFI_SUCCESS The image was loaded into memory.\r
57 @retval EFI_NOT_FOUND The FilePath was not found.\r
58 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
59 @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
60 path cannot be parsed to locate the proper\r
61 protocol for loading the file.\r
62 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
63 resources.\r
b695e7ff
LG
64 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
65 understood.\r
66 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
d1102dba 67 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the\r
b695e7ff 68 image from being loaded. NULL is returned in *ImageHandle.\r
d1102dba
LG
69 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a\r
70 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current\r
b695e7ff 71 platform policy specifies that the image should not be started.\r
023c0fec 72\r
73**/\r
74EFI_STATUS\r
75EFIAPI\r
76CoreLoadImageEx (\r
77 IN EFI_PE32_IMAGE_PROTOCOL *This,\r
78 IN EFI_HANDLE ParentImageHandle,\r
79 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
80 IN VOID *SourceBuffer OPTIONAL,\r
81 IN UINTN SourceSize,\r
82 IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r
83 OUT UINTN *NumberOfPages OPTIONAL,\r
84 OUT EFI_HANDLE *ImageHandle,\r
85 OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r
86 IN UINT32 Attribute\r
87 );\r
88\r
89\r
90/**\r
91 Unload the specified image.\r
92\r
93 @param This Indicates the calling context.\r
94 @param ImageHandle The specified image handle.\r
162ed594 95\r
023c0fec 96 @retval EFI_INVALID_PARAMETER Image handle is NULL.\r
97 @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.\r
98 @retval EFI_SUCCESS Image successfully unloaded.\r
99\r
100**/\r
101EFI_STATUS\r
102EFIAPI\r
103CoreUnloadImageEx (\r
104 IN EFI_PE32_IMAGE_PROTOCOL *This,\r
105 IN EFI_HANDLE ImageHandle\r
106 );\r
28a00297 107#endif\r