2 This library contains functions to do IFR opcode creation and utility functions
3 to help module to interact with a UEFI Form Browser.
5 Copyright (c) 2007 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _IFR_SUPPORT_LIBRARY_H_
17 #define _IFR_SUPPORT_LIBRARY_H_
21 EFI_STRING_ID StringToken
;
22 EFI_IFR_TYPE_VALUE Value
;
29 /// Buffer size allocated for Data.
34 /// Offset in Data to append the newly created opcode binary.
35 /// It will be adjusted automatically in Create***OpCode(), and should be
36 /// initialized to 0 before invocation of a serial of Create***OpCode()
41 /// The destination buffer for created op-codes
44 } EFI_HII_UPDATE_DATA
;
48 Create EFI_IFR_END_OP opcode.
50 If Data is NULL or Data->Data is NULL, then ASSERT.
52 @param Data Destination for the created opcode binary
54 @retval EFI_SUCCESS Opcode is created successfully.
55 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
61 IN OUT EFI_HII_UPDATE_DATA
*Data
66 Create EFI_IFR_DEFAULT_OP opcode.
68 If Data is NULL or Data->Data is NULL, then ASSERT.
70 @param Value Value for the default
71 @param Type Type for the default
72 @param Data Destination for the created opcode binary
74 @retval EFI_SUCCESS Opcode is created successfully.
75 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
76 @retval EFI_INVALID_PARAMETER The type is not valid.
82 IN EFI_IFR_TYPE_VALUE
*Value
,
84 IN OUT EFI_HII_UPDATE_DATA
*Data
89 Create EFI_IFR_ACTION_OP opcode.
91 If Data is NULL or Data->Data is NULL, then ASSERT.
93 @param QuestionId Question ID
94 @param Prompt String ID for Prompt
95 @param Help String ID for Help
96 @param QuestionFlags Flags in Question Header
97 @param QuestionConfig String ID for configuration
98 @param Data Destination for the created opcode binary
100 @retval EFI_SUCCESS Opcode is created successfully.
101 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
102 @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
108 IN EFI_QUESTION_ID QuestionId
,
109 IN EFI_STRING_ID Prompt
,
110 IN EFI_STRING_ID Help
,
111 IN UINT8 QuestionFlags
,
112 IN EFI_STRING_ID QuestionConfig
,
113 IN OUT EFI_HII_UPDATE_DATA
*Data
118 Create EFI_IFR_SUBTITLE_OP opcode.
120 If Data is NULL or Data->Data is NULL, then ASSERT.
122 @param Prompt String ID for Prompt
123 @param Help String ID for Help
124 @param Flags Subtitle opcode flags
125 @param Scope Subtitle Scope bit
126 @param Data Destination for the created opcode binary
128 @retval EFI_SUCCESS Opcode is created successfully.
129 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
134 CreateSubTitleOpCode (
135 IN EFI_STRING_ID Prompt
,
136 IN EFI_STRING_ID Help
,
139 IN OUT EFI_HII_UPDATE_DATA
*Data
144 Create EFI_IFR_TEXT_OP opcode.
146 If Data is NULL or Data->Data is NULL, then ASSERT.
148 @param Prompt String ID for Prompt
149 @param Help String ID for Help
150 @param TextTwo String ID for text two
151 @param Data Destination for the created opcode binary
153 @retval EFI_SUCCESS Opcode is created successfully.
154 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
160 IN EFI_STRING_ID Prompt
,
161 IN EFI_STRING_ID Help
,
162 IN EFI_STRING_ID TextTwo
,
163 IN OUT EFI_HII_UPDATE_DATA
*Data
168 Create EFI_IFR_REF_OP opcode.
170 If Data is NULL or Data->Data is NULL, then ASSERT.
172 @param FormId Destination Form ID
173 @param Prompt String ID for Prompt
174 @param Help String ID for Help
175 @param QuestionFlags Flags in Question Header
176 @param QuestionId Question ID
177 @param Data Destination for the created opcode binary
179 @retval EFI_SUCCESS Opcode is created successfully.
180 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
181 @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
187 IN EFI_FORM_ID FormId
,
188 IN EFI_STRING_ID Prompt
,
189 IN EFI_STRING_ID Help
,
190 IN UINT8 QuestionFlags
,
191 IN EFI_QUESTION_ID QuestionId
,
192 IN OUT EFI_HII_UPDATE_DATA
*Data
197 Create EFI_IFR_ONE_OF_OPTION_OP opcode.
199 If Data is NULL or Data->Data is NULL, then ASSERT.
201 @param OptionCount The number of options.
202 @param OptionsList The list of Options.
203 @param Type The data type.
204 @param Data Destination for the created opcode binary
206 @retval EFI_SUCCESS Opcode is created successfully.
207 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
208 @retval EFI_INVALID_PARAMETER If OptionCount is not zero but OptionsList is NULL.
213 CreateOneOfOptionOpCode (
214 IN UINTN OptionCount
,
215 IN IFR_OPTION
*OptionsList
,
217 IN OUT EFI_HII_UPDATE_DATA
*Data
222 Create EFI_IFR_ONE_OF_OP opcode.
224 If Data is NULL or Data->Data is NULL, then ASSERT.
226 @param QuestionId Question ID
227 @param VarStoreId Storage ID
228 @param VarOffset Offset in Storage
229 @param Prompt String ID for Prompt
230 @param Help String ID for Help
231 @param QuestionFlags Flags in Question Header
232 @param OneOfFlags Flags for oneof opcode
233 @param OptionsList List of options
234 @param OptionCount Number of options in option list
235 @param Data Destination for the created opcode binary
237 @retval EFI_SUCCESS Opcode is created successfully.
238 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
239 @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
245 IN EFI_QUESTION_ID QuestionId
,
246 IN EFI_VARSTORE_ID VarStoreId
,
248 IN EFI_STRING_ID Prompt
,
249 IN EFI_STRING_ID Help
,
250 IN UINT8 QuestionFlags
,
252 IN IFR_OPTION
*OptionsList
,
253 IN UINTN OptionCount
,
254 IN OUT EFI_HII_UPDATE_DATA
*Data
259 Create EFI_IFR_ORDERED_LIST_OP opcode.
261 If Data is NULL or Data->Data is NULL, then ASSERT.
263 @param QuestionId Question ID
264 @param VarStoreId Storage ID
265 @param VarOffset Offset in Storage
266 @param Prompt String ID for Prompt
267 @param Help String ID for Help
268 @param QuestionFlags Flags in Question Header
269 @param OrderedListFlags Flags for ordered list opcode
270 @param DataType Type for option value
271 @param MaxContainers Maximum count for options in this ordered list
272 @param OptionsList List of options
273 @param OptionCount Number of options in option list
274 @param Data Destination for the created opcode binary
276 @retval EFI_SUCCESS Opcode is created successfully.
277 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
278 @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
283 CreateOrderedListOpCode (
284 IN EFI_QUESTION_ID QuestionId
,
285 IN EFI_VARSTORE_ID VarStoreId
,
287 IN EFI_STRING_ID Prompt
,
288 IN EFI_STRING_ID Help
,
289 IN UINT8 QuestionFlags
,
290 IN UINT8 OrderedListFlags
,
292 IN UINT8 MaxContainers
,
293 IN IFR_OPTION
*OptionsList
,
294 IN UINTN OptionCount
,
295 IN OUT EFI_HII_UPDATE_DATA
*Data
300 Create EFI_IFR_CHECKBOX_OP opcode.
302 If Data is NULL or Data->Data is NULL, then ASSERT.
304 @param QuestionId Question ID
305 @param VarStoreId Storage ID
306 @param VarOffset Offset in Storage
307 @param Prompt String ID for Prompt
308 @param Help String ID for Help
309 @param QuestionFlags Flags in Question Header
310 @param CheckBoxFlags Flags for checkbox opcode
311 @param Data Destination for the created opcode binary
313 @retval EFI_SUCCESS Opcode is created successfully.
314 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
315 @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
320 CreateCheckBoxOpCode (
321 IN EFI_QUESTION_ID QuestionId
,
322 IN EFI_VARSTORE_ID VarStoreId
,
324 IN EFI_STRING_ID Prompt
,
325 IN EFI_STRING_ID Help
,
326 IN UINT8 QuestionFlags
,
327 IN UINT8 CheckBoxFlags
,
328 IN OUT EFI_HII_UPDATE_DATA
*Data
333 Create EFI_IFR_NUMERIC_OP opcode.
335 If Data is NULL or Data->Data is NULL, then ASSERT.
337 @param QuestionId Question ID
338 @param VarStoreId Storage ID
339 @param VarOffset Offset in Storage
340 @param Prompt String ID for Prompt
341 @param Help String ID for Help
342 @param QuestionFlags Flags in Question Header
343 @param NumericFlags Flags for numeric opcode
344 @param Minimum Numeric minimum value
345 @param Maximum Numeric maximum value
346 @param Step Numeric step for edit
347 @param Default Numeric default value
348 @param Data Destination for the created opcode binary
350 @retval EFI_SUCCESS Opcode is created successfully.
351 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
352 @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
357 CreateNumericOpCode (
358 IN EFI_QUESTION_ID QuestionId
,
359 IN EFI_VARSTORE_ID VarStoreId
,
361 IN EFI_STRING_ID Prompt
,
362 IN EFI_STRING_ID Help
,
363 IN UINT8 QuestionFlags
,
364 IN UINT8 NumericFlags
,
369 IN OUT EFI_HII_UPDATE_DATA
*Data
374 Create EFI_IFR_STRING_OP opcode.
376 If Data is NULL or Data->Data is NULL, then ASSERT.
378 @param QuestionId Question ID
379 @param VarStoreId Storage ID
380 @param VarOffset Offset in Storage
381 @param Prompt String ID for Prompt
382 @param Help String ID for Help
383 @param QuestionFlags Flags in Question Header
384 @param StringFlags Flags for string opcode
385 @param MinSize String minimum length
386 @param MaxSize String maximum length
387 @param Data Destination for the created opcode binary
389 @retval EFI_SUCCESS Opcode is created successfully.
390 @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
391 @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
397 IN EFI_QUESTION_ID QuestionId
,
398 IN EFI_VARSTORE_ID VarStoreId
,
400 IN EFI_STRING_ID Prompt
,
401 IN EFI_STRING_ID Help
,
402 IN UINT8 QuestionFlags
,
403 IN UINT8 StringFlags
,
406 IN OUT EFI_HII_UPDATE_DATA
*Data
410 Construct <ConfigAltResp> for a buffer storage.
412 @param ConfigRequest The Config request string. If set to NULL, all the
413 configurable elements will be extracted from BlockNameArray.
414 @param Progress On return, points to a character in the Request.
415 @param ConfigAltResp The returned <ConfigAltResp>.
416 @param Guid GUID of the buffer storage.
417 @param Name Name of the buffer storage.
418 @param DriverHandle The DriverHandle which is used to invoke HiiDatabase
419 protocol interface NewPackageList().
420 @param BufferStorage Content of the buffer storage.
421 @param BufferStorageSize Length in bytes of the buffer storage.
422 @param BlockNameArray Array generated by VFR compiler.
423 @param NumberAltCfg Number of Default value array generated by VFR compiler.
424 The sequential input parameters will be number of
425 AltCfgId and DefaultValueArray pairs. When set to 0,
426 there will be no <AltResp>.
427 @param ... Variable argument list.
429 retval EFI_OUT_OF_RESOURCES Run out of memory resource.
430 retval EFI_INVALID_PARAMETER ConfigAltResp is NULL.
431 retval EFI_SUCCESS Operation successful.
435 ConstructConfigAltResp (
436 IN EFI_STRING ConfigRequest
, OPTIONAL
437 OUT EFI_STRING
*Progress
,
438 OUT EFI_STRING
*ConfigAltResp
,
441 IN EFI_HANDLE
*DriverHandle
,
442 IN VOID
*BufferStorage
,
443 IN UINTN BufferStorageSize
,
444 IN VOID
*BlockNameArray
, OPTIONAL
445 IN UINTN NumberAltCfg
,
447 //IN UINT16 AltCfgId,
448 //IN VOID *DefaultValueArray,
453 Converts the unicode character of the string from uppercase to lowercase.
455 @param Str String to be converted
467 Converts binary buffer to a Unicode string. The byte buffer is in a reversed byte order
468 compared with the byte order defined in BufToHexString().
470 @param Str String for output
471 @param Buffer Binary buffer.
472 @param BufferSize Size of the buffer in bytes.
474 @retval EFI_SUCCESS The function completed successfully.
475 @retval EFI_OUT_OF_RESOURCES There is no enough available memory space.
480 BufInReverseOrderToHexString (
488 Converts Hex String to binary buffer in reversed byte order to HexStringToBuf().
490 @param Buffer Pointer to buffer that receives the data.
491 @param BufferSize Length in bytes of the buffer to hold converted
492 data. If routine return with EFI_SUCCESS,
493 containing length of converted data. If routine
494 return with EFI_BUFFER_TOO_SMALL, containg length
496 @param Str String to be converted from.
498 @retval EFI_SUCCESS The function completed successfully.
499 @retval RETURN_BUFFER_TOO_SMALL The input BufferSize is too small to hold the output. BufferSize
500 will be updated to the size required for the converstion.
505 HexStringToBufInReverseOrder (
506 IN OUT UINT8
*Buffer
,
507 IN OUT UINTN
*BufferSize
,
513 Convert binary representation Config string (e.g. "0041004200430044") to the
514 original string (e.g. "ABCD"). Config string appears in <ConfigHdr> (i.e.
515 "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
517 @param UnicodeString Original Unicode string.
518 @param StrBufferLen On input: Length in bytes of buffer to hold the Unicode string.
519 Includes tailing '\0' character.
521 containing length of Unicode string buffer when returning EFI_SUCCESS;
522 containg length of string buffer desired when returning EFI_BUFFER_TOO_SMALL.
523 @param ConfigString Binary representation of Unicode String, <string> := (<HexCh>4)+
525 @retval EFI_SUCCESS Operation completes successfully.
526 @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.
531 ConfigStringToUnicode (
532 IN OUT CHAR16
*UnicodeString
,
533 IN OUT UINTN
*StrBufferLen
,
534 IN CHAR16
*ConfigString
539 Convert Unicode string to binary representation Config string, e.g.
540 "ABCD" => "0041004200430044". Config string appears in <ConfigHdr> (i.e.
541 "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
543 @param ConfigString Binary representation of Unicode String, <string> := (<HexCh>4)+
544 @param StrBufferLen On input: Length in bytes of buffer to hold the Unicode string.
545 Includes tailing '\0' character.
547 If return EFI_SUCCESS, containing length of Unicode string buffer.
548 If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
549 @param UnicodeString Original Unicode string.
551 @retval EFI_SUCCESS Operation completes successfully.
552 @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.
557 UnicodeToConfigString (
558 IN OUT CHAR16
*ConfigString
,
559 IN OUT UINTN
*StrBufferLen
,
560 IN CHAR16
*UnicodeString
565 Construct <ConfigHdr> using routing information GUID/NAME/PATH.
567 @param ConfigHdr Pointer to the ConfigHdr string.
568 @param StrBufferLen On input: Length in bytes of buffer to hold the
569 ConfigHdr string. Includes tailing '\0' character.
570 On output: If return EFI_SUCCESS, containing
571 length of ConfigHdr string buffer. If return
572 EFI_BUFFER_TOO_SMALL, containg length of string
574 @param Guid Routing information: GUID.
575 @param Name Routing information: NAME.
576 @param DriverHandle Driver handle which contains the routing
579 @retval EFI_SUCCESS Operation completes successfully.
580 @retval EFI_BUFFER_TOO_SMALL The ConfigHdr string buffer is too small.
586 IN OUT CHAR16
*ConfigHdr
,
587 IN OUT UINTN
*StrBufferLen
,
588 IN CONST EFI_GUID
*Guid
,
589 IN CHAR16
*Name
, OPTIONAL
590 IN EFI_HANDLE
*DriverHandle
596 Determines if the Routing data (Guid and Name) is correct in <ConfigHdr>.
598 @param ConfigString Either <ConfigRequest> or <ConfigResp>.
599 @param StorageGuid GUID of the storage.
600 @param StorageName Name of the stoarge.
602 @retval TRUE Routing information is correct in ConfigString.
603 @retval FALSE Routing information is incorrect in ConfigString.
609 IN EFI_STRING ConfigString
,
610 IN EFI_GUID
*StorageGuid
, OPTIONAL
611 IN CHAR16
*StorageName OPTIONAL
616 Search BlockName "&OFFSET=Offset&WIDTH=Width" in a string.
618 @param String The string to be searched in.
619 @param Offset Offset in BlockName.
620 @param Width Width in BlockName.
622 @retval TRUE Block name found.
623 @retval FALSE Block name not found.
629 IN OUT CHAR16
*String
,
636 This routine is invoked by ConfigAccess.Callback() to retrived uncommitted data from Form Browser.
638 @param VariableGuid An optional field to indicate the target variable
640 @param VariableName An optional field to indicate the target
641 human-readable variable name.
642 @param BufferSize On input: Length in bytes of buffer to hold
643 retrived data. On output: If return
644 EFI_BUFFER_TOO_SMALL, containg length of buffer
646 @param Buffer Buffer to hold retrived data.
648 @retval EFI_SUCCESS Operation completes successfully.
649 @retval EFI_BUFFER_TOO_SMALL The intput buffer is too small.
655 IN CONST EFI_GUID
*VariableGuid
, OPTIONAL
656 IN CONST CHAR16
*VariableName
, OPTIONAL
657 IN OUT UINTN
*BufferSize
,
663 This routine is invoked by ConfigAccess.Callback() to update uncommitted data of Form Browser.
665 @param VariableGuid An optional field to indicate the target variable
667 @param VariableName An optional field to indicate the target
668 human-readable variable name.
669 @param BufferSize Length in bytes of buffer to hold retrived data.
670 @param Buffer Buffer to hold retrived data.
671 @param RequestElement An optional field to specify which part of the
672 buffer data will be send back to Browser. If NULL,
673 the whole buffer of data will be committed to
674 Browser. <RequestElement> ::=
675 &OFFSET=<Number>&WIDTH=<Number>*
677 @retval EFI_SUCCESS Operation completes successfully.
678 @retval Other Updating Browser uncommitted data failed.
684 IN CONST EFI_GUID
*VariableGuid
, OPTIONAL
685 IN CONST CHAR16
*VariableName
, OPTIONAL
687 IN CONST UINT8
*Buffer
,
688 IN CONST CHAR16
*RequestElement OPTIONAL
693 Draw a dialog and return the selected key.
695 @param NumberOfLines The number of lines for the dialog box
696 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
697 @param String Pointer to the first string in the list
698 @param ... A series of (quantity == NumberOfLines - 1) text
699 strings which will be used to construct the dialog
702 @retval EFI_SUCCESS Displayed dialog and received user interaction
703 @retval EFI_INVALID_PARAMETER One of the parameters was invalid.
709 IN UINTN NumberOfLines
,
710 OUT EFI_INPUT_KEY
*KeyValue
,
717 Draw a dialog and return the selected key using Variable Argument List.
719 @param NumberOfLines The number of lines for the dialog box
720 @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
721 @param String The first String to be displayed in the Pop-Up.
722 @param Args VA_LIST marker for the variable argument list.
723 A series of (quantity == NumberOfLines - 1) text
724 strings which will be used to construct the dialog
727 @retval EFI_SUCCESS Displayed dialog and received user interaction
728 @retval EFI_INVALID_PARAMETER One of the parameters was invalid.
734 IN UINTN NumberOfLines
,
735 OUT EFI_INPUT_KEY
*KeyValue
,
742 Test if a Unicode character is a hexadecimal digit. If true, the input
743 Unicode character is converted to a byte.
745 This function tests if a Unicode character is a hexadecimal digit. If true, the input
746 Unicode character is converted to a byte. For example, Unicode character
747 L'A' will be converted to 0x0A.
749 If Digit is NULL, then ASSERT.
751 @param Digit The output hexadecimal digit.
753 @param Char The input Unicode character.
755 @retval TRUE Char is in the range of Hexadecimal number. Digit is updated
756 to the byte value of the number.
757 @retval FALSE Char is not in the range of Hexadecimal number. Digit is keep
771 Convert binary buffer to a Unicode String in a specified sequence.
773 This function converts bytes in the memory block pointed by Buffer to a Unicode String Str.
774 Each byte will be represented by two Unicode characters. For example, byte 0xA1 will
775 be converted into two Unicode character L'A' and L'1'. In the output String, the Unicode Character
776 for the Most Significant Nibble will be put before the Unicode Character for the Least Significant
777 Nibble. The output string for the buffer containing a single byte 0xA1 will be L"A1".
778 For a buffer with multiple bytes, the Unicode character produced by the first byte will be put into the
779 the last character in the output string. The one next to first byte will be put into the
780 character before the last character. This rules applies to the rest of the bytes. The Unicode
781 character by the last byte will be put into the first character in the output string. For example,
782 the input buffer for a 64-bits unsigned integer 0x12345678abcdef1234 will be converted to
783 a Unicode string equal to L"12345678abcdef1234".
785 @param String On input, String is pointed to the buffer allocated for the convertion.
786 @param StringLen The Length of String buffer to hold the output String. The length must include the tailing '\0' character.
787 The StringLen required to convert a N bytes Buffer will be a least equal to or greater
789 @param Buffer The pointer to a input buffer.
790 @param BufferSizeInBytes Length in bytes of the input buffer.
793 @retval EFI_SUCCESS The convertion is successful. All bytes in Buffer has been convert to the corresponding
794 Unicode character and placed into the right place in String.
795 @retval EFI_BUFFER_TOO_SMALL StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to
796 complete the convertion.
801 IN OUT CHAR16
*String
,
802 IN OUT UINTN
*StringLen
,
803 IN CONST UINT8
*Buffer
,
804 IN UINTN BufferSizeInBytes
810 Convert a Unicode string consisting of hexadecimal characters to a output byte buffer.
812 This function converts a Unicode string consisting of characters in the range of Hexadecimal
813 character (L'0' to L'9', L'A' to L'F' and L'a' to L'f') to a output byte buffer. The function will stop
814 at the first non-hexadecimal character or the NULL character. The convertion process can be
815 simply viewed as the reverse operations defined by BufToHexString. Two Unicode characters will be
816 converted into one byte. The first Unicode character represents the Most Significant Nibble and the
817 second Unicode character represents the Least Significant Nibble in the output byte.
818 The first pair of Unicode characters represents the last byte in the output buffer. The second pair of Unicode
819 characters represent the the byte preceding the last byte. This rule applies to the rest pairs of bytes.
820 The last pair represent the first byte in the output buffer.
822 For example, a Unciode String L"12345678" will be converted into a buffer wil the following bytes
823 (first byte is the byte in the lowest memory address): "0x78, 0x56, 0x34, 0x12".
825 If String has N valid hexadecimal characters for conversion, the caller must make sure Buffer is at least
826 N/2 (if N is even) or (N+1)/2 (if N if odd) bytes.
828 If either Buffer, BufferSizeInBytes or String is NULL, then ASSERT ().
830 @param Buffer The output buffer allocated by the caller.
831 @param BufferSizeInBytes On input, the size in bytes of Buffer. On output, it is updated to
832 contain the size of the Buffer which is actually used for the converstion.
833 For Unicode string with 2*N hexadecimal characters (not including the
834 tailing NULL character), N bytes of Buffer will be used for the output.
835 @param String The input hexadecimal string.
836 @param ConvertedStrLen The number of hexadecimal characters used to produce content in output
839 @retval RETURN_BUFFER_TOO_SMALL The input BufferSizeInBytes is too small to hold the output. BufferSizeInBytes
840 will be updated to the size required for the converstion.
841 @retval RETURN_SUCCESS The convertion is successful or the first Unicode character from String
842 is hexadecimal. If ConvertedStrLen is not NULL, it is updated
843 to the number of hexadecimal character used for the converstion.
849 IN OUT UINTN
*BufferSizeInBytes
,
850 IN CONST CHAR16
*String
,
851 OUT UINTN
*ConvertedStrLen OPTIONAL