Library Uninstallation

NSIS

Previous | Contents | Next

B.3 Library Uninstallation

B.3.1 Introduction

The UnInstallLib macro allows you to uninstall a library. It sets the error flag if something went wrong during library removal.

B.3.2 Parameters

libtype shared uninstall file

libtype

The type of the library

DLL - Dynamic link library (DLL)
REGDLL - DLL that has to be unregistered
REGEXE - EXE COM server that has to be unregistered using /unregserver
TLB - Type library or DLL that contains a type library
REGDLLTLB - DLL that has to be unregistered and contains a type library

shared

Specify whether the library is shared with other applications

NOTSHARED - The library is not shared
SHARED - The library is shared and should be removed if the shared library count indicates that the file is not in use anymore..

uninstall

Specify the uninstallation method

NOREMOVE

  • The library should not be removed. You should use this option for common or important system files such as the Visual Basic/C++/MFC runtimes.

REBOOT_PROTECTED

  • Remove the library on reboot when in use (required for system files).
  • Remove the library if the file is not protected by Windows File Protection.

NOREBOOT_PROTECTED

  • Warns the user when the library is in use. The user will have to close applications using the library.
  • Remove the library if the file is not protected by Windows File Protection.

REBOOT_NOTPROTECTED

  • Remove the library on reboot when in use (required for system files).
  • Remove the library without checking for Windows File Protection.

NOREBOOT_NOTPROTECTED

  • Warns the user when the library is in use. The user will have to close applications using the library.
  • Remove the library without checking for Windows File Protection.

file

Location of the library

B.3.3 Options

Define any of the following before inserting a UnInstallLib macro to modify its behavior as specified.

B.3.3.1 LIBRARY_X64

  • Uninstalls a DLL built for Windows x64.
  • Warning: This resets SetRegView and file system redirection.

B.3.3.2 LIBRARY_SHELL_EXTENSION

  • Define this before inserting UninstallLib macro to call SHChangeNotify with SHCNE_ASSOCCHANGED after unregistration. Use this to refresh the shell when uninstalling a shell extension or when changing file associations.

B.3.3.3 LIBRARY_COM

  • Define this before inserting UninstallLib macro to call CoFreeUnusedLibraries after unregistration. Use this for unloading all unnecessary libraries from memory when uninstalling COM libraries.

B.3.4 Example

 !insertmacro UnInstallLib REGDLL SHARED REBOOT_NOTPROTECTED $SYSDIR\dllname.dll

Previous | Contents | Next