none
Is there a SetupDi equivalent for the "Delete the driver software for this device" Device Uninstall option? RRS feed

  • Question

  • Hi all,

    From the Device Manager, one has the option to "Delete the driver software for this device" when uninstalling a device. It seems that the SetupDiRemoveDevice function uninstalls the device, but it does not delete the correspoding software files. Thus, the driver is re-installed the next time the device is connected to the system. I have found this MSDN article which discusses using SetupDi calls to uninstall Devices AND driver packages:

    http://msdn.microsoft.com/en-us/library/ff553634(v=vs.85).aspx

    In this article, it mentions several SetupAPI calls that can be used to remove a device. I was wondering if anyone knows exactly what call(s) are used from the Device Manager to delete the driver package? In other words, what "driver software" files are actually deleted in response to this option?

    Notes from the article:

    DiUninstallDevice - This may be the desired call, but it is only available from Windows 7 on. I need to uninstall the device on WinXP.

    SetupUninstallOEMInf - I have confirmed that my inf file referenced in the "Inf Name" Device Property is no longer present in the C:\Windows\inf folder after uninstalling my device from the Device Manager and selecting the option to delete the software. So I suspect at least this call is made.

    In the above-referenced MSDN article, it also states that SetupAPI cannot be used to delete binary files of the installed driver. I have also confirmed that my driver.sys binary is still present in the C:\Windows\System32\drivers folder, so this file is not a target of the Device Uninstall option. Is SetupUninstallOEMInf the only extra call made to perform the driver software deletion?

    Thanks for your help and have a great day,

    Mike

    Monday, February 28, 2011 3:37 PM

Answers

  • if you install using dpinst you can uninstall using dpinst. That will cleanup most of the system changes done by the install.
    Mark Roddy Windows Driver and OS consultant www.hollistech.com
    Monday, February 28, 2011 4:32 PM
    Moderator
  • the UI is using the driver store APIs for this checkbox (which is what dpinst is calling)


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by miesch1 Tuesday, March 1, 2011 6:31 PM
    Tuesday, March 1, 2011 5:19 AM

All replies

  • if you install using dpinst you can uninstall using dpinst. That will cleanup most of the system changes done by the install.
    Mark Roddy Windows Driver and OS consultant www.hollistech.com
    Monday, February 28, 2011 4:32 PM
    Moderator
  • Mark,

    Thanks for the prompt reply! Unfortunately, I don't have access to the orginal device installation packages. Do you think the Device Manager is using DPInst to uninstall a driver package? Or does it use SetupAPI calls to remove the device and associated files?

    Thanks,

    Mike

    Monday, February 28, 2011 5:16 PM
  • I don't know. As dpinst is so effortless to use I've stopped looking into install mechanisms. Perhaps somebody else will answer.
    Mark Roddy Windows Driver and OS consultant www.hollistech.com
    Monday, February 28, 2011 5:18 PM
    Moderator
  • the UI is using the driver store APIs for this checkbox (which is what dpinst is calling)


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by miesch1 Tuesday, March 1, 2011 6:31 PM
    Tuesday, March 1, 2011 5:19 AM
  • Mark and Doron,

    You both answered my question perfectly! Thanks a ton for your help and have a great day!

    -Mike

    Tuesday, March 1, 2011 6:32 PM