HdlspKernelAddLogEntry

VOID __stdcall HdlspKernelAddLogEntry(UINT64 StringCode, _UNICODE_STRING *DriverName){
  int v3; 
  wchar_t *v4; 
  __int64 v5; 
  __int64 v6; 
  wchar_t *Buffer; 
  unsigned __int64 v8; 
  unsigned __int64 v9; 
  __int16 Dst[88]; 

  v3 = StringCode;
  if( (unsigned int)StringCode > 0xB )
  {
    switch( (_DWORD)StringCode )
    {
      case 0xC:
        v4 = L"KRNL: Failed to reassign system root.";
        goto LABEL_43;
      case 0xD:
        v4 = L"KRNL: Failed to protect system partition.";
        goto LABEL_43;
      case 0xE:
        v4 = L"KRNL: Failed to UnicodeToAnsi system root.";
        goto LABEL_43;
      case 0xF:
        v4 = L"KRNL: Failed to AnsiToUnicode system root.";
        goto LABEL_43;
      case 0x10:
        v4 = L"KRNL: Failed to find any groups.";
        goto LABEL_43;
      case 0x12:
        v4 = L"KRNL: Failed waiting for boot devices to delete.";
        goto LABEL_43;
      case 0x13:
        v4 = L"KRNL: Failed waiting for boot devices to start.";
        goto LABEL_43;
      case 0x14:
        v4 = L"KRNL: Failed waiting for boot devices to reinit.";
        goto LABEL_43;
      case 0x15:
        v4 = L"KRNL: Failed marking boot partition.";
        goto LABEL_43;
    }
  }
  else
  {
    if( (_DWORD)StringCode == 11 )
    {
      v4 = L"KRNL: Failed to initialize system drivers.";
      goto LABEL_43;
    }
    if( (unsigned int)StringCode > 6 )
    {
      switch( (_DWORD)StringCode )
      {
        case 7:
          v4 = L"KRNL: Failed to initialize(phase 0) plug and play services.";
          break;
        case 8:
          v4 = L"KRNL: Failed to initialize(phase 1) plug and play services.";
          break;
        case 9:
          v4 = L"KRNL: Failed to initialize boot drivers.";
          break;
        default:
          v4 = L"KRNL: Failed to locate system dll.";
          break;
      }
      goto LABEL_43;
    }
    switch( (_DWORD)StringCode )
    {
      case 6:
        v4 = L"KRNL: Failed to create root directories.";
        goto LABEL_43;
      case 1:
        v4 = L"KRNL: Loading ";
        goto LABEL_43;
      case 2:
        v4 = L"KRNL: Load succeeded.";
        goto LABEL_43;
      case 3:
        v4 = L"KRNL: Load failed.";
        goto LABEL_43;
      case 4:
        v4 = L"KRNL: Failed to create event.";
        goto LABEL_43;
      case 5:
        v4 = (wchar_t *)L"KRNL: Failed to create object types.";
LABEL_43:
        wcscpy_s((PWCHAR)Dst, 0x50ui64, v4);
        goto LABEL_44;
    }
  }
  v4 = 0i64;
  Dst[0] = 0;
LABEL_44:
  v5 = -1i64;
  if( v3 == 1 && DriverName )
  {
    v6 = -1i64;
    do
      ++v6;
    while( v4[v6] );
    Buffer = DriverName->Buffer;
    v8 = (unsigned __int64)DriverName->Length >> 1;
    v9 = 79 - v6;
    if( v8 < 80 - v6 )
      v9 = (unsigned __int64)DriverName->Length >> 1;
    memmove(&Dst[v6], DriverName->Buffer, 2 * v9);
    if( Buffer[v8 - 1] )
      Dst[v9 + v6] = 0;
  }
  do
    ++v5;
  while( Dst[v5] );
  HdlspDispatch(HeadlessCmdAddLogEntry, Dst, 2 * v5 + 2, 0i64, 0i64);
}

Referenced by:

HeadlessKernelAddLogEntry
IoInitSystem
IopInitializeBootDrivers
IopInitializeBuiltinDriver
PipInitializeCoreDriversByGroup