PiPnpAddDeviceToPdoDeviceListEnumContext

INT64 __fastcall PiPnpAddDeviceToPdoDeviceListEnumContext(UINT64 *a1, INT64 a2){
  UINT8 *v2; 
  __int64 v5; 
  __int64 v7; 
  UINT8 *PoolWithTag; 
  UINT8 *v9; 
  v2 = (UINT8 *)a1[1];
  if( v2 )
  {
    v5 = *(unsigned int *)v2;
    if( (_DWORD)v5 != *(_DWORD *)a1 )
    {
LABEL_3:
      *(_QWORD *)&v2[8 * v5 + 8] = a2;
      ++*(_DWORD *)a1[1];
      return 0i64;
    }
  }
  v7 = (unsigned int)(*(_DWORD *)a1 + 256);
  PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(PagedPool, 8 * v7 + 8, 0x20207050ui64);
  v2 = PoolWithTag;
  if( PoolWithTag )
  {
    *(_DWORD *)PoolWithTag = 0;
    memset((INT64)&PoolWithTag[8 * *(unsigned int *)a1 + 8], 0i64);
    v9 = (UINT8 *)a1[1];
    if( v9 )
    {
      memmove(v2, v9, 8i64 * *(unsigned int *)a1 + 8);
      ExFreePoolWithTag((PVOID)a1[1], 0);
    }
    *(_DWORD *)a1 = v7;
    a1[1] = (UINT64)v2;
    v5 = *(unsigned int *)v2;
    goto LABEL_3;
  }
  return 3221225626i64;
}

Referenced by:

PiPnpPdoDeviceListEnumCallback