Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyRpPkg / Platform / Dxe / Setup / DxePlatform / Platform / SetupIfrConfigAccess.c
@Ajax Dong Ajax Dong 2 days ago 2 KB Restructure the repo
// SetupIfrConfigAccess - decompiled from Platform.efi
void *__fastcall SetupIfrConfigAccess(__int64 a1, unsigned __int16 n1310, __int64 a3)
{
  void *ZeroPool; // rbx
  __int64 v6; // rcx
  char *x_UEFI; // rbp
  const void *n512; // r8
  void *v9; // r9
  void *AllHandlesByProtocol; // rdi
  UINTN v12[7]; // [rsp+40h] [rbp-38h] BYREF
  __int64 v13; // [rsp+90h] [rbp+18h] BYREF
  void *v14; // [rsp+98h] [rbp+20h] BYREF

  v13 = a3; /*0xa6dd*/
  if ( !a1 ) /*0xa6fa*/
    Assert((__int64)"e:\\hs\\MdeModulePkg\\Library\\UefiHiiLib\\HiiString.c", 238, (__int64)"HiiHandle != ((void *) 0)"); /*0xa70f*/
  if ( !n1310 ) /*0xa718*/
    Assert((__int64)"e:\\hs\\MdeModulePkg\\Library\\UefiHiiLib\\HiiString.c", 239, (__int64)"StringId != 0"); /*0xa72d*/
  v14 = 0; /*0xa735*/
  ZeroPool = 0; /*0xa73d*/
  x_UEFI = (char *)SetupIfrOptionLookup(a1); /*0xa745*/
  if ( x_UEFI ) /*0xa74b*/
  {
    LocateHandleBuffer(v6, (__int64 *)&v14, n512); /*0xa759*/
    v9 = &unk_EF3A; /*0xa76d*/
    if ( v14 ) /*0xa775*/
      v9 = v14; /*0xa775*/
    AllHandlesByProtocol = GetAllHandlesByProtocol(x_UEFI, 0, &unk_EF3A, v9, x_UEFI, 0); /*0xa78d*/
    if ( AllHandlesByProtocol ) /*0xa793*/
    {
      v12[0] = 0; /*0xa7b4*/
      if ( (*(__int64 (__fastcall **)(__int64, void *, __int64, _QWORD, __int64 *, UINTN *, _QWORD))(qword_FF68 + 8))( /*0xa7de*/
             qword_FF68,
             AllHandlesByProtocol,
             a1,
             n1310,
             &v13,
             v12,
             0) == 0x8000000000000005uLL )
      {
        ZeroPool = AllocateZeroPool(v12[0]); /*0xa7ea*/
        if ( ZeroPool ) /*0xa7f0*/
        {
          if ( (*(__int64 (__fastcall **)(__int64, void *, __int64, _QWORD, void *, UINTN *, _QWORD))(qword_FF68 + 8))( /*0xa821*/
                 qword_FF68,
                 AllHandlesByProtocol,
                 a1,
                 n1310,
                 ZeroPool,
                 v12,
                 0) < 0 )
          {
            ExtractConfig(); /*0xa826*/
            ZeroPool = 0; /*0xa82b*/
          }
        }
      }
    }
    ExtractConfig(); /*0xa831*/
    if ( v14 ) /*0xa83e*/
      ExtractConfig(); /*0xa848*/
    if ( AllHandlesByProtocol ) /*0xa850*/
      ExtractConfig(); /*0xa855*/
  }
  return ZeroPool; /*0xa865*/
}