RtlpMuiRegCreateKernelRegistryInfo

NTSTATUS __stdcall RtlpMuiRegCreateKernelRegistryInfo(
        PVOID *RegInfoBlob,
        UINT64 *RegInfoBlobSize,
        UINT64 *pulNumberInstalled,
        UINT64 ulInstallLanguage2Check,
        UINT64 *pulInstallLanguage2CheckExists,
        UINT64 ulMachineLanguage2Check,
        UINT64 *pulMachineLanguage2CheckExists){
  int v7; 
  int v9; 
  _OWORD *v10; 
  _QWORD *v11; 
  _DWORD *RegistryInfo; 
  NTSTATUS v13; 
  __int64 v14; 
  unsigned int v15; 
  _WORD *v16; 
  __int64 v17; 
  _OWORD *PoolWithTag; 
  int NumberOfBytes[18]; 
  v7 = ulInstallLanguage2Check;
  v9 = 0;
  v10 = 0i64;
  v11 = 0i64;
  if( !RegInfoBlob
    || !RegInfoBlobSize
    || !pulNumberInstalled
    || !pulInstallLanguage2CheckExists
    || !pulMachineLanguage2CheckExists )
  {
    v13 = -1073741811;
    goto LABEL_33;
  }
  RegistryInfo = RtlpMuiRegCreateRegistryInfo();
  v11 = RegistryInfo;
  if( !RegistryInfo )
    return -1073741801;
  v13 = RtlpMuiRegLoadRegistryInfo((__int64)RegistryInfo);
  if( v13 >= 0 )
  {
    v14 = v11[3];
    v15 = *(unsigned __int16 *)(v14 + 6);
    if( (_WORD)v15 )
    {
      v16 = *(_WORD **)(v14 + 16);
      v17 = v15;
      do
      {
        if( (*v16 & 0x9020) == 32 && (*v16 & 3) != 0 )
          ++v9;
        v16 += 14;
        --v17;
      }
      while( v17 );
    }
    *(_DWORD *)pulNumberInstalled = v9;
    *(_DWORD *)pulInstallLanguage2CheckExists = 0;
    if( v7 && (int)RtlpMuiRegGetInstalledLanguageIndexByLangId((__int64)v11, v7, 1, 0i64) >= 0 )
      *(_DWORD *)pulInstallLanguage2CheckExists = 1;
    *(_DWORD *)pulMachineLanguage2CheckExists = 0;
    if( (_DWORD)ulMachineLanguage2Check
      && (int)RtlpMuiRegGetInstalledLanguageIndexByLangId((__int64)v11, ulMachineLanguage2Check, 1, 0i64) >= 0 )
    {
      *(_DWORD *)pulMachineLanguage2CheckExists = 1;
    }
    NumberOfBytes[0] = 0;
    v13 = RtlpMuiRegSerializeRegistryInfo((__int64)v11, 0i64, (unsigned int *)NumberOfBytes);
    if( v13 >= 0 )
    {
      if( NumberOfBytes[0] )
      {
        PoolWithTag = ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes[0], 0x72746C6Dui64);
        v10 = PoolWithTag;
        if( PoolWithTag )
          memset((INT64)PoolWithTag, 0i64);
      }
      if( v10 )
      {
        v13 = RtlpMuiRegSerializeRegistryInfo((__int64)v11, v10, (unsigned int *)NumberOfBytes);
        if( v13 >= 0 )
        {
          *RegInfoBlob = v10;
          *(_DWORD *)RegInfoBlobSize = NumberOfBytes[0];
          goto LABEL_27;
        }
LABEL_33:
        if( v10 )
          ExFreeHeapPool(v10);
        goto LABEL_27;
      }
      v13 = -1073741801;
    }
  }
LABEL_27:
  if( v11 )
  {
    RtlpMuiRegFreeRegistryInfo((__int64)v11, 0xFFFu);
    ExFreeHeapPool(v11);
  }
  return v13;
}

Referenced by:

MUIRegistrySystemRoutine