BiCreateEfiEntry
__int64 __fastcall BiCreateEfiEntry(__int64 a1, __int64 a2){
_BOOT_ENTRY *Buffer;
int v5;
VOID *v6;
int BootEntry;
int v8;
int v9;
UINT64 Length;
struct _UNICODE_STRING EntryValue;
PVOID ObjectHandle;
*(_DWORD *)&EntryValue.Length = 0;
ObjectHandle = 0i64;
Buffer = 0i64;
EntryValue.Buffer = 0i64;
v5 = BcdOpenObject((PVOID)a1, (GUID *)(a2 + 16), &ObjectHandle);
v6 = ObjectHandle;
BootEntry = v5;
if( v5 < 0 )
goto LABEL_17;
if( (*(_DWORD *)(a2 + 48) & 2) == 0 )
{
BootEntry = BiCreateBootEntry(ObjectHandle, (VOID **)&EntryValue.Buffer);
if( BootEntry >= 0 )
{
Buffer = (_BOOT_ENTRY *)EntryValue.Buffer;
BootEntry = BiAddBootEntry((_BOOT_ENTRY *)EntryValue.Buffer, (UINT64 *)&EntryValue.Length);
if( BootEntry >= 0 )
{
BiLogMessage();
Buffer->Id = *(_DWORD *)&EntryValue.Length;
v9 = *(_DWORD *)&EntryValue.Length;
*(_DWORD *)(a2 + 48) |= 0x21u;
*(_DWORD *)(a2 + 32) = v9;
*(_QWORD *)(a2 + 40) = Buffer;
LODWORD(Length) = Buffer->Length;
BootEntry = BiSetRegistryValue(v6, (WCHAR *)L"FirmwareVariable", (WCHAR *)L"Description", 3ui64, Buffer, Length);
if( BootEntry >= 0 )
{
*(_DWORD *)(a2 + 48) |= 2u;
LABEL_14:
if( BootEntry >= 0 )
goto LABEL_18;
goto LABEL_17;
}
}
goto LABEL_17;
}
LABEL_16:
Buffer = (_BOOT_ENTRY *)EntryValue.Buffer;
goto LABEL_17;
}
BootEntry = BiGetSavedBootEntry(ObjectHandle, (_BOOT_ENTRY **)&EntryValue.Buffer);
if( BootEntry < 0 )
goto LABEL_16;
Buffer = (_BOOT_ENTRY *)EntryValue.Buffer;
if( (*(_DWORD *)(a2 + 48) & 8) == 0 )
{
BootEntry = BiUpdateObjectReferenceInEfiEntry((INT64)EntryValue.Buffer, v6);
if( BootEntry < 0 )
goto LABEL_17;
*(_DWORD *)(a2 + 48) |= 0x20u;
}
BootEntry = BiAddBootEntry(Buffer, (UINT64 *)&EntryValue.Length);
if( BootEntry >= 0 )
{
BiLogMessage();
Buffer->Id = *(_DWORD *)&EntryValue.Length;
v8 = *(_DWORD *)&EntryValue.Length;
*(_DWORD *)(a2 + 48) |= 1u;
*(_DWORD *)(a2 + 32) = v8;
*(_QWORD *)(a2 + 40) = Buffer;
LODWORD(Length) = Buffer->Length;
BootEntry = BiSetRegistryValue(v6, (WCHAR *)L"FirmwareVariable", (WCHAR *)L"Description", 3ui64, Buffer, Length);
if( BootEntry >= 0 )
{
BootEntry = BiUpdateEfiEntry(a1, a2);
goto LABEL_14;
}
}
LABEL_17:
BiLogMessage();
LABEL_18:
if( v6 )
BcdCloseObject(v6);
if( (*(_DWORD *)(a2 + 48) & 1) == 0 && Buffer )
ExFreePoolWithTag(Buffer, 0x4B444342u);
return(unsigned int)BootEntry;
}Referenced by:
BiBindEfiEntries
BiExportBcdObjects