EtwpGetScsiPassThroughCdb

_CDB *__stdcall EtwpGetScsiPassThroughCdb(_IRP *Irp){
  _IO_STACK_LOCATION *CurrentStackLocation; 
  _CDB *v2; 
  int v3; 
  unsigned __int64 v4; 
  __int64 v5; 
  union {_IRP *MasterIrp;int IrpCount;void *SystemBuffer;} v6; 
  unsigned int Options; 
  bool v8; 
  _CDB *v9; 
  bool v10; 

  CurrentStackLocation = Irp->Tail.CurrentStackLocation;
  v2 = 0i64;
  v3 = *(_DWORD *)&CurrentStackLocation->Parameters.FileAttributes;
  if( v3 != 315396 )
  {
    v4 = (unsigned int)(v3 - 315412);
    if( (unsigned int)v4 > 0x34 )
      return v2;
    v5 = 0x11000000000001i64;
    if( !_bittest64(&v5, v4) )
      return v2;
  }
  v6.MasterIrp = (_IRP *)Irp->AssociatedIrp;
  if( !v6.MasterIrp )
    return v2;
  Options = CurrentStackLocation->Parameters.Options;
  v8 = ((v3 - 315460) & 0xFFFFFFFB) != 0;
  if( IoIs32bitProcess(Irp) )
  {
    if( v8 )
    {
      v9 = (_CDB *)((char *)&v6.MasterIrp->AssociatedIrp.SystemBuffer + 4);
      v10 = Options < 0x2C;
LABEL_12:
      if( v10 )
        return 0i64;
      return v9;
    }
    if( Options >= 0x34 )
      return(_CDB *)&v6.MasterIrp->IoStatus;
  }
  else
  {
    if( v8 )
    {
      v9 = (_CDB *)((char *)&v6.MasterIrp->ThreadListEntry.Flink + 4);
      v10 = Options < 0x38;
      goto LABEL_12;
    }
    if( Options >= 0x40 )
      return(_CDB *)&v6.MasterIrp->IoStatus.Information;
  }
  return v2;
}

Referenced by:

EtwpTraceOpticalIo
EtwpTraceOpticalIoInit