MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / AddNvramVariable

Function AddNvramVariable

rEFIt_UEFI/Platform/Nvram.cpp:233–255  ·  view source on GitHub ↗

Sets NVRAM variable. Does nothing if variable with the same name already exists. */

Source from the content-addressed store, hash-verified

231
232/** Sets NVRAM variable. Does nothing if variable with the same name already exists. */
233EFI_STATUS
234AddNvramVariable (
235 IN CONST CHAR16 *VariableName,
236 IN EFI_GUID *VendorGuid,
237 IN UINT32 Attributes,
238 IN UINTN DataSize,
239 IN VOID *Data
240 )
241{
242 VOID *OldData;
243
244 //DBG("SetNvramVariable (%ls, guid, 0x%X, %d):\n", VariableName, Attributes, DataSize);
245 OldData = (__typeof__(OldData))GetNvramVariable(VariableName, VendorGuid, NULL, NULL);
246 if (OldData == NULL)
247 {
248 // set new value
249 return gRT->SetVariable(VariableName, VendorGuid, Attributes, DataSize, Data);
250// DBG(" -> writing new (%s)\n", efiStrError(Status));
251 } else {
252 FreePool(OldData);
253 return EFI_ABORTED;
254 }
255}
256
257EFI_STATUS
258AddNvramXString8(

Callers 2

SetVariablesForOSXFunction · 0.85
AddNvramXString8Function · 0.85

Calls 2

GetNvramVariableFunction · 0.85
FreePoolFunction · 0.50

Tested by

no test coverage detected