1 /**
2 	Based on Protocol/LoadedImage.h, original notice:
3 
4 	UEFI 2.0 Loaded image protocol definition.
5 	
6 	Every EFI driver and application is passed an image handle when it is loaded.
7 	This image handle will contain a Loaded Image Protocol.
8 	
9 	Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
10 	This program and the accompanying materials
11 	are licensed and made available under the terms and conditions of the BSD License
12 	which accompanies this distribution.  The full text of the license may be found at
13 	http://opensource.org/licenses/bsd-license.php
14 	
15 	THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 	WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 	
18 **/
19 module uefi.protocols.loadedimage;
20 import uefi.base;
21 import uefi.base_type;
22 import uefi.spec;
23 import uefi.protocols.devicepath;
24 
25 public:
26 extern (C):
27 enum EFI_GUID EFI_LOADED_IMAGE_PROTOCOL_GUID = EFI_GUID(0x5B1B31A1, 0x9562,
28         0x11d2, [0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B]);
29 enum EFI_GUID EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID = EFI_GUID(0xbc62157e,
30         0x3e33, 0x4fec, [0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf]);
31 /// Protocol GUID defined in EFI1.1.
32 enum LOADED_IMAGE_PROTOCOL = EFI_LOADED_IMAGE_PROTOCOL_GUID;
33 /// EFI_SYSTEM_TABLE & EFI_IMAGE_UNLOAD are defined in EfiApi.h
34 enum EFI_LOADED_IMAGE_PROTOCOL_REVISION = 0x1000;
35 /// Revision defined in EFI1.1.
36 enum EFI_LOADED_IMAGE_INFORMATION_REVISION = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
37 /// Can be used on any image handle to obtain information about the loaded image.
38 struct EFI_LOADED_IMAGE_PROTOCOL
39 {
40     UINT32 Revision; ///< Defines the revision of the EFI_LOADED_IMAGE_PROTOCOL structure.
41     ///< All future revisions will be backward compatible to the current revision.
42     EFI_HANDLE ParentHandle; ///< Parent image's image handle. NULL if the image is loaded directly from
43     ///< the firmware's boot manager.
44     EFI_SYSTEM_TABLE* SystemTable; ///< the image's EFI system table pointer.
45     //
46     // Source location of image
47     //
48     EFI_HANDLE DeviceHandle; ///< The device handle that the EFI Image was loaded from.
49     EFI_DEVICE_PATH_PROTOCOL* FilePath; ///< A pointer to the file path portion specific to DeviceHandle
50     ///< that the EFI Image was loaded from.
51     VOID* Reserved; ///< Reserved. DO NOT USE.
52     //
53     // Images load options
54     //
55     UINT32 LoadOptionsSize; ///< The size in bytes of LoadOptions.
56     VOID* LoadOptions; ///< A pointer to the image's binary load options.
57     //
58     // Location of where image was loaded
59     //
60     VOID* ImageBase; ///< The base address at which the image was loaded.
61     UINT64 ImageSize; ///< The size in bytes of the loaded image.
62     EFI_MEMORY_TYPE ImageCodeType; ///< The memory type that the code sections were loaded as.
63     EFI_MEMORY_TYPE ImageDataType; ///< The memory type that the data sections were loaded as.
64     EFI_IMAGE_UNLOAD Unload;
65 }
66 
67 alias EFI_LOADED_IMAGE = EFI_LOADED_IMAGE_PROTOCOL;