new header file for the setup of Visual Basic 6.0 run-time files

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5489 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
joostverburg 2008-01-24 21:45:42 +00:00
parent 23e1474468
commit 858ddb4141
4 changed files with 392 additions and 325 deletions

View file

@ -3,8 +3,8 @@
\H{library_intro} Introduction
NSIS 2.01 features a new system for the installation and uninstallation of dynamic link libraries (DLL) and type libraries (TLB).
Using this new system you can handle the complete setup with one single line of code:
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
@ -242,61 +242,36 @@ Location of the library
\c !insertmacro UnInstallLib REGDLL SHARED REBOOT_NOTPROTECTED $SYSDIR\dllname.dll
\H{library_vb6} Visual Basic 6 Runtimes
\H{library_vb6} Visual Basic 6 Run-Time Files
Add this code to your script to install and uninstall the VB6 runtimes.
A new VB6.nsh header file is available for the setup of the VB6 run-time files.
To obtain the latest run-time files, download \W{http://nsis.sourceforge.net/vb6runtime.zip} and extract this file.
The correct version of the following files should be stored in your script folder
(or modify the paths to the local files if you want to use another folder):
\b msvbvm60.dll
\b oleaut32.dll
\b olepro32.dll
\b oleaut32.dll
\b comcat.dll
\b asycfilt.dll
\b stdole2.tlb
A \W{http://support.microsoft.com/default.aspx?scid=kb;en-us;290887}{Microsoft article} that explains how to obtain these files is available.
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.
\c !include Library.nsh
\c !include VB6RunTime.nsh
\c
\c Var ALREADY_INSTALLED
\c Var AlreadyInstalled
\c
\c Section "-Install VB6 runtimes"
\c
\c ;Add code here that sets $ALREADY_INSTALLED to a non-zero value if the application is already installed. For example:
\c Section "-Install VB6 run-time files"
\c
\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 $ALREADY_INSTALLED 1
\c StrCpy $AlreadyInstalled 1
\c new_installation:
\c
\c !insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "msvbvm60.dll" "$SYSDIR\msvbvm60.dll" "$SYSDIR"
\c !insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED "oleaut32.dll" "$SYSDIR\oleaut32.dll" "$SYSDIR"
\c !insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED "olepro32.dll" "$SYSDIR\olepro32.dll" "$SYSDIR"
\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 !insertmacro VB6RunTimeInstall C:\vb6runtimes $AlreadyInstalled ;Replace C:\vb6runtimes with the location of the files
\c
\c SectionEnd
\c
\c Section "-un.Uninstall VB6 runtimes"
\c Section "-un.Uninstall VB6 run-time files"
\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\olepro32.dll"
\c !insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\comcat.dll"
\c !insertmacro UnInstallLib DLL SHARED NOREMOVE "$SYSDIR\asycfilt.dll"
\c !insertmacro UnInstallLib TLB SHARED NOREMOVE "$SYSDIR\stdole2.tlb"
\c !insertmacro VB6RunTimeUnInstall
\c
\c SectionEnd
You can use similar code to install common VB6 ActiveX controls (such as the controls for Windows Common Controls).
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.

View file

@ -154,6 +154,7 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
File ..\Include\LangFile.nsh
File ..\Include\InstallOptions.nsh
File ..\Include\MultiUser.nsh
File ..\Include\VB6RunTime.nsh
SetOutPath $INSTDIR\Docs\StrFunc
File ..\Docs\StrFunc\StrFunc.txt

View file

@ -11,6 +11,7 @@ includes = Split("""
StrFunc.nsh
TextFunc.nsh
UpgradeDLL.nsh
VB6RunTime.nsh
WinMessages.nsh
WinVer.nsh
WordFunc.nsh

90
Include/VB6RunTime.nsh Normal file
View file

@ -0,0 +1,90 @@
/*
VB6RunTime.nsh
Setup of Visual Basic 6.0 run-time files, including the Oleaut32.dll security update
Copyright © 2008 Joost Verburg
To obtain the run-time files, download and extract
http://nsis.sourceforge.net/vb6runtime.zip
Script code for installation:
!insertmacro InstallVB6RunTime FOLDER ALREADY_INSTALLED
in which FOLDER is the location of the run-time files and ALREADY_INSTALLED is the
name of a variable that is empty when the application is installed for the first time
and non-empty otherwise
Script code for uninstallation:
!insertmacro UnInstallVB6RunTime
Remarks:
* You may have to install additional files for such Visual Basic application to work,
such as OCX files for user interface controls.
* 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.
* Add a Modern UI finish page or another check (see IfRebootFlag in the NSIS Users
Manual) to allow the user to restart the computer when necessary.
*/
!ifndef VB6_INCLUDED
!define VB6_INCLUDED
!verbose push
!verbose 3
!include Library.nsh
!include WinVer.nsh
!macro VB6RunTimeInstall FOLDER ALREADY_INSTALLED
!insertmacro InstallLib REGDLL "${ALREADY_INSTALLED}" REBOOT_NOTPROTECTED "${FOLDER}\msvbvm60.dll" "$SYSDIR\msvbvm60.dll" "$SYSDIR"
;The files below will only be installed on Win9x/NT4
!insertmacro InstallLib REGDLL "${ALREADY_INSTALLED}" REBOOT_PROTECTED "${FOLDER}\olepro32.dll" "$SYSDIR\olepro32.dll" "$SYSDIR"
!insertmacro InstallLib REGDLL "${ALREADY_INSTALLED}" REBOOT_PROTECTED "${FOLDER}\comcat.dll" "$SYSDIR\comcat.dll" "$SYSDIR"
!insertmacro InstallLib DLL "${ALREADY_INSTALLED}" REBOOT_PROTECTED "${FOLDER}\asycfilt.dll" "$SYSDIR\asycfilt.dll" "$SYSDIR"
!insertmacro InstallLib TLB "${ALREADY_INSTALLED}" REBOOT_PROTECTED "${FOLDER}\stdole2.tlb" "$SYSDIR\stdole2.tlb" "$SYSDIR"
Push $R0
${if} ${IsNT}
${if} ${IsWinNT4}
ReadRegStr $R0 HKLM "System\CurrentControlSet\Control" "ProductOptions"
${if} $R0 == "Terminal Server"
!insertmacro InstallLib REGDLL "${ALREADY_INSTALLED}" REBOOT_NOTPROTECTED "${FOLDER}\NT4TS\oleaut32.dll" "$SYSDIR\oleaut32.dll" "$SYSDIR"
${else}
!insertmacro InstallLib REGDLL "${ALREADY_INSTALLED}" REBOOT_NOTPROTECTED "${FOLDER}\NT4\oleaut32.dll" "$SYSDIR\oleaut32.dll" "$SYSDIR"
${endif}
${endif}
${else}
;No Oleaut32.dll with the security update has been released for Windows 9x.
;The NT4 version is used because NT4 and Win9x used to share the same 2.40 version
;and version 2.40.4519.0 is reported to work fine on Win9x.
!insertmacro InstallLib REGDLL "${ALREADY_INSTALLED}" REBOOT_NOTPROTECTED "${FOLDER}\NT4\oleaut32.dll" "$SYSDIR\oleaut32.dll" "$SYSDIR"
${endif}
Pop $R0
!macroend
!macro VB6RunTimeUnInstall
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\msvbvm60.dll"
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\oleaut32.dll"
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\olepro32.dll"
!insertmacro UnInstallLib REGDLL SHARED NOREMOVE "$SYSDIR\comcat.dll"
!insertmacro UnInstallLib DLL SHARED NOREMOVE "$SYSDIR\asycfilt.dll"
!insertmacro UnInstallLib TLB SHARED NOREMOVE "$SYSDIR\stdole2.tlb"
!macroend
!verbose pop
!endif