Skip to content
⌘ NSIS Forum Archive

Spaces in path when using upgradedll macro

13 posts

Bugge T. Jensen#

Spaces in path when using upgradedll macro

Hi

I want to use the upgrade macro like

Push "$PROGRAMFILES\common files\designer\Mscdrun.dll"
!define DLL_NAME ${SOURCE}\c_program_files\common files\designer\Mscdrun.dll
!insertmacro UpgradeDLL

But due to the space in the path this fails

Any ideas

😕
Joost Verburg#
You should use my new UpgradeDLL macro, which works better and supports spaces.

You can find it in the NSIS 2 documentation:
Bugge T. Jensen#
Hi

I dont use NSIS 2.0 yet so i think thats the problem.

The exact error is

Push: "$PROGRAMFILES\common files\designer\Mscdrun.dll"
!define expects 1-1 parameters, got 3.
Usage: !define symbol [value]
Joost Verburg#
That UpgradeDLL macro is very old and does not fully handle reboot flags etc.

My new macro should also be compatible with NSIS 1.98. Get it from the link I gave you above.
Bugge T. Jensen#
I use nsis 1.98 so my guess is that the 2.0 macro will work

the exact error is

Push: "$PROGRAMFILES\common files\designer\Mscdrun.dll"
!define expects 1-1 parameters, got 3.
Usage: !define symbol [value]
Bugge T. Jensen#
Hi
OK. Did try your macro

with the command

!insertmacro UpgradeDLL "${SOURCE}\c_system32\Mschrt20.ocx" "$WINDIR\Mschrt20.ocx"

But get an error er don't understand


Section: "System32"
SetOutPath: "$WINDIR\Fonts"
File: "WINGDNG2.TTF" 59696 bytes
!insertmacro: UpgradeDLL
Push: $R0
Push: $R1
Push: $R2
Push: $R3
IfFileExists: "$WINDIR\Mschrt20.ocx" ? : copy_c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx
ClearErrors
GetDLLVersionLocal: c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx (393216,5767172)->($R0,$R1)
GetDLLVersion: $WINDIR\Mschrt20.ocx->$R2,$R3
IfErrors ?upgrade_c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx:
IntCmpU $R0:$R2 equal=, < done_c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx, > upgrade_c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx
IntCmpU $R1:$R3 equal=done_c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx, < done_c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx, > upgrade_c:\TEMP\sn\CBT\install\c_system32\Mschrt20.ocx
Error: !if/!else/!ifdef can only be specified in file mode, not in command/macro mode
Error in macro UpgradeDLL on macroline 26
Error in script "C:\temp\SN\install_cbt\SN_CBT.nsi" on line 76 -- aborting creation process
Joost Verburg#
Forgot about that, NSIS 1.98 doesn't support !if and friends in macro's.

So you have to upgrade to NSIS 2 to use this macro. Download the latest snapshot at http://nsis.sf.net. It's really stable now, so upgrading won't result in any problems.

You can also remove the

!ifndef UPGRADEDLL_NOREGISTER
!endif

lines from the macro, if you are not using UPGRADEDLL_NOREGISTER.
Bugge T. Jensen#
Hi again

I have now installed the nsis20a7 and is using your macro
but still have the

Error: !if/!else/!ifdef can only be specified in file mode, not in command/macro
mode
Error in macro UpgradeDLL on macroline 26

problem ??

anyway thanks
Joost Verburg#
Alpha 7 is a very old version which also doesn't support this feature.

Download the latest snapshot at http://nsis.sourceforge.net/nightly/nsis.zip
kichik#
If you still want to use NSIS 1.98 your problem was you didn't quote. Your !define should have looked like this:

!define DLL_NAME "${SOURCE}\c_program_files\common files\designer\Mscdrun.dll"