PiPnpRtlGetFilteredDeviceList
NTSTATUS __stdcall PiPnpRtlGetFilteredDeviceList(_CM_ACTION_INFORMATION *CmObjectActionInfo){
_CM_ACTION_INFORMATION v1;
VOID **PoolWithTag;
const WCHAR *v4;
bool v5;
char v6;
HPNPCTX *v7;
int inited;
WCHAR *v11;
HPNPCTX *v12;
char v13;
NTSTATUS CmObjectListFromCache;
PVOID v15;
UINT32 v16;
HPNPCTX *v17;
char v18;
_CM_ACTION_INFORMATION v19;
WORD *v20;
int v21;
WORD *v22;
HPNPCTX *v23;
char v24;
size_t *pcchRemaining;
size_t *pcchRemaininga;
const WCHAR *dwFlags;
UINT64 dwFlagsa;
UINT64 dwFlagsb;
UINT64 dwFlagsc;
VOID *v31;
__int64 v32;
VOID *v33;
_UNICODE_STRING DestinationString;
INT64 v35[2];
__int128 v36;
int MatchCallbackRoutine[2];
char v38;
int v39;
__int16 v40;
char v41;
PVOID P;
__int64 v43;
__int64 v44;
__int64 v45;
UINT64 v46;
WCHAR *ppszDestEnd;
v1 = CmObjectActionInfo[6];
v39 = 0;
v40 = 0;
v41 = 0;
PoolWithTag = 0i64;
HIDWORD(v43) = 0;
ppszDestEnd = 0i64;
v46 = 0i64;
*(_OWORD *)v35 = 0i64;
v36 = 0i64;
DestinationString = 0i64;
if( (v1 & 0x7C) != 0 )
{
inited = -1073741802;
LABEL_30:
if( PoolWithTag )
{
v16 = 1198550608;
v15 = PoolWithTag;
goto LABEL_15;
}
}
else
{
if( (v1 & 1) != 0 )
{
v20 = (WORD *)*((_QWORD *)CmObjectActionInfo + 2);
if( v20 )
{
v21 = 0;
while( *v20 )
{
if( *v20 == 92 )
break;
if( (unsigned int)++v21 > 2 )
break;
v22 = wcschr(v20, 92);
if( v22 )
{
v20 = v22 + 1;
if( v20 )
continue;
}
PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x190ui64, 1198550608i64);
if( !PoolWithTag )
return -1073741670;
LODWORD(dwFlags) = 2048;
inited = RtlStringCchCopyExW(
(WCHAR *)PoolWithTag,
0xC8ui64,
*((WCHAR **)CmObjectActionInfo + 2),
&ppszDestEnd,
&v46,
(UINT64)dwFlags);
if( inited >= 0 )
{
if( v46 < 2 )
{
inited = -1073741811;
}
else
{
*(_DWORD *)ppszDestEnd = 92;
inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)PoolWithTag);
if( inited >= 0 )
{
v23 = (HPNPCTX *)*((_QWORD *)CmObjectActionInfo + 6);
v35[0] = (INT64)&DestinationString;
v24 = BYTE1(CmObjectActionInfo[6]) & 1;
*(_DWORD *)((char *)&v35[1] + 1) = 0;
LOBYTE(v35[1]) = v24;
v36 = *((_OWORD *)CmObjectActionInfo + 2);
dwFlagsc = *((_QWORD *)CmObjectActionInfo + 8);
LODWORD(pcchRemaininga) = CmObjectActionInfo[14];
*(_WORD *)((char *)&v35[1] + 5) = 0;
HIBYTE(v35[1]) = 0;
inited = PiDmGetCmObjectListFromCache(
CM_OBJECT_TYPE_DEVICE,
(UINT8)PiPnpRtlEnumeratorFilterCallback,
v35,
v23,
(const WCHAR *)pcchRemaininga,
(_CM_OBJECT_TYPE)dwFlagsc,
v31,
v33,
*(WCHAR **)&DestinationString.Length,
(UINT64)DestinationString.Buffer,
(UINT64 *)&DestinationString.Length);
}
}
}
goto LABEL_30;
}
}
return -1073741811;
}
if( (v1 & 2) == 0 )
{
if( (v1 & 0x80u) == 0 )
{
v17 = (HPNPCTX *)*((_QWORD *)CmObjectActionInfo + 6);
v5 = (v1 & 0x100) != 0;
*(_DWORD *)((char *)&v35[1] + 1) = 0;
v18 = v35[1];
if( v5 )
v18 = 1;
*(_WORD *)((char *)&v35[1] + 5) = 0;
LOBYTE(v35[1]) = v18;
v36 = *((_OWORD *)CmObjectActionInfo + 2);
dwFlagsb = *((_QWORD *)CmObjectActionInfo + 8);
v19 = CmObjectActionInfo[14];
HIBYTE(v35[1]) = 0;
LODWORD(pcchRemaining) = v19;
return PiDmGetCmObjectListFromCache(
CM_OBJECT_TYPE_DEVICE,
(UINT8)PiPnpRtlEnumeratorFilterCallback,
v35,
v17,
(const WCHAR *)pcchRemaining,
(_CM_OBJECT_TYPE)dwFlagsb,
v31,
v33,
*(WCHAR **)&DestinationString.Length,
(UINT64)DestinationString.Buffer,
(UINT64 *)v35[0]);
}
v4 = (const WCHAR *)*((_QWORD *)CmObjectActionInfo + 2);
if( v4 )
{
v5 = (v1 & 0x100) != 0;
*(_DWORD *)((char *)&v35[1] + 1) = 0;
v6 = v35[1];
if( v5 )
v6 = 1;
*(_WORD *)((char *)&v35[1] + 5) = 0;
LOBYTE(v35[1]) = v6;
v36 = *((_OWORD *)CmObjectActionInfo + 2);
v32 = *((_QWORD *)CmObjectActionInfo + 8);
LODWORD(dwFlags) = CmObjectActionInfo[14];
v7 = (HPNPCTX *)*((_QWORD *)CmObjectActionInfo + 6);
HIBYTE(v35[1]) = 0;
return PiDmGetCmObjectConstraintListFromCache(
PiDmListDevicesInInstallerClass|PiDmListInterfacesInDevice,
v4,
(UINT8)PiPnpRtlEnumeratorFilterCallback,
v35,
v7,
dwFlags,
(_CM_OBJECT_TYPE)v32,
v33,
*(VOID **)&DestinationString.Length,
DestinationString.Buffer,
v35[0],
(UINT64 *)v35[1]);
}
return -1073741811;
}
v11 = (WCHAR *)*((_QWORD *)CmObjectActionInfo + 2);
if( !v11 )
return -1073741811;
inited = RtlInitUnicodeStringEx(&DestinationString, v11);
if( inited >= 0 )
{
v12 = (HPNPCTX *)*((_QWORD *)CmObjectActionInfo + 6);
*(_QWORD *)MatchCallbackRoutine = &DestinationString;
v13 = BYTE1(CmObjectActionInfo[6]) & 1;
v39 = 0;
v38 = v13;
v44 = *((_QWORD *)CmObjectActionInfo + 4);
v45 = *((_QWORD *)CmObjectActionInfo + 5);
dwFlagsa = *((_QWORD *)CmObjectActionInfo + 8);
LODWORD(pcchRemaining) = CmObjectActionInfo[14];
v40 = 0;
v41 = 0;
v43 = 0i64;
P = 0i64;
CmObjectListFromCache = PiDmGetCmObjectListFromCache(
CM_OBJECT_TYPE_DEVICE,
(UINT8)PiPnpRtlServiceFilterCallback,
(INT64 *)MatchCallbackRoutine,
v12,
(const WCHAR *)pcchRemaining,
(_CM_OBJECT_TYPE)dwFlagsa,
v31,
v33,
*(WCHAR **)&DestinationString.Length,
(UINT64)DestinationString.Buffer,
(UINT64 *)v35[0]);
v15 = P;
inited = CmObjectListFromCache;
if( P )
{
v16 = 0;
LABEL_15:
ExFreePoolWithTag(v15, v16);
}
}
}
return inited;
}Referenced by:
PiPnpRtlCmActionCallback