Providing Uninstall for your .INF script

An uninstall mechanism for .INF files can be achieved by writing an Install section in your .INF file that removes the files, registry entries, shortcuts, etc., and then adding your component to the list of programs that can be uinstalled in the Add-Remove Programs control panel.

To add your component to the Add-Remove Programs control panel list, add a new key and values under the following registry key:

HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\app-name,"DisplayName",,"description"

HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\app-name,"UninstallString",,"command-line"

description
This is a string that is displayed in the list box in the Add-Remove Programs control panel

command-line
This is the command line that will be executed when the component is selected from the list box in the Add-Remove Programs control panel. To execute a section in an .INF file, you can use the SETUPX.DLL InstallHinfSection entry point (described below).

The following AddReg entries will populate the list box in the Add-Remove Programs control panel with a description of "My Test Application" and execute the Remove_TestApp Install section in TEST.INF:

HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Test,"DisplayName",,"My Test Application"

HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Test,"UninstallString",,"RunDll setupx.dll,InstallHinfSection Remove_TestApp 4 test.inf"

Notes: