HdlspAddLogEntry

VOID __fastcall HdlspAddLogEntry(WCHAR *String){
  __int64 v2; 
  void *v3; 
  UINT64 v4; 
  UINT8 *PoolWithTag; 
  UINT64 v6; 
  UINT8 *v7; 
  unsigned __int8 v8; 
  unsigned __int8 v9; 
  PKSPIN_LOCK v10; 
  __int16 v11; 
  __int64 v12; 
  unsigned __int16 v13; 
  WCHAR *v14; 
  NTSTATUS v15; 
  __int64 v16; 
  KSPIN_LOCK v17; 
  __int128 SystemInformation; 
  __int128 v19; 
  __int128 v20; 
  v2 = -1i64;
  v3 = 0i64;
  SystemInformation = 0i64;
  v19 = 0i64;
  v20 = 0i64;
  do
    ++v2;
  while( String[v2] );
  v4 = 2 * v2 + 2;
  if( KeGetCurrentIrql() < 2u )
  {
    if( (int)ZwQuerySystemInformation() < 0 )
    {
      SystemInformation = 0i64;
      v19 = 0i64;
      v20 = 0i64;
    }
    PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(NonPagedPoolNx, v4, 0x736C6448ui64);
    v7 = PoolWithTag;
    if( PoolWithTag )
      memmove(PoolWithTag, (UINT8 *)String, v4);
    if( (HeadlessGlobals[6] & 2) != 0 )
    {
      v9 = -1;
    }
    else
    {
      KeAcquireSpinLockRaiseToDpc(HeadlessGlobals, v6);
      v9 = v8;
    }
    v10 = HeadlessGlobals;
    v11 = *((_WORD *)HeadlessGlobals + 48);
    *((_DWORD *)HeadlessGlobals + 12) |= 4u;
    v12 = *((unsigned __int16 *)v10 + 49);
    v13 = (unsigned __int8)(v11 + 1);
    *((_WORD *)v10 + 48) = v13;
    if( v13 == (_WORD)v12 )
    {
      v14 = *(WCHAR **)(56 * v12 + v10[2] + 48);
      v15 = wcscmp(v14, (PWCHAR)L"Entry could not be recorded due to lack of memory.\n");
      *((_WORD *)v10 + 49) = (unsigned __int8)(v12 + 1);
      v3 = (void *)((unsigned __int64)v14 & -(__int64)(v15 != 0));
    }
    else if( (_WORD)v12 == 0xFFFF )
    {
      *((_WORD *)v10 + 49) = 0;
    }
    v16 = 56i64 * v13;
    v17 = v10[2];
    *(_OWORD *)(v16 + v17) = SystemInformation;
    *(_OWORD *)(v16 + v17 + 16) = v19;
    *(_OWORD *)(v16 + v17 + 32) = v20;
    if( v7 )
      *(_QWORD *)(56i64 * *((unsigned __int16 *)HeadlessGlobals + 48) + HeadlessGlobals[2] + 48) = v7;
    else
      *(_QWORD *)(56i64 * *((unsigned __int16 *)HeadlessGlobals + 48) + HeadlessGlobals[2] + 48) = L"Entry could not be re"
                                                                                                    "corded due to lack of memory.\n";
    if( v9 != 0xFF )
    {
      KxReleaseSpinLock(HeadlessGlobals);
      __writecr8(v9);
    }
    if( v3 )
      ExFreePoolWithTag(v3, 0);
  }
}

Referenced by:

HdlspDispatch