NtGetDevicePowerState

NTSTATUS __stdcall NtGetDevicePowerState(PVOID Device, _DEVICE_POWER_STATE *State){
  __int64 v3; 
  KPROCESSOR_MODE v4; 
  NTSTATUS result; 
  int RelatedTargetDevice; 
  struct _DMA_ADAPTER *v7; 
  PVOID Object; 
  PADAPTER_OBJECT DmaAdapter; 
  DmaAdapter = 0i64;
  if( *((_BYTE *)KeGetCurrentThread() + 562) )
  {
    v3 = 0x7FFFFFFF0000i64;
    if( (unsigned __int64)State < 0x7FFFFFFF0000i64 )
      v3 = (__int64)State;
    *(_DWORD *)v3 = *(_DWORD *)v3;
  }
  v4 = *((_BYTE *)KeGetCurrentThread() + 562);
  Object = 0i64;
  result = ObReferenceObjectByHandle(Device, 0, (POBJECT_TYPE)IoFileObjectType, v4, &Object, 0i64);
  if( result >= 0 )
  {
    RelatedTargetDevice = IoGetRelatedTargetDevice((FILE_OBJECT *)Object, (DEVICE_OBJECT **)&DmaAdapter);
    HalPutDmaAdapter((PADAPTER_OBJECT)Object);
    if( RelatedTargetDevice >= 0 )
    {
      v7 = DmaAdapter;
      *State = PopLockGetDoDevicePowerState((DEVOBJ_EXTENSION *)DmaAdapter[19].DmaOperations);
      HalPutDmaAdapter(v7);
    }
    return RelatedTargetDevice;
  }
  return result;
}

Referenced by:

PfpVolumeOpenAndVerify