Archive: Proper Installation of VB6 System Files


Proper Installation of VB6 System Files
Hello. I'm coming over from Inno Setup and it seems like "SetOverwrite ifnewer" isn't the right way to approach the following 6 necessary files for a VB6 project:

stdole2.tlb
msvbvm60.dll
oleaut32.dll
olepro32.dll
asycfilt.dll
comcat.dll

Here are the flags that I used to set in Inno:

; begin VB system files
Source: "E:\Ichiban Sudoku\SysFiles\stdole2.tlb"; DestDir: "{sys}"; Flags: restartreplace uninsneveruninstall sharedfile regtypelib
Source: "E:\Ichiban Sudoku\SysFiles\msvbvm60.dll"; DestDir: "{sys}"; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "E:\Ichiban Sudoku\SysFiles\oleaut32.dll"; DestDir: "{sys}"; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "E:\Ichiban Sudoku\SysFiles\olepro32.dll"; DestDir: "{sys}"; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: "E:\Ichiban Sudoku\SysFiles\asycfilt.dll"; DestDir: "{sys}"; Flags: restartreplace uninsneveruninstall sharedfile
Source: "E:\Ichiban Sudoku\SysFiles\comcat.dll"; DestDir: "{sys}"; Flags: restartreplace uninsneveruninstall sharedfile regserver
; end VB system files

Should I be switching SetOverwrite to Off? I think you want to update these files if possible though, right?

Also, is there some equivalent of the restartreplace, where a file in use will be updated but the user will be asked to reboot? I had two files that I had to ignore updating on my first try at installing.

Thanks.


There's a section in the documentation about the installation of VB6 runtimes. The Library macros handle overwriting the files.


Thanks for the link!

I added the code

 !include Library.nsh

Var ALREADY_INSTALLED

Section "-Install VB6 runtimes"

;Add code here that sets $ALREADY_INSTALLED to a non-zero value if the application is already installed. For example:

IfFileExists "$INSTDIR\ichiban.exe" 0 new_installation ;Replace MyApp.exe with your application filename
StrCpy $ALREADY_INSTALLED 1
new_installation:

!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "msvbvm60.dll" "$SYSDIR\msvbvm60.dll" "$SYSDIR"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED "oleaut32.dll" "$SYSDIR\oleaut32.dll" "$SYSDIR"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED "olepro32.dll" "$SYSDIR\olepro32.dll" "$SYSDIR"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED "comcat.dll" "$SYSDIR\comcat.dll" "$SYSDIR"
!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_PROTECTED "asycfilt.dll" "$SYSDIR\asycfilt.dll" "$SYSDIR"
!insertmacro InstallLib TLB $ALREADY_INSTALLED REBOOT_PROTECTED "stdole2.tlb" "$SYSDIR\stdole2.tlb" "$SYSDIR"

SectionEnd

Section "-un.Uninstall VB6 runtimes"

!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"

SectionEnd


I switched the myapp to my app's name on the IfFileExists line, and my script does have a finish page, any idea why I get an error in macro InstallLib on this line

!error "InstallLib: The library ${LOCALFILE} could not be found."

with the first !insertmacro?

I've tried some variations by pointing to system files I keep outside the Windows/System32 folder for safe keeping with no luck so far.

Does it actually say "${LOCALFILE}" instead of, say, msvbvm60.dll? Which line in your script produces this error? Have you tried providing a full path to the DLLs in the fourth macro parameter?