From 5ac3364d92123ec43e5f84b9f2a6acc6b59fb36e Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 30 Jun 2005 19:11:09 +0000 Subject: [PATCH] use new RegTool (also fixes bug #1230336) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4147 212acab6-be3b-0410-9dea-997c60f758d6 --- Include/UpgradeDLL.nsh | 53 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/Include/UpgradeDLL.nsh b/Include/UpgradeDLL.nsh index 73de66c2..46b93762 100644 --- a/Include/UpgradeDLL.nsh +++ b/Include/UpgradeDLL.nsh @@ -40,6 +40,53 @@ Example: !define UPGRADEDLL_INCLUDED +!macro __UpgradeDLL_Helper_AddRegToolEntry mode filename tempdir + + Push $R0 + Push $R1 + Push $R2 + Push $R3 + + ;------------------------ + ;Copy the parameters + + Push "${filename}" + Push "${tempdir}" + + Pop $R2 ; temporary directory + Pop $R1 ; file name to register + + ;------------------------ + ;Advance counter + + StrCpy $R0 0 + ReadRegDWORD $R0 HKLM "Software\NSIS.Library.RegTool.v2\UpgradeDLLSession" "count" + IntOp $R0 $R0 + 1 + WriteRegDWORD HKLM "Software\NSIS.Library.RegTool.v2\UpgradeDLLSession" "count" "$R0" + + ;------------------------ + ;Setup RegTool + + ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "NSIS.Library.RegTool.v2" + IfFileExists $R3 +3 + + File /oname=$R2\NSIS.Library.RegTool.v2.exe "${NSISDIR}\Bin\RegTool.bin" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \ + "NSIS.Library.RegTool.v2" '"$R2\NSIS.Library.RegTool.v2.exe" /S' + + ;------------------------ + ;Add RegTool entry + + WriteRegStr HKLM "Software\NSIS.Library.RegTool.v2\UpgradeDLLSession" "$R0.file" "$R1" + WriteRegStr HKLM "Software\NSIS.Library.RegTool.v2\UpgradeDLLSession" "$R0.mode" "${mode}" + + Pop $R3 + Pop $R2 + Pop $R1 + Pop $R0 + +!macroend + !macro UpgradeDLL LOCALFILE DESTFILE TEMPBASEDIR Push $R0 @@ -101,11 +148,7 @@ Example: ;------------------------ ;Register on reboot - GetTempFileName $R0 $R5 - File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin" - - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \ - "$R4" '"$R0" D $R4' + !insertmacro __UpgradeDLL_Helper_AddRegToolEntry 'D' $R4 $R5 Goto upgradedll.done_${UPGRADEDLL_UNIQUE}