HeadlessTerminalAddResources

NTSTATUS __stdcall HeadlessTerminalAddResources(
        VOID *Resources,
        size_t ResourceListSize,
        UINT8 TranslatedList,
        _CM_RESOURCE_LIST **NewList,
        UINT64 *NewListSize){
  __int64 v8; 
  NTSTATUS result; 
  VOID **PoolWithTag; 
  _CM_RESOURCE_LIST *v11; 
  PHYSICAL_ADDRESS v12; 
  _LARGE_INTEGER TranslatedAddress; 
  __int64 v14; 

  v14 = 0i64;
  TranslatedAddress.anonymous_0.LowPart = 0;
  v8 = ResourceListSize;
  if( !*(&stru_140CF2E80 + 920) || (*(_DWORD *)(*(&stru_140CF2E80 + 920) + 48i64) & 0x1000) != 0 )
  {
    *NewList = 0i64;
    result = 0;
LABEL_3:
    *(_DWORD *)NewListSize = 0;
    return result;
  }
  *(_DWORD *)NewListSize = ResourceListSize + 36;
  if( ResourceListSize + 36 < ResourceListSize
    || (PoolWithTag = ExAllocatePoolWithTag(1ui64, ResourceListSize + 36, 1936483400i64),
        *NewList = (_CM_RESOURCE_LIST *)PoolWithTag,
        (v11 = (_CM_RESOURCE_LIST *)PoolWithTag) == 0i64) )
  {
    result = -1073741670;
    goto LABEL_3;
  }
  memmove(PoolWithTag, Resources, v8);
  v12 = *(PHYSICAL_ADDRESS *)(*(&stru_140CF2E80 + 920) + 64i64);
  if( TranslatedList )
  {
    TranslatedAddress.anonymous_0.LowPart = 1;
    HalTranslateBusAddress(Internal, 0, v12, &TranslatedAddress);
    v11 = *NewList;
  }
  else
  {
    v14 = *(_QWORD *)(*(&stru_140CF2E80 + 920) + 64i64);
  }
  ++v11->Count;
  *(_QWORD *)((char *)&v11->Count + v8) = 1i64;
  *(_DWORD *)((char *)&v11->List[0].PartialResourceList.Version + v8) = 1;
  *(unsigned int *)((char *)&v11->List[0].BusNumber + v8) = 0;
  *(unsigned int *)((char *)&v11->List[0].PartialResourceList.Count + v8) = 66049;
  *(_QWORD *)(&v11->List[0].PartialResourceList.PartialDescriptors[0].Type + v8) = v14;
  result = 0;
  *(LONG *)((char *)&v11->List[0].PartialResourceList.PartialDescriptors[0].u.Start.anonymous_0.HighPart + v8) = 8;
  return result;
}

Referenced by:

IoReportHalResourceUsage