NDIS 6 miniport: Getting the MSI resource list

I am working on an Ndis 6.20 miniport driver. The PCI-Express card supports MSI and I specifiy in the inf file that I support MSI.

NDIS passes the parameter MiniportInitParameters to the InitializeEx function. This struct contains AllocatedResources (data type PNDIS_RESOURCE_LIST). I go through the array PartialDescriptors. I find a struct with Type CmResourceTypeInterrupt and Flag CM_RESOURCE_INTERRUPT_MESSAGE. So I use the information from u.MessageInterrupt. u.MessageInterrupt is a union containing either the struct with raw resources or the struct with the translated resources. How do I know which one to use?

In a WDM driver, in the IRP START_DEVICE I get both structs (AllocatedResources and AllocatedResourcesTranslated).

This is actually a very good question. The docs should definitely be clear about whether they’re presenting you raw or the translated resources. Not that the Raw resources would do you much good…

The one example that I could find of this on GitHub clearly shows using the MSI info from the Translated union.

Peter
(device driver guy, but definitely not an NDIS guy)

Thanks Peter. I now ignore the msi interrupt that is passed to the InitializeEx function. In NdisMRegisterInterruptEx, I set MsiSupported to TRUE. When the function returns, I can find the information about the registered msi interrupts in the struct member MessageInfoTable.