RtlpMuiRegLangInfoMatchesSpec

UINT8 __stdcall RtlpMuiRegLangInfoMatchesSpec(
        _MUIREGISTRYINFO *RegInfo,
        _MUILANGINFO *LangInfo,
        UINT8 LangTypeWanted,
        INT16 LangSpecWanted){
  __int64 v4; 
  UINT8 v5; 
  wchar_t *v8; 
  int LangId; 
  __int64 LangNameIndex; 
  __int64 v13; 
  const wchar_t *v14; 
  __int64 v15; 
  __int64 v16; 
  const wchar_t *v17; 
  wchar_t *v18; 
  INT64 v19; 
  __int64 v20; 
  const wchar_t *v21; 
  __int64 v22; 
  _UNICODE_STRING DestinationString; 
  UINT64 Lcid; 

  v4 = LangSpecWanted;
  v5 = 1;
  LODWORD(Lcid) = 0;
  v8 = 0i64;
  DestinationString = 0i64;
  if( LangTypeWanted == 1 )
  {
    LangId = LangInfo->LangId;
    if( (_WORD)LangId )
      return LangId == LangSpecWanted;
    LangNameIndex = LangInfo->LangNameIndex;
    if( (LangNameIndex & 0x8000u) == 0i64 )
    {
      v13 = *((_QWORD *)RegInfo + 4);
      if( v13 && (int)LangNameIndex < *(unsigned __int16 *)(v13 + 6) )
        v14 = (const wchar_t *)(*(_QWORD *)(v13 + 24) + 2i64 * *(__int16 *)(*(_QWORD *)(v13 + 16) + 2 * LangNameIndex));
      else
        v14 = 0i64;
      if( v14 )
      {
        RtlInitUnicodeString(&DestinationString, v14);
        if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
          return(_WORD)Lcid == (unsigned __int16)v4;
      }
    }
    return 0;
  }
  if( LangTypeWanted == 3 )
  {
    v15 = LangInfo->LangNameIndex;
    if( (v15 & 0x8000u) != 0i64 )
    {
      if( LangInfo->LangId )
      {
        v18 = (wchar_t *)MuiRegAllocArray((INT64)RegInfo, 0x55ui64);
        v8 = v18;
        if( v18 )
        {
          v19 = LangInfo->LangId;
          DestinationString.Buffer = v18;
          *(_DWORD *)&DestinationString.Length = 11141120;
          if( RtlLCIDToCultureName(v19, (INT64)&DestinationString) )
          {
LABEL_26:
            v20 = *((_QWORD *)RegInfo + 4);
            if( v20 && (v4 & 0x8000u) == 0i64 && (int)v4 < *(unsigned __int16 *)(v20 + 6) )
              v21 = (const wchar_t *)(*(_QWORD *)(v20 + 24) + 2i64 * *(__int16 *)(*(_QWORD *)(v20 + 16) + 2 * v4));
            else
              v21 = 0i64;
            if( !v21 || wcsicmp(DestinationString.Buffer, v21) )
              v5 = 0;
            if( v8 )
              ExFreePoolWithTag(v8, 0);
            return v5;
          }
          ExFreePoolWithTag(v8, 0);
        }
      }
    }
    else
    {
      if( (_WORD)v15 == LangSpecWanted )
        return v5;
      v16 = *((_QWORD *)RegInfo + 4);
      if( v16 && (int)v15 < *(unsigned __int16 *)(v16 + 6) )
        v17 = (const wchar_t *)(*(_QWORD *)(v16 + 24) + 2i64 * *(__int16 *)(*(_QWORD *)(v16 + 16) + 2 * v15));
      else
        v17 = 0i64;
      if( v17 )
      {
        RtlInitUnicodeString(&DestinationString, v17);
        goto LABEL_26;
      }
    }
  }
  else if( LangTypeWanted == 2 && LangSpecWanted >= 0 )
  {
    v22 = *((_QWORD *)RegInfo + 3);
    if( LangSpecWanted < (int)*(unsigned __int16 *)(v22 + 6) )
      return LangInfo == (_MUILANGINFO *)(*(_QWORD *)(v22 + 16) + 28i64 * LangSpecWanted);
  }
  return 0;
}

Referenced by:

RtlpMuiRegConfigMatchesInstalled