PnpBusTypeGuidGetIndex
UINT16 __stdcall PnpBusTypeGuidGetIndex(GUID *BusTypeGuid){
unsigned int v2;
GUID *v3;
GUID v5;
__int64 v6;
UINT8 *PoolWithTag;
UINT8 *v8;
PVOID v9;
ExAcquireFastMutex(&PnpBusTypeGuidLock);
v2 = 0;
if( !PnpBusTypeGuidCount )
goto LABEL_7;
do
{
v3 = (GUID *)((char *)PnpBusTypeGuidArray + 16 * v2);
if( BusTypeGuid == v3 )
break;
if( RtlCompareMemory(BusTypeGuid, v3, 0x10ui64) == 16 )
break;
++v2;
}
while( v2 < PnpBusTypeGuidCount );
if( v2 == PnpBusTypeGuidCount )
{
LABEL_7:
if( v2 == PnpBusTypeGuidCountMax )
{
PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(PagedPool, 16i64 * (v2 + 1), 0x75737050ui64);
v8 = PoolWithTag;
if( PoolWithTag )
{
v9 = PnpBusTypeGuidArray;
memmove(PoolWithTag, (UINT8 *)PnpBusTypeGuidArray, 16i64 * (unsigned int)PnpBusTypeGuidCount);
++PnpBusTypeGuidCountMax;
if( v9 )
ExFreePoolWithTag(v9, 0);
PnpBusTypeGuidArray = v8;
}
else
{
v2 = -1;
}
}
if( v2 != -1 )
{
v5 = *BusTypeGuid;
v6 = 2i64 * (unsigned int)PnpBusTypeGuidCount++;
*(GUID *)((char *)PnpBusTypeGuidArray + 8 * v6) = v5;
}
}
KeReleaseGuardedMutex(&PnpBusTypeGuidLock);
return v2;
}Referenced by:
PnpQueryBusInformation