diff --git a/Docs/src/library.but b/Docs/src/library.but index 72fd70a4..e0157587 100644 --- a/Docs/src/library.but +++ b/Docs/src/library.but @@ -70,7 +70,7 @@ REBOOT_PROTECTED NOREBOOT_PROTECTED \b Warns the user when the library is in use. The user will have to close applications using the library. - + \b Upgrade the library if the file is not protected by Windows File Protection. REBOOT_NOTPROTECTED @@ -82,7 +82,7 @@ REBOOT_NOTPROTECTED NOREBOOT_NOTPROTECTED \b Warns the user when the library is in use. The user will have to close applications using the library. - + \b Upgrade the library without checking for Windows File Protection. \\localfile\\ @@ -100,6 +100,16 @@ Directory on the user's system to store a temporary file when the system has to For Windows 9x/ME support, this directory should be on the same volume as the destination file (destfile). The Windows temp directory could be located on any volume, so you cannot use this directory. +\S1{} Options + +LIBRARY_SHELL_EXTENSION + +\b Define this before inserting InstallLib macro to call SHChangeNotify with SHCNE_ASSOCCHANGED after registration. Use this to refresh the shell when installing a shell extension or when changing file associations. + +LIBRARY_COM + +\b Define this before inserting InstallLib macro to call CoFreeUnusedLibraries after registration. Use this for unloading all unnecessary libraries from memory when installing COM libraries. + \S1{} Notes \b If you want to support Windows 9x/ME, you can only use short filenames (8.3). @@ -110,7 +120,7 @@ The Windows temp directory could be located on any volume, so you cannot use thi \c ;Add code here that sets $ALREADY_INSTALLED to a non-zero value if the application is \c ;already installed. For example: -\c +\c \c IfFileExists "$INSTDIR\MyApp.exe" 0 new_installation ;Replace MyApp.exe with your application filename \c StrCpy $ALREADY_INSTALLED 1 \c new_installation: @@ -177,12 +187,22 @@ 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 Remove the library without checking for Windows File Protection. \\file\\ -Location of the library +Location of the library + +\S1{} Options + +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. + +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. \S1{} Example @@ -217,9 +237,9 @@ To ask the user for a reboot if required, use the Modern UI with a Finish page o \c !include Library.nsh \c \c Var ALREADY_INSTALLED -\c +\c \c Section "-Install VB6 runtimes" -\c +\c \c ;Add code here that sets $ALREADY_INSTALLED to a non-zero value if the application is already installed. For example: \c \c IfFileExists "$INSTDIR\MyApp.exe" 0 new_installation ;Replace MyApp.exe with your application filename @@ -232,18 +252,18 @@ To ask the user for a reboot if required, use the Modern UI with a Finish page o \c !insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED "comcat.dll" "$SYSDIR\comcat.dll" "$SYSDIR" \c !insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_PROTECTED "asycfilt.dll" "$SYSDIR\asycfilt.dll" "$SYSDIR" \c !insertmacro InstallLib TLB $ALREADY_INSTALLED REBOOT_PROTECTED "stdole2.tlb" "$SYSDIR\stdole2.tlb" "$SYSDIR" -\c +\c \c SectionEnd \c \c Section "-un.Uninstall VB6 runtimes" -\c +\c \c !insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\msvbvm60.dll" -\c !insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\oleaut32.dll" +\c !insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\oleaut32.dll" \c !insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\olepro32.dll" -\c !insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\comcat32.dll" +\c !insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\comcat32.dll" \c !insertmacro UnInstallLib DLL SHARED NOREMOVE "$SYSDIR\asycfilt.dll" \c !insertmacro UnInstallLib TLB SHARED NOREMOVE "$SYSDIR\stdole2.tlb" -\c +\c \c SectionEnd You can use similar code to install common VB6 ActiveX controls (such as the controls for Windows Common Controls). diff --git a/Include/Library.nsh b/Include/Library.nsh index ed797728..5f29f460 100644 --- a/Include/Library.nsh +++ b/Include/Library.nsh @@ -16,46 +16,56 @@ Usage: Parameters: -libtype The type of the library +libtype The type of the library - DLL Dynamic link library (DLL) - REGDLL DLL that has to be registered - TLB Type library or DLL that contains a type LIBRARY - REGDLLTLB DLL that has to be registered and contains a type library + DLL Dynamic link library (DLL) + REGDLL DLL that has to be registered + TLB Type library or DLL that contains a type LIBRARY + REGDLLTLB DLL that has to be registered and contains a type library -shared Specify whether the library is shared with other applications +shared Specify whether the library is shared with other applications - NOTSHARED The library is not shared - $VARNAME Variable that is empty when the application is installed for the first time, - which is when the shared library count will be increased. + NOTSHARED The library is not shared + $VARNAME Variable that is empty when the application is installed for the first time, + which is when the shared library count will be increased. -install Specify the installation method +install Specify the installation method - REBOOT_PROTECTED * Upgrade the library on reboot when in use (required for system files). - * Upgrade the library if the file is not protected by Windows File Protection. + REBOOT_PROTECTED * Upgrade the library on reboot when in use (required for system files). + * Upgrade 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. - * Upgrade 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. + * Upgrade the library if the file is not protected by Windows File Protection. - REBOOT_NOTPROTECTED * Upgrade the library on reboot when in use (required for system files). - * Upgrade the library without checking for Windows File Protection. + REBOOT_NOTPROTECTED * Upgrade the library on reboot when in use (required for system files). + * Upgrade 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. - * Upgrade 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. + * Upgrade the library without checking for Windows File Protection. -localfile Location of the library on the compiler system +localfile Location of the library on the compiler system -destfile Location to store the library on the user's system +destfile Location to store the library on the user's system -tempbasedir Directory on the user's system to store a temporary file when the system has - to be rebooted. +tempbasedir Directory on the user's system to store a temporary file when the system has + to be rebooted. - For Windows 9x/ME support, this directory should be on the same volume as the - destination file (destfile). - The Windows temp directory could be located on any volume, so you cannot use - this directory. + For Windows 9x/ME support, this directory should be on the same volume as the + destination file (destfile). + The Windows temp directory could be located on any volume, so you cannot use + this directory. + +Options: + +LIBRARY_SHELL_EXTENSION + + Define this before inserting InstallLib macro to call SHChangeNotify with SHCNE_ASSOCCHANGED after registration. Use this to refresh the shell when installing a shell extension or when changing file associations. + +LIBRARY_COM + + Define this before inserting InstallLib macro to call CoFreeUnusedLibraries after registration. Use this for unloading all unnecessary libraries from memory when installing COM libraries. Notes: @@ -86,40 +96,50 @@ Usage: Parameters: -libtype The type of the library +libtype The type of the library - DLL Dynamic link library (DLL) - REGDLL DLL that has to be registered - TLB Type library or DLL that contains a type LIBRARY - REGTLB DLL that has to be registered and contains a type library + DLL Dynamic link library (DLL) + REGDLL DLL that has to be registered + TLB Type library or DLL that contains a type LIBRARY + REGTLB DLL that has to be registered and contains a type library -shared Specify whether the library is shared with other applications +shared Specify whether the library is shared with other applications - NOTSHARED The library is not shared - SHARE The library is shared and should be removed if the shared library count - indicates that the file is not in use anymore. + NOTSHARED The library is not shared + SHARE 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 +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. + 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. + 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. + 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. + 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. + 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 +file Location of the library + +Options: + +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. + +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. ------------------------ @@ -133,6 +153,13 @@ Example: !define LIB_INCLUDED +!ifndef SHCNE_ASSOCCHANGED + !define SHCNE_ASSOCCHANGED 0x08000000 +!endif +!ifndef SHCNF_IDLIST + !define SHCNF_IDLIST 0x0000 +!endif + !macro InstallLib libtype shared install localfile destfile tempbasedir !verbose push @@ -409,6 +436,18 @@ Example: !endif + !ifdef LIBRARY_SHELL_EXTENSION + + System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' + + !endif + + !ifdef LIBRARY_COM + + System::Call 'Ole32::CoFreeUnusedLibraries()' + + !endif + ;------------------------ ;Done @@ -537,7 +576,7 @@ Example: WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0 Goto uninstalllib.done_${UNINSTALLLIB_UNIQUE} - uninstalllib.shareddlldone_${UNINSTALLLIB_UNIQUE}: + uninstalllib.shareddlldone_${UNINSTALLLIB_UNIQUE}: !endif @@ -577,6 +616,18 @@ Example: !endif + !ifdef LIBRARY_SHELL_EXTENSION + + System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' + + !endif + + !ifdef LIBRARY_COM + + System::Call 'Ole32::CoFreeUnusedLibraries()' + + !endif + ;------------------------ ;Delete