in src/framework/shared/support/fxresourcecollection.cpp [367:429]
__in __drv_strictTypeMatch(__drv_typeExpr) POOL_FLAGS PoolFlags
)
/*++
Routine Description:
Allocates and initializes a WDM CM resource list based off of the current
contents of this collection.
Arguments:
PoolFlags - the pool flags from which to allocate the resource list
Return Value:
a new resource list upon success, NULL upon failure
--*/
{
PCM_RESOURCE_LIST pWdmResourceList;
ULONG size;
PFX_DRIVER_GLOBALS pFxDriverGlobals;
pWdmResourceList = NULL;
pFxDriverGlobals = GetDriverGlobals();
if (Count()) {
//
// NOTE: This function assumes all resources are on the same bus
// and therefore there is only one FULL_RESOURCE_DESCRIPTOR.
//
size = sizeof(CM_RESOURCE_LIST) +
(sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (Count() - 1));
pWdmResourceList = (PCM_RESOURCE_LIST)
MxMemory::MxAllocatePool2(PoolFlags, size, pFxDriverGlobals->Tag);
if (pWdmResourceList != NULL) {
PCM_PARTIAL_RESOURCE_DESCRIPTOR pDescriptor;
FxCollectionEntry *cur, *end;
pWdmResourceList->Count = 1; // We only return one full descriptor
pWdmResourceList->List[0].PartialResourceList.Version = 1;
pWdmResourceList->List[0].PartialResourceList.Revision = 1;
pWdmResourceList->List[0].PartialResourceList.Count = Count();
pDescriptor =
pWdmResourceList->List[0].PartialResourceList.PartialDescriptors;
end = End();
for (cur = Start(); cur != end; cur = cur->Next()) {
FxResourceCm *pResource;
pResource = (FxResourceCm*) cur->m_Object;
RtlCopyMemory(pDescriptor,
&pResource->m_Descriptor,
sizeof(pResource->m_Descriptor));
pDescriptor++;
}
}
}
return pWdmResourceList;
}