PipVisitDeviceObjectListEntry

INT64 __fastcall PipVisitDeviceObjectListEntry(INT64 a1, INT64 *a2, INT64 *r8_0){
  int v5; 
  __int64 v7; 
  __int64 v8; 
  __int64 v9; 
  INT64 *v10; 
  _QWORD *v11; 
  LIST_ENTRY *DependentList; 
  LIST_ENTRY *Flink; 
  int v14; 
  DEVICE_OBJECT *Dependent; 
  UINT64 DependencyTypes; 
  INT64 *a3; 
  Dependent = 0i64;
  a3 = 0i64;
  v5 = *(_DWORD *)(a1 + 16);
  if( (v5 & 2) == 0 )
  {
    *(_DWORD *)(a1 + 16) = v5 | 2;
    v7 = *(_QWORD *)a1;
    if( v7 )
      v8 = *(_QWORD *)(*(_QWORD *)(v7 + 312) + 40i64);
    else
      v8 = 0i64;
    v9 = 0i64;
    if( *(_DWORD *)a2 )
    {
      do
      {
        v10 = &a2[2 * v9 + 2 + v9];
        v11 = (_QWORD *)*v10;
        a3 = v10;
        if( v11 )
          v11 = *(_QWORD **)(v11[39] + 40i64);
        if( v11[2] == v8 || (v11[81] & 0xFFFFFFFFFFFFFFFEui64) == v8 )
          PipVisitDeviceObjectListEntry((INT64)v10, a2, r8_0);
        v9 = (unsigned int)(v9 + 1);
      }
      while( (unsigned int)v9 < *(_DWORD *)a2 );
      v7 = *(_QWORD *)a1;
    }
    DependentList = PiGetDependentList((DEVICE_OBJECT *)v7);
    Flink = DependentList->Flink;
    while( Flink != DependentList )
    {
      PiEnumerateDependentListEntry(Flink, &Dependent, &DependencyTypes);
      Flink = Flink->Flink;
      if( Dependent && PipIsDeviceInDeviceObjectList(a2, (INT64)Dependent, &a3) )
        PipVisitDeviceObjectListEntry((INT64)a3, a2, r8_0);
    }
    v14 = *(_DWORD *)r8_0;
    *(_DWORD *)(a1 + 12) = *(_DWORD *)r8_0;
    *(_DWORD *)r8_0 = v14 + 1;
  }
  return 0i64;
}

Referenced by:

PipSortDeviceObjectList
PipVisitDeviceObjectListEntry