RegRtlEnumValue
NTSTATUS __stdcall RegRtlEnumValue(_HANDLE KeyHandle, ULONG Index, VOID *a3, INT64 a4, VOID *a5, INT64 a6){
VOID *v6;
unsigned __int64 v8;
_KEY_VALUE_INFORMATION_CLASS v11;
unsigned int v12;
unsigned int v13;
VOID **PoolWithTag;
NTSTATUS v15;
unsigned int v16;
__int64 v17;
size_t v18;
size_t v20;
__int64 v21;
UINT64 Length;
__int64 ResultLength[2];
unsigned int *v24;
LODWORD(ResultLength[0]) = 0;
v6 = *(VOID **)&KeyHandle;
v8 = 2i64 * *(unsigned int *)a4;
if( v24 )
{
v11 = KeyValueFullInformation;
if( v8 <= 0xFFFFFFFF )
{
v12 = v8 + 24;
if( (int)v8 + 24 >= (unsigned int)v8 )
{
v13 = v12 + *v24;
if( v13 >= v12 )
goto LABEL_5;
}
}
return -1073741675;
}
v11 = KeyValueBasicInformation;
if( v8 > 0xFFFFFFFF )
return -1073741675;
v13 = v8 + 16;
if( (int)v8 + 16 < (unsigned int)v8 )
return -1073741675;
LABEL_5:
PoolWithTag = ExAllocatePoolWithTag(1ui64, v13, 1279739218i64);
if( !PoolWithTag )
return -1073741801;
LODWORD(Length) = v13;
v15 = ZwEnumerateValueKey(v6, Index, v11, PoolWithTag, Length, (UINT64 *)ResultLength);
if( !v15 || v15 == -2147483643 )
{
if( v11 )
{
if( a5 )
*(_DWORD *)a5 = *((_DWORD *)PoolWithTag + 1);
if( v15
|| *(unsigned int *)a4 < ((unsigned __int64)*((unsigned int *)PoolWithTag + 4) >> 1) + 1
|| (v16 = *((_DWORD *)PoolWithTag + 3), *v24 < v16) )
{
v15 = -1073741789;
*(_DWORD *)a4 = (*((_DWORD *)PoolWithTag + 4) >> 1) + 1;
*v24 = *((_DWORD *)PoolWithTag + 3);
}
else
{
v17 = *((_DWORD *)PoolWithTag + 4) >> 1;
*v24 = v16;
v18 = *((_DWORD *)PoolWithTag + 4);
*(_DWORD *)a4 = v17;
memmove(a3, (char *)PoolWithTag + 20, v18);
*((_WORD *)a3 + v17) = 0;
memmove((VOID *)a6, (char *)PoolWithTag + *((unsigned int *)PoolWithTag + 2), *((_DWORD *)PoolWithTag + 3));
}
}
else
{
if( a5 )
*(_DWORD *)a5 = *((_DWORD *)PoolWithTag + 1);
if( v15 || (v20 = *((_DWORD *)PoolWithTag + 2), *(unsigned int *)a4 < ((unsigned __int64)v20 >> 1) + 1) )
{
v15 = -1073741789;
LODWORD(v21) = (*((_DWORD *)PoolWithTag + 2) >> 1) + 1;
}
else
{
v21 = v20 >> 1;
memmove(a3, (char *)PoolWithTag + 12, v20);
*((_WORD *)a3 + v21) = 0;
}
*(_DWORD *)a4 = v21;
}
}
ExFreePoolWithTag(PoolWithTag, 0);
return v15;
}Referenced by:
PnpCtxRegEnumValue
RegRtlCopyTreeInternal