The issue arises from an attempt to automate a proprietary device driver
installation:

void install (const GUID& setupClass, LPCWSTR deviceID)
{
HDEVINFO devInfoSet = ::SetupDiGetClassDevs (&setupClass,0,0,0);
SP_DEVINFO_DATA device =
{sizeof(SP_DEVINFO_DATA),{0,0,0,{0,0,0,0,0,0,0,0}},0,0};
SP_DRVINFO_DATA driver = {sizeof(SP_DRVINFO_DATA),0,0,{0},{0},{0},0,0};
DWORD i=-1;

::SetupDiOpenDeviceInfo (devInfoSet, deviceID, 0, 0, &device);
::SetupDiSetSelectedDevice (devInfoSet, &device);

::SetupDiBuildDriverInfoList (devInfoSet, &device, SPDIT_COMPATDRIVER);
while(::SetupDiEnumDriverInfo(devInfoSet, &device, SPDIT_COMPATDRIVER,
++i, &driver))
if(wcscmp(driver.MfgName, "My Company")==0) break;

* ::SetupDiSetSelectedDriver (devInfoSet, &device, &driver);
* ::SetupDiInstallDevice (devInfoSet, &device);

::SetupDiDestroyDriverInfoList (devInfoSet, &device, SPDIT_COMPATDRIVER);
::SetupDiDestroyDeviceInfoList (devInfoSet);
}

The INF in question is correct because the manual procedure (via
DeviceManager) succeeds.
The *'d calls produce these errors in setupapi.log:

Changed class GUID of device to {78A5C341-4599-66D3-B88D-78C04FAD4280}.
* Setting selected driver caused error: Error 0xe0000201: The INF or the
device information set or element does not match the specified install class.
Installing NULL driver for ROOT\*PNP0C02\PNPBIOS_3.
* Device install finished with error Error 0xe0000219: The installation
failed because a function driver was not specified for this device instance.


Of course they don't match! If they did, the correct driver would already be
installed and this procedure would not be necessary. What am I missing?