PiSwIrpSetLifetime

NTSTATUS __stdcall PiSwIrpSetLifetime(_IRP *Irp){
  INT64 v1; 
  _IO_STACK_LOCATION *CurrentStackLocation; 
  int v3; 
  INT64 FsContext2; 
  _IRP *MasterIrp; 
  _ETHREAD *CurrentThread; 

  CurrentStackLocation = Irp->Tail.CurrentStackLocation;
  v3 = 0;
  FsContext2 = (INT64)CurrentStackLocation->FileObject->FsContext2;
  if( CurrentStackLocation->Parameters.Options == 4
    && (MasterIrp = Irp->AssociatedIrp.MasterIrp, *(_DWORD *)&MasterIrp->Type <= 1u) )
  {
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --CurrentThread->Tcb.KernelApcDisable;
    ExAcquireResourceExclusiveLite((UINT64)&PiSwLockObj, 1, v1);
    if( PiSwDeviceOperationsAllowed(FsContext2) )
      *(_DWORD *)(FsContext2 + 180) = *(_DWORD *)&MasterIrp->Type;
    else
      v3 = -1073741637;
    ExReleaseResourceLite(&PiSwLockObj);
    KeLeaveCriticalRegionThread(KeGetCurrentThread());
  }
  else
  {
    v3 = -1073741811;
  }
  Irp->IoStatus.Status = v3;
  IofCompleteRequest(Irp, 0);
  return v3;
}

Referenced by:

PiSwDispatch