IoResolveDependency

NTSTATUS __stdcall IoResolveDependency(UNICODE_STRING *BindingId, DEVICE_OBJECT *Device){
  NTSTATUS v4; 
  INT64 *BindingResolution; 
  INT64 v6; 
  __int64 v7; 
  __int64 v8; 
  __int64 v9; 
  INT64 v10; 
  __int64 v11; 
  __int64 v12; 
  __int64 v14; 
  DEVICE_OBJECT *v15; 
  __int64 v16; 
  INT64 v17; 
  __int64 v18; 
  INT64 a1; 
  void *v20; 
  v4 = 0;
  PnpAcquireDependencyRelationsLock(1u);
  a1 = 1i64;
  v20 = BindingId;
  BindingResolution = PipQueryBindingResolution((INT64)&a1);
  v6 = (INT64)BindingResolution;
  if( BindingResolution )
  {
    v15 = (DEVICE_OBJECT *)BindingResolution[6];
    if( v15 )
    {
      if( v15 == Device )
        goto LABEL_15;
      v4 = PipDeleteBindingId(v6, BindingId);
      v6 = 0i64;
    }
    if( v6 )
    {
      if( !*(_QWORD *)(v6 + 48) )
      {
        if( Device )
          v16 = *(_QWORD *)(*((_QWORD *)Device + 39) + 80i64);
        else
          v16 = 0i64;
        if( v16 )
        {
          if( Device )
            v17 = *(_QWORD *)(*((_QWORD *)Device + 39) + 80i64);
          else
            v17 = 0i64;
          PipMergeDependencyNodes(v17, v6);
        }
        else
        {
          PipLinkDeviceObjectAndDependencyNode((INT64)Device, v6);
        }
      }
      goto LABEL_8;
    }
  }
  if( Device )
    v7 = *(_QWORD *)(*((_QWORD *)Device + 39) + 80i64);
  else
    v7 = 0i64;
  if( !v7 )
  {
    LODWORD(a1) = 0;
    v20 = Device;
    v8 = PipCreateDependencyNode(&a1);
    v10 = v8;
    if( v8 )
    {
      v4 = PipAddBindingId(v8, BindingId, v9);
      if( v4 >= 0 )
      {
        PipDereferenceDependencyNode(v10);
        goto LABEL_8;
      }
      PipUnlinkDeviceObjectAndDependencyNode((INT64)Device, v10);
      PipDereferenceDependencyNode(v10);
    }
    else
    {
      v4 = -1073741670;
    }
LABEL_15:
    PnpReleaseDependencyRelationsLock();
    return v4;
  }
  if( Device )
    v14 = *(_QWORD *)(*((_QWORD *)Device + 39) + 80i64);
  else
    v14 = 0i64;
  v4 = PipAddBindingId(v14, BindingId, v6);
  if( v4 < 0 )
    goto LABEL_15;
LABEL_8:
  if( Device )
  {
    v11 = *((_QWORD *)Device + 39);
    v12 = *(_QWORD *)(v11 + 40);
    if( v12 )
    {
      if( (*(_DWORD *)(v12 + 396) & 0x20000) == 0 && PipIsProviderStarted(*(_QWORD *)(v11 + 40)) )
        PipAttemptDependentsStart(v18);
    }
  }
  PipAddtoRebuildPowerRelationsQueue(Device);
  PipAddDependentsToRebuildPowerRelationsQueue(Device);
  PnpReleaseDependencyRelationsLock();
  PipProcessRebuildPowerRelationsQueue();
  return v4;
}

Referenced by:

No references.