PspReadIFEOPerfOptions
VOID __fastcall PspReadIFEOPerfOptions(VOID *KeyHandle, INT64 a2){
unsigned int v2;
NTSTATUS inited;
__int128 *p_KeyValueInformation;
NTSTATUS v7;
void *v8;
int v9;
int v10;
VOID *PoolWithQuotaTag;
NTSTATUS v12;
UINT64 BufferSize;
UINT64 BufferSizea;
UINT64 BufferSizeb;
UINT64 BufferSizec;
UINT64 BufferSized;
UINT64 NumberOfBytes[2];
_UNICODE_STRING DestinationString;
__int128 KeyValueInformation;
int v21;
v2 = 0;
HIDWORD(NumberOfBytes[0]) = 0;
LODWORD(BufferSize) = 4;
if( RtlQueryImageFileKeyOption(KeyHandle, (WCHAR *)L"IoPriority", 4ui64, (VOID *)(a2 + 8), BufferSize, 0i64) >= 0 )
*(_DWORD *)a2 |= 1u;
LODWORD(BufferSizea) = 4;
if( RtlQueryImageFileKeyOption(KeyHandle, (WCHAR *)L"PagePriority", 4ui64, (VOID *)(a2 + 12), BufferSizea, 0i64) >= 0 )
*(_DWORD *)a2 |= 2u;
LODWORD(BufferSizeb) = 4;
if( RtlQueryImageFileKeyOption(KeyHandle, (WCHAR *)L"CpuPriorityClass", 4ui64, (VOID *)(a2 + 16), BufferSizeb, 0i64) >= 0 )
*(_DWORD *)a2 |= 4u;
LODWORD(NumberOfBytes[0]) = 0;
v21 = 0;
DestinationString = 0i64;
KeyValueInformation = 0i64;
inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)L"WorkingSetLimitInKB");
if( inited < 0 )
goto LABEL_10;
LODWORD(BufferSizec) = 20;
p_KeyValueInformation = &KeyValueInformation;
v7 = ZwQueryValueKey(
KeyHandle,
&DestinationString,
KeyValuePartialInformation,
&KeyValueInformation,
BufferSizec,
NumberOfBytes);
inited = v7;
if( v7 >= 0 )
{
v8 = 0i64;
LABEL_14:
v9 = *((_DWORD *)p_KeyValueInformation + 1);
if( ((v9 - 3) & 0xFFFFFFFB) != 0 )
{
if( v9 == 4 )
{
if( *((_DWORD *)p_KeyValueInformation + 2) == 4 )
{
LODWORD(NumberOfBytes[0]) = 4;
v2 = *((_DWORD *)p_KeyValueInformation + 3);
}
else
{
inited = -1073741820;
}
LABEL_21:
if( v8 )
ExFreePoolWithTag(v8, 0);
goto LABEL_10;
}
if( v9 != 11 && v9 == 1 )
{
if( (((unsigned __int8)NumberOfBytes + 4) & 3) != 0 )
{
inited = -2147483646;
goto LABEL_21;
}
LODWORD(NumberOfBytes[0]) = 4;
DestinationString.Buffer = (wchar_t *)p_KeyValueInformation + 6;
DestinationString.Length = *((_WORD *)p_KeyValueInformation + 4);
DestinationString.MaximumLength = *((_WORD *)p_KeyValueInformation + 4);
inited = RtlUnicodeStringToInteger(&DestinationString, 0i64, (UINT64 *)((char *)NumberOfBytes + 4));
goto LABEL_32;
}
}
else if( v9 == 4 )
{
LODWORD(NumberOfBytes[0]) = *((_DWORD *)p_KeyValueInformation + 2);
if( *((_DWORD *)p_KeyValueInformation + 2) > 4u )
{
inited = -2147483643;
goto LABEL_21;
}
memmove((char *)NumberOfBytes + 4, (char *)p_KeyValueInformation + 12, *((_DWORD *)p_KeyValueInformation + 2));
LABEL_32:
v2 = HIDWORD(NumberOfBytes[0]);
goto LABEL_21;
}
inited = -1073741788;
goto LABEL_21;
}
if( v7 != -2147483643 )
{
LABEL_10:
if( inited >= 0 )
{
*(_DWORD *)(a2 + 4) |= 1u;
*(_QWORD *)(a2 + 24) = (unsigned __int64)v2 >> 2;
}
return;
}
while( 1 )
{
v10 = NumberOfBytes[0];
PoolWithQuotaTag = ExAllocatePoolWithQuotaTag((POOL_TYPE)520, LODWORD(NumberOfBytes[0]), 0x6B497452ui64);
v8 = PoolWithQuotaTag;
if( !PoolWithQuotaTag )
break;
p_KeyValueInformation = (__int128 *)PoolWithQuotaTag;
LODWORD(BufferSized) = v10;
v12 = ZwQueryValueKey(
KeyHandle,
&DestinationString,
KeyValuePartialInformation,
PoolWithQuotaTag,
BufferSized,
NumberOfBytes);
inited = v12;
if( v12 >= 0 )
goto LABEL_14;
if( v12 != -2147483643 )
goto LABEL_21;
ExFreePoolWithTag(v8, 0);
}
}Referenced by:
PspAllocateProcess