HalpQueryResources

NTSTATUS __stdcall HalpQueryResources(_DEVICE_OBJECT *DeviceObject, _CM_RESOURCE_LIST **Resources){
  _DWORD *DeviceExtension; 
  unsigned int v3; 
  int v5; 
  NTSTATUS result; 
  _DWORD *v7; 
  VOID **PoolWithTag; 
  _CM_RESOURCE_LIST *v9; 
  __int64 v10; 
  __int64 v11; 
  __int16 v12; 
  PVOID P; 

  DeviceExtension = DeviceObject->DeviceExtension;
  v3 = 0;
  P = 0i64;
  v5 = DeviceExtension[8];
  if( v5 != 129 )
    return(unsigned int)(v5 - 130) > 1 ? 0xC00000BB : 0;
  result = HalpQueryAcpiResourceRequirements((_IO_RESOURCE_REQUIREMENTS_LIST **)&P);
  if( result >= 0 )
  {
    v7 = P;
    PoolWithTag = ExAllocatePoolWithTag(1ui64, (unsigned int)(20 * *((_DWORD *)P + 9) + 39), 543973704i64);
    v9 = (_CM_RESOURCE_LIST *)PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag[2] = 0i64;
      PoolWithTag[3] = 0i64;
      PoolWithTag[4] = 0i64;
      *((_DWORD *)PoolWithTag + 2) = -1;
      *(_DWORD *)PoolWithTag = 1;
      *((_DWORD *)PoolWithTag + 1) = 15;
      *((_DWORD *)PoolWithTag + 3) = 65537;
      *((_DWORD *)PoolWithTag + 4) = v7[9];
      if( v7[9] )
      {
        do
        {
          v10 = 8i64 * v3;
          v11 = 5i64 * v3;
          *(&v9->List[0].PartialResourceList.PartialDescriptors[0].Type + 4 * v11) = BYTE1(v7[v10 + 10]);
          *(&v9->List[0].PartialResourceList.PartialDescriptors[0].ShareDisposition + 4 * v11) = BYTE2(v7[v10 + 10]);
          *(&v9->List[0].PartialResourceList.PartialDescriptors[0].Flags + 2 * v11) = v7[v10 + 11];
          ++v3;
          *((_WORD *)&v9->List[0].PartialResourceList.PartialDescriptors[0].u.Start.anonymous_0.LowPart + 2 * v11) = (unsigned __int8)HalConvertDeviceIdtToIrql((unsigned int)v7[v10 + 12]);
          *(&v9->List[0].PartialResourceList.PartialDescriptors[0].u.Start.anonymous_0.HighPart + v11) = v7[v10 + 12];
          v12 = HIWORD(v7[v10 + 14]);
          *(_QWORD *)(&v9->List[0].PartialResourceList.PartialDescriptors[0].u.Length + v11) = -1i64;
          *((_WORD *)&v9->List[0].PartialResourceList.PartialDescriptors[0].u.Start.u.LowPart + 2 * v11 + 1) = v12;
        }
        while( v3 < v7[9] );
      }
      *Resources = v9;
      ExFreePoolWithTag(v7, 0);
      return 0;
    }
    else
    {
      ExFreePoolWithTag(v7, 0);
      return -1073741670;
    }
  }
  return result;
}

Referenced by:

HalpDispatchPnp