KdpPrint

NTSTATUS __stdcall KdpPrint(
        UINT64 ComponentId,
        UINT64 Level,
        INT8 *Message,
        UINT64 Length,
        INT64 PreviousMode,
        _KTRAP_FRAME *TrapFrame,
        _KTRAP_FRAME *ExceptionFrame,
        UINT8 *Completion){
  __int64 v8; 
  unsigned int v9; 
  NTSTATUS v10; 
  unsigned __int16 v11; 
  INT8 *v12; 
  void *v13; 
  INT8 *v14; 
  UINT8 v15; 
  char Destination[480]; 
  _STRING String; 

  String = 0i64;
  v8 = 101i64;
  if( (unsigned int)ComponentId < 0x9C )
    v8 = (unsigned int)ComponentId;
  v9 = 3;
  if( (unsigned int)ComponentId < 0x9C )
    v9 = Level;
  v10 = 0;
  *Completion = 0;
  if( v9 <= 0x1F )
    v9 = 1 << v9;
  if( (v9 & Kd_WIN2000_Mask) != 0 || (_mm_lfence(), (v9 & *(_DWORD *)*(&KdComponentTable + v8)) != 0) )
  {
    v11 = 512;
    if( (unsigned __int16)Length <= 0x200u )
      v11 = Length;
    if( (_BYTE)PreviousMode )
    {
      if( v11 )
      {
        v12 = &Message[v11];
        if( (unsigned __int64)v12 > 0x7FFFFFFF0000i64 || v12 < Message )
          MEMORY[0x7FFFFFFF0000] = 0;
      }
      v13 = alloca(512i64);
      KdpQuickMoveMemory(Destination, Message, v11);
      Message = v14;
    }
    String.Buffer = Message;
    String.Length = v11;
    KdLogDbgPrint(&String);
    if( !(_BYTE)KdDebuggerNotPresent || KdEventLoggingPresent )
    {
      v15 = KdEnterDebugger(TrapFrame, ExceptionFrame);
      v10 = KdpPrintString(&String) != 0 ? 0x80000003 : 0;
      KdExitDebugger(v15);
    }
    else
    {
      v10 = -1073741667;
    }
  }
  *Completion = 1;
  return v10;
}

Referenced by:

KdpTrap