+ If String is NULL, then ASSERT().\r
+ If String is not aligned on a 16-bit boundary, then ASSERT().\r
+ If SearchString is NULL, then ASSERT().\r
+ If SearchString is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and SearchString\r
+ or String contains more than PcdMaximumUnicodeStringLength Unicode\r
+ characters, not including the Null-terminator, then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated Unicode string.\r
+ @param SearchString The pointer to a Null-terminated Unicode string to search for.\r
+\r
+ @retval NULL If the SearchString does not appear in String.\r
+ @return others If there is a match.\r
+\r
+**/\r
+CHAR16 *\r
+EFIAPI\r
+StrStr (\r
+ IN CONST CHAR16 *String,\r
+ IN CONST CHAR16 *SearchString\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated Unicode decimal string to a value of\r
+ type UINTN.\r
+\r
+ This function returns a value of type UINTN by interpreting the contents\r
+ of the Unicode string specified by String as a decimal number. The format\r
+ of the input Unicode string String is:\r
+\r
+ [spaces] [decimal digits].\r
+\r
+ The valid decimal digit character is in the range [0-9]. The\r
+ function will ignore the pad space, which includes spaces or\r
+ tab characters, before [decimal digits]. The running zero in the\r
+ beginning of [decimal digits] will be ignored. Then, the function\r
+ stops at the first character that is a not a valid decimal character\r
+ or a Null-terminator, whichever one comes first.\r
+\r
+ If String is NULL, then ASSERT().\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+ If String has only pad spaces, then 0 is returned.\r
+ If String has no pad spaces or valid decimal digits,\r
+ then 0 is returned.\r
+ If the number represented by String overflows according\r
+ to the range defined by UINTN, then MAX_UINTN is returned.\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and String contains\r
+ more than PcdMaximumUnicodeStringLength Unicode characters not including\r
+ the Null-terminator, then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated Unicode string.\r
+\r
+ @retval Value translated from String.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+StrDecimalToUintn (\r
+ IN CONST CHAR16 *String\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated Unicode decimal string to a value of\r
+ type UINT64.\r
+\r
+ This function returns a value of type UINT64 by interpreting the contents\r
+ of the Unicode string specified by String as a decimal number. The format\r
+ of the input Unicode string String is:\r
+\r
+ [spaces] [decimal digits].\r
+\r
+ The valid decimal digit character is in the range [0-9]. The\r
+ function will ignore the pad space, which includes spaces or\r
+ tab characters, before [decimal digits]. The running zero in the\r
+ beginning of [decimal digits] will be ignored. Then, the function\r
+ stops at the first character that is a not a valid decimal character\r
+ or a Null-terminator, whichever one comes first.\r
+\r
+ If String is NULL, then ASSERT().\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+ If String has only pad spaces, then 0 is returned.\r
+ If String has no pad spaces or valid decimal digits,\r
+ then 0 is returned.\r
+ If the number represented by String overflows according\r
+ to the range defined by UINT64, then MAX_UINT64 is returned.\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and String contains\r
+ more than PcdMaximumUnicodeStringLength Unicode characters not including\r
+ the Null-terminator, then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated Unicode string.\r
+\r
+ @retval Value translated from String.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+StrDecimalToUint64 (\r
+ IN CONST CHAR16 *String\r
+ );\r
+ \r
+\r
+/**\r
+ Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.\r
+\r
+ This function returns a value of type UINTN by interpreting the contents\r
+ of the Unicode string specified by String as a hexadecimal number.\r
+ The format of the input Unicode string String is:\r
+\r
+ [spaces][zeros][x][hexadecimal digits].\r
+\r
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r
+ If "x" appears in the input string, it must be prefixed with at least one 0.\r
+ The function will ignore the pad space, which includes spaces or tab characters,\r
+ before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or\r
+ [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the\r
+ first valid hexadecimal digit. Then, the function stops at the first character \r
+ that is a not a valid hexadecimal character or NULL, whichever one comes first.\r
+\r
+ If String is NULL, then ASSERT().\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+ If String has only pad spaces, then zero is returned.\r
+ If String has no leading pad spaces, leading zeros or valid hexadecimal digits,\r
+ then zero is returned.\r
+ If the number represented by String overflows according to the range defined by\r
+ UINTN, then MAX_UINTN is returned.\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated Unicode string.\r
+\r
+ @retval Value translated from String.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+StrHexToUintn (\r
+ IN CONST CHAR16 *String\r
+ );\r
+\r
+\r
+/**\r
+ Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.\r
+\r
+ This function returns a value of type UINT64 by interpreting the contents\r
+ of the Unicode string specified by String as a hexadecimal number.\r
+ The format of the input Unicode string String is\r
+\r
+ [spaces][zeros][x][hexadecimal digits].\r
+\r
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r
+ If "x" appears in the input string, it must be prefixed with at least one 0.\r
+ The function will ignore the pad space, which includes spaces or tab characters,\r
+ before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or\r
+ [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the\r
+ first valid hexadecimal digit. Then, the function stops at the first character that is\r
+ a not a valid hexadecimal character or NULL, whichever one comes first.\r
+\r
+ If String is NULL, then ASSERT().\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+ If String has only pad spaces, then zero is returned.\r
+ If String has no leading pad spaces, leading zeros or valid hexadecimal digits,\r
+ then zero is returned.\r
+ If the number represented by String overflows according to the range defined by\r
+ UINT64, then MAX_UINT64 is returned.\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated Unicode string.\r
+\r
+ @retval Value translated from String.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+StrHexToUint64 (\r
+ IN CONST CHAR16 *String\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated Unicode string to IPv6 address and prefix length.\r
+\r
+ This function outputs a value of type IPv6_ADDRESS and may output a value\r
+ of type UINT8 by interpreting the contents of the Unicode string specified\r
+ by String. The format of the input Unicode string String is as follows:\r
+\r
+ X:X:X:X:X:X:X:X[/P]\r
+\r
+ X contains one to four hexadecimal digit characters in the range [0-9], [a-f] and\r
+ [A-F]. X is converted to a value of type UINT16, whose low byte is stored in low\r
+ memory address and high byte is stored in high memory address. P contains decimal\r
+ digit characters in the range [0-9]. The running zero in the beginning of P will\r
+ be ignored. /P is optional.\r
+\r
+ When /P is not in the String, the function stops at the first character that is\r
+ not a valid hexadecimal digit character after eight X's are converted.\r
+\r
+ When /P is in the String, the function stops at the first character that is not\r
+ a valid decimal digit character after P is converted.\r
+\r
+ "::" can be used to compress one or more groups of X when X contains only 0.\r
+ The "::" can only appear once in the String.\r
+\r
+ If String is NULL, then ASSERT().\r
+\r
+ If Address is NULL, then ASSERT().\r
+\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
+ PcdMaximumUnicodeStringLength Unicode characters, not including the\r
+ Null-terminator, then ASSERT().\r
+\r
+ If EndPointer is not NULL and Address is translated from String, a pointer\r
+ to the character that stopped the scan is stored at the location pointed to\r
+ by EndPointer.\r
+\r
+ @param String Pointer to a Null-terminated Unicode string.\r
+ @param EndPointer Pointer to character that stops scan.\r
+ @param Address Pointer to the converted IPv6 address.\r
+ @param PrefixLength Pointer to the converted IPv6 address prefix\r
+ length. MAX_UINT8 is returned when /P is\r
+ not in the String.\r
+\r
+ @retval RETURN_SUCCESS Address is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ @retval RETURN_UNSUPPORTED If X contains more than four hexadecimal\r
+ digit characters.\r
+ If String contains "::" and number of X\r
+ is not less than 8.\r
+ If P starts with character that is not a\r
+ valid decimal digit character.\r
+ If the decimal number converted from P\r
+ exceeds 128.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+StrToIpv6Address (\r
+ IN CONST CHAR16 *String,\r
+ OUT CHAR16 **EndPointer, OPTIONAL\r
+ OUT IPv6_ADDRESS *Address,\r
+ OUT UINT8 *PrefixLength OPTIONAL\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated Unicode string to IPv4 address and prefix length.\r
+\r
+ This function outputs a value of type IPv4_ADDRESS and may output a value\r
+ of type UINT8 by interpreting the contents of the Unicode string specified\r
+ by String. The format of the input Unicode string String is as follows:\r
+\r
+ D.D.D.D[/P]\r
+\r
+ D and P are decimal digit characters in the range [0-9]. The running zero in\r
+ the beginning of D and P will be ignored. /P is optional.\r
+\r
+ When /P is not in the String, the function stops at the first character that is\r
+ not a valid decimal digit character after four D's are converted.\r
+\r
+ When /P is in the String, the function stops at the first character that is not\r
+ a valid decimal digit character after P is converted.\r
+\r
+ If String is NULL, then ASSERT().\r
+\r
+ If Address is NULL, then ASSERT().\r
+\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
+ PcdMaximumUnicodeStringLength Unicode characters, not including the\r
+ Null-terminator, then ASSERT().\r
+\r
+ If EndPointer is not NULL and Address is translated from String, a pointer\r
+ to the character that stopped the scan is stored at the location pointed to\r
+ by EndPointer.\r
+\r
+ @param String Pointer to a Null-terminated Unicode string.\r
+ @param EndPointer Pointer to character that stops scan.\r
+ @param Address Pointer to the converted IPv4 address.\r
+ @param PrefixLength Pointer to the converted IPv4 address prefix\r
+ length. MAX_UINT8 is returned when /P is\r
+ not in the String.\r
+\r
+ @retval RETURN_SUCCESS Address is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ @retval RETURN_UNSUPPORTED If String is not in the correct format.\r
+ If any decimal number converted from D\r
+ exceeds 255.\r
+ If the decimal number converted from P\r
+ exceeds 32.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+StrToIpv4Address (\r
+ IN CONST CHAR16 *String,\r
+ OUT CHAR16 **EndPointer, OPTIONAL\r
+ OUT IPv4_ADDRESS *Address,\r
+ OUT UINT8 *PrefixLength OPTIONAL\r
+ );\r
+\r
+#define GUID_STRING_LENGTH 36\r
+\r
+/**\r
+ Convert a Null-terminated Unicode GUID string to a value of type\r
+ EFI_GUID.\r
+\r
+ This function outputs a GUID value by interpreting the contents of\r
+ the Unicode string specified by String. The format of the input\r
+ Unicode string String consists of 36 characters, as follows:\r
+\r
+ aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\r
+\r
+ The pairs aa - pp are two characters in the range [0-9], [a-f] and\r
+ [A-F], with each pair representing a single byte hexadecimal value.\r
+\r
+ The mapping between String and the EFI_GUID structure is as follows:\r
+ aa Data1[24:31]\r
+ bb Data1[16:23]\r
+ cc Data1[8:15]\r
+ dd Data1[0:7]\r
+ ee Data2[8:15]\r
+ ff Data2[0:7]\r
+ gg Data3[8:15]\r
+ hh Data3[0:7]\r
+ ii Data4[0:7]\r
+ jj Data4[8:15]\r
+ kk Data4[16:23]\r
+ ll Data4[24:31]\r
+ mm Data4[32:39]\r
+ nn Data4[40:47]\r
+ oo Data4[48:55]\r
+ pp Data4[56:63]\r
+\r
+ If String is NULL, then ASSERT().\r
+ If Guid is NULL, then ASSERT().\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+\r
+ @param String Pointer to a Null-terminated Unicode string.\r
+ @param Guid Pointer to the converted GUID.\r
+\r
+ @retval RETURN_SUCCESS Guid is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ @retval RETURN_UNSUPPORTED If String is not as the above format.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+StrToGuid (\r
+ IN CONST CHAR16 *String,\r
+ OUT GUID *Guid\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated Unicode hexadecimal string to a byte array.\r
+\r
+ This function outputs a byte array by interpreting the contents of\r
+ the Unicode string specified by String in hexadecimal format. The format of\r
+ the input Unicode string String is:\r
+\r
+ [XX]*\r
+\r
+ X is a hexadecimal digit character in the range [0-9], [a-f] and [A-F].\r
+ The function decodes every two hexadecimal digit characters as one byte. The\r
+ decoding stops after Length of characters and outputs Buffer containing\r
+ (Length / 2) bytes.\r
+\r
+ If String is not aligned in a 16-bit boundary, then ASSERT().\r
+\r
+ If String is NULL, then ASSERT().\r
+\r
+ If Buffer is NULL, then ASSERT().\r
+\r
+ If Length is not multiple of 2, then ASSERT().\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero and Length is greater than\r
+ PcdMaximumUnicodeStringLength, then ASSERT().\r
+\r
+ If MaxBufferSize is less than (Length / 2), then ASSERT().\r
+\r
+ @param String Pointer to a Null-terminated Unicode string.\r
+ @param Length The number of Unicode characters to decode.\r
+ @param Buffer Pointer to the converted bytes array.\r
+ @param MaxBufferSize The maximum size of Buffer.\r
+\r
+ @retval RETURN_SUCCESS Buffer is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ If Length is not multiple of 2.\r
+ If PcdMaximumUnicodeStringLength is not zero,\r
+ and Length is greater than\r
+ PcdMaximumUnicodeStringLength.\r
+ @retval RETURN_UNSUPPORTED If Length of characters from String contain\r
+ a character that is not valid hexadecimal\r
+ digit characters, or a Null-terminator.\r
+ @retval RETURN_BUFFER_TOO_SMALL If MaxBufferSize is less than (Length / 2).\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+StrHexToBytes (\r
+ IN CONST CHAR16 *String,\r
+ IN UINTN Length,\r
+ OUT UINT8 *Buffer,\r
+ IN UINTN MaxBufferSize\r
+ );\r
+\r
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
+\r
+/**\r
+ [ATTENTION] This function is deprecated for security reason.\r
+\r
+ Convert a Null-terminated Unicode string to a Null-terminated\r
+ ASCII string and returns the ASCII string.\r
+\r
+ This function converts the content of the Unicode string Source\r
+ to the ASCII string Destination by copying the lower 8 bits of\r
+ each Unicode character. It returns Destination.\r
+\r
+ The caller is responsible to make sure Destination points to a buffer with size\r
+ equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.\r
+\r
+ If any Unicode characters in Source contain non-zero value in\r
+ the upper 8 bits, then ASSERT().\r
+\r
+ If Destination is NULL, then ASSERT().\r
+ If Source is NULL, then ASSERT().\r
+ If Source is not aligned on a 16-bit boundary, then ASSERT().\r
+ If Source and Destination overlap, then ASSERT().\r
+\r
+ If PcdMaximumUnicodeStringLength is not zero, and Source contains\r
+ more than PcdMaximumUnicodeStringLength Unicode characters not including\r
+ the Null-terminator, then ASSERT().\r
+\r
+ If PcdMaximumAsciiStringLength is not zero, and Source contains more\r
+ than PcdMaximumAsciiStringLength Unicode characters not including the\r
+ Null-terminator, then ASSERT().\r
+\r
+ @param Source The pointer to a Null-terminated Unicode string.\r
+ @param Destination The pointer to a Null-terminated ASCII string.\r
+\r
+ @return Destination.\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+UnicodeStrToAsciiStr (\r
+ IN CONST CHAR16 *Source,\r
+ OUT CHAR8 *Destination\r
+ );\r
+\r
+#endif\r
+\r
+/**\r
+ Convert a Null-terminated Unicode string to a Null-terminated\r
+ ASCII string.\r
+\r
+ This function is similar to AsciiStrCpyS.\r
+\r
+ This function converts the content of the Unicode string Source\r
+ to the ASCII string Destination by copying the lower 8 bits of\r
+ each Unicode character. The function terminates the ASCII string\r
+ Destination by appending a Null-terminator character at the end.\r
+\r
+ The caller is responsible to make sure Destination points to a buffer with size\r
+ equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.\r
+\r
+ If any Unicode characters in Source contain non-zero value in\r
+ the upper 8 bits, then ASSERT().\r
+\r
+ If Source is not aligned on a 16-bit boundary, then ASSERT().\r
+ If an error would be returned, then the function will also ASSERT().\r
+\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
+ @param Source The pointer to a Null-terminated Unicode string.\r
+ @param Destination The pointer to a Null-terminated ASCII string.\r
+ @param DestMax The maximum number of Destination Ascii\r
+ char, including terminating null char.\r
+\r
+ @retval RETURN_SUCCESS String is converted.\r
+ @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).\r
+ @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r
+ If Source is NULL.\r
+ If PcdMaximumAsciiStringLength is not zero,\r
+ and DestMax is greater than\r
+ PcdMaximumAsciiStringLength.\r
+ If PcdMaximumUnicodeStringLength is not zero,\r
+ and DestMax is greater than\r
+ PcdMaximumUnicodeStringLength.\r
+ If DestMax is 0.\r
+ @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+UnicodeStrToAsciiStrS (\r
+ IN CONST CHAR16 *Source,\r
+ OUT CHAR8 *Destination,\r
+ IN UINTN DestMax\r
+ );\r
+\r
+/**\r
+ Convert not more than Length successive characters from a Null-terminated\r
+ Unicode string to a Null-terminated Ascii string. If no null char is copied\r
+ from Source, then Destination[Length] is always set to null.\r
+\r
+ This function converts not more than Length successive characters from the\r
+ Unicode string Source to the Ascii string Destination by copying the lower 8\r
+ bits of each Unicode character. The function terminates the Ascii string\r
+ Destination by appending a Null-terminator character at the end.\r
+\r
+ The caller is responsible to make sure Destination points to a buffer with size\r
+ equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.\r
+\r
+ If any Unicode characters in Source contain non-zero value in the upper 8\r
+ bits, then ASSERT().\r
+ If Source is not aligned on a 16-bit boundary, then ASSERT().\r
+ If an error would be returned, then the function will also ASSERT().\r
+\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
+ @param Source The pointer to a Null-terminated Unicode string.\r
+ @param Length The maximum number of Unicode characters to\r
+ convert.\r
+ @param Destination The pointer to a Null-terminated Ascii string.\r
+ @param DestMax The maximum number of Destination Ascii\r
+ char, including terminating null char.\r
+ @param DestinationLength The number of Unicode characters converted.\r
+\r
+ @retval RETURN_SUCCESS String is converted.\r
+ @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r
+ If Source is NULL.\r
+ If DestinationLength is NULL.\r
+ If PcdMaximumAsciiStringLength is not zero,\r
+ and Length or DestMax is greater than\r
+ PcdMaximumAsciiStringLength.\r
+ If PcdMaximumUnicodeStringLength is not\r
+ zero, and Length or DestMax is greater than\r
+ PcdMaximumUnicodeStringLength.\r
+ If DestMax is 0.\r
+ @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than\r
+ MIN(StrLen(Source), Length).\r
+ @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+UnicodeStrnToAsciiStrS (\r
+ IN CONST CHAR16 *Source,\r
+ IN UINTN Length,\r
+ OUT CHAR8 *Destination,\r
+ IN UINTN DestMax,\r
+ OUT UINTN *DestinationLength\r
+ );\r
+\r
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
+\r
+/**\r
+ [ATTENTION] This function is deprecated for security reason.\r
+\r
+ Copies one Null-terminated ASCII string to another Null-terminated ASCII\r
+ string and returns the new ASCII string.\r
+\r
+ This function copies the contents of the ASCII string Source to the ASCII\r
+ string Destination, and returns Destination. If Source and Destination\r
+ overlap, then the results are undefined.\r
+\r
+ If Destination is NULL, then ASSERT().\r
+ If Source is NULL, then ASSERT().\r
+ If Source and Destination overlap, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and Source contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param Destination The pointer to a Null-terminated ASCII string.\r
+ @param Source The pointer to a Null-terminated ASCII string.\r
+\r
+ @return Destination\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+AsciiStrCpy (\r
+ OUT CHAR8 *Destination,\r
+ IN CONST CHAR8 *Source\r
+ );\r
+\r
+\r
+/**\r
+ [ATTENTION] This function is deprecated for security reason.\r
+\r
+ Copies up to a specified length one Null-terminated ASCII string to another \r
+ Null-terminated ASCII string and returns the new ASCII string.\r
+\r
+ This function copies the contents of the ASCII string Source to the ASCII\r
+ string Destination, and returns Destination. At most, Length ASCII characters\r
+ are copied from Source to Destination. If Length is 0, then Destination is\r
+ returned unmodified. If Length is greater that the number of ASCII characters\r
+ in Source, then Destination is padded with Null ASCII characters. If Source\r
+ and Destination overlap, then the results are undefined.\r
+\r
+ If Destination is NULL, then ASSERT().\r
+ If Source is NULL, then ASSERT().\r
+ If Source and Destination overlap, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and Length is greater than \r
+ PcdMaximumAsciiStringLength, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param Destination The pointer to a Null-terminated ASCII string.\r
+ @param Source The pointer to a Null-terminated ASCII string.\r
+ @param Length The maximum number of ASCII characters to copy.\r
+\r
+ @return Destination\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+AsciiStrnCpy (\r
+ OUT CHAR8 *Destination,\r
+ IN CONST CHAR8 *Source,\r
+ IN UINTN Length\r
+ );\r
+#endif\r
+\r
+/**\r
+ Returns the length of a Null-terminated ASCII string.\r
+\r
+ This function returns the number of ASCII characters in the Null-terminated\r
+ ASCII string specified by String.\r
+\r
+ If Length > 0 and Destination is NULL, then ASSERT().\r
+ If Length > 0 and Source is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and String contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated ASCII string.\r
+\r
+ @return The length of String.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+AsciiStrLen (\r
+ IN CONST CHAR8 *String\r
+ );\r
+\r
+\r
+/**\r
+ Returns the size of a Null-terminated ASCII string in bytes, including the\r
+ Null terminator.\r
+\r
+ This function returns the size, in bytes, of the Null-terminated ASCII string\r
+ specified by String.\r
+\r
+ If String is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and String contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated ASCII string.\r
+\r
+ @return The size of String.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+AsciiStrSize (\r
+ IN CONST CHAR8 *String\r
+ );\r
+\r
+\r
+/**\r
+ Compares two Null-terminated ASCII strings, and returns the difference\r
+ between the first mismatched ASCII characters.\r
+\r
+ This function compares the Null-terminated ASCII string FirstString to the\r
+ Null-terminated ASCII string SecondString. If FirstString is identical to\r
+ SecondString, then 0 is returned. Otherwise, the value returned is the first\r
+ mismatched ASCII character in SecondString subtracted from the first\r
+ mismatched ASCII character in FirstString.\r
+\r
+ If FirstString is NULL, then ASSERT().\r
+ If SecondString is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r
+ than PcdMaximumAsciiStringLength ASCII characters not including the\r
+ Null-terminator, then ASSERT().\r
+\r
+ @param FirstString The pointer to a Null-terminated ASCII string.\r
+ @param SecondString The pointer to a Null-terminated ASCII string.\r
+\r
+ @retval ==0 FirstString is identical to SecondString.\r
+ @retval !=0 FirstString is not identical to SecondString.\r
+\r
+**/\r
+INTN\r
+EFIAPI\r
+AsciiStrCmp (\r
+ IN CONST CHAR8 *FirstString,\r
+ IN CONST CHAR8 *SecondString\r
+ );\r
+\r
+\r
+/**\r
+ Performs a case insensitive comparison of two Null-terminated ASCII strings,\r
+ and returns the difference between the first mismatched ASCII characters.\r
+\r
+ This function performs a case insensitive comparison of the Null-terminated\r
+ ASCII string FirstString to the Null-terminated ASCII string SecondString. If\r
+ FirstString is identical to SecondString, then 0 is returned. Otherwise, the\r
+ value returned is the first mismatched lower case ASCII character in\r
+ SecondString subtracted from the first mismatched lower case ASCII character\r
+ in FirstString.\r
+\r
+ If FirstString is NULL, then ASSERT().\r
+ If SecondString is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r
+ than PcdMaximumAsciiStringLength ASCII characters not including the\r
+ Null-terminator, then ASSERT().\r
+\r
+ @param FirstString The pointer to a Null-terminated ASCII string.\r
+ @param SecondString The pointer to a Null-terminated ASCII string.\r
+\r
+ @retval ==0 FirstString is identical to SecondString using case insensitive\r
+ comparisons.\r
+ @retval !=0 FirstString is not identical to SecondString using case\r
+ insensitive comparisons.\r
+\r
+**/\r
+INTN\r
+EFIAPI\r
+AsciiStriCmp (\r
+ IN CONST CHAR8 *FirstString,\r
+ IN CONST CHAR8 *SecondString\r
+ );\r
+\r
+\r
+/**\r
+ Compares two Null-terminated ASCII strings with maximum lengths, and returns\r
+ the difference between the first mismatched ASCII characters.\r
+\r
+ This function compares the Null-terminated ASCII string FirstString to the\r
+ Null-terminated ASCII string SecondString. At most, Length ASCII characters\r
+ will be compared. If Length is 0, then 0 is returned. If FirstString is\r
+ identical to SecondString, then 0 is returned. Otherwise, the value returned\r
+ is the first mismatched ASCII character in SecondString subtracted from the\r
+ first mismatched ASCII character in FirstString.\r
+\r
+ If Length > 0 and FirstString is NULL, then ASSERT().\r
+ If Length > 0 and SecondString is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and Length is greater than \r
+ PcdMaximumAsciiStringLength, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param FirstString The pointer to a Null-terminated ASCII string.\r
+ @param SecondString The pointer to a Null-terminated ASCII string.\r
+ @param Length The maximum number of ASCII characters for compare.\r
+ \r
+ @retval ==0 FirstString is identical to SecondString.\r
+ @retval !=0 FirstString is not identical to SecondString.\r
+\r
+**/\r
+INTN\r
+EFIAPI\r
+AsciiStrnCmp (\r
+ IN CONST CHAR8 *FirstString,\r
+ IN CONST CHAR8 *SecondString,\r
+ IN UINTN Length\r
+ );\r
+\r
+\r
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
+\r
+/**\r
+ [ATTENTION] This function is deprecated for security reason.\r
+\r
+ Concatenates one Null-terminated ASCII string to another Null-terminated\r
+ ASCII string, and returns the concatenated ASCII string.\r
+\r
+ This function concatenates two Null-terminated ASCII strings. The contents of\r
+ Null-terminated ASCII string Source are concatenated to the end of Null-\r
+ terminated ASCII string Destination. The Null-terminated concatenated ASCII\r
+ String is returned.\r
+\r
+ If Destination is NULL, then ASSERT().\r
+ If Source is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and Destination contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and Source contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero and concatenating Destination and\r
+ Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r
+ ASCII characters, then ASSERT().\r
+\r
+ @param Destination The pointer to a Null-terminated ASCII string.\r
+ @param Source The pointer to a Null-terminated ASCII string.\r
+\r
+ @return Destination\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+AsciiStrCat (\r
+ IN OUT CHAR8 *Destination,\r
+ IN CONST CHAR8 *Source\r
+ );\r
+\r
+\r
+/**\r
+ [ATTENTION] This function is deprecated for security reason.\r
+\r
+ Concatenates up to a specified length one Null-terminated ASCII string to \r
+ the end of another Null-terminated ASCII string, and returns the \r
+ concatenated ASCII string.\r
+\r
+ This function concatenates two Null-terminated ASCII strings. The contents\r
+ of Null-terminated ASCII string Source are concatenated to the end of Null-\r
+ terminated ASCII string Destination, and Destination is returned. At most,\r
+ Length ASCII characters are concatenated from Source to the end of\r
+ Destination, and Destination is always Null-terminated. If Length is 0, then\r
+ Destination is returned unmodified. If Source and Destination overlap, then\r
+ the results are undefined.\r
+\r
+ If Length > 0 and Destination is NULL, then ASSERT().\r
+ If Length > 0 and Source is NULL, then ASSERT().\r
+ If Source and Destination overlap, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and Length is greater than\r
+ PcdMaximumAsciiStringLength, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and Destination contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and\r
+ Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r
+ ASCII characters, not including the Null-terminator, then ASSERT().\r
+\r
+ @param Destination The pointer to a Null-terminated ASCII string.\r
+ @param Source The pointer to a Null-terminated ASCII string.\r
+ @param Length The maximum number of ASCII characters to concatenate from\r
+ Source.\r
+\r
+ @return Destination\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+AsciiStrnCat (\r
+ IN OUT CHAR8 *Destination,\r
+ IN CONST CHAR8 *Source,\r
+ IN UINTN Length\r
+ );\r
+#endif\r
+\r
+/**\r
+ Returns the first occurrence of a Null-terminated ASCII sub-string\r
+ in a Null-terminated ASCII string.\r
+\r
+ This function scans the contents of the ASCII string specified by String\r
+ and returns the first occurrence of SearchString. If SearchString is not\r
+ found in String, then NULL is returned. If the length of SearchString is zero,\r
+ then String is returned.\r
+\r
+ If String is NULL, then ASSERT().\r
+ If SearchString is NULL, then ASSERT().\r
+\r
+ If PcdMaximumAsciiStringLength is not zero, and SearchString or\r
+ String contains more than PcdMaximumAsciiStringLength Unicode characters\r
+ not including the Null-terminator, then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated ASCII string.\r
+ @param SearchString The pointer to a Null-terminated ASCII string to search for.\r
+\r
+ @retval NULL If the SearchString does not appear in String.\r
+ @retval others If there is a match return the first occurrence of SearchingString.\r
+ If the length of SearchString is zero,return String.\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+AsciiStrStr (\r
+ IN CONST CHAR8 *String,\r
+ IN CONST CHAR8 *SearchString\r
+ );\r
+\r
+\r
+/**\r
+ Convert a Null-terminated ASCII decimal string to a value of type\r
+ UINTN.\r
+\r
+ This function returns a value of type UINTN by interpreting the contents\r
+ of the ASCII string String as a decimal number. The format of the input\r
+ ASCII string String is:\r
+\r
+ [spaces] [decimal digits].\r
+\r
+ The valid decimal digit character is in the range [0-9]. The function will\r
+ ignore the pad space, which includes spaces or tab characters, before the digits.\r
+ The running zero in the beginning of [decimal digits] will be ignored. Then, the\r
+ function stops at the first character that is a not a valid decimal character or\r
+ Null-terminator, whichever on comes first.\r
+\r
+ If String has only pad spaces, then 0 is returned.\r
+ If String has no pad spaces or valid decimal digits, then 0 is returned.\r
+ If the number represented by String overflows according to the range defined by\r
+ UINTN, then MAX_UINTN is returned.\r
+ If String is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and String contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated ASCII string.\r
+\r
+ @retval The value translated from String.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+AsciiStrDecimalToUintn (\r
+ IN CONST CHAR8 *String\r
+ );\r
+\r
+\r
+/**\r
+ Convert a Null-terminated ASCII decimal string to a value of type\r
+ UINT64.\r
+\r
+ This function returns a value of type UINT64 by interpreting the contents\r
+ of the ASCII string String as a decimal number. The format of the input\r
+ ASCII string String is:\r
+\r
+ [spaces] [decimal digits].\r
+\r
+ The valid decimal digit character is in the range [0-9]. The function will\r
+ ignore the pad space, which includes spaces or tab characters, before the digits.\r
+ The running zero in the beginning of [decimal digits] will be ignored. Then, the\r
+ function stops at the first character that is a not a valid decimal character or\r
+ Null-terminator, whichever on comes first.\r
+\r
+ If String has only pad spaces, then 0 is returned.\r
+ If String has no pad spaces or valid decimal digits, then 0 is returned.\r
+ If the number represented by String overflows according to the range defined by\r
+ UINT64, then MAX_UINT64 is returned.\r
+ If String is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and String contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated ASCII string.\r
+\r
+ @retval Value translated from String.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsciiStrDecimalToUint64 (\r
+ IN CONST CHAR8 *String\r
+ );\r
+\r
+\r
+/**\r
+ Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.\r
+\r
+ This function returns a value of type UINTN by interpreting the contents of\r
+ the ASCII string String as a hexadecimal number. The format of the input ASCII\r
+ string String is:\r
+\r
+ [spaces][zeros][x][hexadecimal digits].\r
+\r
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r
+ appears in the input string, it must be prefixed with at least one 0. The function\r
+ will ignore the pad space, which includes spaces or tab characters, before [zeros],\r
+ [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r
+ will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r
+ digit. Then, the function stops at the first character that is a not a valid\r
+ hexadecimal character or Null-terminator, whichever on comes first.\r
+\r
+ If String has only pad spaces, then 0 is returned.\r
+ If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r
+ 0 is returned.\r
+\r
+ If the number represented by String overflows according to the range defined by UINTN,\r
+ then MAX_UINTN is returned.\r
+ If String is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero,\r
+ and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r
+ the Null-terminator, then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated ASCII string.\r
+\r
+ @retval Value translated from String.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+AsciiStrHexToUintn (\r
+ IN CONST CHAR8 *String\r
+ );\r
+\r
+\r
+/**\r
+ Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.\r
+\r
+ This function returns a value of type UINT64 by interpreting the contents of\r
+ the ASCII string String as a hexadecimal number. The format of the input ASCII\r
+ string String is:\r
+\r
+ [spaces][zeros][x][hexadecimal digits].\r
+\r
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r
+ appears in the input string, it must be prefixed with at least one 0. The function\r
+ will ignore the pad space, which includes spaces or tab characters, before [zeros],\r
+ [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r
+ will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r
+ digit. Then, the function stops at the first character that is a not a valid\r
+ hexadecimal character or Null-terminator, whichever on comes first.\r
+\r
+ If String has only pad spaces, then 0 is returned.\r
+ If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r
+ 0 is returned.\r
+\r
+ If the number represented by String overflows according to the range defined by UINT64,\r
+ then MAX_UINT64 is returned.\r
+ If String is NULL, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero,\r
+ and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r
+ the Null-terminator, then ASSERT().\r
+\r
+ @param String The pointer to a Null-terminated ASCII string.\r
+\r
+ @retval Value translated from String.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsciiStrHexToUint64 (\r
+ IN CONST CHAR8 *String\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated ASCII string to IPv6 address and prefix length.\r
+\r
+ This function outputs a value of type IPv6_ADDRESS and may output a value\r
+ of type UINT8 by interpreting the contents of the ASCII string specified\r
+ by String. The format of the input ASCII string String is as follows:\r
+\r
+ X:X:X:X:X:X:X:X[/P]\r
+\r
+ X contains one to four hexadecimal digit characters in the range [0-9], [a-f] and\r
+ [A-F]. X is converted to a value of type UINT16, whose low byte is stored in low\r
+ memory address and high byte is stored in high memory address. P contains decimal\r
+ digit characters in the range [0-9]. The running zero in the beginning of P will\r
+ be ignored. /P is optional.\r
+\r
+ When /P is not in the String, the function stops at the first character that is\r
+ not a valid hexadecimal digit character after eight X's are converted.\r
+\r
+ When /P is in the String, the function stops at the first character that is not\r
+ a valid decimal digit character after P is converted.\r
+\r
+ "::" can be used to compress one or more groups of X when X contains only 0.\r
+ The "::" can only appear once in the String.\r
+\r
+ If String is NULL, then ASSERT().\r
+\r
+ If Address is NULL, then ASSERT().\r
+\r
+ If EndPointer is not NULL and Address is translated from String, a pointer\r
+ to the character that stopped the scan is stored at the location pointed to\r
+ by EndPointer.\r
+\r
+ @param String Pointer to a Null-terminated ASCII string.\r
+ @param EndPointer Pointer to character that stops scan.\r
+ @param Address Pointer to the converted IPv6 address.\r
+ @param PrefixLength Pointer to the converted IPv6 address prefix\r
+ length. MAX_UINT8 is returned when /P is\r
+ not in the String.\r
+\r
+ @retval RETURN_SUCCESS Address is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ @retval RETURN_UNSUPPORTED If X contains more than four hexadecimal\r
+ digit characters.\r
+ If String contains "::" and number of X\r
+ is not less than 8.\r
+ If P starts with character that is not a\r
+ valid decimal digit character.\r
+ If the decimal number converted from P\r
+ exceeds 128.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+AsciiStrToIpv6Address (\r
+ IN CONST CHAR8 *String,\r
+ OUT CHAR8 **EndPointer, OPTIONAL\r
+ OUT IPv6_ADDRESS *Address,\r
+ OUT UINT8 *PrefixLength OPTIONAL\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated ASCII string to IPv4 address and prefix length.\r
+\r
+ This function outputs a value of type IPv4_ADDRESS and may output a value\r
+ of type UINT8 by interpreting the contents of the ASCII string specified\r
+ by String. The format of the input ASCII string String is as follows:\r
+\r
+ D.D.D.D[/P]\r
+\r
+ D and P are decimal digit characters in the range [0-9]. The running zero in\r
+ the beginning of D and P will be ignored. /P is optional.\r
+\r
+ When /P is not in the String, the function stops at the first character that is\r
+ not a valid decimal digit character after four D's are converted.\r
+\r
+ When /P is in the String, the function stops at the first character that is not\r
+ a valid decimal digit character after P is converted.\r
+\r
+ If String is NULL, then ASSERT().\r
+\r
+ If Address is NULL, then ASSERT().\r
+\r
+ If EndPointer is not NULL and Address is translated from String, a pointer\r
+ to the character that stopped the scan is stored at the location pointed to\r
+ by EndPointer.\r
+\r
+ @param String Pointer to a Null-terminated ASCII string.\r
+ @param EndPointer Pointer to character that stops scan.\r
+ @param Address Pointer to the converted IPv4 address.\r
+ @param PrefixLength Pointer to the converted IPv4 address prefix\r
+ length. MAX_UINT8 is returned when /P is\r
+ not in the String.\r
+\r
+ @retval RETURN_SUCCESS Address is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ @retval RETURN_UNSUPPORTED If String is not in the correct format.\r
+ If any decimal number converted from D\r
+ exceeds 255.\r
+ If the decimal number converted from P\r
+ exceeds 32.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+AsciiStrToIpv4Address (\r
+ IN CONST CHAR8 *String,\r
+ OUT CHAR8 **EndPointer, OPTIONAL\r
+ OUT IPv4_ADDRESS *Address,\r
+ OUT UINT8 *PrefixLength OPTIONAL\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated ASCII GUID string to a value of type\r
+ EFI_GUID.\r
+\r
+ This function outputs a GUID value by interpreting the contents of\r
+ the ASCII string specified by String. The format of the input\r
+ ASCII string String consists of 36 characters, as follows:\r
+\r
+ aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\r
+\r
+ The pairs aa - pp are two characters in the range [0-9], [a-f] and\r
+ [A-F], with each pair representing a single byte hexadecimal value.\r
+\r
+ The mapping between String and the EFI_GUID structure is as follows:\r
+ aa Data1[24:31]\r
+ bb Data1[16:23]\r
+ cc Data1[8:15]\r
+ dd Data1[0:7]\r
+ ee Data2[8:15]\r
+ ff Data2[0:7]\r
+ gg Data3[8:15]\r
+ hh Data3[0:7]\r
+ ii Data4[0:7]\r
+ jj Data4[8:15]\r
+ kk Data4[16:23]\r
+ ll Data4[24:31]\r
+ mm Data4[32:39]\r
+ nn Data4[40:47]\r
+ oo Data4[48:55]\r
+ pp Data4[56:63]\r
+\r
+ If String is NULL, then ASSERT().\r
+ If Guid is NULL, then ASSERT().\r
+\r
+ @param String Pointer to a Null-terminated ASCII string.\r
+ @param Guid Pointer to the converted GUID.\r
+\r
+ @retval RETURN_SUCCESS Guid is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ @retval RETURN_UNSUPPORTED If String is not as the above format.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+AsciiStrToGuid (\r
+ IN CONST CHAR8 *String,\r
+ OUT GUID *Guid\r
+ );\r
+\r
+/**\r
+ Convert a Null-terminated ASCII hexadecimal string to a byte array.\r
+\r
+ This function outputs a byte array by interpreting the contents of\r
+ the ASCII string specified by String in hexadecimal format. The format of\r
+ the input ASCII string String is:\r
+\r
+ [XX]*\r
+\r
+ X is a hexadecimal digit character in the range [0-9], [a-f] and [A-F].\r
+ The function decodes every two hexadecimal digit characters as one byte. The\r
+ decoding stops after Length of characters and outputs Buffer containing\r
+ (Length / 2) bytes.\r
+\r
+ If String is NULL, then ASSERT().\r
+\r
+ If Buffer is NULL, then ASSERT().\r
+\r
+ If Length is not multiple of 2, then ASSERT().\r
+\r
+ If PcdMaximumAsciiStringLength is not zero and Length is greater than\r
+ PcdMaximumAsciiStringLength, then ASSERT().\r
+\r
+ If MaxBufferSize is less than (Length / 2), then ASSERT().\r
+\r
+ @param String Pointer to a Null-terminated ASCII string.\r
+ @param Length The number of ASCII characters to decode.\r
+ @param Buffer Pointer to the converted bytes array.\r
+ @param MaxBufferSize The maximum size of Buffer.\r
+\r
+ @retval RETURN_SUCCESS Buffer is translated from String.\r
+ @retval RETURN_INVALID_PARAMETER If String is NULL.\r
+ If Data is NULL.\r
+ If Length is not multiple of 2.\r
+ If PcdMaximumAsciiStringLength is not zero,\r
+ and Length is greater than\r
+ PcdMaximumAsciiStringLength.\r
+ @retval RETURN_UNSUPPORTED If Length of characters from String contain\r
+ a character that is not valid hexadecimal\r
+ digit characters, or a Null-terminator.\r
+ @retval RETURN_BUFFER_TOO_SMALL If MaxBufferSize is less than (Length / 2).\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+AsciiStrHexToBytes (\r
+ IN CONST CHAR8 *String,\r
+ IN UINTN Length,\r
+ OUT UINT8 *Buffer,\r
+ IN UINTN MaxBufferSize\r
+ );\r
+\r
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
+\r
+/**\r
+ [ATTENTION] This function is deprecated for security reason.\r
+\r
+ Convert one Null-terminated ASCII string to a Null-terminated\r
+ Unicode string and returns the Unicode string.\r
+\r
+ This function converts the contents of the ASCII string Source to the Unicode\r
+ string Destination, and returns Destination. The function terminates the\r
+ Unicode string Destination by appending a Null-terminator character at the end.\r
+ The caller is responsible to make sure Destination points to a buffer with size\r
+ equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.\r
+\r
+ If Destination is NULL, then ASSERT().\r
+ If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
+ If Source is NULL, then ASSERT().\r
+ If Source and Destination overlap, then ASSERT().\r
+ If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r
+ then ASSERT().\r
+ If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r
+ PcdMaximumUnicodeStringLength ASCII characters not including the\r
+ Null-terminator, then ASSERT().\r
+\r
+ @param Source The pointer to a Null-terminated ASCII string.\r
+ @param Destination The pointer to a Null-terminated Unicode string.\r
+\r
+ @return Destination.\r
+\r
+**/\r
+CHAR16 *\r
+EFIAPI\r
+AsciiStrToUnicodeStr (\r
+ IN CONST CHAR8 *Source,\r
+ OUT CHAR16 *Destination\r
+ );\r
+\r
+#endif\r
+\r
+/**\r
+ Convert one Null-terminated ASCII string to a Null-terminated\r
+ Unicode string.\r
+\r
+ This function is similar to StrCpyS.\r
+\r
+ This function converts the contents of the ASCII string Source to the Unicode\r
+ string Destination. The function terminates the Unicode string Destination by\r
+ appending a Null-terminator character at the end.\r
+\r
+ The caller is responsible to make sure Destination points to a buffer with size\r
+ equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.\r
+\r
+ If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
+ If an error would be returned, then the function will also ASSERT().\r
+\r
+ If an error is returned, then the Destination is unmodified.\r
+\r
+ @param Source The pointer to a Null-terminated ASCII string.\r
+ @param Destination The pointer to a Null-terminated Unicode string.\r
+ @param DestMax The maximum number of Destination Unicode\r
+ char, including terminating null char.\r
+\r
+ @retval RETURN_SUCCESS String is converted.\r
+ @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).\r
+ @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r
+ If Source is NULL.\r
+ If PcdMaximumUnicodeStringLength is not zero,\r
+ and DestMax is greater than\r
+ PcdMaximumUnicodeStringLength.\r
+ If PcdMaximumAsciiStringLength is not zero,\r
+ and DestMax is greater than\r
+ PcdMaximumAsciiStringLength.\r
+ If DestMax is 0.\r
+ @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+AsciiStrToUnicodeStrS (\r
+ IN CONST CHAR8 *Source,\r
+ OUT CHAR16 *Destination,\r
+ IN UINTN DestMax\r
+ );\r
+\r
+/**\r
+ Convert not more than Length successive characters from a Null-terminated\r
+ Ascii string to a Null-terminated Unicode string. If no null char is copied\r
+ from Source, then Destination[Length] is always set to null.\r
+\r
+ This function converts not more than Length successive characters from the\r
+ Ascii string Source to the Unicode string Destination. The function\r
+ terminates the Unicode string Destination by appending a Null-terminator\r
+ character at the end.\r
+\r
+ The caller is responsible to make sure Destination points to a buffer with\r
+ size not smaller than\r
+ ((MIN(AsciiStrLen(Source), Length) + 1) * sizeof (CHAR8)) in bytes.\r
+\r
+ If Destination is not aligned on a 16-bit boundary, then ASSERT().\r
+ If an error would be returned, then the function will also ASSERT().\r
+\r
+ If an error is returned, then Destination and DestinationLength are\r
+ unmodified.\r
+\r
+ @param Source The pointer to a Null-terminated Ascii string.\r
+ @param Length The maximum number of Ascii characters to convert.\r
+ @param Destination The pointer to a Null-terminated Unicode string.\r
+ @param DestMax The maximum number of Destination Unicode char,\r
+ including terminating null char.\r
+ @param DestinationLength The number of Ascii characters converted.\r
+\r
+ @retval RETURN_SUCCESS String is converted.\r
+ @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r
+ If Source is NULL.\r
+ If DestinationLength is NULL.\r
+ If PcdMaximumUnicodeStringLength is not\r
+ zero, and Length or DestMax is greater than\r
+ PcdMaximumUnicodeStringLength.\r
+ If PcdMaximumAsciiStringLength is not zero,\r
+ and Length or DestMax is greater than\r
+ PcdMaximumAsciiStringLength.\r
+ If DestMax is 0.\r
+ @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than\r
+ MIN(AsciiStrLen(Source), Length).\r
+ @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+AsciiStrnToUnicodeStrS (\r
+ IN CONST CHAR8 *Source,\r
+ IN UINTN Length,\r
+ OUT CHAR16 *Destination,\r
+ IN UINTN DestMax,\r
+ OUT UINTN *DestinationLength\r
+ );\r
+\r
+/**\r
+ Converts an 8-bit value to an 8-bit BCD value.\r
+\r
+ Converts the 8-bit value specified by Value to BCD. The BCD value is\r
+ returned.\r
+\r
+ If Value >= 100, then ASSERT().\r
+\r
+ @param Value The 8-bit value to convert to BCD. Range 0..99.\r
+\r
+ @return The BCD value.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+DecimalToBcd8 (\r
+ IN UINT8 Value\r
+ );\r
+\r
+\r
+/**\r
+ Converts an 8-bit BCD value to an 8-bit value.\r
+\r
+ Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit\r
+ value is returned.\r
+\r
+ If Value >= 0xA0, then ASSERT().\r
+ If (Value & 0x0F) >= 0x0A, then ASSERT().\r
+\r
+ @param Value The 8-bit BCD value to convert to an 8-bit value.\r
+\r
+ @return The 8-bit value is returned.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+BcdToDecimal8 (\r
+ IN UINT8 Value\r
+ );\r
+\r
+//\r
+// File Path Manipulation Functions\r
+//\r
+\r
+/**\r
+ Removes the last directory or file entry in a path.\r
+\r
+ @param[in, out] Path The pointer to the path to modify.\r
+\r
+ @retval FALSE Nothing was found to remove.\r
+ @retval TRUE A directory or file was removed.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+PathRemoveLastItem(\r
+ IN OUT CHAR16 *Path\r
+ );\r
+\r
+/**\r
+ Function to clean up paths.\r
+ - Single periods in the path are removed.\r
+ - Double periods in the path are removed along with a single parent directory.\r
+ - Forward slashes L'/' are converted to backward slashes L'\'.\r
+\r
+ This will be done inline and the existing buffer may be larger than required\r
+ upon completion.\r
+\r
+ @param[in] Path The pointer to the string containing the path.\r
+\r
+ @return Returns Path, otherwise returns NULL to indicate that an error has occurred.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+PathCleanUpDirectories(\r
+ IN CHAR16 *Path\r
+ );\r
+\r
+//\r
+// Linked List Functions and Macros\r
+//\r
+\r
+/**\r
+ Initializes the head node of a doubly linked list that is declared as a\r
+ global variable in a module.\r
+\r
+ Initializes the forward and backward links of a new linked list. After\r
+ initializing a linked list with this macro, the other linked list functions\r
+ may be used to add and remove nodes from the linked list. This macro results\r
+ in smaller executables by initializing the linked list in the data section,\r
+ instead if calling the InitializeListHead() function to perform the\r
+ equivalent operation.\r
+\r
+ @param ListHead The head note of a list to initialize.\r
+\r
+**/\r
+#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}\r
+\r
+\r
+/**\r
+ Checks whether FirstEntry and SecondEntry are part of the same doubly-linked\r
+ list.\r
+\r
+ If FirstEntry is NULL, then ASSERT().\r
+ If FirstEntry->ForwardLink is NULL, then ASSERT().\r
+ If FirstEntry->BackLink is NULL, then ASSERT().\r
+ If SecondEntry is NULL, then ASSERT();\r
+ If PcdMaximumLinkedListLength is not zero, and List contains more than\r
+ PcdMaximumLinkedListLength nodes, then ASSERT().\r
+\r
+ @param FirstEntry A pointer to a node in a linked list.\r
+ @param SecondEntry A pointer to the node to locate.\r
+\r
+ @retval TRUE SecondEntry is in the same doubly-linked list as FirstEntry.\r
+ @retval FALSE SecondEntry isn't in the same doubly-linked list as FirstEntry,\r
+ or FirstEntry is invalid.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsNodeInList (\r
+ IN CONST LIST_ENTRY *FirstEntry,\r
+ IN CONST LIST_ENTRY *SecondEntry\r
+ );\r
+\r
+\r
+/**\r
+ Initializes the head node of a doubly linked list, and returns the pointer to\r
+ the head node of the doubly linked list.\r
+\r
+ Initializes the forward and backward links of a new linked list. After\r
+ initializing a linked list with this function, the other linked list\r
+ functions may be used to add and remove nodes from the linked list. It is up\r
+ to the caller of this function to allocate the memory for ListHead.\r
+\r
+ If ListHead is NULL, then ASSERT().\r
+\r
+ @param ListHead A pointer to the head node of a new doubly linked list.\r
+\r
+ @return ListHead\r
+\r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+InitializeListHead (\r
+ IN OUT LIST_ENTRY *ListHead\r
+ );\r
+\r
+\r
+/**\r
+ Adds a node to the beginning of a doubly linked list, and returns the pointer\r
+ to the head node of the doubly linked list.\r
+\r
+ Adds the node Entry at the beginning of the doubly linked list denoted by\r
+ ListHead, and returns ListHead.\r
+\r
+ If ListHead is NULL, then ASSERT().\r
+ If Entry is NULL, then ASSERT().\r
+ If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r
+ InitializeListHead(), then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and prior to insertion the number\r
+ of nodes in ListHead, including the ListHead node, is greater than or\r
+ equal to PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+ @param ListHead A pointer to the head node of a doubly linked list.\r
+ @param Entry A pointer to a node that is to be inserted at the beginning\r
+ of a doubly linked list.\r
+\r
+ @return ListHead\r
+\r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+InsertHeadList (\r
+ IN OUT LIST_ENTRY *ListHead,\r
+ IN OUT LIST_ENTRY *Entry\r
+ );\r
+\r
+\r
+/**\r
+ Adds a node to the end of a doubly linked list, and returns the pointer to\r
+ the head node of the doubly linked list.\r
+\r
+ Adds the node Entry to the end of the doubly linked list denoted by ListHead,\r
+ and returns ListHead.\r
+\r
+ If ListHead is NULL, then ASSERT().\r
+ If Entry is NULL, then ASSERT().\r
+ If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r
+ InitializeListHead(), then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and prior to insertion the number\r
+ of nodes in ListHead, including the ListHead node, is greater than or\r
+ equal to PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+ @param ListHead A pointer to the head node of a doubly linked list.\r
+ @param Entry A pointer to a node that is to be added at the end of the\r
+ doubly linked list.\r
+\r
+ @return ListHead\r
+\r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+InsertTailList (\r
+ IN OUT LIST_ENTRY *ListHead,\r
+ IN OUT LIST_ENTRY *Entry\r
+ );\r
+\r
+\r
+/**\r
+ Retrieves the first node of a doubly linked list.\r
+\r
+ Returns the first node of a doubly linked list. List must have been \r
+ initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r
+ If List is empty, then List is returned.\r
+\r
+ If List is NULL, then ASSERT().\r
+ If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r
+ InitializeListHead(), then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes\r
+ in List, including the List node, is greater than or equal to\r
+ PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+ @param List A pointer to the head node of a doubly linked list.\r
+\r
+ @return The first node of a doubly linked list.\r
+ @retval List The list is empty.\r
+\r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+GetFirstNode (\r
+ IN CONST LIST_ENTRY *List\r
+ );\r
+\r
+\r
+/**\r
+ Retrieves the next node of a doubly linked list.\r
+\r
+ Returns the node of a doubly linked list that follows Node. \r
+ List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()\r
+ or InitializeListHead(). If List is empty, then List is returned.\r
+\r
+ If List is NULL, then ASSERT().\r
+ If Node is NULL, then ASSERT().\r
+ If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r
+ InitializeListHead(), then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and List contains more than\r
+ PcdMaximumLinkedListLength nodes, then ASSERT().\r
+ If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r
+\r
+ @param List A pointer to the head node of a doubly linked list.\r
+ @param Node A pointer to a node in the doubly linked list.\r
+\r
+ @return The pointer to the next node if one exists. Otherwise List is returned.\r
+\r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+GetNextNode (\r
+ IN CONST LIST_ENTRY *List,\r
+ IN CONST LIST_ENTRY *Node\r
+ );\r
+\r
+ \r
+/**\r
+ Retrieves the previous node of a doubly linked list.\r
+ \r
+ Returns the node of a doubly linked list that precedes Node. \r
+ List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()\r
+ or InitializeListHead(). If List is empty, then List is returned.\r
+ \r
+ If List is NULL, then ASSERT().\r
+ If Node is NULL, then ASSERT().\r
+ If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r
+ InitializeListHead(), then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and List contains more than\r
+ PcdMaximumLinkedListLength nodes, then ASSERT().\r
+ If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r
+ \r
+ @param List A pointer to the head node of a doubly linked list.\r
+ @param Node A pointer to a node in the doubly linked list.\r
+ \r
+ @return The pointer to the previous node if one exists. Otherwise List is returned.\r
+ \r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+GetPreviousNode (\r
+ IN CONST LIST_ENTRY *List,\r
+ IN CONST LIST_ENTRY *Node\r
+ );\r
+\r
+ \r
+/**\r
+ Checks to see if a doubly linked list is empty or not.\r
+\r
+ Checks to see if the doubly linked list is empty. If the linked list contains\r
+ zero nodes, this function returns TRUE. Otherwise, it returns FALSE.\r
+\r
+ If ListHead is NULL, then ASSERT().\r
+ If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r
+ InitializeListHead(), then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes\r
+ in List, including the List node, is greater than or equal to\r
+ PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+ @param ListHead A pointer to the head node of a doubly linked list.\r
+\r
+ @retval TRUE The linked list is empty.\r
+ @retval FALSE The linked list is not empty.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsListEmpty (\r
+ IN CONST LIST_ENTRY *ListHead\r
+ );\r
+\r
+\r
+/**\r
+ Determines if a node in a doubly linked list is the head node of a the same\r
+ doubly linked list. This function is typically used to terminate a loop that\r
+ traverses all the nodes in a doubly linked list starting with the head node.\r
+\r
+ Returns TRUE if Node is equal to List. Returns FALSE if Node is one of the\r
+ nodes in the doubly linked list specified by List. List must have been\r
+ initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r
+\r
+ If List is NULL, then ASSERT().\r
+ If Node is NULL, then ASSERT().\r
+ If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), \r
+ then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes\r
+ in List, including the List node, is greater than or equal to\r
+ PcdMaximumLinkedListLength, then ASSERT().\r
+ If PcdVerifyNodeInList is TRUE and Node is not a node in List the and Node is not equal \r
+ to List, then ASSERT().\r
+\r
+ @param List A pointer to the head node of a doubly linked list.\r
+ @param Node A pointer to a node in the doubly linked list.\r
+\r
+ @retval TRUE Node is the head of the doubly-linked list pointed by List.\r
+ @retval FALSE Node is not the head of the doubly-linked list pointed by List.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsNull (\r
+ IN CONST LIST_ENTRY *List,\r
+ IN CONST LIST_ENTRY *Node\r
+ );\r
+\r
+\r
+/**\r
+ Determines if a node the last node in a doubly linked list.\r
+\r
+ Returns TRUE if Node is the last node in the doubly linked list specified by\r
+ List. Otherwise, FALSE is returned. List must have been initialized with\r
+ INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r
+\r
+ If List is NULL, then ASSERT().\r
+ If Node is NULL, then ASSERT().\r
+ If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r
+ InitializeListHead(), then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes\r
+ in List, including the List node, is greater than or equal to\r
+ PcdMaximumLinkedListLength, then ASSERT().\r
+ If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r
+\r
+ @param List A pointer to the head node of a doubly linked list.\r
+ @param Node A pointer to a node in the doubly linked list.\r
+\r
+ @retval TRUE Node is the last node in the linked list.\r
+ @retval FALSE Node is not the last node in the linked list.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsNodeAtEnd (\r
+ IN CONST LIST_ENTRY *List,\r
+ IN CONST LIST_ENTRY *Node\r
+ );\r
+\r
+\r
+/**\r
+ Swaps the location of two nodes in a doubly linked list, and returns the\r
+ first node after the swap.\r
+\r
+ If FirstEntry is identical to SecondEntry, then SecondEntry is returned.\r
+ Otherwise, the location of the FirstEntry node is swapped with the location\r
+ of the SecondEntry node in a doubly linked list. SecondEntry must be in the\r
+ same double linked list as FirstEntry and that double linked list must have\r
+ been initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). \r
+ SecondEntry is returned after the nodes are swapped.\r
+\r
+ If FirstEntry is NULL, then ASSERT().\r
+ If SecondEntry is NULL, then ASSERT().\r
+ If PcdVerifyNodeInList is TRUE and SecondEntry and FirstEntry are not in the \r
+ same linked list, then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r
+ linked list containing the FirstEntry and SecondEntry nodes, including\r
+ the FirstEntry and SecondEntry nodes, is greater than or equal to\r
+ PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+ @param FirstEntry A pointer to a node in a linked list.\r
+ @param SecondEntry A pointer to another node in the same linked list.\r
+ \r
+ @return SecondEntry.\r
+\r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+SwapListEntries (\r
+ IN OUT LIST_ENTRY *FirstEntry,\r
+ IN OUT LIST_ENTRY *SecondEntry\r
+ );\r
+\r
+\r
+/**\r
+ Removes a node from a doubly linked list, and returns the node that follows\r
+ the removed node.\r
+\r
+ Removes the node Entry from a doubly linked list. It is up to the caller of\r
+ this function to release the memory used by this node if that is required. On\r
+ exit, the node following Entry in the doubly linked list is returned. If\r
+ Entry is the only node in the linked list, then the head node of the linked\r
+ list is returned.\r
+\r
+ If Entry is NULL, then ASSERT().\r
+ If Entry is the head node of an empty list, then ASSERT().\r
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r
+ linked list containing Entry, including the Entry node, is greater than\r
+ or equal to PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+ @param Entry A pointer to a node in a linked list.\r
+\r
+ @return Entry.\r
+\r
+**/\r
+LIST_ENTRY *\r
+EFIAPI\r
+RemoveEntryList (\r
+ IN CONST LIST_ENTRY *Entry\r
+ );\r
+\r
+//\r
+// Math Services\r
+//\r
+\r
+/**\r
+ Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled\r
+ with zeros. The shifted value is returned.\r
+\r
+ This function shifts the 64-bit value Operand to the left by Count bits. The\r
+ low Count bits are set to zero. The shifted value is returned.\r
+\r
+ If Count is greater than 63, then ASSERT().\r
+\r
+ @param Operand The 64-bit operand to shift left.\r
+ @param Count The number of bits to shift left.\r
+\r
+ @return Operand << Count.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+LShiftU64 (\r
+ IN UINT64 Operand,\r
+ IN UINTN Count\r
+ );\r
+\r
+\r
+/**\r
+ Shifts a 64-bit integer right between 0 and 63 bits. This high bits are\r
+ filled with zeros. The shifted value is returned.\r
+\r
+ This function shifts the 64-bit value Operand to the right by Count bits. The\r
+ high Count bits are set to zero. The shifted value is returned.\r
+\r
+ If Count is greater than 63, then ASSERT().\r
+\r
+ @param Operand The 64-bit operand to shift right.\r
+ @param Count The number of bits to shift right.\r
+\r
+ @return Operand >> Count\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+RShiftU64 (\r
+ IN UINT64 Operand,\r
+ IN UINTN Count\r
+ );\r
+\r
+\r
+/**\r
+ Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled\r
+ with original integer's bit 63. The shifted value is returned.\r
+\r
+ This function shifts the 64-bit value Operand to the right by Count bits. The\r
+ high Count bits are set to bit 63 of Operand. The shifted value is returned.\r
+\r
+ If Count is greater than 63, then ASSERT().\r
+\r
+ @param Operand The 64-bit operand to shift right.\r
+ @param Count The number of bits to shift right.\r
+\r
+ @return Operand >> Count\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+ARShiftU64 (\r
+ IN UINT64 Operand,\r
+ IN UINTN Count\r
+ );\r
+\r
+\r
+/**\r
+ Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits\r
+ with the high bits that were rotated.\r
+\r
+ This function rotates the 32-bit value Operand to the left by Count bits. The\r
+ low Count bits are fill with the high Count bits of Operand. The rotated\r
+ value is returned.\r
+\r
+ If Count is greater than 31, then ASSERT().\r