ViFilterDispatchPnp

NTSTATUS __stdcall ViFilterDispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp){
  _DWORD *DeviceExtension; 
  int v5; 
  NTSTATUS v6; 
  _DEVICE_OBJECT *v8; 
  _IO_STACK_LOCATION *CurrentStackLocation; 
  unsigned __int8 MinorFunction; 
  _IO_STACK_LOCATION *v11; 
  PIRP v12; 
  NTSTATUS(__stdcall *v13)(_DEVICE_OBJECT *, _IRP *, VOID *); 
  _IO_STACK_LOCATION *v14; 
  NTSTATUS Status; 
  UINT64 RemlockSize; 
  _DWORD *v17; 

  DeviceExtension = DeviceObject->DeviceExtension;
  v17 = DeviceExtension;
  while( (DeviceExtension[25] & 1) == 0 )
    _mm_pause();
  LODWORD(RemlockSize) = 32;
  v5 = IoAcquireRemoveLockEx((_IO_REMOVE_LOCK *)(v17 + 8), Irp, (CHAR *)&byte_1409C4470, 1ui64, RemlockSize);
  v6 = v5;
  if( v5 < 0 )
  {
    Irp->IoStatus.Status = v5;
    IofCompleteRequest(Irp, 0);
    return v6;
  }
  v8 = (_DEVICE_OBJECT *)*((_QWORD *)v17 + 1);
  CurrentStackLocation = Irp->Tail.CurrentStackLocation;
  MinorFunction = CurrentStackLocation->MinorFunction;
  *(_OWORD *)&CurrentStackLocation[-1].MajorFunction = *(_OWORD *)&CurrentStackLocation->MajorFunction;
  *(_OWORD *)&CurrentStackLocation[-1].Parameters.Options = *(_OWORD *)&CurrentStackLocation->Parameters.Options;
  *(_OWORD *)&CurrentStackLocation[-1].Parameters.EaLength = *(_OWORD *)&CurrentStackLocation->Parameters.EaLength;
  CurrentStackLocation[-1].FileObject = CurrentStackLocation->FileObject;
  CurrentStackLocation[-1].Control = 0;
  if( !MinorFunction )
  {
    v11 = Irp->Tail.CurrentStackLocation;
    v13 = ViFilterStartCompletionRoutine;
    v12 = Irp;
    v11[-1].Control = -32;
LABEL_14:
    v11[-1].CompletionRoutine = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *, void *))v13;
    v11[-1].Context = &v17;
    return IofCallDriver((UINT64)v8, (UINT64)v12);
  }
  if( MinorFunction != 2 )
  {
    v11 = Irp->Tail.CurrentStackLocation;
    v12 = Irp;
    v11[-1].Control = -32;
    if( MinorFunction == 22 )
      v13 = ViFilterDeviceUsageNotificationCompletion;
    else
      v13 = ViFilterGenericCompletionRoutine;
    goto LABEL_14;
  }
  KeInitializeEvent((INT64)(v17 + 16), 0, 0);
  v14 = Irp->Tail.CurrentStackLocation;
  v14[-1].CompletionRoutine = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *, void *))ViFilterRemoveNotificationCompletion;
  v14[-1].Context = &v17;
  v14[-1].Control = -32;
  Status = IofCallDriver((UINT64)v8, (UINT64)Irp);
  if( Status == 259 )
  {
    KeWaitForSingleObject((UINT64)(v17 + 16), 0, 0, 0, 0i64);
    Status = Irp->IoStatus.Status;
  }
  IoReleaseRemoveLockAndWaitEx((PIO_REMOVE_LOCK)(v17 + 8), Irp, 0x20u);
  IoDetachDevice(v8);
  IoDeleteDevice(DeviceObject);
  IofCompleteRequest(Irp, 0);
  return Status;
}

Referenced by:

No references.