2 Functions in this module are associated with variable parsing operations and
3 are intended to be usable across variable driver source files.
5 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "VariableParsing.h"
14 This code checks if variable header is valid or not.
16 @param[in] Variable Pointer to the Variable Header.
17 @param[in] VariableStoreEnd Pointer to the Variable Store End.
19 @retval TRUE Variable header is valid.
20 @retval FALSE Variable header is not valid.
24 IsValidVariableHeader (
25 IN VARIABLE_HEADER
*Variable
,
26 IN VARIABLE_HEADER
*VariableStoreEnd
29 if ((Variable
== NULL
) || (Variable
>= VariableStoreEnd
) || (Variable
->StartId
!= VARIABLE_DATA
)) {
31 // Variable is NULL or has reached the end of variable store,
32 // or the StartId is not correct.
42 This code gets the current status of Variable Store.
44 @param[in] VarStoreHeader Pointer to the Variable Store Header.
46 @retval EfiRaw Variable store status is raw.
47 @retval EfiValid Variable store status is valid.
48 @retval EfiInvalid Variable store status is invalid.
52 GetVariableStoreStatus (
53 IN VARIABLE_STORE_HEADER
*VarStoreHeader
56 if ((CompareGuid (&VarStoreHeader
->Signature
, &gEfiAuthenticatedVariableGuid
) ||
57 CompareGuid (&VarStoreHeader
->Signature
, &gEfiVariableGuid
)) &&
58 VarStoreHeader
->Format
== VARIABLE_STORE_FORMATTED
&&
59 VarStoreHeader
->State
== VARIABLE_STORE_HEALTHY
63 } else if (((UINT32
*)(&VarStoreHeader
->Signature
))[0] == 0xffffffff &&
64 ((UINT32
*)(&VarStoreHeader
->Signature
))[1] == 0xffffffff &&
65 ((UINT32
*)(&VarStoreHeader
->Signature
))[2] == 0xffffffff &&
66 ((UINT32
*)(&VarStoreHeader
->Signature
))[3] == 0xffffffff &&
67 VarStoreHeader
->Size
== 0xffffffff &&
68 VarStoreHeader
->Format
== 0xff &&
69 VarStoreHeader
->State
== 0xff
79 This code gets the size of variable header.
81 @param[in] AuthFormat TRUE indicates authenticated variables are used.
82 FALSE indicates authenticated variables are not used.
84 @return Size of variable header in bytes in type UINTN.
88 GetVariableHeaderSize (
95 Value
= sizeof (AUTHENTICATED_VARIABLE_HEADER
);
97 Value
= sizeof (VARIABLE_HEADER
);
105 This code gets the size of name of variable.
107 @param[in] Variable Pointer to the variable header.
108 @param[in] AuthFormat TRUE indicates authenticated variables are used.
109 FALSE indicates authenticated variables are not used.
111 @return UINTN Size of variable in bytes.
116 IN VARIABLE_HEADER
*Variable
,
117 IN BOOLEAN AuthFormat
120 AUTHENTICATED_VARIABLE_HEADER
*AuthVariable
;
122 AuthVariable
= (AUTHENTICATED_VARIABLE_HEADER
*) Variable
;
124 if (AuthVariable
->State
== (UINT8
) (-1) ||
125 AuthVariable
->DataSize
== (UINT32
) (-1) ||
126 AuthVariable
->NameSize
== (UINT32
) (-1) ||
127 AuthVariable
->Attributes
== (UINT32
) (-1)) {
130 return (UINTN
) AuthVariable
->NameSize
;
132 if (Variable
->State
== (UINT8
) (-1) ||
133 Variable
->DataSize
== (UINT32
) (-1) ||
134 Variable
->NameSize
== (UINT32
) (-1) ||
135 Variable
->Attributes
== (UINT32
) (-1)) {
138 return (UINTN
) Variable
->NameSize
;
143 This code sets the size of name of variable.
145 @param[in] Variable Pointer to the Variable Header.
146 @param[in] NameSize Name size to set.
147 @param[in] AuthFormat TRUE indicates authenticated variables are used.
148 FALSE indicates authenticated variables are not used.
152 SetNameSizeOfVariable (
153 IN VARIABLE_HEADER
*Variable
,
155 IN BOOLEAN AuthFormat
158 AUTHENTICATED_VARIABLE_HEADER
*AuthVariable
;
160 AuthVariable
= (AUTHENTICATED_VARIABLE_HEADER
*) Variable
;
162 AuthVariable
->NameSize
= (UINT32
) NameSize
;
164 Variable
->NameSize
= (UINT32
) NameSize
;
170 This code gets the size of variable data.
172 @param[in] Variable Pointer to the Variable Header.
173 @param[in] AuthFormat TRUE indicates authenticated variables are used.
174 FALSE indicates authenticated variables are not used.
176 @return Size of variable in bytes.
181 IN VARIABLE_HEADER
*Variable
,
182 IN BOOLEAN AuthFormat
185 AUTHENTICATED_VARIABLE_HEADER
*AuthVariable
;
187 AuthVariable
= (AUTHENTICATED_VARIABLE_HEADER
*) Variable
;
189 if (AuthVariable
->State
== (UINT8
) (-1) ||
190 AuthVariable
->DataSize
== (UINT32
) (-1) ||
191 AuthVariable
->NameSize
== (UINT32
) (-1) ||
192 AuthVariable
->Attributes
== (UINT32
) (-1)) {
195 return (UINTN
) AuthVariable
->DataSize
;
197 if (Variable
->State
== (UINT8
) (-1) ||
198 Variable
->DataSize
== (UINT32
) (-1) ||
199 Variable
->NameSize
== (UINT32
) (-1) ||
200 Variable
->Attributes
== (UINT32
) (-1)) {
203 return (UINTN
) Variable
->DataSize
;
208 This code sets the size of variable data.
210 @param[in] Variable Pointer to the Variable Header.
211 @param[in] DataSize Data size to set.
212 @param[in] AuthFormat TRUE indicates authenticated variables are used.
213 FALSE indicates authenticated variables are not used.
217 SetDataSizeOfVariable (
218 IN VARIABLE_HEADER
*Variable
,
220 IN BOOLEAN AuthFormat
223 AUTHENTICATED_VARIABLE_HEADER
*AuthVariable
;
225 AuthVariable
= (AUTHENTICATED_VARIABLE_HEADER
*) Variable
;
227 AuthVariable
->DataSize
= (UINT32
) DataSize
;
229 Variable
->DataSize
= (UINT32
) DataSize
;
235 This code gets the pointer to the variable name.
237 @param[in] Variable Pointer to the Variable Header.
238 @param[in] AuthFormat TRUE indicates authenticated variables are used.
239 FALSE indicates authenticated variables are not used.
241 @return Pointer to Variable Name which is Unicode encoding.
246 IN VARIABLE_HEADER
*Variable
,
247 IN BOOLEAN AuthFormat
250 return (CHAR16
*) ((UINTN
) Variable
+ GetVariableHeaderSize (AuthFormat
));
254 This code gets the pointer to the variable guid.
256 @param[in] Variable Pointer to the Variable Header.
257 @param[in] AuthFormat TRUE indicates authenticated variables are used.
258 FALSE indicates authenticated variables are not used.
260 @return A EFI_GUID* pointer to Vendor Guid.
265 IN VARIABLE_HEADER
*Variable
,
266 IN BOOLEAN AuthFormat
269 AUTHENTICATED_VARIABLE_HEADER
*AuthVariable
;
271 AuthVariable
= (AUTHENTICATED_VARIABLE_HEADER
*) Variable
;
273 return &AuthVariable
->VendorGuid
;
275 return &Variable
->VendorGuid
;
281 This code gets the pointer to the variable data.
283 @param[in] Variable Pointer to the Variable Header.
284 @param[in] AuthFormat TRUE indicates authenticated variables are used.
285 FALSE indicates authenticated variables are not used.
287 @return Pointer to Variable Data.
292 IN VARIABLE_HEADER
*Variable
,
293 IN BOOLEAN AuthFormat
299 // Be careful about pad size for alignment.
301 Value
= (UINTN
) GetVariableNamePtr (Variable
, AuthFormat
);
302 Value
+= NameSizeOfVariable (Variable
, AuthFormat
);
303 Value
+= GET_PAD_SIZE (NameSizeOfVariable (Variable
, AuthFormat
));
305 return (UINT8
*) Value
;
309 This code gets the variable data offset related to variable header.
311 @param[in] Variable Pointer to the Variable Header.
312 @param[in] AuthFormat TRUE indicates authenticated variables are used.
313 FALSE indicates authenticated variables are not used.
315 @return Variable Data offset.
319 GetVariableDataOffset (
320 IN VARIABLE_HEADER
*Variable
,
321 IN BOOLEAN AuthFormat
327 // Be careful about pad size for alignment
329 Value
= GetVariableHeaderSize (AuthFormat
);
330 Value
+= NameSizeOfVariable (Variable
, AuthFormat
);
331 Value
+= GET_PAD_SIZE (NameSizeOfVariable (Variable
, AuthFormat
));
338 This code gets the pointer to the next variable header.
340 @param[in] Variable Pointer to the Variable Header.
341 @param[in] AuthFormat TRUE indicates authenticated variables are used.
342 FALSE indicates authenticated variables are not used.
344 @return Pointer to next variable header.
349 IN VARIABLE_HEADER
*Variable
,
350 IN BOOLEAN AuthFormat
355 Value
= (UINTN
) GetVariableDataPtr (Variable
, AuthFormat
);
356 Value
+= DataSizeOfVariable (Variable
, AuthFormat
);
357 Value
+= GET_PAD_SIZE (DataSizeOfVariable (Variable
, AuthFormat
));
360 // Be careful about pad size for alignment.
362 return (VARIABLE_HEADER
*) HEADER_ALIGN (Value
);
367 Gets the pointer to the first variable header in given variable store area.
369 @param[in] VarStoreHeader Pointer to the Variable Store Header.
371 @return Pointer to the first variable header.
376 IN VARIABLE_STORE_HEADER
*VarStoreHeader
380 // The start of variable store.
382 return (VARIABLE_HEADER
*) HEADER_ALIGN (VarStoreHeader
+ 1);
387 Gets the pointer to the end of the variable storage area.
389 This function gets pointer to the end of the variable storage
390 area, according to the input variable store header.
392 @param[in] VarStoreHeader Pointer to the Variable Store Header.
394 @return Pointer to the end of the variable storage area.
399 IN VARIABLE_STORE_HEADER
*VarStoreHeader
403 // The end of variable store
405 return (VARIABLE_HEADER
*) HEADER_ALIGN ((UINTN
) VarStoreHeader
+ VarStoreHeader
->Size
);
409 Compare two EFI_TIME data.
412 @param[in] FirstTime A pointer to the first EFI_TIME data.
413 @param[in] SecondTime A pointer to the second EFI_TIME data.
415 @retval TRUE The FirstTime is not later than the SecondTime.
416 @retval FALSE The FirstTime is later than the SecondTime.
420 VariableCompareTimeStampInternal (
421 IN EFI_TIME
*FirstTime
,
422 IN EFI_TIME
*SecondTime
425 if (FirstTime
->Year
!= SecondTime
->Year
) {
426 return (BOOLEAN
) (FirstTime
->Year
< SecondTime
->Year
);
427 } else if (FirstTime
->Month
!= SecondTime
->Month
) {
428 return (BOOLEAN
) (FirstTime
->Month
< SecondTime
->Month
);
429 } else if (FirstTime
->Day
!= SecondTime
->Day
) {
430 return (BOOLEAN
) (FirstTime
->Day
< SecondTime
->Day
);
431 } else if (FirstTime
->Hour
!= SecondTime
->Hour
) {
432 return (BOOLEAN
) (FirstTime
->Hour
< SecondTime
->Hour
);
433 } else if (FirstTime
->Minute
!= SecondTime
->Minute
) {
434 return (BOOLEAN
) (FirstTime
->Minute
< SecondTime
->Minute
);
437 return (BOOLEAN
) (FirstTime
->Second
<= SecondTime
->Second
);
441 Find the variable in the specified variable store.
443 @param[in] VariableName Name of the variable to be found
444 @param[in] VendorGuid Vendor GUID to be found.
445 @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute
446 check at runtime when searching variable.
447 @param[in, out] PtrTrack Variable Track Pointer structure that contains Variable Information.
448 @param[in] AuthFormat TRUE indicates authenticated variables are used.
449 FALSE indicates authenticated variables are not used.
451 @retval EFI_SUCCESS Variable found successfully
452 @retval EFI_NOT_FOUND Variable not found
456 IN CHAR16
*VariableName
,
457 IN EFI_GUID
*VendorGuid
,
458 IN BOOLEAN IgnoreRtCheck
,
459 IN OUT VARIABLE_POINTER_TRACK
*PtrTrack
,
460 IN BOOLEAN AuthFormat
463 VARIABLE_HEADER
*InDeletedVariable
;
466 PtrTrack
->InDeletedTransitionPtr
= NULL
;
469 // Find the variable by walk through HOB, volatile and non-volatile variable store.
471 InDeletedVariable
= NULL
;
473 for ( PtrTrack
->CurrPtr
= PtrTrack
->StartPtr
474 ; IsValidVariableHeader (PtrTrack
->CurrPtr
, PtrTrack
->EndPtr
)
475 ; PtrTrack
->CurrPtr
= GetNextVariablePtr (PtrTrack
->CurrPtr
, AuthFormat
)
477 if (PtrTrack
->CurrPtr
->State
== VAR_ADDED
||
478 PtrTrack
->CurrPtr
->State
== (VAR_IN_DELETED_TRANSITION
& VAR_ADDED
)
480 if (IgnoreRtCheck
|| !AtRuntime () || ((PtrTrack
->CurrPtr
->Attributes
& EFI_VARIABLE_RUNTIME_ACCESS
) != 0)) {
481 if (VariableName
[0] == 0) {
482 if (PtrTrack
->CurrPtr
->State
== (VAR_IN_DELETED_TRANSITION
& VAR_ADDED
)) {
483 InDeletedVariable
= PtrTrack
->CurrPtr
;
485 PtrTrack
->InDeletedTransitionPtr
= InDeletedVariable
;
489 if (CompareGuid (VendorGuid
, GetVendorGuidPtr (PtrTrack
->CurrPtr
, AuthFormat
))) {
490 Point
= (VOID
*) GetVariableNamePtr (PtrTrack
->CurrPtr
, AuthFormat
);
492 ASSERT (NameSizeOfVariable (PtrTrack
->CurrPtr
, AuthFormat
) != 0);
493 if (CompareMem (VariableName
, Point
, NameSizeOfVariable (PtrTrack
->CurrPtr
, AuthFormat
)) == 0) {
494 if (PtrTrack
->CurrPtr
->State
== (VAR_IN_DELETED_TRANSITION
& VAR_ADDED
)) {
495 InDeletedVariable
= PtrTrack
->CurrPtr
;
497 PtrTrack
->InDeletedTransitionPtr
= InDeletedVariable
;
507 PtrTrack
->CurrPtr
= InDeletedVariable
;
508 return (PtrTrack
->CurrPtr
== NULL
) ? EFI_NOT_FOUND
: EFI_SUCCESS
;
512 This code finds the next available variable.
514 Caution: This function may receive untrusted input.
515 This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
517 @param[in] VariableName Pointer to variable name.
518 @param[in] VendorGuid Variable Vendor Guid.
519 @param[in] VariableStoreList A list of variable stores that should be used to get the next variable.
520 The maximum number of entries is the max value of VARIABLE_STORE_TYPE.
521 @param[out] VariablePtr Pointer to variable header address.
522 @param[in] AuthFormat TRUE indicates authenticated variables are used.
523 FALSE indicates authenticated variables are not used.
525 @retval EFI_SUCCESS The function completed successfully.
526 @retval EFI_NOT_FOUND The next variable was not found.
527 @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while VendorGuid is NULL.
528 @retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and
529 GUID of an existing variable.
534 VariableServiceGetNextVariableInternal (
535 IN CHAR16
*VariableName
,
536 IN EFI_GUID
*VendorGuid
,
537 IN VARIABLE_STORE_HEADER
**VariableStoreList
,
538 OUT VARIABLE_HEADER
**VariablePtr
,
539 IN BOOLEAN AuthFormat
543 VARIABLE_STORE_TYPE StoreType
;
544 VARIABLE_POINTER_TRACK Variable
;
545 VARIABLE_POINTER_TRACK VariableInHob
;
546 VARIABLE_POINTER_TRACK VariablePtrTrack
;
548 Status
= EFI_NOT_FOUND
;
550 if (VariableStoreList
== NULL
) {
551 return EFI_INVALID_PARAMETER
;
554 ZeroMem (&Variable
, sizeof (Variable
));
556 // Check if the variable exists in the given variable store list
557 for (StoreType
= (VARIABLE_STORE_TYPE
) 0; StoreType
< VariableStoreTypeMax
; StoreType
++) {
558 if (VariableStoreList
[StoreType
] == NULL
) {
562 Variable
.StartPtr
= GetStartPointer (VariableStoreList
[StoreType
]);
563 Variable
.EndPtr
= GetEndPointer (VariableStoreList
[StoreType
]);
564 Variable
.Volatile
= (BOOLEAN
) (StoreType
== VariableStoreTypeVolatile
);
566 Status
= FindVariableEx (VariableName
, VendorGuid
, FALSE
, &Variable
, AuthFormat
);
567 if (!EFI_ERROR (Status
)) {
572 if (Variable
.CurrPtr
== NULL
|| EFI_ERROR (Status
)) {
574 // For VariableName is an empty string, FindVariableEx() will try to find and return
575 // the first qualified variable, and if FindVariableEx() returns error (EFI_NOT_FOUND)
576 // as no any variable is found, still go to return the error (EFI_NOT_FOUND).
578 if (VariableName
[0] != 0) {
580 // For VariableName is not an empty string, and FindVariableEx() returns error as
581 // VariableName and VendorGuid are not a name and GUID of an existing variable,
582 // there is no way to get next variable, follow spec to return EFI_INVALID_PARAMETER.
584 Status
= EFI_INVALID_PARAMETER
;
589 if (VariableName
[0] != 0) {
591 // If variable name is not empty, get next variable.
593 Variable
.CurrPtr
= GetNextVariablePtr (Variable
.CurrPtr
, AuthFormat
);
598 // Switch to the next variable store if needed
600 while (!IsValidVariableHeader (Variable
.CurrPtr
, Variable
.EndPtr
)) {
602 // Find current storage index
604 for (StoreType
= (VARIABLE_STORE_TYPE
) 0; StoreType
< VariableStoreTypeMax
; StoreType
++) {
605 if ((VariableStoreList
[StoreType
] != NULL
) && (Variable
.StartPtr
== GetStartPointer (VariableStoreList
[StoreType
]))) {
609 ASSERT (StoreType
< VariableStoreTypeMax
);
611 // Switch to next storage
613 for (StoreType
++; StoreType
< VariableStoreTypeMax
; StoreType
++) {
614 if (VariableStoreList
[StoreType
] != NULL
) {
619 // Capture the case that
620 // 1. current storage is the last one, or
621 // 2. no further storage
623 if (StoreType
== VariableStoreTypeMax
) {
624 Status
= EFI_NOT_FOUND
;
627 Variable
.StartPtr
= GetStartPointer (VariableStoreList
[StoreType
]);
628 Variable
.EndPtr
= GetEndPointer (VariableStoreList
[StoreType
]);
629 Variable
.CurrPtr
= Variable
.StartPtr
;
635 if (Variable
.CurrPtr
->State
== VAR_ADDED
|| Variable
.CurrPtr
->State
== (VAR_IN_DELETED_TRANSITION
& VAR_ADDED
)) {
636 if (!AtRuntime () || ((Variable
.CurrPtr
->Attributes
& EFI_VARIABLE_RUNTIME_ACCESS
) != 0)) {
637 if (Variable
.CurrPtr
->State
== (VAR_IN_DELETED_TRANSITION
& VAR_ADDED
)) {
639 // If it is a IN_DELETED_TRANSITION variable,
640 // and there is also a same ADDED one at the same time,
643 VariablePtrTrack
.StartPtr
= Variable
.StartPtr
;
644 VariablePtrTrack
.EndPtr
= Variable
.EndPtr
;
645 Status
= FindVariableEx (
646 GetVariableNamePtr (Variable
.CurrPtr
, AuthFormat
),
647 GetVendorGuidPtr (Variable
.CurrPtr
, AuthFormat
),
652 if (!EFI_ERROR (Status
) && VariablePtrTrack
.CurrPtr
->State
== VAR_ADDED
) {
653 Variable
.CurrPtr
= GetNextVariablePtr (Variable
.CurrPtr
, AuthFormat
);
659 // Don't return NV variable when HOB overrides it
661 if ((VariableStoreList
[VariableStoreTypeHob
] != NULL
) && (VariableStoreList
[VariableStoreTypeNv
] != NULL
) &&
662 (Variable
.StartPtr
== GetStartPointer (VariableStoreList
[VariableStoreTypeNv
]))
664 VariableInHob
.StartPtr
= GetStartPointer (VariableStoreList
[VariableStoreTypeHob
]);
665 VariableInHob
.EndPtr
= GetEndPointer (VariableStoreList
[VariableStoreTypeHob
]);
666 Status
= FindVariableEx (
667 GetVariableNamePtr (Variable
.CurrPtr
, AuthFormat
),
668 GetVendorGuidPtr (Variable
.CurrPtr
, AuthFormat
),
673 if (!EFI_ERROR (Status
)) {
674 Variable
.CurrPtr
= GetNextVariablePtr (Variable
.CurrPtr
, AuthFormat
);
679 *VariablePtr
= Variable
.CurrPtr
;
680 Status
= EFI_SUCCESS
;
685 Variable
.CurrPtr
= GetNextVariablePtr (Variable
.CurrPtr
, AuthFormat
);
693 Routine used to track statistical information about variable usage.
694 The data is stored in the EFI system table so it can be accessed later.
695 VariableInfo.efi can dump out the table. Only Boot Services variable
696 accesses are tracked by this code. The PcdVariableCollectStatistics
697 build flag controls if this feature is enabled.
699 A read that hits in the cache will have Read and Cache true for
700 the transaction. Data is allocated by this routine, but never
703 @param[in] VariableName Name of the Variable to track.
704 @param[in] VendorGuid Guid of the Variable to track.
705 @param[in] Volatile TRUE if volatile FALSE if non-volatile.
706 @param[in] Read TRUE if GetVariable() was called.
707 @param[in] Write TRUE if SetVariable() was called.
708 @param[in] Delete TRUE if deleted via SetVariable().
709 @param[in] Cache TRUE for a cache hit.
710 @param[in,out] VariableInfo Pointer to a pointer of VARIABLE_INFO_ENTRY structures.
715 IN CHAR16
*VariableName
,
716 IN EFI_GUID
*VendorGuid
,
722 IN OUT VARIABLE_INFO_ENTRY
**VariableInfo
725 VARIABLE_INFO_ENTRY
*Entry
;
727 if (FeaturePcdGet (PcdVariableCollectStatistics
)) {
728 if (VariableName
== NULL
|| VendorGuid
== NULL
|| VariableInfo
== NULL
) {
732 // Don't collect statistics at runtime.
736 if (*VariableInfo
== NULL
) {
738 // On the first call allocate a entry and place a pointer to it in
739 // the EFI System Table.
741 *VariableInfo
= AllocateZeroPool (sizeof (VARIABLE_INFO_ENTRY
));
742 ASSERT (*VariableInfo
!= NULL
);
744 CopyGuid (&(*VariableInfo
)->VendorGuid
, VendorGuid
);
745 (*VariableInfo
)->Name
= AllocateZeroPool (StrSize (VariableName
));
746 ASSERT ((*VariableInfo
)->Name
!= NULL
);
747 StrCpyS ((*VariableInfo
)->Name
, StrSize(VariableName
)/sizeof(CHAR16
), VariableName
);
748 (*VariableInfo
)->Volatile
= Volatile
;
752 for (Entry
= (*VariableInfo
); Entry
!= NULL
; Entry
= Entry
->Next
) {
753 if (CompareGuid (VendorGuid
, &Entry
->VendorGuid
)) {
754 if (StrCmp (VariableName
, Entry
->Name
) == 0) {
762 Entry
->DeleteCount
++;
772 if (Entry
->Next
== NULL
) {
774 // If the entry is not in the table add it.
775 // Next iteration of the loop will fill in the data.
777 Entry
->Next
= AllocateZeroPool (sizeof (VARIABLE_INFO_ENTRY
));
778 ASSERT (Entry
->Next
!= NULL
);
780 CopyGuid (&Entry
->Next
->VendorGuid
, VendorGuid
);
781 Entry
->Next
->Name
= AllocateZeroPool (StrSize (VariableName
));
782 ASSERT (Entry
->Next
->Name
!= NULL
);
783 StrCpyS (Entry
->Next
->Name
, StrSize(VariableName
)/sizeof(CHAR16
), VariableName
);
784 Entry
->Next
->Volatile
= Volatile
;