mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 09:04:07 +02:00
NetworkPkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49 to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
This commit is contained in:
parent
b68ccac17c
commit
b9679cd745
@ -271,7 +271,7 @@ CreateSpdEntry (
|
|||||||
//
|
//
|
||||||
ValueStr = ShellCommandLineGetValue (ParamPackage, L"--name");
|
ValueStr = ShellCommandLineGetValue (ParamPackage, L"--name");
|
||||||
if (ValueStr != NULL) {
|
if (ValueStr != NULL) {
|
||||||
UnicodeStrToAsciiStr (ValueStr, (CHAR8 *) (*Data)->Name);
|
UnicodeStrToAsciiStrS (ValueStr, (CHAR8 *) (*Data)->Name, sizeof ((*Data)->Name));
|
||||||
*Mask |= NAME;
|
*Mask |= NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -785,7 +785,7 @@ CreateSadEntry (
|
|||||||
(*Data)->AlgoInfo.EspAlgoInfo.EncKeyLength = EncKeyLength;
|
(*Data)->AlgoInfo.EspAlgoInfo.EncKeyLength = EncKeyLength;
|
||||||
AsciiStr = AllocateZeroPool (EncKeyLength + 1);
|
AsciiStr = AllocateZeroPool (EncKeyLength + 1);
|
||||||
ASSERT (AsciiStr != NULL);
|
ASSERT (AsciiStr != NULL);
|
||||||
UnicodeStrToAsciiStr (ValueStr, AsciiStr);
|
UnicodeStrToAsciiStrS (ValueStr, AsciiStr, EncKeyLength + 1);
|
||||||
CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.EncKey, AsciiStr, EncKeyLength);
|
CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.EncKey, AsciiStr, EncKeyLength);
|
||||||
FreePool (AsciiStr);
|
FreePool (AsciiStr);
|
||||||
*Mask |= ENCRYPT_KEY;
|
*Mask |= ENCRYPT_KEY;
|
||||||
@ -815,7 +815,7 @@ CreateSadEntry (
|
|||||||
(*Data)->AlgoInfo.EspAlgoInfo.AuthKeyLength = AuthKeyLength;
|
(*Data)->AlgoInfo.EspAlgoInfo.AuthKeyLength = AuthKeyLength;
|
||||||
AsciiStr = AllocateZeroPool (AuthKeyLength + 1);
|
AsciiStr = AllocateZeroPool (AuthKeyLength + 1);
|
||||||
ASSERT (AsciiStr != NULL);
|
ASSERT (AsciiStr != NULL);
|
||||||
UnicodeStrToAsciiStr (ValueStr, AsciiStr);
|
UnicodeStrToAsciiStrS (ValueStr, AsciiStr, AuthKeyLength + 1);
|
||||||
CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.AuthKey, AsciiStr, AuthKeyLength);
|
CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.AuthKey, AsciiStr, AuthKeyLength);
|
||||||
FreePool (AsciiStr);
|
FreePool (AsciiStr);
|
||||||
*Mask |= AUTH_KEY;
|
*Mask |= AUTH_KEY;
|
||||||
|
@ -255,6 +255,7 @@ HttpBootDhcp6ExtractUriInfo (
|
|||||||
EFI_DHCP6_PACKET_OPTION *Option;
|
EFI_DHCP6_PACKET_OPTION *Option;
|
||||||
EFI_IPv6_ADDRESS IpAddr;
|
EFI_IPv6_ADDRESS IpAddr;
|
||||||
CHAR8 *HostName;
|
CHAR8 *HostName;
|
||||||
|
UINTN HostNameSize;
|
||||||
CHAR16 *HostNameStr;
|
CHAR16 *HostNameStr;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
@ -349,14 +350,15 @@ HttpBootDhcp6ExtractUriInfo (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
HostNameStr = AllocateZeroPool ((AsciiStrLen (HostName) + 1) * sizeof (CHAR16));
|
HostNameSize = AsciiStrSize (HostName);
|
||||||
|
HostNameStr = AllocateZeroPool (HostNameSize * sizeof (CHAR16));
|
||||||
if (HostNameStr == NULL) {
|
if (HostNameStr == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (HostName, HostNameStr);
|
AsciiStrToUnicodeStrS (HostName, HostNameStr, HostNameSize);
|
||||||
Status = HttpBootDns (Private, HostNameStr, &IpAddr);
|
Status = HttpBootDns (Private, HostNameStr, &IpAddr);
|
||||||
FreePool (HostNameStr);
|
FreePool (HostNameStr);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -752,6 +754,7 @@ HttpBootGetBootFile (
|
|||||||
UINTN ContentLength;
|
UINTN ContentLength;
|
||||||
HTTP_BOOT_CACHE_CONTENT *Cache;
|
HTTP_BOOT_CACHE_CONTENT *Cache;
|
||||||
UINT8 *Block;
|
UINT8 *Block;
|
||||||
|
UINTN UrlSize;
|
||||||
CHAR16 *Url;
|
CHAR16 *Url;
|
||||||
BOOLEAN IdentityMode;
|
BOOLEAN IdentityMode;
|
||||||
UINTN ReceivedSize;
|
UINTN ReceivedSize;
|
||||||
@ -770,11 +773,12 @@ HttpBootGetBootFile (
|
|||||||
//
|
//
|
||||||
// First, check whether we already cached the requested Uri.
|
// First, check whether we already cached the requested Uri.
|
||||||
//
|
//
|
||||||
Url = AllocatePool ((AsciiStrLen (Private->BootFileUri) + 1) * sizeof (CHAR16));
|
UrlSize = AsciiStrSize (Private->BootFileUri);
|
||||||
|
Url = AllocatePool (UrlSize * sizeof (CHAR16));
|
||||||
if (Url == NULL) {
|
if (Url == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr (Private->BootFileUri, Url);
|
AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);
|
||||||
if (!HeaderOnly) {
|
if (!HeaderOnly) {
|
||||||
Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);
|
Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);
|
||||||
if (Status != EFI_NOT_FOUND) {
|
if (Status != EFI_NOT_FOUND) {
|
||||||
@ -873,11 +877,6 @@ HttpBootGetBootFile (
|
|||||||
}
|
}
|
||||||
RequestData->Method = HeaderOnly ? HttpMethodHead : HttpMethodGet;
|
RequestData->Method = HeaderOnly ? HttpMethodHead : HttpMethodGet;
|
||||||
RequestData->Url = Url;
|
RequestData->Url = Url;
|
||||||
if (RequestData->Url == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
goto ERROR_4;
|
|
||||||
}
|
|
||||||
AsciiStrToUnicodeStr (Private->BootFileUri, RequestData->Url);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// 2.3 Record the request info in a temp cache item.
|
// 2.3 Record the request info in a temp cache item.
|
||||||
|
@ -104,7 +104,7 @@ HttpBootAddBootOption (
|
|||||||
//
|
//
|
||||||
// Update the URI node with the input boot file URI.
|
// Update the URI node with the input boot file URI.
|
||||||
//
|
//
|
||||||
UnicodeStrToAsciiStr (Uri, AsciiUri);
|
UnicodeStrToAsciiStrS (Uri, AsciiUri, sizeof (AsciiUri));
|
||||||
Length = sizeof (EFI_DEVICE_PATH_PROTOCOL) + AsciiStrSize (AsciiUri);
|
Length = sizeof (EFI_DEVICE_PATH_PROTOCOL) + AsciiStrSize (AsciiUri);
|
||||||
Node = AllocatePool (Length);
|
Node = AllocatePool (Length);
|
||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
|
@ -236,6 +236,7 @@ EfiHttpRequest (
|
|||||||
VOID *UrlParser;
|
VOID *UrlParser;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR8 *HostName;
|
CHAR8 *HostName;
|
||||||
|
UINTN HostNameSize;
|
||||||
UINT16 RemotePort;
|
UINT16 RemotePort;
|
||||||
HTTP_PROTOCOL *HttpInstance;
|
HTTP_PROTOCOL *HttpInstance;
|
||||||
BOOLEAN Configure;
|
BOOLEAN Configure;
|
||||||
@ -343,7 +344,7 @@ EfiHttpRequest (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (Request->Url, Url);
|
UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
|
||||||
UrlParser = NULL;
|
UrlParser = NULL;
|
||||||
Status = HttpParseUrl (Url, (UINT32) AsciiStrLen (Url), FALSE, &UrlParser);
|
Status = HttpParseUrl (Url, (UINT32) AsciiStrLen (Url), FALSE, &UrlParser);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -443,13 +444,14 @@ EfiHttpRequest (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
HostNameStr = AllocateZeroPool ((AsciiStrLen (HostName) + 1) * sizeof (CHAR16));
|
HostNameSize = AsciiStrSize (HostName);
|
||||||
|
HostNameStr = AllocateZeroPool (HostNameSize * sizeof (CHAR16));
|
||||||
if (HostNameStr == NULL) {
|
if (HostNameStr == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Error1;
|
goto Error1;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (HostName, HostNameStr);
|
AsciiStrToUnicodeStrS (HostName, HostNameStr, HostNameSize);
|
||||||
if (!HttpInstance->LocalAddressIsIPv6) {
|
if (!HttpInstance->LocalAddressIsIPv6) {
|
||||||
Status = HttpDns4 (HttpInstance, HostNameStr, &HttpInstance->RemoteAddr);
|
Status = HttpDns4 (HttpInstance, HostNameStr, &HttpInstance->RemoteAddr);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous routines for HttpDxe driver.
|
Miscellaneous routines for HttpDxe driver.
|
||||||
|
|
||||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -1489,6 +1489,7 @@ HttpTcpTransmit (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR8 *RequestMsg;
|
CHAR8 *RequestMsg;
|
||||||
CHAR8 *Url;
|
CHAR8 *Url;
|
||||||
|
UINTN UrlSize;
|
||||||
UINTN RequestMsgSize;
|
UINTN RequestMsgSize;
|
||||||
|
|
||||||
ValueInItem = (HTTP_TOKEN_WRAP *) Item->Value;
|
ValueInItem = (HTTP_TOKEN_WRAP *) Item->Value;
|
||||||
@ -1499,12 +1500,13 @@ HttpTcpTransmit (
|
|||||||
//
|
//
|
||||||
// Parse the URI of the remote host.
|
// Parse the URI of the remote host.
|
||||||
//
|
//
|
||||||
Url = AllocatePool (StrLen (ValueInItem->HttpToken->Message->Data.Request->Url) + 1);
|
UrlSize = StrLen (ValueInItem->HttpToken->Message->Data.Request->Url) + 1;
|
||||||
|
Url = AllocatePool (UrlSize);
|
||||||
if (Url == NULL) {
|
if (Url == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (ValueInItem->HttpToken->Message->Data.Request->Url, Url);
|
UnicodeStrToAsciiStrS (ValueInItem->HttpToken->Message->Data.Request->Url, Url, UrlSize);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create request message.
|
// Create request message.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Helper functions for configuring or getting the parameters relating to iSCSI.
|
Helper functions for configuring or getting the parameters relating to iSCSI.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -390,7 +390,11 @@ IScsiConvertAttemptConfigDataToIfrNvData (
|
|||||||
IScsiIpToStr (&Ip, TRUE, IfrNvData->TargetIp);
|
IScsiIpToStr (&Ip, TRUE, IfrNvData->TargetIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (SessionConfigData->TargetName, IfrNvData->TargetName);
|
AsciiStrToUnicodeStrS (
|
||||||
|
SessionConfigData->TargetName,
|
||||||
|
IfrNvData->TargetName,
|
||||||
|
sizeof (IfrNvData->TargetName) / sizeof (IfrNvData->TargetName[0])
|
||||||
|
);
|
||||||
IScsiLunToUnicodeStr (SessionConfigData->BootLun, IfrNvData->BootLun);
|
IScsiLunToUnicodeStr (SessionConfigData->BootLun, IfrNvData->BootLun);
|
||||||
IScsiConvertIsIdToString (IfrNvData->IsId, SessionConfigData->IsId);
|
IScsiConvertIsIdToString (IfrNvData->IsId, SessionConfigData->IsId);
|
||||||
|
|
||||||
@ -405,16 +409,36 @@ IScsiConvertAttemptConfigDataToIfrNvData (
|
|||||||
if (IfrNvData->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
if (IfrNvData->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
||||||
AuthConfigData = &Attempt->AuthConfigData.CHAP;
|
AuthConfigData = &Attempt->AuthConfigData.CHAP;
|
||||||
IfrNvData->CHAPType = AuthConfigData->CHAPType;
|
IfrNvData->CHAPType = AuthConfigData->CHAPType;
|
||||||
AsciiStrToUnicodeStr (AuthConfigData->CHAPName, IfrNvData->CHAPName);
|
AsciiStrToUnicodeStrS (
|
||||||
AsciiStrToUnicodeStr (AuthConfigData->CHAPSecret, IfrNvData->CHAPSecret);
|
AuthConfigData->CHAPName,
|
||||||
AsciiStrToUnicodeStr (AuthConfigData->ReverseCHAPName, IfrNvData->ReverseCHAPName);
|
IfrNvData->CHAPName,
|
||||||
AsciiStrToUnicodeStr (AuthConfigData->ReverseCHAPSecret, IfrNvData->ReverseCHAPSecret);
|
sizeof (IfrNvData->CHAPName) / sizeof (IfrNvData->CHAPName[0])
|
||||||
|
);
|
||||||
|
AsciiStrToUnicodeStrS (
|
||||||
|
AuthConfigData->CHAPSecret,
|
||||||
|
IfrNvData->CHAPSecret,
|
||||||
|
sizeof (IfrNvData->CHAPSecret) / sizeof (IfrNvData->CHAPSecret[0])
|
||||||
|
);
|
||||||
|
AsciiStrToUnicodeStrS (
|
||||||
|
AuthConfigData->ReverseCHAPName,
|
||||||
|
IfrNvData->ReverseCHAPName,
|
||||||
|
sizeof (IfrNvData->ReverseCHAPName) / sizeof (IfrNvData->ReverseCHAPName[0])
|
||||||
|
);
|
||||||
|
AsciiStrToUnicodeStrS (
|
||||||
|
AuthConfigData->ReverseCHAPSecret,
|
||||||
|
IfrNvData->ReverseCHAPSecret,
|
||||||
|
sizeof (IfrNvData->ReverseCHAPSecret) / sizeof (IfrNvData->ReverseCHAPSecret[0])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Other parameters.
|
// Other parameters.
|
||||||
//
|
//
|
||||||
AsciiStrToUnicodeStr (Attempt->AttemptName, IfrNvData->AttemptName);
|
AsciiStrToUnicodeStrS (
|
||||||
|
Attempt->AttemptName,
|
||||||
|
IfrNvData->AttemptName,
|
||||||
|
sizeof (IfrNvData->AttemptName) / sizeof (IfrNvData->AttemptName[0])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -603,12 +627,12 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (Attempt->AttemptName, AttemptName1);
|
AsciiStrToUnicodeStrS (Attempt->AttemptName, AttemptName1, ATTEMPT_NAME_MAX_SIZE);
|
||||||
if (StrLen (AttemptName1) > ATTEMPT_NAME_SIZE) {
|
if (StrLen (AttemptName1) > ATTEMPT_NAME_SIZE) {
|
||||||
CopyMem (&AttemptName1[ATTEMPT_NAME_SIZE], L"...", 4 * sizeof (CHAR16));
|
CopyMem (&AttemptName1[ATTEMPT_NAME_SIZE], L"...", 4 * sizeof (CHAR16));
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (SameNicAttempt->AttemptName, AttemptName2);
|
AsciiStrToUnicodeStrS (SameNicAttempt->AttemptName, AttemptName2, ATTEMPT_NAME_MAX_SIZE);
|
||||||
if (StrLen (AttemptName2) > ATTEMPT_NAME_SIZE) {
|
if (StrLen (AttemptName2) > ATTEMPT_NAME_SIZE) {
|
||||||
CopyMem (&AttemptName2[ATTEMPT_NAME_SIZE], L"...", 4 * sizeof (CHAR16));
|
CopyMem (&AttemptName2[ATTEMPT_NAME_SIZE], L"...", 4 * sizeof (CHAR16));
|
||||||
}
|
}
|
||||||
@ -663,7 +687,7 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (Attempt->MacString, MacString);
|
AsciiStrToUnicodeStrS (Attempt->MacString, MacString, sizeof (MacString) / sizeof (MacString[0]));
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
mPrivate->PortString,
|
mPrivate->PortString,
|
||||||
@ -1087,7 +1111,7 @@ IScsiConfigUpdateAttempt (
|
|||||||
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
|
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
|
||||||
AttemptConfigData = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
|
AttemptConfigData = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (AttemptConfigData->AttemptName, AttemptName);
|
AsciiStrToUnicodeStrS (AttemptConfigData->AttemptName, AttemptName, sizeof (AttemptName) / sizeof (AttemptName[0]));
|
||||||
UnicodeSPrint (mPrivate->PortString, (UINTN) 128, L"Attempt %s", AttemptName);
|
UnicodeSPrint (mPrivate->PortString, (UINTN) 128, L"Attempt %s", AttemptName);
|
||||||
AttemptConfigData->AttemptTitleToken = HiiSetString (
|
AttemptConfigData->AttemptTitleToken = HiiSetString (
|
||||||
mCallbackInfo->RegisteredHandle,
|
mCallbackInfo->RegisteredHandle,
|
||||||
@ -1216,7 +1240,7 @@ IScsiConfigDeleteAttempts (
|
|||||||
mPrivate->SinglePathCount--;
|
mPrivate->SinglePathCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (AttemptConfigData->MacString, MacString);
|
AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, sizeof (MacString) / sizeof (MacString[0]));
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
mPrivate->PortString,
|
mPrivate->PortString,
|
||||||
@ -1730,7 +1754,7 @@ IScsiConfigProcessDefault (
|
|||||||
MacString
|
MacString
|
||||||
);
|
);
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (MacString, AttemptConfigData->MacString);
|
UnicodeStrToAsciiStrS (MacString, AttemptConfigData->MacString, sizeof (AttemptConfigData->MacString));
|
||||||
AttemptConfigData->NicIndex = NicIndex;
|
AttemptConfigData->NicIndex = NicIndex;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1773,7 +1797,7 @@ IScsiConfigProcessDefault (
|
|||||||
L"%d",
|
L"%d",
|
||||||
(UINTN) AttemptConfigData->AttemptConfigIndex
|
(UINTN) AttemptConfigData->AttemptConfigIndex
|
||||||
);
|
);
|
||||||
UnicodeStrToAsciiStr (mPrivate->PortString, AttemptConfigData->AttemptName);
|
UnicodeStrToAsciiStrS (mPrivate->PortString, AttemptConfigData->AttemptName, sizeof (AttemptConfigData->AttemptName));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save the created Attempt temporarily. If user does not save the attempt
|
// Save the created Attempt temporarily. If user does not save the attempt
|
||||||
@ -1942,7 +1966,11 @@ IScsiFormExtractConfig (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
IfrNvData->InitiatorName[0] = L'\0';
|
IfrNvData->InitiatorName[0] = L'\0';
|
||||||
} else {
|
} else {
|
||||||
AsciiStrToUnicodeStr (InitiatorName, IfrNvData->InitiatorName);
|
AsciiStrToUnicodeStrS (
|
||||||
|
InitiatorName,
|
||||||
|
IfrNvData->InitiatorName,
|
||||||
|
sizeof (IfrNvData->InitiatorName) / sizeof (IfrNvData->InitiatorName[0])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2210,7 +2238,7 @@ IScsiFormCallback (
|
|||||||
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
|
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
|
||||||
switch (QuestionId) {
|
switch (QuestionId) {
|
||||||
case KEY_INITIATOR_NAME:
|
case KEY_INITIATOR_NAME:
|
||||||
UnicodeStrToAsciiStr (IfrNvData->InitiatorName, IScsiName);
|
UnicodeStrToAsciiStrS (IfrNvData->InitiatorName, IScsiName, ISCSI_NAME_MAX_SIZE);
|
||||||
BufferSize = AsciiStrSize (IScsiName);
|
BufferSize = AsciiStrSize (IScsiName);
|
||||||
|
|
||||||
Status = gIScsiInitiatorName.Set (&gIScsiInitiatorName, &BufferSize, IScsiName);
|
Status = gIScsiInitiatorName.Set (&gIScsiInitiatorName, &BufferSize, IScsiName);
|
||||||
@ -2237,7 +2265,7 @@ IScsiFormCallback (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (IfrNvData->AttemptName, Private->Current->AttemptName);
|
UnicodeStrToAsciiStrS (IfrNvData->AttemptName, Private->Current->AttemptName, sizeof (Private->Current->AttemptName));
|
||||||
|
|
||||||
IScsiConfigUpdateAttempt ();
|
IScsiConfigUpdateAttempt ();
|
||||||
|
|
||||||
@ -2366,7 +2394,7 @@ IScsiFormCallback (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_TARGET_IP:
|
case KEY_TARGET_IP:
|
||||||
UnicodeStrToAsciiStr (IfrNvData->TargetIp, IpString);
|
UnicodeStrToAsciiStrS (IfrNvData->TargetIp, IpString, sizeof (IpString));
|
||||||
Status = IScsiAsciiStrToIp (IpString, IfrNvData->IpMode, &HostIp);
|
Status = IScsiAsciiStrToIp (IpString, IfrNvData->IpMode, &HostIp);
|
||||||
if (EFI_ERROR (Status) || !IpIsUnicast (&HostIp, IfrNvData->IpMode)) {
|
if (EFI_ERROR (Status) || !IpIsUnicast (&HostIp, IfrNvData->IpMode)) {
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -2383,7 +2411,7 @@ IScsiFormCallback (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_TARGET_NAME:
|
case KEY_TARGET_NAME:
|
||||||
UnicodeStrToAsciiStr (IfrNvData->TargetName, IScsiName);
|
UnicodeStrToAsciiStrS (IfrNvData->TargetName, IScsiName, ISCSI_NAME_MAX_SIZE);
|
||||||
Status = IScsiNormalizeName (IScsiName, AsciiStrLen (IScsiName));
|
Status = IScsiNormalizeName (IScsiName, AsciiStrLen (IScsiName));
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -2406,7 +2434,7 @@ IScsiFormCallback (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_BOOT_LUN:
|
case KEY_BOOT_LUN:
|
||||||
UnicodeStrToAsciiStr (IfrNvData->BootLun, LunString);
|
UnicodeStrToAsciiStrS (IfrNvData->BootLun, LunString, sizeof (LunString));
|
||||||
Status = IScsiAsciiStrToLun (LunString, (UINT8 *) &Lun);
|
Status = IScsiAsciiStrToLun (LunString, (UINT8 *) &Lun);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -2433,30 +2461,34 @@ IScsiFormCallback (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_CHAP_NAME:
|
case KEY_CHAP_NAME:
|
||||||
UnicodeStrToAsciiStr (
|
UnicodeStrToAsciiStrS (
|
||||||
IfrNvData->CHAPName,
|
IfrNvData->CHAPName,
|
||||||
Private->Current->AuthConfigData.CHAP.CHAPName
|
Private->Current->AuthConfigData.CHAP.CHAPName,
|
||||||
|
sizeof (Private->Current->AuthConfigData.CHAP.CHAPName)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_CHAP_SECRET:
|
case KEY_CHAP_SECRET:
|
||||||
UnicodeStrToAsciiStr (
|
UnicodeStrToAsciiStrS (
|
||||||
IfrNvData->CHAPSecret,
|
IfrNvData->CHAPSecret,
|
||||||
Private->Current->AuthConfigData.CHAP.CHAPSecret
|
Private->Current->AuthConfigData.CHAP.CHAPSecret,
|
||||||
|
sizeof (Private->Current->AuthConfigData.CHAP.CHAPSecret)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_REVERSE_CHAP_NAME:
|
case KEY_REVERSE_CHAP_NAME:
|
||||||
UnicodeStrToAsciiStr (
|
UnicodeStrToAsciiStrS (
|
||||||
IfrNvData->ReverseCHAPName,
|
IfrNvData->ReverseCHAPName,
|
||||||
Private->Current->AuthConfigData.CHAP.ReverseCHAPName
|
Private->Current->AuthConfigData.CHAP.ReverseCHAPName,
|
||||||
|
sizeof (Private->Current->AuthConfigData.CHAP.ReverseCHAPName)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_REVERSE_CHAP_SECRET:
|
case KEY_REVERSE_CHAP_SECRET:
|
||||||
UnicodeStrToAsciiStr (
|
UnicodeStrToAsciiStrS (
|
||||||
IfrNvData->ReverseCHAPSecret,
|
IfrNvData->ReverseCHAPSecret,
|
||||||
Private->Current->AuthConfigData.CHAP.ReverseCHAPSecret
|
Private->Current->AuthConfigData.CHAP.ReverseCHAPSecret,
|
||||||
|
sizeof (Private->Current->AuthConfigData.CHAP.ReverseCHAPSecret)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ IScsiStart (
|
|||||||
Session->ConfigData = AttemptConfigData;
|
Session->ConfigData = AttemptConfigData;
|
||||||
Session->AuthType = AttemptConfigData->AuthenticationType;
|
Session->AuthType = AttemptConfigData->AuthenticationType;
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (AttemptConfigData->MacString, MacString);
|
AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, sizeof (MacString) / sizeof (MacString[0]));
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
mPrivate->PortString,
|
mPrivate->PortString,
|
||||||
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
||||||
|
@ -1106,7 +1106,7 @@ IScsiGetConfigData (
|
|||||||
//
|
//
|
||||||
// Refresh the state of this attempt to NVR.
|
// Refresh the state of this attempt to NVR.
|
||||||
//
|
//
|
||||||
AsciiStrToUnicodeStr (AttemptTmp->MacString, MacString);
|
AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof (MacString) / sizeof (MacString[0]));
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
mPrivate->PortString,
|
mPrivate->PortString,
|
||||||
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
||||||
@ -1145,7 +1145,7 @@ IScsiGetConfigData (
|
|||||||
//
|
//
|
||||||
// Refresh the state of this attempt to NVR.
|
// Refresh the state of this attempt to NVR.
|
||||||
//
|
//
|
||||||
AsciiStrToUnicodeStr (AttemptTmp->MacString, MacString);
|
AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof (MacString) / sizeof (MacString[0]));
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
mPrivate->PortString,
|
mPrivate->PortString,
|
||||||
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
||||||
@ -1236,7 +1236,7 @@ IScsiGetConfigData (
|
|||||||
//
|
//
|
||||||
// Refresh the state of this attempt to NVR.
|
// Refresh the state of this attempt to NVR.
|
||||||
//
|
//
|
||||||
AsciiStrToUnicodeStr (AttemptConfigData->MacString, MacString);
|
AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, sizeof (MacString) / sizeof (MacString[0]));
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
mPrivate->PortString,
|
mPrivate->PortString,
|
||||||
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user