Library fixes and improvements:
- always register DLL/TLB, even if the installer didn't copy it there - only copy one RegTool and use it to register all of the DLLs and TLBs - extract the RegTool as an .exe so explorer won't complain it doesn't know how to open the file - fixed REGDLLTLB registering just as a TLB git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3660 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
d7ca86c446
commit
28c2e72073
3 changed files with 90 additions and 90 deletions
Binary file not shown.
|
@ -7,14 +7,19 @@
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
Name "RegTool"
|
Name "RegTool"
|
||||||
OutFile "RegTool.bin"
|
OutFile "RegToolGenerator.exe"
|
||||||
SilentInstall silent
|
SilentInstall silent
|
||||||
|
SilentUninstall silent
|
||||||
|
|
||||||
SetCompressor lzma
|
SetCompressor lzma
|
||||||
|
|
||||||
|
Icon "${NSISDIR}\Contrib\Graphics\Icons\classic-install.ico"
|
||||||
|
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\classic-install.ico"
|
||||||
|
|
||||||
|
AllowRootDirInstall true
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
Var COMMAND_LINE
|
|
||||||
Var MODE
|
Var MODE
|
||||||
Var FILENAME
|
Var FILENAME
|
||||||
Var FOLDER
|
Var FOLDER
|
||||||
|
@ -23,78 +28,62 @@ Var FOLDER
|
||||||
|
|
||||||
Section
|
Section
|
||||||
|
|
||||||
Call GetParameters
|
WriteUninstaller $EXEDIR\RegTool.bin
|
||||||
Pop $COMMAND_LINE
|
|
||||||
|
|
||||||
StrCpy $MODE $COMMAND_LINE 1
|
|
||||||
StrCpy $FILENAME $COMMAND_LINE "" 2
|
|
||||||
|
|
||||||
;DLL
|
|
||||||
StrCmp $MODE "D" 0 no_dll
|
|
||||||
|
|
||||||
Push $FILENAME
|
|
||||||
Call GetParent
|
|
||||||
Pop $FOLDER
|
|
||||||
|
|
||||||
SetOutPath $FOLDER
|
|
||||||
RegDLL $FILENAME
|
|
||||||
|
|
||||||
no_dll:
|
|
||||||
|
|
||||||
;TLB
|
|
||||||
StrCmp $MODE "T" 0 no_tlb
|
|
||||||
|
|
||||||
TypeLib::Register $FILENAME
|
|
||||||
|
|
||||||
no_tlb:
|
|
||||||
|
|
||||||
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
|
|
||||||
Delete /REBOOTOK $R0
|
|
||||||
|
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
;--------------------------------
|
Section uninstall
|
||||||
|
|
||||||
; GetParameters
|
StrCpy $0 -1
|
||||||
; input, none
|
|
||||||
; output, top of stack (replaces, with e.g. whatever)
|
|
||||||
; modifies no other variables.
|
|
||||||
|
|
||||||
Function GetParameters
|
|
||||||
|
|
||||||
Push $R0
|
|
||||||
Push $R1
|
|
||||||
Push $R2
|
|
||||||
Push $R3
|
|
||||||
|
|
||||||
StrCpy $R2 1
|
|
||||||
StrLen $R3 $CMDLINE
|
|
||||||
|
|
||||||
;Check for quote or space
|
|
||||||
StrCpy $R0 $CMDLINE $R2
|
|
||||||
StrCmp $R0 '"' 0 +3
|
|
||||||
StrCpy $R1 '"'
|
|
||||||
Goto loop
|
|
||||||
StrCpy $R1 " "
|
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
IntOp $R2 $R2 + 1
|
|
||||||
StrCpy $R0 $CMDLINE 1 $R2
|
IntOp $0 $0 + 1
|
||||||
StrCmp $R0 $R1 get
|
|
||||||
StrCmp $R2 $R3 get
|
EnumRegValue $FILENAME HKLM "Software\NSIS.Library.RegTool" $0
|
||||||
Goto loop
|
StrCmp $FILENAME "" done
|
||||||
|
|
||||||
get:
|
ReadRegStr $MODE HKLM "Software\NSIS.Library.RegTool" $FILENAME
|
||||||
IntOp $R2 $R2 + 1
|
|
||||||
StrCpy $R0 $CMDLINE 1 $R2
|
StrCmp $MODE "DT" 0 +4
|
||||||
StrCmp $R0 " " get
|
|
||||||
StrCpy $R0 $CMDLINE "" $R2
|
Call un.RegDLL
|
||||||
|
Call un.RegTLB
|
||||||
Pop $R3
|
Goto loop
|
||||||
Pop $R2
|
|
||||||
Pop $R1
|
StrCmp $MODE "D" 0 +3
|
||||||
Exch $R0
|
|
||||||
|
Call un.RegDLL
|
||||||
|
Goto loop
|
||||||
|
|
||||||
|
StrCmp $MODE "T" 0 +3
|
||||||
|
|
||||||
|
Call un.RegTLB
|
||||||
|
Goto loop
|
||||||
|
|
||||||
|
Goto loop
|
||||||
|
|
||||||
|
done:
|
||||||
|
|
||||||
|
DeleteRegKey HKLM "Software\NSIS.Library.RegTool"
|
||||||
|
Delete $INSTDIR\NSIS.Library.RegTool.exe
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Function un.RegDLL
|
||||||
|
|
||||||
|
Push $FILENAME
|
||||||
|
Call un.GetParent
|
||||||
|
Pop $FOLDER
|
||||||
|
|
||||||
|
SetOutPath $FOLDER
|
||||||
|
RegDLL $FILENAME
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function un.RegTLB
|
||||||
|
|
||||||
|
TypeLib::Register $FILENAME
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
@ -109,29 +98,29 @@ FunctionEnd
|
||||||
; Pop $R0
|
; Pop $R0
|
||||||
; ; at this point $R0 will equal "C:\Program Files\Directory"
|
; ; at this point $R0 will equal "C:\Program Files\Directory"
|
||||||
|
|
||||||
Function GetParent
|
Function un.GetParent
|
||||||
|
|
||||||
Exch $R0
|
Exch $R0
|
||||||
Push $R1
|
Push $R1
|
||||||
Push $R2
|
Push $R2
|
||||||
Push $R3
|
Push $R3
|
||||||
|
|
||||||
StrCpy $R1 0
|
StrCpy $R1 0
|
||||||
StrLen $R2 $R0
|
StrLen $R2 $R0
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
IntOp $R1 $R1 + 1
|
IntOp $R1 $R1 + 1
|
||||||
IntCmp $R1 $R2 get 0 get
|
IntCmp $R1 $R2 get 0 get
|
||||||
StrCpy $R3 $R0 1 -$R1
|
StrCpy $R3 $R0 1 -$R1
|
||||||
StrCmp $R3 "\" get
|
StrCmp $R3 "\" get
|
||||||
Goto loop
|
Goto loop
|
||||||
|
|
||||||
get:
|
get:
|
||||||
StrCpy $R0 $R0 -$R1
|
StrCpy $R0 $R0 -$R1
|
||||||
|
|
||||||
Pop $R3
|
Pop $R3
|
||||||
Pop $R2
|
Pop $R2
|
||||||
Pop $R1
|
Pop $R1
|
||||||
Exch $R0
|
Exch $R0
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
|
@ -237,8 +237,8 @@ Example:
|
||||||
|
|
||||||
!ifndef INSTALLLIB_LIBTYPE_TLB & INSTALLLIB_LIBTYPE_REGDLLTLB
|
!ifndef INSTALLLIB_LIBTYPE_TLB & INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||||
|
|
||||||
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
IntCmpU $R0 $R2 0 installlib.register_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||||
IntCmpU $R1 $R3 installlib.done_${INSTALLLIB_UNIQUE} installlib.done_${INSTALLLIB_UNIQUE} \
|
IntCmpU $R1 $R3 installlib.register_${INSTALLLIB_UNIQUE} installlib.register_${INSTALLLIB_UNIQUE} \
|
||||||
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||||
|
|
||||||
!else
|
!else
|
||||||
|
@ -252,14 +252,14 @@ Example:
|
||||||
|
|
||||||
!ifndef LIBRARY_VERSION_NONE
|
!ifndef LIBRARY_VERSION_NONE
|
||||||
|
|
||||||
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
IntCmpU $R0 $R2 0 installlib.register_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||||
IntCmpU $R1 $R3 0 installlib.done_${INSTALLLIB_UNIQUE} \
|
IntCmpU $R1 $R3 0 installlib.register_${INSTALLLIB_UNIQUE} \
|
||||||
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||||
|
|
||||||
!else
|
!else
|
||||||
|
|
||||||
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
IntCmpU $R0 $R2 0 installlib.register_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||||
IntCmpU $R1 $R3 installlib.done_${INSTALLLIB_UNIQUE} installlib.done_${INSTALLLIB_UNIQUE} \
|
IntCmpU $R1 $R3 installlib.register_${INSTALLLIB_UNIQUE} installlib.register_${INSTALLLIB_UNIQUE} \
|
||||||
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
@ -353,23 +353,34 @@ Example:
|
||||||
;------------------------
|
;------------------------
|
||||||
;Register on reboot
|
;Register on reboot
|
||||||
|
|
||||||
!ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_REGDLLTLB
|
!ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||||
|
|
||||||
GetTempFileName $R0 $R5
|
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "NSIS.Library.RegTool"
|
||||||
File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
|
IfFileExists $R0 installlib.rebootreg_${INSTALLLIB_UNIQUE}
|
||||||
|
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
File /oname=$R5\NSIS.Library.RegTool.exe "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
|
||||||
"$R4" '"$R0" D $R4'
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
||||||
|
"NSIS.Library.RegTool" '"$R5\NSIS.Library.RegTool.exe"'
|
||||||
|
|
||||||
|
installlib.rebootreg_${INSTALLLIB_UNIQUE}:
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
|
!ifdef INSTALLLIB_LIBTYPE_REGDLL
|
||||||
|
|
||||||
GetTempFileName $R0 $R5
|
WriteRegStr HKLM "Software\NSIS.Library.RegTool" "$R4" 'D'
|
||||||
File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
|
|
||||||
|
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
!endif
|
||||||
"$R4" '"$R0" T $R4'
|
|
||||||
|
!ifdef INSTALLLIB_LIBTYPE_TLB
|
||||||
|
|
||||||
|
WriteRegStr HKLM "Software\NSIS.Library.RegTool" "$R4" 'T'
|
||||||
|
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifdef INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||||
|
|
||||||
|
WriteRegStr HKLM "Software\NSIS.Library.RegTool" "$R4" 'DT'
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue