CmSelectQualifiedInstallLanguage
__int64 __fastcall CmSelectQualifiedInstallLanguage(__int64 a1, unsigned int a2, _DWORD *a3, int a4){
unsigned int v4;
char v8;
char v9;
unsigned int v10;
unsigned int v11;
__int64 v12;
unsigned int ValueByName;
unsigned int v14;
_CM_KEY_NODE *v15;
bool v16;
__int64 v18;
unsigned int v19;
_CM_KEY_VALUE *v20;
unsigned int v21;
unsigned int v22;
unsigned int v23;
unsigned __int64 v24;
int v25;
_CM_KEY_VALUE *v26;
_CELL_DATA *v27;
char v28;
char v29;
unsigned int v30;
_CM_KEY_NODE *v31;
size_t Size;
unsigned int v33;
int v34;
int v35[2];
UINT ChildCell;
int v37[2];
_HV_GET_CELL_CONTEXT v38;
int v39[2];
_HV_GET_CELL_CONTEXT CellContext;
int v41[2];
_DWORD *v42;
_UNICODE_STRING DestinationString;
WCHAR Str2[88];
WCHAR v45[88];
wchar_t Name[88];
v4 = 0;
ChildCell = 0;
v37[1] = 0;
v39[1] = 0;
v37[0] = -1;
v39[0] = -1;
v41[0] = -1;
v35[0] = -1;
CellContext.Cell = -1;
v38.Cell = -1;
v8 = 0;
v42 = a3;
DestinationString = 0i64;
v41[1] = 0;
v9 = 0;
v35[1] = 0;
v28 = 0;
v29 = 0;
v34 = 0;
v33 = 0;
Size = 0;
*(_DWORD *)&CellContext.BinContext._bf_0 = 0;
*(_DWORD *)&v38.BinContext._bf_0 = 0;
memset(v45, 0i64, 0xAAu);
memset(Str2, 0i64, 0xAAu);
memset(Name, 0i64, 0xAAu);
if( a3 )
{
*a3 = 0;
if( a4 )
{
v10 = 70;
if( !DownLevelLangIDToLanguageName(a4, Name, 85i64, 0i64) )
a4 = 0;
}
else
{
v10 = 38;
}
v11 = CmpWalkPath((INT64)&CmControlHive, a2, L"MUI\\Settings");
if( v11 != -1 )
{
v12 = ((__int64(__fastcall *)(ULONG_PTR *, _QWORD, int *))qword_140D5B768)(&CmControlHive, v11, v39);
if( v12 )
{
RtlInitUnicodeString(&DestinationString, L"PreferredUILanguages");
ValueByName = CmpFindValueByName((__int64)&CmControlHive, v12, (__int64)&DestinationString);
if( ValueByName != -1 )
{
v26 = (_CM_KEY_VALUE *)((__int64(__fastcall *)(ULONG_PTR *, _QWORD, int *))qword_140D5B768)(
&CmControlHive,
ValueByName,
v37);
if( v26 )
{
if( v26->Type == 7 )
{
v27 = CmpValueToData((_HHIVE *)&CmControlHive, ValueByName, v26, &Size, &v38);
if( v27 )
{
if( Size < 0xA8 )
{
memmove(v45, v27, Size);
PsMachineUILanguageId = DownLevelLanguageNameToLangID(v45, 0i64);
}
((void(__fastcall *)(ULONG_PTR *, _HV_GET_CELL_CONTEXT *))qword_140D5B770)(&CmControlHive, &v38);
}
}
((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v37);
}
}
((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v39);
}
}
v14 = CmpWalkPath((INT64)&CmControlHive, a2, L"MUI\\UILanguages");
if( v14 == -1 )
return v10;
v15 = (_CM_KEY_NODE *)((__int64(__fastcall *)(ULONG_PTR *, _QWORD, int *))qword_140D5B768)(
&CmControlHive,
v14,
v41);
v31 = v15;
if( !v15 )
return v10;
v10 &= ~2u;
LABEL_12:
v16 = 0;
while( 1 )
{
CmpFindSubKeyByNumber((_HHIVE *)&CmControlHive, v15, v4++, &ChildCell);
v30 = v4;
if( ChildCell == -1 )
break;
v18 = ((__int64(__fastcall *)(ULONG_PTR *, _QWORD, int *))qword_140D5B768)(&CmControlHive, ChildCell, v35);
v15 = v31;
if( v18 )
{
RtlInitUnicodeString(&DestinationString, L"Type");
v19 = CmpFindValueByName((__int64)&CmControlHive, v18, (__int64)&DestinationString);
if( v19 == -1 )
goto LABEL_58;
v20 = (_CM_KEY_VALUE *)((__int64(__fastcall *)(ULONG_PTR *, _QWORD, int *))qword_140D5B768)(
&CmControlHive,
v19,
v37);
if( !v20 )
goto LABEL_58;
if( v20->Type == 4 )
{
v21 = CmpValueToData((_HHIVE *)&CmControlHive, v19, v20, &Size, &CellContext)->u.KeyList[0];
v33 = v21;
if( (v21 & 3) != 0 )
v16 = (v21 & 0x10) != 0;
((void(__fastcall *)(ULONG_PTR *, _HV_GET_CELL_CONTEXT *))qword_140D5B770)(&CmControlHive, &CellContext);
}
((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v37);
if( !v16 )
goto LABEL_58;
v22 = *(unsigned __int16 *)(v18 + 72);
if( (*(_BYTE *)(v18 + 2) & 0x20) != 0 )
{
v23 = (unsigned __int16)(2 * v22);
if( v23 <= 0xA8 )
{
CmpCopyCompressedName(
Str2,
(unsigned __int16)(2 * v22),
(PWCHAR)(v18 + 76),
*(unsigned __int16 *)(v18 + 72));
goto LABEL_31;
}
LABEL_58:
((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v35);
v15 = v31;
v4 = v30;
v8 = v28;
}
else
{
v23 = *(unsigned __int16 *)(v18 + 72);
if( v22 > 0xA8 )
goto LABEL_58;
memmove(Str2, (const VOID *)(v18 + 76), *(unsigned __int16 *)(v18 + 72));
LABEL_31:
((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v35);
v24 = v23 & 0xFFFFFFFE;
if( v24 >= 0xAA )
_report_rangecheckfailure();
*(WCHAR *)((char *)Str2 + v24) = 0;
v4 = v30;
v8 = v28;
v25 = DownLevelLanguageNameToLangID(Str2, 0i64);
v15 = v31;
if( v25 && v25 != 127 )
{
if( a4 && !v29 && !wcsicmp(Name, Str2) )
{
v29 = 1;
v10 &= ~0x40u;
}
v4 = v30;
v15 = v31;
if( !v28 )
{
if( v9 )
goto LABEL_12;
v34 = v25;
if( (v33 & 2) == 0 )
{
v8 = 1;
v28 = 1;
goto LABEL_12;
}
goto LABEL_42;
}
if( !v9 && (v33 & 2) != 0 )
{
v34 = v25;
LABEL_42:
v9 = 1;
goto LABEL_12;
}
}
}
goto LABEL_12;
}
v8 = v28;
}
((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v41);
if( v8 || v9 )
v10 &= ~4u;
if( v29 )
{
*v42 = a4;
}
else
{
if( !v9 && !v8 )
return v10;
*v42 = v34;
}
return 0;
}
return 1i64;
}Referenced by:
CmpGetSystemControlValues