+ Handle = NULL; \r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // ImageHandle will be valid only Status is success. \r
+ //\r
+ Handle = *ImageHandle;\r
+ }\r
+\r
+ PERF_START (Handle, "LoadImage:", NULL, Tick);\r
+ PERF_END (Handle, "LoadImage:", NULL, 0);\r
+\r
+ return Status;\r
+}\r
+\r
+\r
+\r
+/**\r
+ Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
+\r
+ @param This Calling context\r
+ @param ParentImageHandle The caller's image handle.\r
+ @param FilePath The specific file path from which the image is\r
+ loaded.\r
+ @param SourceBuffer If not NULL, a pointer to the memory location\r
+ containing a copy of the image to be loaded.\r
+ @param SourceSize The size in bytes of SourceBuffer.\r
+ @param DstBuffer The buffer to store the image.\r
+ @param NumberOfPages For input, specifies the space size of the\r
+ image by caller if not NULL. For output,\r
+ specifies the actual space size needed.\r
+ @param ImageHandle Image handle for output.\r
+ @param EntryPoint Image entry point for output.\r
+ @param Attribute The bit mask of attributes to set for the load\r
+ PE image.\r
+\r
+ @retval EFI_SUCCESS The image was loaded into memory.\r
+ @retval EFI_NOT_FOUND The FilePath was not found.\r
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
+ @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
+ path cannot be parsed to locate the proper\r
+ protocol for loading the file.\r
+ @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
+ resources.\r
+ @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
+ understood.\r
+ @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
+ @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the \r
+ image from being loaded. NULL is returned in *ImageHandle.\r
+ @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a \r
+ valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
+ platform policy specifies that the image should not be started.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreLoadImageEx (\r
+ IN EFI_PE32_IMAGE_PROTOCOL *This,\r
+ IN EFI_HANDLE ParentImageHandle,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
+ IN VOID *SourceBuffer OPTIONAL,\r
+ IN UINTN SourceSize,\r
+ IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r
+ OUT UINTN *NumberOfPages OPTIONAL,\r
+ OUT EFI_HANDLE *ImageHandle,\r
+ OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r
+ IN UINT32 Attribute\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINT64 Tick;\r
+ EFI_HANDLE Handle;\r
+\r
+ Tick = 0;\r
+ PERF_CODE (\r
+ Tick = GetPerformanceCounter ();\r
+ );\r
+\r
+ Status = CoreLoadImageCommon (\r
+ TRUE,\r
+ ParentImageHandle,\r
+ FilePath,\r
+ SourceBuffer,\r
+ SourceSize,\r
+ DstBuffer,\r
+ NumberOfPages,\r
+ ImageHandle,\r
+ EntryPoint,\r
+ Attribute\r
+ );\r
+\r
+ Handle = NULL; \r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // ImageHandle will be valid only Status is success. \r
+ //\r
+ Handle = *ImageHandle;\r
+ }\r
+\r
+ PERF_START (Handle, "LoadImage:", NULL, Tick);\r
+ PERF_END (Handle, "LoadImage:", NULL, 0);\r