KeGetBugMessageText

UINT8 __stdcall KeGetBugMessageText(UINT64 MessageId, _STRING *ReturnedString, INT64 a3){
  unsigned int v4; 
  UINT8 v5; 
  _DWORD *v6; 
  __int64 i; 
  unsigned __int16 *v8; 
  __int64 j; 
  char *v10; 
  __int64 v11; 

  v4 = MessageId;
  v5 = 0;
  if( KiBugCodeMessages )
  {
    v6 = (char *)KiBugCodeMessages + 4;
    for( i = *(unsigned int *)KiBugCodeMessages; i; --i )
    {
      if( v4 >= *v6 && v4 <= v6[1] )
      {
        v8 = (unsigned __int16 *)((char *)KiBugCodeMessages + (unsigned int)v6[2]);
        for( j = v4 - *v6; j; --j )
          v8 = (unsigned __int16 *)((char *)v8 + *v8);
        v10 = (char *)(v8 + 2);
        v11 = -1i64;
        do
          ++v11;
        while( v10[v11] );
        ReturnedString->Buffer = v10;
        ReturnedString->Length = v11;
        ReturnedString->MaximumLength = v11;
        return 1;
      }
      v6 += 3;
    }
  }
  return v5;
}

Referenced by:

CmpCreateHwProfileFriendlyName
KiDisplayBlueScreen