CmpAddProcessorConfigurationEntry
NTSTATUS __fastcall CmpAddProcessorConfigurationEntry(__int64 a1, int a2, void *a3){
char v6;
INT8 *v7;
__int64 v8;
NTSTATUS v9;
bool v10;
__int64 v11;
NTSTATUS v12;
HANDLE v13;
NTSTATUS v14;
__int128 *v15;
const char *v16;
unsigned int v17;
__int64 v18;
INT8 v19;
__int64 v20;
INT8 v21;
_QWORD *v22;
UINT64 DataSize;
int Data;
struct _UNICODE_STRING DestinationString;
struct _UNICODE_STRING UnicodeString;
HANDLE KeyHandle;
struct _STRING SourceString;
INT64 result[3];
int v30;
int v31;
int v32;
__int16 v33;
__int16 v34;
int v35;
char *v36;
HANDLE Handle;
__int128 v38[3];
int v39;
char DstBuf[128];
Data = 0;
Handle = 0i64;
v39 = 0;
KeyHandle = (HANDLE)-1i64;
SourceString = 0i64;
memset(v38, 0, sizeof(v38));
UnicodeString = 0i64;
DestinationString = 0i64;
memset((INT64)result, 0i64);
v33 = *(unsigned __int8 *)(a1 + 208);
v34 = *(unsigned __int8 *)(a1 + 209);
v36 = DstBuf;
v6 = *(_BYTE *)(a1 + 141);
v30 = 1;
v31 = 1;
v32 = a2;
if( v6 == 1 )
{
v7 = "AMD64 Family %u Model %u Stepping %u";
}
else if( v6 == 2 )
{
v7 = (INT8 *)"Intel64 Family %u Model %u Stepping %u";
}
else
{
if( v6 != 3 )
KeBugCheck(0x5Dui64);
v7 = "VIA64 Family %u Model %u Stepping %u";
}
sprintf_s(DstBuf, 0x80ui64, v7);
v8 = -1i64;
do
++v8;
while( DstBuf[v8] );
v35 = v8 + 1;
v9 = CmpInitializeRegistryNode((__int64)result, a3, &KeyHandle, -1, -1, (__int64)CmpDeviceIndexTable);
if( v9 >= 0 )
{
memset((INT64)result, 0i64);
v10 = *(_BYTE *)(a1 + 64) == 3;
v33 = *(unsigned __int8 *)(a1 + 208);
v34 = *(unsigned __int8 *)(a1 + 209);
v36 = DstBuf;
v30 = 1;
v31 = 2;
v32 = a2;
if( v10 )
strcpy_s(DstBuf, 0x80ui64, (PSTR)"80387");
v11 = -1i64;
do
++v11;
while( DstBuf[v11] );
v35 = v11 + 1;
v12 = CmpInitializeRegistryNode((__int64)result, a3, &Handle, -1, -1, (__int64)CmpDeviceIndexTable);
v13 = KeyHandle;
v14 = v12;
if( v12 >= 0 )
{
ZwClose(Handle);
v16 = (const char *)((a1 + 34192) & -(__int64)(*(_BYTE *)(a1 + 65) != 0));
if( (unsigned int)EAX(__cpuid(0x80000000, 0)) < 0x80000004 )
goto LABEL_40;
v15 = v38;
v17 = -2147483646;
do
{
v18 = __cpuid(v17, 0);
*(_DWORD *)v15 = EAX(v18);
++v17;
*((_DWORD *)v15 + 1) = EBX(v18);
*((_DWORD *)v15 + 2) = ECX(v18);
*((_DWORD *)v15++ + 3) = EDX(v18);
}
while( v17 <= 0x80000004 );
LOBYTE(v39) = 0;
if( !v15 )
goto LABEL_40;
RtlInitUnicodeString(&DestinationString, L"ProcessorNameString", (WCHAR)v15);
LODWORD(v20) = 0;
if( LOBYTE(v38[0]) == 32 )
{
do
v20 = (unsigned int)(v20 + 1);
while( *((_BYTE *)v38 + v20) == 32 );
}
RtlInitAnsiString(&SourceString, (PCSZ)v38 + (unsigned int)v20, v19);
v14 = RtlAnsiStringToUnicodeString(&UnicodeString, &SourceString, 1u);
if( v14 >= 0 )
{
LODWORD(DataSize) = UnicodeString.Length + 2;
v14 = ZwSetValueKey(v13, &DestinationString, 0i64, 1ui64, UnicodeString.Buffer, DataSize);
RtlFreeAnsiString(&UnicodeString);
if( v14 >= 0 )
{
LABEL_40:
if( !v16
|| (RtlInitUnicodeString(&DestinationString, (PCWSTR)L"VendorIdentifier", (WCHAR)v15),
RtlInitAnsiString(&SourceString, v16, v21),
v14 = RtlAnsiStringToUnicodeString(&UnicodeString, &SourceString, 1u),
v14 >= 0)
&& (LODWORD(DataSize) = UnicodeString.Length + 2,
v14 = ZwSetValueKey(v13, &DestinationString, 0i64, 1ui64, UnicodeString.Buffer, DataSize),
RtlFreeAnsiString(&UnicodeString),
v14 >= 0) )
{
if( !*(_QWORD *)(a1 + 34208)
|| (Data = *(_DWORD *)(a1 + 34208),
RtlInitUnicodeString(&DestinationString, L"FeatureSet", (WCHAR)v15),
LODWORD(DataSize) = 4,
v14 = ZwSetValueKey(v13, &DestinationString, 0i64, 4ui64, &Data, DataSize),
v14 >= 0) )
{
if( !*(_DWORD *)(a1 + 68)
|| (RtlInitUnicodeString(&DestinationString, L"~MHz", (WCHAR)v15),
LODWORD(DataSize) = 4,
v14 = ZwSetValueKey(v13, &DestinationString, 0i64, 4ui64, (PVOID)(a1 + 68), DataSize),
v14 >= 0) )
{
v22 = (_QWORD *)(a1 + 34216);
if( *v22 )
{
RtlInitUnicodeString(&DestinationString, L"Update Revision", (WCHAR)v15);
LODWORD(DataSize) = 8;
v14 = ZwSetValueKey(v13, &DestinationString, 0i64, 3ui64, v22, DataSize);
}
}
}
}
}
}
}
if( v13 != (HANDLE)-1i64 )
ZwClose(v13);
return v14;
}
return v9;
}Referenced by:
CmInitializeProcessor
CmpInitializeMachineDependentConfiguration