7

At MSDN it is stated that there are two techniques to install INF files on Windows XP or later:

  • Programmatically through SetupCopyOEMInf function.
  • Add an entry called CopyInf on an INF section.

Are there an equivalent entry on an inf section to uninstall inf files that is similar to SetupUninstallOEMInf function?

I found this solution using SetupUninstallOEMInf but it does not seems suitable to me.

coelhudo
  • 182

4 Answers4

4

Well it depends on the .inf file (some may not have un-installation function at all), but you could always try one of the following:

rundll32 setupapi.dll,InstallHinfSection DefaultUninstall 132 <driver.inf>

rundll32 advpack.dll,LaunchINFSection <driver.inf>,UnInstall

rundll32 syssetup.dll,SetupInfObjectInstallAction Uninstall.NT 4 <driver.inf>

(Of course, replace the filename, including quotes as necessary.)

Synetech
  • 69,547
3

No, driver INF files do not typically feature an uninstall section. As per How to remove .inf files from the system and How Devices and Driver Packages are Uninstalled | Microsoft Docs , DiUninstallDevice and SetupUninstallOEMInf are the ways to uninstall a device and a driver package, correspondingly.

From the console, you can call the latter with devcon of at least version 6 (from Windows 8.x DDK; confirmed to work in XP):

devcon [-f] dp_delete oemXXX.inf

(-f forces uninstallation even if the driver is in use)

See Quick Method to install DevCon.exe? how to download the utility if you need to do this by hand.

From an installer package, you need to use facilities provided by the installer framework that would call those API for you.

ivan_pozdeev
  • 1,973
1

In my case the rundll32 method failed, and finding it hard to get a hold of devcon.exe, I discovered another way, as suggested by Deleting a Driver Package from the Driver Store. What you basically have to do is to open a cmd-prompt in administrative mode and issue the following command:

C:\Windows\INF\>pnputil /delete-driver <example.inf> /uninstall
0

You may not initially know the OEM###.INF filename but that name is what Microsoft calls the driver for the INF you installed. Look in the registry for your actual INF filename and see what OEM###.INF it corresponds to (replace ### with 3 digits shown in registry), then you can use pnputil /delete-driver OEM###.inf and you'll notice it finds both copies in the driver store repository folders and removes them the proper way. This applies at least to Windows 10 Pro 64-bit but I assume other editions and versions as well.