PnpGetDeviceDependencyList
__int64 __fastcall PnpGetDeviceDependencyList(__int64 a1, int a2, __int64 a3, unsigned int a4, _DWORD *a5){
_DEVICE_OBJECT *v5;
int v6;
int v7;
int v8;
UINT64 v9;
__int64 v10;
WCHAR *v11;
_LIST_ENTRY *DependentList;
__int16 v13;
_LIST_ENTRY *Flink;
_PNP_DEPENDENCY_EDGE *v15;
__int64 v16;
__int64 v17;
__int64 v18;
WCHAR *v19;
__int64 v20;
_QWORD *v21;
_QWORD *v22;
__int64 v23;
WCHAR *v24;
UINT64 dwFlags;
_NTSTRSAFE_PWSTR ppszDestEnd[2];
size_t pcchLength[2];
_LIST_ENTRY *v29;
STRSAFE_PCNZWCH psz;
__int64 v31;
_LIST_ENTRY *v32;
__int64 v33;
UINT64 pcchRemaining;
int v35;
__int64 v36;
unsigned int v37;
v37 = a4;
v36 = a3;
v35 = a2;
v5 = *(_DEVICE_OBJECT **)(a1 + 32);
v6 = a2;
*(_QWORD *)pcchLength = 0i64;
psz = 0i64;
v7 = 0;
v8 = 0;
v9 = a4;
v10 = a3;
pcchRemaining = a4;
v11 = (WCHAR *)a3;
*(_QWORD *)ppszDestEnd = a3;
PnpAcquireDependencyRelationsLock(0);
if( v6 )
{
if( v6 != 1 )
{
v8 = -1073741811;
goto LABEL_39;
}
DependentList = PiGetDependentList(v5);
}
else
{
DependentList = PiGetProviderList(v5);
}
Flink = DependentList->Flink;
v32 = DependentList;
if( Flink == DependentList )
goto LABEL_35;
do
{
v15 = PiListEntryToDependencyEdge(Flink, (PNP_DEPENDENCY_EDGE_LIST_TYPE)v6);
Flink = Flink->Flink;
v29 = Flink;
if( v6 )
v16 = *((_QWORD *)v15 + 5);
else
v16 = *((_QWORD *)v15 + 4);
v17 = *(_QWORD *)(v16 + 48);
if( v17 )
v18 = *(_QWORD *)(*(_QWORD *)(v17 + 312) + 40i64);
else
v18 = 0i64;
if( v17 && v18 && (v19 = *(WCHAR **)(v18 + 48)) != 0i64 )
{
v8 = RtlStringCchLengthW(v19, 0xC8ui64, (UINT64 *)pcchLength);
if( v8 < 0 )
goto LABEL_39;
v7 += pcchLength[0] + 1;
if( ++*(_QWORD *)pcchLength <= v9 )
{
LODWORD(dwFlags) = 2048;
v8 = RtlStringCchCopyExW(v11, v9, *(WCHAR **)(v20 + 48), (WCHAR **)ppszDestEnd, &pcchRemaining, dwFlags);
if( v8 < 0 )
goto LABEL_39;
v11 = (WCHAR *)(*(_QWORD *)ppszDestEnd + 2i64);
v9 = pcchRemaining - 1;
*(_QWORD *)ppszDestEnd += 2i64;
--pcchRemaining;
}
}
else
{
v21 = (_QWORD *)(v16 + 56);
v22 = *(_QWORD **)(v16 + 56);
if( v22 != (_QWORD *)(v16 + 56) )
{
while( 1 )
{
v23 = (__int64)v22;
v22 = (_QWORD *)*v22;
v31 = v23;
v33 = v23 + 16;
v8 = PnpUnicodeStringToWstr((__int16 **)&psz, 0i64, (unsigned __int16 *)(v23 + 16));
if( v8 < 0 )
goto LABEL_39;
v24 = (WCHAR *)psz;
v8 = RtlStringCchLengthW((WCHAR *)psz, 0x7FFFui64, (UINT64 *)pcchLength);
if( v8 < 0 )
break;
v7 += pcchLength[0] + 1;
if( ++*(_QWORD *)pcchLength <= v9 )
{
LODWORD(dwFlags) = 2048;
v8 = RtlStringCchCopyExW(v11, v9, v24, (WCHAR **)ppszDestEnd, &pcchRemaining, dwFlags);
if( v8 < 0 )
{
PnpUnicodeStringToWstrFree(v24, v31 + 16);
v9 = pcchRemaining;
v11 = *(WCHAR **)ppszDestEnd;
LABEL_29:
Flink = v29;
goto LABEL_30;
}
v11 = (WCHAR *)(*(_QWORD *)ppszDestEnd + 2i64);
v9 = pcchRemaining - 1;
*(_QWORD *)ppszDestEnd += 2i64;
--pcchRemaining;
}
PnpUnicodeStringToWstrFree(v24, v33);
if( v22 == v21 )
goto LABEL_29;
}
PnpUnicodeStringToWstrFree(v24, v31 + 16);
goto LABEL_29;
}
LABEL_30:
if( v8 < 0 )
goto LABEL_39;
v6 = v35;
}
}
while( Flink != v32 );
if( v8 >= 0 )
{
v10 = v36;
v13 = 0;
LABEL_35:
if( ++v7 <= v37 )
*(_WORD *)(v10 + 2i64 * (unsigned int)(v7 - 1)) = v13;
else
v8 = -1073741789;
}
LABEL_39:
ExReleaseResourceLite((PERESOURCE)((char *)&stru_140C452E0 + 384));
PpDevNodeUnlockTree(PPL_SIMPLE_READ);
if( (int)(v8 + 0x80000000) < 0 || v8 == -1073741789 )
{
if( a5 )
*a5 = v7;
}
return(unsigned int)v8;
}Referenced by:
PiControlGetPropertyData