- fixed "already defined" error

- fixed unused label warning


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3654 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-09-11 15:44:17 +00:00
parent 38d7adce15
commit a84b5fe2b1

View file

@ -33,17 +33,17 @@ install Specify the installation method
REBOOT_PROTECTED * Upgrade the library on reboot when in use (required for system files).
* Upgrade the library if the file is not protected by Windows File Protection.
NOREBOOT_PROTECTED * Warns the user when the library is in use. The user will have to close
applications using the library.
* Upgrade the library if the file is not protected by Windows File Protection.
REBOOT_NOTPROTECTED * Upgrade the library on reboot when in use (required for system files).
* Upgrade the library without checking for Windows File Protection.
NOREBOOT_NOTPROTECTED * Warns the user when the library is in use. The user will have to close
applications using the library.
* Upgrade the library without checking for Windows File Protection.
* Upgrade the library without checking for Windows File Protection.
localfile Location of the library on the compiler system
@ -51,7 +51,7 @@ destfile Location to store the library on the user's system
tempbasedir Directory on the user's system to store a temporary file when the system has
to be rebooted.
For Windows 9x/ME support, this directory should be on the same volume as the
destination file (destfile).
The Windows temp directory could be located on any volume, so you cannot use
@ -104,20 +104,20 @@ uninstall Specify the uninstallation method
NOREMOVE The library should not be removed.
You should use this option for common or important system files such as the
Visual Basic/C++/MFC runtimes.
REBOOT_PROTECTED * Remove the library on reboot when in use (required for system files).
* Remove the library if the file is not protected by Windows File Protection.
NOREBOOT_PROTECTED * Warns the user when the library is in use. The user will have to close
applications using the library.
* Remove the library if the file is not protected by Windows File Protection.
REBOOT_NOTPROTECTED * Remove the library on reboot when in use (required for system files).
* Remove the library without checking for Windows File Protection.
NOREBOOT_NOTPROTECTED * Warns the user when the library is in use. The user will have to close
applications using the library.
* Remove the library without checking for Windows File Protection.
* Remove the library without checking for Windows File Protection.
file Location of the library
@ -137,7 +137,7 @@ Example:
!verbose push
!verbose 3
Push $R0
Push $R1
Push $R2
@ -147,9 +147,9 @@ Example:
;------------------------
;Define
!define INSTALLLIB_UNIQUE ${__LINE__}
!define INSTALLLIB_LIBTYPE_${libtype}
!define INSTALLLIB_LIBTYPE_SET INSTALLLIB_LIBTYPE_${libtype}
!define INSTALLLIB_SHARED_${shared}
@ -159,7 +159,7 @@ Example:
;------------------------
;Validate
!ifndef INSTALLLIB_LIBTYPE_DLL & INSTALLLIB_LIBTYPE_REGDLL & INSTALLLIB_LIBTYPE_TLB & \
INSTALLLIB_LIBTYPE_REGDLLTLB
!error "InstallLib: Incorrect setting for parameter: libtype"
@ -176,191 +176,209 @@ Example:
StrCpy $R4 "${destfile}"
StrCpy $R5 "${tempbasedir}"
;------------------------
;Shared library count
!ifndef INSTALLLIB_SHARED_NOTSHARED
StrCmp ${shared} "" 0 installlib.noshareddllincrease_${INSTALLLIB_UNIQUE}
ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R4
IntOp $R0 $R0 + 1
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R4 $R0
installlib.noshareddllincrease_${INSTALLLIB_UNIQUE}:
!endif
;------------------------
;Check Windows File Protection
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_NOREBOOT_PROTECTED
System::Call "sfc::SfcIsFileProtected(i 0, w R4) i.R0"
StrCmp $R0 "error" installlib.notprotected_${INSTALLLIB_UNIQUE}
StrCmp $R0 "0" installlib.notprotected_${INSTALLLIB_UNIQUE}
Goto installlib.done_${INSTALLLIB_UNIQUE}
installlib.notprotected_${INSTALLLIB_UNIQUE}:
!endif
;------------------------
;Check file
IfFileExists $R4 0 installlib.copy_${INSTALLLIB_UNIQUE}
;------------------------
;Get version information
!execute '"${NSISDIR}\Contrib\Library\LibraryLocal\LibraryLocal.exe" D ${LOCALFILE}'
!include "${NSISDIR}\Contrib\Library\LibraryLocal\LibraryLocal.nsh"
!ifdef LIBRARY_VERSION_FILENOTFOUND
!error "InstallLib: The library ${LOCALFILE} could not be found."
!endif
!ifndef LIBRARY_VERSION_NONE
!define LIBRARY_DEFINE_UPGRADE_LABEL
StrCpy $R0 ${LIBRARY_VERSION_HIGH}
StrCpy $R1 ${LIBRARY_VERSION_LOW}
GetDLLVersion $R4 $R2 $R3
!undef LIBRARY_VERSION_HIGH
!undef LIBRARY_VERSION_LOW
!ifndef INSTALLLIB_LIBTYPE_TLB & INSTALLLIB_LIBTYPE_REGDLLTLB
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
IntCmpU $R1 $R3 installlib.done_${INSTALLLIB_UNIQUE} installlib.done_${INSTALLLIB_UNIQUE} \
installlib.upgrade_${INSTALLLIB_UNIQUE}
!else
!execute '"${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.exe" T ${LOCALFILE}'
!include "${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.nsh"
!ifdef LIBRARY_VERSION_FILENOTFOUND
!error "InstallLib: The library ${LOCALFILE} could not be found."
!endif
!ifndef LIBRARY_VERSION_NONE
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
IntCmpU $R1 $R3 0 installlib.done_${INSTALLLIB_UNIQUE} \
installlib.upgrade_${INSTALLLIB_UNIQUE}
!else
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
IntCmpU $R1 $R3 installlib.done_${INSTALLLIB_UNIQUE} installlib.done_${INSTALLLIB_UNIQUE} \
installlib.upgrade_${INSTALLLIB_UNIQUE}
installlib.upgrade_${INSTALLLIB_UNIQUE}
!endif
!endif
!else
!undef LIBRARY_VERSION_NONE
!execute '"${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.exe" T ${LOCALFILE}'
!include "${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.nsh"
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
!execute '"${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.exe" T ${LOCALFILE}'
!include "${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.nsh"
!endif
!endif
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
!ifndef LIBRARY_VERSION_NONE
!ifndef LIBRARY_DEFINE_UPGRADE_LABEL
!define LIBRARY_DEFINE_UPGRADE_LABEL
!endif
StrCpy $R0 ${LIBRARY_VERSION_HIGH}
StrCpy $R1 ${LIBRARY_VERSION_LOW}
TypeLib::GetLibVersion $R4
Pop $R2
Pop $R3
IntCmpU $R0 $R2 0 installlib.register_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
IntCmpU $R1 $R3 installlib.register_${INSTALLLIB_UNIQUE} installlib.register_${INSTALLLIB_UNIQUE} \
installlib.upgrade_${INSTALLLIB_UNIQUE}
!undef LIBRARY_VERSION_HIGH
!undef LIBRARY_VERSION_LOW
!else
!undef LIBRARY_VERSION_NONE
!endif
!endif
;------------------------
;Upgrade
installlib.upgrade_${INSTALLLIB_UNIQUE}:
!ifdef LIBRARY_DEFINE_UPGRADE_LABEL
!undef LIBRARY_DEFINE_UPGRADE_LABEL
installlib.upgrade_${INSTALLLIB_UNIQUE}:
!endif
;------------------------
;Copy
!ifdef INSTALLLIB_INSTALL_NOREBOOT_PROTECTED | INSTALLLIB_INSTALL_NOREBOOT_NOTPROTECTED
installlib.copy_${INSTALLLIB_UNIQUE}:
StrCpy $R0 $R4
Call :installlib.file_${INSTALLLIB_UNIQUE}
!else
ClearErrors
StrCpy $R0 $R4
Call :installlib.file_${INSTALLLIB_UNIQUE}
IfErrors 0 installlib.register_${INSTALLLIB_UNIQUE}
SetOverwrite lastused
;------------------------
;Copy on reboot
GetTempFileName $R0 $R5
Call :installlib.file_${INSTALLLIB_UNIQUE}
Rename /REBOOTOK $R0 $R4
;------------------------
;Register on reboot
!ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_REGDLLTLB
GetTempFileName $R0 $R5
File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
"$R4" '"$R0" D $R4'
!endif
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
GetTempFileName $R0 $R5
File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
"$R4" '"$R0" T $R4'
!endif
Goto installlib.done_${INSTALLLIB_UNIQUE}
installlib.copy_${INSTALLLIB_UNIQUE}:
StrCpy $R0 $R4
Call :installlib.file_${INSTALLLIB_UNIQUE}
!endif
;------------------------
@ -369,22 +387,22 @@ Example:
installlib.register_${INSTALLLIB_UNIQUE}:
!ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_REGDLLTLB
RegDLL $R4
!endif
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
TypeLib::Register $R4
!endif
;------------------------
;Done
installlib.done_${INSTALLLIB_UNIQUE}:
Pop $R5
Pop $R4
Pop $R3
@ -401,43 +419,43 @@ Example:
;Extract
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED
SetOverwrite try
installlib.file_${INSTALLLIB_UNIQUE}:
File /oname=$R0 "${LOCALFILE}"
Return
installlib.end_${INSTALLLIB_UNIQUE}:
SetOverwrite lastused
!else
SetOverwrite on
installlib.file_${INSTALLLIB_UNIQUE}:
File /oname=$R0 "${LOCALFILE}"
Return
installlib.end_${INSTALLLIB_UNIQUE}:
SetOverwrite lastused
!endif
;------------------------
;Undefine
!undef INSTALLLIB_UNIQUE
!undef ${INSTALLLIB_LIBTYPE_SET}
!undef INSTALLLIB_LIBTYPE_SET
!undef ${INSTALLLIB_SHARED_SET}
!undef INSTALLLIB_SHARED_SET
!undef ${INSTALLLIB_INSTALL_SET}
!undef INSTALLLIB_INSTALL_SET
!verbose pop
!macroend
@ -446,7 +464,7 @@ Example:
!verbose push
!verbose 3
Push $R0
Push $R1
@ -454,7 +472,7 @@ Example:
;Define
!define UNINSTALLLIB_UNIQUE ${__LINE__}
!define UNINSTALLLIB_LIBTYPE_${libtype}
!define UNINSTALLLIB_LIBTYPE_SET UNINSTALLLIB_LIBTYPE_${libtype}
!define UNINSTALLLIB_SHARED_${shared}
@ -464,7 +482,7 @@ Example:
;------------------------
;Validate
!ifndef UNINSTALLLIB_LIBTYPE_DLL & UNINSTALLLIB_LIBTYPE_REGDLL & UNINSTALLLIB_LIBTYPE_TLB & \
UNINSTALLLIB_LIBTYPE_REGDLLTLB
!error "UnInstallLib: Incorrect setting for parameter: libtype"
@ -485,89 +503,89 @@ Example:
;This allows the usage of variables as parameter
StrCpy $R1 "${file}"
;------------------------
;Shared library count
!ifdef UNINSTALLLIB_SHARED_SHARED
ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
StrCmp $R0 "" uninstalllib.remove_${UNINSTALLLIB_UNIQUE}
IntOp $R0 $R0 - 1
IntCmp $R0 0 uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE} \
uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE} uninstalllib.shareddllinuse_${UNINSTALLLIB_UNIQUE}
uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE}:
DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
!ifndef UNINSTALLLIB_SHARED_SHAREDNOREMOVE
Goto uninstalllib.remove_${UNINSTALLLIB_UNIQUE}
!endif
uninstalllib.shareddllinuse_${UNINSTALLLIB_UNIQUE}:
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
Goto uninstalllib.done_${UNINSTALLLIB_UNIQUE}
!endif
;------------------------
;Remove
uninstalllib.remove_${UNINSTALLLIB_UNIQUE}:
!ifndef UNINSTALLLIB_UNINSTALL_NOREMOVE
;------------------------
;Check Windows File Protection
!ifdef UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED | UNINSTALLLIB_UNINSTALL_NOREBOOT_PROTECTED
System::Call "sfc::SfcIsFileProtected(i 0, w $R1) i.R0"
StrCmp $R0 "error" uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}
StrCmp $R0 "0" uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}
Goto uninstalllib.done_${UNINSTALLLIB_UNIQUE}
uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}:
!endif
;------------------------
;Unregister
!ifdef UNINSTALLLIB_LIBTYPE_REGDLL | UNINSTALLLIB_LIBTYPE_REGDLLTLB
UnRegDLL $R1
!endif
!ifdef INSTALLLIB_LIBTYPE_TLB | UNINSTALLLIB_LIBTYPE_REGDLLTLB
TypeLib::UnRegister $R1
!endif
;------------------------
;Delete
!ifdef UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED | UNINSTALLLIB_UNINSTALL_REBOOT_NOTPROTECTED
Delete /REBOOTOK $R1
!else
Delete $R1
!endif
!endif
;------------------------
;Done
uninstalllib.done_${UNINSTALLLIB_UNIQUE}:
Pop $R1
Pop $R0
@ -575,14 +593,14 @@ Example:
;Undefine
!undef UNINSTALLLIB_UNIQUE
!undef ${UNINSTALLLIB_LIBTYPE_SET}
!undef UNINSTALLLIB_LIBTYPE_SET
!undef ${UNINSTALLLIB_SHARED_SET}
!undef UNINSTALLLIB_SHARED_SET
!undef ${UNINSTALLLIB_UNINSTALL_SET}
!undef UNINSTALLLIB_UNINSTALL_SET
!verbose pop
!macroend