RegRtlEnumKeyWithCallback
NTSTATUS __stdcall RegRtlEnumKeyWithCallback(VOID *hKey, VOID *Context){
__int64 v2;
NTSTATUS v3;
VOID **v5;
__int64 v6;
unsigned int v7;
unsigned __int64 v8;
WCHAR *p_KeyName;
unsigned int v10;
NTSTATUS v11;
int v12;
VOID **PoolWithTag;
VOID **v15;
INT64 a5;
INT64 a6;
UINT64 KeyNameLength;
UINT64 HighLimit;
__int64 LowLimit[2];
WCHAR KeyName;
v3 = 0;
LODWORD(KeyNameLength) = 0;
HighLimit = 0i64;
v5 = 0i64;
LowLimit[0] = 0i64;
v6 = v2;
IoGetStackLimits((UINT64 *)LowLimit, &HighLimit);
if( (unsigned __int64)&LowLimit[-1] - LowLimit[0] < 0x400 )
return -1073741670;
if( (unsigned int)RegRtlQueryInfoKey(hKey, 0i64, (unsigned int *)&KeyNameLength, 0i64, 0i64, 0i64) )
{
LODWORD(v8) = 0;
}
else
{
v7 = KeyNameLength;
if( (_DWORD)KeyNameLength )
{
if( (int)KeyNameLength + 1 < (unsigned int)KeyNameLength )
{
v3 = -1073741675;
v7 = -1;
}
else
{
v7 = KeyNameLength + 1;
}
if( v3 < 0 )
return v3;
v3 = 0;
}
v8 = 2i64 * v7;
if( v8 > 0xFFFFFFFF )
return -1073741675;
}
if( (unsigned int)v8 > 0x50 )
{
PoolWithTag = ExAllocatePoolWithTag(1ui64, (unsigned int)v8, 1279739218i64);
v5 = PoolWithTag;
if( !PoolWithTag )
return -1073741801;
p_KeyName = (WCHAR *)PoolWithTag;
}
else
{
p_KeyName = &KeyName;
LODWORD(v8) = 80;
}
v10 = 0;
while( 1 )
{
LODWORD(KeyNameLength) = (unsigned int)v8 >> 1;
v11 = RegRtlEnumKey(hKey, v10, p_KeyName, &KeyNameLength, a5, a6, KeyNameLength, HighLimit);
if( v11 == -2147483622 )
break;
if( v11 == -1073741444 )
{
v3 = 0;
break;
}
if( v11 == -1073741789 )
{
v8 = 2i64 * (unsigned int)KeyNameLength;
if( v8 > 0xFFFFFFFF )
{
v3 = -1073741675;
break;
}
v3 = 0;
if( v5 )
ExFreePoolWithTag(v5, 0);
v15 = ExAllocatePoolWithTag(1ui64, (unsigned int)v8, 1279739218i64);
v5 = v15;
if( !v15 )
return -1073741801;
p_KeyName = (WCHAR *)v15;
}
else
{
v3 = 0;
if( v11 )
{
v3 = v11;
break;
}
p_KeyName[((unsigned __int64)(unsigned int)v8 >> 1) - 1] = 0;
v12 = SysCtxInternalEnumSubkeyCallback((__int64)hKey, (__int64)p_KeyName, v6);
if( v12 )
{
if( v12 == 1 )
{
v10 = 0;
}
else if( v12 != 2 )
{
if( v12 == 3 )
v3 = -1073741248;
else
v3 = -1073741595;
break;
}
}
else
{
++v10;
}
if( v12 == 2 )
break;
}
}
if( v5 )
ExFreePoolWithTag(v5, 0);
return v3;
}Referenced by:
PnpCtxRegEnumKeyWithCallback