EtwpSendReplyDataBlock

NTSTATUS __stdcall EtwpSendReplyDataBlock(_ETWP_NOTIFICATION_HEADER *DataBlock){
  _ETHREAD *CurrentThread; 
  VOID *ReplyObject; 
  unsigned int ReplyIndex; 
  int v5; 
  _ADAPTER_OBJECT *v6; 
  _ETW_QUEUE_ENTRY *v7; 
  _ETW_REG_ENTRY *v8; 
  PADAPTER_OBJECT DmaAdapter; 

  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  ReplyObject = DataBlock->ReplyObject;
  ReplyIndex = DataBlock->ReplyIndex;
  --CurrentThread->Tcb.KernelApcDisable;
  DmaAdapter = 0i64;
  v5 = ObReferenceObjectByHandle(ReplyObject, 4ui64, EtwpRegistrationObjectType, 1, (VOID **)&DmaAdapter, 0i64);
  if( v5 >= 0 )
  {
    v6 = DmaAdapter;
    if( (DmaAdapter->AdapterObject.CrashDump.ContiguousHint.Offset & 0x20000) != 0 )
    {
      if( ReplyIndex >= 4 )
      {
        v5 = -1073741811;
      }
      else
      {
        v7 = (_ETW_QUEUE_ENTRY *)_InterlockedExchange64(
                                   (volatile __int64 *)&DmaAdapter->AdapterObject.ScatterTranslations + ReplyIndex,
                                   0i64);
        if( v7 )
        {
          v8 = v7->ReplyObject;
          if( (v8->Flags & 0x40) != 0 )
            v5 = -1073741055;
          else
            v5 = EtwpQueueReply((PRKQUEUE)v8->ReplyQueue, DataBlock);
          EtwpReleaseQueueEntry(v7, 2ui64);
        }
        else
        {
          v5 = -1073741811;
        }
        v6 = DmaAdapter;
      }
    }
    else
    {
      v5 = -1073741816;
    }
    HalPutDmaAdapter(v6);
  }
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
  return v5;
}

Referenced by:

NtTraceControl