CmEnumDevicesInContainerWithCallbackWorker
__int64 __fastcall CmEnumDevicesInContainerWithCallbackWorker(
__int64 a1,
__int64 a2,
char *a3,
__int64 (__fastcall *a4)(__int64, char *, __int64),
__int64 a5,
int a6){
char *PoolWithTag;
int v7;
int v11;
char *v12;
__int64 v13;
unsigned int v14;
int v15;
__int64 v16;
__int64 v17;
ULONG i;
int v19;
int v20;
unsigned int v21;
char v23[8];
HANDLE KeyHandle;
HANDLE Handle;
HANDLE v26;
v26 = 0i64;
PoolWithTag = 0i64;
KeyHandle = 0i64;
v7 = 0;
if( (_WORD)a6 )
return(unsigned int)-1073741811;
if( a3 )
goto LABEL_6;
v11 = PnpOpenObjectRegKey(a1, a2, 5u, 1, 0, (__int64)&v26);
if( v11 < 0 )
goto LABEL_41;
v12 = (char *)v26;
if( !v26 )
LABEL_6:
v12 = a3;
if( a1 )
v13 = *(_QWORD *)(a1 + 224);
else
v13 = 0i64;
v11 = SysCtxRegOpenKey(v13, v12, L"BaseContainers", 0, 8u, &KeyHandle);
if( v11 < 0 )
{
LABEL_41:
if( v11 == -1073741444 )
v11 = -1073741772;
goto LABEL_43;
}
PoolWithTag = (char *)ExAllocatePoolWithTag(PagedPool, 0x190ui64, 0x52504E50ui64);
if( PoolWithTag )
{
v14 = 0;
while( 1 )
{
Handle = 0i64;
a6 = 200;
v15 = RegRtlEnumKey(KeyHandle, v14, PoolWithTag, (unsigned int *)&a6);
v11 = v15;
if( v15 == -2147483622 )
break;
if( v15 != -1073741789 )
{
if( v15 < 0 )
goto LABEL_41;
v16 = a1 ? *(_QWORD *)(a1 + 224) : 0i64;
v11 = SysCtxRegOpenKey(v16, (char *)KeyHandle, (const WCHAR *)PoolWithTag, 0, 1u, &Handle);
if( v11 < 0 )
goto LABEL_41;
for( i = 0; ; ++i )
{
do
{
a6 = 200;
v19 = PnpCtxRegEnumValue(v17, Handle, i, PoolWithTag, &a6, (__int64)v23, 0i64, 0i64);
v11 = v19;
if( v19 == -2147483622 )
{
v11 = 0;
goto LABEL_33;
}
}
while( v19 == -1073741789 );
if( v19 < 0 )
goto LABEL_33;
v20 = a4(a1, PoolWithTag, a5);
v7 = v20;
if( v20 )
break;
}
if( v20 != 1 && v20 != 2 )
{
if( v20 == 3 )
v11 = -1073741248;
else
v11 = -1073741595;
}
LABEL_33:
if( Handle )
ZwClose(Handle);
if( v11 < 0 || v7 == 2 )
goto LABEL_41;
v21 = v14 + 1;
v14 = 0;
if( v7 != 1 )
v14 = v21;
}
}
v11 = 0;
goto LABEL_41;
}
v11 = -1073741801;
LABEL_43:
if( KeyHandle )
ZwClose(KeyHandle);
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
if( v26 )
ZwClose(v26);
return(unsigned int)v11;
}Referenced by:
CmEnumDevicesInContainerWithCallback