Driver Problems? Questions? Issues?
Put OSR's experience to work for you! Contact us for assistance with:
  • Creating the right design for your requirements
  • Reviewing your existing driver code
  • Analyzing driver reliability/performance issues
  • Custom training mixed with consulting and focused directly on your specific areas of interest/concern.
Check us out. OSR, the Windows driver experts.

Monthly Seminars at OSR Headquarters

East Coast USA
Windows Internals and SW Drivers, Dulles (Sterling) VA, 13 November 2017

Kernel Debugging & Crash Analysis for Windows, Nashua (Amherst) NH, 4 December 2017

Writing WDF Drivers I: Core Concepts, Nashua (Amherst) NH, 8 January 2018

WDF Drivers II: Advanced Implementation Techniques, Nashua (Amherst) NH, 15 January 2018


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 8  
13 Feb 17 13:32
Suresh Patil
xxxxxx@yahoo.com
Join Date: 17 Feb 2010
Posts To This List: 101
A doubt with device co-installer

Hi, I install a driver for a PCI device by claiming it with 4-point match (VID_DID_SVID_SDID). There is also another driver available for the same device that claims it with 2-point match (VID_DID). Since I claim it with 4-point match, I get the priority over the other one. Under certain condition however I want to let the other driver own the device. I achieve it with a co-installer which checks for that condition and if necessary loads the other eligible driver using SetupDiEnumDriverInfo, SetupDiGetDriverInfoDetail and SetupDiSetSelectedDriver. This works fine, but after a system reboot I see that it is still MY DRIVER that is being loaded. Am I missing any step in the co-installer to permanently set the other driver as the default one? Regards, Suresh
  Message 2 of 8  
13 Feb 17 13:39
Mark Roddy
xxxxxx@gmail.com
Join Date: 25 Feb 2000
Posts To This List: 4022
A doubt with device co-installer

If the condition is permanent why not just uninstall your driver? Mark Roddy On Mon, Feb 13, 2017 at 1:31 PM, <xxxxx@yahoo.com> wrote: > Hi, > > I install a driver for a PCI device by claiming it with 4-point match > (VID_DID_SVID_SDID). There is also another driver available for the same > device that claims it with 2-point match (VID_DID). > Since I claim it with 4-point match, I get the priority over the other > one. Under certain condition however I want to let the other driver own the > device. I achieve it with a co-installer which checks for that condition > and if necessary loads the other eligible driver using > SetupDiEnumDriverInfo, SetupDiGetDriverInfoDetail and <...excess quoted lines suppressed...> --
  Message 3 of 8  
13 Feb 17 20:56
ntdev member 171212
xxxxxx@microsoft.com
Join Date:
Posts To This List: 12
A doubt with device co-installer

I don't think this is possible in a coinstaller. By the time the coinstaller gets invoked, the driver has already been selected and you're in the middle of the install process. If you want that kind of logic, you're better off using an exe. But even better yet would be to not need that logic, as PNP considers the hardware ID matching to be a contract.
  Message 4 of 8  
13 Feb 17 21:37
Suresh Patil
xxxxxx@yahoo.com
Join Date: 17 Feb 2010
Posts To This List: 101
A doubt with device co-installer

> If the condition is permanent why not just uninstall your driver? Is it possible to do this seamlessly without user interaction from within the coinstaller? > By the time the coinstaller gets invoked, the driver has already been selected Isn't SetupDiSetSelectedDriver supposed to override that default driver? Or is this only for that session? > If you want that kind of logic, you're better off using an exe Thanks. What exactly do I need to do in the EXE to achieve this? Also whatever APIs I would use in the exe, wouldn't they available for use in the coinstaller too?
  Message 5 of 8  
14 Feb 17 14:04
ntdev member 171212
xxxxxx@microsoft.com
Join Date:
Posts To This List: 12
A doubt with device co-installer

> Isn't SetupDiSetSelectedDriver supposed to override that default driver? Yes, but by the time you're in the coinstaller, it's too late to set the driver. You're already installing a driver at that point. Coinstallers do not get invoked until after a driver has been selected and the install has begun. > Thanks. What exactly do I need to do in the EXE to achieve this? Also whatever APIs I would use in the exe, wouldn't they available for use in the coinstaller too? Yes, the APIs are available, but again, it's too late to change the INF being installed once you're inside a coinstaller. An EXE would let you run this same code before any installs happen. From an EXE, after you've set the selected driver, you can call DiInstallDevice (https://msdn.microsoft.com/en-us/library/windows/hardware/ff544710(v=vs.85).aspx ) and it will install the selected driver.
  Message 6 of 8  
14 Feb 17 20:20
Suresh Patil
xxxxxx@yahoo.com
Join Date: 17 Feb 2010
Posts To This List: 101
A doubt with device co-installer

Thanks Zac for all your help, but I am sorry I misguided you. I have been testing all the while in WinPE (the device in question is SCSI adapter) and noticing that once the OS installation is complete, I still see MY DRIVE claiming the device. But I see that this behavior is peculiar to WinPE environment. If I install the OS first and then install my driver with my coinstaller, and say I don't claim the device, then I see that it works as expected, i.e. even after system reboot it is the 'other' driver that gets loaded. In WinPE, though this seems to work during installation, the 'selected driver information' is not preserved when the normal OS boots (i.e. does not get staged). Is there any API that I am missing to preserve the changes done to the Driver Store in WinPE? Regards, Suresh
  Message 7 of 8  
21 Feb 17 13:26
ntdev member 171212
xxxxxx@microsoft.com
Join Date:
Posts To This List: 12
A doubt with device co-installer

The driver store is entirely different from the one in WinPE, so anything you do to the WinPE driver store won't affect the driver store of the main OS. You can use DISM to add a driver to the target OS. There's an API for DISM: https://msdn.microsoft.com/en-us/library/windows/desktop/hh825834%28v=vs.85%29.as px Keep in mind that since the driver has a coinstaller, it will not be installed until the OS is up and running - so on the first boot it may not be running the driver you expect.
  Message 8 of 8  
26 Feb 17 11:57
Suresh Patil
xxxxxx@yahoo.com
Join Date: 17 Feb 2010
Posts To This List: 101
A doubt with device co-installer

Thanks Zac for the tip about DISM. > Keep in mind that since the driver has a coinstaller, it will not be installed > until the OS is up and running Does this mean that the coinstaller is supposed to run after OS is up and running when the driver was installed using DISM? I am actually seeing that the coinstaller DOES NOT run at all in this case and have posted in another thread for the confirmation of this behavior.
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 02:35.


Copyright ©2015, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license