Microsoft KB Archive/813449

= How to remove .inf files from the system =

Article ID: 813449

Article Last Modified on 8/1/2005

-

APPLIES TO


 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional
 * Microsoft Windows Server 2003 Service Pack 1

-



SUMMARY
This article lists the steps and some tips to help the OEM driver developer write an &quot;uninstall&quot; 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.  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 Oem .inf (where  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 Oem .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 Oem .inf name from the &quot;InfPath&quot; 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. </li></ul> </li> 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.</li> On Windows 2000, follow these steps: <ol style="list-style-type: lower-alpha;"> Enumerate all the devices and make sure that none are using your driver.</li> Use DeleteFile to remove only the .pnf files from the %Windir%\Inf folder.</li> Use DeleteFile to finally remove the .inf files from the %Windir%\Inf folder.</li></ol> </li></ul> </li></ol>

Keywords: kbwdm kbplugplay kbusb KB813449

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.