mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/Bds: Get User inputs in Unicode
The user input was getting in Ascii and converted later to Unicode when required. In this change, the user inputs are caught in Unicode and converted to Ascii only when needed. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12310 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c3cd46d421
commit
74b961324c
|
@ -68,8 +68,8 @@ GetEnvironmentVariable (
|
|||
}
|
||||
|
||||
EFI_STATUS
|
||||
EditHIInputAscii (
|
||||
IN OUT CHAR8 *CmdLine,
|
||||
EditHIInputStr (
|
||||
IN OUT CHAR16 *CmdLine,
|
||||
IN UINTN MaxCmdLine
|
||||
)
|
||||
{
|
||||
|
@ -79,9 +79,9 @@ EditHIInputAscii (
|
|||
EFI_INPUT_KEY Key;
|
||||
EFI_STATUS Status;
|
||||
|
||||
AsciiPrint (CmdLine);
|
||||
Print (CmdLine);
|
||||
|
||||
for (CmdLineIndex = AsciiStrLen(CmdLine); CmdLineIndex < MaxCmdLine; ) {
|
||||
for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine; ) {
|
||||
Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
@ -98,25 +98,63 @@ EditHIInputAscii (
|
|||
|
||||
if ((Char == CHAR_LINEFEED) || (Char == CHAR_CARRIAGE_RETURN) || (Char == 0x7f)) {
|
||||
CmdLine[CmdLineIndex] = '\0';
|
||||
AsciiPrint ("\n\r");
|
||||
Print (L"\n\r");
|
||||
|
||||
return EFI_SUCCESS;
|
||||
} else if ((Char == '\b') || (Key.ScanCode == SCAN_LEFT) || (Key.ScanCode == SCAN_DELETE)){
|
||||
} else if ((Key.UnicodeChar == L'\b') || (Key.ScanCode == SCAN_LEFT) || (Key.ScanCode == SCAN_DELETE)){
|
||||
if (CmdLineIndex != 0) {
|
||||
CmdLineIndex--;
|
||||
AsciiPrint ("\b \b");
|
||||
Print (L"\b \b");
|
||||
}
|
||||
} else if ((Key.ScanCode == SCAN_ESC) || (Char == 0x1B) || (Char == 0x0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
} else {
|
||||
CmdLine[CmdLineIndex++] = Char;
|
||||
AsciiPrint ("%c", Char);
|
||||
CmdLine[CmdLineIndex++] = Key.UnicodeChar;
|
||||
Print (L"%c", Key.UnicodeChar);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetHIInputStr (
|
||||
IN OUT CHAR16 *CmdLine,
|
||||
IN UINTN MaxCmdLine
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
// For a new input just passed an empty string
|
||||
CmdLine[0] = L'\0';
|
||||
|
||||
Status = EditHIInputStr (CmdLine, MaxCmdLine);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EditHIInputAscii (
|
||||
IN OUT CHAR8 *CmdLine,
|
||||
IN UINTN MaxCmdLine
|
||||
)
|
||||
{
|
||||
CHAR16* Str;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Str = (CHAR16*)AllocatePool (MaxCmdLine * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStr (CmdLine, Str);
|
||||
|
||||
Status = EditHIInputStr (Str, MaxCmdLine);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
UnicodeStrToAsciiStr (Str, CmdLine);
|
||||
}
|
||||
FreePool (Str);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetHIInputAscii (
|
||||
IN OUT CHAR8 *CmdLine,
|
||||
|
@ -134,13 +172,13 @@ GetHIInputInteger (
|
|||
OUT UINTN *Integer
|
||||
)
|
||||
{
|
||||
CHAR8 CmdLine[255];
|
||||
CHAR16 CmdLine[255];
|
||||
EFI_STATUS Status;
|
||||
|
||||
CmdLine[0] = '\0';
|
||||
Status = EditHIInputAscii (CmdLine,255);
|
||||
Status = EditHIInputStr (CmdLine, 255);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
*Integer = AsciiStrDecimalToUintn (CmdLine);
|
||||
*Integer = StrDecimalToUintn (CmdLine);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -151,36 +189,36 @@ GetHIInputIP (
|
|||
OUT EFI_IP_ADDRESS *Ip
|
||||
)
|
||||
{
|
||||
CHAR8 CmdLine[255];
|
||||
CHAR8 *Str;
|
||||
CHAR16 CmdLine[255];
|
||||
CHAR16 *Str;
|
||||
EFI_STATUS Status;
|
||||
|
||||
CmdLine[0] = '\0';
|
||||
Status = EditHIInputAscii (CmdLine,255);
|
||||
Status = EditHIInputStr (CmdLine,255);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Str = CmdLine;
|
||||
Ip->v4.Addr[0] = (UINT8)AsciiStrDecimalToUintn (Str);
|
||||
Ip->v4.Addr[0] = (UINT8)StrDecimalToUintn (Str);
|
||||
|
||||
Str = AsciiStrStr (Str, ".");
|
||||
Str = StrStr (Str, L".");
|
||||
if (Str == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Ip->v4.Addr[1] = (UINT8)AsciiStrDecimalToUintn (++Str);
|
||||
Ip->v4.Addr[1] = (UINT8)StrDecimalToUintn (++Str);
|
||||
|
||||
Str = AsciiStrStr (Str, ".");
|
||||
Str = StrStr (Str, L".");
|
||||
if (Str == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Ip->v4.Addr[2] = (UINT8)AsciiStrDecimalToUintn (++Str);
|
||||
Ip->v4.Addr[2] = (UINT8)StrDecimalToUintn (++Str);
|
||||
|
||||
Str = AsciiStrStr (Str, ".");
|
||||
Str = StrStr (Str, L".");
|
||||
if (Str == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Ip->v4.Addr[3] = (UINT8)AsciiStrDecimalToUintn (++Str);
|
||||
Ip->v4.Addr[3] = (UINT8)StrDecimalToUintn (++Str);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -191,18 +229,18 @@ GetHIInputBoolean (
|
|||
OUT BOOLEAN *Value
|
||||
)
|
||||
{
|
||||
CHAR8 CmdBoolean[2];
|
||||
CHAR16 CmdBoolean[2];
|
||||
EFI_STATUS Status;
|
||||
|
||||
while(1) {
|
||||
Print (L"[y/n] ");
|
||||
Status = GetHIInputAscii (CmdBoolean,2);
|
||||
Status = GetHIInputStr (CmdBoolean,2);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
} else if ((CmdBoolean[0] == 'y') || (CmdBoolean[0] == 'Y')) {
|
||||
} else if ((CmdBoolean[0] == L'y') || (CmdBoolean[0] == L'Y')) {
|
||||
if (Value) *Value = TRUE;
|
||||
return EFI_SUCCESS;
|
||||
} else if ((CmdBoolean[0] == 'n') || (CmdBoolean[0] == 'N')) {
|
||||
} else if ((CmdBoolean[0] == L'n') || (CmdBoolean[0] == L'N')) {
|
||||
if (Value) *Value = FALSE;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,18 @@ BootDeviceGetDeviceSupport (
|
|||
OUT BDS_LOAD_OPTION_SUPPORT** DeviceSupport
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
GetHIInputStr (
|
||||
IN OUT CHAR16 *CmdLine,
|
||||
IN UINTN MaxCmdLine
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EditHIInputStr (
|
||||
IN OUT CHAR16 *CmdLine,
|
||||
IN UINTN MaxCmdLine
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
GetHIInputAscii (
|
||||
IN OUT CHAR8 *CmdLine,
|
||||
|
|
|
@ -116,8 +116,7 @@ BootMenuAddBootOption (
|
|||
EFI_STATUS Status;
|
||||
BDS_SUPPORTED_DEVICE* SupportedBootDevice;
|
||||
BDS_LOADER_ARGUMENTS BootArguments;
|
||||
CHAR8 AsciiBootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
|
||||
CHAR16 *BootDescription;
|
||||
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
|
||||
UINT32 Attributes;
|
||||
BDS_LOADER_TYPE BootType;
|
||||
BDS_LOAD_OPTION *BdsLoadOption;
|
||||
|
@ -171,24 +170,18 @@ BootMenuAddBootOption (
|
|||
}
|
||||
|
||||
Print(L"Description for this new Entry: ");
|
||||
Status = GetHIInputAscii (AsciiBootDescription,BOOT_DEVICE_DESCRIPTION_MAX);
|
||||
Status = GetHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto FREE_DEVICE_PATH;
|
||||
}
|
||||
|
||||
// Convert Ascii into Unicode
|
||||
BootDescription = (CHAR16*)AllocatePool(AsciiStrSize(AsciiBootDescription) * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStr (AsciiBootDescription, BootDescription);
|
||||
|
||||
// Create new entry
|
||||
Status = BootOptionCreate (Attributes, BootDescription, DevicePath, BootType, &BootArguments, &BdsLoadOption);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
InsertTailList (BootOptionsList,&BdsLoadOption->Link);
|
||||
}
|
||||
|
||||
FreePool (BootDescription);
|
||||
|
||||
FREE_DEVICE_PATH:
|
||||
FreePool (DevicePath);
|
||||
|
||||
|
@ -303,8 +296,7 @@ BootMenuUpdateBootOption (
|
|||
BDS_LOAD_OPTION *BootOption;
|
||||
BDS_LOAD_OPTION_SUPPORT *DeviceSupport;
|
||||
BDS_LOADER_ARGUMENTS BootArguments;
|
||||
CHAR8 AsciiBootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
|
||||
CHAR16 *BootDescription;
|
||||
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
|
||||
EFI_DEVICE_PATH* DevicePath;
|
||||
BDS_LOADER_TYPE BootType;
|
||||
|
||||
|
@ -365,22 +357,15 @@ BootMenuUpdateBootOption (
|
|||
}
|
||||
|
||||
Print(L"Description for this new Entry: ");
|
||||
UnicodeStrToAsciiStr (BootOption->Description, AsciiBootDescription);
|
||||
Status = EditHIInputAscii (AsciiBootDescription, BOOT_DEVICE_DESCRIPTION_MAX);
|
||||
Status = EditHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto FREE_DEVICE_PATH;
|
||||
}
|
||||
|
||||
// Convert Ascii into Unicode
|
||||
BootDescription = (CHAR16*)AllocatePool(AsciiStrSize(AsciiBootDescription) * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStr (AsciiBootDescription, BootDescription);
|
||||
|
||||
// Update the entry
|
||||
Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, &BootArguments);
|
||||
|
||||
FreePool (BootDescription);
|
||||
|
||||
FREE_DEVICE_PATH:
|
||||
FreePool (DevicePath);
|
||||
|
||||
|
|
|
@ -335,32 +335,26 @@ BdsLoadOptionFileSystemCreateDevicePath (
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
FILEPATH_DEVICE_PATH* FilePathDevicePath;
|
||||
CHAR8 AsciiBootFilePath[BOOT_DEVICE_FILEPATH_MAX];
|
||||
CHAR16 *BootFilePath;
|
||||
CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
|
||||
UINTN BootFilePathSize;
|
||||
|
||||
Status = GetHIInputAscii (AsciiBootFilePath,BOOT_DEVICE_FILEPATH_MAX);
|
||||
Status = GetHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
if (AsciiStrSize(AsciiBootFilePath) == 1) {
|
||||
BootFilePathSize = StrSize (BootFilePath);
|
||||
if (BootFilePathSize == 2) {
|
||||
*DevicePathNode = NULL;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Convert Ascii into Unicode
|
||||
BootFilePath = (CHAR16*)AllocatePool(AsciiStrSize(AsciiBootFilePath) * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStr (AsciiBootFilePath, BootFilePath);
|
||||
BootFilePathSize = StrSize(BootFilePath);
|
||||
|
||||
// Create the FilePath Device Path node
|
||||
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||
FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;
|
||||
FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
|
||||
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
||||
FreePool (BootFilePath);
|
||||
|
||||
if (BootType != NULL || Attributes != NULL) {
|
||||
Status = BootDeviceGetType (FilePathDevicePath->PathName, BootType, Attributes);
|
||||
|
@ -384,8 +378,7 @@ BdsLoadOptionFileSystemUpdateDevicePath (
|
|||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR8 AsciiBootFilePath[BOOT_DEVICE_FILEPATH_MAX];
|
||||
CHAR16 *BootFilePath;
|
||||
CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
|
||||
UINTN BootFilePathSize;
|
||||
FILEPATH_DEVICE_PATH* EndingDevicePath;
|
||||
FILEPATH_DEVICE_PATH* FilePathDevicePath;
|
||||
|
@ -395,29 +388,24 @@ BdsLoadOptionFileSystemUpdateDevicePath (
|
|||
|
||||
EndingDevicePath = (FILEPATH_DEVICE_PATH*)GetLastDevicePathNode (DevicePath);
|
||||
|
||||
UnicodeStrToAsciiStr (EndingDevicePath->PathName,AsciiBootFilePath);
|
||||
Status = EditHIInputAscii (AsciiBootFilePath,BOOT_DEVICE_FILEPATH_MAX);
|
||||
StrnCpy (BootFilePath, EndingDevicePath->PathName, BOOT_DEVICE_FILEPATH_MAX);
|
||||
Status = EditHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (AsciiStrSize(AsciiBootFilePath) == 1) {
|
||||
BootFilePathSize = StrSize(BootFilePath);
|
||||
if (BootFilePathSize == 2) {
|
||||
*NewDevicePath = NULL;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Convert Ascii into Unicode
|
||||
BootFilePath = (CHAR16*)AllocatePool(AsciiStrSize(AsciiBootFilePath) * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStr (AsciiBootFilePath, BootFilePath);
|
||||
BootFilePathSize = StrSize(BootFilePath);
|
||||
|
||||
// Create the FilePath Device Path node
|
||||
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||
FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;
|
||||
FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
|
||||
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
||||
FreePool (BootFilePath);
|
||||
|
||||
// Generate the new Device Path by replacing the last node by the updated node
|
||||
SetDevicePathEndNode (EndingDevicePath);
|
||||
|
@ -545,17 +533,17 @@ BdsLoadOptionMemMapCreateDevicePath (
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
MEMMAP_DEVICE_PATH* MemMapDevicePath;
|
||||
CHAR8 AsciiStartingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
CHAR8 AsciiEndingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
CHAR16 StrStartingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
CHAR16 StrEndingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
|
||||
Print(L"Starting Address of the binary: ");
|
||||
Status = GetHIInputAscii (AsciiStartingAddress,BOOT_DEVICE_ADDRESS_MAX);
|
||||
Status = GetHIInputStr (StrStartingAddress,BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
Print(L"Ending Address of the binary: ");
|
||||
Status = GetHIInputAscii (AsciiEndingAddress,BOOT_DEVICE_ADDRESS_MAX);
|
||||
Status = GetHIInputStr (StrEndingAddress,BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
@ -565,8 +553,8 @@ BdsLoadOptionMemMapCreateDevicePath (
|
|||
MemMapDevicePath->Header.Type = HARDWARE_DEVICE_PATH;
|
||||
MemMapDevicePath->Header.SubType = HW_MEMMAP_DP;
|
||||
MemMapDevicePath->MemoryType = EfiBootServicesData;
|
||||
MemMapDevicePath->StartingAddress = AsciiStrHexToUint64 (AsciiStartingAddress);
|
||||
MemMapDevicePath->EndingAddress = AsciiStrHexToUint64 (AsciiEndingAddress);
|
||||
MemMapDevicePath->StartingAddress = StrHexToUint64 (StrStartingAddress);
|
||||
MemMapDevicePath->EndingAddress = StrHexToUint64 (StrEndingAddress);
|
||||
|
||||
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
@ -587,8 +575,8 @@ BdsLoadOptionMemMapUpdateDevicePath (
|
|||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR8 AsciiStartingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
CHAR8 AsciiEndingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
CHAR16 StrStartingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
CHAR16 StrEndingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
MEMMAP_DEVICE_PATH* EndingDevicePath;
|
||||
EFI_DEVICE_PATH* DevicePath;
|
||||
|
||||
|
@ -596,21 +584,21 @@ BdsLoadOptionMemMapUpdateDevicePath (
|
|||
EndingDevicePath = (MEMMAP_DEVICE_PATH*)GetLastDevicePathNode (DevicePath);
|
||||
|
||||
Print(L"Starting Address of the binary: ");
|
||||
AsciiSPrint (AsciiStartingAddress,BOOT_DEVICE_ADDRESS_MAX,"0x%X",(UINTN)EndingDevicePath->StartingAddress);
|
||||
Status = EditHIInputAscii (AsciiStartingAddress,BOOT_DEVICE_ADDRESS_MAX);
|
||||
UnicodeSPrint (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX, L"0x%X", (UINTN)EndingDevicePath->StartingAddress);
|
||||
Status = EditHIInputStr (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
Print(L"Ending Address of the binary: ");
|
||||
AsciiSPrint (AsciiEndingAddress,BOOT_DEVICE_ADDRESS_MAX,"0x%X",(UINTN)EndingDevicePath->EndingAddress);
|
||||
Status = EditHIInputAscii (AsciiEndingAddress,BOOT_DEVICE_ADDRESS_MAX);
|
||||
UnicodeSPrint (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX, L"0x%X", (UINTN)EndingDevicePath->EndingAddress);
|
||||
Status = EditHIInputStr (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
EndingDevicePath->StartingAddress = AsciiStrHexToUint64 (AsciiStartingAddress);
|
||||
EndingDevicePath->EndingAddress = AsciiStrHexToUint64 (AsciiEndingAddress);
|
||||
EndingDevicePath->StartingAddress = StrHexToUint64 (StrStartingAddress);
|
||||
EndingDevicePath->EndingAddress = StrHexToUint64 (StrEndingAddress);
|
||||
|
||||
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
@ -797,8 +785,7 @@ BdsLoadOptionTftpCreateDevicePath (
|
|||
EFI_IP_ADDRESS RemoteIp;
|
||||
IPv4_DEVICE_PATH* IPv4DevicePathNode;
|
||||
FILEPATH_DEVICE_PATH* FilePathDevicePath;
|
||||
CHAR8 AsciiBootFilePath[BOOT_DEVICE_FILEPATH_MAX];
|
||||
CHAR16* BootFilePath;
|
||||
CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
|
||||
UINTN BootFilePathSize;
|
||||
|
||||
Print(L"Get the IP address from DHCP: ");
|
||||
|
@ -821,16 +808,16 @@ BdsLoadOptionTftpCreateDevicePath (
|
|||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
Print(L"File path of the EFI Application or the kernel: ");
|
||||
Status = GetHIInputAscii (AsciiBootFilePath,BOOT_DEVICE_FILEPATH_MAX);
|
||||
Print(L"File path of the EFI Application or the kernel : ");
|
||||
Status = GetHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
// Convert Ascii into Unicode
|
||||
BootFilePath = (CHAR16*)AllocatePool(AsciiStrSize(AsciiBootFilePath) * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStr (AsciiBootFilePath, BootFilePath);
|
||||
BootFilePathSize = StrSize(BootFilePath);
|
||||
if (BootFilePathSize == 2) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Allocate the memory for the IPv4 + File Path Device Path Nodes
|
||||
IPv4DevicePathNode = (IPv4_DEVICE_PATH*)AllocatePool(sizeof(IPv4_DEVICE_PATH) + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||
|
@ -852,7 +839,6 @@ BdsLoadOptionTftpCreateDevicePath (
|
|||
FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
|
||||
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
||||
FreePool (BootFilePath);
|
||||
|
||||
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
|
Loading…
Reference in New Issue