HalpCopyDebugDescriptor

DEBUG_DEVICE_DESCRIPTOR *__stdcall HalpCopyDebugDescriptor(DEBUG_DEVICE_DESCRIPTOR *DebugDescriptor){
  UINT64 v3; 
  PSTR v4; 
  PSTR v5; 
  if( !DebugDescriptor )
    return 0i64;
  v3 = DebugDescriptor->OemDataLength + DebugDescriptor->NameSpacePathLength + 248;
  v4 = HalpMmLoaderBlock ? HalpMmAllocateMemoryInternal(v3, MmCached) : (PSTR)ExAllocatePoolWithTag(
                                                                                PagedPool,
                                                                                (unsigned int)v3,
                                                                                0x206C6148ui64);
  v5 = v4;
  if( !v4 )
    return 0i64;
  memset((INT64)v4, 0i64);
  *(_OWORD *)v5 = *(_OWORD *)&DebugDescriptor->Bus;
  *((_OWORD *)v5 + 1) = *(_OWORD *)&DebugDescriptor->ProgIf;
  *((_OWORD *)v5 + 2) = *(_OWORD *)&DebugDescriptor->BaseAddress[0].TranslatedAddress;
  *((_OWORD *)v5 + 3) = *(_OWORD *)&DebugDescriptor->BaseAddress[1].Type;
  *((_OWORD *)v5 + 4) = *(_OWORD *)&DebugDescriptor->BaseAddress[1].Length;
  *((_OWORD *)v5 + 5) = *(_OWORD *)&DebugDescriptor->BaseAddress[2].TranslatedAddress;
  *((_OWORD *)v5 + 6) = *(_OWORD *)&DebugDescriptor->BaseAddress[3].Type;
  *((_OWORD *)v5 + 7) = *(_OWORD *)&DebugDescriptor->BaseAddress[3].Length;
  *((_OWORD *)v5 + 8) = *(_OWORD *)&DebugDescriptor->BaseAddress[4].TranslatedAddress;
  *((_OWORD *)v5 + 9) = *(_OWORD *)&DebugDescriptor->BaseAddress[5].Type;
  *((_OWORD *)v5 + 10) = *(_OWORD *)&DebugDescriptor->BaseAddress[5].Length;
  *((_OWORD *)v5 + 11) = *(_OWORD *)&DebugDescriptor->Memory.MaxEnd.LowPart;
  *((_OWORD *)v5 + 12) = *(_OWORD *)&DebugDescriptor->Memory.Length;
  *((_OWORD *)v5 + 13) = *(_OWORD *)&DebugDescriptor->OemData;
  *((_OWORD *)v5 + 14) = *(_OWORD *)&DebugDescriptor->NameSpacePath;
  *((_QWORD *)v5 + 30) = DebugDescriptor->TransportData;
  *((_QWORD *)v5 + 26) = v5 + 248;
  *((_QWORD *)v5 + 28) = &v5[DebugDescriptor->OemDataLength + 248];
  memmove((UINT8 *)v5 + 248, (UINT8 *)DebugDescriptor->OemData, DebugDescriptor->OemDataLength);
  memmove(*((UINT8 **)v5 + 28), (UINT8 *)DebugDescriptor->NameSpacePath, DebugDescriptor->NameSpacePathLength);
  return(DEBUG_DEVICE_DESCRIPTOR *)v5;
}

Referenced by:

HalpDbgInitSystem