PnprInitiateReplaceOperation

__int64 PnprInitiateReplaceOperation(){
  char v0; 
  char v1; 
  _WORK_QUEUE_ITEM *v2; 
  _WORK_QUEUE_ITEM *PoolWithTag; 
  __int64 v4; 
  int v5; 
  int v6; 
  int v7; 
  __int64 v8; 
  int v9; 
  int v10; 
  __int64 v11; 
  int v12; 
  int v13; 
  unsigned __int8 CurrentIrql; 
  __int64 v15; 
  int v16; 
  int v17; 
  __int64 v18; 
  int v19; 
  int v20; 
  unsigned int v21; 
  _MM_MIRROR_DISPATCH MirrorDispatch[4]; 
  __int128 v24; 
  __int64 v25; 

  *(_OWORD *)MirrorDispatch = 0i64;
  v24 = 0i64;
  v25 = 0i64;
  v0 = 0;
  v1 = 0;
  v2 = 0i64;
  KeInitializeEvent(PnprContext + 20760, 0, 0);
  KeInitializeEvent(PnprContext + 20784, 0, 0);
  KeInitializeEvent(PnprContext + 20808, 0, 0);
  KeInitializeEvent(PnprContext + 20832, 0, 0);
  if( (*(_DWORD *)(PnprContext + 64) & 0x20) == 0 )
  {
    PoolWithTag = (_WORK_QUEUE_ITEM *)ExAllocatePoolWithTag(0x200ui64, 0x20ui64, 1366322768i64);
    v2 = PoolWithTag;
    if( !PoolWithTag )
    {
      v4 = PnprContext;
      v5 = -1073741670;
      v6 = *(_DWORD *)(PnprContext + 20984);
      if( !v6 )
        v6 = 1663;
      v7 = *(_DWORD *)(PnprContext + 20988);
      *(_DWORD *)(PnprContext + 20984) = v6;
      if( !v7 )
        v7 = 10;
      *(_DWORD *)(v4 + 20988) = v7;
      goto LABEL_39;
    }
    PoolWithTag->List.Flink = 0i64;
    PoolWithTag->WorkerRoutine = (void(__fastcall *)(void *))PnprQuiesceWorker;
    PoolWithTag->Parameter = PoolWithTag;
    ExQueueWorkItem(PoolWithTag, CriticalWorkQueue);
  }
  v5 = PnprReplaceStart();
  if( v5 < 0 )
  {
    v8 = PnprContext;
    v9 = *(_DWORD *)(PnprContext + 20984);
    if( !v9 )
      v9 = 1678;
    *(_DWORD *)(PnprContext + 20984) = v9;
    v10 = *(_DWORD *)(v8 + 20988);
    if( !v10 )
      v10 = 1;
    *(_DWORD *)(v8 + 20988) = v10;
    goto LABEL_39;
  }
  v1 = 1;
  if( !*(_DWORD *)(*(_QWORD *)(PnprContext + 24) + 4i64) )
    goto LABEL_25;
  if( (*(_DWORD *)(PnprContext + 64) & 8) == 0 )
  {
    *((_QWORD *)&v24 + 1) = 0i64;
    *(_QWORD *)MirrorDispatch = PnprStartMirroring;
    *(_QWORD *)&MirrorDispatch[2] = PnprEndMirroring;
    *(_QWORD *)&v24 = PnprMirrorPhysicalMemory;
    v25 = 8i64;
    v5 = MmDuplicateMemory(MirrorDispatch);
    if( v5 == 1073742484 )
      v5 = 0;
    goto LABEL_39;
  }
  v5 = (*(__int64(__fastcall **)(_QWORD))(PnprContext + 20952))(*(_QWORD *)(PnprContext + 20880));
  if( v5 < 0 )
  {
    v11 = PnprContext;
    v12 = *(_DWORD *)(PnprContext + 20984);
    if( !v12 )
      v12 = 1746;
    *(_DWORD *)(PnprContext + 20984) = v12;
    v13 = *(_DWORD *)(v11 + 20988);
    if( !v13 )
      v13 = 8;
    *(_DWORD *)(v11 + 20988) = v13;
  }
  else
  {
LABEL_25:
    CurrentIrql = KeGetCurrentIrql();
    v5 = PnprQuiesce();
    if( v5 < 0 )
    {
      v18 = PnprContext;
      v19 = *(_DWORD *)(PnprContext + 20984);
      if( !v19 )
        v19 = 1779;
      *(_DWORD *)(PnprContext + 20984) = v19;
      v20 = *(_DWORD *)(v18 + 20988);
      if( !v20 )
        v20 = 1;
      *(_DWORD *)(v18 + 20988) = v20;
    }
    else
    {
      v0 = 1;
      v5 = PnprSwap();
      if( v5 < 0 )
      {
        ((void(__fastcall *)(__int64, _QWORD))off_140C00688[0])(3i64, *(_QWORD *)(PnprContext + 20872));
        v15 = PnprContext;
        v16 = *(_DWORD *)(PnprContext + 20984);
        if( !v16 )
          v16 = 1769;
        *(_DWORD *)(PnprContext + 20984) = v16;
        v17 = *(_DWORD *)(v15 + 20988);
        if( !v17 )
          v17 = 1;
        *(_DWORD *)(v15 + 20988) = v17;
      }
      PnprWakeProcessors();
    }
    __writecr8(CurrentIrql);
  }
LABEL_39:
  if( (*(_DWORD *)(PnprContext + 64) & 0x20) != 0 )
  {
    if( v0 )
      PnprCompleteWake();
  }
  else if( v2 )
  {
    KeSetEvent((PRKEVENT)(PnprContext + 20808), 0, 0);
    KeWaitForSingleObject(PnprContext + 20832, 0, 0, 0, 0i64);
  }
  if( *(_QWORD *)(PnprContext + 20872) )
    off_140C00690[0]();
  if( v1 )
  {
    if( *(_DWORD *)(*(_QWORD *)(PnprContext + 24) + 4i64) )
    {
      v21 = (*(__int64(__fastcall **)(_QWORD))(PnprContext + 20920))(*(_QWORD *)(PnprContext + 20880));
      if( v5 >= 0 )
        return v21;
    }
  }
  return(unsigned int)v5;
}

Referenced by:

No references.