Initialization and Creating IO Queues In Separate Thread

Hi Guys,
I am writing a WDF driver in which partial initialization happens in EvtPrepareHardware. At the end, the EvtPrepareHardware schedules a passive level callback and the rest of the initialization occurs there. So I have two questions related to this.

  1. I want to create the IO dispatch queues once the entire initialization is complete, which basically means that I would want to create the queues from my scheduled passive level callback once all t he steps involved in hardware initialization are completed. (I get some data from the hardware during initialization which tells me how many commands can I post to the hardware during run time. I want to use this data to setup the queues.)

  2. Because I am performing initialization in a separate thread, I am not in context of EvtPrepareHardware or AddDevice. I am not sure how do I let the kernel know that the initialization has failed and the driver should be unloaded. Is there anyway I can send a notification about this?

Please let me know.

Thanks,
— AJ

None of this is a problem. Use a WDF Work Item for the callback. If the initialization failed, call WdfDeviceSetFailed. Problem solved.

Peter