PipDeviceObjectListIndexOf

NTSTATUS __stdcall PipDeviceObjectListIndexOf(
        _DEVICE_OBJECT_LIST *List,
        _DEVICE_OBJECT *Target,
        UINT64 EndIndex,
        _DEVICE_OBJECT_LIST_ENTRY **Result){
  NTSTATUS v4; 
  _DEVICE_OBJECT_LIST_ENTRY *Devices; 

  v4 = 0;
  if( (int)EndIndex <= 0 )
  {
LABEL_5:
    v4 = -1;
    if( Result )
      *Result = 0i64;
  }
  else
  {
    Devices = List->Devices;
    while( Target != Devices->DeviceObject )
    {
      ++v4;
      ++Devices;
      if( v4 >= (int)EndIndex )
        goto LABEL_5;
    }
    if( Result )
      *Result = &List->Devices[v4];
  }
  return v4;
}

Referenced by:

IopMergeRelationLists
IopRemoveRelationFromList
PipIsDeviceInDeviceObjectList