PiDevCfgInitDriverDatabaseCallback
CHAR __fastcall PiDevCfgInitDriverDatabaseCallback(const WCHAR *a1){
void *PoolWithTag;
__int64 v3;
__int64 v4;
__int64 v5;
__int64 v6;
unsigned int v7;
int MatchingFilteredDeviceList;
const wchar_t *i;
int v10;
HANDLE v11;
__int64 v12;
int NumberOfBytes;
SIZE_T NumberOfBytesa;
int a6;
UINT64 a7;
INT64 a11;
unsigned int a8;
PVOID P;
HANDLE a4;
HANDLE v22;
HANDLE Handle;
SIZE_T v24;
v22 = 0i64;
P = 0i64;
PoolWithTag = 0i64;
a8 = 0;
LODWORD(v3) = 0;
a4 = 0i64;
v4 = 0i64;
Handle = 0i64;
LOBYTE(v24) = 0;
if( PiPnpRtlCtx )
v4 = *(_QWORD *)(PiPnpRtlCtx + 224);
if( (int)SysCtxRegOpenKey(v4, (char *)0x80000002i64, a1, 0, 0x2000000u, &v22) >= 0 )
{
if( (int)PnpCtxOpenMachine(v5, (__int64)v22, v6, 0i64, NumberOfBytes, a6, &P) >= 0 )
{
v7 = 2048;
a8 = 2048;
while( v7 > (unsigned int)v3 )
{
v3 = v7;
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
PoolWithTag = ExAllocatePoolWithTag(PagedPool, 2 * v3, 0x63647050ui64);
if( !PoolWithTag )
{
MatchingFilteredDeviceList = -1073741670;
LABEL_13:
if( MatchingFilteredDeviceList >= 0 )
{
if( (_DWORD)v3 )
{
for( i = (const wchar_t *)PoolWithTag; *i; i += v12 + 1 )
{
if( (int)CmOpenDeviceRegKey((__int64)P, i, 16, 0, 0x2000000, 0, (__int64)&a4, 0i64) >= 0 )
{
v10 = CmCreateDevice(PiPnpRtlCtx, i, 131103, &Handle, &v24, 0);
if( v10 >= 0 )
{
v11 = Handle;
if( (_BYTE)v24 )
{
LODWORD(a11) = 0x20000;
LODWORD(a7) = 1;
v10 = PiDevCfgCopyObjectProperties(
(INT64)P,
(INT64)i,
1ui64,
a4,
NumberOfBytesa,
(INT64)i,
a7,
(__int64)Handle,
0i64,
0i64,
a11);
}
ZwClose(v11);
if( v10 < 0 )
CmDeleteDevice(PiPnpRtlCtx, i, 0);
}
ZwClose(a4);
}
v12 = -1i64;
do
++v12;
while( i[v12] );
}
}
}
break;
}
MatchingFilteredDeviceList = CmGetMatchingFilteredDeviceList(
(__int64)P,
(__int64)L"Root",
1,
0i64,
0i64,
(__int64)PoolWithTag,
v3,
(__int64)&a8);
if( MatchingFilteredDeviceList != -1073741789 )
goto LABEL_13;
v7 = a8;
}
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
}
if( P )
PnpCtxCloseMachine(P);
}
if( v22 )
ZwClose(v22);
return 1;
}Referenced by:
PiDrvDbEnumNodes