Newer
Older
AMI-Aptio-BIOS-Reversed / Platform / SetupKeywordHandler.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Init
// SetupKeywordHandler - decompiled from Platform.efi
void *__fastcall SetupKeywordHandler(__int64 a1, __int64 a2, void *ZeroPool_1, __int64 a4)
{
  __int64 v4; // rax
  void *ZeroPool; // rbx
  __int64 v10; // rax
  UINTN v11[5]; // [rsp+30h] [rbp-28h] BYREF
  char v12; // [rsp+78h] [rbp+20h] BYREF

  v4 = qword_FF98; /*0x971e*/
  if ( !qword_FF98 ) /*0x9734*/
  {
    if ( (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *, __int64))(BootServices + 320))( /*0x9756*/
           &unk_FBE0,
           0,
           &qword_FF98,
           a4) < 0 )
      return 0; /*0x9756*/
    v4 = qword_FF98; /*0x9758*/
    if ( !qword_FF98 ) /*0x9762*/
      return 0; /*0x9762*/
  }
  v11[0] = 0; /*0x976b*/
  if ( ZeroPool_1 ) /*0x9773*/
  {
    ZeroPool = ZeroPool_1; /*0x9775*/
  }
  else
  {
    LOBYTE(a4) = 1; /*0x9784*/
    v10 = (*(__int64 (__fastcall **)(__int64, UINTN *, char *, __int64, __int64, __int64))(v4 + 8))( /*0x9794*/
            v4,
            v11,
            &v12,
            a4,
            a1,
            a2);
    if ( v10 >= 0 ) /*0x979a*/
      return AllocateZeroPool(2u); /*0x97a6*/
    if ( v10 != 0x8000000000000005uLL ) /*0x97b5*/
      return 0; /*0x97b5*/
    ZeroPool = AllocateZeroPool(v11[0]); /*0x97c1*/
    if ( !ZeroPool ) /*0x97c7*/
      return 0; /*0x9766*/
    v4 = qword_FF98; /*0x97c9*/
  }
  LOBYTE(a4) = ZeroPool_1 == 0; /*0x97e0*/
  if ( (*(__int64 (__fastcall **)(__int64, UINTN *, void *, __int64, __int64, __int64))(v4 + 8))( /*0x97f2*/
         v4,
         v11,
         ZeroPool,
         a4,
         a1,
         a2) < 0 )
    return 0; /*0x97f2*/
  return ZeroPool; /*0x9803*/
}