Skip to content
⌘ NSIS Forum Archive

Registering *.dll

3 posts

Tonst#

Registering *.dll

Hi

I've had a bit of a look but i'm a bit confused.

In ${SourcePath}\Components\ I have *.dll/*.ocx/*.exe that I want to copy to my current $OUTDIR and register. Currently for the DLL/OCX I am using:
  !insertmacro InstallLib REGDLL 0 REBOOT_NOTPROTECTED "${SourcePath}\Components\ADOListView.ocx" "$OUTDIR\ADOListView.ocx" $0
And for the exes:

File "${SourcePath}\PopupMessage.exe"
ExecWait '"$OUTDIR\PopupMessage.exe" /regserver'
However I've got so many files I don't want to hardcode each one, plus it's hassle adding/removing new/old ones, so how can I just do it with a wildcard?

For my .Net files I have:
  File "${SourcePath}\ComponentsDOTNET\*.dll"
${Locate} "$OUTDIR\" "/M=Interop* /L=F /G=0" "Regasm"
And that works fine, the Regasm function simply executes regasm.exe with the filepath to register


I could do the same sort of thing and just call regsvr32 I guess.... Or will that cause problems for me?
Tonst#
Ok Kind of figured it out using a !system and !include to run and include the result of the following at compile time:

!include "FileFunc.nsh"
!insertmacro Locate
!include "${enta_SourceFolder}\Setup\VersionNumber.inc" ;defines SourcePath


OutFile "RegisterVB6Components.exe"
SilentInstall silent

Section
FileOpen $R1 "VB6Registration.inc" w
${Locate} "${SourcePath}\Components\" "/M=*.dll /L=F /G=0" "Regdll"
${Locate} "${SourcePath}\Components\" "/M=*.ocx /L=F /G=0" "Regdll"
${Locate} "${SourcePath}\Components\" "/M=*.exe /L=F /G=0" "Regexe"
FileClose $R1
SectionEnd

Function Regdll
FileWrite $R1 '!insertmacro InstallLib REGDLL $$ALREADY_INSTALLED REBOOT_NOTPROTECTED "$R9" "$$OUTDIR\$R7" "$$OUTDIR\"$\r$\n'

Push $0
FunctionEnd

Function Regexe
;FileWrite $R1 '!insertmacro InstallLib REGEXE $$ALREADY_INSTALLED REBOOT_NOTPROTECTED "$R9" "$$OUTDIR\$R7" "$$OUTDIR\"$\r$\n'

Push $0
FunctionEnd
But it doesn't like REGEXE despite it being in the documentation in Appendix B.... Hmmm