+#include <Library/SortLib.h>\r
+#include <Library/ShellCommandLib.h>\r
+\r
+#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1 1\r
+#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2 2\r
+\r
+///\r
+/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec < 2.4a\r
+///\r
+typedef struct {\r
+ /// \r
+ /// A unique number identifying the firmware image within the device. The number is \r
+ /// between 1 and DescriptorCount.\r
+ /// \r
+ UINT8 ImageIndex;\r
+ ///\r
+ /// A unique number identifying the firmware image type. \r
+ /// \r
+ EFI_GUID ImageTypeId;\r
+ /// \r
+ /// A unique number identifying the firmware image. \r
+ /// \r
+ UINT64 ImageId;\r
+ /// \r
+ /// A pointer to a null-terminated string representing the firmware image name. \r
+ /// \r
+ CHAR16 *ImageIdName;\r
+ /// \r
+ /// Identifies the version of the device firmware. The format is vendor specific and new \r
+ /// version must have a greater value than an old version.\r
+ /// \r
+ UINT32 Version;\r
+ /// \r
+ /// A pointer to a null-terminated string representing the firmware image version name.\r
+ /// \r
+ CHAR16 *VersionName;\r
+ /// \r
+ /// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid.\r
+ /// \r
+ UINTN Size;\r
+ /// \r
+ /// Image attributes that are supported by this device. See 'Image Attribute Definitions' \r
+ /// for possible returned values of this parameter. A value of 1 indicates the attribute is \r
+ /// supported and the current setting value is indicated in AttributesSetting. A \r
+ /// value of 0 indicates the attribute is not supported and the current setting value in \r
+ /// AttributesSetting is meaningless.\r
+ /// \r
+ UINT64 AttributesSupported;\r
+ /// \r
+ /// Image attributes. See 'Image Attribute Definitions' for possible returned values of \r
+ /// this parameter.\r
+ /// \r
+ UINT64 AttributesSetting;\r
+ /// \r
+ /// Image compatibilities. See 'Image Compatibility Definitions' for possible returned \r
+ /// values of this parameter.\r
+ /// \r
+ UINT64 Compatibilities;\r
+} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1;\r
+\r
+\r
+///\r
+/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5\r
+///\r
+typedef struct {\r
+ /// \r
+ /// A unique number identifying the firmware image within the device. The number is \r
+ /// between 1 and DescriptorCount.\r
+ /// \r
+ UINT8 ImageIndex;\r
+ ///\r
+ /// A unique number identifying the firmware image type. \r
+ /// \r
+ EFI_GUID ImageTypeId;\r
+ /// \r
+ /// A unique number identifying the firmware image. \r
+ /// \r
+ UINT64 ImageId;\r
+ /// \r
+ /// A pointer to a null-terminated string representing the firmware image name. \r
+ /// \r
+ CHAR16 *ImageIdName;\r
+ /// \r
+ /// Identifies the version of the device firmware. The format is vendor specific and new \r
+ /// version must have a greater value than an old version.\r
+ /// \r
+ UINT32 Version;\r
+ /// \r
+ /// A pointer to a null-terminated string representing the firmware image version name.\r
+ /// \r
+ CHAR16 *VersionName;\r
+ /// \r
+ /// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid.\r
+ /// \r
+ UINTN Size;\r
+ /// \r
+ /// Image attributes that are supported by this device. See 'Image Attribute Definitions' \r
+ /// for possible returned values of this parameter. A value of 1 indicates the attribute is \r
+ /// supported and the current setting value is indicated in AttributesSetting. A \r
+ /// value of 0 indicates the attribute is not supported and the current setting value in \r
+ /// AttributesSetting is meaningless.\r
+ /// \r
+ UINT64 AttributesSupported;\r
+ /// \r
+ /// Image attributes. See 'Image Attribute Definitions' for possible returned values of \r
+ /// this parameter.\r
+ /// \r
+ UINT64 AttributesSetting;\r
+ /// \r
+ /// Image compatibilities. See 'Image Compatibility Definitions' for possible returned \r
+ /// values of this parameter.\r
+ /// \r
+ UINT64 Compatibilities;\r
+ ///\r
+ /// Describes the lowest ImageDescriptor version that the device will accept. Only\r
+ /// present in version 2 or higher.\r
+ UINT32 LowestSupportedImageVersion;\r
+} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2;\r