HalpDmaAllocateEmergencyResources

INT64 __fastcall HalpDmaAllocateEmergencyResources(_HALP_ALLOC_CONTEXT *a1){
  __int64 v1; 
  PMDL v2; 
  PMDL v3; 
  __int64 v4; 
  __int64 v5; 
  __int64 v7; 
  PMDL v8; 
  MemoryDescriptorList = (PMDL)HalpMmAllocCtxAlloc((__int64)a1, 56i64);
  if( !MemoryDescriptorList )
    return 3221225626i64;
  Mdl = (PMDL)HalpMmAllocCtxAlloc(v1, 56i64);
  v2 = Mdl;
  if( !Mdl )
  {
    v8 = MemoryDescriptorList;
LABEL_10:
    HalpMmAllocCtxFree((__int64)v2, (__int64)v8);
    return 3221225626i64;
  }
  v3 = MemoryDescriptorList;
  *(_DWORD *)&MemoryDescriptorList->Size = 56;
  v3->Next = 0i64;
  v3->StartVa = 0i64;
  *(_QWORD *)&v3->ByteCount = 4096i64;
  *(_DWORD *)&v2->Size = 56;
  v2->Next = 0i64;
  v2->StartVa = 0i64;
  *(_QWORD *)&v2->ByteCount = 4096i64;
  v3->MdlFlags |= 2u;
  v2->MdlFlags |= 2u;
  MappingAddress = MmAllocateMappingAddress(0x1000ui64, 0x206C6148ui64);
  if( !MappingAddress )
  {
    HalpMmAllocCtxFree(v4, (__int64)MemoryDescriptorList);
    v8 = Mdl;
    goto LABEL_10;
  }
  qword_140C53C50 = MmAllocateMappingAddress(0x1000ui64, 0x206C6148ui64);
  if( qword_140C53C50 )
  {
    qword_140CF2318 = 0i64;
    return 0i64;
  }
  HalpMmAllocCtxFree(v5, (__int64)MemoryDescriptorList);
  HalpMmAllocCtxFree(v7, (__int64)Mdl);
  MmFreeMappingAddress(MappingAddress, 0x206C6148u);
  return 3221225626i64;
}

Referenced by:

HalpDmaInit