PnpCtxOpenMachine
__int64 __fastcall PnpCtxOpenMachine(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, int a6, _QWORD *a7){
_QWORD *v7;
_QWORD *PoolWithTag;
_QWORD *v11;
__int64 v12;
char *v13;
_QWORD *v14;
__int64 v15;
int v16;
char **v17;
_QWORD *v18;
_QWORD *v19;
VOID **v20;
struct _ERESOURCE *v21;
struct _ERESOURCE *v22;
void *v24;
PVOID P;
v7 = a7;
P = 0i64;
*a7 = 0i64;
PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x210ui64, 0x52504E50ui64);
v11 = PoolWithTag;
if( PoolWithTag )
{
memset((INT64)PoolWithTag, 0i64);
v13 = (char *)(v11 + 1);
*(_DWORD *)v11 = 167772160;
v11[2] = v11 + 1;
v14 = v11 + 3;
v11[1] = v11 + 1;
v15 = 4i64;
do
{
v14[1] = v14;
*v14 = v14;
v14 += 2;
--v15;
}
while( v15 );
v16 = PnpCtxCreateNode((int *)v11, L"SYSTEM", 1, v12, a2, v24, a4, 0i64, &P);
if( v16 < 0 )
{
v18 = P;
}
else
{
v17 = (char **)v11[2];
if( *v17 != v13
|| (v18 = P,
*((_QWORD *)P + 1) = v17,
v19 = v18 + 2,
*v18 = v13,
*v17 = (char *)v18,
v11[2] = v18,
v20 = (VOID **)v11[6],
*v20 != v11 + 5) )
{
__fastfail(3u);
}
v18[3] = v20;
*v19 = v11 + 5;
*v20 = v19;
v11[6] = v19;
v11[11] = v18;
v11[28] = v18[7];
v21 = (struct _ERESOURCE *)ExAllocatePoolWithTag(NonPagedPoolNx, 0x68ui64, 0x52504E50ui64);
v22 = v21;
if( v21 )
{
v16 = ExInitializeResourceLite(v21);
if( v16 >= 0 )
{
v11[30] = v22;
v22 = 0i64;
}
if( v22 )
ExFreePoolWithTag(v22, 0);
if( v16 >= 0 )
{
v11[29] = 0i64;
memset((INT64)(v11 + 31), 0i64);
v11[38] = PnpDispatchDevice;
v11[39] = PnpDispatchInstallerClass;
v11[40] = PnpDispatchDeviceInterface;
v11[41] = PnpDispatchInterfaceClass;
v11[42] = PnpDispatchDeviceContainer;
v11[43] = PnpDispatchDevicePanel;
memset((INT64)(v11 + 49), 0i64);
v11[61] = 0i64;
v11[62] = 0i64;
v11[63] = 0i64;
v11[64] = 0i64;
v11[65] = 0i64;
*v7 = v11;
v11 = 0i64;
v18 = 0i64;
}
}
else
{
v16 = -1073741801;
}
}
if( v18 )
PnpCtxDestroyNode(v18);
if( v11 )
ExFreePoolWithTag(v11, 0);
}
else
{
return(unsigned int)-1073741801;
}
return(unsigned int)v16;
}Referenced by:
PiDevCfgInitDriverDatabaseCallback
PiPnpRtlInit
PipMigratePnpState