Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to remove .inf files from the system

View products that this article applies to.


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.

↑ Back to the top

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.

↑ Back to the top

Keywords: KB813449, kbplugplay, kbwdm, kbusb

↑ Back to the top

Article Info
Article ID : 813449
Revision : 5
Created on : 8/1/2005
Published on : 8/1/2005
Exists online : False
Views : 398