- if (!EFI_ERROR (Status)) {\r
- // If the command exited with an error, we pass this error out in the ExitData\r
- // so that it can be retrieved by the EfiShellExecute function (which may\r
- // start the shell with gBS->StartImage)\r
- if (ExitStatus != SHELL_SUCCESS) {\r
- // Allocate a buffer for exit data to pass to gBS->Exit().\r
- // This buffer will contain the empty string immediately followed by\r
- // the shell's exit status. (The empty string is required by the UEFI spec)\r
- ExitDataSize = (sizeof (CHAR16) + sizeof (SHELL_STATUS));\r
- ExitData = AllocatePool (ExitDataSize);\r
- if (ExitData == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- ExitData[0] = '\0';\r
- // Use CopyMem to avoid alignment faults\r
- CopyMem ((ExitData + 1), &ExitStatus, sizeof (ExitStatus));\r
-\r
- gBS->Exit (ImageHandle, EFI_ABORTED, ExitDataSize, ExitData);\r
-\r
- ASSERT (FALSE);\r
- return EFI_SUCCESS;\r
- } else {\r
- return EFI_SUCCESS;\r
- }\r
- } else {\r
- return Status;\r