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; 
  int v11; 
  unsigned int v12; 
  unsigned __int64 v13; 
  UINT64 v14; 
  __int64 v15; 
  struct _EX_RUNDOWN_REF *v16; 
  unsigned __int8 CurrentIrql; 
  void **v18; 
  void **v19; 
  void(__fastcall *v20)(_QWORD, _QWORD, _QWORD); 
  char dst[96]; 
  int v22; 
  STRING Output; 
  NTSTRSAFE_PCSTR pszFormat; 
  unsigned __int64 v25; 
  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 = dst;
    v12 += 128;
    v13 = -1i64;
    do
      ++v13;
    while( Prefix[v13] );
    v25 = v13;
    v14 = v12 - 1;
    if( v13 <= v14 )
      v14 = v13;
    memmove((UINT8 *)dst, (UINT8 *)Prefix, v14);
    v11 = RtlStringCbVPrintfA(&dst[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 && RtlpDebugPrintCallbacksActive == 1 )
  {
    v16 = 0i64;
    CurrentIrql = KeGetCurrentIrql();
    if( CurrentIrql < 0xCu )
    {
      KeGetCurrentIrql();
      __writecr8(0xCui64);
    }
    ExAcquireSpinLockSharedAtDpcLevel(&RtlpDebugPrintCallbackLock);
    v18 = (void **)RtlpDebugPrintCallbackList;
    if( RtlpDebugPrintCallbackList != &RtlpDebugPrintCallbackList )
    {
      do
      {
        v19 = v18 - 3;
        if( ExAcquireRundownProtection((PEX_RUNDOWN_REF)v18 - 2) )
        {
          ExReleaseSpinLockSharedFromDpcLevel(&RtlpDebugPrintCallbackLock);
          v20 = (void(__fastcall *)(_QWORD, _QWORD, _QWORD))v19[2];
          if( v16 )
            ExReleaseRundownProtection(v16 + 1);
          v16 = (struct _EX_RUNDOWN_REF *)v19;
          v20(&Output, v7, v6);
          ExAcquireSpinLockSharedAtDpcLevel(&RtlpDebugPrintCallbackLock);
          v18 = (void **)v19[3];
        }
        else
        {
          v18 = (void **)*v18;
        }
      }
      while( v18 != &RtlpDebugPrintCallbackList );
    }
    ExReleaseSpinLockSharedFromDpcLevel(&RtlpDebugPrintCallbackLock);
    if( v16 )
      ExReleaseRundownProtection(v16 + 1);
    if( CurrentIrql < 0xCu )
      __writecr8(CurrentIrql);
  }
  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