michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ################################################################################ michael@0: # Modified versions of macros provided by NSIS michael@0: michael@0: !ifndef OVERRIDES_INCLUDED michael@0: !define OVERRIDES_INCLUDED michael@0: michael@0: !ifndef ___WINVER__NSH___ michael@0: !include WinVer.nsh michael@0: !endif michael@0: michael@0: ; When including a file check if its verbose macro is defined to prevent michael@0: ; loading the file a second time. michael@0: !ifmacrondef TEXTFUNC_VERBOSE michael@0: !include TextFunc.nsh michael@0: !endif michael@0: michael@0: !ifmacrondef FILEFUNC_VERBOSE michael@0: !include FileFunc.nsh michael@0: !endif michael@0: michael@0: !macro __MOZ__WinVer_DefineOSTests WinVer michael@0: !insertmacro __WinVer_DefineOSTest AtLeast ${WinVer} "" michael@0: !insertmacro __WinVer_DefineOSTest Is ${WinVer} "" michael@0: !insertmacro __WinVer_DefineOSTest AtMost ${WinVer} "" michael@0: !macroend michael@0: michael@0: !ifndef WINVER_8 michael@0: !define WINVER_8 0x06020000 ;6.02.9200 michael@0: !insertmacro __MOZ__WinVer_DefineOSTests 8 michael@0: !endif michael@0: michael@0: !ifndef WINVER_8.1 michael@0: !define WINVER_8.1 0x06030000 ;6.03.9600 michael@0: !insertmacro __MOZ__WinVer_DefineOSTests 8.1 michael@0: !endif michael@0: michael@0: !ifndef WINVER_2012 michael@0: !define WINVER_2012 0x06020001 ;6.02.9200 michael@0: !insertmacro __MOZ__WinVer_DefineOSTests 2012 michael@0: !endif michael@0: michael@0: !ifndef WINVER_2012R2 michael@0: !define WINVER_2012R2 0x06030001 ;6.03.9600 michael@0: !insertmacro __MOZ__WinVer_DefineOSTests 2012R2 michael@0: !endif michael@0: michael@0: !verbose push michael@0: !verbose 3 michael@0: !ifndef _OVERRIDE_VERBOSE michael@0: !define _OVERRIDE_VERBOSE 3 michael@0: !endif michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: !define OVERRIDE_VERBOSE `!insertmacro OVERRIDE_VERBOSE` michael@0: !define _OVERRIDE_UN michael@0: !define _OVERRIDE_S michael@0: !verbose pop michael@0: michael@0: !macro OVERRIDE_VERBOSE _VERBOSE michael@0: !verbose push michael@0: !verbose 3 michael@0: !undef _OVERRIDE_VERBOSE michael@0: !define _OVERRIDE_VERBOSE ${_VERBOSE} michael@0: !verbose pop michael@0: !macroend michael@0: michael@0: ; Modified version of Locate from the NSIS File Functions Header v3.4 (it has michael@0: ; the same version in earlier versions of NSIS even though it has changed) that michael@0: ; is distributed with NSIS v2.46-Unicode. This version has the calls to michael@0: ; SetDetailsPrint commented out. michael@0: ; See /include/FileFunc.nsh for more information. michael@0: !macro LocateNoDetailsCall _PATH _OPTIONS _FUNC michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: Push $0 michael@0: Push `${_PATH}` michael@0: Push `${_OPTIONS}` michael@0: GetFunctionAddress $0 `${_FUNC}` michael@0: Push `$0` michael@0: Call LocateNoDetails michael@0: Pop $0 michael@0: !verbose pop michael@0: !macroend michael@0: michael@0: !macro LocateNoDetails michael@0: !ifndef ${_OVERRIDE_UN}LocateNoDetails michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: !define ${_OVERRIDE_UN}LocateNoDetails `!insertmacro ${_OVERRIDE_UN}LocateNoDetailsCall` michael@0: michael@0: Function ${_OVERRIDE_UN}LocateNoDetails michael@0: Exch $2 michael@0: Exch michael@0: Exch $1 michael@0: Exch michael@0: Exch 2 michael@0: Exch $0 michael@0: Exch 2 michael@0: Push $3 michael@0: Push $4 michael@0: Push $5 michael@0: Push $6 michael@0: Push $7 michael@0: Push $8 michael@0: Push $9 michael@0: Push $R6 michael@0: Push $R7 michael@0: Push $R8 michael@0: Push $R9 michael@0: ClearErrors michael@0: michael@0: StrCpy $3 '' michael@0: StrCpy $4 '' michael@0: StrCpy $5 '' michael@0: StrCpy $6 '' michael@0: StrCpy $7 '' michael@0: StrCpy $8 0 michael@0: StrCpy $R7 '' michael@0: michael@0: StrCpy $R9 $0 1 -1 michael@0: StrCmp $R9 '\' 0 +3 michael@0: StrCpy $0 $0 -1 michael@0: goto -3 michael@0: IfFileExists '$0\*.*' 0 error michael@0: michael@0: option: michael@0: StrCpy $R9 $1 1 michael@0: StrCpy $1 $1 '' 1 michael@0: StrCmp $R9 ' ' -2 michael@0: StrCmp $R9 '' sizeset michael@0: StrCmp $R9 '/' 0 -4 michael@0: StrCpy $9 -1 michael@0: IntOp $9 $9 + 1 michael@0: StrCpy $R9 $1 1 $9 michael@0: StrCmp $R9 '' +2 michael@0: StrCmp $R9 '/' 0 -3 michael@0: StrCpy $R8 $1 $9 michael@0: StrCpy $R8 $R8 '' 2 michael@0: StrCpy $R9 $R8 '' -1 michael@0: StrCmp $R9 ' ' 0 +3 michael@0: StrCpy $R8 $R8 -1 michael@0: goto -3 michael@0: StrCpy $R9 $1 2 michael@0: StrCpy $1 $1 '' $9 michael@0: michael@0: StrCmp $R9 'L=' 0 mask michael@0: StrCpy $3 $R8 michael@0: StrCmp $3 '' +6 michael@0: StrCmp $3 'FD' +5 michael@0: StrCmp $3 'F' +4 michael@0: StrCmp $3 'D' +3 michael@0: StrCmp $3 'DE' +2 michael@0: StrCmp $3 'FDE' 0 error michael@0: goto option michael@0: michael@0: mask: michael@0: StrCmp $R9 'M=' 0 size michael@0: StrCpy $4 $R8 michael@0: goto option michael@0: michael@0: size: michael@0: StrCmp $R9 'S=' 0 gotosubdir michael@0: StrCpy $6 $R8 michael@0: goto option michael@0: michael@0: gotosubdir: michael@0: StrCmp $R9 'G=' 0 banner michael@0: StrCpy $7 $R8 michael@0: StrCmp $7 '' +3 michael@0: StrCmp $7 '1' +2 michael@0: StrCmp $7 '0' 0 error michael@0: goto option michael@0: michael@0: banner: michael@0: StrCmp $R9 'B=' 0 error michael@0: StrCpy $R7 $R8 michael@0: StrCmp $R7 '' +3 michael@0: StrCmp $R7 '1' +2 michael@0: StrCmp $R7 '0' 0 error michael@0: goto option michael@0: michael@0: sizeset: michael@0: StrCmp $6 '' default michael@0: StrCpy $9 0 michael@0: StrCpy $R9 $6 1 $9 michael@0: StrCmp $R9 '' +4 michael@0: StrCmp $R9 ':' +3 michael@0: IntOp $9 $9 + 1 michael@0: goto -4 michael@0: StrCpy $5 $6 $9 michael@0: IntOp $9 $9 + 1 michael@0: StrCpy $1 $6 1 -1 michael@0: StrCpy $6 $6 -1 $9 michael@0: StrCmp $5 '' +2 michael@0: IntOp $5 $5 + 0 michael@0: StrCmp $6 '' +2 michael@0: IntOp $6 $6 + 0 michael@0: michael@0: StrCmp $1 'B' 0 +3 michael@0: StrCpy $1 1 michael@0: goto default michael@0: StrCmp $1 'K' 0 +3 michael@0: StrCpy $1 1024 michael@0: goto default michael@0: StrCmp $1 'M' 0 +3 michael@0: StrCpy $1 1048576 michael@0: goto default michael@0: StrCmp $1 'G' 0 error michael@0: StrCpy $1 1073741824 michael@0: michael@0: default: michael@0: StrCmp $3 '' 0 +2 michael@0: StrCpy $3 'FD' michael@0: StrCmp $4 '' 0 +2 michael@0: StrCpy $4 '*.*' michael@0: StrCmp $7 '' 0 +2 michael@0: StrCpy $7 '1' michael@0: StrCmp $R7 '' 0 +2 michael@0: StrCpy $R7 '0' michael@0: StrCpy $7 'G$7B$R7' michael@0: michael@0: StrCpy $8 1 michael@0: Push $0 michael@0: ; SetDetailsPrint textonly michael@0: michael@0: nextdir: michael@0: IntOp $8 $8 - 1 michael@0: Pop $R8 michael@0: michael@0: StrCpy $9 $7 2 2 michael@0: StrCmp $9 'B0' +3 michael@0: GetLabelAddress $9 findfirst michael@0: goto call michael@0: ; DetailPrint 'Search in: $R8' michael@0: michael@0: findfirst: michael@0: FindFirst $0 $R7 '$R8\$4' michael@0: IfErrors subdir michael@0: StrCmp $R7 '.' 0 dir michael@0: FindNext $0 $R7 michael@0: StrCmp $R7 '..' 0 dir michael@0: FindNext $0 $R7 michael@0: IfErrors 0 dir michael@0: FindClose $0 michael@0: goto subdir michael@0: michael@0: dir: michael@0: IfFileExists '$R8\$R7\*.*' 0 file michael@0: StrCpy $R6 '' michael@0: StrCmp $3 'DE' +4 michael@0: StrCmp $3 'FDE' +3 michael@0: StrCmp $3 'FD' precall michael@0: StrCmp $3 'F' findnext precall michael@0: FindFirst $9 $R9 '$R8\$R7\*.*' michael@0: StrCmp $R9 '.' 0 +4 michael@0: FindNext $9 $R9 michael@0: StrCmp $R9 '..' 0 +2 michael@0: FindNext $9 $R9 michael@0: FindClose $9 michael@0: IfErrors precall findnext michael@0: michael@0: file: michael@0: StrCmp $3 'FDE' +3 michael@0: StrCmp $3 'FD' +2 michael@0: StrCmp $3 'F' 0 findnext michael@0: StrCpy $R6 0 michael@0: StrCmp $5$6 '' precall michael@0: FileOpen $9 '$R8\$R7' r michael@0: IfErrors +3 michael@0: FileSeek $9 0 END $R6 michael@0: FileClose $9 michael@0: System::Int64Op $R6 / $1 michael@0: Pop $R6 michael@0: StrCmp $5 '' +2 michael@0: IntCmp $R6 $5 0 findnext michael@0: StrCmp $6 '' +2 michael@0: IntCmp $R6 $6 0 0 findnext michael@0: michael@0: precall: michael@0: StrCpy $9 0 michael@0: StrCpy $R9 '$R8\$R7' michael@0: michael@0: call: michael@0: Push $0 michael@0: Push $1 michael@0: Push $2 michael@0: Push $3 michael@0: Push $4 michael@0: Push $5 michael@0: Push $6 michael@0: Push $7 michael@0: Push $8 michael@0: Push $9 michael@0: Push $R7 michael@0: Push $R8 michael@0: StrCmp $9 0 +4 michael@0: StrCpy $R6 '' michael@0: StrCpy $R7 '' michael@0: StrCpy $R9 '' michael@0: Call $2 michael@0: Pop $R9 michael@0: Pop $R8 michael@0: Pop $R7 michael@0: Pop $9 michael@0: Pop $8 michael@0: Pop $7 michael@0: Pop $6 michael@0: Pop $5 michael@0: Pop $4 michael@0: Pop $3 michael@0: Pop $2 michael@0: Pop $1 michael@0: Pop $0 michael@0: michael@0: IfErrors 0 +3 michael@0: FindClose $0 michael@0: goto error michael@0: StrCmp $R9 'StopLocateNoDetails' 0 +3 michael@0: FindClose $0 michael@0: goto clearstack michael@0: goto $9 michael@0: michael@0: findnext: michael@0: FindNext $0 $R7 michael@0: IfErrors 0 dir michael@0: FindClose $0 michael@0: michael@0: subdir: michael@0: StrCpy $9 $7 2 michael@0: StrCmp $9 'G0' end michael@0: FindFirst $0 $R7 '$R8\*.*' michael@0: StrCmp $R7 '.' 0 pushdir michael@0: FindNext $0 $R7 michael@0: StrCmp $R7 '..' 0 pushdir michael@0: FindNext $0 $R7 michael@0: IfErrors 0 pushdir michael@0: FindClose $0 michael@0: StrCmp $8 0 end nextdir michael@0: michael@0: pushdir: michael@0: IfFileExists '$R8\$R7\*.*' 0 +3 michael@0: Push '$R8\$R7' michael@0: IntOp $8 $8 + 1 michael@0: FindNext $0 $R7 michael@0: IfErrors 0 pushdir michael@0: FindClose $0 michael@0: StrCmp $8 0 end nextdir michael@0: michael@0: error: michael@0: SetErrors michael@0: michael@0: clearstack: michael@0: StrCmp $8 0 end michael@0: IntOp $8 $8 - 1 michael@0: Pop $R8 michael@0: goto clearstack michael@0: michael@0: end: michael@0: ; SetDetailsPrint both michael@0: Pop $R9 michael@0: Pop $R8 michael@0: Pop $R7 michael@0: Pop $R6 michael@0: Pop $9 michael@0: Pop $8 michael@0: Pop $7 michael@0: Pop $6 michael@0: Pop $5 michael@0: Pop $4 michael@0: Pop $3 michael@0: Pop $2 michael@0: Pop $1 michael@0: Pop $0 michael@0: FunctionEnd michael@0: michael@0: !verbose pop michael@0: !endif michael@0: !macroend michael@0: michael@0: !macro un.LocateNoDetailsCall _PATH _OPTIONS _FUNC michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: Push $0 michael@0: Push `${_PATH}` michael@0: Push `${_OPTIONS}` michael@0: GetFunctionAddress $0 `${_FUNC}` michael@0: Push `$0` michael@0: Call un.LocateNoDetails michael@0: Pop $0 michael@0: !verbose pop michael@0: !macroend michael@0: michael@0: !macro un.LocateNoDetails michael@0: !ifndef un.LocateNoDetails michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: !undef _OVERRIDE_UN michael@0: !define _OVERRIDE_UN `un.` michael@0: michael@0: !insertmacro LocateNoDetails michael@0: michael@0: !undef _OVERRIDE_UN michael@0: !define _OVERRIDE_UN michael@0: !verbose pop michael@0: !endif michael@0: !macroend michael@0: michael@0: ; Modified version of TextCompare from the NSIS Text Functions Header v2.4 (it michael@0: ; has the same version in earlier versions of NSIS even though it has changed) michael@0: ; that is distributed with NSIS v2.46-Unicode. This version has the calls to michael@0: ; SetDetailsPrint commented out. michael@0: ; See /include/TextFunc.nsh for more information. michael@0: !macro TextCompareNoDetailsCall _FILE1 _FILE2 _OPTION _FUNC michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: Push $0 michael@0: Push `${_FILE1}` michael@0: Push `${_FILE2}` michael@0: Push `${_OPTION}` michael@0: GetFunctionAddress $0 `${_FUNC}` michael@0: Push `$0` michael@0: ${CallArtificialFunction} TextCompareNoDetails_ michael@0: Pop $0 michael@0: !verbose pop michael@0: !macroend michael@0: michael@0: !macro TextCompareNoDetailsSCall _FILE1 _FILE2 _OPTION _FUNC michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: Push $0 michael@0: Push `${_FILE1}` michael@0: Push `${_FILE2}` michael@0: Push `${_OPTION}` michael@0: GetFunctionAddress $0 `${_FUNC}` michael@0: Push `$0` michael@0: ${CallArtificialFunction} TextCompareNoDetailsS_ michael@0: Pop $0 michael@0: !verbose pop michael@0: !macroend michael@0: michael@0: michael@0: !macro TextCompareNoDetailsBody _OVERRIDE_S michael@0: Exch $3 michael@0: Exch michael@0: Exch $2 michael@0: Exch michael@0: Exch 2 michael@0: Exch $1 michael@0: Exch 2 michael@0: Exch 3 michael@0: Exch $0 michael@0: Exch 3 michael@0: Push $4 michael@0: Push $5 michael@0: Push $6 michael@0: Push $7 michael@0: Push $8 michael@0: Push $9 michael@0: ClearErrors michael@0: michael@0: IfFileExists $0 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error michael@0: IfFileExists $1 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error michael@0: StrCmp $2 'FastDiff' +5 michael@0: StrCmp $2 'FastEqual' +4 michael@0: StrCmp $2 'SlowDiff' +3 michael@0: StrCmp $2 'SlowEqual' +2 michael@0: goto TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error michael@0: michael@0: FileOpen $4 $0 r michael@0: IfErrors TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error michael@0: FileOpen $5 $1 r michael@0: IfErrors TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error michael@0: ; SetDetailsPrint textonly michael@0: michael@0: StrCpy $6 0 michael@0: StrCpy $8 0 michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline: michael@0: StrCmp${_OVERRIDE_S} $4 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast michael@0: IntOp $8 $8 + 1 michael@0: FileRead $4 $9 michael@0: IfErrors 0 +4 michael@0: FileClose $4 michael@0: StrCpy $4 '' michael@0: StrCmp${_OVERRIDE_S} $5 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end michael@0: StrCmp $2 'FastDiff' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast michael@0: StrCmp $2 'FastEqual' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slow michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast: michael@0: StrCmp${_OVERRIDE_S} $5 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call michael@0: IntOp $6 $6 + 1 michael@0: FileRead $5 $7 michael@0: IfErrors 0 +5 michael@0: FileClose $5 michael@0: StrCpy $5 '' michael@0: StrCmp${_OVERRIDE_S} $4 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end michael@0: StrCmp $2 'FastDiff' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call TextFunc_TextCompareNoDetails${_OVERRIDE_S}_close michael@0: StrCmp $2 'FastDiff' 0 +2 michael@0: StrCmp${_OVERRIDE_S} $7 $9 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call michael@0: StrCmp${_OVERRIDE_S} $7 $9 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slow: michael@0: StrCmp${_OVERRIDE_S} $4 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_close michael@0: StrCpy $6 '' michael@0: ; DetailPrint '$8. $9' michael@0: FileSeek $5 0 michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slownext: michael@0: FileRead $5 $7 michael@0: IfErrors 0 +2 michael@0: StrCmp $2 'SlowDiff' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline michael@0: StrCmp $2 'SlowDiff' 0 +2 michael@0: StrCmp${_OVERRIDE_S} $7 $9 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slownext michael@0: IntOp $6 $6 + 1 michael@0: StrCmp${_OVERRIDE_S} $7 $9 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slownext michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call: michael@0: Push $2 michael@0: Push $3 michael@0: Push $4 michael@0: Push $5 michael@0: Push $6 michael@0: Push $7 michael@0: Push $8 michael@0: Push $9 michael@0: Call $3 michael@0: Pop $0 michael@0: Pop $9 michael@0: Pop $8 michael@0: Pop $7 michael@0: Pop $6 michael@0: Pop $5 michael@0: Pop $4 michael@0: Pop $3 michael@0: Pop $2 michael@0: StrCmp $0 'StopTextCompareNoDetails' 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_close: michael@0: FileClose $4 michael@0: FileClose $5 michael@0: goto TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error: michael@0: SetErrors michael@0: michael@0: TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end: michael@0: ; SetDetailsPrint both michael@0: Pop $9 michael@0: Pop $8 michael@0: Pop $7 michael@0: Pop $6 michael@0: Pop $5 michael@0: Pop $4 michael@0: Pop $3 michael@0: Pop $2 michael@0: Pop $1 michael@0: Pop $0 michael@0: !macroend michael@0: michael@0: !define TextCompareNoDetails `!insertmacro TextCompareNoDetailsCall` michael@0: !define un.TextCompareNoDetails `!insertmacro TextCompareNoDetailsCall` michael@0: michael@0: !macro TextCompareNoDetails michael@0: !macroend michael@0: michael@0: !macro un.TextCompareNoDetails michael@0: !macroend michael@0: michael@0: !macro TextCompareNoDetails_ michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: michael@0: !insertmacro TextCompareNoDetailsBody '' michael@0: michael@0: !verbose pop michael@0: !macroend michael@0: michael@0: !define TextCompareNoDetailsS `!insertmacro TextCompareNoDetailsSCall` michael@0: !define un.TextCompareNoDetailsS `!insertmacro TextCompareNoDetailsSCall` michael@0: michael@0: !macro TextCompareNoDetailsS michael@0: !macroend michael@0: michael@0: !macro un.TextCompareNoDetailsS michael@0: !macroend michael@0: michael@0: !macro TextCompareNoDetailsS_ michael@0: !verbose push michael@0: !verbose ${_OVERRIDE_VERBOSE} michael@0: michael@0: !insertmacro TextCompareNoDetailsBody 'S' michael@0: michael@0: !verbose pop michael@0: !macroend michael@0: michael@0: !endif