Creating multiple instances of Device

I am working on virtual serial driver (UMDF) from the WDK samples. I want to create more instances of the COM. To create multiple device instance i guess i need to call WdfDeviceCreate as many times as the device instance is required. But I cannot call WdfDeviceCreate repeatedly because it looks like the DeviceInit struct is free after the first call. How can I create multiple instances of the device.

Any suggestions would be of great help.

You can’t do this directly in a UMDF driver. You must create (if virtual) or install each instance of the device and then each device stack will be created. BTW you can’t do this directly in a KMDF driver as an FDO either, although the option exists in kernel mode to create a bus driver which you then control the creation of child devices from the driver, not an installation app

Thanks Doron, that was really helpful.