IopQueryXxxInformation

INT64 __stdcall IopQueryXxxInformation(
        FILE_OBJECT *FileObject,
        UINT64 InformationClass,
        UINT64 Length,
        INT8 Mode,
        VOID *Information,
        UINT64 *ReturnedLength,
        UINT8 FileInformation){
  int v8; 
  char v10; 
  _DEVICE_OBJECT *RelatedDeviceObject; 
  int v12; 
  _DEVICE_OBJECT *v13; 
  IRP *Irp; 
  IRP *v15; 
  struct _KEVENT *p_Event; 
  __int64 v17; 
  bool v18; 
  NTSTATUS v19; 
  unsigned int FinalStatus; 
  _ETHREAD *CurrentThread; 
  __int64 v23; 
  INT64 v24; 
  UINT64 v25; 
  UINT8 v26; 
  UINT8 v27; 
  unsigned int v28; 
  __int64 *v29; 
  __int128 v30; 
  struct _KEVENT Event; 
  VOID *retaddr; 
  __int64 v33; 
  int v34; 
  v34 = Length;
  memset(&Event, 0, sizeof(Event));
  v30 = 0i64;
  v8 = InformationClass;
  ObfReferenceObject(FileObject);
  if( (FileObject->Flags & 2) != 0 )
  {
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --*((_WORD *)CurrentThread + 242);
    LODWORD(v23) = KeAbPreAcquire(&FileObject->Lock, 0i64, 0i64);
    LOBYTE(v33) = 0;
    if( _InterlockedExchange((volatile __int32 *)&FileObject->Busy, 1) )
    {
      v29 = &v33;
      LOBYTE(v24) = Mode;
      v28 = IopWaitAndAcquireFileObjectLock(FileObject, v24);
      if( (_BYTE)v33 )
      {
        HalPutDmaAdapter((PADAPTER_OBJECT)FileObject);
        return v28;
      }
    }
    else
    {
      if( v23 )
        *(_BYTE *)(v23 + 26) |= 1u;
      ObfReferenceObject(FileObject);
    }
    KeResetEvent(&FileObject->Event, v25, v26, v27, (IRP *)v29);
    v10 = 1;
  }
  else
  {
    KeInitializeEvent(&Event, SynchronizationEvent, 0);
    v10 = 0;
  }
  RelatedDeviceObject = IoGetRelatedDeviceObject(FileObject);
  v12 = 71;
  v13 = RelatedDeviceObject;
  if( v8 != 75 )
    v12 = v8;
  Irp = IopAllocateIrpExReturn(RelatedDeviceObject, *((_BYTE *)RelatedDeviceObject + 76), v10 ^ 1u, retaddr);
  v15 = Irp;
  if( Irp )
  {
    *((_QWORD *)Irp + 24) = FileObject;
    *((_QWORD *)Irp + 19) = KeGetCurrentThread();
    *((_BYTE *)Irp + 64) = Mode;
    if( v10 )
    {
      *((_BYTE *)Irp + 71) |= 2u;
      p_Event = 0i64;
    }
    else
    {
      *((_DWORD *)Irp + 4) = 4;
      p_Event = &Event;
    }
    *((_QWORD *)v15 + 10) = p_Event;
    *((_QWORD *)v15 + 11) = 0i64;
    v17 = *((_QWORD *)v15 + 23);
    v18 = FileInformation != 0;
    FileInformation = -FileInformation;
    *((_QWORD *)v15 + 9) = &v30;
    *(_QWORD *)(v17 - 24) = FileObject;
    *(_BYTE *)(v17 - 72) = v18 ? 5 : 10;
    *((_DWORD *)v15 + 4) |= 0x10u;
    *((_QWORD *)v15 + 3) = Information;
    *(_DWORD *)(v17 - 64) = v34;
    *(_DWORD *)(v17 - 56) = v12;
    if( v8 == 75 )
      *(_BYTE *)(v17 - 70) |= 1u;
    IopQueueThreadIrp(v15);
    v19 = IofCallDriver(v13, v15);
    FinalStatus = v19;
    if( v10 )
    {
      if( v19 == 259 )
      {
        IopWaitForSynchronousIo(v15, FileObject, Mode);
        FinalStatus = FileObject->FinalStatus;
      }
      IopReleaseFileObjectLock((PADAPTER_OBJECT)FileObject);
    }
    else if( v19 == 259 )
    {
      KeWaitForSingleObject(&Event, Executive, 0, 0, 0i64);
      FinalStatus = v30;
    }
    *(_DWORD *)ReturnedLength = DWORD2(v30);
    return FinalStatus;
  }
  else
  {
    IopAllocateIrpCleanup((PUNICODE_STRING)FileObject);
    return 3221225626i64;
  }
}

Referenced by:

IoQueryFileInformation
IopGetNetworkOpenInformation
IopQueryNameInternal
IopValidateJunctionTarget
MiAttemptPageFileExtension
PfSnGetSectionObject
PfpPrefetchEntireDirectory