I think I may have been able to figure out how to do this using the
SetupDiXxx calls. However I have a question regarding how I did it.
I took out most of the error checking in order to keep this as short a
possible.
/* This comes after creating appropriate device information sets, and such.
*/
/* I got this from the DDK devcon sample. */
SetupDiCallClassInstaller (DIF_REGISTERDEVICE, DevInfoSet, pDevInfoData);
/* Now to install the driver without using
UpdateDriverForPlugAndPlayDevices. */
Failed = TRUE;
DevInstParams.cbSize = sizeof (DevInstParams);
SetupDiGetDeviceInstallParams (DevInfoSet, pDevInfoData, &DevInstParams);
DevInstParams.Flags |= DI_SHOWOEM;
SetupDiSetDeviceInstallParams (DevInfoSet, pDevInfoData, &DevInstParams);
SetupDiBuildDriverInfoList (DevInfoSet, pDevInfoData, SPDIT_COMPATDRIVER);
if (!SetupDiSelectBestCompatDrv (DevInfoSet, pDevInfoData)) {
SetupDiSelectDevice (DevInfoSet, pDevInfoData);
if (SetupDiInstallDevice (DevInfoSet, pDevInfoData))
Failed = FALSE;
}
else {
if (SetupDiInstallDevice (DevInfoSet, pDevInfoData))
Failed = FALSE;
}
if (Cancelled)
SetupDiRemoveDevice (DevInfoSet, pDevInfoData);
Now for my question:
The devcon sample (and consequently my code) uses SetupDiCallClassInstaller
(DIF_REGISTERDEVICE,…) to register the device. Should I be using
SetupDiCallClassInstaller with appropriate DIF codes to do the other
functions (where available)?
i.e.:
SetupDiSelectBestCompatDrv -> DIF_SELECTBESTCOMPATDRV
SetupDiSelectDevice -> DIF_SELECTDEVICE
SetupDiInstallDevice -> DIF_INSTALLDEVICE
SetupDiRemoveDevice -> DIF_REMOVE
Using both “versions” works, but I’m not sure if any installer (class, co,
etc.) code is being skipped by not using SetupDiCallClassInstaller.
If there’s anything else I am not doing correctly please let me know.
Thanks, Chris
“Chris Dore” wrote in message
news:xxxxx@ntdev…
>
> After using SetupDiCallClassInstaller (DIF_REGISTERDEVICE,…) to create a
> new devnode, is it possible to get a driver to be associated with the new
> device without calling UpdateDriverForPlugAndPlayDevices? If I could even
> just simply get the found new hardware wizard to popup for the new device
it
> would be great. I just want to install another device without disrupting
> already installed devices with the same hardware ID.
>
> See my other post titled “UpdateDriverForPlugAndPlayDevices for single
> device instance” for more information.
>
> Any hints will surely assist my quest.
> Thanks, Chris
>
>
>
>