I have a specific need to install/update drivers for certain devnodes
only although multiple devices with the same hardware ID may exist in
the system. That's why I cannot use UpdateDriverForPlugAndPlayDevices()
because this installs the driver for all devices matching the supplied
HwID. I also want a little more error control because when UDFPPD
returns FALSE, you never know for _which_ device instance it failed.
So I've inspected the setupapi.log entries created from a typicall call
to UDFPPD and written my own implementation of this API. It is working
fine apart from the minor problem I'm describing below. The pseudo code
is as follows and needs to work only for PnP devices:
1. Call SetupDiGetClassDevs() for all setup classes in the system,
enumerate devices until I find a device with a HwID I have an INF
for.
2. SetupDiSetSelectedDevice(hDevInfoSet, &DevInfoData);
3. ZeroMemory(&DevInstParams, sizeof(SP_DEVINSTALL_PARAMS));
DevInstParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
DevInstParams.Flags = DI_ENUMSINGLEINF | DI_QUIETINSTALL;
DevInstParams.FlagsEx = DI_FLAGSEX_ALLOWEXCLUDEDDRVS;
DevInstParams.hwndParent = hWnd;
lstrcpy(DevInstParams.DriverPath, szInfFile);
4. SetupDiSetDeviceInstallParams(...);
5. SetupDiBuildDriverInfoList(..., SPDIT_COMPATDRIVER);
6. SetupDiCallClassInstaller() for
- DIF_SELECTBESTCOMPATDRV
- DIF_INSTALLDEVICEFILES
- DIF_REGISTER_COINSTALLERS
- DIF_INSTALLINTERFACES
- DIF_INSTALLDEVICE
in that order. I also set the DI_NOFILECOPY flag in the device
installation flags before calling DIF_INSTALLDEVICE because otherwise
driver files are copied again although already copied during
DIF_INSTALLDEVICEFILES.
Like I said, it's working without any problems so far except that when
installing an unsigned driver, I get the "Digital Signature not found"
dialog for each call to SetupDiCallClassInstaller() in 6.
The setupapi.log entries created from running my code look exactly like
I was calling UDFPPD instead, and when using UDFPPD, I get the Digital
Signature prompt only once. What am I missing?
Also I realize that I need to do some cleanup when finished installing
this devnode. Right now I'm doing
- SetupDiDestroyDriverInfoList (if 5. succeeded)
- SetupDiCallClassInstaller() for DIF_DESTROYPRIVATEDATA and
SetupDiSetClassInstallParams(..., NULL, 0) if 4. succeeded
And of course I'm eventually calling SetupDiDestroyDeviceInfoList() when
finished with my enumeration.
Is that enough/too much, am I missing something?
Thanks!
Ralf.
There is an undocumented API (InstallSelectedDriver) to update a specific
instance of a device. If you contact MS tech support and talk to DDK support
engineers, they might be able to give you a sample code that shows how to
use this API. This function hasn't gone thru extensive testing and possibly
can change in the future releases. So if you do get the sample, please use
it at your own risk.
--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/hwdev/driver/KB-drv.asp
>There is an undocumented API (InstallSelectedDriver) to update a specific
>instance of a device.
Thanks for your reply.
I'd rather not go down the undocumented paths, if possible. The fact
that my code works except for giving these superfluous multiple Digital
Signature prompts tells me I'm on the right track. It looks like I'm
missing just a minor bit of information, such as a
SHUT_OFF_DIGITAL_SIGNATURE_PROMPT_IF_ALREADY_PROMPTED_DAMNIT_WILL_YOU
flag :-) How does UDFPPD manage to get around the multiple prompts?
Thanks!
Ralf.
>On Thu, 10 Oct 2002 12:03:25 -0700, "Eliyas Yakub"
><email_addres...@microsoft.com> wrote:
>
>>There is an undocumented API (InstallSelectedDriver) to update a specific
>>instance of a device.
>
>Thanks for your reply.
>
>I'd rather not go down the undocumented paths, if possible. The fact
>that my code works except for giving these superfluous multiple Digital
>Signature prompts tells me I'm on the right track.
Just in case somebody is interested in the solution: you need to supply
your own file queue in SP_DEVINSTALL_PARAMS and set the DI_NOVCP flag
and eventually commit the file queue yourself. You then get the digital
signature prompt only once, upon committal of the queue.
Ralf.