How to remove .inf files from the system

Article translations Article translations
Article ID: 813449 - View products that this article applies to.
Expand all | Collapse all

SUMMARY

This article lists the steps and some tips to help the OEM driver developer write an "uninstall" package that safely removes .inf files from the system. You have to have administrative credentials to complete these steps.
To remove .inf files, follow these steps:

Note Microsoft recommends that you leave your driver files where they are, if possible, even after you remove your value added applications and .inf files. Other devices and drivers on the system may reference your driver and will stop functioning correctly if the driver files are removed.
  1. Retrieve the path and file name of your .inf file:
    • The .inf files are located in the %Windir%\Inf folder, and are accompanied by a system-maintained .pnf file with the same root name. When third-party drivers are installed correctly, the .inf is renamed to Oemxx.inf (where xx is a sequential number) to make sure that there are no name conflicts with drivers that are included with the product and with other third-party drivers. You can find the installed name of your driver by using the SetupCopyOEMInf function with the SP_COPY_REPLACEONLY flag and the full path name to your original .inf file (SetupCopyOEMInf is documented in the operating system SDK).
    • If the original .inf file has been moved, use the full path name to the new location of your .inf file. If the original .inf does not exist on the system, you have to enumerate all the Oemxx.inf files. In each one, check the Provider, DriverVer, Hardware IDs, and other properties to identify the .inf files that you must remove. There is code that does the enumeration and details retrieval in the FindCurrentDriver routine in Dump.cpp of the DevCon sample code (in the Windows Driver Development Kit under Src\Setup\Devcon).
    • You can also retrieve the Oemxx.inf name from the "InfPath" REG_SZ value under the associated device's driver key, before the device has been removed.
      • For Windows XP and later versions, use SetupDiBuildDriverInfoList with DeviceInstallParams.FlagsEx set to DI_FLAGSEX_INSTALLEDDRIVER to obtain details about the installed driver.
      • For Windows 2000, use SetupDiOpenDevRegKey to find the key.
  2. Remove the .inf file and associated files.
    • On Windows XP and later operating systems, after you have the actual name of the .inf file in the \Inf folder, you can use SetupUninstallOEMInf to correctly remove it.
    • On Windows 2000, follow these steps:
      1. Enumerate all the devices and make sure that none are using your driver.
      2. Use DeleteFile to remove only the .pnf files from the %Windir%\Inf folder.
      3. Use DeleteFile to finally remove the .inf files from the %Windir%\Inf folder.

Properties

Article ID: 813449 - Last Review: August 1, 2005 - Revision: 4.1
APPLIES TO
  • Microsoft Windows 2000 Professional Edition
  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows Server 2003 Service Pack 1
Keywords: 
kbusb kbwdm kbplugplay KB813449

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com