; Tom’s Image Gallery 2.1 Setup Script (TN)
; Written by Tom Nowacki @ https://www.teanow5pm.co.uk
;
; Requires NSIS >= 3.0a0
;--------------------------------
; Installer Definitions
!define PRODUCT_NAME "TIG"
!define PRODUCT_VERSION "2.1"
!define PRODUCT_PUBLISHER "CAGD"
!define PRODUCT_COPYRIGHT "© 2022 Tom Nowacki (CAGD)"
!define PRODUCT_WEB_SITE "https://www.teanow5pm.co.uk"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define APP_DATA_KEY "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
!define HELP_KEY "chm.file\shell\open\command"
!define CHM_KEY ".chm"
!define HELP_ROOT_KEY "HKCR"
!define LOCAL "..\" ; Path where local include files reside
!define ABSDIR "F:\homepage\nsis" ; Absolute local include path
!define ARTWORK "${ABSDIR}\artwork\" ; Path where bitmaps are located
!define SRCDIR "F:\Gallery"
!define TEMP $INSTDIR\bin ; Temporary location of encrypted archives
!define TEMP1 $R0 ; Temp variable
!define TEMP2 $R1 ; Temp variable
!define MESSAGE_INST_LANG_INFO $0 ; Language dialog text
!define V 0 ; Option to write a string with uninstall parameters to the uninstaller itself
; Writing the string depends on the value of 'V'
; 0 - all Windows versions write the string
; 5 - only Vista or greater writes the string
; >= 6 - never writes the string
!ifndef NSIS_PACKEDVERSION
!error "NSIS 3.0 Alpha 0 or higher is required to build this installer!"
!endif
!ifdef NSIS_UNICODE
; Unicode defaults to true since NSIS 3.07
; When you undefine NSIS_UNICODE, it removes the default
!undef NSIS_UNICODE
!endif
; *** Uncomment one of the next lines to override the theme(s)
#!define LITE ; works @ 120, 144, 168, 192 dpi
#!define LITE_PLUS ; plus 96 dpi
!ifdef LITE_PLUS
!define /ReDef ARTWORK "${ABSDIR}\artworks\"
!endif
; *** Uncomment the next line for testing the installer
#!define MUI_QUICK_COMPILE
; Unicode NSIS
; 'true' for unicode, 'false' for ansi
Unicode false ; NSIS_UNICODE is not defined unless you set the Unicode 'true' flag
!ifdef NSIS_UNICODE
!define UNICODE
!endif
!ifdef UNICODE
!define inst "TIGsetup-unicode_"
!define instx "TIGsetup-unicode.exe"
!define uninst "uun-TIGsetup_"
!define uninstx "uuninst.exe"
!define SEX "Size\setsizew.nsi"
!define NSIDIR "UNICODE"
!else
!define inst "TIGsetup_"
!define instx "TIGsetup.exe"
!define uninst "un-TIGsetup_"
!define uninstx "uninst.exe"
!define SEX "Size\setsize.nsi"
!define NSIDIR "ANSI"
!system 'for /D %A in ("$%temp%\ns*.tmp") do @RMDir /S /Q "%~A"' ; clean out old .tmp copies
!endif
; *** Uncomment the next line to include unwelcome & unfinish pages
; *** Results in larger binaries (more images)
#!define MUI_UN_FULL
; *** Uncomment the next line to skip the reinstall and directory pages
#!define MUI_AUTO_SKIP
; *** Optionally run a 'Banner.dll' uninstaller from the reinstall page
; *** Uncommenting the next line enables the banner plugin
#!define MUI_UN_RUN "false"
!ifndef MUI_UN_RUN
!define MUI_UN_RUN "true"
!else
!define MUI_UN_BANNER
!endif
; *** Comment out the next line to disable the password page
!define PASS_ON
; *** Uncomment the next line to put the temp install folder in localappdata (xp sp2+)
#!define PLUGINSDIR_APPDATA
; *** Uncomment the next line to prompt when files can't be overwritten
!define OVERWRITE_ON
!ifndef OVERWRITE_ON
SetOverwrite try ; skip files that are locked
!else
SetOverwrite on ; overwrite existing
AllowSkipFiles on ; 'abort/retry/ignore' message
!endif
; *** Uncomment the next line to allow root install paths (C:\, D:\, portable media)
!define ALLOW_ROOT
!ifdef ALLOW_ROOT
AllowRootDirInstall true
!endif
; *** Uncomment the next line to allow modified MUI language files
!define MUI_MODIFIED
!ifdef MUI_MODIFIED
!define MOD_ "MOD_"
!else
!define MOD_ ""
!endif
; Estimate the space required
#!system '"${NSISDIR}\makensis.exe" "${LOCAL}${SEX}"' ; output "setsize.exe"
!execute "setsize.exe /S" ; generate "setsize.nsh"
#!delfile "setsize.exe" ; remove "setsize.exe"
!include "setsize.nsh" ; generated file
; Manifest
; *** Uncomment the next line to manually add information to the manifest
#!define MANIFEST
!ifdef MANIFEST
!define ResHacker "${ABSDIR}\Resource Hacker\ResourceHacker.exe" ; external tool
!tempfile tmpexe
!tempfile tmpmanifest
!define level "asInvoker" ; user's highest account privileges
!define build ${NSIS_VERSION}
!appendfile ${tmpmanifest} '\
\
\
Nullsoft Install System "${build}"\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
true\
true\
\
'
!packhdr "${tmpexe}" '"${ResHacker}" -addoverwrite "${tmpexe}", "${tmpexe}", "${tmpmanifest}", 24, 1, 1033'
!delfile "${tmpexe}"
!endif
; *** Uncomment the next line to add header compression (small amount)
!define upx "${ABSDIR}\UPX\upx.exe" ; external tool
!ifdef upx
!tempfile tmpupx
!packhdr "${tmpupx}" '"${upx}" -9 "${tmpupx}"'
!endif
;--------------------------------
; Windows Dll Version
!macro _WinVerCustom_AtLeastDllVer _a _b _t _f
!insertmacro _LOGICLIB_TEMP
Push $0
GetDLLVersion "$SysDir\KERNEL32.DLL" $0 $_LOGICLIB_TEMP
IntCmpU ${_a} $0 "" +2 +3
IntCmpU ${_b} $_LOGICLIB_TEMP "" "" +2
StrCpy $_LOGICLIB_TEMP "+"
Pop $0
!insertmacro _== $_LOGICLIB_TEMP "+" '${_t}' '${_f}'
!macroend
!define SysDllAtLeastWinXPSP2 '0x00050001 WinVerCustom_AtLeastDllVer 0x0a280884'
!define SysDllAtLeastWin8SP0 '0x00060002 WinVerCustom_AtLeastDllVer 0'
;--------------------------------
; MUI 2.0 ------
!include "MUI2.nsh"
!ifndef MUI_MODIFIED
!define MUI_LICENSEPAGE_TEXT_TOP "$(M_INNERTEXT_LICENSE_BOTTOM_CHECKBOX)"
!else
!define MUI_LICENSEPAGE_TEXT_TOP "$(MUI_INNERTEXT_LICENSE_BOTTOM_CHECKBOX)"
!endif
; Detect OS ------
!include "x64.nsh"
; Included Macros ------
!include "TIGmacros.nsh"
; Configuration
!ifndef MANIFEST
RequestExecutionLevel user
ManifestSupportedOS all
!endif
ManifestDPIAware true ; 'true', 'system', 'false' or 'notset'
Caption "${PRODUCT_NAME} Setup"
Name "${PRODUCT_NAME}"
BrandingText "${PRODUCT_COPYRIGHT}"
OutFile "${LOCAL}${instx}"
ShowInstDetails hide
ShowUninstDetails hide
AutoCloseWindow true
XPStyle on
SetCompress auto ; default - compress if smaller
!ifndef PASS_ON
SetCompressor /SOLID /FINAL lzma
!else
SetCompressor zlib
!endif
; Variables
Var APP_DATA ; application data directory (when $APPDATA is unavailable)
Var HELP ; path of Help application
Var DESK ; desktop icon
Var ACCOUNT ; admin or user
Var LANG ; previous installer's language (registry)
Var LANG_ID ; user's system language
Var PATH ; previous $INSTDIR (registry)
Var ICONS_PATH ; previous start menu folder (registry)
Var ICONS_GROUP ; start menu folder
Var PAR_NUM ; number of parent folders installed (registry) - these can be uninstalled, if empty
Var PREV_INST ; copy exists
Var PREV_INST_V ; type & number of copies
Var CU_PREV_INST ; personal copy (user)
Var LM_PREV_INST ; per-machine copy (all users)
Var REM ; remove copy
Var WIN_V ; Windows version
Var SYS_DIR ; System folder
Var SYS__DIR ; 64-bit system folder
Var SYS_FONT ; 'MS Shell Dlg'?
Var UNINSTSTR ; uninstall string (registry)
Var UNINST ; path of removed copy
Var DTI ; desktop icon caption text (T I G or T.I.G.) - T.I.G. is 'admin' installs
Var SPAWN ; uninstall commandline option
Var PASSWORD ; used to store the password
Var DIALOG ; nsDialogs control
Var IMAGECTL ; nsDialogs control
Var LABELCTL_0 ; nsDialogs control
Var LABELCTL_1 ; nsDialogs control
Var LABELCTL_2 ; nsDialogs control
Var LABELCTL_3 ; nsDialogs control
Var LABELCTL_4 ; nsDialogs control
Var LABELCTL_5 ; nsDialogs control
Var IMAGE ; nsDialogs handle
Var CHECKBOX_1 ; nsDialogs control
Var CHECKBOX_2 ; nsDialogs control
Var CHECK_STATE ; checked or unchecked
Var RADIO_1 ; nsDialogs control
Var RADIO_2 ; nsDialogs control
Var RADIO_STATE ; checked or unchecked
Var MY_PROFILE ; username
Var X_PROFILE ; previous username
Var X_ACCOUNT ; previous account (registry)
Var TIME ; timestamp
Var XXX ; delete registry and desktop icon
Var SIZE ; required space (setsize.nsh)
Var SIZE_1 ; equal to SIZE
Var SIZE_2 ; alternate SIZE (C:\Gallery) - pdfs using absolute path links
Var BYTE_SIZE ; original size (setsize.nsh)
Var SYS_DPI ; 96, 120, 144, etc.
Var DPI_AWARE ; 0 if not set
Var DPI_SCALE ; initially 'none' (before any scaling occurs)
Var WIN_BUILD ; build, eg. 7601 = Windows 7
Var UseLightTheme ; switch to user's theme
; Label variables - (un)finish & (un)welcome pages
Var W_X_1
Var W_X_3
Var W_X_4
Var W_Y_4
Var W_W_4
Var W_H_4
Var W_X_5
Var W_Y_5
Var W_W_5
Var W_H_5
Var F_X_4
Var F_Y_4
Var F_W_4
Var F_H_4
Var F_X_5
Var F_Y_5
Var F_W_5
Var F_H_5
Var UN_W_X_1
Var UN_W_X_4
Var UN_W_Y_4
Var UN_W_W_4
Var UN_W_H_4
Var UN_W_X_5
Var UN_W_Y_5
Var UN_W_W_5
Var UN_W_H_5
Var UN_F_X_4
Var UN_F_Y_4
Var UN_F_W_4
Var UN_F_H_4
Var UN_F_X_5
Var UN_F_Y_5
Var UN_F_W_5
Var UN_F_H_5
;--------------------------------
; x y coordinates, width and height written out in full
; English is the installer language
; @ 96 dpi
/* ###############
StrCpy $W_X_1 232u
StrCpy $W_X_3 232u
StrCpy $W_X_5 47
StrCpy $W_Y_5 167
StrCpy $W_W_5 242
StrCpy $W_H_5 17
IntOp $W_X_4 $W_X_5 - 6
IntOp $W_Y_4 $W_Y_5 - 2
IntOp $W_W_4 $W_W_5 + 8
IntOp $W_H_4 $W_H_5 + 4
StrCpy $F_X_5 45
StrCpy $F_Y_5 175
StrCpy $F_W_5 241
StrCpy $F_H_5 8
IntOp $F_X_4 $F_X_5 + 0
IntOp $F_Y_4 $F_Y_5 - 2
IntOp $F_W_4 $F_W_5 + 0
IntOp $F_H_4 $F_H_5 + 4
StrCpy $UN_W_X_1 232u
StrCpy $UN_W_X_5 52
StrCpy $UN_W_Y_5 167
StrCpy $UN_W_W_5 230
StrCpy $UN_W_H_5 17
IntOp $UN_W_X_4 $UN_W_X_5 - 6
IntOp $UN_W_Y_4 $UN_W_Y_5 - 2
IntOp $UN_W_W_4 $UN_W_W_5 + 8
IntOp $UN_W_H_4 $UN_W_H_5 + 4
StrCpy $UN_F_X_5 60
StrCpy $UN_F_Y_5 167
StrCpy $UN_F_W_5 216
StrCpy $UN_F_H_5 17
IntOp $UN_F_X_4 $UN_F_X_5 - 6
IntOp $UN_F_Y_4 $UN_F_Y_5 - 2
IntOp $UN_F_W_4 $UN_F_W_5 + 8
IntOp $UN_F_H_4 $UN_F_H_5 + 4
############### */
;--------------------------------
; DPI Labels
!macro MakeLabel txt X Y W H
${NSD_CreateLabel} ${X}u ${Y}u ${W}u ${H}u ${txt}
!macroend
!macro WelcomeTitle u
StrCpy $W_X_1 ${u} #
StrCpy $W_X_3 ${u} #
StrCpy $UN_W_X_1 ${u} #
!macroend
!macro DefineControls UNINST PAGE X5 Y5 W5 H5 OPX OPY OPW OPH
StrCpy $${UNINST}${PAGE}X_5 ${X5} #
StrCpy $${UNINST}${PAGE}Y_5 ${Y5} #
StrCpy $${UNINST}${PAGE}W_5 ${W5} #
StrCpy $${UNINST}${PAGE}H_5 ${H5} #
IntOp $${UNINST}${PAGE}X_4 $${UNINST}${PAGE}X_5 - ${OPX}
IntOp $${UNINST}${PAGE}Y_4 $${UNINST}${PAGE}Y_5 - ${OPY}
IntOp $${UNINST}${PAGE}W_4 $${UNINST}${PAGE}W_5 + ${OPW}
IntOp $${UNINST}${PAGE}H_4 $${UNINST}${PAGE}H_5 + ${OPH}
!macroend
!macro TweakControls UNINST PAGE X5 W5 OPX OPW
StrCpy $${UNINST}${PAGE}X_5 ${X5} #
StrCpy $${UNINST}${PAGE}W_5 ${W5} #
IntOp $${UNINST}${PAGE}X_4 $${UNINST}${PAGE}X_5 - ${OPX}
IntOp $${UNINST}${PAGE}W_4 $${UNINST}${PAGE}W_5 + ${OPW}
!macroend
!macro Labelizer
${If} $SYS_DPI == 192
${OrIf} $SYS_DPI == 168
${OrIf} $SYS_DPI == 144
${OrIf} $SYS_DPI == 120
${If} $SYS_DPI == 192
${ElseIf} $SYS_DPI == 168
${IfNot} $LANGUAGE == 1031 ; English
!insertmacro TweakControls "" "W_" 47 241 6 8
!insertmacro TweakControls "UN_" "W_" 45 245 6 8 ; unpage
!insertmacro TweakControls "UN_" "F_" 60 216 6 8 ; unpage
${Else} ; German
!insertmacro TweakControls "" "W_" 49 237 6 8
!insertmacro TweakControls "UN_" "W_" 47 240 6 8 ; unpage
!insertmacro TweakControls "UN_" "F_" 52 231 6 8 ; unpage
${EndIf}
!insertmacro TweakControls "" "F_" 36 259 0 0
${ElseIf} $SYS_DPI == 144
${IfNot} $LANGUAGE == 1031
!insertmacro TweakControls "" "W_" 46 244 6 8
${Else}
!insertmacro TweakControls "UN_" "W_" 54 226 6 8 ; unpage
!insertmacro TweakControls "UN_" "F_" 59 217 6 8 ; unpage
${EndIf}
${ElseIf} $SYS_DPI == 120
!insertmacro WelcomeTitle 228u
${IfNot} $LANGUAGE == 1031
!insertmacro TweakControls "" "W_" 51 232 6 8
!insertmacro TweakControls "" "F_" 40 251 0 0
!insertmacro TweakControls "UN_" "W_" 49 236 6 8 ; unpage
!insertmacro TweakControls "UN_" "F_" 56 223 6 8 ; unpage
${Else}
!insertmacro TweakControls "" "W_" 52 230 6 8
!insertmacro TweakControls "" "F_" 39 252 0 0
!insertmacro TweakControls "UN_" "W_" 51 232 6 8 ; unpage
!insertmacro TweakControls "UN_" "F_" 55 224 6 8 ; unpage
${EndIf}
${EndIf}
${ElseIf} $SYS_DPI > 96
; one size fits all the rest
!insertmacro DefineControls "" "W_" 39 167 252 17 0 0 0 0
!insertmacro DefineControls "" "F_" 1 175 331 8 0 0 0 0
!insertmacro DefineControls "UN_" "W_" 51 167 232 17 0 0 0 0 ; unpage
!insertmacro DefineControls "UN_" "F_" 51 167 232 17 0 0 0 0 ; unpage
${EndIf}
!macroend
;--------------------------------
; DPI Images
;--------------------------------
; BMPs
; standard = 100%, 125%, 150%, 175%, 200%
; custom = any non-standard scaling
/* ###############
120 standard
1.52 MB
1.52 MB un
---------
120 custom
17.6 KB
20.5 KB un
---------
144 standard
2.21 MB
2.21 MB un
---------
144 custom
21.6 KB
25.3 KB un
---------
168 standard
3.04 MB
3.04 MB un
---------
168 custom
26.5 KB
29.7 KB un
---------
192 standard
3.92 MB
3.92 MB un
---------
192 custom
30.5 KB
37.4 KB un
############### */
!macro BMPX_ DPI UN _
; Uninstaller: 'standard' bitmaps, otherwise 'custom' (A or B or C or D)
; A
#${If} $WIN_BUILD < 22001 ; Windows 11
; B
#${If} $WIN_BUILD < 14393 ; Windows 10 1607 release (December 2015)
; C
#${IfNot} ${SysDllAtLeastWin8SP0} ; Windows 8 (August 2012)
; D
${If} $UseLightTheme == "1"
StrCpy $DPI_SCALE "custom" #
${EndIf}
StrCmp $DPI_SCALE "custom" +2
!insertmacro BMPX ${DPI} "UN" ""
!macroend
!macro BMPX DPI UN _
!ifdef LITE
!define /ReDef _ "_"
StrCpy $DPI_SCALE "custom" #
!endif
; High DPI images to use
File "/oname=$PluginsDir\modern-header.bmp" "${ARTWORK}${DPI}\tigh${UN}${_}.bmp"
File "/oname=$PluginsDir\modern-wizard.bmp" "${ARTWORK}${DPI}\tigw${UN}${_}.bmp"
File "/oname=$PluginsDir\fmodern-wizard.bmp" "${ARTWORK}${DPI}\tigf${UN}${_}.bmp"
!macroend
Function StandardDPI
; Standard images installer = 10.69 MB + uninstaller = 10.69 MB | uncompressed 24-bit BMPs
; A or B or C or D
; A
#${If} $WIN_BUILD < 22001
; B
#${If} $WIN_BUILD < 14393
; C
#${IfNot} ${SysDllAtLeastWin8SP0}
; D
${If} $UseLightTheme == "1"
StrCpy ${TEMP2} "not" #
${EndIf}
StrCmp ${TEMP2} "not" endif
${If} $SYS_DPI == 192
${OrIf} $SYS_DPI == 168
${OrIf} $SYS_DPI == 144
${OrIf} $SYS_DPI == 120
StrCpy $DPI_SCALE "standard" #
${If} $SYS_DPI == 192
!insertmacro BMPX 192 "" ""
${ElseIf} $SYS_DPI == 168
!insertmacro BMPX 168 "" ""
${ElseIf} $SYS_DPI == 144
!insertmacro BMPX 144 "" ""
${ElseIf} $SYS_DPI == 120
!insertmacro BMPX 120 "" ""
${EndIf}
${EndIf}
endif:
FunctionEnd
Function CustomDPI
; Custom images installer = 96.2 KB + uninstaller = 112.9 KB | compressed RLE BMPs
; These are also the LITE themed images
${If} $SYS_DPI > 96
${AndIf} $DPI_SCALE != "standard"
StrCpy $DPI_SCALE "custom" #
${If} $SYS_DPI >= 192
!insertmacro BMPX 192 "" "_"
${ElseIf} $SYS_DPI >= 168
!insertmacro BMPX 168 "" "_"
${ElseIf} $SYS_DPI >= 144
!insertmacro BMPX 144 "" "_"
${ElseIf} $SYS_DPI >= 120
!insertmacro BMPX 120 "" "_"
${Else}
!insertmacro BMPX 96 "" "_"
${EndIf}
${EndIf}
FunctionEnd
; Center header image
!macro MUI_LOADANDVERTICALCENTERIMAGE _hwndImg _ImgPath _XAlign _RetImgHandle
!insertmacro MUI_INTERNAL_LOADANDSIZEIMAGE \
MUI_INTERNAL_LOADANDVERTICALCENTERIMAGE "${_hwndImg}" "${_ImgPath}" "${_XAlign}" "${_RetImgHandle}"
!macroend
!macro MUI_INTERNAL_LOADANDVERTICALCENTERIMAGE
System::Store "S" ; Save registers
System::Call 'USER32::GetWindowRect(psr0,@r1)'
#System::Call 'USER32::MapWindowPoints(p0,p$hwndparent,pr1,i2)' ; Note: Assuming control is not in inner dialog
System::Call '*$1(i.r5,i.r6,i.r7,i.r8)'
; MessageBox MB_OK "$5 $6 $7 $8" ; CtlX CtlY CtlW CtlH
IntOp $7 $7 - $5
IntOp $8 $8 - $6
Pop $1
StrCpy $3 $1 1
${If} $3 == "*" ; Move control to the right?
StrCpy $1 $1 "" 1
${Endif}
System::Call 'USER32::LoadImage(p0,tr1,i${IMAGE_BITMAP},i0,i0,i${LR_LOADFROMFILE})p.r2'
SendMessage $0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $2 $1
Push $2 ; Return value
#System::Call 'GDI32::DeleteObject(pr1)' ; Note: Assuming the previous image (if any) will be redrawn
System::Call 'USER32::GetClientRect(pr0,@r1)'
System::Call '*$1(i,i,i.r1,i.r2)'
; MessageBox MB_OK "$1 $2" ; ImgW ImgH
IntCmp $8 $2 end end 0
IntOp $R8 $8 - $2
IntOp $R1 $R8 / 2
StrCpy $5 $R1
StrCpy $6 $R1
; MessageBox MB_OK "$5 $6 $1 $2" ; new CtlX CtlY CtlW CtlH
System::Call 'USER32::SetWindowPos(pr0,p0,ir5,ir6,ir1,ir2,i0x14)'
end:
System::Store "L" ; Restore registers
!macroend
!macro DPI_INIT
; assume the app does not require scaling-up / maybe it's dpi-unaware
StrCpy $DPI_SCALE "none" #
; Windows 10 'Anniversary Update' (or greater) - set if ManifestDPIAware is 'notset'
#System::Call 'USER32::SetProcessDPIAware()i.r0'
; Is thread dpi-aware? (minimum Windows 8.1 or Server 2012 R2)
#System::Call 'SHCORE::GetProcessDpiAwareness(p0,*i0r1)'
#${IfThen} $1 = 1 ${|} StrCpy $1 PROCESS_SYSTEM_DPI_AWARE ${|}
; Is thread dpi-aware? (minimum Vista or Server 2008)
System::Call 'USER32::IsProcessDPIAware()i.r3' ; $3
; Get DPI ('Anniversary Update' or greater)
#System::Call 'USER32::GetDpiForSystem()i.r0' ; $0
; Get DPI ('SysCompImg.dll' NSIS plugin by Anders)
SysCompImg::GetSysDpi ; $0
; MessageBox MB_OK "$WIN_BUILD: get=$1 sysdpi=$0 aware=$3"
; >> "6002: get=0 sysdpi=120 aware=1" <<
StrCpy $DPI_AWARE $3 #
StrCpy $SYS_DPI $0 #
!macroend
!macro DPI_MUI_LOAD UN unin
!define /IfNDef PATH "$PLUGINSDIR\modern-header.bmp"
; default labels - 96 dpi / 192 dpi
!insertmacro WelcomeTitle 232u
${IfNot} $LANGUAGE == 1031
!insertmacro DefineControls "" "W_" 47 167 242 17 6 2 8 4
!insertmacro DefineControls "" "F_" 45 175 241 8 0 2 0 4
!insertmacro DefineControls "UN_" "W_" 52 167 230 17 6 2 8 4
${Else}
!insertmacro DefineControls "" "W_" 44 167 246 17 6 2 8 4
!insertmacro DefineControls "" "F_" 45 175 242 8 0 2 0 4
!insertmacro DefineControls "UN_" "W_" 55 167 224 17 6 2 8 4
${EndIf}
!insertmacro DefineControls "UN_" "F_" 60 167 216 17 6 2 8 4
${If} $DPI_AWARE == 1 ; XP is not dpi-aware, although fonts can be scaled (but badly)
${AndIf} $SYS_DPI > 96
!insertmacro Labelizer
Call ${unin}StandardDPI
Call ${unin}CustomDPI
SysCompImg::SetCustom "$PluginsDir\modern-header.bmp"
SysCompImg::SetCustom "$PluginsDir\modern-wizard.bmp"
SysCompImg::SetCustom "$PluginsDir\fmodern-wizard.bmp"
!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDVERTICALCENTERIMAGE ; vertically center, no stretch, no crop
${EndIf}
!macroend
;--------------------------------
; Page Macros
!macro PAGE_WELCOME
Page custom nsDialogsWelcome ""
!macroend
!macro PAGE_PASS
Page custom nsDialogsPasswordPage PasswordPageLeave ""
!macroend
!macro PAGE_PREP
Page custom nsDialogsReinstallPage ReinstallPageLeave ""
!macroend
!macro PAGE_READY
Page custom nsDialogsPreinstallPage PreinstallPageLeave ""
!macroend
!macro PAGE_FINISH
Page custom nsDialogsFinish post_install ""
!macroend
;--------------------------------
; SFX Extraction
!macro overwrite_error file
!ifdef OVERWRITE_ON ; prompt user what to do
StrCpy $0 "$OUTDIR\${file}" #
MessageBox MB_ICONSTOP|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1 "$(^FileError)" /SD IDIGNORE IDABORT +3 IDRETRY +4
StrCpy $0 "ignore" #
Goto +3
Abort
StrCpy $0 "retry" #
!else
StrCpy $0 "ignore" #
!endif
!macroend
!define x_x "!insertmacro extract_exe"
!macro extract_exe folder exe
; exe = self-extracting archive
SetOutPath ${TEMP}
File "${SRCDIR}${folder}\${exe}"
!macroend
!macro extract_berliner exe
; exe = "htmlexev.exe" or "htmlexe.exe"
SetOutPath "-"
retry__${exe}:
nsExec::Exec '"${TEMP}\${exe}" -y -p${PW} -o"$OUTDIR"'
Pop $0
; 7-Zip exit codes:
; 0 = No error > continue
; 1 = Non-fatal > continue
; 2 = Fatal, for example, if the file is locked > skip or prompt
; 7 = Command line error > skip or prompt
; 8 = Not enough memory for operation > skip or prompt
; 255 = User stopped the process > not applicable
IntCmp $0 2 0 +4 0
!insertmacro overwrite_error berliner.exe
StrCmp $0 "retry" retry__${exe}
StrCmp $0 "ignore" +3
DetailPrint "$(^Extract)berliner.exe"
Goto +2
DetailPrint "$(^Skipped)berliner.exe"
Delete "${TEMP}\${exe}"
Sleep 5
!macroend
!define x_f "!insertmacro extract_files"
!macro extract_files folder exe
; folder = 'htm' or 'pdf'
; exe = "html.exe" or "pdf.exe"
nsExec::Exec '"${TEMP}\${exe}" -y -p${PW} -o"${TEMP}\${folder}"'
Pop $0
StrCmp $0 "0" 0 +2
DetailPrint "$(^Extract)${TEMP}\${folder}"
Delete "${TEMP}\${exe}"
!macroend
!define copy_temp_pdf "!insertmacro copy_temp pdf ${outdir}"
!define copy_temp_htm "!insertmacro copy_temp htm 0" ; 0 = no outdir
!macro copy_temp folder outdir file
; outdir identifies the install folder, acro+'ice' or acro+'home'
IfFileExists "${TEMP}\${folder}\${file}" +3
DetailPrint "$(DETAIL_NOT_FOUND)${TEMP}\${folder}\${file}"
Goto end__${outdir}__${file}
ClearErrors
IfFileExists "$OUTDIR\${file}" retry__${outdir}__${file}
System::Call 'kernel32::MoveFile(t "${TEMP}\${folder}\${file}", t "$OUTDIR\${file}", i 0)i.r0'
StrCmp $0 "0" 0 success__${outdir}__${file}
retry__${outdir}__${file}:
ClearErrors
System::Call 'kernel32::CopyFile(t "${TEMP}\${folder}\${file}", t "$OUTDIR\${file}", i 0)i.r0'
StrCmp $0 "0" 0 success__${outdir}__${file}
!insertmacro overwrite_error ${file}
StrCmp $0 "retry" retry__${outdir}__${file}
StrCmp $0 "ignore" fail__${outdir}__${file}
success__${outdir}__${file}:
DetailPrint $(^CopyTo)${file}
Goto end__${outdir}__${file}
fail__${outdir}__${file}:
DetailPrint "$(^CopyFailed): ${file}"
end__${outdir}__${file}:
Sleep 5
!macroend
!macro copy_omail i j
; j = number of files
; i = base name ('text' or 'add')
; loop through "text*.htm" or "add*.htm" or mo_a*.htm or mo_t*.htm
IntOp $R0 1000 - ${j}
${i}__loop:
IntCmp $R0 999 0 0 ${i}__done
IntOp $R1 ${j} + $R0
StrCpy $R1 $R1 "" -3 #
${copy_temp_htm} "${i}$R1.htm"
IntOp $R0 $R0 + 1
Goto ${i}__loop
${i}__done:
!macroend
!macro copy_pdf outdir
# ${copy_temp_pdf} "exhibita.pdf"
# ${copy_temp_pdf} "exhibit.pdf"
# ${copy_temp_pdf} "gent.pdf"
# ${copy_temp_pdf} "genta.pdf"
# ${copy_temp_pdf} "guide.pdf"
# ${copy_temp_pdf} "guidea.pdf"
# ${copy_temp_pdf} "impo.pdf"
# ${copy_temp_pdf} "impoa.pdf"
# ${copy_temp_pdf} "magic.pdf"
# ${copy_temp_pdf} "magica.pdf"
${copy_temp_pdf} "mo.pdf"
# ${copy_temp_pdf} "quotes.pdf"
# ${copy_temp_pdf} "quotesa.pdf"
# ${copy_temp_pdf} "voyeur.pdf"
# ${copy_temp_pdf} "voyeura.pdf"
!macroend
!macro copy_htm
SetOutPath "-"
!insertmacro copy_omail add ${A_0}
!insertmacro copy_omail text ${T_0}
!insertmacro copy_omail mo_a ${A_1}
!insertmacro copy_omail mo_t ${T_1}
; copy remaining
${copy_temp_htm} "exhibit.htm"
${copy_temp_htm} "gent.htm"
${copy_temp_htm} "impo.htm"
${copy_temp_htm} "magic.htm"
${copy_temp_htm} "quotes.htm"
${copy_temp_htm} "voyeur.htm"
SetDetailsPrint textonly
RMDir /r ${TEMP}\htm
Sleep 5
SetDetailsPrint both
!macroend
!macro copy_icehome outdir
; outdir = 'ice' or 'home'
SetOutPath "$INSTDIR\acro${outdir}"
!insertmacro copy_pdf ${outdir}
SetDetailsPrint textonly
RMDir /r ${TEMP}\pdf
Sleep 5
SetDetailsPrint both
!macroend
;--------------------------------
; Install Macros
!macro quick_compile
SetOutPath "-"
File "${SRCDIR}\index.hta"
!macroend
!macro file_gallery
SetOutPath "-"
File "${SRCDIR}\*.ico"
File "${SRCDIR}\*.hta"
!ifdef PASS_ON
File /x text*.htm /x add*.htm /x mo_t*.htm /x mo_a*.htm /x quotes.htm /x exhibit.htm /x magic.htm /x impo.htm \
/x voyeur.htm /x gent.htm /x pid*.htm /x ht*.htm /x ft*.htm /x fmo*.htm /x tigp2.htm /x tigp3.htm /x tigp4.htm /x tigp5.htm \
/x tigp6.htm /x tigp7.htm /x tigp8.htm "${SRCDIR}\*.htm"
!else
File /x pid*.htm /x ht*.htm /x ft*.htm /x tigp2.htm /x tigp3.htm /x tigp4.htm /x tigp5.htm /x tigp6.htm /x tigp7.htm \
/x tigp8.htm "${SRCDIR}\*.htm"
; Vista SP2 at least
${If} $WIN_BUILD >= 6002
File "/oname=$INSTDIR\berliner.exe" "${SRCDIR}\berlinerv.exe"
${Else}
File "${SRCDIR}\berliner.exe"
${EndIf}
!endif
File "${SRCDIR}\*.jar"
File "${SRCDIR}\*clas1.*"
File "${SRCDIR}\*jazz1.*"
File "${SRCDIR}\*rock1.*"
# File "${SRCDIR}\TIG.exe.manifest" ; older wxWidgets
SetOutPath "$INSTDIR\aforest"
File "${SRCDIR}\aforest\*b.png"
File "${SRCDIR}\aforest\quote.png"
File "${SRCDIR}\aforest\size.js"
SetOutPath "$INSTDIR\bigpix"
File "${SRCDIR}\bigpix\*.jpg"
SetOutPath "$INSTDIR\buttons"
File "${SRCDIR}\buttons\*.gif"
SetOutPath "$INSTDIR\clas1"
File "${SRCDIR}\clas1\*.mov"
File "${SRCDIR}\clas1\*.mid"
File "${SRCDIR}\clas1\*.rmi"
SetOutPath "$INSTDIR\css"
File "${SRCDIR}\css\*.css"
File "${SRCDIR}\css\*.ttf"
File "${SRCDIR}\css\*.woff"
File "${SRCDIR}\css\*.woff2"
File "${SRCDIR}\css\*.svg"
File "${SRCDIR}\css\*.eot"
SetOutPath "$INSTDIR\flash"
File /x *.zip "${SRCDIR}\flash\*.swf"
SetOutPath "$INSTDIR\jazz1"
File "${SRCDIR}\jazz1\*.mov"
File "${SRCDIR}\jazz1\*.mid"
File "${SRCDIR}\jazz1\*.rmi"
SetOutPath "$INSTDIR\javacert"
File "${SRCDIR}\javacert\*.cer"
File "${SRCDIR}\javacert\*.txt"
SetOutPath "$INSTDIR\graphics"
File /x complogo.gif /x Thumbs.db /x *.bmp "${SRCDIR}\graphics\*.*"
SetOutPath "$INSTDIR\help"
File "${SRCDIR}\help\*.chm"
File "${SRCDIR}\help\*.txt"
File "${SRCDIR}\help\*.htm"
File "${LOCAL}license.rtf" ; send a copy to the 'help' folder
SetOutPath "$INSTDIR\icons"
File /x gallery.ico /x galleryv.ico /x oBook.ico /x oBookv.ico /x mmp.ico /x mmpv.ico /x tchaser.ico /x tchaserv.ico "${SRCDIR}\icons\*.ico"
SetOutPath "$INSTDIR\js"
File /x ice.js "${SRCDIR}\js\*.js"
# SetOutPath "$INSTDIR\menu"
# File "${SRCDIR}\menu\*.gif" ; moved to 'graphics'
SetOutPath "$INSTDIR\midi"
File "${SRCDIR}\midi\*.gif"
File "${SRCDIR}\midi\*.js"
File "${SRCDIR}\midi\*.css"
File "${SRCDIR}\midi\*.svg"
SetOutPath "$INSTDIR\mp3"
File "${SRCDIR}\mp3\*.js"
File "${SRCDIR}\mp3\tchaser.*"
SetOutPath "$INSTDIR\pix"
File "${SRCDIR}\pix\*.jp*"
SetOutPath "$INSTDIR\rock1"
File "${SRCDIR}\rock1\*.mov"
File "${SRCDIR}\rock1\*.mid"
File "${SRCDIR}\rock1\*.rmi"
SetOutPath "$INSTDIR\thumbs"
File /x 22trisk.jpg /x theend3d.jpg "${SRCDIR}\thumbs\*.jpg"
!macroend
!macro tigmenu file
; file = "TIG_.exe" or "TIG.exe"
StrCmp $INSTDIR $OUTDIR +2
SetOutPath "-"
File "/oname=TIG.exe" "${SRCDIR}\${file}"
!macroend
!macro tigmenu_bmp
SetOutPath "$INSTDIR\graphics"
File "${SRCDIR}\graphics\*.bmp"
!macroend
!macro ice
SetOutPath "$INSTDIR\acroice"
!ifndef PASS_ON
File "${SRCDIR}\acroice\*.pdf"
!endif
File "${SRCDIR}\acroice\*.htm"
SetOutPath "$INSTDIR\js"
File "${SRCDIR}\jsice\*.*"
; Pre-XP (2000, ME, 98, 95, NT4)
${If} $WIN_BUILD < 2600
${OrIf} $WIN_BUILD == 3000 ; ME (build 3000)
SetOutPath "$INSTDIR\menu"
File "/oname=index.html" "${SRCDIR}\menu\indexi.html"
${EndIf}
!macroend
!macro home
SetOutPath "$INSTDIR\acrohome"
!ifndef PASS_ON
File "${SRCDIR}\acrohome\*.pdf"
!endif
File "${SRCDIR}\acrohome\*.htm"
SetOutPath "$INSTDIR\js"
File "${SRCDIR}\js\ice.js"
; Pre-XP (2000, ME, 98, 95, NT4)
${If} $WIN_BUILD < 2600
${OrIf} $WIN_BUILD == 3000 ; ME (build 3000)
SetOutPath "$INSTDIR\menu"
File "/oname=index.html" "${SRCDIR}\menu\index.html"
${EndIf}
!macroend
!macro v_icons
SetOutPath "$INSTDIR\icons"
File "/oname=gallery.ico" "${SRCDIR}\icons\galleryv.ico"
File "/oname=oBook.ico" "${SRCDIR}\icons\oBookv.ico"
File "/oname=mmp.ico" "${SRCDIR}\icons\mmpv.ico"
File "/oname=tchaser.ico" "${SRCDIR}\icons\tchaserv.ico"
!macroend
!macro xp_icons
SetOutPath "$INSTDIR\icons"
File "/oname=gallery.ico" "${SRCDIR}\icons\gallery.ico"
File "/oname=oBook.ico" "${SRCDIR}\icons\oBook.ico"
File "/oname=mmp.ico" "${SRCDIR}\icons\mmp.ico"
File "/oname=chaser.ico" "${SRCDIR}\icons\tchaser.ico"
!macroend
;--------------------------------
; Get Size
!define SizeOp "!insertmacro SizeOp"
!macro SizeOp SIZE OP
; physical size in bytes
StrCpy $R0 ${S_${SIZE}}
${If} ${OP} = 0
IntOp $SIZE $SIZE + $R0
${Else}
IntOp $SIZE_2 $SIZE_2 + $R0
${EndIf}
!macroend
;--------------------------------
; Auto-Reinstall
!macro auto_skip
; skip reinstall and directory pages
; "DirectoryPageShow", ".onVerifyInstDir", "check_dir_folder" & "DirectoryPageLeave"
; functions therefore will be not referenced
!ifdef MUI_AUTO_SKIP
!pragma warning disable 6000 ; Disable warning about unknown variable/constant "mui.DirectoryPage"
!pragma warning disable 6010 ; Disable warning about function "DirectoryPageLeave" not referenced
${SetSize}
${If} $WIN_V == 5
Call no_uninstall
Abort
${EndIf}
!endif
!macroend
;--------------------------------
; Language Strings
!macro MUI_STRINGS
!ifndef MUI_MODIFIED
; replace German/English MUI language strings
!define MUI_TEXT_LICENSE_TITLE "$(M_TEXT_LICENSE_TITLE)"
!define MUI_TEXT_LICENSE_SUBTITLE "$(M_TEXT_LICENSE_SUBTITLE)"
!ifndef MUI_AUTO_SKIP
!define MUI_TEXT_DIRECTORY_TITLE "$(M_TEXT_DIRECTORY_TITLE)"
!define MUI_TEXT_DIRECTORY_SUBTITLE "$(M_TEXT_DIRECTORY_SUBTITLE)"
!endif
!define MUI_TEXT_STARTMENU_TITLE "$(M_TEXT_STARTMENU_TITLE)"
!define MUI_TEXT_STARTMENU_SUBTITLE "$(M_TEXT_STARTMENU_SUBTITLE)"
!define MUI_UNTEXT_CONFIRM_TITLE "$(M_UNTEXT_CONFIRM_TITLE)"
!endif
!macroend
!macro MOD_MUI_LANGUAGEEX LangDir NLFID
!verbose push ${MUI_VERBOSE}
!ifndef MUI_PAGE_UNINSTALLER_PREFIX
!ifndef MUI_DISABLE_INSERT_LANGUAGE_AFTER_PAGES_WARNING ; Define this to avoid the warning if you only have custom pages
!warning "MUI_LANGUAGE[EX] should be inserted after the MUI_[UN]PAGE_* macros"
!endif
!endif
!insertmacro MUI_INSERT
; Include a language
LoadLanguageFile "${LangDir}\${NLFID}.nlf"
; Include MUI language file
!insertmacro LANGFILE_INCLUDE_WITHDEFAULT \
"${LangDir}\${NLFID}.nsh" "${NSISDIR}\Contrib\Language files\English.nsh"
; Add language to list of languages for selection dialog
!define /ifndef MUI_LANGDLL_LANGUAGES ""
!define /redef MUI_LANGDLL_LANGUAGES \
'"${LANGFILE_${NLFID}_LANGDLL}" "${LANG_${NLFID}}" ${MUI_LANGDLL_LANGUAGES}'
!define /ifndef MUI_LANGDLL_LANGUAGES_CP ""
!define /redef MUI_LANGDLL_LANGUAGES_CP \
'"${LANGFILE_${NLFID}_LANGDLL}" "${LANG_${NLFID}}" "${LANG_${NLFID}_CP}" ${MUI_LANGDLL_LANGUAGES_CP}'
!verbose pop
!macroend
!macro MOD_MUI_LANGUAGE NLFID
!verbose push ${MUI_VERBOSE}
!insertmacro MOD_MUI_LANGUAGEEX "${LOCAL}MUI2 language files" "${NLFID}"
!verbose pop
!macroend
;--------------------------------
; MUI Settings
; modern ui
!define MUI_UI "${LOCAL}UIs\modern.exe" ; hack
; centered header image
!define MUI_UI_HEADERIMAGE "${LOCAL}UIs\modern_headerbmpc.exe" ; hack
!define MUI_ABORTWARNING
!define MUI_ICON "${LOCAL}inst.ico"
!define MUI_UNICON "${LOCAL}uninst.ico"
!define MUI_LICENSEPAGE_BGCOLOR "FFFFFF"
!define MUI_INSTFILESPAGE_COLORS "000000 FFFFFF"
!define MUI_INSTFILESPAGE_PROGRESSBAR "colored"
!define MUI_HEADERIMAGE_BITMAP "${ARTWORK}96\tigh.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${ARTWORK}96\tighUN.bmp"
!define MUI_BGCOLOR "FFFFF2"
!define MUI_TEXTCOLOR "4F5235"
!define MUI_HEADERIMAGE
; Initialize
!define MUI_CUSTOMFUNCTION_GUIINIT onGUIInit_func
; Welcome page
!insertmacro PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!define MUI_PAGE_CUSTOMFUNCTION_PRE skip_license
!insertmacro MUI_PAGE_LICENSE "${LOCAL}license.rtf"
; Password page (custom)
!ifdef PASS_ON
!include "TIGpassword.nsh"
!endif
!insertmacro PAGE_PASS
; Prepare page (custom) - uninstall/reinstall
!insertmacro PAGE_PREP
; Directory page
!ifndef MUI_AUTO_SKIP
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryPageShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryPageLeave
!insertmacro MUI_PAGE_DIRECTORY
!endif
; Start menu page
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "TIG"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW StartMenuPageShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE StartMenuPageLeave
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Ready page (custom)
!insertmacro PAGE_READY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro PAGE_FINISH
; Uninstaller pages
!ifndef MUI_UN_FULL
!include "unTIGsetup.nsh"
!else
!include "unTIGsetupFull.nsh"
!endif
; Banner uninstall
!ifdef MUI_UN_BANNER
!include "unTIGbanner.nsh"
!else
Function reinst_uninstall
FunctionEnd ; void - null function - do nothing
!endif
; Language files
!define crlf "$\r$\n" ; line break
!insertmacro MUI_STRINGS ; English strings for unmodified version
!insertmacro ${MOD_}MUI_LANGUAGE "English" ; modified or ${NSISDIR} version
!insertmacro MUI_STRINGS ; German strings for unmodified version
!insertmacro ${MOD_}MUI_LANGUAGE "German" ; modified or ${NSISDIR} version
!include "LanguageStrings.nsh"
!ifndef MUI_UN_FULL
!include "unLanguageStrings.nsh"
!else
!include "unLanguageStringsFull.nsh"
!endif
; Version Info
VIFileVersion ${PRODUCT_VERSION}.0.0
VIProductVersion ${PRODUCT_VERSION}.0.0
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Password required!"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" ${PRODUCT_PUBLISHER}
VIAddVersionKey /LANG=${LANG_ENGLISH} "Compiled" "${__DATE__} ${__TIME__}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Tom's Image Gallery Setup, ${NSIDIR}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" ${PRODUCT_VERSION}.0.0
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${PRODUCT_COPYRIGHT}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" ${PRODUCT_NAME}
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" ${PRODUCT_VERSION}
VIAddVersionKey /LANG=${LANG_GERMAN} "Comments" "Passwort erforderlich!"
VIAddVersionKey /LANG=${LANG_GERMAN} "CompanyName" ${PRODUCT_PUBLISHER}
VIAddVersionKey /LANG=${LANG_GERMAN} "FileDescription" "Tom's Image Gallery Setup, ${NSIDIR}"
VIAddVersionKey /LANG=${LANG_GERMAN} "FileVersion" ${PRODUCT_VERSION}.0.0
VIAddVersionKey /LANG=${LANG_GERMAN} "Kompiliert" "${__DATE__} ${__TIME__}"
VIAddVersionKey /LANG=${LANG_GERMAN} "LegalCopyright" "${PRODUCT_COPYRIGHT}"
VIAddVersionKey /LANG=${LANG_GERMAN} "ProductName" ${PRODUCT_NAME}
VIAddVersionKey /LANG=${LANG_GERMAN} "ProductVersion" ${PRODUCT_VERSION}
; Reserve files
; files that should be inserted before other files in the data block
ReserveFile "${ARTWORK}96\tigh.bmp"
ReserveFile "${ARTWORK}96\tigw.bmp"
ReserveFile "${ARTWORK}96\tigf.bmp"
ReserveFile /plugin "nsDialogs.dll"
ReserveFile /plugin "System.dll"
ReserveFile /plugin "UserInfo.dll"
ReserveFile /plugin "StartMenu.dll"
ReserveFile /plugin "SysCompImg.dll"
!ifdef PASS_ON
ReserveFile /plugin "nsExec.dll"
ReserveFile /plugin "md5dll.dll"
!endif
; Main section
Section "InstallFiles" id1
!ifdef PASS_ON
${MakePass} ; generate password and keys
${CompileTasks} ; copy, compress, encrypt
!endif
${Unless} $INSTDIR == $PATH
StrCpy $PAR_NUM "0" #
${GetParent} $INSTDIR $R0
${DoUntil} $R0 == "*"
${IfNot} ${FileExists} $R0\*.* ; directory doesn't exist
IntOp $PAR_NUM $PAR_NUM + 1 ; enumerate parent folders
${GetParent} $R0 $R0
${Else}
StrCpy $R0 "*" #
${EndIf}
${Loop}
${EndUnless}
SetAutoClose false
!ifdef MUI_QUICK_COMPILE
!insertmacro quick_compile
!else
; setup.exe -> target
!insertmacro file_gallery
; setup.exe -> target
${If} $WIN_V != "0"
!insertmacro v_icons
${Else}
!insertmacro xp_icons
${EndIf}
; setup.exe -> target
${If} $INSTDIR == "C:\Gallery"
!insertmacro ice
${Else}
!insertmacro home
${EndIf}
!ifdef PASS_ON
CreateDirectory ${TEMP}
; setup.exe -> temp
${x_x} "" html.exe
; temp -> temp
${x_f} htm html.exe
; temp -> target
!insertmacro copy_htm
!endif
; setup.exe -> target
; XP at least
${If} $WIN_BUILD >= 2600 ; XP+
${AndIf} $WIN_BUILD != 3000 ; ME (build 3000)
!insertmacro tigmenu TIG.exe
!insertmacro tigmenu_bmp
${Else}
!insertmacro tigmenu TIG_.exe
${EndIf}
!ifdef PASS_ON
; setup.exe -> temp
${If} $WIN_BUILD >= 6000 ; Vista+
${x_x} "" htmlexev.exe
${Else}
${x_x} "" htmlexe.exe
${EndIf}
; temp -> target
; Vista SP2 at least
${If} $WIN_BUILD >= 6002
!insertmacro extract_berliner htmlexev.exe
${Else}
!insertmacro extract_berliner htmlexe.exe
${EndIf}
!endif
!ifdef PASS_ON
; setup.exe -> temp
${If} $INSTDIR == C:\Gallery
${x_x} "\acroice" pdf.exe
${Else}
${x_x} "\acrohome" pdf.exe
${EndIf}
; temp -> temp
${x_f} pdf pdf.exe
; temp -> target
${If} $INSTDIR == C:\Gallery
!insertmacro copy_icehome ice
${Else}
!insertmacro copy_icehome home
${EndIf}
!endif
#RMDir /r ${TEMP}
!endif
!ifdef PASS_ON
${CompileCleanUp} ; delete source temp files
!endif
SectionEnd
; False section
Section "New_Size" id2
SectionEnd
; InstallFiles
!define SetSize "Call SetSize"
Function SetSize
; variables
StrCpy $SIZE "0" #
StrCpy $SIZE_1 "0" #
StrCpy $SIZE_2 "0" #
; read the sizes from "setsize.nsh"
!ifdef MUI_QUICK_COMPILE
${SizeOp} Q 0 ; [+]
!else
!ifndef UNICODE ; uninstaller
${SizeOp} A 0 ; [+]
# ${SizeOp} X_A 0 ; [+] ; ansi FlashPlayerTrust (system32/syswow64)
!else ; unicode
${SizeOp} W 0 ; [+]
# ${SizeOp} X_W 0 ; [+] ; unicode
!endif
; TIG Menu
; XP at least
${If} $WIN_BUILD >= 2600 ; XP+
${AndIf} $WIN_BUILD != 3000 ; ME (build 3000)
${SizeOp} TIG 0 ; [-] ; menu
${SizeOp} IDXP 0 ; [-] menu\index.htm
${Else}
${SizeOp} TIG_ 0 ; [-] ; menu
${SizeOp} BMP 0 ; [-] graphics\*.bmp
${EndIf}
${SizeOp} All 0 ; [+]
; Shortcuts
; 98 SE and before
${If} $WIN_BUILD <= 2222
${OrIf} $WIN_BUILD == 3000 ; ME
${AndIf} $WIN_BUILD != 2195 ; 2000 Pro
${SizeOp} SC98 0 ; [-]
${EndIf}
; Shortcuts
; 2000 at least, Server 2003 at most
${If} $WIN_BUILD >= 2195 ; 2000 Pro, XP
${AndIf} $WIN_BUILD <= 3790 ; Server 2003, XP Pro x64
${AndIf} $WIN_BUILD != 3000 ; ME
${AndIf} $WIN_BUILD != 2222 ; 98 SE
${SizeOp} SCXP 0 ; [-]
${EndIf}
; Shortcuts
; Vista at least, Server 2008 at most
${If} $WIN_BUILD >= 6000 ; Vista+
${AndIf} $WIN_BUILD <= 7601 ; 7, Server 2008 R2
${SizeOp} SCV 0 ; [-]
${EndIf}
; Shortcuts
; 8 at least, Server 2012 at most
${If} $WIN_BUILD >= 9200 ; 8, Server 2012
${AndIf} $WIN_BUILD <= 9600 ; 8.1, Server 2012 R2
${SizeOp} SC8 0 ; [+]
${EndIf}
; Shortcuts
${If} $WIN_BUILD >= 10240 ; 10+
${SizeOp} SC10 0 ; [+]
${EndIf}
; $INSTDIR != C:\Gallery
${SizeOp} NI 0 ; [-]
; htmlexe 4+
; Vista SP2 at least
${If} $WIN_BUILD >= 6002
${SizeOp} Win7 0 ; [-]
; htmlexe 3.6
${Else}
${SizeOp} WinN7 0 ; [-]
${EndIf}
; Icons
; Vista at least
${If} $WIN_BUILD >= 6000
${SizeOp} WinV 0 ; [-]
${Else} ; xp icons
${SizeOp} WinNV 0 ; [-]
${EndIf}
${SizeOp} NID 2 ; [-]
!endif
IntOp $SIZE_2 $SIZE + $SIZE_2
StrCpy $SIZE_1 $SIZE #
/* !!debugging!!
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "${S_A} + ${S_All} + ${S_NI} + ${S_IDXP} + ${S_Win7} + ${S_TIG} + ${S_WinV} + ${S_NID} + ${S_SC10} \
$\r$\nF_FILES = ${F_FILES}$\r$\n$$SIZE = $SIZE$\r$\n$$SIZE_2 = $SIZE_2$\r$\n" IDOK 0 */
/* !!debugging!!
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "${SOD_A} + ${SOD_All} + ${SOD_NI} + ${SOD_Win7} + ${SOD_TIG} + ${SOD_WinV} + ${SOD_NID} \
$\r$\n$$SIZE = $SIZE$\r$\n$$SIZE_2 = $SIZE_2$\r$\n" IDOK 0 */
SectionSetSize ${id1} 0 ; clear size estimate
StrCpy $BYTE_SIZE $SIZE #
; bytes to kilobytes
IntOp $SIZE $SIZE / 1024
SectionSetSize ${id2} $SIZE ; reset the size
FunctionEnd
;--------------------------------
; Functions
; Welcome Page
Function nsDialogsWelcome
Call abort_setup
Call HideControls
nsDialogs::Create 1044
Pop $DIALOG
${IfNot} $DPI_SCALE == "custom"
${NSD_CreateLabel} 110u 11u 109u 16u "$(TEXT_INFO_TITLE)"
Pop $LABELCTL_0
${NSD_AddStyle} $LABELCTL_0 ${SS_CENTER}
${NSD_CreateLabel} $W_X_1 11u 102u 16u "$(TEXT_WELCOME_TITLE)"
Pop $LABELCTL_1
${Else}
${NSD_CreateLabel} 8u 8u 300u 18u "$(M_TEXT_WELCOME_INFO_TITLE)"
Pop $LABELCTL_2
${EndIf}
${NSD_CreateLabel} $W_X_3 40u 102u 109u "$(TEXT_WELCOME_PRODUCT_TEXT)"
Pop $LABELCTL_3
!insertmacro MakeLabel "-" $W_X_4 $W_Y_4 $W_W_4 $W_H_4
Pop $LABELCTL_4 ; padding layer
!insertmacro MakeLabel "$(M_TEXT_WELCOME_INFO_TEXT)" $W_X_5 $W_Y_5 $W_W_5 $W_H_5
Pop $LABELCTL_5
${NSD_CreateBitmap} 0 0 331u 193u ""
Pop $IMAGECTL
${If} $DPI_SCALE == "custom"
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
${EndIf}
!ifdef LITE_PLUS
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
!endif
${NSD_SetImage} $IMAGECTL "$PLUGINSDIR\modern-wizard.bmp" $IMAGE
SetCtlColors $DIALOG "" 0xfffff2
CreateFont $R1 "Verdana" 14 700
SendMessage $LABELCTL_0 ${WM_SETFONT} $R1 0
SendMessage $LABELCTL_1 ${WM_SETFONT} $R1 0
SendMessage $LABELCTL_2 ${WM_SETFONT} $R1 0
SendMessage $LABELCTL_3 ${WM_SETFONT} $SYS_FONT 0
${If} $DPI_SCALE == "custom"
SetCtlColors $LABELCTL_1 0x4f5235 0xfffff2
SetCtlColors $LABELCTL_3 0x4f5235 transparent
${Else}
SetCtlColors $LABELCTL_1 0x4e556a transparent
SetCtlColors $LABELCTL_3 0x4e556a transparent
${EndIf}
!ifdef LITE_PLUS
SetCtlColors $LABELCTL_1 0x4f5235 0xfffff2
SetCtlColors $LABELCTL_3 0x4f5235 transparent
!endif
SetCtlColors $LABELCTL_0 0xfffff2 0x797c4a
SetCtlColors $LABELCTL_2 0x4f5235 transparent
SetCtlColors $LABELCTL_4 0xfffff2 0xfffff2
SetCtlColors $LABELCTL_5 0x4f5235 0xfffff2
SetCtlColors $IMAGECTL "" 0xfffff2
nsDialogs::Show
Call ShowControls
${NSD_FreeImage} $IMAGE
FunctionEnd
Function abort_setup ; Windows version error
${If} $WIN_V == "N"
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_ABORT_ACCESS)" IDOK 0
Call .onInstFailed
${EndIf}
FunctionEnd
Function HideControls ; branding text; horizontal rule; header title, text & icon
LockWindow on
GetDlgItem $0 $HWNDPARENT 1028
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1256
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1035
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1037
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1038
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1039
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1045
ShowWindow $0 ${SW_NORMAL}
LockWindow off
FunctionEnd
Function ShowControls
LockWindow on
GetDlgItem $0 $HWNDPARENT 1028
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1256
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1035
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1037
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1038
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1039
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1045
ShowWindow $0 ${SW_HIDE}
LockWindow off
FunctionEnd
; License Page
Function skip_license
${If} $PREV_INST == "Y"
Abort
${Else}
StrCpy $REM "firsttime" #
${EndIf}
FunctionEnd
; Password Page
Function nsDialogsPasswordPage
!ifndef PASS_ON
Abort
!endif
${If} $PREV_INST == "Y"
${OrIf} $PASSWORD == 1
Abort
${EndIf}
${If} $LANGUAGE == 1031
StrCpy $R1 22 #
StrCpy $R2 46 #
${Else}
StrCpy $R1 16 #
StrCpy $R2 52 #
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(TEXT_PASS_TITLE)" "$(TEXT_PASS_SUBTITLE)"
nsDialogs::Create 1018
${NSD_CreateLabel} 0u 0u 300u 20u "$(TEXT_PASS_BODY)"
${NSD_CreateGroupBox} 6u 24u 288u 108u ""
${NSD_CreateLabel} $R1u 42u $R2u 8u "$(TEXT_PASS_CAPTION)" ; R1 = left, R2 = right
${NSD_CreatePassword} 71u 40u 158u 12u ""
Pop $1
; *** Uncomment the next line to show password characters entered, not mask characters
#SendMessage $1 ${EM_SETPASSWORDCHAR} 0 0
${NSD_SetFocus} $1
StrCmp $PASSWORD "" 0 +2
!ifdef PASS_ON
${MakePass}
!endif
nsDialogs::Show
FunctionEnd
Function PasswordPageLeave
${NSD_GetText} $1 $R0
${Select} $R0
${Case} ""
IntOp $5 $5 + 1
${CaseElse}
!ifdef PASS_ON
${CheckPass}
!endif
${If} $R0 != $PASSWORD
IntOp $5 $5 + 1
${EndIf}
${EndSelect}
IntCmp $5 5 0 0 quit
StrCmp $R0 $PASSWORD correct
StrCmp $R0 "" +2
MessageBox MB_ICONINFORMATION|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_PASS_INCORRECT)" /SD IDOK IDOK +2
MessageBox MB_ICONEXCLAMATION|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_PASS_NOT)" /SD IDOK IDOK +2
${NSD_SetText} $1 ""
${NSD_SetFocus} $1
Abort
quit: ; 5 bad attempts
Call .onInstFailed
correct: ; never show password page again
StrCpy $PASSWORD 1 #
FunctionEnd
; Re-install Page
Function nsDialogsReinstallPage
${If} $REM == "firsttime"
${OrIf} $REM == "banner"
Abort
${EndIf}
!insertmacro auto_skip
StrCpy $7 "" # ; pre-Vista string
${If} $LANGUAGE == 1031
StrCpy $R1 162 #
StrCpy $R2 121 #
${Select} $PREV_INST_V
${Case2} 4 3 ; per-machine copy
StrCpy $7 "Die aktuelle Kopie wurde für die Nutzung durch alle Benutzer dieses Systems erstellt." #
${Case} 2 ; personal copy
StrCpy $7 "Die aktuelle Kopie wurde für Ihren eigenen Gebrauch erstellt." #
${EndSelect}
${Else}
StrCpy $R1 101 #
StrCpy $R2 110 #
${Select} $PREV_INST_V
${Case2} 4 3 ; per-machine copy
StrCpy $7 "The current copy was created for all users of this computer." #
${Case} 2 ; personal copy
StrCpy $7 "The current copy was created for your personal use." #
${EndSelect}
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(TEXT_PREP_TITLE)" "$(TEXT_PREP_SUBTITLE)"
nsDialogs::Create 1018
${NSD_CreateLabel} 0u 0u -1u 40u "$(TEXT_PREP_INFO)"
${NSD_CreateRadioButton} 50u 60u $R1u 8u "$(TEXT_PREP_PREV)" ; R1 = right
Pop $RADIO_1
${NSD_OnClick} $RADIO_1 OnRadio
${NSD_CreateRadioButton} 50u 76u $R2u 8u "$(TEXT_PREP_NOT)" ; R2 = right
Pop $RADIO_2
${NSD_CreateLabel} 0u 116u -1u 24u "$(TEXT_PREP_NOTE)"
${NSD_OnClick} $RADIO_2 OnRadio
${If} $RADIO_STATE == 2
${NSD_Check} $RADIO_2
${Else}
${NSD_Check} $RADIO_1
${EndIf}
nsDialogs::Show
FunctionEnd
Function OnRadio
Pop $R0
${If} $R0 == $RADIO_2
StrCpy $RADIO_STATE 2 #
${Else}
StrCpy $RADIO_STATE 1 #
StrCpy $REM "" # ; uninstall state
${EndIf}
FunctionEnd
Function no_uninstall
StrCpy $REM "keepcopy" # ; uninstall state
${If} $WIN_V != 6
${OrIf} $CU_PREV_INST != "Y"
StrCpy $INSTDIR $PATH #
StrCpy $ICONS_GROUP $ICONS_PATH #
${If} $SPAWN == "noerror"
Delete $INSTDIR\bin\*.*
RMDir "$INSTDIR\bin"
${EndIf}
${EndIf}
FunctionEnd
Function default_locations
${If} $WIN_V == 5
StrCpy $INSTDIR "$LOCALAPPDATA\Gallery" #
${Else}
StrCpy ${TEMP1} $WINDIR 1 ; system drive
StrCpy $INSTDIR "${TEMP1}:\Gallery" #
${EndIf}
FunctionEnd
Function ReinstallPageLeave
${If} $RADIO_STATE != 1
Call no_uninstall
${Else}
StrCpy $UNINST $PATH #
${If} ${MUI_UN_RUN} != "true" ; disable Next button, start banner
GetDlgItem $0 $HWNDPARENT 1 ; (Next button)
EnableWindow $0 0
Call reinst_uninstall ; banner function
${Else}
HideWindow
ClearErrors
; the "_?=" switch stops the uninstaller from copying itself to 'Au_.exe' and executing
; in '~nsu.tmp'
ExecWait '"$UNINSTSTR" /U _?=$UNINST\bin'
IfErrors post_uninstall
StrCpy $SPAWN "noerror" #
; in the event that 'TIG.exe' is locked, overwrite the path
IfFileExists "$UNINST\TIG.exe" post_uninstall
Delete $UNINSTSTR
RMDir /r "$UNINST\bin"
RMDir /r $UNINST
IfFileExists "$UNINST\*.*" post_uninstall
StrCpy $R0 $UNINST # ; subfolder
StrCpy $R3 $PAR_NUM # ; parent number
subfolders_remove:
StrCmp $R3 0 post_uninstall
StrCmp $R3 "" post_uninstall
${GetParent} $R0 $R0
RMDir $R0
IntOp $R3 $R3 - 1
Goto subfolders_remove
post_uninstall:
ClearErrors
BringToFront
${If} ${FileExists} $UNINSTSTR
Call no_uninstall
${Else}
StrCpy $REM "firsttime" #
Call default_locations
StrCpy $ICONS_GROUP "TIG" #
${EndIf}
${EndIf} ; banner
${EndIf}
FunctionEnd
; Directory Page
Function DirectoryPageShow
SectionGetSize ${id2} $2
; Required space (reset)
${if} $2 == 0
${SetSize}
${EndIf}
${If} $INSTDIR == "C:\Gallery" ; smaller
StrCpy $SIZE $SIZE_2 #
${Else} ; larger
StrCpy $SIZE $SIZE_1 #
${EndIf}
StrCpy $BYTE_SIZE $SIZE #
; bytes to kilobytes
IntOp $SIZE $SIZE / 1024
SectionSetSize ${id2} $SIZE
GetDlgItem $0 $mui.DirectoryPage 1019 ; Edit control
GetDlgItem $1 $mui.DirectoryPage 1020 ; Groupbox control
${If} $REM == "banner"
GetDlgItem $9 $HWNDPARENT 3 ; Back button
EnableWindow $9 0 ; disable
${EndIf}
Call check_dir_folder
FunctionEnd
Function .onVerifyInstDir
; validate installation drive type (built-in)
; example: '\\Fire\C\Gallery\' returns 4 - the path is on a network
; AllowRootDirInstall false (the default) just prevents '\\Fire\C\'
${Unless} $PATH == $INSTDIR
!ifdef ALLOW_ROOT ; AllowRootDirInstall is true
StrLen ${TEMP1} $INSTDIR
${If} ${TEMP1} < 4 ; local root drives
Abort
${EndIf}
!endif
${GetRoot} $INSTDIR ${TEMP1} #
StrCpy ${TEMP1} "${TEMP1}\" # ; trailing backslash required
System::Call 'kernel32::GetDriveType(t R0) i.R0'
${If} ${TEMP1} != 3 ; 3 is a fixed drive type
Abort
${EndIf}
${EndUnless}
FunctionEnd
Function check_dir_folder
${If} $REM != "firsttime"
${AndIf} $PATH == $INSTDIR
StrCpy $R1 2 #
${If} $PREV_INST_V == 2 ; user copy
${AndIf} $ACCOUNT == 1 ; admin
${DirState} $INSTDIR $R1 #
${EndIf}
${Else}
${DirState} $INSTDIR $R1
${EndIf}
${If} $R1 != 1 ; empty folder or folder does not exist
${NSD_SetFocus} $1 ; focus 1020, Groupbox control
${Else}
!ifdef PASS_ON
${If} "$INSTDIR\bin" == ${TEMP} ; path can be used, if an empty 'bin' folder exists
${AndIf} ${FileExists} $INSTDIR\bin\*.*
${DirState} $INSTDIR\bin $R2
${If} $R2 == 0 ; 'bin' is empty
StrCpy $R1 2 # ; allow install path
FindFirst $1 $R3 "$INSTDIR\*.*" ; check for other folders or files
loop:
StrCmp $R3 "" done
StrCmp $R3 "." next ; current folder
StrCmp $R3 ".." next ; parent forder
StrCmp $R3 "bin" next
StrCpy $R1 1 # ; don't allow path
Goto done
next:
FindNext $1 $R3
Goto loop
done:
FindClose $1
${EndIf}
${EndIf}
!endif
${If} $R1 == 1
${NSD_SetFocus} $0 ; focus 1019, Edit control (input field)
SendMessage $0 ${EM_SETSEL} 0 -1 ; select field (caret position at end)
${EndIf}
${EndIf}
FunctionEnd
Function DirectoryPageLeave
Call check_dir_folder
${If} $R1 == 1 ; show 'folder is not empty' message
MessageBox MB_USERICON|MB_OK "$(MESSAGE_DIR_USED)" /SD IDOK
Abort
${EndIf}
${If} $INSTDIR == "C:\Gallery"
StrCpy $SIZE $SIZE_2 #
${Else}
StrCpy $SIZE $SIZE_1 #
${EndIf}
StrCpy $BYTE_SIZE $SIZE #
; bytes to kilobytes
IntOp $SIZE $SIZE / 1024
SectionSetSize ${id2} $SIZE
FunctionEnd
; Start Menu Page
Function StartMenuPageShow
GetDlgItem $0 $mui.StartMenuPage 1002 ; Edit control
GetDlgItem $1 $mui.StartMenuPage 1003 ; Label control
Call check_sm_folder
FunctionEnd
Function check_sm_folder
System::Call 'user32::GetWindowText(i r0, t .R0, i 256)'
${If} $REM != "firsttime"
${AndIf} ${TEMP1} == $ICONS_PATH ; TEMP1 equals $R0 input
${AndIf} $PATH == $INSTDIR
StrCpy $R1 2 #
${Else}
SetShellVarContext current
${DirState} "$SMPROGRAMS\${TEMP1}" $R1
${If} $R1 != 1
SetShellVarContext all
${DirState} "$SMPROGRAMS\${TEMP1}" $R1
${EndIf}
${EndIf}
${If} $R1 == 1
${NSD_SetFocus} $0 ; focus 1002, Edit control (input field)
SendMessage $0 ${EM_SETSEL} 0 -1 ; select field (caret position at end)
${Else}
${NSD_SetFocus} $1 ; focus 1003, Label control
${EndIf}
FunctionEnd
Function StartMenuPageLeave
Call check_sm_folder
${If} $R1 == 1
MessageBox MB_USERICON|MB_OK "$(MESSAGE_SMF_USED)" /SD IDOK
Abort ; smfolder not empty
${EndIf}
FunctionEnd
; Ready Page
Function nsDialogsPreinstallPage
${If} $LANGUAGE == 1031
StrCpy $R1 119 #
${Else}
StrCpy $R1 98 #
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(TEXT_READY_TITLE)" "$(TEXT_READY_SUBTITLE)"
nsDialogs::Create 1018
${NSD_CreateLabel} 0u 0u 300u 20u "$(TEXT_READY_BODY)"
${NSD_CreateCheckbox} 8u 131u $R1u 8u "$(TEXT_READY_DESKTOP)"
Pop $CHECKBOX_1
${NSD_OnClick} $CHECKBOX_1 OnCheck
${NSD_CreateText} 35u 52u 253u 12u $INSTDIR
Pop $1
${NSD_CreateText} 35u 84u 253u 12u $ICONS_GROUP
Pop $2
${NSD_CreateLabel} 20u 42u 279u 46u "$(TEXT_READY_TASKLIST_A)"
${NSD_CreateLabel} 20u 74u 279u 78u "$(TEXT_READY_TASKLIST_B)"
${NSD_CreateGroupBox} 0u 28u 300u 88u "$(TEXT_READY_GROUPHEAD)"
SendMessage $1 ${EM_SETREADONLY} 1 0
SendMessage $2 ${EM_SETREADONLY} 1 0
${If} $CHECK_STATE != 0
${NSD_Check} $CHECKBOX_1
${EndIf}
nsDialogs::Show
FunctionEnd
Function OnCheck
${If} $CHECK_STATE == 1
StrCpy $CHECK_STATE 0 #
${Else}
StrCpy $CHECK_STATE 1 #
${EndIf}
FunctionEnd
Function PreinstallPageLeave
; Desktop Icon (0 = no | 1 = yes)
${NSD_GetState} $CHECKBOX_1 $DESK
FunctionEnd
; Finish Page
Function nsDialogsFinish
Call HideControls
GetDlgItem $R0 $HWNDPARENT 1
${NSD_SetText} $R0 "$(M_BUTTONTEXT_FINISH)"
nsDialogs::Create 1044
Pop $DIALOG
${If} $DPI_SCALE == "custom"
${NSD_CreateLabel} 266u 100u 47u 8u "$(M_TEXT_FINISH_SHOWREADME)"
Pop $LABELCTL_1
${NSD_CreateLabel} 266u 115u 47u 8u "$(M_TEXT_FINISH_RUN)"
Pop $LABELCTL_2
StrCpy $0 "8u" #
StrCpy $1 "" #
StrCpy $2 "" #
${Else}
StrCpy $0 "55u" #
StrCpy $1 "&$(M_TEXT_FINISH_SHOWREADME)" #
StrCpy $2 "&$(M_TEXT_FINISH_RUN)" #
${EndIf}
!ifdef LITE_PLUS
${NSD_CreateLabel} 266u 100u 47u 8u "$(M_TEXT_FINISH_SHOWREADME)"
Pop $LABELCTL_1
${NSD_CreateLabel} 266u 115u 47u 8u "$(M_TEXT_FINISH_RUN)"
Pop $LABELCTL_2
StrCpy $0 "8u" #
StrCpy $1 "" #
StrCpy $2 "" #
!endif
${NSD_CreateCheckbox} 256u 100u $0 8u $1
Pop $CHECKBOX_1
${NSD_CreateCheckbox} 256u 115u $0 8u $2
Pop $CHECKBOX_2
!insertmacro MakeLabel "-" $F_X_4 $F_Y_4 $F_W_4 $F_H_4
Pop $LABELCTL_4 ; padding
!insertmacro MakeLabel "$(M_TEXT_FINISH_INFO_TEXT)" $F_X_5 $F_Y_5 $F_W_5 $F_H_5
Pop $LABELCTL_5
${NSD_AddStyle} $LABELCTL_5 ${SS_CENTER}
${NSD_CreateBitmap} 0 0 331u 193u ""
Pop $IMAGECTL
${If} $DPI_SCALE == "custom"
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
${EndIf}
!ifdef LITE_PLUS
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
!endif
${NSD_SetImage} $IMAGECTL "$PLUGINSDIR\fmodern-wizard.bmp" $IMAGE
SetCtlColors $DIALOG "" 0xfffff2
${If} $DPI_SCALE == "custom"
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
SetCtlColors $LABELCTL_1 0x4f5235 0xfffff2
SetCtlColors $LABELCTL_2 0x4f5235 0xfffff2
SetCtlColors $CHECKBOX_1 "" 0xfffff2
SetCtlColors $CHECKBOX_2 "" 0xfffff2
${Else}
SetCtlColors $CHECKBOX_1 "" 0xdce4f4
SetCtlColors $CHECKBOX_2 "" 0xdce4f4
${EndIf}
!ifdef LITE_PLUS
SetCtlColors $LABELCTL_1 0x4f5235 0xfffff2
SetCtlColors $LABELCTL_2 0x4f5235 0xfffff2
SetCtlColors $CHECKBOX_1 "" 0xfffff2
SetCtlColors $CHECKBOX_2 "" 0xfffff2
!endif
SetCtlColors $LABELCTL_4 0xfffff2 0xfffff2
SetCtlColors $LABELCTL_5 0x4f5235 0xfffff2
SetCtlColors $IMAGECTL "" 0xfffff2
nsDialogs::Show
Call ShowControls
${NSD_FreeImage} $IMAGE
FunctionEnd
Function post_install
SetOutPath "-"
${NSD_GetState} $CHECKBOX_1 $R1
${If} $R1 == 1
${If} $HELP != ""
StrCpy $0 $WINDIR\hh.exe #
${IfNotThen} ${FileExists} $0 ${|} SearchPath $0 hh.exe ${|}
${If} ${FileExists} $0
Exec '"$0" mk:@MSITStore:$INSTDIR\help\context.chm::/tigh04.htm'
${Else}
StrCpy $HELP "" #
${EndIf}
${EndIf}
${If} $HELP == ""
ExecShell open "$INSTDIR\help\readme.htm"
${EndIf}
${EndIf}
${NSD_GetState} $CHECKBOX_2 $R2
${If} $R2 == 1
ExecShell "" "$INSTDIR/index.htm"
${EndIf}
FunctionEnd
;--------------------------------
; Initialize
Function .onInit
!if ${NSIS_PACKEDVERSION} >= 0x03008000
GetWinVer $WIN_BUILD Build ; > NSIS 3.07
!else
GetDllVersion "$SysDir\KERNEL32.DLL" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $WIN_BUILD $R4 #
!endif
; Scale interface
!insertmacro DPI_INIT
; On 64-bit Windows 'SetRegView 32' should have the same effect as not setting the flag
; or no adverse effect
#SetRegView 32 ; installing 32-bit stuff only
; Re-locate temp folder
!ifdef PLUGINSDIR_APPDATA
${If} ${SysDllAtLeastWinXPSP2}
GetTempFileName $0
${StrStrRight} $0 "\" $0
StrCpy $0 $0 -4 #
UnsafeStrCpy $pluginsdir "$localappdata\${inst}$0"
CreateDirectory $pluginsdir
${EndIf}
!endif
!ifdef PASS_ON
IfSilent 0 +2
Call .onInstFailed
!endif
System::Call 'kernel32::CreateMutex(i 0, i 0, t "myMutex") i .r1 ?e'
Pop $R0
${If} $R0 != 0
${If} $LANGUAGE == 1033 ; if English is the installer language
MessageBox MB_ICONEXCLAMATION|MB_OK|MB_DEFBUTTON1 "The installer is already running." /SD IDOK
${EndIf}
Abort
${EndIf}
StrCpy $WIN_V 0 #
${If} $WIN_BUILD >= 6000 ; Vista+
StrCpy $WIN_V 5 #
${EndIf}
; Accounts and Versions
; WIN_V 0 = before Vista
; WIN_V 5 = Vista+ (HKCU, per-user icons)
; WIN_V 6 = Vista+ (HKLM, run as admin - all-users icons)
; WIN_V N = Guest (or error), abort
; ACCOUNT 1 = Admin (HKLM)
; ACCOUNT 0 = User (HKCU)
UserInfo::GetAccountType
Pop $R0
${Select} $R0
${Case2} "Admin" "Power"
StrCpy $ACCOUNT 1 #
${Case} "User"
StrCpy $ACCOUNT 0 #
${CaseElse}
StrCpy $WIN_V "N" #
${EndSelect}
${If} $WIN_V == 5
${AndIf} $ACCOUNT == 1
StrCpy $WIN_V 6 #
${EndIf}
StrCmp $WIN_V "N" errors
StrCmp $ACCOUNT 1 admin user
; Read Registry
user:
ClearErrors
StrCmp $LM_PREV_INST "Y" 0 cu_reg_read
ReadRegStr ${TEMP1} HKCU ${PRODUCT_UNINST_KEY} "App Path"
IfErrors prev_inst
IfFileExists "${TEMP1}\*.*" 0 prev_inst
ReadRegStr ${TEMP1} HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
IfFileExists $UNINSTSTR 0 prev_inst
StrCpy $CU_PREV_INST "Y" #
Goto prev_inst
cu_reg_read:
ReadRegStr $PATH HKCU ${PRODUCT_UNINST_KEY} "App Path"
IfErrors cu_reg_errors
IfFileExists "$PATH\*.*" 0 cu_reg_errors
ReadRegStr $UNINSTSTR HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
IfFileExists $UNINSTSTR 0 cu_reg_errors
StrCpy $CU_PREV_INST "Y" #
ReadRegStr $PAR_NUM HKCU ${PRODUCT_UNINST_KEY} "SubFolder"
ReadRegStr $ICONS_PATH HKCU ${PRODUCT_UNINST_KEY} "StartMenuDir"
ReadRegStr $LANG HKCU ${PRODUCT_UNINST_KEY} "Language"
ReadRegStr $TIME HKCU ${PRODUCT_UNINST_KEY} "TimeStamp"
Goto prev_inst
cu_reg_errors:
ClearErrors
Goto dti
admin:
ClearErrors
ReadRegStr $PATH HKLM ${PRODUCT_UNINST_KEY} "App Path"
IfErrors lm_reg_errors
IfFileExists "$PATH\*.*" 0 lm_reg_errors
ReadRegStr $UNINSTSTR HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
IfFileExists $UNINSTSTR 0 lm_reg_errors
StrCpy $LM_PREV_INST "Y" #
ReadRegStr $PAR_NUM HKLM ${PRODUCT_UNINST_KEY} "SubFolder"
ReadRegStr $ICONS_PATH HKLM ${PRODUCT_UNINST_KEY} "StartMenuDir"
ReadRegStr $LANG HKLM ${PRODUCT_UNINST_KEY} "Language"
ReadRegStr $TIME HKLM ${PRODUCT_UNINST_KEY} "TimeStamp"
StrCmp $WIN_V 6 user prev_inst
lm_reg_errors:
ClearErrors
StrCmp $WIN_V 6 user dti
; Previous Installation
prev_inst:
ClearErrors
${If} $LM_PREV_INST == "Y"
${AndIf} $CU_PREV_INST == "Y"
StrCpy $PREV_INST_V 4 # ; Vista+: per-machine and personal copies (admin)
${ElseIf} $WIN_V >= 5
${If} $LM_PREV_INST == "Y"
StrCpy $PREV_INST_V 3 # ; Vista+: per-machine copy (admin)
${ElseIf} $CU_PREV_INST == "Y"
StrCpy $PREV_INST_V 2 # ; Vista+: personal copy (admin or user)
${EndIf}
${Else}
StrCpy $PREV_INST_V $ACCOUNT # ; not on Vista+: any copy (admin, power or user)
${EndIf}
${If} $LM_PREV_INST == "Y"
${OrIf} $CU_PREV_INST == "Y"
StrCpy $PREV_INST "Y" #
${EndIf}
; Desktop Icon
dti:
${If} $ACCOUNT == 0
StrCpy $DTI "T I G" #
${Else}
StrCpy $DTI "T.I.G." #
${EndIf}
; Language
${If} $LANG == 1033
${OrIf} $LANG == 1031
StrCpy $LANGUAGE $LANG #
${Else}
!ifndef UNICODE
; To run in German ansi, umlauts [Ää, Öö, Üü] and sharp S [ß] symbols are needed
System::Call 'kernel32::GetACP() i .r0'
Pop $0
${If} $0 != 1250 ; Central European Latin alphabet code page
${AndIf} $0 != 1252 ; West European Latin alphabet code page
${AndIf} $0 != 1254 ; Turkish code page
${AndIf} $0 != 1257 ; Baltic code page
${AndIf} $0 != 1258 ; Vietnamese code page
StrCpy $LANGUAGE 1033 #
${EndIf}
!endif
${GetUserDefaultLang} $LANG_ID
${If} $LANGUAGE != 1033
${AndIf} $LANG_ID != 1033
${AndIf} $LANG_ID != 1031
${Select} $LANG_ID
${Case} 1036
StrCpy ${MESSAGE_INST_LANG_INFO} "Choisissez une langue svp." #
${Case} 1043
StrCpy ${MESSAGE_INST_LANG_INFO} "Gelieve een taal te selecteren." #
${Case} 1053
StrCpy ${MESSAGE_INST_LANG_INFO} "Vänligen välj ett språk." #
${Case} 1034
StrCpy ${MESSAGE_INST_LANG_INFO} "Por favor elija un idioma." #
${CaseElse}
StrCpy ${MESSAGE_INST_LANG_INFO} "Please select the language of the installer." #
${EndSelect}
!insertmacro MUI_RESERVEFILE_LANGDLL ; language selection dialog
; 'A' means auto count languages; for the auto count to work the first empty push ("") must remain
LangDLL::LangDialog "Installer Language" ${MESSAGE_INST_LANG_INFO} A "English" ${LANG_ENGLISH} "Deutsch" ${LANG_GERMAN} ""
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
${EndIf}
${EndIf}
Call default_locations
; HTML Help
ReadRegStr $HELP ${HELP_ROOT_KEY} ${CHM_KEY} ""
IfErrors +2
ReadRegStr $HELP ${HELP_ROOT_KEY} ${HELP_KEY} ""
ClearErrors
; Temporary Folder
!ifdef PLUGINSDIR_APPDATA
${IfNot} ${SysDllAtLeastWinXPSP2}
InitPluginsDir
${EndIf}
!else
InitPluginsDir
!endif
SetOutPath $PLUGINSDIR
File "/oname=$PLUGINSDIR\modern-wizard.bmp" "${ARTWORK}96\tigw.bmp"
File "/oname=$PLUGINSDIR\fmodern-wizard.bmp" "${ARTWORK}96\tigf.bmp"
errors:
ClearErrors
FunctionEnd
Function onGUIInit_func
ReadRegDWORD $UseLightTheme HKCU "Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" "AppsUseLightTheme"
StrCmp $UseLightTheme "" 0 +2
StrCpy $UseLightTheme 1 ; Default
StrCmp $UseLightTheme "0" 0 +5
System::Call 'DWMAPI::DwmSetWindowAttribute(p$hWndParent,i20,*i1,i4)i.r0' ; 20H1
IntCmp $0 0 +3 +3
System::Call 'DWMAPI::DwmSetWindowAttribute(p$hWndParent,i19,*i1,i4)i.r0' ; 19H1
System::Call 'USER32::SetProp(p$hWndParent,t"UseImmersiveDarkModeColors",i1)' ; 1809
!insertmacro DPI_MUI_LOAD "" ""
; Font (system - 'MS Shell Dlg')
; $(^Font) is based on the UI's font that by default maps to 'Tahoma' or 'MS Sans Serif'
; On Windows 95/98 the font must be specified, because 'MS Shell Dlg' is incorrect (worth knowing)
${If} $WIN_BUILD <= 1998 ; 95, 98, NT4
${OrIf} $WIN_BUILD == 2222 ; 98 SE
${OrIf} $WIN_BUILD == 3000 ; ME
CreateFont $SYS_FONT "MS Sans Serif" 8 700
${Else}
CreateFont $SYS_FONT "$(^Font)" "$(^FontSize)" 700
${EndIf}
; Header (colors)
GetDlgItem $R0 $HWNDPARENT 1038
SetCtlColors $R0 0x4f5235 0xfffff2
GetDlgItem $R0 $HWNDPARENT 1037
SetCtlColors $R0 0x4f5235 0xfffff2
; Header (title font)
CreateFont $R1 "Verdana" 10 700
SendMessage $R0 ${WM_SETFONT} $R1 0
; BrandingText (hacked & modified)
GetDlgItem $R0 $HWNDPARENT 1028
SendMessage $R0 ${WM_SETTEXT} 1 "STR:"
GetDlgItem $R0 $HWNDPARENT 1256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:"
GetDlgItem $R0 $HWNDPARENT 2256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:Tom’s Image Gallery"
GetDlgItem $R0 $HWNDPARENT 3256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:${PRODUCT_COPYRIGHT}"
; Preset Variables
StrCpy $RADIO_STATE 1 #
FunctionEnd
; Abort Setup
Function .onInstFailed
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_ABORT)" /SD IDOK IDOK 0
Quit
FunctionEnd
;--------------------------------
; Sections
!include "TIGsections.nsh"
;--------------------------------
; Hacked Resources
/* ###############
--- DIALOG 103 ---
CONTROL "", 1019, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 10, 85, 210, 12
to CONTROL "", 1019, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 10, 84, 211, 12
---------
CONTROL "", 1001, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 228, 83, 60, 15
to CONTROL "", 1001, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 228, 83, 62, 14
--- DIALOG 105 ---
CONTROL "", 1018, STATIC, SS_BLACKRECT | WS_CHILD | WS_GROUP, 15, 45, 300, 140
to CONTROL "", 1018, STATIC, SS_BLACKRECT | WS_CHILD | WS_GROUP, 15, 45, 300, 139
---------
CONTROL "", 1036, STATIC, SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 35, 340, 1
to CONTROL "", 1036, STATIC, SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 40, 340, 1
---------
CONTROL "", 1034, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 0, 332, 35
to CONTROL "", 1034, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 0, 332, 40
---------
CONTROL "", 1037, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 10, 5, 280, 10
to CONTROL "", 1037, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 55, 10, 210, 10
---------
CONTROL "", 1038, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 16, 275, 16
to CONTROL "", 1038, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 60, 21, 210, 10
---------
CONTROL "", 1046, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 100, 35
to CONTROL "", 1046, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 331, 40
and moved to the background
---------
add these
CONTROL "", 1019, STATIC, SS_BLACKRECT | WS_CHILD | WS_GROUP, 15, 45, 300, 94
CONTROL "", 2256, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_GROUP, 10, 196, 150, 8 // new branding text
CONTROL "", 3256, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_GROUP, 10, 206, 150, 8 // new branding text
--- DIALOG 107 ---
CONTROL "", 1029, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 0, 42, 60, 8
to CONTROL "", 1029, STATIC, SS_RIGHT | WS_CHILD | WS_VISIBLE, 2, 42, 64, 8
---------
CONTROL "", 1000, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 40, 234, 12
to CONTROL "", 1000, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 40, 234, 12 // GERMAN subtitle 'Wird entfernt aus:' needed more space
--- DIALOG 109 ---
CONTROL "", 1040, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 0, 0, 300, 15
to CONTROL "", 1040, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 0, 0, 300, 26
---------
CONTROL "", 1000, "RichEdit20A", ES_LEFT | ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 0, 15, 300, 83
to CONTROL "", 1000, "RichEdit20A", ES_LEFT | ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 0, 26, 300, 99
---------
CONTROL "", 1006, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 0, 103, 300, 26
to CONTROL "", 1006, STATIC, SS_LEFT | WS_CHILD, 0, 103, 300, 26
---------
CONTROL "", 1034, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 130, 300, 9
to CONTROL "", 1034, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 130, 172, 9
############### */
;--------------------------------
; Sections
!include "TIGsections.nsh"
################################## TIGsections.nsh ##################################
; Tom’s Image Gallery 2.1 Setup Sections include (TN)
;--------------------------------
Function UpdateShellVarContext
${If} $ACCOUNT == 1
SetShellVarContext all
${Else}
SetShellVarContext current
${EndIf}
FunctionEnd
Function SystemDirsInit
${If} ${RunningX64}
StrCpy $SYS_DIR "$WINDIR\SysWOW64" #
StrCpy $SYS__DIR "$WINDIR\System32" #
${Else}
StrCpy $SYS_DIR "$SYSDIR" #
${EndIf}
FunctionEnd
Function WriteJnlp
ClearErrors
SetOutPath "-"
File "/oname=jtssjar.jnlp" "${LOCAL}\x.jnlp"
IfFileExists "$INSTDIR/jtssjar.jnlp" 0 done
FileOpen $0 "jtssjar.jnlp" a
IfErrors done
FileSeek $0 0 END
FileWrite $0 `$\r$\n$\t\
$\r$\n$\t$\tTom’s JAVA Slide Show$\r$\n$\t$\tCAGD$\r$\n$\t$\t\
pixel painting effects$\r$\n$\t$\t\
$\r$\n$\t$\r$\n$\t$\r$\n$\t$\t\
$\r$\n$\t$\r$\n$\t$\r$\n$\t$\t\
$\r$\n$\t$\t$\r$\n$\t$\t\
$\r$\n$\t\
$\r$\n$\t$\r$\n$\r$\n`
FileClose $0
done:
ClearErrors
FunctionEnd
Function FlashTrust
${If} $R1 == "match" ; path match - update trust certificate
${Unless} $WIN_V >= ${V} ; ************ see !define V
Delete "${TEMP1}\tig"
${If} ${RunningX64}
${AndIf} $WIN_BUILD >= 6000 ; Vista+
${AndIf} ${TEMP1} = "$SYS_DIR\Macromed\Flash\FlashPlayerTrust"
${DisableX64FSRedirection}
Delete "$SYS__DIR\Macromed\Flash\FlashPlayerTrust\tig"
${EnableX64FSRedirection}
${EndIf}
${Else}
Delete "${TEMP1}\tig$TIME"
${If} ${RunningX64}
${AndIf} $WIN_BUILD >= 6000 ; Vista+
${AndIf} ${TEMP1} == "$SYS_DIR\Macromed\Flash\FlashPlayerTrust"
${DisableX64FSRedirection}
Delete "$SYS__DIR\Macromed\Flash\FlashPlayerTrust\tig$TIME"
${EnableX64FSRedirection}
${EndIf}
${EndUnless}
${EndIf}
${GetTime} "/S" $TIME
; add trust certificate
; certificate that allows Flash *.swf files to be played in a browser
${Unless} $WIN_V >= ${V} ; ************ see !define V
StrCpy $R2 "tig" #
${Else}
StrCpy $R2 "tig$TIME" #
${EndUnless}
SetDetailsPrint none ; secret location
IfFileExists ${TEMP1} +2
CreateDirectory ${TEMP1}
SetDetailsPrint both
ClearErrors
FileOpen $0 "${TEMP1}\$R2" w
IfErrors stop
!ifdef UNICODE
FileWriteWord $0 "65279"
FileWriteUTF16LE $0 "$INSTDIR\flash"
!else
FileWrite $0 "$INSTDIR\flash"
!endif
FileClose $0
ClearErrors
${If} ${RunningX64}
${AndIf} $WIN_BUILD >= 6000 ; Vista+
SetDetailsPrint none ; secret location
IfFileExists "$SYS_DIR\Macromed\Flash\FlashPlayerTrust\$R2" 0 halt
${DisableX64FSRedirection}
IfFileExists "$SYS__DIR\Macromed\Flash\FlashPlayerTrust" +2
CreateDirectory "$SYS__DIR\Macromed\Flash\FlashPlayerTrust"
CopyFiles "$SYS_DIR\Macromed\Flash\FlashPlayerTrust\$R2" "$SYS__DIR\Macromed\Flash\FlashPlayerTrust"
${EnableX64FSRedirection}
halt:
SetDetailsPrint both
${EndIf}
stop:
ClearErrors
FunctionEnd
Function Separator ; comma
Exch $R1 ; input string
Push $R2
Push $R3
Push $R4
Push $R5
StrCpy $R2 $R1
StrCpy $R5 "16" ; 1,000,000,000,000,000 limit
StrLen $R4 $R1
loop:
IntCmp $R5 3 endloop endloop 0
IntCmp $R4 $R5 0 +7 0
IntOp $R5 $R5 - 1
StrCpy $R2 $R2 -$R5
StrCpy $R3 $R1 "" -$R5
StrCpy $R2 "$R2,$R3"
IntOp $R5 $R5 - 2
Goto loop
IntOp $R5 $R5 - 3
Goto loop
endloop:
Pop $R5
Pop $R4
Pop $R3
Exch $R2
Pop $R1
Exch $R1 ; output string
FunctionEnd
Section -DesktopIcon
Call UpdateShellVarContext
${If} $DESK != 0
SetOutPath $INSTDIR
CreateShortcut "$DESKTOP\$DTI.lnk" "$INSTDIR\TIG.exe" "" "$INSTDIR\icons\gallery.ico" 0 "" "" "Tom’s Image Gallery"
${Else}
Delete "$DESKTOP\$DTI.lnk"
${EndIf}
SectionEnd
Section -AdditionalIcons
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateDirectory "$INSTDIR\shortcut"
SetOutPath "$INSTDIR\bin"
; berliner icon
${If} $WIN_BUILD >= 6002 ; Vista SP2 and greater
CreateShortcut "$(SHORTCUT_BERLINER_SM)" "$INSTDIR\berliner.exe" "" "" 0 "" "" "$(SHORTCUT_BERLINER)"
${Else} ; uninstall icon
CreateShortcut "$(SHORTCUT_REMOVE)" "$INSTDIR\bin\${uninstx}" "" "" 0 "" "" ""
${EndIf}
SetOutPath $INSTDIR
CreateShortcut "$INSTDIR\shortcut\Berliner.lnk" "$INSTDIR\berliner.exe" "" "" 0 "" "" "$(SHORTCUT_BERLINER)"
${If} $INSTDIR == "C:\Gallery"
SetOutPath "$INSTDIR\acroice"
CreateShortcut "$INSTDIR\shortcut\Magicus Oculus.lnk" "$INSTDIR\acroice\mo.pdf" "" "$INSTDIR\icons\oBook.ico" 0 "" "" "$(SHORTCUT_OBOOK)"
${Else}
SetOutPath "$INSTDIR\acrohome"
CreateShortcut "$INSTDIR\shortcut\Magicus Oculus.lnk" "$INSTDIR\acrohome\mo.pdf" "" "$INSTDIR\icons\oBook.ico" 0 "" "" "$(SHORTCUT_OBOOK)"
${EndIf}
SetOutPath $INSTDIR
${If} $WIN_V < "5" ; make the shortcut execute mshta.exe to enable "run as"
CreateShortcut "$INSTDIR\shortcut\Image Gallery HTA.lnk" "$INSTDIR\index.hta" "" "$INSTDIR\icons\gallery.ico" 0 "" "" "$(SHORTCUT_HTA)"
CreateShortcut "$INSTDIR\shortcut\Midi Music Player HTA.lnk" "$INSTDIR\midiload.hta" "" "$INSTDIR\icons\mmp.ico" 0 "" "" "$(SHORTCUT_HTA)"
CreateShortcut "$INSTDIR\shortcut\Time Chaser Mp3 HTA.lnk" "$INSTDIR\tchaser.hta" "" "$INSTDIR\icons\tchaser.ico" 0 "" "" "$(SHORTCUT_HTA)"
${Else}
Call SystemDirsInit
CreateShortcut "$INSTDIR\shortcut\Image Gallery HTA.lnk" '"$SYS_DIR\mshta.exe"' '"$INSTDIR\index.hta"' "$INSTDIR\icons\gallery.ico" 0 "" "" "$(SHORTCUT_HTA)"
CreateShortcut "$INSTDIR\shortcut\Midi Music Player HTA.lnk" '"$SYS_DIR\mshta.exe"' '"$INSTDIR\midiload.hta"' "$INSTDIR\icons\mmp.ico" 0 "" "" "$(SHORTCUT_HTA)"
CreateShortcut "$INSTDIR\shortcut\Time Chaser Mp3 HTA.lnk" '"$SYS_DIR\mshta.exe"' '"$INSTDIR\tchaser.hta"' "$INSTDIR\icons\tchaser.ico" 0 "" "" "$(SHORTCUT_HTA)"
${EndIf}
CreateShortcut "$(SHORTCUT_WELCOME)" "$INSTDIR\indexxx.htm" "" "" 0 "" "" "$(SHORTCUT_WELCOME_PAGE)"
CreateShortcut "$SMPROGRAMS\$ICONS_GROUP\Tom’s Image Gallery.lnk" "$INSTDIR\TIG.exe" "" "" 0 "" "" "$(SHORTCUT_START_PAGE)"
SetOutPath "$INSTDIR\help"
${If} $HELP == ""
CreateShortcut "$(SHORTCUT_README)" "$INSTDIR\help\readme.htm" "" "" 0 "" "" ""
${Else}
CreateShortcut "$INSTDIR\shortcut\Help.lnk" "$INSTDIR\help\tigh.chm" "" "" 0 "" "" "$(SHORTCUT_HELP_CONTEXT)"
${EndIf}
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section -Post
Call WriteJnlp
Call UpdateShellVarContext
${If} $REM != "firsttime"
${OrIf} $REM == "keepcopy"
${AndIf} $UNINSTSTR == "$INSTDIR\bin\${uninstx}"
StrCpy $R1 "match" # ; paths are a match
${If} $ICONS_PATH == $ICONS_GROUP
# ${AndIf} $LANG == $LANGUAGE ; language selection must be enabled to re-install in a different language
StrCpy $R2 "match" # ; old & new icons folder & languages
${EndIf}
${EndIf}
${If} $R1 == "match"
${AndIf} $R2 != "match"
${AndIf} $ICONS_PATH != ""
${DirState} "$SMPROGRAMS\$ICONS_PATH" $R0
${If} $R0 > 0
Delete "$SMPROGRAMS\$ICONS_PATH\*.lnk"
${AndIf} $R0 >= 0
RMDir "$SMPROGRAMS\$ICONS_PATH"
${EndIf}
${EndIf}
StrCmp $ACCOUNT "0" user
Call SystemDirsInit
StrCpy ${TEMP1} "$SYS_DIR\Macromed\Flash\FlashPlayerTrust" #
Call FlashTrust
${If} $WIN_V == 6
StrCpy $R0 " (ice)" # ; admin copy -> Add/Remove Programs
${Else}
StrCpy $R0 "" #
${EndIf}
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "TimeStamp" $TIME
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "DisplayName" "Tom’s Image Gallery$R0"
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\${uninstx}"
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "DeskTopIcon" $DESK
WriteRegExpandStr HKLM ${PRODUCT_UNINST_KEY} "App Path" $INSTDIR
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "SubFolder" $PAR_NUM
WriteRegExpandStr HKLM ${PRODUCT_UNINST_KEY} "UninstallString" "$INSTDIR\bin\${uninstx}"
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "DisplayVersion" ${PRODUCT_VERSION}
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "URLInfoAbout" ${PRODUCT_WEB_SITE}
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "Publisher" ${PRODUCT_PUBLISHER}
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "StartMenuDir" $ICONS_GROUP
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "Language" $LANGUAGE
WriteRegStr HKLM ${PRODUCT_UNINST_KEY} "InstallType" $ACCOUNT
WriteRegDword HKLM ${PRODUCT_UNINST_KEY} "NoModify" "00000001"
WriteRegDword HKLM ${PRODUCT_UNINST_KEY} "NoRepair" "00000001"
Goto uninst_write
user:
${If} $APPDATA != ""
StrCpy $APP_DATA $APPDATA #
${Else} ; as may be the case on really old Windows
ReadRegStr $APP_DATA HKCU "${APP_DATA_KEY}" "App Data"
ClearErrors
${EndIf}
${If} $APP_DATA != ""
StrCpy ${TEMP1} "$APP_DATA\Macromedia\Flash Player\#Security\FlashPlayerTrust" #
Call FlashTrust
${EndIf}
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "TimeStamp" $TIME
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "DisplayName" "Tom’s Image Gallery"
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\${uninstx}"
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "DeskTopIcon" $DESK
WriteRegExpandStr HKCU ${PRODUCT_UNINST_KEY} "App Path" $INSTDIR
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "SubFolder" $PAR_NUM
WriteRegExpandStr HKCU ${PRODUCT_UNINST_KEY} "UninstallString" "$INSTDIR\bin\${uninstx}"
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "DisplayVersion" ${PRODUCT_VERSION}
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "URLInfoAbout" ${PRODUCT_WEB_SITE}
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "Publisher" ${PRODUCT_PUBLISHER}
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "StartMenuDir" $ICONS_GROUP
WriteRegStr HKCU ${PRODUCT_UNINST_KEY} "Language" $LANGUAGE
WriteRegDword HKCU ${PRODUCT_UNINST_KEY} "NoModify" "00000001"
WriteRegDword HKCU ${PRODUCT_UNINST_KEY} "NoRepair" "00000001"
uninst_write:
; "uninst.exe" (ansi) <> "uuninst.exe" (unicode)
DetailPrint "$(DETAIL_DATA)"
SetOutPath "$INSTDIR\bin"
WriteUninstaller "$INSTDIR\bin\${uninstx}"
ClearErrors
${GetUser} $MY_PROFILE
${If} $WIN_V >= ${V} ; ************ see !define V
${AndIf} ${FileExists} "$INSTDIR\bin\${uninstx}"
FileOpen $0 "$INSTDIR\bin\${uninstx}" a
IfErrors stop
FileSeek $0 0 END
FileWrite $0 "31904101:$INSTDIR;$DESK;$LANGUAGE;$ICONS_GROUP;$PAR_NUM;$TIME;$MY_PROFILE;$ACCOUNT;${V}"
FileClose $0
stop:
ClearErrors
${EndIf}
; real size
ClearErrors
${GetSizeOnDisk} "$INSTDIR\bin" "/M=${uninstx} /S=0B /G=0" "" $4 $1 $2 $3 ; get size - uninstaller
${If} ${Errors}
SetErrors
${EndIf}
${GetSizeOnDisk} "$INSTDIR\shortcut" "/M=*.lnk /S=0B /G=0" "" $5 $1 $2 $3 ; get size - shortcuts
${If} ${Errors}
SetErrors
${EndIf}
${GetSizeOnDisk} "$INSTDIR" "/M=jtssjar.jnlp /S=0B /G=0" "" $6 $1 $2 $3 ; get size - java file
${If} ${Errors}
SetErrors
${EndIf}
; subtract estimated size
StrCpy $0 $BYTE_SIZE #
${IfNot} ${Errors}
StrCpy ${TEMP1} ${S_SCF} # ; 7 (default)
; Shortcuts
; 98 SE and before
${If} $WIN_BUILD <= 2222
${OrIf} $WIN_BUILD == 3000 ; ME
${AndIf} $WIN_BUILD != 2195 ; 2000 Pro
IntOp ${TEMP1} ${TEMP1} + ${S_SC98}
${EndIf}
; Shortcuts
; 2000 at least, Server 2003 at most
${If} $WIN_BUILD >= 2195 ; 2000 Pro, XP
${AndIf} $WIN_BUILD <= 3790 ; Server 2003, XP Pro x64
${AndIf} $WIN_BUILD != 3000 ; ME
${AndIf} $WIN_BUILD != 2222 ; 98 SE
IntOp ${TEMP1} ${TEMP1} + ${S_SCXP}
${EndIf}
; Shortcuts
; Vista at least, Server 2008 at most
${If} $WIN_BUILD >= 6000 ; Vista+
${AndIf} $WIN_BUILD <= 7601 ; 7, Server 2008 R2
IntOp ${TEMP1} ${TEMP1} + ${S_SCV}
${EndIf}
; Shortcuts
; 8 at least, Server 2012 at most
${If} $WIN_BUILD >= 9200 ; 8, Server 2012
${AndIf} $WIN_BUILD <= 9600 ; 8.1, Server 2012 R2
IntOp ${TEMP1} ${TEMP1} + ${S_SC8}
${EndIf}
${If} $WIN_BUILD >= 10240 ; 10+
IntOp ${TEMP1} ${TEMP1} + ${S_SC10}
${EndIf}
IntOp $0 $0 - ${TEMP1} ; shortcuts
IntOp $0 $0 - ${S_JNLP} ; java
!ifdef UNICODE
StrCpy ${TEMP2} ${S_W} # ; unicode uninstaller
!else
StrCpy ${TEMP2} ${S_A} # ; ansi uninstaller
!endif
IntOp $0 $0 - ${TEMP2}
; add real size
IntOp $0 $0 + $4
IntOp $0 $0 + $5
IntOp $0 $0 + $6
${EndIf}
ClearErrors
; bytes to kilobytes
IntOp $1 $0 % 1024
IntOp $0 $0 / 1024 ; rounded down
IntCmp $1 512 0 +2 0
IntOp $0 $0 + 1 ; rounded up
Push $0
Call Separator
Pop $7
${If} ${FileExists} "$INSTDIR\aforest\size.js"
IntOp $1 ${T_0} - 2
IntOp $2 ${A_0} - 1
IntOp $3 $1 + $2
StrCpy $8 "$3 pages. $2 pages" #
FileOpen $9 "$INSTDIR\aforest\size.js" w
IfErrors break
FileWrite $9 "var obookpages = '$8';$\r$\nvar tigsetup = '${F_FILES} files ${D_FOLDERS} folders $7 Kb';"
FileClose $9
break:
ClearErrors
${EndIf}
# DetailPrint "$BYTE_SIZE - ${TEMP1} - ${S_JNLP} - ${TEMP2} + $5 + $6 + $4" ; check the sum
${If} $LANGUAGE == 1031
DetailPrint "${F_FILES} Dateien | ${D_FOLDERS} Ordner | $7 Kb"
${Else}
DetailPrint "${F_FILES} files | ${D_FOLDERS} folders | $7 Kb"
${EndIf}
ClearErrors
IntFmt $0 "0x%08X" $0
StrCmp $ACCOUNT "0" +3
WriteRegDword HKLM ${PRODUCT_UNINST_KEY} "EstimatedSize" $0
Goto finito
WriteRegDword HKCU ${PRODUCT_UNINST_KEY} "EstimatedSize" $0
finito:
${GetTime} "/F" $7
DetailPrint $7
SectionEnd
Function un.UpdateShellVarContext
${If} $X_ACCOUNT == 1
SetShellVarContext all
${Else}
SetShellVarContext current
${EndIf}
FunctionEnd
Function un.SystemDirsInit
${If} ${RunningX64}
StrCpy $SYS_DIR "$WINDIR\SysWOW64" #
StrCpy $SYS__DIR "$WINDIR\System32" #
${Else}
StrCpy $SYS_DIR "$SYSDIR" #
${EndIf}
FunctionEnd
Function un.subfolders_remove
; parent folders have to be completely empty
${If} $PAR_NUM != 0
${AndIf} $PAR_NUM != ""
${GetParent} $R0 $R0
RMDir $R0
IntOp $PAR_NUM $PAR_NUM - 1
call un.subfolders_remove
${EndIf}
FunctionEnd
Section Uninstall
SetAutoClose false
SetDetailsView show
Call un.UpdateShellVarContext
${If} $XXX == 1
${AndIf} $DESK != 0
Delete "$DESKTOP\$DTI.lnk"
${EndIf}
${If} $ICONS_GROUP != ""
${DirState} "$SMPROGRAMS\$ICONS_GROUP" $R0
${If} $R0 > 0
Delete "$SMPROGRAMS\$ICONS_GROUP\*.lnk"
${AndIf} $R0 >= 0
RMDir "$SMPROGRAMS\$ICONS_GROUP"
${EndIf}
${EndIf}
Delete "$INSTDIR\*.*"
${If} $SPAWN != "/U"
Delete "$INSTDIR\bin\${uninstx}"
${EndIf}
RMDir /r "$INSTDIR\acrohome"
RMDir /r "$INSTDIR\acroice"
RMDir /r "$INSTDIR\aforest"
RMDir /r "$INSTDIR\bigpix"
${If} $SPAWN != "/U"
RMDir /r "$INSTDIR\bin"
${EndIf}
RMDir /r "$INSTDIR\buttons"
RMDir /r "$INSTDIR\clas1"
RMDir /r "$INSTDIR\css"
RMDir /r "$INSTDIR\flash"
RMDir /r "$INSTDIR\graphics"
RMDir /r "$INSTDIR\jazz1"
RMDir /r "$INSTDIR\javacert"
RMDir /r "$INSTDIR\help"
RMDir /r "$INSTDIR\icons"
RMDir /r "$INSTDIR\js"
RMDir /r "$INSTDIR\menu"
RMDir /r "$INSTDIR\midi"
RMDir /r "$INSTDIR\mp3"
RMDir /r "$INSTDIR\pix"
RMDir /r "$INSTDIR\rock1"
RMDir /r "$INSTDIR\shortcut"
RMDir /r "$INSTDIR\thumbs"
${If} $SPAWN != "/U"
RMDir $INSTDIR
${IfNot} ${FileExists} "$INSTDIR\*.*"
StrCpy $R0 $INSTDIR #
Call un.subfolders_remove
${EndIf}
${EndIf}
${If} $X_ACCOUNT == "1"
Call un.SystemDirsInit
StrCpy ${TEMP1} "$SYS_DIR\Macromed\Flash\FlashPlayerTrust" #
Delete "${TEMP1}\tig$TIME"
Delete "${TEMP1}\tig"
RMDir ${TEMP1}
${If} ${RunningX64}
${AndIf} $WIN_BUILD >= 6000 ; Vista+
${DisableX64FSRedirection}
StrCpy $R1 "$SYS__DIR\Macromed\Flash\FlashPlayerTrust" #
IfFileExists "$R1" 0 +4
Delete "$R1\tig$TIME"
Delete "$R1\tig"
RMDir $R1
${EnableX64FSRedirection}
${EndIF}
${If} $XXX == "1"
DeleteRegKey HKLM ${PRODUCT_UNINST_KEY}
${EndIf}
${Else}
SetShellVarContext current
${If} $APPDATA != ""
StrCpy $APP_DATA $APPDATA #
${Else}
ReadRegStr $APP_DATA HKCU "${APP_DATA_KEY}" "App Data"
ClearErrors
${EndIf}
${If} $APP_DATA != ""
StrCpy ${TEMP1} "$APP_DATA\Macromedia\Flash Player\#Security\FlashPlayerTrust" #
Delete "${TEMP1}\tig$TIME"
Delete "${TEMP1}\tig"
RMDir ${TEMP1}
RMDir "$APP_DATA\Macromedia\Flash Player\#Security"
RMDir "$APP_DATA\Macromedia\Flash Player"
RMDir "$APP_DATA\Macromedia"
${EndIf}
${If} $XXX == 1
DeleteRegKey HKCU ${PRODUCT_UNINST_KEY}
${EndIf}
${EndIf}
Call un.remove_failed
SectionEnd
################################### unTIGbanner.nsh ####################################
; Tom’s Image Gallery 2.1 Setup Uninstall (banner) include (TN)
;--------------------------------
; Banner.dll plugin
ReserveFile /plugin "Banner.dll"
Function reinst_uninstall
StrCmp $REM "keepcopy" done
${If} $LM_PREV_INST == "Y"
SetShellVarContext all
ReadRegStr $DESK HKLM ${PRODUCT_UNINST_KEY} "DeskTopIcon"
ReadRegStr $TIME HKLM ${PRODUCT_UNINST_KEY} "TimeStamp"
Call SystemDirsInit
StrCpy ${TEMP1} "$SYS_DIR\Macromed\Flash\FlashPlayerTrust" #
Delete "${TEMP1}\tig$TIME"
Delete "${TEMP1}\tig"
RMDir ${TEMP1}
${If} ${RunningX64}
${AndIf} $WIN_BUILD >= 6000 ; Vista+
${DisableX64FSRedirection}
StrCpy $R1 "$SYS__DIR\Macromed\Flash\FlashPlayerTrust" #
IfFileExists "$R1" 0 +4
Delete "$R1\tig$TIME"
Delete "$R1\tig"
RMDir $R1
${EnableX64FSRedirection}
${EndIF}
DeleteRegKey HKLM ${PRODUCT_UNINST_KEY}
${If} $DESK == 1
Delete "$DESKTOP\$DTI.lnk"
${EndIf}
Delete "$SMPROGRAMS\$ICONS_PATH\*.lnk"
RMDir /r "$SMPROGRAMS\$ICONS_PATH"
${Else}
SetShellVarContext current
ReadRegStr $DESK HKCU ${PRODUCT_UNINST_KEY} "DeskTopIcon"
ReadRegStr $TIME HKCU ${PRODUCT_UNINST_KEY} "TimeStamp"
${If} $APPDATA != ""
StrCpy $APP_DATA $APPDATA #
${Else}
ReadRegStr $APP_DATA HKCU "${APP_DATA_KEY}" "App Data"
ClearErrors
${EndIf}
${If} $APP_DATA != ""
StrCpy ${TEMP1} "$APP_DATA\Macromedia\Flash Player\#Security\FlashPlayerTrust" #
Delete "${TEMP1}\tig$TIME"
Delete "${TEMP1}\tig"
RMDir ${TEMP1}
RMDir "$APP_DATA\Macromedia\Flash Player\#Security"
RMDir "$APP_DATA\Macromedia\Flash Player"
RMDir "$APP_DATA\Macromedia"
DeleteRegKey HKCU ${PRODUCT_UNINST_KEY}
${EndIf}
${If} $DESK == 1
Delete "$DESKTOP\T I G.lnk"
${EndIf}
Delete "$SMPROGRAMS\$ICONS_PATH\*.lnk"
RMDir /r "$SMPROGRAMS\$ICONS_PATH"
${EndIf}
Banner::show /NOUNLOAD /set 76 "$(MESSAGE_BANNER_WAIT)" ""
Banner::getWindow /NOUNLOAD ; contains the handle to the dialog window
Pop $R1
GetDlgItem $R2 $R1 1030
Call UpdateShellVarContext
Delete "$PATH\acrohome\*.*"
Delete "$PATH\acroice\*.*"
Delete "$PATH\aforest\*.*"
Delete "$PATH\bigpix\*.*"
Delete "$PATH\bin\*.*"
Delete "$PATH\buttons\*.*"
Delete "$PATH\clas1\*.*"
Delete "$PATH\css\*.*"
Delete "$PATH\flash\*.*"
Delete "$PATH\graphics\*.*"
Delete "$PATH\help\*.*"
Delete "$PATH\icons\*.*"
Delete "$PATH\jazz1\*.*"
Delete "$PATH\javacert\*.*"
Delete "$PATH\js\*.*"
Delete "$PATH\menu\*.*"
Delete "$PATH\midi\*.*"
Delete "$PATH\mp3\*.*"
Delete "$PATH\pix\*.*"
Delete "$PATH\rock1\*.*"
Delete "$PATH\shortcut\*.*"
Delete "$PATH\thumbs\*.*"
Delete "$PATH\*.*"
RMDir /r "$PATH\acrohome"
RMDir /r "$PATH\acroice"
RMDir /r "$PATH\aforest"
RMDir /r "$PATH\bigpix"
RMDir /r "$PATH\bin"
RMDir /r "$PATH\buttons"
RMDir /r "$PATH\clas1"
RMDir /r "$PATH\css"
RMDir /r "$PATH\flash"
RMDir /r "$PATH\graphics"
RMDir /r "$PATH\help"
RMDir /r "$PATH\icons"
RMDir /r "$PATH\jazz1"
RMDir /r "$PATH\javacert"
RMDir /r "$PATH\js"
RMDir /r "$PATH\menu"
RMDir /r "$PATH\midi"
RMDir /r "$PATH\mp3"
RMDir /r "$PATH\pix"
RMDir /r "$PATH\rock1"
RMDir /r "$PATH\shortcut"
RMDir /r "$PATH\thumbs"
RMDir $PATH
StrCmp $PAR_NUM "" endloop
StrCpy $R0 $PATH #
StrCpy $R3 $PAR_NUM #
IfFileExists "$R0\*.*" endloop
subfolders_remove:
StrCmp $R3 0 endloop
${GetParent} $R0 $R0
RMDir $R0
IntOp $R3 $R3 - 1
Goto subfolders_remove
endloop:
${DirState} $PATH $R3
Sleep 1200
SendMessage $R2 ${WM_SETTEXT} 0 "STR:$(MESSAGE_BANNER_REMOVE_DONE)"
Sleep 1200
ShowWindow $R1 ${SW_HIDE} ; hide the dialog window
Sleep 200
IntCmp $R3 0 leave leave 0
MessageBox MB_ICONEXCLAMATION|MB_OKCANCEL "$(MESSAGE_BANNER_REMOVE_FAIL)" /SD IDOK IDOK +4 IDCANCEL 0
Sleep 500
Banner::destroy
Quit
Sleep 500
leave:
Banner::destroy
StrCpy $REM "banner" #
StrCpy $INSTDIR $PATH #
StrCpy $ICONS_GROUP $ICONS_PATH #
done:
FunctionEnd
#################################### unTIGsetup.nsh ####################################
; Tom’s Image Gallery 2.1 Setup Uninstall include (TN)
; Creates a smaller uninstaller than the full version that includes a welcome and finish
; page does
;--------------------------------
; Initialize
!define MUI_CUSTOMFUNCTION_UNGUIINIT un.onGUIInit_func
; Splash unpage
UninstPage custom un.nsDialogsSplash ""
; Confirm unpage
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.confirm
!insertmacro MUI_UNPAGE_CONFIRM
; Instfiles unpage
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
; Functions
Function un.spawn_abort
${If} $SPAWN == "/U"
Abort
${EndIf}
FunctionEnd
; Splash UnPage
Function un.nsDialogsSplash
Call un.spawn_abort
StrCmp $SPAWN "\U" +2
File "/oname=$PLUGINSDIR\splash.bmp" "${LOCAL}tigwsu2.bmp" ; (261 KB | 900px x 432px)
!insertmacro MUI_HEADER_TEXT "$(TEXT_HELLO_TITLE)" "$(TEXT_HELLO_SUBTITLE)"
nsDialogs::Create 1018
Pop $DIALOG
${NSD_CreateBitmap} 0u 6u 300u 134u ""
Pop $IMAGECTL
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE} ; center image and crop to fit
${NSD_SetImage} $IMAGECTL "$PLUGINSDIR\splash.bmp" $IMAGE
SetCtlColors $DIALOG "" transparent
SetCtlColors $IMAGECTL "" transparent
nsDialogs::Show
${NSD_FreeImage} $IMAGE
FunctionEnd
; Confirm UnPage
Function un.confirm
StrCmp $SPAWN "/U" 0 done
GetDlgItem $3 $HWNDPARENT 3 ; Back button
LockWindow on
ShowWindow $3 ${SW_HIDE} ; hide 'Back'
LockWindow off
done:
FunctionEnd
Function un.remove_failed
StrCpy $R2 "" # ; clear list
StrCpy $R3 0 # ; set count
${If} ${FileExists} "$INSTDIR\*.*"
ClearErrors
Sleep 500 ; wait before ${Locate}
${Locate} $INSTDIR "/L=F" "un.populate_list"
ClearErrors
${If} $R3 > 0
DetailPrint "---------------------------"
IntCmp $R3 1 0 0 +3
DetailPrint " $(DETAIL_REMOVED)"
Goto +2
DetailPrint " $(DETAIL_REMOVED_S)"
DetailPrint "###########################"
DetailPrint ""
${Endif}
${EndIf}
FunctionEnd
Function un.populate_list ; files that were not removed
ClearErrors
StrCpy $R1 $R9 # ; Locate returns R9
StrCmp $R1 "$INSTDIR\bin\${uninstx}" end ; exclude uninstaller
SetDetailsPrint listonly
StrCmp $R3 0 0 +5
DetailPrint ""
DetailPrint "###########################"
DetailPrint "$(DETAIL_ERRORS)"
DetailPrint "---------------------------"
DetailPrint $R1
SetDetailsPrint textonly
IntOp $R3 $R3 + 1
end:
Push $0
FunctionEnd
Function un.ReadEasterEgg
; arguments
Exch $R1 ; easter egg magic value
; locals
Push $1 ; file name or (later) file handle
Push $2 ; current trial offset
Push $3 ; current trial string (which will match R1 when easter egg is found)
Push $4 ; length of $R1
FileOpen $1 "$INSTDIR\${uninstx}" r
; change 512 here to, e.g., 2048 to scan the last 2Kb of EXE file
IntOp $2 0 - 512
StrLen $4 $R1
loop:
FileSeek $1 $2 END
FileRead $1 $3 $4
StrCmp $3 $R1 found
IntOp $2 $2 + 1
IntCmp $2 0 loop loop
StrCpy $R1 ""
goto fin
found:
IntOp $2 $2 + $4
FileSeek $1 $2 END
FileRead $1 $3
StrCpy $R1 $3
fin:
FileClose $1
Pop $4
Pop $3
Pop $2
Pop $1
Exch $R1
FunctionEnd
Function un.trim
${StrStrRight} $1 ";" $3
StrLen $2 $3
IntOp $2 $2 + 1
StrCpy $1 $1 -$2
FunctionEnd
Function un.ParseEasterEgg
Push "31904101:"
Call un.ReadEasterEgg
Pop $1
Call un.trim
StrCpy $XXX $3 #
Call un.trim
StrCpy $X_ACCOUNT $3 #
Call un.trim
StrCpy $X_PROFILE $3 #
Call un.trim
StrCpy $TIME $3 #
Call un.trim
StrCpy $PAR_NUM $3 #
Call un.trim
StrCpy $ICONS_GROUP $3 #
Call un.trim
StrCpy $LANGUAGE $3 #
Call un.trim
StrCpy $DESK $3 #
Call un.trim
StrCpy $PATH $3 #
; MessageBox MB_OK "Easter data: $XXX $X_ACCOUNT $X_PROFILE $TIME $PAR_NUM $ICONS_GROUP $LANGUAGE $DESK $PATH"
FunctionEnd
Function un.onInit
!if ${NSIS_PACKEDVERSION} >= 0x03008000
GetWinVer $WIN_BUILD Build ; > NSIS 3.07
!else
GetDllVersion "$SysDir\KERNEL32.DLL" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $WIN_BUILD $R4
!endif
; Scale interface
!insertmacro DPI_INIT
; Re-locate temp folder
!ifdef PLUGINSDIR_APPDATA
${If} ${SysDllAtLeastWinXPSP2}
GetTempFileName $0
${StrStrRight} $0 "\" $0
StrCpy $0 $0 -4 #
UnsafeStrCpy $pluginsdir "$localappdata\${uninst}$0"
CreateDirectory $pluginsdir
${EndIf}
!endif
StrCpy $SPAWN $CMDLINE "" -2
StrCpy $WIN_V 0 #
${If} $WIN_BUILD >= 6000 ; Vista+
StrCpy $WIN_V 5 #
${EndIf}
; Accounts and Versions
UserInfo::GetAccountType
Pop $R0
${Select} $R0
${Case2} "Admin" "Power"
StrCpy $ACCOUNT 1 #
${Case} "User"
StrCpy $ACCOUNT 0 #
${CaseElse}
StrCpy $WIN_V "N" #
${EndSelect}
${If} $WIN_V == 5
${AndIf} $ACCOUNT == 1
StrCpy $WIN_V 6 #
StrCpy $ACCOUNT 2 #
${EndIf}
StrCmp $WIN_V "N" abort
IntCmp $ACCOUNT 1 reg_test_admin reg_test_user reg_test_admin
; Registry Access
reg_test_user:
ReadRegStr $PATH HKCU ${PRODUCT_UNINST_KEY} "App Path"
IfErrors exe_read
IfFileExists "$PATH\*.*" 0 exe_read
ReadRegStr $UNINSTSTR HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
IfErrors exe_read
StrCpy $UNINST "$INSTDIR\${uninstx}" #
StrCmp $UNINST $UNINSTSTR reg_read_user exe_read
reg_test_admin:
ReadRegStr $PATH HKLM ${PRODUCT_UNINST_KEY} "App Path"
IfErrors redirect
IfFileExists "$PATH\*.*" 0 redirect
ReadRegStr $UNINSTSTR HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
IfErrors redirect continue
redirect:
ClearErrors
StrCmp $WIN_V 0 exe_read reg_test_user
continue:
StrCpy $UNINST "$INSTDIR\${uninstx}" #
StrCmp $UNINST $UNINSTSTR reg_read_admin
StrCmp $WIN_V 0 exe_read reg_test_user
; Read Registry
reg_read_user:
ClearErrors
ReadRegStr $LANG HKCU ${PRODUCT_UNINST_KEY} "Language"
StrCpy $LANGUAGE $LANG #
ReadRegStr $INSTDIR HKCU ${PRODUCT_UNINST_KEY} "App Path"
ReadRegStr $DESK HKCU ${PRODUCT_UNINST_KEY} "DeskTopIcon"
ReadRegStr $TIME HKCU ${PRODUCT_UNINST_KEY} "TimeStamp"
ReadRegStr $PAR_NUM HKCU ${PRODUCT_UNINST_KEY} "SubFolder"
ReadRegStr $ICONS_GROUP HKCU ${PRODUCT_UNINST_KEY} "StartMenuDir"
StrCpy $DTI "T I G" #
StrCpy $X_ACCOUNT 0 #
StrCpy $ACCOUNT 0 #
StrCpy $XXX 1 #
Goto plug
reg_read_admin:
ClearErrors
ReadRegStr $LANG HKLM ${PRODUCT_UNINST_KEY} "Language"
StrCpy $LANGUAGE $LANG #
ReadRegStr $INSTDIR HKLM ${PRODUCT_UNINST_KEY} "App Path"
ReadRegStr $DESK HKLM ${PRODUCT_UNINST_KEY} "DeskTopIcon"
ReadRegStr $TIME HKLM ${PRODUCT_UNINST_KEY} "TimeStamp"
ReadRegStr $PAR_NUM HKLM ${PRODUCT_UNINST_KEY} "SubFolder"
ReadRegStr $ICONS_GROUP HKLM ${PRODUCT_UNINST_KEY} "StartMenuDir"
ReadRegStr $X_ACCOUNT HKLM ${PRODUCT_UNINST_KEY} "InstallType"
${If} $X_ACCOUNT == 1
StrCpy $DTI "T.I.G." #
${Else}
StrCpy $DTI "T I G" #
${EndIf}
StrCpy $ACCOUNT 1 #
StrCpy $XXX 1 #
Goto plug
exe_read: ; self-uninstall option - read string in file
ClearErrors
${GetUser} $MY_PROFILE
Call un.ParseEasterEgg
IfErrors abort
IfFileExists "$PATH\*.*" 0 abort
StrCpy $INSTDIR $PATH #
${If} $ACCOUNT == 2
StrCpy $ACCOUNT $X_ACCOUNT #
${EndIf}
; ACCOUNT 1 | X_ACCOUNT 1 | goto plug
; ACCOUNT 1 | X_ACCOUNT 0 | $X_PROFILE = $MY_PROFILE | goto plug
; ACCOUNT 1 | X_ACCOUNT 0 | $X_PROFILE ! $MY_PROFILE | goto abort (USER message)
; ACCOUNT 0 | X_ACCOUNT 1 | goto abort (UAC message)
; ACCOUNT 0 | X_ACCOUNT 0 | $X_PROFILE = $MY_PROFILE | goto plug
; ACCOUNT 0 | X_ACCOUNT 0 | $X_PROFILE ! $MY_PROFILE | goto abort (USER message)
StrCmp $ACCOUNT 0 uac
ReadRegStr $R0 HKLM ${PRODUCT_UNINST_KEY} "App Path"
${If} $R0 == $INSTDIR
StrCpy $DTI "T.I.G." #
StrCpy $XXX 1 # ; remove desktop icon + registry entries
${EndIf}
StrCmp $X_ACCOUNT 1 plug profile
uac:
ReadRegStr $R0 HKCU ${PRODUCT_UNINST_KEY} "App Path"
${If} $R0 == $INSTDIR
StrCpy $DTI "T I G" #
StrCpy $XXX 1 # ; remove desktop icon + registry entries
${EndIf}
StrCmp $X_ACCOUNT 0 profile
StrCpy $R2 "uac" #
Goto abort
profile:
StrCmp $X_PROFILE "" abort
StrCmp $X_PROFILE $MY_PROFILE plug
StrCpy $R2 "profile" #
Goto abort
; Temporary Folder
plug:
!ifdef PLUGINSDIR_APPDATA
${IfNot} ${SysDllAtLeastWinXPSP2}
InitPluginsDir
${EndIf}
!else
InitPluginsDir
!endif
SetOutPath "$PLUGINSDIR"
ReserveFile /plugin "nsDialogs.dll"
ReserveFile /plugin "System.dll"
ReserveFile /plugin "UserInfo.dll"
ReserveFile /plugin "SysCompImg.dll"
ReserveFile "${ARTWORK}96\tighUN.bmp"
ReserveFile "${LOCAL}tigwsu2.bmp"
SetOutPath "$TEMP"
Goto done
abort:
ClearErrors
${If} $SPAWN != "/U"
Call un.onUnInstFailed
${EndIf}
done:
FunctionEnd
!macro BMPX2_ DPI UN _
; if condition A or B or C or D
; A
#${If} $WIN_BUILD < 48001
; B
#${If} $WIN_BUILD < 14393 ; Windows 10 1607 release (December 2015)
; C
#${IfNot} ${SysDllAtLeastWin8SP0} ; Windows 8 (August 2012)
; D
${If} $UseLightTheme == "1"
StrCpy $DPI_SCALE "custom" #
${EndIf}
StrCmp $DPI_SCALE "custom" +2
!insertmacro BMPX2 ${DPI} "UN" ""
!macroend
!macro BMPX2 DPI UN _
!ifdef LITE
!define /ReDef _ "_"
StrCpy $DPI_SCALE "custom" #
!endif
; High DPI header
File "/oname=$PluginsDir\modern-header.bmp" "${ARTWORK}${DPI}\tigh${UN}${_}.bmp"
!macroend
Function un.StandardDPI2
; Standard images (24-bit uncompressed)
${If} $SYS_DPI == 192
${OrIf} $SYS_DPI == 168
${OrIf} $SYS_DPI == 144
${OrIf} $SYS_DPI == 120
StrCpy $DPI_SCALE "standard" #
${If} $SYS_DPI == 192
!insertmacro BMPX2_ 192 "UN" ""
${ElseIf} $SYS_DPI == 168
!insertmacro BMPX2_ 168 "UN" ""
${ElseIf} $SYS_DPI == 144
!insertmacro BMPX2_ 144 "UN" ""
${ElseIf} $SYS_DPI == 120
!insertmacro BMPX2_ 120 "UN" ""
${EndIf}
${EndIf}
FunctionEnd
Function un.CustomDPI2
; Custom images (rle compressed)
${If} $SYS_DPI > 96
${AndIf} $DPI_SCALE != "standard"
StrCpy $DPI_SCALE "custom" #
${If} $SYS_DPI >= 192
!insertmacro BMPX2 192 "UN" "_"
${ElseIf} $SYS_DPI >= 168
!insertmacro BMPX2 168 "UN" "_"
${ElseIf} $SYS_DPI >= 144
!insertmacro BMPX2 144 "UN" "_"
${ElseIf} $SYS_DPI >= 120
!insertmacro BMPX2 120 "UN" "_"
${EndIf}
${EndIf}
FunctionEnd
!macro DPI_MUI_LOAD2 UN unin
!define /IfNDef PATH "$PLUGINSDIR\modern-header.bmp"
${If} $DPI_AWARE == 1
${AndIf} $SYS_DPI > 96
Call ${unin}StandardDPI2
Call ${unin}CustomDPI2
SysCompImg::SetCustom "$PluginsDir\modern-header.bmp"
!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDVERTICALCENTERIMAGE ; vertically center, no stretch, no crop
${EndIf}
!macroend
Function un.onGUIInit_func
ReadRegDWORD $UseLightTheme HKCU "Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" "AppsUseLightTheme"
StrCmp $UseLightTheme "" 0 +2
StrCpy $UseLightTheme 1 ; Default
StrCmp $UseLightTheme "0" 0 +5
System::Call 'DWMAPI::DwmSetWindowAttribute(p$hWndParent,i20,*i1,i4)i.r0' ; 20H1
IntCmp $0 0 +3 +3
System::Call 'DWMAPI::DwmSetWindowAttribute(p$hWndParent,i19,*i1,i4)i.r0' ; 19H1
System::Call 'USER32::SetProp(p$hWndParent,t"UseImmersiveDarkModeColors",i1)' ; 1809
!insertmacro DPI_MUI_LOAD2 "UN" "un."
; Header (colors)
GetDlgItem $R0 $HWNDPARENT 1038
SetCtlColors $R0 0x4f5235 0xfffff2
GetDlgItem $R0 $HWNDPARENT 1037
SetCtlColors $R0 0x4f5235 0xfffff2
; Header (title font)
CreateFont $R1 "Verdana" 10 700
SendMessage $R0 ${WM_SETFONT} $R1 0
GetDlgItem $R0 $HWNDPARENT 1028
SendMessage $R0 ${WM_SETTEXT} 1 "STR:"
GetDlgItem $R0 $HWNDPARENT 1256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:"
GetDlgItem $R0 $HWNDPARENT 2256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:Tom’s Image Gallery"
GetDlgItem $R0 $HWNDPARENT 3256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:${PRODUCT_COPYRIGHT}"
# ; continue
# ${If} $SPAWN != "/U"
# Call un.onUnInstContinue
# ${EndIf}
FunctionEnd
#; Pre-Uninstall
#Function un.onUnInstContinue
# MessageBox MB_USERICON|MB_YESNO|MB_DEFBUTTON2 "$(MESSAGE_REMOVE)" /SD IDYES IDYES +2
# Abort
#FunctionEnd
; Post-Uninstall
Function un.onUnInstFailed
${If} $R2 == "profile"
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT_PROFILE)" /SD IDOK IDOK quit
${ElseIf} $R2 == "uac"
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT_UAC)" /SD IDOK IDOK quit
${ElseIf} $WIN_V == "N"
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT_N)" /SD IDOK IDOK quit
${Else}
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT)" /SD IDOK IDOK quit
${EndIf}
quit:
Quit
FunctionEnd
#Function un.onUninstSuccess
# ${If} $SPAWN != "/U"
# HideWindow
# MessageBox MB_USERICON|MB_OK "$(MESSAGE_REMOVE_SUCCESS)" /SD IDOK
# ${EndIf}
#FunctionEnd
################################## unTIGsetupFull.nsh ##################################
; Tom’s Image Gallery 2.1 Setup Uninstall (full) include (TN)
;--------------------------------
; Initialize
!define MUI_CUSTOMFUNCTION_UNGUIINIT un.onGUIInit_func
; Welcome unpage
UninstPage custom un.nsDialogsWelcome ""
; Confirm unpage
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.confirm
!insertmacro MUI_UNPAGE_CONFIRM
; Instfiles unpage
!insertmacro MUI_UNPAGE_INSTFILES
; Finish unpage
UninstPage custom un.nsDialogsFinish
;--------------------------------
; Functions
; Welcome UnPage
Function un.nsDialogsWelcome
Call un.spawn_abort
StrCmp $SPAWN "\U" +4
${If} $DPI_SCALE == "none"
File "/oname=$PLUGINSDIR\modern-wizard.bmp" "${ARTWORK}96\tigwUN.bmp"
${EndIf}
Call un.HideControls
nsDialogs::Create 1044
Pop $DIALOG
${IfNot} $DPI_SCALE == "custom"
${NSD_CreateLabel} 110u 11u 109u 16u "$(UNTEXT_INFO_TITLE)"
Pop $LABELCTL_0
${NSD_AddStyle} $LABELCTL_0 ${SS_CENTER}
${NSD_CreateLabel} $UN_W_X_1 11u 102u 16u "$(UNTEXT_WELCOME_TITLE)"
Pop $LABELCTL_1
${Else}
${NSD_CreateLabel} 8u 8u 300u 18u "$(M_UNTEXT_WELCOME_INFO_TITLE)"
Pop $LABELCTL_2
${EndIf}
!insertmacro MakeLabel "-" $UN_W_X_4 $UN_W_Y_4 $UN_W_W_4 $UN_W_H_4
Pop $LABELCTL_4 ; padding layer
!insertmacro MakeLabel "$(M_UNTEXT_WELCOME_INFO_TEXT)" $UN_W_X_5 $UN_W_Y_5 $UN_W_W_5 $UN_W_H_5
Pop $LABELCTL_5
${NSD_CreateBitmap} 0 0 331u 193u ""
Pop $IMAGECTL
${If} $DPI_SCALE == "custom"
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
${EndIf}
!ifdef LITE_PLUS
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
!endif
${NSD_SetImage} $IMAGECTL "$PLUGINSDIR\modern-wizard.bmp" $IMAGE
SetCtlColors $DIALOG "" 0xfffff2
CreateFont $R1 "Verdana" 14 700
SendMessage $LABELCTL_0 ${WM_SETFONT} $R1 0
SendMessage $LABELCTL_1 ${WM_SETFONT} $R1 0
SendMessage $LABELCTL_2 ${WM_SETFONT} $R1 0
${If} $DPI_SCALE == "custom"
SetCtlColors $LABELCTL_1 0x4f5235 transparent
${Else}
SetCtlColors $LABELCTL_1 0x4e556a transparent
${EndIf}
!ifdef LITE_PLUS
SetCtlColors $LABELCTL_1 0x4f5235 transparent
!endif
SetCtlColors $LABELCTL_0 0xfffff2 0x8b595c
SetCtlColors $LABELCTL_2 0x4f5235 transparent
SetCtlColors $LABELCTL_4 0xfffff2 0xfffff2
SetCtlColors $LABELCTL_5 0x4f5235 0xfffff2
SetCtlColors $IMAGECTL "" 0xfffff2
nsDialogs::Show
Call un.ShowControls
${NSD_FreeImage} $IMAGE
FunctionEnd
Function un.spawn_abort
${If} $SPAWN == "/U"
Abort
${EndIf}
FunctionEnd
Function un.HideControls
LockWindow on
GetDlgItem $0 $HWNDPARENT 1028
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1256
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1035
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1037
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1038
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1039
ShowWindow $0 ${SW_HIDE}
GetDlgItem $0 $HWNDPARENT 1045
ShowWindow $0 ${SW_NORMAL}
LockWindow off
FunctionEnd
Function un.ShowControls
LockWindow on
GetDlgItem $0 $HWNDPARENT 1028
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1256
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1035
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1037
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1038
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1039
ShowWindow $0 ${SW_NORMAL}
GetDlgItem $0 $HWNDPARENT 1045
ShowWindow $0 ${SW_HIDE}
LockWindow off
FunctionEnd
; Confirm UnPage
Function un.confirm
StrCmp $SPAWN "/U" 0 done
GetDlgItem $3 $HWNDPARENT 3 ; Back button
LockWindow on
ShowWindow $3 ${SW_HIDE} ; hide 'Back'
LockWindow off
done:
FunctionEnd
Function un.remove_failed
StrCpy $R2 "" # ; clear list
StrCpy $R3 0 # ; set count
${If} ${FileExists} "$INSTDIR\*.*"
ClearErrors
Sleep 500 ; wait before ${Locate}
${Locate} $INSTDIR "/L=F" "un.populate_list"
ClearErrors
${If} $R3 > 0
DetailPrint "---------------------------"
IntCmp $R3 1 0 0 +3
DetailPrint " $(DETAIL_REMOVED)"
Goto +2
DetailPrint " $(DETAIL_REMOVED_S)"
DetailPrint "###########################"
DetailPrint ""
${Endif}
${EndIf}
FunctionEnd
Function un.populate_list ; files that were not removed
ClearErrors
StrCpy $R1 $R9 # ; Locate returns R9
StrCmp $R1 "$INSTDIR\bin\${uninstx}" end ; exclude uninstaller
SetDetailsPrint listonly
StrCmp $R3 0 0 +5
DetailPrint ""
DetailPrint "###########################"
DetailPrint "$(DETAIL_ERRORS)"
DetailPrint "---------------------------"
DetailPrint $R1
SetDetailsPrint textonly
IntOp $R3 $R3 + 1
end:
Push $0
FunctionEnd
; Finish UnPage
Function un.nsDialogsFinish
Call un.spawn_abort
Call un.HideControls
GetDlgItem $R0 $HWNDPARENT 1
${NSD_SetText} $R0 "$(M_BUTTONTEXT_FINISH)"
nsDialogs::Create 1044
Pop $DIALOG
!insertmacro MakeLabel "-" $UN_F_X_4 $UN_F_Y_4 $UN_F_W_4 $UN_F_H_4
Pop $LABELCTL_4 ; padding
!insertmacro MakeLabel "$(M_UNTEXT_FINISH_INFO_TEXT)" $UN_F_X_5 $UN_F_Y_5 $UN_F_W_5 $UN_F_H_5
Pop $LABELCTL_5
${NSD_CreateBitmap} 0 0 331u 193u ""
Pop $IMAGECTL
${If} $DPI_SCALE == "custom"
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
${EndIf}
!ifdef LITE_PLUS
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
!endif
${NSD_AddStyle} $IMAGECTL ${SS_CENTERIMAGE}
${NSD_SetImage} $IMAGECTL "$PLUGINSDIR\fmodern-wizard.bmp" $IMAGE
SetCtlColors $DIALOG "" 0xfffff2
SetCtlColors $LABELCTL_4 0xfffff2 0xfffff2
SetCtlColors $LABELCTL_5 0x4f5235 0xfffff2
SetCtlColors $IMAGECTL "" 0xfffff2
nsDialogs::Show
${NSD_FreeImage} $IMAGE
FunctionEnd
Function un.ReadEasterEgg
; arguments
Exch $R1 ; easter egg magic value
; locals
Push $1 ; file name or (later) file handle
Push $2 ; current trial offset
Push $3 ; current trial string (which will match R1 when easter egg is found)
Push $4 ; length of $R1
FileOpen $1 "$INSTDIR\${uninstx}" r
; change 512 here to, e.g., 2048 to scan the last 2Kb of EXE file
IntOp $2 0 - 512
StrLen $4 $R1
loop:
FileSeek $1 $2 END
FileRead $1 $3 $4
StrCmp $3 $R1 found
IntOp $2 $2 + 1
IntCmp $2 0 loop loop
StrCpy $R1 ""
goto fin
found:
IntOp $2 $2 + $4
FileSeek $1 $2 END
FileRead $1 $3
StrCpy $R1 $3
fin:
FileClose $1
Pop $4
Pop $3
Pop $2
Pop $1
Exch $R1
FunctionEnd
Function un.trim
${StrStrRight} $1 ";" $3
StrLen $2 $3
IntOp $2 $2 + 1
StrCpy $1 $1 -$2
FunctionEnd
Function un.ParseEasterEgg
Push "31904101:"
Call un.ReadEasterEgg
Pop $1
Call un.trim
StrCpy $XXX $3 #
Call un.trim
StrCpy $X_ACCOUNT $3 #
Call un.trim
StrCpy $X_PROFILE $3 #
Call un.trim
StrCpy $TIME $3 #
Call un.trim
StrCpy $PAR_NUM $3 #
Call un.trim
StrCpy $ICONS_GROUP $3 #
Call un.trim
StrCpy $LANGUAGE $3 #
Call un.trim
StrCpy $DESK $3 #
Call un.trim
StrCpy $PATH $3 #
; MessageBox MB_OK "Easter data: $XXX $X_ACCOUNT $X_PROFILE $TIME $PAR_NUM $ICONS_GROUP $LANGUAGE $DESK $PATH"
FunctionEnd
Function un.onInit
!if ${NSIS_PACKEDVERSION} >= 0x03008000
GetWinVer $WIN_BUILD Build ; > NSIS 3.07
!else
GetDllVersion "$SysDir\KERNEL32.DLL" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $WIN_BUILD $R4 #
!endif
; Scale interface
!insertmacro DPI_INIT
; Re-locate temp folder
!ifdef PLUGINSDIR_APPDATA
${If} ${SysDllAtLeastWinXPSP2}
GetTempFileName $0
${StrStrRight} $0 "\" $0
StrCpy $0 $0 -4 #
UnsafeStrCpy $pluginsdir "$localappdata\${uninst}$0"
CreateDirectory $pluginsdir
${EndIf}
!endif
StrCpy $SPAWN $CMDLINE "" -2
StrCpy $WIN_V 0 #
${If} $WIN_BUILD >= 6000 ; Vista+
StrCpy $WIN_V 5 #
${EndIf}
; Accounts and Versions
UserInfo::GetAccountType
Pop $R0
${Select} $R0
${Case2} "Admin" "Power"
StrCpy $ACCOUNT 1 #
${Case} "User"
StrCpy $ACCOUNT 0 #
${CaseElse}
StrCpy $WIN_V "N" #
${EndSelect}
${If} $WIN_V == 5
${AndIf} $ACCOUNT == 1
StrCpy $WIN_V 6 #
StrCpy $ACCOUNT 2 #
${EndIf}
StrCmp $WIN_V "N" abort
IntCmp $ACCOUNT 1 reg_test_admin reg_test_user reg_test_admin
; Registry Access
reg_test_user:
ReadRegStr $PATH HKCU ${PRODUCT_UNINST_KEY} "App Path"
IfErrors exe_read
IfFileExists "$PATH\*.*" 0 exe_read
ReadRegStr $UNINSTSTR HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
IfErrors exe_read
StrCpy $UNINST "$INSTDIR\${uninstx}" #
StrCmp $UNINST $UNINSTSTR reg_read_user exe_read
reg_test_admin:
ReadRegStr $PATH HKLM ${PRODUCT_UNINST_KEY} "App Path"
IfErrors redirect
IfFileExists "$PATH\*.*" 0 redirect
ReadRegStr $UNINSTSTR HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
IfErrors redirect continue
redirect:
ClearErrors
StrCmp $WIN_V 0 exe_read reg_test_user
continue:
StrCpy $UNINST "$INSTDIR\${uninstx}" #
StrCmp $UNINST $UNINSTSTR reg_read_admin
StrCmp $WIN_V 0 exe_read reg_test_user
; Read Registry
reg_read_user:
ClearErrors
ReadRegStr $LANG HKCU ${PRODUCT_UNINST_KEY} "Language"
StrCpy $LANGUAGE $LANG #
ReadRegStr $INSTDIR HKCU ${PRODUCT_UNINST_KEY} "App Path"
ReadRegStr $DESK HKCU ${PRODUCT_UNINST_KEY} "DeskTopIcon"
ReadRegStr $TIME HKCU ${PRODUCT_UNINST_KEY} "TimeStamp"
ReadRegStr $PAR_NUM HKCU ${PRODUCT_UNINST_KEY} "SubFolder"
ReadRegStr $ICONS_GROUP HKCU ${PRODUCT_UNINST_KEY} "StartMenuDir"
StrCpy $DTI "T I G" #
StrCpy $X_ACCOUNT 0 #
StrCpy $ACCOUNT 0 #
StrCpy $XXX 1 #
Goto plug
reg_read_admin:
ClearErrors
ReadRegStr $LANG HKLM ${PRODUCT_UNINST_KEY} "Language"
StrCpy $LANGUAGE $LANG #
ReadRegStr $INSTDIR HKLM ${PRODUCT_UNINST_KEY} "App Path"
ReadRegStr $DESK HKLM ${PRODUCT_UNINST_KEY} "DeskTopIcon"
ReadRegStr $TIME HKLM ${PRODUCT_UNINST_KEY} "TimeStamp"
ReadRegStr $PAR_NUM HKLM ${PRODUCT_UNINST_KEY} "SubFolder"
ReadRegStr $ICONS_GROUP HKLM ${PRODUCT_UNINST_KEY} "StartMenuDir"
ReadRegStr $X_ACCOUNT HKLM ${PRODUCT_UNINST_KEY} "InstallType"
${If} $X_ACCOUNT == 1
StrCpy $DTI "T.I.G." #
${Else}
StrCpy $DTI "T I G" #
${EndIf}
StrCpy $ACCOUNT 1 #
StrCpy $XXX 1 #
Goto plug
exe_read: ; self-uninstall option - read string in file
ClearErrors
${GetUser} $MY_PROFILE
Call un.ParseEasterEgg
IfErrors abort
IfFileExists "$PATH\*.*" 0 abort
StrCpy $INSTDIR $PATH #
${If} $ACCOUNT == 2
StrCpy $ACCOUNT $X_ACCOUNT #
${EndIf}
; ACCOUNT 1 | X_ACCOUNT 1 | goto plug
; ACCOUNT 1 | X_ACCOUNT 0 | $X_PROFILE = $MY_PROFILE | goto plug
; ACCOUNT 1 | X_ACCOUNT 0 | $X_PROFILE ! $MY_PROFILE | goto abort (USER message)
; ACCOUNT 0 | X_ACCOUNT 1 | goto abort (UAC message)
; ACCOUNT 0 | X_ACCOUNT 0 | $X_PROFILE = $MY_PROFILE | goto plug
; ACCOUNT 0 | X_ACCOUNT 0 | $X_PROFILE ! $MY_PROFILE | goto abort (USER message)
StrCmp $ACCOUNT 0 uac
ReadRegStr $R0 HKLM ${PRODUCT_UNINST_KEY} "App Path"
${If} $R0 == $INSTDIR
StrCpy $DTI "T.I.G." #
StrCpy $XXX 1 # ; remove desktop icon + registry entries
${EndIf}
StrCmp $X_ACCOUNT 1 plug profile
uac:
ReadRegStr $R0 HKCU ${PRODUCT_UNINST_KEY} "App Path"
${If} $R0 == $INSTDIR
StrCpy $DTI "T I G" #
StrCpy $XXX 1 # ; remove desktop icon + registry entries
${EndIf}
StrCmp $X_ACCOUNT 0 profile
StrCpy $R2 "uac" #
Goto abort
profile:
StrCmp $X_PROFILE "" abort
StrCmp $X_PROFILE $MY_PROFILE plug
StrCpy $R2 "profile" #
Goto abort
; Temporary Folder
plug:
!ifdef PLUGINSDIR_APPDATA
${IfNot} ${SysDllAtLeastWinXPSP2}
InitPluginsDir
${EndIf}
!else
InitPluginsDir
!endif
SetOutPath "$PLUGINSDIR"
ReserveFile /plugin "nsDialogs.dll"
ReserveFile /plugin "System.dll"
ReserveFile /plugin "UserInfo.dll"
ReserveFile /plugin "SysCompImg.dll"
ReserveFile "${ARTWORK}96\tighUN.bmp"
ReserveFile "${ARTWORK}96\tigfUN.bmp"
File "/oname=$PLUGINSDIR\fmodern-wizard.bmp" "${ARTWORK}96\tigfUN.bmp"
ReserveFile "${ARTWORK}96\tigwUN.bmp"
SetOutPath "$TEMP"
Goto done
abort:
ClearErrors
${If} $SPAWN != "/U"
Call un.onUnInstFailed
${EndIf}
done:
FunctionEnd
Function un.StandardDPI
; Standard images (24-bit uncompressed)
${If} $SYS_DPI == 192
${OrIf} $SYS_DPI == 168
${OrIf} $SYS_DPI == 144
${OrIf} $SYS_DPI == 120
StrCpy $DPI_SCALE "standard" #
${If} $SYS_DPI == 192
!insertmacro BMPX_ 192 "UN" ""
${ElseIf} $SYS_DPI == 168
!insertmacro BMPX_ 168 "UN" ""
${ElseIf} $SYS_DPI == 144
!insertmacro BMPX_ 144 "UN" ""
${ElseIf} $SYS_DPI == 120
!insertmacro BMPX_ 120 "UN" ""
${EndIf}
${EndIf}
FunctionEnd
Function un.CustomDPI
; Custom images (rle compressed)
${If} $SYS_DPI > 96
${AndIf} $DPI_SCALE != "standard"
StrCpy $DPI_SCALE "custom" #
${If} $SYS_DPI >= 192
!insertmacro BMPX 192 "UN" "_"
${ElseIf} $SYS_DPI >= 168
!insertmacro BMPX 168 "UN" "_"
${ElseIf} $SYS_DPI >= 144
!insertmacro BMPX 144 "UN" "_"
${ElseIf} $SYS_DPI >= 120
!insertmacro BMPX 120 "UN" "_"
${EndIf}
${EndIf}
FunctionEnd
Function un.onGUIInit_func
ReadRegDWORD $UseLightTheme HKCU "Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" "AppsUseLightTheme"
StrCmp $UseLightTheme "" 0 +2
StrCpy $UseLightTheme 1 ; Default
StrCmp $UseLightTheme "0" 0 +5
System::Call 'DWMAPI::DwmSetWindowAttribute(p$hWndParent,i20,*i1,i4)i.r0' ; 20H1
IntCmp $0 0 +3 +3
System::Call 'DWMAPI::DwmSetWindowAttribute(p$hWndParent,i19,*i1,i4)i.r0' ; 19H1
System::Call 'USER32::SetProp(p$hWndParent,t"UseImmersiveDarkModeColors",i1)' ; 1809
!insertmacro DPI_MUI_LOAD "UN" "un."
; Header (colors)
GetDlgItem $R0 $HWNDPARENT 1038
SetCtlColors $R0 0x4f5235 0xfffff2
GetDlgItem $R0 $HWNDPARENT 1037
SetCtlColors $R0 0x4f5235 0xfffff2
; Header (title font)
CreateFont $R1 "Verdana" 10 700
SendMessage $R0 ${WM_SETFONT} $R1 0
GetDlgItem $R0 $HWNDPARENT 1028
SendMessage $R0 ${WM_SETTEXT} 1 "STR:"
GetDlgItem $R0 $HWNDPARENT 1256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:"
GetDlgItem $R0 $HWNDPARENT 2256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:Tom’s Image Gallery"
GetDlgItem $R0 $HWNDPARENT 3256
SendMessage $R0 ${WM_SETTEXT} 1 "STR:${PRODUCT_COPYRIGHT}"
FunctionEnd
; Post-Uninstall
Function un.onUnInstFailed
${If} $R2 == "profile"
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT_PROFILE)" /SD IDOK IDOK quit
${ElseIf} $R2 == "uac"
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT_UAC)" /SD IDOK IDOK quit
${ElseIf} $WIN_V == "N"
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT_N)" /SD IDOK IDOK quit
${Else}
MessageBox MB_ICONSTOP|MB_OK|MB_DEFBUTTON1 "$(MESSAGE_UNABORT)" /SD IDOK IDOK quit
${EndIf}
quit:
Quit
FunctionEnd
################################# TIGpassword.nsh #################################
; Tom’s Image Gallery 2.1 Setup Password include (TN)
;--------------------------------
!define MakePass "!insertmacro MakePass"
!define CheckPass "!insertmacro CheckPass"
!define CompileTasks "!insertmacro CompileTasks"
!define CompileCleanUp "!insertmacro CompileCleanUp"
!ifdef UNICODE
!define 7z "C:\Program Files\7-Zip\7z.exe" ; 21.7
!else
!define 7z "C:\Program Files\7-Zip 9.20\7z.exe"
!endif
!ifndef ResHacker
!define ResHacker "${ABSDIR}\Resource Hacker\ResourceHacker.exe"
!endif
!ifndef upx
!define upx "${ABSDIR}\UPX\upx.exe"
!endif
; Password - @compile-time
!macro MakePass
!ifndef IV
!system 'vector.exe' ; initial (random) vector
!define /file IV iv.enc
# !system 'userkey.exe' ; uncomment this line to create a new key
!define /file UK uk.enc
!system 'md5 -generate -d${UK}${IV} -l -o${LOCAL}${NSIDIR}\pw.enc'
!define /file PW ${LOCAL}${NSIDIR}\pw.enc
!endif
StrCpy $PASSWORD ${PW} #
!macroend
; Password - @runtime, if "PASS_ON" is enabled
!macro CheckPass
StrCpy $3 0
loop:
IntOp $3 $3 + 1
IntCmp $3 100 0 0 incorrect
md5dll::GetMD5String "${UK}$3"
Pop $2
StrCpy $2 $2 16 -24
StrCmp ${TEMP1} $2 0 loop
md5dll::GetMD5String ${UK}${IV}
Pop ${TEMP1}
incorrect:
!macroend
!macro CompileTasks
!cd ${SRCDIR}
!system 'copy berlinerv.exe $%TEMP%\berliner.exe'
; 7-Zip self-extracting archive (Igor Pavlov) - password encrypted
!system '"${7z}" a -sfx -t7z -m0=lzma2 -p${PW} -mmt8 -y htmlexev.exe $%TEMP%\berliner.exe'
!system '"${7z}" a -sfx -t7z -m0=lzma2 -p${PW} -mmt8 -y htmlexe.exe berliner.exe'
!system '"${7z}" a -sfx -t7z -m0=lzma2 -p${PW} -mmt8 -y html.exe text*.htm add*.htm \
mo_t*.htm mo_a*.htm quotes.htm exhibit.htm magic.htm impo.htm voyeur.htm gent.htm'
!system '"${7z}" a -sfx -t7z -m0=lzma2 -p${PW} -mmt8 -y .\acroice\pdf.exe .\acroice\*.pdf'
!system '"${7z}" a -sfx -t7z -m0=lzma2 -p${PW} -mmt8 -y .\acrohome\pdf.exe .\acrohome\*.pdf'
; swap icon resources
# !execute '"${ResHacker}" -modify "htmlexev.exe", "htmlexev.exe", "${ABSDIR}\instx.ico", icongroup, 101, 1033'
# !execute '"${ResHacker}" -modify "htmlexe.exe", "htmlexe.exe", "${ABSDIR}\instx.ico", icongroup, 101, 1033'
# !execute '"${ResHacker}" -modify "html.exe", "html.exe", "${ABSDIR}\instx.ico", icongroup, 101, 1033'
# !execute '"${ResHacker}" -modify "${SRCDIR}\acroice\pdf.exe", "${SRCDIR}\acroice\pdf.exe", "${ABSDIR}\instx.ico", icongroup, 101, 1033'
# !execute '"${ResHacker}" -modify "${SRCDIR}\acrohome\pdf.exe", "${SRCDIR}\acrohome\pdf.exe", "${ABSDIR}\instx.ico", icongroup, 101, 1033'
; add manifest for compatibility + upx header compression
!execute '"${ResHacker}" -add "htmlexev.exe", "htmlexev.exe", "${ABSDIR}\Key\sfxmanifest", 24, 1, 1033'
!execute '"${upx}" -9 "htmlexev.exe"'
!execute '"${ResHacker}" -add "htmlexe.exe", "htmlexe.exe", "${ABSDIR}\Key\sfxmanifest", 24, 1, 1033'
!execute '"${upx}" -9 "htmlexe.exe"'
!execute '"${ResHacker}" -add "html.exe", "html.exe", "${ABSDIR}\Key\sfxmanifest", 24, 1, 1033'
!execute '"${upx}" -9 "html.exe"'
!execute '"${ResHacker}" -add "${SRCDIR}\acroice\pdf.exe", "${SRCDIR}\acroice\pdf.exe", "${ABSDIR}\Key\sfxmanifest", 24, 1, 1033'
!execute '"${upx}" -9 "${SRCDIR}\acroice\pdf.exe"'
!execute '"${ResHacker}" -add "${SRCDIR}\acrohome\pdf.exe", "${SRCDIR}\acrohome\pdf.exe", "${ABSDIR}\Key\sfxmanifest", 24, 1, 1033'
!execute '"${upx}" -9 "${SRCDIR}\acrohome\pdf.exe"'
ReserveFile "html.exe"
ReserveFile "htmlexev.exe"
ReserveFile "htmlexe.exe"
ReserveFile "acroice\pdf.exe"
ReserveFile "acrohome\pdf.exe"
!delfile $%TEMP%\berliner.exe
!cd ${ABSDIR}\${NSIDIR}
!macroend
!macro CompileCleanUp ; (afterward)
!delfile "${SRCDIR}\html.exe"
!delfile "${SRCDIR}\htmlexev.exe"
!delfile "${SRCDIR}\htmlexe.exe"
!delfile "${SRCDIR}\acroice\pdf.exe"
!delfile "${SRCDIR}\acrohome\pdf.exe"
!macroend
################################## TIGmacros.nsh ##################################
; Tom’s Image Gallery 2.1 Setup Macros include (TN)
;--------------------------------
/*
FileFunction=[Locate|GetSizeOnDisk|DirState|GetParent|GetRoot|GetUser|
GetUserDefaultLang|GetTime|StrStrRight]
*/
;_____________________________________________________________________________
;
; Macros
;_____________________________________________________________________________
;
; Change log window verbosity (default: 3=no script)
;
; Example:
; !include "TIGmacros.nsh"
; !insertmacro DirState
; ${FILEFUNC_VERBOSE} 4 # all verbosity
; !insertmacro GetParent
; ${FILEFUNC_VERBOSE} 3 # no script
!include Util.nsh ; for "CallArtificialFunction"
!verbose push
!verbose 3
!ifndef _FILEFUNC_VERBOSE
!define _FILEFUNC_VERBOSE 3
!endif
!verbose ${_FILEFUNC_VERBOSE}
!define FILEFUNC_VERBOSE `!insertmacro FILEFUNC_VERBOSE`
!verbose pop
!macro FILEFUNC_VERBOSE _VERBOSE
!verbose push
!verbose 3
!undef _FILEFUNC_VERBOSE
!define _FILEFUNC_VERBOSE ${_VERBOSE}
!verbose pop
!macroend
!macro LocateCall _PATH _OPTIONS _FUNC
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push $0
Push `${_PATH}`
Push `${_OPTIONS}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
${CallArtificialFunction} Locate_
Pop $0
!verbose pop
!macroend
!macro GetSizeOnDiskCall _PATH _OPTIONS _FILESYSTEM _RESULT1 _RESULT2 _RESULT3 _RESULT4
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_PATH}`
Push `${_OPTIONS}`
Push `${_FILESYSTEM}` ; volume block size
${CallArtificialFunction} GetSizeOnDisk_
Pop ${_RESULT1}
Pop ${_RESULT2}
Pop ${_RESULT3}
Pop ${_RESULT4}
!verbose pop
!macroend
!macro DirStateCall _PATH _RESULT
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_PATH}`
${CallArtificialFunction} DirState_
Pop ${_RESULT}
!verbose pop
!macroend
!macro GetParentCall _PATHSTRING _RESULT
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_PATHSTRING}`
${CallArtificialFunction} GetParent_
Pop ${_RESULT}
!verbose pop
!macroend
!macro GetRootCall _FULLPATH _RESULT
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_FULLPATH}`
${CallArtificialFunction} GetRoot_
Pop ${_RESULT}
!verbose pop
!macroend
!macro GetUserCall _PROFILE
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
${CallArtificialFunction} GetUser_
Pop ${_PROFILE}
!verbose pop
!macroend
!macro GetUserDefaultLangCall _LID
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
${CallArtificialFunction} GetUserDefaultLang_
Pop ${_LID}
!verbose pop
!macroend
!macro GetTimeCall _OPTIONS _TIME
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_OPTIONS}`
${CallArtificialFunction} GetTime_
Pop ${_TIME}
!verbose pop
!macroend
!macro StrStrRightCall _STRING _SUBSTRING _NEWSTRING
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_STRING}`
Push `${_SUBSTRING}`
${CallArtificialFunction} StrStrRight_
Pop ${_NEWSTRING}
!verbose pop
!macroend
; ---------------
; Locate (FileFunc.nsh)
!define Locate `!insertmacro LocateCall`
!define un.Locate `!insertmacro LocateCall`
!macro Locate
!macroend
!macro un.Locate
!macroend
!macro Locate_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Exch $2
Exch
Exch $1
Exch
Exch 2
Exch $0
Exch 2
Push $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
Push $R6
Push $R7
Push $R8
Push $R9
ClearErrors
StrCpy $3 ''
StrCpy $4 ''
StrCpy $5 ''
StrCpy $6 ''
StrCpy $7 ''
StrCpy $8 0
StrCpy $R7 ''
StrCpy $R9 $0 1 -1
StrCmp $R9 '\' 0 +3
StrCpy $0 $0 -1
goto -3
IfFileExists '$0\*.*' 0 FileFunc_Locate_error
FileFunc_Locate_option:
StrCpy $R9 $1 1
StrCpy $1 $1 '' 1
StrCmp $R9 ' ' -2
StrCmp $R9 '' FileFunc_Locate_sizeset
StrCmp $R9 '/' 0 -4
StrCpy $9 -1
IntOp $9 $9 + 1
StrCpy $R9 $1 1 $9
StrCmp $R9 '' +2
StrCmp $R9 '/' 0 -3
StrCpy $R8 $1 $9
StrCpy $R8 $R8 '' 2
StrCpy $R9 $R8 '' -1
StrCmp $R9 ' ' 0 +3
StrCpy $R8 $R8 -1
goto -3
StrCpy $R9 $1 2
StrCpy $1 $1 '' $9
StrCmp $R9 'L=' 0 FileFunc_Locate_mask
StrCpy $3 $R8
StrCmp $3 '' +6
StrCmp $3 'FD' +5
StrCmp $3 'F' +4
StrCmp $3 'D' +3
StrCmp $3 'DE' +2
StrCmp $3 'FDE' 0 FileFunc_Locate_error
goto FileFunc_Locate_option
FileFunc_Locate_mask:
StrCmp $R9 'M=' 0 FileFunc_Locate_size
StrCpy $4 $R8
goto FileFunc_Locate_option
FileFunc_Locate_size:
StrCmp $R9 'S=' 0 FileFunc_Locate_gotosubdir
StrCpy $6 $R8
goto FileFunc_Locate_option
FileFunc_Locate_gotosubdir:
StrCmp $R9 'G=' 0 FileFunc_Locate_banner
StrCpy $7 $R8
StrCmp $7 '' +3
StrCmp $7 '1' +2
StrCmp $7 '0' 0 FileFunc_Locate_error
goto FileFunc_Locate_option
FileFunc_Locate_banner:
StrCmp $R9 'B=' 0 FileFunc_Locate_error
StrCpy $R7 $R8
StrCmp $R7 '' +3
StrCmp $R7 '1' +2
StrCmp $R7 '0' 0 FileFunc_Locate_error
goto FileFunc_Locate_option
FileFunc_Locate_sizeset:
StrCmp $6 '' FileFunc_Locate_default
StrCpy $9 0
StrCpy $R9 $6 1 $9
StrCmp $R9 '' +4
StrCmp $R9 ':' +3
IntOp $9 $9 + 1
goto -4
StrCpy $5 $6 $9
IntOp $9 $9 + 1
StrCpy $1 $6 1 -1
StrCpy $6 $6 -1 $9
StrCmp $5 '' +2
IntOp $5 $5 + 0
StrCmp $6 '' +2
IntOp $6 $6 + 0
StrCmp $1 'B' 0 +3
StrCpy $1 1
goto FileFunc_Locate_default
StrCmp $1 'K' 0 +3
StrCpy $1 1024
goto FileFunc_Locate_default
StrCmp $1 'M' 0 +3
StrCpy $1 1048576
goto FileFunc_Locate_default
StrCmp $1 'G' 0 FileFunc_Locate_error
StrCpy $1 1073741824
FileFunc_Locate_default:
StrCmp $3 '' 0 +2
StrCpy $3 'FD'
StrCmp $4 '' 0 +2
StrCpy $4 '*.*'
StrCmp $7 '' 0 +2
StrCpy $7 '1'
StrCmp $R7 '' 0 +2
StrCpy $R7 '0'
StrCpy $7 'G$7B$R7'
StrCpy $8 1
Push $0
SetDetailsPrint textonly
FileFunc_Locate_nextdir:
IntOp $8 $8 - 1
Pop $R8
StrCpy $9 $7 2 2
StrCmp $9 'B0' +3
GetLabelAddress $9 FileFunc_Locate_findfirst
goto call
DetailPrint 'Search in: $R8'
FileFunc_Locate_findfirst:
FindFirst $0 $R7 '$R8\$4'
IfErrors FileFunc_Locate_subdir
StrCmp $R7 '.' 0 FileFunc_Locate_dir
FindNext $0 $R7
StrCmp $R7 '..' 0 FileFunc_Locate_dir
FindNext $0 $R7
IfErrors 0 FileFunc_Locate_dir
FindClose $0
goto FileFunc_Locate_subdir
FileFunc_Locate_dir:
IfFileExists '$R8\$R7\*.*' 0 FileFunc_Locate_file
StrCpy $R6 ''
StrCmp $3 'DE' +4
StrCmp $3 'FDE' +3
StrCmp $3 'FD' FileFunc_Locate_precall
StrCmp $3 'F' FileFunc_Locate_findnext FileFunc_Locate_precall
FindFirst $9 $R9 '$R8\$R7\*.*'
StrCmp $R9 '.' 0 +4
FindNext $9 $R9
StrCmp $R9 '..' 0 +2
FindNext $9 $R9
FindClose $9
IfErrors FileFunc_Locate_precall FileFunc_Locate_findnext
FileFunc_Locate_file:
StrCmp $3 'FDE' +3
StrCmp $3 'FD' +2
StrCmp $3 'F' 0 FileFunc_Locate_findnext
StrCpy $R6 0
StrCmp $5$6 '' FileFunc_Locate_precall
FileOpen $9 '$R8\$R7' r
IfErrors +3
FileSeek $9 0 END $R6
FileClose $9
System::Int64Op $R6 / $1
Pop $R6
StrCmp $5 '' +2
IntCmp $R6 $5 0 FileFunc_Locate_findnext
StrCmp $6 '' +2
IntCmp $R6 $6 0 0 FileFunc_Locate_findnext
FileFunc_Locate_precall:
StrCpy $9 0
StrCpy $R9 '$R8\$R7'
call:
Push $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
Push $R7
Push $R8
StrCmp $9 0 +4
StrCpy $R6 ''
StrCpy $R7 ''
StrCpy $R9 ''
Call $2
Pop $R9
Pop $R8
Pop $R7
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
IfErrors 0 +3
FindClose $0
goto FileFunc_Locate_error
StrCmp $R9 'StopLocate' 0 +3
FindClose $0
goto FileFunc_Locate_clearstack
goto $9
FileFunc_Locate_findnext:
FindNext $0 $R7
IfErrors 0 FileFunc_Locate_dir
FindClose $0
FileFunc_Locate_subdir:
StrCpy $9 $7 2
StrCmp $9 'G0' FileFunc_Locate_end
FindFirst $0 $R7 '$R8\*.*'
StrCmp $R7 '.' 0 FileFunc_Locate_pushdir
FindNext $0 $R7
StrCmp $R7 '..' 0 FileFunc_Locate_pushdir
FindNext $0 $R7
IfErrors 0 FileFunc_Locate_pushdir
FindClose $0
StrCmp $8 0 FileFunc_Locate_end FileFunc_Locate_nextdir
FileFunc_Locate_pushdir:
IfFileExists '$R8\$R7\*.*' 0 +3
Push '$R8\$R7'
IntOp $8 $8 + 1
FindNext $0 $R7
IfErrors 0 FileFunc_Locate_pushdir
FindClose $0
StrCmp $8 0 FileFunc_Locate_end FileFunc_Locate_nextdir
FileFunc_Locate_error:
SetErrors
FileFunc_Locate_clearstack:
StrCmp $8 0 FileFunc_Locate_end
IntOp $8 $8 - 1
Pop $R8
goto FileFunc_Locate_clearstack
FileFunc_Locate_end:
SetDetailsPrint both
Pop $R9
Pop $R8
Pop $R7
Pop $R6
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!verbose pop
!macroend
; ---------------
; GetSizeOnDisk (modified "GetSize" - FileFunc.nsh - KiCHiK - Function "FindFiles")
!define GetSizeOnDisk `!insertmacro GetSizeOnDiskCall`
!define un.GetSizeOnDisk `!insertmacro GetSizeOnDiskCall`
!macro GetSizeOnDisk
!macroend
!macro un.GetSizeOnDisk
!macroend
; Usage: similar to "GetSize"
; For documentation, see the NSIS user manual: E.1.3 GetSize
; Four (not three) values are returned
; $var1 ; Result1: Size/Size on disk
; $var2 ; Result2: Sum of files
; $var3 ; Result3: Sum of directories
; $var4 ; Result4: Sum of compressed/sparse files
; Example: ${GetSizeOnDisk} "$INSTDIR" "/S=0K" "SOD" $0 $1 $2 $3
; DetailPrint "$1 file(s) | $2 folder(s) | $0 Kb | $3 compressed or sparse file(s)"
; Specifying 'SOD' (e.g. Size On Disk) toggles the $var1 result
; Output is logical size, if used, or physical size, if left empty ""
; The target volume's allocation unit size in bytes, the size of a
; cluster, for example '4096' bytes, if valid, can also be the input
; If neither 'SOD' nor a cluster size is specified, $var4 returns 0
; even where compressed and/or sparse files exist
; ${GetSizeOnDisk} can be used with Windows NT and Windows 2000
; When the volume is FAT32, FAT16 or an older file system, the result
; in $var1 reverts to physical size, although not incorrect
!macro GetSizeOnDisk_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Exch $2
Exch 2
Exch $0
Exch
Exch $1
Push $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
Push $R0
Push $R1
Push $R2
StrCpy $R1 $2
Push $R3
Push $R4
Push $R5
Push $R6
Push $R7
Push $R8
Push $R9
ClearErrors
StrCmp $R1 '' FileFunc_GetSize_path
StrCpy $5 $0
StrCpy $2 $0 2
StrCmp $2 '\\' FileFunc_GetSize_Root_UNC
StrCpy $3 $2 1 1
StrCmp $3 ':' 0 FileFunc_GetSize_Root_empty
StrCpy $5 $2
goto FileFunc_GetSize_FileSystem
FileFunc_GetSize_Root_UNC:
StrCpy $3 1
StrCpy $4 ''
FileFunc_GetSize_Root_loop:
IntOp $3 $3 + 1
StrCpy $2 $5 1 $3
StrCmp $2$4 '' FileFunc_GetSize_Root_empty
StrCmp $2 '' +5
StrCmp $2 '\' 0 FileFunc_GetSize_Root_loop
StrCmp $4 '1' +3
StrCpy $4 '1'
goto FileFunc_GetSize_Root_loop
StrCpy $5 $5 $3
StrCpy $3 $5 1 -1
StrCmp $3 '\' 0 FileFunc_GetSize_FileSystem
FileFunc_GetSize_Root_empty:
StrCpy $5 ''
FileFunc_GetSize_FileSystem:
System::Call 'Kernel32::GetVolumeInformation(t "$5\",t,i ${NSIS_MAX_STRLEN},*i,*i,*i,t.r2,i ${NSIS_MAX_STRLEN})i.r3'
StrCmp $3 0 FileFunc_GetSize_FileSystem_error
StrCpy $2 $2 3
StrCmp $2 'FAT' FileFunc_GetSize_FileSystem_error
StrCmp $R1 'SOD' 0 FileFunc_GetSize_path
System::Call 'kernel32::GetDiskFreeSpace(t "$5\",*i0r2,*i0r3,,)'
IntOp $R1 $2 * $3
goto FileFunc_GetSize_path
FileFunc_GetSize_FileSystem_error:
StrCpy $R1 ''
FileFunc_GetSize_path:
StrCpy $R9 $0 1 -1
StrCmp $R9 '\' 0 +3
StrCpy $0 $0 -1
goto -3
IfFileExists '$0\*.*' 0 FileFunc_GetSize_error
StrCpy $3 0
StrCpy $4 ''
StrCpy $5 ''
StrCpy $6 ''
StrCpy $8 0
StrCpy $R3 ''
StrCpy $R4 ''
StrCpy $R5 ''
FileFunc_GetSize_option:
StrCpy $R9 $1 1
StrCpy $1 $1 '' 1
StrCmp $R9 ' ' -2
StrCmp $R9 '' FileFunc_GetSize_sizeset
StrCmp $R9 '/' 0 -4
StrCpy $9 -1
IntOp $9 $9 + 1
StrCpy $R9 $1 1 $9
StrCmp $R9 '' +2
StrCmp $R9 '/' 0 -3
StrCpy $8 $1 $9
StrCpy $8 $8 '' 2
StrCpy $R9 $8 '' -1
StrCmp $R9 ' ' 0 +3
StrCpy $8 $8 -1
goto -3
StrCpy $R9 $1 2
StrCpy $1 $1 '' $9
StrCmp $R9 'M=' 0 FileFunc_GetSize_size
StrCpy $4 $8
goto FileFunc_GetSize_option
FileFunc_GetSize_size:
StrCmp $R9 'S=' 0 FileFunc_GetSize_gotosubdir
StrCpy $6 $8
goto FileFunc_GetSize_option
FileFunc_GetSize_gotosubdir:
StrCmp $R9 'G=' 0 FileFunc_GetSize_error
StrCpy $7 $8
StrCmp $7 '' +3
StrCmp $7 '1' +2
StrCmp $7 '0' 0 FileFunc_GetSize_error
goto FileFunc_GetSize_option
FileFunc_GetSize_sizeset:
StrCmp $6 '' FileFunc_GetSize_default
StrCpy $9 0
StrCpy $R9 $6 1 $9
StrCmp $R9 '' +4
StrCmp $R9 ':' +3
IntOp $9 $9 + 1
goto -4
StrCpy $5 $6 $9
IntOp $9 $9 + 1
StrCpy $1 $6 1 -1
StrCpy $6 $6 -1 $9
StrCmp $5 '' +2
IntOp $5 $5 + 0
StrCmp $6 '' +2
IntOp $6 $6 + 0
StrCmp $1 'B' 0 +4
StrCpy $1 1
StrCpy $2 bytes
goto FileFunc_GetSize_default
StrCmp $1 'K' 0 +4
StrCpy $1 1024
StrCpy $2 Kb
goto FileFunc_GetSize_default
StrCmp $1 'M' 0 +4
StrCpy $1 1048576
StrCpy $2 Mb
goto FileFunc_GetSize_default
StrCmp $1 'G' 0 FileFunc_GetSize_error
StrCpy $1 1073741824
StrCpy $2 Gb
FileFunc_GetSize_default:
StrCmp $4 '' 0 +2
StrCpy $4 '*.*'
StrCmp $7 '' 0 +2
StrCpy $7 '1'
StrCpy $8 1
Push $0
SetDetailsPrint textonly
FileFunc_GetSize_nextdir:
IntOp $8 $8 - 1
Pop $R8
FindFirst $0 $R7 '$R8\$4'
IfErrors FileFunc_GetSize_show
StrCmp $R7 '.' 0 FileFunc_GetSize_dir
FindNext $0 $R7
StrCmp $R7 '..' 0 FileFunc_GetSize_dir
FindNext $0 $R7
IfErrors 0 FileFunc_GetSize_dir
FindClose $0
goto FileFunc_GetSize_show
FileFunc_GetSize_dir:
IfFileExists '$R8\$R7\*.*' 0 FileFunc_GetSize_file
IntOp $R5 $R5 + 1
goto FileFunc_GetSize_findnext
FileFunc_GetSize_file:
StrCpy $R6 0
StrCmp $5$6 '' 0 +3
IntOp $R4 $R4 + 1
goto FileFunc_GetSize_findnext
StrCmp $R1 '' FileFunc_GetSize_fileopen
StrCpy $R0 0
System::Call 'kernel32::GetFileAttributes(t "$R8\$R7")i .R2'
StrCmp $R2 -1 FileFunc_GetSize_fileopen
IntOp $R0 $R2 & 0x0800 ; compressed
IntCmp $R0 0 0 0 FileFunc_GetSize_GetCompressed
IntOp $R0 $R2 & 0x0200 ; sparse file
IntCmp $R0 0 FileFunc_GetSize_fileopen
FileFunc_GetSize_GetCompressed:
System::Call 'kernel32::GetCompressedFileSize(t "$R8\$R7", i)i .R6'
IntCmp $R6 4096 +2 0 +2
StrCpy $R6 4096
IntOp $3 $3 + 1 ; location contains compressed or sparse files
goto FileFunc_GetSize_fileclose
FileFunc_GetSize_fileopen:
FileOpen $9 '$R8\$R7' r
IfErrors FileFunc_GetSize_error
FileSeek $9 0 END $R6
FileClose $9
FileFunc_GetSize_fileclose:
StrCmp $5 '' +2
IntCmp $R6 $5 0 FileFunc_GetSize_findnext
StrCmp $6 '' +2
IntCmp $R6 $6 0 0 FileFunc_GetSize_findnext
IntOp $R4 $R4 + 1
StrCmp $R1 '' FileFunc_GetSize_file_add
StrCmp $R0 0 0 FileFunc_GetSize_file_add
StrCpy $R0 $R1
IntOp $R6 $R6 + $R0
IntOp $R1 $R6 % $R0
StrCmp $R1 0 0 +2
StrCpy $R1 $R0
IntOp $R2 $R0 - $R1
IntOp $R6 $R6 - $R0
IntOp $R6 $R6 + $R2
StrCpy $R1 $R0
FileFunc_GetSize_file_add:
System::Int64Op $R3 + $R6
Pop $R3
FileFunc_GetSize_findnext:
FindNext $0 $R7
IfErrors 0 FileFunc_GetSize_dir
FindClose $0
FileFunc_GetSize_show:
StrCmp $5$6 '' FileFunc_GetSize_nosize
System::Int64Op $R3 / $1
Pop $9
DetailPrint 'Size:$9 $2 Files:$R4 Folders:$R5'
goto FileFunc_GetSize_subdir
FileFunc_GetSize_nosize:
DetailPrint 'Files:$R4 Folders:$R5'
FileFunc_GetSize_subdir:
StrCmp $7 0 FileFunc_GetSize_preend
FindFirst $0 $R7 '$R8\*.*'
StrCmp $R7 '.' 0 FileFunc_GetSize_pushdir
FindNext $0 $R7
StrCmp $R7 '..' 0 FileFunc_GetSize_pushdir
FindNext $0 $R7
IfErrors 0 FileFunc_GetSize_pushdir
FindClose $0
StrCmp $8 0 FileFunc_GetSize_preend FileFunc_GetSize_nextdir
FileFunc_GetSize_pushdir:
IfFileExists '$R8\$R7\*.*' 0 +3
Push '$R8\$R7'
IntOp $8 $8 + 1
FindNext $0 $R7
IfErrors 0 FileFunc_GetSize_pushdir
FindClose $0
StrCmp $8 0 FileFunc_GetSize_preend FileFunc_GetSize_nextdir
FileFunc_GetSize_preend:
StrCmp $R3 '' FileFunc_GetSize_nosizeend
System::Int64Op $R3 / $1
Pop $R3
FileFunc_GetSize_nosizeend:
StrCpy $2 $R4
StrCpy $1 $R5
StrCpy $0 $R3
goto FileFunc_GetSize_noerror
FileFunc_GetSize_error:
SetErrors
StrCpy $0 ''
StrCpy $1 ''
StrCpy $2 ''
StrCpy $3 ''
goto FileFunc_GetSize_end
FileFunc_GetSize_noerror:
StrCmp $0 '' 0 +2
StrCpy $0 0
StrCmp $1 '' 0 +2
StrCpy $1 0
StrCmp $2 '' 0 +2
StrCpy $2 0
StrCmp $3 '' 0 +2
StrCpy $3 0
FileFunc_GetSize_end:
SetDetailsPrint both
Pop $R9
Pop $R8
Pop $R7
Pop $R6
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Pop $R0
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Exch $3
Exch 3
Exch $2
Exch
Exch $1
Exch 2
Exch $0
!verbose pop
!macroend
; ---------------
; DirState (FileFunc.nsh)
; (-1 = dir does not exist | 0 = dir is empty | 1 = dir is full)
!define DirState `!insertmacro DirStateCall`
!define un.DirState `!insertmacro DirStateCall`
!macro DirState
!macroend
!macro un.DirState
!macroend
!macro DirState_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Exch $0
Push $1
ClearErrors
FindFirst $1 $0 '$0\*.*'
IfErrors 0 +3
StrCpy $0 -1
goto FileFunc_DirState_end
StrCmp $0 '.' 0 +4
FindNext $1 $0
StrCmp $0 '..' 0 +2
FindNext $1 $0
FindClose $1
IfErrors 0 +3
StrCpy $0 0
goto FileFunc_DirState_end
StrCpy $0 1
FileFunc_DirState_end:
Pop $1
Exch $0
!verbose pop
!macroend
; ---------------
; GetParent (FileFunc.nsh - sunjammer - Based on his Function "GetParent")
!define GetParent `!insertmacro GetParentCall`
!define un.GetParent `!insertmacro GetParentCall`
!macro GetParent
!macroend
!macro un.GetParent
!macroend
!macro GetParent_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Exch $0
Push $1
Push $2
StrCpy $2 $0 1 -1
StrCmp $2 '\' 0 +3
StrCpy $0 $0 -1
goto -3
StrCpy $1 0
IntOp $1 $1 - 1
StrCpy $2 $0 1 $1
StrCmp $2 '\' +2
StrCmp $2 '' 0 -3
StrCpy $0 $0 $1
Pop $2
Pop $1
Exch $0
!verbose pop
!macroend
; ---------------
; GetRoot (FileFunc.nsh - KiCHiK - Based on his Function "GetRoot")
!define GetRoot `!insertmacro GetRootCall`
!define un.GetRoot `!insertmacro GetRootCall`
!macro GetRoot
!macroend
!macro un.GetRoot
!macroend
!macro GetRoot_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Exch $0
Push $1
Push $2
Push $3
StrCpy $1 $0 2
StrCmp $1 '\\' FileFunc_GetRoot_UNC
StrCpy $2 $1 1 1
StrCmp $2 ':' 0 FileFunc_GetRoot_empty
StrCpy $0 $1
goto FileFunc_GetRoot_end
FileFunc_GetRoot_UNC:
StrCpy $2 1
StrCpy $3 ''
FileFunc_GetRoot_loop:
IntOp $2 $2 + 1
StrCpy $1 $0 1 $2
StrCmp $1$3 '' FileFunc_GetRoot_empty
StrCmp $1 '' +5
StrCmp $1 '\' 0 FileFunc_GetRoot_loop
StrCmp $3 '1' +3
StrCpy $3 '1'
goto FileFunc_GetRoot_loop
StrCpy $0 $0 $2
StrCpy $2 $0 1 -1
StrCmp $2 '\' 0 FileFunc_GetRoot_end
FileFunc_GetRoot_empty:
StrCpy $0 ''
FileFunc_GetRoot_end:
Pop $3
Pop $2
Pop $1
Exch $0
!verbose pop
!macroend
; ---------------
; GetUser
!define GetUser `!insertmacro GetUserCall`
!define un.GetUser `!insertmacro GetUserCall`
!macro GetUser
!macroend
!macro un.GetUser
!macroend
!macro GetUser_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push $0
Push $1
Push $2
System::Call 'advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i .r2'
; MessageBox MB_OK "User name: $0 | Number of characters: $1 | Return value (OK if non-zero): $2"
${If} $2 == 0
StrCpy $1 '' #
${EndIf}
Pop $2
Pop $1
Exch $0
!verbose pop
!macroend
; ---------------
; GetUserDefaultLang
!define GetUserDefaultLang `!insertmacro GetUserDefaultLangCall`
!define un.GetUserDefaultLang `!insertmacro GetUserDefaultLangCall`
!macro GetUserDefaultLang
!macroend
!macro un.GetUserDefaultLang
!macroend
!macro GetUserDefaultLang_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push $0
System::Call 'kernel32::GetUserDefaultLangID() i .r0'
; If there is no perfect match, find a primary language match
${Select} $0
${Case5} 1031 2055 3079 4103 5127
StrCpy $0 1031 # ; German
${Case5} 1033 2057 3081 4105 5129
StrCpy $0 1033 # ; English
${Case5} 6153 7177 8201 9225 10249
StrCpy $0 1033 #
${Case3} 11273 12297 13321
StrCpy $0 1033 #
${Case3} 1036 2060 3084
StrCpy $0 1036 # ; French
${Case3} 4108 5132 6156
StrCpy $0 1036 #
${Case2} 1043 2067
StrCpy $0 1043 # ; Dutch
${Case2} 1053 2077
StrCpy $0 1053 # ; Swedish
${Case5} 1034 2058 3082 4106 5130
StrCpy $0 1034 # ; Spanish
${Case5} 6154 7178 8202 9226 10250
StrCpy $0 1034 #
${Case5} 11274 12298 13322 14346 15370
StrCpy $0 1034 #
${Case5} 16394 17418 18442 19466 20490
StrCpy $0 1034 #
${CaseElse}
StrCpy $0 "" #
${EndSelect}
Exch $0
!verbose pop
!macroend
; ---------------
; GetTime
!define GetTime `!insertmacro GetTimeCall`
!define un.GetTime `!insertmacro GetTimeCall`
!macro GetTime
!macroend
!macro un.GetTime
!macroend
!macro GetTime_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Exch $R9
Push $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $6
Push $7
; option1 = S (STAMP) | option2 = F (FORMATTED)
ClearErrors
System::Call '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r7'
System::Call 'kernel32::GetLocalTime(i)i(r7)'
System::Call '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
; 0 day ; 1 seconds ; 2 minutes ; 3 hour ; 4 day of week name ; 5 year ; 6 month
IntCmp $0 9 0 0 +2
StrCpy $0 '0$0'
IntCmp $1 9 0 0 +2
StrCpy $1 '0$1'
IntCmp $2 9 0 0 +2
StrCpy $2 '0$2'
IntCmp $3 9 0 0 +2
StrCpy $3 '0$3'
IntCmp $6 9 0 0 +2
StrCpy $6 '0$6'
StrCmp $R9 '/S' +2
StrCmp $R9 '/F' +3
StrCpy $R9 $0$6$5$3$2$1
Goto +2
StrCpy $R9 '$5-$6-$0 $3:$2:$1'
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
Exch $R9
!verbose pop
!macroend
; ---------------
; StrStrRight
!define StrStrRight `!insertmacro StrStrRightCall`
!define un.StrStrRight `!insertmacro StrStrRightCall`
!macro StrStrRight
!macroend
!macro un.StrStrRight
!macroend
!macro StrStrRight_
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
; Search in a string from right to left
; Usage:
; Push "this is a long ass string"
; Push " ass"
; Call (un.)StrStrRight
; Pop $R0
; ($R0 at this point is "ass string")
Exch $R1 ; st=haystack,old$R1, $R1=needle
Exch ; st=old$R1,haystack
Exch $R2 ; st=old$R1,old$R2, $R2=haystack
Push $R3
Push $R4
Push $R5
StrLen $R3 $R1
StrLen $R4 $R2
IntOp $R4 $R4 - 1
strstr_loop:
StrCpy $R5 $R2 $R3 $R4
StrCmp $R5 $R1 strstr_done
StrCmp $R5 "" strstr_done
IntOp $R4 $R4 - 1
Goto strstr_loop
strstr_done:
IntOp $R4 $R4 + 1
StrCpy $R1 $R2 "" $R4
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Exch $R1
!verbose pop
!macroend
################################## LanguageStrings.nsh ##################################
; Tom’s Image Gallery 2.1 Setup Language Strings include (TN)
;--------------------------------
!ifndef MUI_MODIFIED
; MUI 2 changes - English
LangString M_TEXT_LICENSE_TITLE ${LANG_ENGLISH} "License"
LangString M_TEXT_LICENSE_SUBTITLE ${LANG_ENGLISH} "Please review the license terms before installing the software."
LangString M_INNERTEXT_LICENSE_BOTTOM_CHECKBOX ${LANG_ENGLISH} "If you accept the terms of the agreement, click the \
check box below. You must accept the agreement to install $(^NameDA)."
LangString M_TEXT_DIRECTORY_TITLE ${LANG_ENGLISH} "Install Location"
LangString M_TEXT_DIRECTORY_SUBTITLE ${LANG_ENGLISH} "Choose the folder in which to install $(^NameDA)."
LangString M_TEXT_STARTMENU_TITLE ${LANG_ENGLISH} "Shortcuts Folder"
LangString M_TEXT_STARTMENU_SUBTITLE ${LANG_ENGLISH} "Choose a Start Menu folder for the $(^NameDA) shortcuts."
; MUI 2 changes - German
LangString M_TEXT_LICENSE_TITLE ${LANG_GERMAN} "Lizenzabkommen"
LangString M_TEXT_LICENSE_SUBTITLE ${LANG_GERMAN} "Bitte lesen Sie die Lizenzvereinbarung \
sorgfältig durch."
LangString M_INNERTEXT_LICENSE_BOTTOM_CHECKBOX ${LANG_GERMAN} "Falls Sie alle Bedingungen des Abkommens \
akzeptieren, aktivieren Sie das Kästchen. Sie müssen die Lizenzvereinbarungen anerkennen, um $(^NameDA) \
installieren zu können."
LangString M_TEXT_DIRECTORY_TITLE ${LANG_GERMAN} "Zielverzeichnis auswählen"
LangString M_TEXT_DIRECTORY_SUBTITLE ${LANG_GERMAN} "Wählen Sie das Ziel aus, in das $(^NameDA) installiert werden soll."
LangString M_TEXT_STARTMENU_TITLE ${LANG_GERMAN} "Startmenü-Ordner bestimmen"
LangString M_TEXT_STARTMENU_SUBTITLE ${LANG_GERMAN} "Bestimmen Sie einen Ordner für die Verknüpfungen."
!endif
;--------------------------------
; English
LangString M_TEXT_WELCOME_INFO_TITLE ${LANG_ENGLISH} " Welcome to the Setup for $(^NameDA)"
LangString TEXT_INFO_TITLE ${LANG_ENGLISH} "$(^NameDA)"
LangString TEXT_WELCOME_TITLE ${LANG_ENGLISH} "Welcome."
LangString M_TEXT_WELCOME_INFO_TEXT ${LANG_ENGLISH} "Setup will guide you through the installation \
of $(^NameDA) on your computer. Click Next to continue."
LangString TEXT_WELCOME_PRODUCT_TEXT ${LANG_ENGLISH} "* MIDI Music Player${crlf}${crlf}* Time Chaser (MP3)${crlf}${crlf}\
* Counter-clock Clock${crlf}${crlf}* Berliner (Publication)${crlf}${crlf}* Magicus Oculus (PDF)${crlf}${crlf}* Stereograms${crlf}${crlf}and more"
; Password
LangString TEXT_PASS_TITLE ${LANG_ENGLISH} "Password ?"
LangString TEXT_PASS_SUBTITLE ${LANG_ENGLISH} "Enter the password you were provided with."
LangString TEXT_PASS_BODY ${LANG_ENGLISH} "Please enter your password below and click Next, when you are ready."
LangString TEXT_PASS_CAPTION ${LANG_ENGLISH} "Your Password:"
LangString MESSAGE_PASS_NOT ${LANG_ENGLISH} "The password field cannot be empty. ${crlf}${crlf}"
LangString MESSAGE_PASS_INCORRECT ${LANG_ENGLISH} "The password is incorrect. ${crlf}${crlf}"
; Uninstall
LangString TEXT_PREP_TITLE ${LANG_ENGLISH} "Already Installed"
LangString TEXT_PREP_SUBTITLE ${LANG_ENGLISH} "Choose how you want to install."
LangString TEXT_PREP_INFO ${LANG_ENGLISH} "$(^Name) is already installed. $7\
${crlf}${crlf}It's recommended that you uninstall the copy before installing. Select the operation you want to \
perform and click Next to continue."
LangString TEXT_PREP_PREV ${LANG_ENGLISH} "&Uninstall first"
LangString TEXT_PREP_NOT ${LANG_ENGLISH} "&Do not uninstall"
LangString TEXT_PREP_NOTE ${LANG_ENGLISH} "To uninstall other versions, if present, you can also run \
the uninstaller from the 'bin' folder of the version of $(^Name) you wish to remove."
; Ready
LangString TEXT_READY_TITLE ${LANG_ENGLISH} "Ready to Install"
LangString TEXT_READY_SUBTITLE ${LANG_ENGLISH} "Setup is now ready to start installing $(^Name)."
LangString TEXT_READY_BODY ${LANG_ENGLISH} "Click Install to continue with the \
installation, or Back if you want to review or make changes to the settings."
LangString TEXT_READY_GROUPHEAD ${LANG_ENGLISH} "Install Settings"
LangString TEXT_READY_TASKLIST_A ${LANG_ENGLISH} "Destination Folder:"
LangString TEXT_READY_TASKLIST_B ${LANG_ENGLISH} "Start Menu Folder:"
LangString TEXT_READY_DESKTOP ${LANG_ENGLISH} "&Install desktop icon"
; Finish
LangString M_TEXT_FINISH_INFO_TEXT ${LANG_ENGLISH} "$(^NameDA) has been installed. You can \
click Finish to complete and close Setup."
LangString M_TEXT_FINISH_RUN ${LANG_ENGLISH} "Start $(^NameDA)"
LangString M_TEXT_FINISH_SHOWREADME ${LANG_ENGLISH} "View Help"
LangString M_BUTTONTEXT_FINISH ${LANG_ENGLISH} "&Finish"
; Shortcut
LangString SHORTCUT_REMOVE ${LANG_ENGLISH} "$SMPROGRAMS\$ICONS_GROUP\X TIG (uninstall).lnk"
LangString SHORTCUT_README ${LANG_ENGLISH} "$INSTDIR\shortcut\Read Me.lnk"
LangString SHORTCUT_OBOOK ${LANG_ENGLISH} "PDF - 2019 oBook oDition"
LangString SHORTCUT_BERLINER_SM ${LANG_ENGLISH} "$SMPROGRAMS\$ICONS_GROUP\Berliner.lnk"
LangString SHORTCUT_BERLINER ${LANG_ENGLISH} "HTML Executable Publication"
LangString SHORTCUT_HTA ${LANG_ENGLISH} "Browser Object"
LangString SHORTCUT_WELCOME ${LANG_ENGLISH} "$INSTDIR\shortcut\Welcome.lnk"
LangString SHORTCUT_WELCOME_PAGE ${LANG_ENGLISH} "Splash Page"
LangString SHORTCUT_START_PAGE ${LANG_ENGLISH} "TIG Menu"
LangString SHORTCUT_HELP_CONTEXT ${LANG_ENGLISH} "View Help"
; Message
#LangString MESSAGE_INST_LANG_TITLE ${LANG_ENGLISH} "Installer Language"
#LangString MESSAGE_INST_LANG_INFO ${LANG_ENGLISH} "Please select the language of the installer."
!ifdef MUI_UN_BANNER
LangString MESSAGE_BANNER_WAIT ${LANG_ENGLISH} "Uninstalling files. Please wait..."
LangString MESSAGE_BANNER_REMOVE_DONE ${LANG_ENGLISH} "Done."
LangString MESSAGE_BANNER_REMOVE_FAIL ${LANG_ENGLISH} "One or more folders/files could not be removed from \
$PATH. Please check the path. ${crlf}${crlf}\
Click Cancel to stop the installation, or OK to continue. ${crlf}${crlf}"
!endif
LangString MESSAGE_DIR_USED ${LANG_ENGLISH} "The selected folder is not empty. Please ${crlf}\
choose another destination. ${crlf}${crlf}"
LangString MESSAGE_SMF_USED ${LANG_ENGLISH} "The selected folder is not empty. Please choose ${crlf}\
another Start Menu location. ${crlf}${crlf}"
LangString MESSAGE_ABORT ${LANG_ENGLISH} "Better luck next time. ${crlf}${crlf}"
LangString MESSAGE_ABORT_ACCESS ${LANG_ENGLISH} "The setup cannot continue because access is denied. Please ${crlf}\
see your system administrator to install $(^Name). ${crlf}${crlf}"
; DetailPrint
LangString DETAIL_NOT_FOUND ${LANG_ENGLISH} "Could not find file: "
LangString DETAIL_DATA ${LANG_ENGLISH} "Compressing Uninstall Data..."
;--------------------------------
; German
LangString M_TEXT_WELCOME_INFO_TITLE ${LANG_GERMAN} " Willkommen beim Setup für $(^NameDA)"
LangString TEXT_INFO_TITLE ${LANG_GERMAN} "$(^NameDA)"
LangString TEXT_WELCOME_TITLE ${LANG_GERMAN} "Willkommen."
LangString M_TEXT_WELCOME_INFO_TEXT ${LANG_GERMAN} "Dieser Setup Assistent wird Sie durch die Installation von \
$(^NameDA) führen. Klicken Sie auf Weiter, um fortzufahren."
LangString TEXT_WELCOME_PRODUCT_TEXT ${LANG_GERMAN} "* MIDI Music Player${crlf}${crlf}* Time Chaser (MP3)${crlf}${crlf}\
* Counter-clock Clock${crlf}${crlf}* Berliner (Publikation)${crlf}${crlf}* Magicus Oculus (PDF)${crlf}${crlf}* Stereogramme${crlf}${crlf}und vieles mehr"
; Password
LangString TEXT_PASS_TITLE ${LANG_GERMAN} "Passwort ?"
LangString TEXT_PASS_SUBTITLE ${LANG_GERMAN} "Geben Sie das Ihnen mitgeteilte Passwort ein."
LangString TEXT_PASS_BODY ${LANG_GERMAN} "Bitte geben Sie Ihr Passwort unten ein, und klicken Sie auf Weiter, wenn Sie \
bereit sind."
LangString TEXT_PASS_CAPTION ${LANG_GERMAN} "Ihr Passwort:"
LangString MESSAGE_PASS_NOT ${LANG_GERMAN} "Das Passwort Feld kann nicht leer sein. ${crlf}${crlf}"
LangString MESSAGE_PASS_INCORRECT ${LANG_GERMAN} "Das Passwort ist falsch. ${crlf}${crlf}"
; Uninstall
LangString TEXT_PREP_TITLE ${LANG_GERMAN} "Bereits Installiert"
LangString TEXT_PREP_SUBTITLE ${LANG_GERMAN} "Wählen Sie, wie Sie installieren möchten."
LangString TEXT_PREP_INFO ${LANG_GERMAN} "$(^Name) ist bereits installiert. $7\
${crlf}${crlf}Es wird empfohlen die Kopie zu deinstallieren. Wählen Sie die auszuführende Aktion aus und \
klicken Sie auf Weiter, um fortzufahren."
LangString TEXT_PREP_PREV ${LANG_GERMAN} "&Vor der Installation deinstallieren"
LangString TEXT_PREP_NOT ${LANG_GERMAN} "&Nicht deinstallieren"
LangString TEXT_PREP_NOTE ${LANG_GERMAN} "Weitere Versionen von $(^Name), falls vorhanden, können Sie auch durch die \
Uninstall-Anwendung deinstallieren, die sich im 'bin' Ordner der Version, die Sie entfernen möchten, befindet."
; Ready
LangString TEXT_READY_TITLE ${LANG_GERMAN} "Installation durchführen"
LangString TEXT_READY_SUBTITLE ${LANG_GERMAN} "Das Setup ist jetzt bereit $(^Name) zu installieren."
LangString TEXT_READY_BODY ${LANG_GERMAN} "Klicken Sie auf Installieren, um mit der \
Installation zu beginnen, oder auf Züruck, um Ihre Einstellungen zu überprüfen \
oder zu ändern."
LangString TEXT_READY_GROUPHEAD ${LANG_GERMAN} "Setup Einstellungen"
LangString TEXT_READY_TASKLIST_A ${LANG_GERMAN} "Zielverzeichnis:"
LangString TEXT_READY_TASKLIST_B ${LANG_GERMAN} "Startmenü-Ordner:"
LangString TEXT_READY_DESKTOP ${LANG_GERMAN} "&Desktop-Symbol anlegen"
; Finish
LangString M_TEXT_FINISH_INFO_TEXT ${LANG_GERMAN} "$(^NameDA) wurde installiert. Klicken \
Sie auf Fertig, um das Setup abzuschließen."
LangString M_TEXT_FINISH_RUN ${LANG_GERMAN} "$(^NameDA) starten"
LangString M_TEXT_FINISH_SHOWREADME ${LANG_GERMAN} "Help öffnen"
LangString M_BUTTONTEXT_FINISH ${LANG_GERMAN} "&Fertig"
; Shortcut
LangString SHORTCUT_REMOVE ${LANG_GERMAN} "$SMPROGRAMS\$ICONS_GROUP\X TIG (deinstallieren).lnk"
LangString SHORTCUT_README ${LANG_GERMAN} "$INSTDIR\shortcut\Lies Mich.lnk"
LangString SHORTCUT_OBOOK ${LANG_GERMAN} "PDF - 2019 oBook oDition"
LangString SHORTCUT_BERLINER_SM ${LANG_GERMAN} "$SMPROGRAMS\$ICONS_GROUP\Berliner.lnk"
LangString SHORTCUT_BERLINER ${LANG_GERMAN} "HTML Executable Publikation"
LangString SHORTCUT_HTA ${LANG_GERMAN} "Browser Objekt"
LangString SHORTCUT_WELCOME ${LANG_GERMAN} "$INSTDIR\shortcut\Willkommen.lnk"
LangString SHORTCUT_WELCOME_PAGE ${LANG_GERMAN} "Splash Seite"
LangString SHORTCUT_START_PAGE ${LANG_GERMAN} "TIG Menü"
LangString SHORTCUT_HELP_CONTEXT ${LANG_GERMAN} "Help öffnen"
; Message
#LangString MESSAGE_INST_LANG_TITLE ${LANG_GERMAN} "Installations Sprache"
#LangString MESSAGE_INST_LANG_INFO ${LANG_GERMAN} "Bitte wählen Sie eine Sprache."
!ifdef MUI_UN_BANNER
LangString MESSAGE_BANNER_WAIT ${LANG_GERMAN} "Lösche Dateien. Bitte warten..."
LangString MESSAGE_BANNER_REMOVE_DONE ${LANG_GERMAN} "Fertig."
LangString MESSAGE_BANNER_REMOVE_FAIL ${LANG_GERMAN} "Eine oder mehrere Ordner/Dateien in dem Verzeichnis \
$PATH konnten nicht gelöscht werden. Bitte sehen Sie nach. ${crlf}${crlf}\
Klicken Sie auf Abbrechen, um die Installation zu beenden, oder auf OK, um fortzufahren. ${crlf}${crlf}"
!endif
LangString MESSAGE_DIR_USED ${LANG_GERMAN} "Das angegebene Zielverzeichnis ist nicht leer. Bitte ${crlf}\
wählen Sie einen anderen Ordner. ${crlf}${crlf}"
LangString MESSAGE_SMF_USED ${LANG_GERMAN} "Das gewählte Verzeichnis ist nicht leer. Bitte suchen ${crlf}\
Sie einen anderen Startmenü-Ordner aus. ${crlf}${crlf}"
LangString MESSAGE_ABORT ${LANG_GERMAN} "Beim nächsten Mal haben Sie mehr Glück! ${crlf}${crlf}"
LangString MESSAGE_ABORT_ACCESS ${LANG_GERMAN} "Setup kann nicht fortgesetzt werden, weil ein Zugriff \
verweigert ist. ${crlf}\Bitte wenden Sie sich an Ihren System-Administrator. ${crlf}${crlf}"
; DetailPrint
LangString DETAIL_NOT_FOUND ${LANG_GERMAN} "Datei ist nicht vorhanden: "
LangString DETAIL_DATA ${LANG_GERMAN} "Kompremiere Deinstallations-Daten..."
################################## unLanguageStringsFull.nsh ##################################
; Tom’s Image Gallery 2.1 Setup Uninstall (full) Language Strings include (TN)
;--------------------------------
!ifndef MUI_MODIFIED
; MUI 2 changes - English
LangString M_UNTEXT_CONFIRM_TITLE ${LANG_ENGLISH} "Uninstall"
; MUI 2 changes - German
LangString M_UNTEXT_CONFIRM_TITLE ${LANG_GERMAN} "Deinstallation"
!endif
;--------------------------------
; English
LangString M_UNTEXT_WELCOME_INFO_TITLE ${LANG_ENGLISH} " Welcome to the $(^NameDA) Uninstall Setup"
LangString UNTEXT_INFO_TITLE ${LANG_ENGLISH} "$(^NameDA)"
LangString UNTEXT_WELCOME_TITLE ${LANG_ENGLISH} "Good-bye."
LangString M_UNTEXT_WELCOME_INFO_TEXT ${LANG_ENGLISH} "Setup will guide you through the uninstallation of \
$(^NameDA). Please click Next to continue."
LangString M_UNTEXT_FINISH_INFO_TEXT ${LANG_ENGLISH} "$(^NameDA) has been successfully uninstalled from your computer. \
You can click Finish to close Setup."
LangString MESSAGE_UNABORT ${LANG_ENGLISH} "$(^Name) uninstall did not complete successfully. ${crlf}${crlf}"
LangString MESSAGE_UNABORT_N ${LANG_ENGLISH} "The operating system denied access. You do not have ${crlf}\
permission to uninstall $(^Name). Please restart the ${crlf}\
uninstaller with Administrator privileges. ${crlf}${crlf}"
LangString MESSAGE_UNABORT_UAC ${LANG_ENGLISH} "The uninstallation should be run with Administrative privileges. ${crlf}${crlf}"
LangString MESSAGE_UNABORT_PROFILE ${LANG_ENGLISH} "The uninstallation cannot continue because ${crlf}\
access is denied. ${crlf}${crlf}"
#LangString MESSAGE_REMOVE ${LANG_ENGLISH} "Are you sure you want to completely remove $(^Name)? ${crlf}${crlf}"
#LangString MESSAGE_REMOVE_SUCCESS ${LANG_ENGLISH} "$(^Name) has been uninstalled from your computer. ${crlf}${crlf}"
LangString TEXT_HELLO_TITLE ${LANG_ENGLISH} "Hello,"
LangString TEXT_HELLO_SUBTITLE ${LANG_ENGLISH} "And welcome to the $(^Name) Uninstall Wizard."
; DetailPrint
LangString DETAIL_ERRORS ${LANG_ENGLISH} "Locked files:"
LangString DETAIL_REMOVED_S ${LANG_ENGLISH} "$R3 files not deleted."
LangString DETAIL_REMOVED ${LANG_ENGLISH} "$R3 file not deleted."
;--------------------------------
; German
LangString M_UNTEXT_WELCOME_INFO_TITLE ${LANG_GERMAN} " Willkommen zur Deinstallation von $(^NameDA)"
LangString UNTEXT_INFO_TITLE ${LANG_GERMAN} "$(^NameDA)"
LangString UNTEXT_WELCOME_TITLE ${LANG_GERMAN} "Tschüss."
LangString M_UNTEXT_WELCOME_INFO_TEXT ${LANG_GERMAN} "Der Assistent wird Sie durch die Deinstallation von \
$(^NameDA) führen. Klicken Sie auf Weiter, um fortzufahren."
LangString M_UNTEXT_FINISH_INFO_TEXT ${LANG_GERMAN} "Die Deinstallation von $(^NameDA) wurde erfolgreich abgeschlossen. \
Klicken Sie auf Fertig, um den Assistenten zu schließen."
LangString MESSAGE_UNABORT ${LANG_GERMAN} "Die Deinstallation von $(^Name) wurde nicht erfolgreich abgeschlossen. ${crlf}${crlf}"
LangString MESSAGE_UNABORT_N ${LANG_GERMAN} "Das Betriebssystem verweigert den Zugriff. Sie haben keine ${crlf}\
Berechtigung $(^Name) zu entfernen. Bitte starten Sie die ${crlf}\
Deinstallation mit Administratorrechten. ${crlf}${crlf}"
LangString MESSAGE_UNABORT_UAC ${LANG_GERMAN} "Die Deinstallation sollte von einem Benutzer mit ausreichenden ${crlf}\
Rechten, wie z.B. dem Systemadministrator, ausgeführt werden. ${crlf}${crlf}"
LangString MESSAGE_UNABORT_PROFILE ${LANG_GERMAN} "Die Deinstallation kann nicht fortgesetzt werden, ${crlf}\
weil ein Zugriff verweigert ist. ${crlf}${crlf}"
#LangString MESSAGE_REMOVE ${LANG_GERMAN} "Sind Sie sicher, dass Sie $(^Name) komplett entfernen wollen? ${crlf}${crlf}"
#LangString MESSAGE_REMOVE_SUCCESS ${LANG_GERMAN} "$(^Name) wurde von Ihrem Computer deinstalliert. ${crlf}${crlf}"
LangString TEXT_HELLO_TITLE ${LANG_GERMAN} "Hallo."
LangString TEXT_HELLO_SUBTITLE ${LANG_GERMAN} "Und willkommen beim Uninstall-Wizard für $(^Name)."
; DetailPrint
LangString DETAIL_ERRORS ${LANG_GERMAN} "Gesperrte Dateien:"
LangString DETAIL_REMOVED_S ${LANG_GERMAN} "$R3 Dateien nicht gelöscht."
LangString DETAIL_REMOVED ${LANG_GERMAN} "$R3 Datei nicht gelöscht."
###################################### setsize.nsi ######################################
; Tom’s Image Gallery 2.1 Size Script (TN)
; Compile this script and run "setsize.exe" before compiling "TIGsetup.exe"
Name "Set Size"
RequestExecutionLevel user
Unicode false ; use 'true' for unicode
!define LOCAL "..\" ; Path where local include files reside
!ifdef NSIS_UNICODE
!define LOCAL_UA "..\unicode\" ; Path where unicode local include files are
!endif
!ifndef LOCAL_UA
!define LOCAL_UA "..\ansi\" ; Path where ansi local include files are
!endif
OutFile "${LOCAL_UA}setsize.exe"
Icon "${LOCAL}arrows.ico"
!include "LogicLib.nsh"
!include "${LOCAL_UA}TIGmacros.nsh"
ReserveFile /plugin "Math.dll"
ShowInstDetails show
; Variables
Var BLOCK
Var S_X_A
Var S_X_W
Var S_A
Var S_W
Var S_Q
Var S
Var S_I
Var S_NI
Var S_NID
Var S_IDXP
Var S_7
Var S_N7
Var S_TIG
Var S_TIG_
Var S_BMP
Var S_V
Var S_NV
Var S_SC98
Var S_SCXP
Var S_SCV
Var S_SC8
Var S_SC10
Var S_SCF
Var S_JNLP
Var S_TOTAL
Var SOD_X_A
Var SOD_X_W
Var SOD_A
Var SOD_W
Var SOD_Q
Var SOD
Var SOD_I
Var SOD_NI
Var SOD_NID
Var SOD_7
Var SOD_N7
Var SOD_TIG
Var SOD_TIG_
Var SOD_BMP
Var SOD_V
Var SOD_NV
Var SOD_SCF
Var SOD_JNLP
Var F
Var D
Var T_0
Var A_0
Var T_1
Var A_1
Var desktopini
Var thumbsdb
Var everything
;--------------------------------
; Size
Function SectionSize
; physical size in bytes
StrCpy $S_X_A 16 # ; flash trust certificate (approximate) - file written to system folder
StrCpy $S_X_W 34 # ; unicode flash trust certificate (approximate) - file written to system folder
StrCpy $S_A 0 # ; no uninstaller
StrCpy $S_W 0 # ; no unicode uninstaller
IfFileExists "F:\homepage\nsis\bin\uninst.exe" 0 fA ; temporary uninstaller file
${GetSizeOnDisk} "F:\homepage\nsis\bin" "/M=uninst.exe /S=0B /G=0" "" $0 $1 $2 $3
StrCpy $S_A $0 #
fA:
IfFileExists "F:\homepage\nsis\bin\uuninst.exe" 0 fW ; temporary unicode uninstaller file
${GetSizeOnDisk} "F:\homepage\nsis\bin" "/M=uuninst.exe /S=0B /G=0" "" $0 $1 $2 $3
StrCpy $S_W $0 #
fW:
; Shortcut .lnk files are smaller
IntOp $S_SC98 5647 * -1 ; Windows 98
IntOp $S_SCXP 1109 * -1 ; Windows XP
IntOp $S_SCV 695 * -1 ; Windows Vista
; Shortcut .lnk files are larger
StrCpy $S_SC8 72 # ; windows 8+
StrCpy $S_SC10 180 # ; windows 10+
; Quick compile (1 file)
${GetSizeOnDisk} "F:\Gallery" "/M=index.hta /S=0B /G=0" "" $0 $1 $2 $3
StrCpy $S_Q $0 #
; All source files
${GetSizeOnDisk} "F:\Gallery" "/S=0B" "" $0 $1 $2 $3
StrCpy $S $0 #
StrCpy $F $1 #
StrCpy $everything $1
StrCpy $D $2 #
IntOp $F $F + 1 ; uninstaller file
IntOp $D $D + 1 ; bin folder
; menu index.htm file + folder not required
IntOp $S_IDXP 2819 * -1 ; XP+
IntOp $D $D - 1
IntOp $F $F - 1
; subtract files and folders
${GetSizeOnDisk} "F:\Gallery" "/M=*.php /S=0B" "" $0 $1 $2 $3
IntOp $S $S - $0 ; php files (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=desktop.ini /S=0B" "" $0 $1 $2 $3
IntOp $S $S - $0 ; desktop.ini files (not installed)
StrCpy $desktopini $1 #
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=thumbs.db /S=0B" "" $0 $1 $2 $3
IntOp $S $S - $0 ; thumbs.db files (not installed)
StrCpy $thumbsdb $1 #
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=TIG.exe.manifest /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; wxWidgets TIG menu manifest (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=ft*.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=fmo*.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=ht*.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=pid*.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery" "/M=tigp2.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery" "/M=tigp3.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery" "/M=tigp4.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery" "/M=tigp5.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery" "/M=tigp6.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery" "/M=tigp7.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery" "/M=tigp8.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery" "/M=berlinervsfx.exe /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; sfx (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.js /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; js (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.jpg /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; jpg (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.htm /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; htm (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.gif /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; gif (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.css /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; css (not installed)
IntOp $F $F - $1
${GetSizeOnDisk} "F:\Gallery\graphics" "/M=complogo.gif /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; gif file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery\menu" "/M=TIG.exe.widget-unicode /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; old exe file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery\thumbs" "/M=22trisk.jpg /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; jpg file (not installed)
IntOp $F $F - 1
${GetSizeOnDisk} "F:\Gallery\thumbs" "/M=theend3d.jpg /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0 ; jpg file (not installed)
IntOp $F $F - 1
; add files
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=size.js /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S + $0 ; js file (is installed)
IntOp $F $F + $1
; install path == C:\Gallery
${GetSizeOnDisk} "F:\Gallery\acrohome" "/S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_I $0 * -1
${GetSizeOnDisk} "F:\Gallery\js" "/M=ice.js /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_I $S_I - $0
${GetSizeOnDisk} "F:\Gallery\menu" "/M=index.html /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_I $S_I - $0
; install path != C:\Gallery
${GetSizeOnDisk} "F:\Gallery\acroice" "/S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_NI $0 * -1
IntOp $F $F - $1
IntOp $D $D - 1
${GetSizeOnDisk} "F:\Gallery\jsice" "/M=ice.js /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_NI $S_NI - $0
IntOp $F $F - 1
IntOp $D $D - 1
${GetSizeOnDisk} "F:\Gallery\menu" "/M=indexi.html /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_NI $S_NI - $0
IntOp $F $F - 1
; difference
IntOp $S_NID $S_I - $S_NI
; add rtf license
${GetSizeOnDisk} "F:\homepage\nsis" "/M=license.rtf /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S + $0
IntOp $F $F + 1
; htmlexe 4.x version (at least WinVista SP2)
${GetSizeOnDisk} "F:\Gallery" "/M=berliner.exe /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_7 $0 * -1
; htmlexe 3.5 version (pre-WinVista SP2)
${GetSizeOnDisk} "F:\Gallery" "/M=berlinerv.exe /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_N7 $0 * -1
IntOp $F $F - 1
; subtract ansi menu (TIG_.exe)
${GetSizeOnDisk} "F:\Gallery" "/M=TIG.exe /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_TIG_ $0 * -1
; subtract unicode menu (TIG.exe) XP or higher
${GetSizeOnDisk} "F:\Gallery" "/M=TIG_.exe /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_TIG $0 * -1
IntOp $F $F - 1
; subtract menu bmps (pre-XP)
${GetSizeOnDisk} "F:\Gallery\graphics" "/M=*.bmp /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S $S - $0
IntOp $S_BMP $0 * -1
IntOp $F $F - 10
; subtract xp icons (at least WinVista)
${GetSizeOnDisk} "F:\Gallery\icons" "/M=tchaser.ico /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_V $0 * -1
${GetSizeOnDisk} "F:\Gallery\icons" "/M=mmp.ico /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_V $S_V - $0
${GetSizeOnDisk} "F:\Gallery\icons" "/M=oBook.ico /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_V $S_V - $0
${GetSizeOnDisk} "F:\Gallery\icons" "/M=gallery.ico /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_V $S_V - $0
; subtract aero icons (pre-WinVista)
${GetSizeOnDisk} "F:\Gallery\icons" "/M=*v.ico /S=0B /G=0" "" $0 $1 $2 $3
IntOp $S_NV $0 * -1
IntOp $F $F - 4
; runtime variables
${GetSizeOnDisk} "F:\Gallery\shortcut" "/M=*.lnk /S=0B /G=0" "" $0 $1 $2 $3
StrCpy $S_SCF $0 # ; shortcuts
${GetSizeOnDisk} "F:\Gallery" "/M=jtssjar.jnlp /S=0B /G=0" "" $0 $1 $2 $3
StrCpy $S_JNLP $0 # ; java file
; size on disk (logical size) - in kilobytes
StrCpy $BLOCK 4096 #
Math::Script "b = $BLOCK; \
a = $S_X_A; c = a % b; #[c == 0, c = $BLOCK]; \
R1 = (b - c + a) / 1024; \
a = $S_X_W; c = a % b; #[c == 0, c = $BLOCK]; \
R2 = (b - c + a) / 1024; \
a = $S_A; c = a % b; #[c == 0, c = $BLOCK]; \
R3 = (b - c + a) / 1024; \
a = $S_W; c = a % b; #[c == 0, c = $BLOCK]; \
R4 = (b - c + a) / 1024"
StrCpy $SOD_X_A $R1 # ; ansi certificate
StrCpy $SOD_X_W $R2 # ; unicode certificate
StrCpy $SOD_A $R3 # ; ansi uninstaller
StrCpy $SOD_W $R4 # ; unicode uninstaller
; Quick compile (1 file)
${GetSizeOnDisk} "F:\Gallery" "/M=index.hta /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
StrCpy $SOD_Q $0 #
; All source files
${GetSizeOnDisk} "F:\Gallery" "/S=0K" "$BLOCK" $0 $1 $2 $3
StrCpy $SOD $0 #
; subtract files
${GetSizeOnDisk} "F:\Gallery" "/M=*.php /S=0K" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; php files (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=desktop.ini /S=0K" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; desktop.ini files (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=thumbs.db /S=0K" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; thumbs.db files (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=TIG.exe.manifest /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; wxWidgets TIG menu manifest (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=ft*.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=fmo*.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=hta*.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=pid*.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=tigp2.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm file (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=tigp3.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm file (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=tigp4.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm file (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=tigp5.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm file (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=tigp6.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm file (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=tigp7.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm file (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=tigp8.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm file (not installed)
${GetSizeOnDisk} "F:\Gallery" "/M=berlinervsfx.exe /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; sfx (not installed)
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.js /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; js (not installed)
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.jpg /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; jpg (not installed)
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.htm /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; htm (not installed)
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.gif /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; gif (not installed)
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=*.css /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; css (not installed)
${GetSizeOnDisk} "F:\Gallery\graphics" "/M=complogo.gif /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; gif file (not installed)
${GetSizeOnDisk} "F:\Gallery\menu" "/M=TIG.exe.widget-unicode /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; old exe file (not installed)
${GetSizeOnDisk} "F:\Gallery\thumbs" "/M=22trisk.jpg /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; jpg file (not installed)
${GetSizeOnDisk} "F:\Gallery\thumbs" "/M=theend3d.jpg /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0 ; jpg file (not installed)
; add files
${GetSizeOnDisk} "F:\Gallery\aforest" "/M=size.js /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD + $0 ; js file (is installed)
; install path == C:\Gallery
${GetSizeOnDisk} "F:\Gallery\acrohome" "/S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_I $0 * -1
${GetSizeOnDisk} "F:\Gallery\js" "/M=ice.js /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_I $SOD_I - $0
${GetSizeOnDisk} "F:\Gallery\menu" "/M=index.html /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_I $SOD_I - $0
; install path != C:\Gallery
${GetSizeOnDisk} "F:\Gallery\acroice" "/S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_NI $0 * -1
${GetSizeOnDisk} "F:\Gallery\jsice" "/M=ice.js /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_NI $SOD_NI - $0
${GetSizeOnDisk} "F:\Gallery\menu" "/M=indexi.html /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_NI $SOD_NI - $0
; difference
IntOp $SOD_NID $SOD_I - $SOD_NI
; add rtf license
${GetSizeOnDisk} "F:\homepage\nsis" "/M=license.rtf /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD + $0
; htmlexe 4.x version (at least WinVista SP2)
${GetSizeOnDisk} "F:\Gallery" "/M=berliner.exe /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_7 $0 * -1
; htmlexe 3.5 version (pre-WinVista SP2)
${GetSizeOnDisk} "F:\Gallery" "/M=berlinerv.exe /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_N7 $0 * -1
; TIG_.exe - subtract ansi menu (XP+)
${GetSizeOnDisk} "F:\Gallery" "/M=TIG.exe /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_TIG_ $0 * -1
; TIG.exe - subtract unicode menu
${GetSizeOnDisk} "F:\Gallery" "/M=TIG_.exe /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_TIG $0 * -1
; subtract menu bmps (pre-XP)
${GetSizeOnDisk} "F:\Gallery\graphics" "/M=*.bmp /S=0B /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD $SOD - $0
IntOp $SOD_BMP $0 * -1
; subtract xp icons (at least WinVista)
${GetSizeOnDisk} "F:\Gallery\icons" "/M=tchaser.ico /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_V $0 * -1
${GetSizeOnDisk} "F:\Gallery\icons" "/M=mmp.ico /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_V $SOD_V - $0
${GetSizeOnDisk} "F:\Gallery\icons" "/M=oBook.ico /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_V $SOD_V - $0
${GetSizeOnDisk} "F:\Gallery\icons" "/M=gallery.ico /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_V $SOD_V - $0
; subtract aero icons (pre-WinVista)
${GetSizeOnDisk} "F:\Gallery\icons" "/M=*v.ico /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
IntOp $SOD_NV $0 * -1
; runtime variables
${GetSizeOnDisk} "F:\Gallery\shortcut" "/M=*.lnk /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
StrCpy $SOD_SCF $0 # ; shortcuts
${GetSizeOnDisk} "F:\Gallery" "/M=jtssjar.jnlp /S=0K /G=0" "$BLOCK" $0 $1 $2 $3
StrCpy $SOD_JNLP $0 # ; java file
; count the number of "text*.htm" files
FindFirst $0 $1 F:\Gallery\text*.htm
${DoUntil} ${Errors}
${If} ${FileExists} F:\Gallery\$1
IntOp $T_0 $T_0 + 1
${EndIf}
FindNext $0 $1
${Loop}
FindClose $0
; and the number of "add*.htm" files
FindFirst $0 $1 F:\Gallery\add*.htm
${DoUntil} ${Errors}
${If} ${FileExists} F:\Gallery\$1
IntOp $A_0 $A_0 + 1
${EndIf}
FindNext $0 $1
${Loop}
FindClose $0
; count the number of "mo_t*.htm" files
FindFirst $0 $1 F:\Gallery\mo_t*.htm
${DoUntil} ${Errors}
${If} ${FileExists} F:\Gallery\$1
IntOp $T_1 $T_1 + 1
${EndIf}
FindNext $0 $1
${Loop}
FindClose $0
; and the number of "mo_a*.htm" files
FindFirst $0 $1 F:\Gallery\mo_a*.htm
${DoUntil} ${Errors}
${If} ${FileExists} F:\Gallery\$1
IntOp $A_1 $A_1 + 1
${EndIf}
FindNext $0 $1
${Loop}
FindClose $0
!if ${NSIS_PACKEDVERSION} >= 0x03008000
GetWinVer $R4 Build
!else
GetDllVersion "$SysDir\KERNEL32.DLL" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
!endif
${If} $R4 >= 2600 ; XP
${AndIf} $R4 != 3000 ; ME
IntOp $S_BMP $S_BMP * -1 ; positive integer
IntOp $S $S + $S_BMP ; bmp files (installed - xp+)
IntOp $F $F + 10
IntOp $SOD_BMP $SOD_BMP * -1 ; positive integer
IntOp $SOD $SOD + $SOD_BMP ; bmp files (installed - xp+)
${EndIf}
FunctionEnd
!define SectionSize "Call SectionSize"
Section
IntOp $S_TOTAL $S_A + $S
IntOp $S_TOTAL $S_TOTAL + $S_NI
IntOp $S_TOTAL $S_TOTAL + $S_NID
IntOp $S_TOTAL $S_TOTAL + $S_IDXP
IntOp $S_TOTAL $S_TOTAL + $S_7
IntOp $S_TOTAL $S_TOTAL + $S_TIG
IntOp $S_TOTAL $S_TOTAL + $S_V
IntOp $S_TOTAL $S_TOTAL + $S_SC10
DetailPrint "S_X_A $S_X_A"
DetailPrint "S_X_W $S_X_W"
DetailPrint "S_A $S_A †"
DetailPrint "S_W $S_W"
DetailPrint "S_Q $S_Q"
DetailPrint "S_All $S †"
DetailPrint "S_I $S_I"
DetailPrint "S_NI $S_NI †"
DetailPrint "S_NID $S_NID †"
DetailPrint "S_IDXP $S_IDXP †"
DetailPrint "S_Win7 $S_7 †"
DetailPrint "S_WinN7 $S_N7"
DetailPrint "S_TIG $S_TIG †"
DetailPrint "S_TIG_ $S_TIG_"
DetailPrint "S_BMP $S_BMP"
DetailPrint "S_WinV $S_V †"
DetailPrint "S_WinNV $S_NV"
DetailPrint "S_SC98 $S_SC98"
DetailPrint "S_SCXP $S_SCXP"
DetailPrint "S_SCV $S_SCV"
DetailPrint "S_SC8 $S_SC8"
DetailPrint "S_SC10 $S_SC10 †"
DetailPrint "S_SCF $S_SCF"
DetailPrint "S_JNLP $S_JNLP"
DetailPrint "F_FILES $F"
DetailPrint "D_FOLDERS $D"
DetailPrint ""
DetailPrint "SOD_X_A $SOD_X_A"
DetailPrint "SOD_X_W $SOD_X_W"
DetailPrint "SOD_A $SOD_A"
DetailPrint "SOD_W $SOD_W"
DetailPrint "SOD_Q $SOD_Q"
DetailPrint "SOD_All $SOD"
DetailPrint "SOD_I $SOD_I"
DetailPrint "SOD_NI $SOD_NI"
DetailPrint "SOD_NID $SOD_NID"
DetailPrint "SOD_Win7 $SOD_7"
DetailPrint "SOD_WinN7 $SOD_N7"
DetailPrint "SOD_TIG $SOD_TIG"
DetailPrint "SOD_TIG_ $SOD_TIG_"
DetailPrint "SOD_BMP $SOD_BMP"
DetailPrint "SOD_WinV $SOD_V"
DetailPrint "SOD_WinNV $SOD_NV"
DetailPrint "SOD_SCF $SOD_SCF"
DetailPrint "SOD_JNLP $SOD_JNLP"
DetailPrint "F_FILES $F"
DetailPrint "D_FOLDERS $D"
DetailPrint ""
DetailPrint "T_0 $T_0"
DetailPrint "A_0 $A_0"
DetailPrint "T_1 $T_1"
DetailPrint "A_1 $A_1"
DetailPrint ""
DetailPrint "† windows 10/11 total = $S_TOTAL"
## system hidden files ##
DetailPrint "desktop.ini $desktopini"
DetailPrint "thumbs.db $thumbsdb"
DetailPrint ""
DetailPrint "total # of files $everything"
; write to file
; === String All ===
StrCpy $R0 "!define S_X_A $S_X_A$\r$\n!define S_X_W $S_X_W$\r$\n!define S_A $S_A$\r$\n!define S_W $S_W$\r$\n!define S_Q $S_Q\
$\r$\n!define S_All $S$\r$\n!define S_NI $S_NI$\r$\n!define S_NID $S_NID$\r$\n!define S_IDXP $S_IDXP$\r$\n!define S_Win7 $S_7$\r$\n!define S_WinN7 $S_N7\
$\r$\n!define S_TIG $S_TIG$\r$\n!define S_TIG_ $S_TIG_$\r$\n!define S_BMP $S_BMP$\r$\n!define S_WinV $S_V$\r$\n!define S_WinNV $S_NV$\r$\n!define S_SC98 $S_SC98\
$\r$\n!define S_SCXP $S_SCXP$\r$\n!define S_SCV $S_SCV$\r$\n!define S_SC8 $S_SC8$\r$\n!define S_SC10 $S_SC10$\r$\n!define S_SCF $S_SCF\
$\r$\n!define S_JNLP $S_JNLP$\r$\n!define F_FILES $F$\r$\n!define D_FOLDERS $D$\r$\n!define SOD_X_A $SOD_X_A$\r$\n!define SOD_X_W $SOD_X_W\
$\r$\n!define SOD_A $SOD_A$\r$\n!define SOD_W $SOD_W$\r$\n!define SOD_Q $SOD_Q$\r$\n!define SOD_All $SOD$\r$\n!define SOD_NI $SOD_NI\
$\r$\n!define SOD_NID $SOD_NID$\r$\n!define SOD_Win7 $SOD_7$\r$\n!define SOD_WinN7 $SOD_N7$\r$\n!define SOD_TIG $SOD_TIG\
$\r$\n!define SOD_TIG_ $SOD_TIG_$\r$\n!define SOD_BMP $SOD_BMP$\r$\n!define SOD_WinV $SOD_V$\r$\n!define SOD_WinNV $SOD_NV$\r$\n!define SOD_SCF $SOD_SCF\
$\r$\n!define SOD_JNLP $SOD_JNLP$\r$\n!define T_0 $T_0$\r$\n!define A_0 $A_0$\r$\n!define T_1 $T_1$\r$\n!define A_1 $A_1$\r$\n\
$\r$\n## desktopini $desktopini$\r$\n## thumbsdb $thumbsdb$\r$\n" #
; === String S ===
StrCpy $R1 "!define S_X_A $S_X_A$\r$\n!define S_X_W $S_X_W$\r$\n!define S_A $S_A$\r$\n!define S_W $S_W$\r$\n!define S_Q $S_Q\
$\r$\n!define S_All $S$\r$\n!define S_NI $S_NI$\r$\n!define S_NID $S_NID$\r$\n!define S_IDXP $S_IDXP$\r$\n!define S_Win7 $S_7$\r$\n!define S_WinN7 $S_N7\
$\r$\n!define S_TIG $S_TIG$\r$\n!define S_TIG_ $S_TIG_$\r$\n!define S_BMP $S_BMP$\r$\n!define S_WinV $S_V$\r$\n!define S_WinNV $S_NV$\r$\n!define S_SC98 $S_SC98\
$\r$\n!define S_SCXP $S_SCXP$\r$\n!define S_SCV $S_SCV$\r$\n!define S_SC8 $S_SC8$\r$\n!define S_SC10 $S_SC10$\r$\n!define S_SCF $S_SCF\
$\r$\n!define S_JNLP $S_JNLP$\r$\n!define F_FILES $F$\r$\n!define D_FOLDERS $D$\r$\n!define T_0 $T_0$\r$\n!define A_0 $A_0\
$\r$\n!define T_1 $T_1$\r$\n!define A_1 $A_1$\r$\n$\r$\n## desktopini $desktopini$\r$\n## thumbsdb $thumbsdb$\r$\n" #
; === String SOD ===
StrCpy $R2 "!define SOD_X_A $SOD_X_A$\r$\n!define SOD_X_W $SOD_X_W$\r$\n!define SOD_A $SOD_A$\r$\n!define SOD_W $SOD_W$\r$\n!define SOD_Q $SOD_Q\
$\r$\n!define SOD_All $SOD$\r$\n!define SOD_NI $SOD_NI$\r$\n!define SOD_NID $SOD_NID$\r$\n!define SOD_Win7 $SOD_7$\r$\n!define SOD_WinN7 $SOD_N7\
$\r$\n!define SOD_TIG $SOD_TIG$\r$\n!define SOD_TIG_ $SOD_TIG_$\r$\n!define SOD_BMP $SOD_BMP$\r$\n!define SOD_WinV $SOD_V$\r$\n!define SOD_WinNV $SOD_NV\
$\r$\n!define SOD_SCF $SOD_SCF$\r$\n!define SOD_JNLP $SOD_JNLP$\r$\n!define F_FILES $F$\r$\n!define D_FOLDERS $D\
$\r$\n!define T_0 $T_0$\r$\n!define A_0 $A_0$\r$\n!define T_1 $T_1$\r$\n!define A_1 $A_1$\r$\n\
$\r$\n## desktopini $desktopini$\r$\n## thumbsdb $thumbsdb$\r$\n" #
ClearErrors
!ifndef NSIS_UNICODE
FileOpen $0 "F:\homepage\nsis\ansi\setsize.nsh" w
IfErrors completed
FileWrite $0 $R1
!else
FileOpen $0 "F:\homepage\nsis\unicode\setsize.nsh" w
IfErrors completed
FileWriteWord $0 "65279"
FileWriteUTF16LE $0 $R1
!endif
FileClose $0
completed:
SectionEnd
;--------------------------------
; Let's go.
Function .onInit
; Required Space & Estimated Size
${SectionSize}
FunctionEnd
;--------------------------------