banner graphic
Reference

Providing Uninstall Functionality in an .inf Script

You can provide uninstall functionality in your .inf files by adding an Install section that removes the files, registry entries, and shortcuts, then adds your component to the list of programs that can be uninstalled from the Add/Remove Programs dialog box in Control Panel. An example is included in the Inf folder of the IEAK Toolkit.

To add your component to the Add/Remove Programs dialog box, 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 string is displayed in the list box in the Add/Remove Programs dialog box.

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 dialog box. To execute a section in an .inf file, you can use the Setupx.dll InstallHinfSection entry point (described below).

The following sample AddReg entries add "My Test Application" to the list box in the Add/Remove Programs dialog box and executes 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