Extracted from my code:
; -----------------------------
; Includes & Defines
!include "..\common\src\GlobalDefines.nsh"
!include "MUI.nsh"
(...)
; -----------------------------
; Modern Interface
; MUI Settings
!define MUI_ABORTWARNING
; MUI Settings / Icons
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
; MUI Settings / Header
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "${GRAPHICS_DIR}\installtop.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${GRAPHICS_DIR}\uninstalltop.bmp"
; MUI Settings / Wizard
!define MUI_WELCOMEFINISHPAGE_BITMAP "${GRAPHICS_DIR}\installside.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${GRAPHICS_DIR}\uninstallside.bmp"
(... including section writing the uninstaller ...)
; ========================
; Uninstaller
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
Function un.onGUIInit
; get instance from the uninstall.ini file
ReadIniStr $INSTANCE "$INSTDIR\Uninstall.ini" "Uninstall" "Instance"
; TODO - close application if it is running
FunctionEnd
Section "un.Uninstall all"
; Media
ReadIniStr $0 "$INSTDIR\Uninstall.ini" "Uninstall" "MediaDir"
${If} $0 != ""
Delete "$0\*.*"
RMDir "$0"
${EndIf}
; Database
ReadIniStr $0 "$INSTDIR\Uninstall.ini" "Uninstall" "DatabaseDir"
${If} $0 != ""
Delete "$0\*.*"
RMDir "$0"
${EndIf}
; Settings
ReadIniStr $0 "$INSTDIR\Uninstall.ini" "Uninstall" "InstanceType"
${If} $0 == "/reg"
DeleteRegKey HKLM "${IS_REGKEY}\${APP_NAME}\$INSTANCE"
${ElseIf} $0 == "/xml"
ReadRegStr $1 HKLM "${IS_REGKEY}\Paths" "AppConfigRoot"
Delete "$1\${APP_NAME}\Config-$INSTANCE.xml"
${EndIf}
; Launcher
; TODO - remove registration with launcher via LauncherManager
; Program Files
Delete "$INSTDIR\*.*"
RMDir "$INSTDIR"
; remove uninstaller entry from registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}-$INSTANCE"
; TODO - offer to remove Firebird as well...
SectionEnd