Well, I got farther. The one change that I made was to add
wcscpy_s(installParams.DriverPath,SIZECHARS(installParams.DriverPath),
TEXT(“C:\WINDOWS\INF\1394.INF”));
To tell it exactly which INF file I wanted. However, with that change I only seem to have 1 device in my built list… Off to figure that out. Did I mentioned that this sucks…
Thanks to all for being patient… Now I know why I stick to drivers…
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Cariddi
Sent: Friday, October 15, 2010 11:06 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How do you programmatically force setupdi to load a particular driver
Below is the code I am working with. The problem I am having is that I am getting back 0xe000020a from the line with **** after it. That is what I am exploring now… BTW, what the heck is 0xe000020a?
int Replace1394BusDriver()
{
DWORD Err = NO_ERROR;
HDEVINFO DeviceInfoSet = INVALID_HANDLE_VALUE;
SP_DEVINFO_DATA DeviceInfoData;
SP_DEVINFO_DATA DeviceInfoData1;
DWORD Reboot = false;
int result = EXIT_FAIL;
DWORD memberIndex = 0;
SP_DEVINSTALL_PARAMS installParams;
memset(&installParams,0,sizeof(installParams));
DebugBreak();
//
// Create an empty device information list.
//
DeviceInfoSet = SetupDiGetClassDevsEx(&GUID_DEVCLASS_1394,NULL,NULL,DIGCF_PRESENT,NULL,NULL,NULL);
if (DeviceInfoSet == INVALID_HANDLE_VALUE) {
Err = GetLastError();
goto Replace1394BusDriverExit;
}
DeviceInfoData.cbSize = sizeof(DeviceInfoData);
if(!SetupDiEnumDeviceInfo(DeviceInfoSet,0,&DeviceInfoData)) {
Err = GetLastError();
goto Replace1394BusDriverExit;
}
//
// We got information about a member in the 1394 class, let’s
// see if it is the legacy driver.
//
DumpDevice(DeviceInfoSet,&DeviceInfoData);
installParams.cbSize = sizeof(installParams);
installParams.Flags = DI_ENUMSINGLEINF;
installParams.FlagsEx = DI_FLAGSEX_ALLOWEXCLUDEDDRVS | DI_FLAGSEX_FILTERSIMILARDRIVERS;
if(!SetupDiSetDeviceInstallParams(DeviceInfoSet,&DeviceInfoData,&installParams)) {
Err = GetLastError();
goto Replace1394BusDriverExit;
}
if(!SetupDiBuildDriverInfoList(DeviceInfoSet,&DeviceInfoData,SPDIT_COMPATDRIVER)) { ******
Err = GetLastError();
goto Replace1394BusDriverExit;
}
while(TRUE) {
DeviceInfoData1.cbSize = sizeof(DeviceInfoData1);
if(!SetupDiEnumDeviceInfo(DeviceInfoSet,memberIndex,&DeviceInfoData1)) {
Err = GetLastError();
goto Replace1394BusDriverExit;
}
DumpDevice(DeviceInfoSet,&DeviceInfoData1);
memberIndex++;
}
Replace1394BusDriverExit:
return result;
}
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of David R. Cattley
Sent: Friday, October 15, 2010 10:40 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How do you programmatically force setupdi to load a particular driver
I share your sense of numbness whenever I try to read the SetupDi documentation to gather any useful insight. I am sure it makes sense to *somebody*.
When you call SetupDiBuildDriverInfoList() you can pass it a DeviceInfoData
structure. That DeviceInfoData structure in this case we want to be the
DeviceInfoData for the device you are trying to update the driver for.
One of the things you can do *to* that DeviceInfoData is to call
SetupDiSetDeviceInstallParams() to modify the SP_DEVICEINSTALL_PARAMS Flags, FlagsEx, and DriverPath.
If you do a SetupDiGetDeviceInstallParams() to get the current values and then modify them by setting
DriverPath to your INF file
Flags |= DI_ENUMSINGLEINF
FlagsEx |= DIF_FLAGSEX_ALLOWEXCLUDEDDRVS | DIF_FLAGSEX_FILTERSIMILARDRIVERS
Then call SetupDiSetDeviceInstallParams() to set those values back.
Then call SetupDiBuildDriverInfoList() and specify the DeviceInfoData for that device.
And maybe SetupDi will play along and load the driver data only for your driver.
And if you tried all that and I am just not understanding your current state of affairs, I would conclude I have no idea what to do next.
I hope this helps.
Cheers,
Dave Cattley
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer