#include "117828F1-DA7D-4BC1-8B58-9A954FED5121.h"
// ReadCfgMgr.c - Extracted from 117828F1-DA7D-4BC1-8B58-9A954FED5121.c
// Functions: 14
// Function: RstQueryConfig @ 0x4b1c (0x6a bytes)
// Index: 103/906
EFI_STATUS __fastcall RstQueryConfig(RST_PRIVATE_DATA *Private)
{
EFI_STATUS result; // rax
__int64 n24; // [rsp+48h] [rbp+10h] BYREF
CHAR16 *Source; // [rsp+50h] [rbp+18h] BYREF
n24 = 0; /*0x4b22*/
HiiLibGetDefaultString(Private); /*0x4b2b*/
result = (*(__int64 (__fastcall **)(__int64, void *, _QWORD, __int64 *, CHAR16 **))(qword_58070 + 312))( /*0x4b54*/
2,
&unk_27890,
0,
&n24,
&Source);
if ( !result ) /*0x4b5d*/
{
RstCallbackHandler(Private); /*0x4b6c*/
return (*(EFI_STATUS (__fastcall **)(CHAR16 *))(qword_58070 + 72))(Source); /*0x4b7d*/
}
return result; /*0x4b80*/
}
// Function: RstCheckCondition @ 0x5174 (0x38 bytes)
// Index: 113/906
__int64 __fastcall RstCheckCondition(__int64 *a1)
{
__int64 result; // rax
if ( a1[78] ) /*0x517a*/
{
result = HiiLibFindString(a1[2], a1[23], (__int64)&unk_278F0); /*0x5199*/
a1[78] = 0; /*0x519e*/
}
return result; /*0x51a6*/
}
// Function: RstConfigRead @ 0x5360 (0x2a bytes)
// Index: 118/906
__int64 __fastcall RstConfigRead(__int64 a1)
{
__int64 result; // rax
result = 0x8000000000000003uLL; /*0x536c*/
if ( *(_QWORD *)(a1 + 200) ) /*0x5364*/
return (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)(a1 + 200) + 16LL))(*(_QWORD *)(a1 + 200)); /*0x5382*/
return result; /*0x5385*/
}
// Function: RstConfigWrite @ 0x538c (0x1e bytes)
// Index: 119/906
__int64 __fastcall RstConfigWrite(__int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)
{
return RstReadWriteConfig(a1, 1, a2, a3, a4); /*0x53a5*/
}
// Function: RstConfigReadVar @ 0x53ac (0x1b bytes)
// Index: 120/906
__int64 __fastcall RstConfigReadVar(__int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)
{
return RstReadWriteConfig(a1, 0, a2, a3, a4); /*0x53c2*/
}
// Function: RstValidate @ 0x5504 (0x4a bytes)
// Index: 126/906
unsigned __int64 __fastcall RstValidate(__int64 a1, __int64 a2, CHAR16 *i, unsigned __int64 n0x14)
{
if ( !a2 || !i || n0x14 <= 0x14 ) /*0x551b*/
return 0x8000000000000002uLL; /*0x553f*/
RstStringTrimCopy(i, n0x14, (const CHAR16 *)(a1 + 236), 0x14u); /*0x5536*/
return 0; /*0x5549*/
}
// Function: RstCheckSecureBoot @ 0x5550 (0x86 bytes)
// Index: 127/906
char __fastcall RstCheckSecureBoot(__int64 a1, int n5)
{
__int64 v4; // rax
char v5; // bl
int n5_1; // eax
__int64 v8; // [rsp+30h] [rbp+8h] BYREF
__int64 v9; // [rsp+40h] [rbp+18h] BYREF
v4 = sub_2DB8(*(_QWORD *)(a1 + 184)); /*0x556b*/
v5 = 0; /*0x5570*/
if ( !v4 ) /*0x5575*/
return 0; /*0x5575*/
v8 = v4; /*0x5577*/
if ( (*(__int64 (__fastcall **)(void *, __int64 *, __int64 *))(qword_58070 + 184))(&unk_27890, &v8, &v9) < 0 || !v9 ) /*0x55a7*/
return 0; /*0x55c4*/
n5_1 = HiiLibFreeStringArray(*(_QWORD *)(a1 + 16), v9); /*0x55ad*/
if ( !n5_1 || !n5 || n5_1 == n5 ) /*0x55bc*/
return 1; /*0x55be*/
return v5; /*0x55d0*/
}
// Function: RstGetVariableUefi @ 0x5c30 (0x37 bytes)
// Index: 151/906
__int64 __fastcall RstGetVariableUefi(RST_PRIVATE_DATA *Private, __int16 *RstUefiV)
{
sub_9368(); /*0x5c39*/
return (*(__int64 (__fastcall **)(__int16 *, void *, __int64))(RuntimeServices + 88))(RstUefiV, &unk_27178, 6); /*0x5c61*/
}
// Function: RstGetRaidVariable @ 0x5c68 (0xab bytes)
// Index: 152/906
__int64 __fastcall RstGetRaidVariable(RST_PRIVATE_DATA *Private, __int16 *VrocHwKeyId)
{
__int64 v2; // rbx
_BYTE *v5; // rdi
v2 = 0; /*0x5c7c*/
if ( !VrocHwKeyId ) /*0x5c84*/
return 0x8000000000000002uLL; /*0x5c86*/
v5 = (_BYTE *)MemAllocPages(7); /*0x5c9f*/
if ( v5 ) /*0x5ca5*/
{
if ( !sub_96B8() ) /*0x5cc0*/
v2 = (*(__int64 (__fastcall **)(__int16 *, void *, __int64, __int64, _BYTE *))(RuntimeServices + 88))( /*0x5ced*/
VrocHwKeyId,
&unk_27178,
6,
6,
v5);
MemZeroThenFree(v5, 7); /*0x5cf6*/
return v2; /*0x5cfb*/
}
else
{
MemZeroThenFree(0, 7); /*0x5cac*/
return 0x8000000000000009uLL; /*0x5cb1*/
}
}
// Function: RstParseRaidVariable @ 0x5d14 (0x1fc bytes)
// Index: 153/906
EFI_STATUS __fastcall RstParseRaidVariable(RST_PRIVATE_DATA *Private)
{
const __m128i *v1; // rdx
CHAR16 *Source_2; // r8
CHAR16 *Source; // r13
const __m128i *v5; // r14
signed __int64 RaidVariable; // rbx
__int64 i; // rdi
unsigned __int16 Length; // ax
__m128i v9; // xmm5
const CHAR16 *Source_1; // rax
__int64 v11; // r8
__int64 (__fastcall **v12)(void *, __int64, _QWORD, __int64, void **); // r11
void (__fastcall **DeviceListHead)(void *); // rax
__int64 (__fastcall **v14)(void *, __int64); // rax
Private->field_2A8 = 0; /*0x5d31*/
Private->DeviceListHead = 0; /*0x5d39*/
Source = Source_2; /*0x5d48*/
v5 = v1; /*0x5d55*/
if ( (*(__int64 (__fastcall **)(void *, _QWORD, void **))(qword_58070 + 320))(&unk_27880, 0, &Private->field_2A8) >= 0 /*0x5d9f*/
&& Private->field_2A8
|| (RaidVariable = (*(__int64 (__fastcall **)(void *, _QWORD, void **))(qword_58070 + 320))(
&unk_277E0,
0,
&Private->DeviceListHead),
RaidVariable >= 0)
&& Private->DeviceListHead )
{
i = MemAllocPages(92); /*0x5dc2*/
MemZero((_BYTE *)i, 0, 92); /*0x5dc5*/
*(_DWORD *)i = 1229342037; /*0x5dd9*/
*(_DWORD *)(i + 4) = 92; /*0x5ddf*/
*(_BYTE *)(i + 8) = 1; /*0x5de2*/
StrnCpy((CHAR16 *)(i + 10), "INTEL", 5u); /*0x5de6*/
Length = StrLenA(Source); /*0x5dee*/
StrnCpy((CHAR16 *)(i + 16), Source, Length); /*0x5dfe*/
v9 = _mm_loadu_si128(v5); /*0x5e06*/
*(_WORD *)(i + 52) = 54; /*0x5e0b*/
*(__m128i *)(i + 36) = v9; /*0x5e0f*/
Source_1 = (const CHAR16 *)sub_9368(); /*0x5e14*/
StrnCpy((CHAR16 *)(i + 54), Source_1, 0x26u); /*0x5e24*/
v12 = (__int64 (__fastcall **)(void *, __int64, _QWORD, __int64, void **))Private->field_2A8; /*0x5e29*/
if ( v12 ) /*0x5e37*/
{
LOBYTE(v11) = 1; /*0x5e43*/
RaidVariable = v12[1](Private->field_2A8, i, v11, 14, &Private->DeviceListTail); /*0x5e55*/
}
else
{
DeviceListHead = (void (__fastcall **)(void *))Private->DeviceListHead; /*0x5e5a*/
if ( DeviceListHead ) /*0x5e64*/
{
if ( Private->DeviceListTail ) /*0x5e66*/
DeviceListHead[1](Private->DeviceListHead); /*0x5e75*/
(*(void (__fastcall **)(void *, __int64, __int64, void **))Private->DeviceListHead)( /*0x5e92*/
Private->DeviceListHead,
i,
92,
&Private->DeviceListTail);
RstGetVariableUefi((__int64)Private, L"RstUefiV"); /*0x5e9e*/
RaidVariable = RstGetRaidVariable((__int64)Private, L"VrocHwKeyId"); /*0x5eb2*/
}
else
{
RaidVariable = 0x800000000000000EuLL; /*0x5eb7*/
}
}
if ( RaidVariable >= 0 ) /*0x5ec9*/
{
v14 = (__int64 (__fastcall **)(void *, __int64))Private->field_2A8; /*0x5ecb*/
if ( v14 ) /*0x5ed5*/
RaidVariable = v14[2](Private->field_2A8, 14); /*0x5ee0*/
}
MemZeroThenFree((_BYTE *)i, 92); /*0x5ee9*/
}
return RaidVariable; /*0x5f05*/
}
// Function: RstSetVariableUefi @ 0x5f48 (0x41 bytes)
// Index: 155/906
__int64 __fastcall RstSetVariableUefi(RST_PRIVATE_DATA *Private, wchar_t *RstUefiF)
{
return (*(__int64 (__fastcall **)(wchar_t *, void *, __int64))(RuntimeServices + 88))(RstUefiF, &unk_27178, 2); /*0x5f84*/
}
// Function: RstCheckAlreadyStarted @ 0x6034 (0x55 bytes)
// Index: 159/906
__int64 __fastcall RstCheckAlreadyStarted(RST_PRIVATE_DATA *Private, __int64 a2, char a3)
{
_QWORD *Private_; // rax
__int64 v5; // rbx
_QWORD *p_i; // [rsp+30h] [rbp+8h] BYREF
Private_ = Private->Private_; /*0x6041*/
if ( !Private_ ) /*0x6047*/
return 0; /*0x6049*/
p_i = Private->Private_; /*0x604d*/
while ( *(_QWORD *)(Private_[2] + 8LL) != a2 ) /*0x605a*/
{
Private_ = (_QWORD *)*Private_; /*0x605c*/
p_i = Private_; /*0x605f*/
if ( !Private_ ) /*0x6067*/
return 0; /*0x6067*/
}
v5 = Private_[2]; /*0x606b*/
if ( a3 ) /*0x6071*/
RstInstallConfigAccess(&Private->Private_, &p_i); /*0x607b*/
return v5; /*0x6083*/
}
// Function: RstGetVariable @ 0x7064 (0xa4 bytes)
// Index: 186/906
unsigned __int64 __fastcall RstGetVariable(__int64 a1, __int64 a2, _QWORD *a3)
{
_BYTE *i; // rdi
const CHAR8 *v6; // rax
CHAR8 *v7; // rsi
unsigned int n99; // ebx
if ( !*(_QWORD *)(a1 + 184) ) /*0x7078*/
return 0x8000000000000002uLL; /*0x7093*/
i = (_BYTE *)(a1 + 192); /*0x7095*/
if ( !*(_WORD *)(a1 + 192) ) /*0x709c*/
{
v6 = (const CHAR8 *)sub_A2A4(*(_QWORD *)(a1 + 184)); /*0x70a4*/
v7 = (CHAR8 *)v6; /*0x70a9*/
if ( !v6 ) /*0x70af*/
return 0x8000000000000007uLL; /*0x70bb*/
n99 = AsciiStrLen(v6); /*0x70c8*/
if ( n99 > 0x63 ) /*0x70d6*/
n99 = 99; /*0x70d6*/
MemZero(i, 0, 200); /*0x70db*/
sub_872C(i, n99, v7); /*0x70e8*/
}
*a3 = i; /*0x70ed*/
return 0; /*0x7102*/
}
// Function: RstSetVariable @ 0x7108 (0x87 bytes)
// Index: 187/906
__int64 __fastcall RstSetVariable(_QWORD *a1)
{
if ( !a1[1] || !a1[23] ) /*0x711c*/
return 0x8000000000000002uLL; /*0x717a*/
RstDeviceCheck((__int64)a1); /*0x7126*/
if ( (unsigned int)sub_A4D0(a1[23]) == -1 ) /*0x713a*/
sub_A684(a1[23], 1, a1 + 1); /*0x714c*/
sub_7DD0((__int64)a1); /*0x7154*/
return (*(__int64 (__fastcall **)(_QWORD, void *, _QWORD, _QWORD))(qword_58070 + 336))(a1[1], &unk_27730, a1[3], 0); /*0x7189*/
}