BiSetRegistryValue

INT64 __fastcall BiSetRegistryValue(
        VOID *ParentHandle,
        WCHAR *ValueName,
        WCHAR *KeyName,
        UINT64 Type,
        VOID *Buffer,
        UINT64 Length){
  unsigned int v6; 
  unsigned int i; 
  VOID *v11; 
  int v12; 
  PVOID Handle; 
  struct _UNICODE_STRING DestinationString; 
  v6 = Type;
  DestinationString = 0i64;
  for( i = 0; ; ++i )
  {
    RtlInitUnicodeString(&DestinationString, ValueName, (WCHAR)KeyName);
    LODWORD(v11) = BiSanitizeHandle(ParentHandle);
    ParentHandle = v11;
    Handle = 0i64;
    if( KeyName )
    {
      v12 = BiOpenKey(v11, KeyName, 0x2001Fui64, &Handle);
      if( v12 < 0 )
        goto LABEL_5;
    }
    else
    {
      Handle = v11;
    }
    v12 = BiZwSetValueKey(Handle, &DestinationString, (UINT64)KeyName, (PVOID)v6, (UINT64)Buffer);
LABEL_5:
    if( Handle != ParentHandle && Handle )
      BiCloseKey(Handle);
    if( v12 == -1073741443 )
    {
      __debugbreak();
      if( i < 5 )
        continue;
    }
    break;
  }
  return(unsigned int)v12;
}

Referenced by:

BcdSetElementDataWithFlags
BiAddStoreFromFile
BiCreateEfiEntry
BiMarkTreatAsSystemStore
BiSetFirmwareModified
BiSetObjectDescription
BiUpdateBcdObject