PiDevCfgInitDriverDatabaseCallback
CHAR __stdcall PiDevCfgInitDriverDatabaseCallback(const WCHAR *a1){
VOID **PoolWithTag;
__int64 v3;
__int64 v4;
__int64 v5;
__int64 v6;
unsigned int v7;
NTSTATUS MatchingFilteredDeviceList;
WCHAR *i;
NTSTATUS v10;
_HANDLE v11;
__int64 v12;
int DesiredAccess;
UINT64 DesiredAccessa;
int Create;
UINT8 *Createa;
INT64 v18;
INT64 a8;
VOID *v20;
WCHAR *v21;
UINT64 v22;
UINT64 *v23;
UINT64 v24;
HPNPCTX *hPnpCtx;
VOID *DeviceKey;
VOID *Handle;
__int64 v28[2];
VOID *Created;
Handle = 0i64;
hPnpCtx = 0i64;
PoolWithTag = 0i64;
LODWORD(v24) = 0;
LODWORD(v3) = 0;
DeviceKey = 0i64;
v4 = 0i64;
v28[0] = 0i64;
LOBYTE(Created) = 0;
if( *(&stru_140CF2E80 + 607) )
v4 = *(_QWORD *)(*(&stru_140CF2E80 + 607) + 224i64);
if( SysCtxRegOpenKey(v4, (VOID *)0x80000002i64, a1, 0, 0x2000000u, &Handle) >= 0 )
{
if( (int)PnpCtxOpenMachine(v5, Handle, v6, 0i64, DesiredAccess, Create, &hPnpCtx) >= 0 )
{
v7 = 2048;
LODWORD(v24) = 2048;
while( v7 > (unsigned int)v3 )
{
v3 = v7;
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
PoolWithTag = ExAllocatePoolWithTag(1ui64, 2 * v3, 1667526736i64);
if( !PoolWithTag )
{
MatchingFilteredDeviceList = -1073741670;
LABEL_13:
if( MatchingFilteredDeviceList >= 0 )
{
if( (_DWORD)v3 )
{
for( i = (WCHAR *)PoolWithTag; *i; i += v12 + 1 )
{
LODWORD(DesiredAccessa) = 0x2000000;
if( CmOpenDeviceRegKey(
hPnpCtx,
i,
CM_KEY_TYPE_DEVICE_INSTANCE,
0i64,
DesiredAccessa,
0,
&DeviceKey,
0i64) >= 0 )
{
LODWORD(Createa) = 0;
v10 = CmCreateDevice(
*(&stru_140CF2E80 + 607),
i,
(WCHAR *)0x2001F,
(INT64)v28,
&Created,
Createa,
v18,
a8,
(INT64)v20);
if( v10 >= 0 )
{
v11 = v28[0];
if( (_BYTE)Created )
{
v20 = 0i64;
v10 = PiDevCfgCopyObjectProperties(hPnpCtx, i, 1, DeviceKey);
}
ZwClose(v11);
if( v10 < 0 )
CmDeleteDevice(*(&stru_140CF2E80 + 607), i, 0i64);
}
ZwClose((_HANDLE)DeviceKey);
}
v12 = -1i64;
do
++v12;
while( i[v12] );
}
}
}
break;
}
MatchingFilteredDeviceList = CmGetMatchingFilteredDeviceList(
hPnpCtx,
L"Root",
CM_DEVICE_LIST_FILTER_ENUMERATOR,
0i64,
0i64,
(const WCHAR *)PoolWithTag,
(_CM_OBJECT_TYPE)v3,
&v24,
v20,
v21,
v22,
v23,
v24);
if( MatchingFilteredDeviceList != -1073741789 )
goto LABEL_13;
v7 = v24;
}
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
}
if( hPnpCtx )
PnpCtxCloseMachine(hPnpCtx);
}
if( Handle )
ZwClose((_HANDLE)Handle);
return 1;
}Referenced by:
PiDrvDbEnumNodes