My library performs a sequence of actions which result in a new (virtual) device node being added to the system. Assuming that everything is correctly configured the Windows PnP manager will respond by loading my function driver. This function driver will then proceed to create a device interface file which my library can open and interact with.
However, while it is not hard to receive notification messages when a new device interface appears (WM_DEVICECHANGE
with DBT_DEVICEARRIVAL
) I am facing the problem of deciding how long to wait for a device interface before giving up (say because the driver is not in the driver store). The issue is that the first time the system encounters my device it delay-installs the PnP function driver -- which can take in excess of 10 seconds. However, after this initial first-use delay the time is on the order of ~100ms.
Therefore is there any way I can get the PnP manager to inform me if it is delay installing my driver from the driver store? Knowing that a device interface is likely to appear in the future would eliminate any arbitrary timeout values.