IopQueryDeviceState

NTSTATUS __stdcall IopQueryDeviceState(PDEVICE_OBJECT DeviceObject, PPNP_DEVICE_STATE DeviceState, UINT64 a3){
  NTSTATUS result; 
  _IO_STACK_LOCATION TopStackLocation; 
  UINT64 Information; 

  Information = 0i64;
  memset(&TopStackLocation, 0i64, sizeof(TopStackLocation));
  *(_WORD *)&TopStackLocation.MajorFunction = 5147;
  result = IopSynchronousCall(DeviceObject, &TopStackLocation, 3221225659i64, 0i64, &Information);
  if( result >= 0 )
  {
    if( DeviceState )
      *DeviceState = Information;
  }
  return result;
}

Referenced by:

PiProcessCanceledRemoveForReset
PiProcessQueryDeviceState
PiRestartRemovalRelations