IoVerifyVolume

NTSTATUS __stdcall IoVerifyVolume(_DEVICE_OBJECT *DeviceObject, UINT8 AllowRawMount){
  _ETHREAD *CurrentThread; 
  _KEVENT *v5; 
  NTSTATUS v6; 
  _DEVICE_OBJECT *v7; 
  _DEVICE_OBJECT *i; 
  _IRP *Irp; 
  UINT64 v10; 
  _IO_STACK_LOCATION *CurrentStackLocation; 
  _VPB *v12; 
  __int128 v14; 
  __int128 Object; 
  __int64 v16; 
  VOID *retaddr; 
  _VPB *Vpb; 
  _DEVICE_OBJECT *FsDeviceObject; 
  _VPB *v20; 

  FsDeviceObject = 0i64;
  Vpb = 0i64;
  Object = 0i64;
  v16 = 0i64;
  v14 = 0i64;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.KernelApcDisable;
  v5 = (_KEVENT *)DeviceObject->gap118;
  KeWaitForSingleObject((UINT64)DeviceObject->gap118, 0, 0, 0, 0i64);
  if( !IopReferenceVerifyVpb(DeviceObject, &Vpb, &FsDeviceObject) )
  {
    v6 = 0;
LABEL_11:
    if( IopCreateVpb(DeviceObject) < 0
      || (PoVolumeDevice(DeviceObject), v20 = 0i64, IopMountVolume(DeviceObject, AllowRawMount, 1u, 0, &v20) < 0) )
    {
      DeviceObject->Flags &= ~2u;
    }
    else if( v20 )
    {
      IopDecrementVpbRefCount(v20, 1u);
    }
    goto LABEL_16;
  }
  KeInitializeEvent((INT64)&Object, 0, 0);
  v7 = FsDeviceObject;
  for( i = FsDeviceObject->AttachedDevice; i; i = i->AttachedDevice )
    v7 = i;
  Irp = IopAllocateIrpExReturn(v7, v7->StackSize, 0, retaddr);
  v10 = (UINT64)Irp;
  if( !Irp )
  {
    IopDereferenceVpbAndFree(Vpb);
    v6 = -1073741670;
    goto LABEL_16;
  }
  Irp->Flags = 66;
  Irp->RequestorMode = 0;
  Irp->UserEvent = (_KEVENT *)&Object;
  Irp->UserIosb = (_IO_STATUS_BLOCK *)&v14;
  CurrentStackLocation = Irp->Tail.CurrentStackLocation;
  v12 = Vpb;
  Irp->Tail.Thread = (_ETHREAD *)KeGetCurrentThread();
  CurrentStackLocation[-1].Flags = AllowRawMount != 0;
  *(_QWORD *)&CurrentStackLocation[-1].Parameters.Options = FsDeviceObject;
  *(_WORD *)&CurrentStackLocation[-1].MajorFunction = 525;
  CurrentStackLocation[-1].Parameters.SecurityContext = (_IO_SECURITY_CONTEXT *)v12;
  IopQueueThreadIrp(Irp);
  v6 = IofCallDriver((UINT64)v7, v10);
  if( v6 == 259 )
  {
    KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
    v6 = v14;
  }
  IopDereferenceVpbAndFree(v12);
  if( v6 == -1073741806 )
    goto LABEL_11;
LABEL_16:
  KeSetEvent(v5, 0, 0);
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
  return v6;
}

Referenced by:

No references.