The Library header file can be used to setup dynamic link libraries (DLL) and type libraries (TLB).
If necessary, the following actions will be performed:
\b File copying
\b File copying on reboot
\b Version checks
\b Registration and unregistration
\b Registration and unregistration on reboot
\b Shared DLL counting
\b Windows File Protection checks
The macros are stored in the header file Library.nsh, which should be included in scripts using this system:
\c !include Library.nsh
Note that the library macros are limited on non-Windows platforms. DLL version information is required when compiling on non-Windows platforms.
\H{library_install} Library Installation
\S1{} Introduction
The InstallLib macro allows you to install a library. It sets the error flag if something went wrong during library setup.
To ask the user for a reboot, if required, use the Modern UI with a Finish page or use \R{ifrebootflag}{IfRebootFlag} and make your own page or message box.
The UnInstallLib macro allows you to uninstall a library. It sets the error flag if something went wrong during library removal.
\S1{} Parameters
\c libtype shared uninstall file
\\<b\\>libtype\\</b\\>
The type of the library
DLL - Dynamic link library (DLL)\\<br\\>
REGDLL - DLL that has to be registered\\<br\\>
TLB - Type library or DLL that contains a type LIBRARY\\<br\\>
REGDLLTLB - DLL that has to be registered and contains a type library\\<br\\>
\\<b\\>shared\\</b\\>
Specify whether the library is shared with other applications
NOTSHARED - The library is not shared\\<br\\>
SHARED - The library is shared and should be removed if the shared library count
indicates that the file is not in use anymore..\\<br\\>
\\<b\\>uninstall\\</b\\>
Specify the uninstallation method
NOREMOVE
\b 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
\b Remove the library on reboot when in use (required for system files).
\b Remove the library if the file is not protected by Windows File Protection.
NOREBOOT_PROTECTED
\b Warns the user when the library is in use. The user will have to close applications using the library.
\b Remove the library if the file is not protected by Windows File Protection.
REBOOT_NOTPROTECTED
\b Remove the library on reboot when in use (required for system files).
\b Remove the library without checking for Windows File Protection.
NOREBOOT_NOTPROTECTED
\b Warns the user when the library is in use. The user will have to close applications using the library.
\b Remove the library without checking for Windows File Protection.
\\<b\\>file\\</b\\>
Location of the library
\S1{} Options
\R{define}{Define} any of the following before inserting the UnInstallLib macro to modify its behavior as specified.
\S2{} LIBRARY_X64
\b Uninstalls a DLL built for Windows x64.
\b \\<b\\>Warning:\\</b\\> this resets \R{setregview}{RegSetView} and file system redirection.
\S2{} LIBRARY_SHELL_EXTENSION
\b 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.
\S2{} LIBRARY_COM
\b Define this before inserting UninstallLib macro to call CoFreeUnusedLibraries after unregistration. Use this for unloading all unnecessary libraries from memory when uninstalling COM libraries.
\c ;Add code here that sets $AlreadyInstalled to a non-zero value if the application is already installed. For example:
\c IfFileExists "$INSTDIR\MyApp.exe" 0 new_installation ;Replace MyApp.exe with your application filename
\c StrCpy $AlreadyInstalled 1
\c new_installation:
\c
\c !insertmacro VB6RunTimeInstall C:\vb6runtimes $AlreadyInstalled ;Replace C:\vb6runtimes with the location of the files
\c
\c SectionEnd
\c
\c Section "-un.Uninstall VB6 run-time files"
\c
\c !insertmacro VB6RunTimeUnInstall
\c
\c SectionEnd
Remarks:
\b You may have to install additional files for such Visual Basic application to work, such as OCX files for user interface controls.
\b Installation of the run-time files requires Administrator or Power User privileges. Use the Multi-User header file to verify whether these privileges are available.
\b Add a Modern UI finish page or another check (see \R{ifrebootflag}{IfRebootFlag}) to allow the user to restart the computer when necessary.