PspIsDfssEnabled
INT64 __fastcall PspIsDfssEnabled(){
char v0;
unsigned int v1;
INT64 result;
void *v3;
int inited;
__int128 *p_KeyValueInformation;
NTSTATUS v6;
void *v7;
ULONG Length;
void *PoolWithQuotaTag;
NTSTATUS v10;
int v11;
unsigned int v12;
ULONG ResultLength;
UINT64 Value;
void *KeyHandle;
struct _UNICODE_STRING DestinationString;
struct _OBJECT_ATTRIBUTES ObjectAttributes;
__int128 KeyValueInformation;
int v19;
LODWORD(Value) = 0;
v0 = 0;
KeyHandle = 0i64;
*(&ObjectAttributes.Length + 1) = 0;
*(&ObjectAttributes.Attributes + 1) = 0;
v1 = 0;
while( 1 )
{
ObjectAttributes.RootDirectory = 0i64;
ObjectAttributes.Length = 48;
ObjectAttributes.ObjectName = (_UNICODE_STRING *)&PspQuotaKeyNames[2 * v1];
ObjectAttributes.Attributes = 576;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
LODWORD(result) = ZwOpenKey(&KeyHandle, 1u, &ObjectAttributes);
if( (int)result < 0 )
{
LABEL_16:
if( !v0 )
goto LABEL_17;
LABEL_22:
PspReadDfssConfigurationValues();
goto LABEL_17;
}
v3 = KeyHandle;
ResultLength = 0;
v19 = 0;
DestinationString = 0i64;
KeyValueInformation = 0i64;
inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)L"EnableCpuQuota");
if( inited >= 0 )
{
p_KeyValueInformation = &KeyValueInformation;
v6 = ZwQueryValueKey(
v3,
&DestinationString,
KeyValuePartialInformation,
&KeyValueInformation,
0x14u,
&ResultLength);
inited = v6;
if( v6 >= 0 )
{
v7 = 0i64;
LABEL_8:
v11 = *((_DWORD *)p_KeyValueInformation + 1);
if( ((v11 - 3) & 0xFFFFFFFB) != 0 )
{
if( v11 != 4 )
{
if( v11 != 11 && v11 == 1 )
{
if( ((unsigned __int8)&Value & 3) != 0 )
{
inited = -2147483646;
}
else
{
ResultLength = 4;
DestinationString.Buffer = (wchar_t *)p_KeyValueInformation + 6;
DestinationString.Length = *((_WORD *)p_KeyValueInformation + 4);
DestinationString.MaximumLength = *((_WORD *)p_KeyValueInformation + 4);
inited = RtlUnicodeStringToInteger(&DestinationString, 0i64, &Value);
}
goto LABEL_12;
}
LABEL_11:
inited = -1073741788;
goto LABEL_12;
}
if( *((_DWORD *)p_KeyValueInformation + 2) == 4 )
{
ResultLength = 4;
LODWORD(Value) = *((_DWORD *)p_KeyValueInformation + 3);
}
else
{
inited = -1073741820;
}
}
else
{
if( v11 != 4 )
goto LABEL_11;
ResultLength = *((_DWORD *)p_KeyValueInformation + 2);
v12 = *((_DWORD *)p_KeyValueInformation + 2);
if( v12 > 4 )
inited = -2147483643;
else
memmove((UINT8 *)&Value, (UINT8 *)p_KeyValueInformation + 12, v12);
}
LABEL_12:
if( v7 )
ExFreePoolWithTag(v7, 0);
goto LABEL_15;
}
if( v6 == -2147483643 )
{
while( 1 )
{
Length = ResultLength;
PoolWithQuotaTag = ExAllocatePoolWithQuotaTag((POOL_TYPE)520, ResultLength, 0x6B497452ui64);
v7 = PoolWithQuotaTag;
if( !PoolWithQuotaTag )
break;
p_KeyValueInformation = (__int128 *)PoolWithQuotaTag;
v10 = ZwQueryValueKey(
v3,
&DestinationString,
KeyValuePartialInformation,
PoolWithQuotaTag,
Length,
&ResultLength);
inited = v10;
if( v10 >= 0 )
goto LABEL_8;
if( v10 != -2147483643 )
goto LABEL_12;
ExFreePoolWithTag(v7, 0);
}
inited = -1073741801;
}
}
LABEL_15:
LODWORD(result) = ZwClose(KeyHandle);
if( inited < 0 )
goto LABEL_16;
if( !(_DWORD)Value )
break;
++v1;
v0 = 1;
if( v1 >= 2 )
goto LABEL_22;
}
v0 = 0;
LABEL_17:
LOBYTE(result) = v0;
return result;
}Referenced by:
PsBootPhaseComplete