]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/LoadPe32Image.h
5fc9be161eb050ee636f9bcefbb6b8cb5247d7e7
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / LoadPe32Image.h
1 /** @file
2
3 Load Pe32 Image protocol provides capability to load and unload EFI image into memory and execute it.
4
5 This protocol supports the additional new boot devices that do not map well to file system.
6 UEFI can boot from any device (including Network boot) that produces a LoadFile protocol.
7
8 Copyright (c) 2006 - 2008, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 **/
18
19 #ifndef __LOAD_PE32_IMAGE_H__
20 #define __LOAD_PE32_IMAGE_H__
21
22 #define PE32_IMAGE_PROTOCOL_GUID \
23 {0x5cb5c776,0x60d5,0x45ee,{0x88,0x3c,0x45,0x27,0x8,0xcd,0x74,0x3f }}
24
25 #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00
26 #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01
27 #define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02
28
29 typedef struct _EFI_PE32_IMAGE_PROTOCOL EFI_PE32_IMAGE_PROTOCOL;
30
31 /**
32
33 Loads an EFI image into memory and returns a handle to the image with extended parameters.
34
35 @param This Pointer to the LoadPe32Image protocol instance
36 @param ParentImageHandle The caller's image handle.
37 @param FilePath The specific file path from which the image is loaded.
38 @param SourceBuffer If not NULL, a pointer to the memory location containing a copy of
39 the image to be loaded.
40 @param SourceSize The size in bytes of SourceBuffer.
41 @param DstBuffer The buffer to store the image.
42 @param NumberOfPages For input, specifies the space size of the image by caller if not NULL.
43 For output, specifies the actual space size needed.
44 @param ImageHandle Image handle for output.
45 @param EntryPoint Image entry point for output.
46 @param Attribute The bit mask of attributes to set for the load PE image.
47
48 @retval EFI_SUCCESS The image was loaded into memory.
49 @retval EFI_NOT_FOUND The FilePath was not found.
50 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
51 @retval EFI_UNSUPPORTED The image type is not supported, or the device path cannot be
52 parsed to locate the proper protocol for loading the file.
53 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient memory resources.
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 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 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 Attempt to unload an unsupported image.
79 @retval EFI_SUCCESS Image is 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