After reading MSDN about device driver installation I have some general questions about the process. The question is not a question about a problem, but about the idea in general.
Hardware-first installation doesn't look that complicated. Windows looks for preloaded drivers, then for preinstalled drivers, then dependently on settings and version tries to download drivers and install them silently.
Software-first installation looks a bit more complicated. Accordingly to these articles:http://msdn.microsoft.com/en-us/library/windows/hardware/ff552293
(v=vs.85).aspx , http://msdn.microsoft.com/en-us/library/windows/hardware/ff537895
(v=vs.85).aspx , http://msdn.microsoft.com/en-us/library/windows/hardware/ff541091
I have to call CMP_WaitNoPendingInstallEvents (if possible) to prevent interfering with possible started hardware-first installation.
The next step is to check if the device is plugged in. Here the 1st question arise. Why should I care about it? Is it another way to do CMP_WaitNoPendingInstallEvents's job? Or something else?
And few other questions.
As I understand there is at least two layers of API: CM_ API, which is the lowest level API to interact with device tree and SetupDi which probably relies on CM_. The strange thing here is that there is no CM_ API function that creates a device node. devcon uses SetupDi(DIF_REGISTERDEVICE) to create a device node. Is it the only way to do it?
One more thing I don't get is what code triggers creation of device node in the case of hardware-first installation? I suspect that co or class installer of bus driver does it, but really not sure.
And the last one: are co and class installers called only in the case of using SetupDi API? Or user mode component of PnP calls them in any case?
Thanking In Advance,