vDbgPrintExWithPrefixInternal

UINT64 __stdcall vDbgPrintExWithPrefixInternal(
        INT8 *Prefix,
        UINT64 ComponentId,
        UINT64 Level,
        INT8 *Format,
        INT8 *arglist,
        UINT8 ControlC){
  unsigned int v6; 
  unsigned int v7; 
  UINT64 result; 
  char *v10; 
  NTSTATUS v11; 
  unsigned int v12; 
  unsigned __int64 v13; 
  unsigned __int64 v14; 
  __int64 v15; 
  _EX_RUNDOWN_REF *v16; 
  unsigned __int8 CurrentIrql; 
  _EX_RUNDOWN_REF *v18; 
  _EX_RUNDOWN_REF *v19; 
  void(__fastcall *Count)(_STRING *, _QWORD, _QWORD); 
  char v21[96]; 
  NTSTATUS v22; 
  _STRING Output; 
  _NTSTRSAFE_PCSTR pszFormat[2]; 
  unsigned __int64 v25; 

  *(_QWORD *)pszFormat = Format;
  v6 = Level;
  v7 = ComponentId;
  Output = 0i64;
  if( !NtQueryDebugFilterState((unsigned int)ComponentId, (unsigned int)Level) )
    return 0i64;
  v10 = 0i64;
  v11 = 0;
  v22 = 0;
  v12 = 0;
  do
  {
    if( v12 >= 0x200 )
      break;
    v10 = v21;
    v12 += 128;
    v13 = -1i64;
    do
      ++v13;
    while( Prefix[v13] );
    v25 = v13;
    v14 = v12 - 1;
    if( v13 <= v14 )
      v14 = v13;
    memmove(v21, Prefix, v14);
    v11 = RtlStringCbVPrintfA(&v21[v14], v12 - v14, *(INT8 **)pszFormat, arglist);
    v22 = v11;
    if( v11 >= 0 )
      break;
  }
  while( v11 == -2147483643 );
  if( v11 == -2147483643 )
  {
    v10[v12 - 2] = 10;
    LOWORD(v15) = v12 - 1;
    v10[v12 - 1] = 0;
  }
  else
  {
    v15 = -1i64;
    do
      ++v15;
    while( v10[v15] );
  }
  Output.Buffer = v10;
  Output.Length = v15;
  if( (KiBugCheckActive & 3) == 0 && byte_140C50450 == 1 )
  {
    v16 = 0i64;
    CurrentIrql = KeGetCurrentIrql();
    if( CurrentIrql < 0xCu )
    {
      KeGetCurrentIrql();
      __writecr8(0xCui64);
    }
    ExAcquireSpinLockSharedAtDpcLevel((PEX_SPIN_LOCK)&unk_140CEC520);
    v18 = (_EX_RUNDOWN_REF *)*(&stru_140C00F40 + 892);
    while( v18 != (_EX_RUNDOWN_REF *)((char *)&stru_140C00F40 + 7136) )
    {
      v19 = v18 - 3;
      if( ExAcquireRundownProtection(v18 - 2) )
      {
        ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)&unk_140CEC520);
        Count = (void(__fastcall *)(_STRING *, _QWORD, _QWORD))v19[2].Count;
        if( v16 )
          ExReleaseRundownProtection(v16 + 1);
        v16 = v19;
        Count(&Output, v7, v6);
        ExAcquireSpinLockSharedAtDpcLevel((PEX_SPIN_LOCK)&unk_140CEC520);
        v18 = (_EX_RUNDOWN_REF *)v19[3].Count;
      }
      else
      {
        v18 = (_EX_RUNDOWN_REF *)v18->Count;
      }
    }
    ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)&unk_140CEC520);
    if( v16 )
      ExReleaseRundownProtection(v16 + 1);
    if( CurrentIrql < 0xCu )
      __writecr8(CurrentIrql);
  }
  LODWORD(result) = DebugPrint(&Output, v7, v6);
  if( (_DWORD)result == -2147483645 && ControlC == 1 )
  {
    DbgBreakPointWithStatus(1u);
    return 0i64;
  }
  return result;
}

Referenced by:

DbgPrint
DbgPrintEx
DbgPrintReturnControlC
IopDebugPrint
KsepDebugPrint
PopPrintEx
VfUtilDbgPrint
vDbgPrintEx
vDbgPrintExWithPrefix