Add custom QZ Tray fork with pairing key authentication
- Custom fork of QZ Tray 2.2.x with certificate validation bypassed - Implemented pairing key (HMAC) authentication as replacement - Modified files: PrintSocketClient.java (certificate check disabled) - New files: PairingAuth.java, PairingConfigDialog.java - Excluded build artifacts (out/, lib/javafx*) from repository - Library JARs included for dependency management
This commit is contained in:
143
tray/ant/windows/nsis/Include/FindJava.nsh
Normal file
143
tray/ant/windows/nsis/Include/FindJava.nsh
Normal file
@@ -0,0 +1,143 @@
|
||||
!include FileFunc.nsh
|
||||
!include LogicLib.nsh
|
||||
!include x64.nsh
|
||||
|
||||
!include StrRep.nsh
|
||||
!include IndexOf.nsh
|
||||
!include StrTok.nsh
|
||||
|
||||
; Resulting variable
|
||||
Var /GLOBAL java
|
||||
Var /GLOBAL javaw
|
||||
Var /GLOBAL java_major
|
||||
|
||||
; Constants
|
||||
!define EXE "java.exe"
|
||||
|
||||
!define ADOPT "SOFTWARE\Classes\AdoptOpenJDK.jarfile\shell\open\command"
|
||||
!define ECLIPSE "SOFTWARE\Classes\Eclipse Adoptium.jarfile\shell\open\command"
|
||||
!define ECLIPSE_OLD "SOFTWARE\Classes\Eclipse Foundation.jarfile\shell\open\command"
|
||||
|
||||
!define JRE "Software\JavaSoft\Java Runtime Environment"
|
||||
!define JRE32 "Software\Wow6432Node\JavaSoft\Java Runtime Environment"
|
||||
!define JDK "Software\JavaSoft\JDK"
|
||||
!define JDK32 "Software\Wow6432Node\JavaSoft\JDK"
|
||||
|
||||
; Macros
|
||||
!macro _ReadEclipseKey
|
||||
ClearErrors
|
||||
ReadRegStr $0 HKLM "${ECLIPSE}" ""
|
||||
StrCpy $0 "$0" "" 1 ; Remove first double-quote
|
||||
${IndexOf} $1 $0 "$\"" ; Find the index of second double-quote
|
||||
StrCpy $0 "$0" $1 ; Get the string section up to the index
|
||||
IfFileExists "$0" Found
|
||||
!macroend
|
||||
|
||||
!macro _ReadEclipseOldKey
|
||||
ClearErrors
|
||||
ReadRegStr $0 HKLM "${ECLIPSE_OLD}" ""
|
||||
StrCpy $0 "$0" "" 1 ; Remove first double-quote
|
||||
${IndexOf} $1 $0 "$\"" ; Find the index of second double-quote
|
||||
StrCpy $0 "$0" $1 ; Get the string section up to the index
|
||||
IfFileExists "$0" Found
|
||||
!macroend
|
||||
|
||||
!macro _ReadAdoptKey
|
||||
ClearErrors
|
||||
ReadRegStr $0 HKLM "${ADOPT}" ""
|
||||
StrCpy $0 "$0" "" 1 ; Remove first double-quote
|
||||
${IndexOf} $1 $0 "$\"" ; Find the index of second double-quote
|
||||
StrCpy $0 "$0" $1 ; Get the string section up to the index
|
||||
IfFileExists "$0" Found
|
||||
!macroend
|
||||
|
||||
!macro _ReadReg key
|
||||
ClearErrors
|
||||
ReadRegStr $0 HKLM "${key}" "CurrentVersion"
|
||||
ReadRegStr $0 HKLM "${key}\$0" "JavaHome"
|
||||
IfErrors +2 0
|
||||
StrCpy $0 "$0\bin\${EXE}"
|
||||
IfFileExists "$0" Found
|
||||
!macroend
|
||||
|
||||
!macro _ReadPayload root path
|
||||
ClearErrors
|
||||
StrCpy $0 "${root}\${path}\bin\${EXE}"
|
||||
IfFileExists $0 Found
|
||||
!macroend
|
||||
|
||||
!macro _ReadWorking path
|
||||
ClearErrors
|
||||
StrCpy $0 "$EXEDIR\${path}\bin\${EXE}"
|
||||
IfFileExists $0 Found
|
||||
!macroend
|
||||
|
||||
!macro _ReadEnv var
|
||||
ClearErrors
|
||||
ReadEnvStr $0 "${var}"
|
||||
StrCpy $0 "$0\bin\${EXE}"
|
||||
IfFileExists "$0" Found
|
||||
!macroend
|
||||
|
||||
; Create the shared function.
|
||||
!macro _FindJava un
|
||||
Function ${un}FindJava
|
||||
; Snag payload directory off the stack
|
||||
exch $R0
|
||||
|
||||
${If} ${RunningX64}
|
||||
SetRegView 64
|
||||
${EndIf}
|
||||
|
||||
; Check payload directories
|
||||
!insertmacro _ReadPayload "$R0" "runtime"
|
||||
|
||||
; Check relative directories
|
||||
!insertmacro _ReadWorking "runtime"
|
||||
!insertmacro _ReadWorking "jre"
|
||||
|
||||
; Check common env vars
|
||||
!insertmacro _ReadEnv "JAVA_HOME"
|
||||
|
||||
; Check registry
|
||||
!insertmacro _ReadEclipseKey
|
||||
!insertmacro _ReadEclipseOldKey
|
||||
!insertmacro _ReadAdoptKey
|
||||
!insertmacro _ReadReg "${JRE}"
|
||||
!insertmacro _ReadReg "${JRE32}"
|
||||
!insertmacro _ReadReg "${JDK}"
|
||||
!insertmacro _ReadReg "${JDK32}"
|
||||
|
||||
; Give up. Use java.exe and hope it works
|
||||
StrCpy $0 "${EXE}"
|
||||
|
||||
; Set global var
|
||||
Found:
|
||||
StrCpy $java $0
|
||||
${StrRep} '$java' '$java' 'javaw.exe' '${EXE}' ; AdoptOpenJDK returns "javaw.exe"
|
||||
${StrRep} '$javaw' '$java' '${EXE}' 'javaw.exe'
|
||||
|
||||
; Discard payload directory
|
||||
pop $R0
|
||||
|
||||
; Detect java version
|
||||
nsExec::ExecToStack '"$java" -version'
|
||||
Pop $0
|
||||
Pop $1
|
||||
; Isolate version number, e.g. "1.8.0"
|
||||
${StrTok} $0 "$1" "$\"" "1" "1"
|
||||
; Isolate major version
|
||||
${StrTok} $R0 "$0" "." "0" "1"
|
||||
; Handle old 1.x.x version format
|
||||
${If} "$R0" == "1"
|
||||
${StrTok} $R0 "$0" "." "1" "1"
|
||||
${EndIf}
|
||||
|
||||
; Convert to integer
|
||||
IntOp $java_major $R0 + 0
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
; Allows registering identical functions for install and uninstall
|
||||
!insertmacro _FindJava ""
|
||||
;!insertmacro _FindJava "un."
|
||||
28
tray/ant/windows/nsis/Include/IndexOf.nsh
Normal file
28
tray/ant/windows/nsis/Include/IndexOf.nsh
Normal file
@@ -0,0 +1,28 @@
|
||||
!define IndexOf "!insertmacro IndexOf"
|
||||
|
||||
!macro IndexOf Var Str Char
|
||||
Push "${Char}"
|
||||
Push "${Str}"
|
||||
|
||||
Exch $R0
|
||||
Exch
|
||||
Exch $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
|
||||
StrCpy $R3 $R0
|
||||
StrCpy $R0 -1
|
||||
IntOp $R0 $R0 + 1
|
||||
StrCpy $R2 $R3 1 $R0
|
||||
StrCmp $R2 "" +2
|
||||
StrCmp $R2 $R1 +2 -3
|
||||
|
||||
StrCpy $R0 -1
|
||||
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
|
||||
Pop "${Var}"
|
||||
!macroend
|
||||
5
tray/ant/windows/nsis/Include/SetTitleBar.nsh
Normal file
5
tray/ant/windows/nsis/Include/SetTitleBar.nsh
Normal file
@@ -0,0 +1,5 @@
|
||||
; Allow title masquerading
|
||||
!define SetTitleBar "!insertmacro SetTitleBar"
|
||||
!macro SetTitlebar title
|
||||
SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:${title}"
|
||||
!macroend
|
||||
501
tray/ant/windows/nsis/Include/StdUtils.nsh
Normal file
501
tray/ant/windows/nsis/Include/StdUtils.nsh
Normal file
@@ -0,0 +1,501 @@
|
||||
#################################################################################
|
||||
# StdUtils plug-in for NSIS
|
||||
# Copyright (C) 2004-2018 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# http://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
#################################################################################
|
||||
|
||||
# DEVELOPER NOTES:
|
||||
# - Please see "https://github.com/lordmulder/stdutils/" for news and updates!
|
||||
# - Please see "Docs\StdUtils\StdUtils.html" for detailed function descriptions!
|
||||
# - Please see "Examples\StdUtils\StdUtilsTest.nsi" for usage examples!
|
||||
|
||||
#################################################################################
|
||||
# FUNCTION DECLARTIONS
|
||||
#################################################################################
|
||||
|
||||
!ifndef ___STDUTILS__NSH___
|
||||
!define ___STDUTILS__NSH___
|
||||
|
||||
!define StdUtils.Time '!insertmacro _StdU_Time' #time(), as in C standard library
|
||||
!define StdUtils.GetMinutes '!insertmacro _StdU_GetMinutes' #GetSystemTimeAsFileTime(), returns the number of minutes
|
||||
!define StdUtils.GetHours '!insertmacro _StdU_GetHours' #GetSystemTimeAsFileTime(), returns the number of hours
|
||||
!define StdUtils.GetDays '!insertmacro _StdU_GetDays' #GetSystemTimeAsFileTime(), returns the number of days
|
||||
!define StdUtils.Rand '!insertmacro _StdU_Rand' #rand(), as in C standard library
|
||||
!define StdUtils.RandMax '!insertmacro _StdU_RandMax' #rand(), as in C standard library, with maximum value
|
||||
!define StdUtils.RandMinMax '!insertmacro _StdU_RandMinMax' #rand(), as in C standard library, with minimum/maximum value
|
||||
!define StdUtils.RandList '!insertmacro _StdU_RandList' #rand(), as in C standard library, with list support
|
||||
!define StdUtils.RandBytes '!insertmacro _StdU_RandBytes' #Generates random bytes, returned as Base64-encoded string
|
||||
!define StdUtils.FormatStr '!insertmacro _StdU_FormatStr' #sprintf(), as in C standard library, one '%d' placeholder
|
||||
!define StdUtils.FormatStr2 '!insertmacro _StdU_FormatStr2' #sprintf(), as in C standard library, two '%d' placeholders
|
||||
!define StdUtils.FormatStr3 '!insertmacro _StdU_FormatStr3' #sprintf(), as in C standard library, three '%d' placeholders
|
||||
!define StdUtils.ScanStr '!insertmacro _StdU_ScanStr' #sscanf(), as in C standard library, one '%d' placeholder
|
||||
!define StdUtils.ScanStr2 '!insertmacro _StdU_ScanStr2' #sscanf(), as in C standard library, two '%d' placeholders
|
||||
!define StdUtils.ScanStr3 '!insertmacro _StdU_ScanStr3' #sscanf(), as in C standard library, three '%d' placeholders
|
||||
!define StdUtils.TrimStr '!insertmacro _StdU_TrimStr' #Remove whitspaces from string, left and right
|
||||
!define StdUtils.TrimStrLeft '!insertmacro _StdU_TrimStrLeft' #Remove whitspaces from string, left side only
|
||||
!define StdUtils.TrimStrRight '!insertmacro _StdU_TrimStrRight' #Remove whitspaces from string, right side only
|
||||
!define StdUtils.RevStr '!insertmacro _StdU_RevStr' #Reverse a string, e.g. "reverse me" <-> "em esrever"
|
||||
!define StdUtils.ValidFileName '!insertmacro _StdU_ValidFileName' #Test whether string is a valid file name - no paths allowed
|
||||
!define StdUtils.ValidPathSpec '!insertmacro _StdU_ValidPathSpec' #Test whether string is a valid full(!) path specification
|
||||
!define StdUtils.ValidDomainName '!insertmacro _StdU_ValidDomain' #Test whether string is a valid host name or domain name
|
||||
!define StdUtils.StrToUtf8 '!insertmacro _StdU_StrToUtf8' #Convert string from Unicode (UTF-16) or ANSI to UTF-8 bytes
|
||||
!define StdUtils.StrFromUtf8 '!insertmacro _StdU_StrFromUtf8' #Convert string from UTF-8 bytes to Unicode (UTF-16) or ANSI
|
||||
!define StdUtils.SHFileMove '!insertmacro _StdU_SHFileMove' #SHFileOperation(), using the FO_MOVE operation
|
||||
!define StdUtils.SHFileCopy '!insertmacro _StdU_SHFileCopy' #SHFileOperation(), using the FO_COPY operation
|
||||
!define StdUtils.AppendToFile '!insertmacro _StdU_AppendToFile' #Append contents of an existing file to another file
|
||||
!define StdUtils.ExecShellAsUser '!insertmacro _StdU_ExecShlUser' #ShellExecute() as NON-elevated user from elevated installer
|
||||
!define StdUtils.InvokeShellVerb '!insertmacro _StdU_InvkeShlVrb' #Invokes a "shell verb", e.g. for pinning items to the taskbar
|
||||
!define StdUtils.ExecShellWaitEx '!insertmacro _StdU_ExecShlWaitEx' #ShellExecuteEx(), returns the handle of the new process
|
||||
!define StdUtils.WaitForProcEx '!insertmacro _StdU_WaitForProcEx' #WaitForSingleObject(), e.g. to wait for a running process
|
||||
!define StdUtils.GetParameter '!insertmacro _StdU_GetParameter' #Get the value of a specific command-line option
|
||||
!define StdUtils.TestParameter '!insertmacro _StdU_TestParameter' #Test whether a specific command-line option has been set
|
||||
!define StdUtils.ParameterCnt '!insertmacro _StdU_ParameterCnt' #Get number of command-line tokens, similar to argc in main()
|
||||
!define StdUtils.ParameterStr '!insertmacro _StdU_ParameterStr' #Get the n-th command-line token, similar to argv[i] in main()
|
||||
!define StdUtils.GetAllParameters '!insertmacro _StdU_GetAllParams' #Get complete command-line, but without executable name
|
||||
!define StdUtils.GetRealOSVersion '!insertmacro _StdU_GetRealOSVer' #Get the *real* Windows version number, even on Windows 8.1+
|
||||
!define StdUtils.GetRealOSBuildNo '!insertmacro _StdU_GetRealOSBld' #Get the *real* Windows build number, even on Windows 8.1+
|
||||
!define StdUtils.GetRealOSName '!insertmacro _StdU_GetRealOSStr' #Get the *real* Windows version, as a "friendly" name
|
||||
!define StdUtils.GetOSEdition '!insertmacro _StdU_GetOSEdition' #Get the Windows edition, i.e. "workstation" or "server"
|
||||
!define StdUtils.GetOSReleaseId '!insertmacro _StdU_GetOSRelIdNo' #Get the Windows release identifier (on Windows 10)
|
||||
!define StdUtils.GetOSReleaseName '!insertmacro _StdU_GetOSRelIdStr' #Get the Windows release (on Windows 10), as a "friendly" name
|
||||
!define StdUtils.VerifyOSVersion '!insertmacro _StdU_VrfyRealOSVer' #Compare *real* operating system to an expected version number
|
||||
!define StdUtils.VerifyOSBuildNo '!insertmacro _StdU_VrfyRealOSBld' #Compare *real* operating system to an expected build number
|
||||
!define StdUtils.HashText '!insertmacro _StdU_HashText' #Compute hash from text string (CRC32, MD5, SHA1/2/3, BLAKE2)
|
||||
!define StdUtils.HashFile '!insertmacro _StdU_HashFile' #Compute hash from file (CRC32, MD5, SHA1/2/3, BLAKE2)
|
||||
!define StdUtils.NormalizePath '!insertmacro _StdU_NormalizePath' #Simplifies the path to produce a direct, well-formed path
|
||||
!define StdUtils.GetParentPath '!insertmacro _StdU_GetParentPath' #Get parent path by removing the last component from the path
|
||||
!define StdUtils.SplitPath '!insertmacro _StdU_SplitPath' #Split the components of the given path
|
||||
!define StdUtils.GetDrivePart '!insertmacro _StdU_GetDrivePart' #Get drive component of path
|
||||
!define StdUtils.GetDirectoryPart '!insertmacro _StdU_GetDirPart' #Get directory component of path
|
||||
!define StdUtils.GetFileNamePart '!insertmacro _StdU_GetFNamePart' #Get file name component of path
|
||||
!define StdUtils.GetExtensionPart '!insertmacro _StdU_GetExtnPart' #Get file extension component of path
|
||||
!define StdUtils.TimerCreate '!insertmacro _StdU_TimerCreate' #Create a new event-timer that will be triggered periodically
|
||||
!define StdUtils.TimerDestroy '!insertmacro _StdU_TimerDestroy' #Destroy a running timer created with TimerCreate()
|
||||
!define StdUtils.ProtectStr '!insertmacro _StdU_PrtctStr' #Protect a given String using Windows' DPAPI
|
||||
!define StdUtils.UnprotectStr '!insertmacro _StdU_UnprtctStr' #Unprotect a string that was protected via ProtectStr()
|
||||
!define StdUtils.GetLibVersion '!insertmacro _StdU_GetLibVersion' #Get the current StdUtils library version (for debugging)
|
||||
!define StdUtils.SetVerbose '!insertmacro _StdU_SetVerbose' #Enable or disable "verbose" mode (for debugging)
|
||||
|
||||
|
||||
#################################################################################
|
||||
# MACRO DEFINITIONS
|
||||
#################################################################################
|
||||
|
||||
!macro _StdU_Time out
|
||||
StdUtils::Time /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetMinutes out
|
||||
StdUtils::GetMinutes /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetHours out
|
||||
StdUtils::GetHours /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetDays out
|
||||
StdUtils::GetDays /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_Rand out
|
||||
StdUtils::Rand /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_RandMax out max
|
||||
push ${max}
|
||||
StdUtils::RandMax /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_RandMinMax out min max
|
||||
push ${min}
|
||||
push ${max}
|
||||
StdUtils::RandMinMax /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_RandList count max
|
||||
push ${max}
|
||||
push ${count}
|
||||
StdUtils::RandList /NOUNLOAD
|
||||
!macroend
|
||||
|
||||
!macro _StdU_RandBytes out count
|
||||
push ${count}
|
||||
StdUtils::RandBytes /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_FormatStr out format val
|
||||
push `${format}`
|
||||
push ${val}
|
||||
StdUtils::FormatStr /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_FormatStr2 out format val1 val2
|
||||
push `${format}`
|
||||
push ${val1}
|
||||
push ${val2}
|
||||
StdUtils::FormatStr2 /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_FormatStr3 out format val1 val2 val3
|
||||
push `${format}`
|
||||
push ${val1}
|
||||
push ${val2}
|
||||
push ${val3}
|
||||
StdUtils::FormatStr3 /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ScanStr out format input default
|
||||
push `${format}`
|
||||
push `${input}`
|
||||
push ${default}
|
||||
StdUtils::ScanStr /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ScanStr2 out1 out2 format input default1 default2
|
||||
push `${format}`
|
||||
push `${input}`
|
||||
push ${default1}
|
||||
push ${default2}
|
||||
StdUtils::ScanStr2 /NOUNLOAD
|
||||
pop ${out1}
|
||||
pop ${out2}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ScanStr3 out1 out2 out3 format input default1 default2 default3
|
||||
push `${format}`
|
||||
push `${input}`
|
||||
push ${default1}
|
||||
push ${default2}
|
||||
push ${default3}
|
||||
StdUtils::ScanStr3 /NOUNLOAD
|
||||
pop ${out1}
|
||||
pop ${out2}
|
||||
pop ${out3}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_TrimStr var
|
||||
push ${var}
|
||||
StdUtils::TrimStr /NOUNLOAD
|
||||
pop ${var}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_TrimStrLeft var
|
||||
push ${var}
|
||||
StdUtils::TrimStrLeft /NOUNLOAD
|
||||
pop ${var}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_TrimStrRight var
|
||||
push ${var}
|
||||
StdUtils::TrimStrRight /NOUNLOAD
|
||||
pop ${var}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_RevStr var
|
||||
push ${var}
|
||||
StdUtils::RevStr /NOUNLOAD
|
||||
pop ${var}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ValidFileName out test
|
||||
push `${test}`
|
||||
StdUtils::ValidFileName /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ValidPathSpec out test
|
||||
push `${test}`
|
||||
StdUtils::ValidPathSpec /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ValidDomain out test
|
||||
push `${test}`
|
||||
StdUtils::ValidDomainName /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
|
||||
!macro _StdU_StrToUtf8 out str
|
||||
push `${str}`
|
||||
StdUtils::StrToUtf8 /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_StrFromUtf8 out trnc str
|
||||
push ${trnc}
|
||||
push `${str}`
|
||||
StdUtils::StrFromUtf8 /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_SHFileMove out from to hwnd
|
||||
push `${from}`
|
||||
push `${to}`
|
||||
push ${hwnd}
|
||||
StdUtils::SHFileMove /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_SHFileCopy out from to hwnd
|
||||
push `${from}`
|
||||
push `${to}`
|
||||
push ${hwnd}
|
||||
StdUtils::SHFileCopy /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_AppendToFile out from dest offset maxlen
|
||||
push `${from}`
|
||||
push `${dest}`
|
||||
push ${offset}
|
||||
push ${maxlen}
|
||||
StdUtils::AppendToFile /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ExecShlUser out file verb args
|
||||
push `${file}`
|
||||
push `${verb}`
|
||||
push `${args}`
|
||||
StdUtils::ExecShellAsUser /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_InvkeShlVrb out path file verb_id
|
||||
push "${path}"
|
||||
push "${file}"
|
||||
push ${verb_id}
|
||||
StdUtils::InvokeShellVerb /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ExecShlWaitEx out_res out_val file verb args
|
||||
push `${file}`
|
||||
push `${verb}`
|
||||
push `${args}`
|
||||
StdUtils::ExecShellWaitEx /NOUNLOAD
|
||||
pop ${out_res}
|
||||
pop ${out_val}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_WaitForProcEx out handle
|
||||
push `${handle}`
|
||||
StdUtils::WaitForProcEx /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetParameter out name default
|
||||
push `${name}`
|
||||
push `${default}`
|
||||
StdUtils::GetParameter /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_TestParameter out name
|
||||
push `${name}`
|
||||
StdUtils::TestParameter /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ParameterCnt out
|
||||
StdUtils::ParameterCnt /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_ParameterStr out index
|
||||
push ${index}
|
||||
StdUtils::ParameterStr /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetAllParams out truncate
|
||||
push `${truncate}`
|
||||
StdUtils::GetAllParameters /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetRealOSVer out_major out_minor out_spack
|
||||
StdUtils::GetRealOsVersion /NOUNLOAD
|
||||
pop ${out_major}
|
||||
pop ${out_minor}
|
||||
pop ${out_spack}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetRealOSBld out
|
||||
StdUtils::GetRealOsBuildNo /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetRealOSStr out
|
||||
StdUtils::GetRealOsName /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_VrfyRealOSVer out major minor spack
|
||||
push `${major}`
|
||||
push `${minor}`
|
||||
push `${spack}`
|
||||
StdUtils::VerifyRealOsVersion /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_VrfyRealOSBld out build
|
||||
push `${build}`
|
||||
StdUtils::VerifyRealOsBuildNo /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetOSEdition out
|
||||
StdUtils::GetOsEdition /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetOSRelIdNo out
|
||||
StdUtils::GetOsReleaseId /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetOSRelIdStr out
|
||||
StdUtils::GetOsReleaseName /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_HashText out type text
|
||||
push `${type}`
|
||||
push `${text}`
|
||||
StdUtils::HashText /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_HashFile out type file
|
||||
push `${type}`
|
||||
push `${file}`
|
||||
StdUtils::HashFile /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_NormalizePath out path
|
||||
push `${path}`
|
||||
StdUtils::NormalizePath /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetParentPath out path
|
||||
push `${path}`
|
||||
StdUtils::GetParentPath /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_SplitPath out_drive out_dir out_fname out_ext path
|
||||
push `${path}`
|
||||
StdUtils::SplitPath /NOUNLOAD
|
||||
pop ${out_drive}
|
||||
pop ${out_dir}
|
||||
pop ${out_fname}
|
||||
pop ${out_ext}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetDrivePart out path
|
||||
push `${path}`
|
||||
StdUtils::GetDrivePart /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetDirPart out path
|
||||
push `${path}`
|
||||
StdUtils::GetDirectoryPart /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetFNamePart out path
|
||||
push `${path}`
|
||||
StdUtils::GetFileNamePart /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetExtnPart out path
|
||||
push `${path}`
|
||||
StdUtils::GetExtensionPart /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_TimerCreate out callback interval
|
||||
GetFunctionAddress ${out} ${callback}
|
||||
push ${out}
|
||||
push ${interval}
|
||||
StdUtils::TimerCreate /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_TimerDestroy out timer_id
|
||||
push ${timer_id}
|
||||
StdUtils::TimerDestroy /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_PrtctStr out dpsc salt text
|
||||
push `${dpsc}`
|
||||
push `${salt}`
|
||||
push `${text}`
|
||||
StdUtils::ProtectStr /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_UnprtctStr out trnc salt data
|
||||
push `${trnc}`
|
||||
push `${salt}`
|
||||
push `${data}`
|
||||
StdUtils::UnprotectStr /NOUNLOAD
|
||||
pop ${out}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_GetLibVersion out_ver out_tst
|
||||
StdUtils::GetLibVersion /NOUNLOAD
|
||||
pop ${out_ver}
|
||||
pop ${out_tst}
|
||||
!macroend
|
||||
|
||||
!macro _StdU_SetVerbose enable
|
||||
Push ${enable}
|
||||
StdUtils::SetVerboseMode /NOUNLOAD
|
||||
!macroend
|
||||
|
||||
|
||||
#################################################################################
|
||||
# MAGIC NUMBERS
|
||||
#################################################################################
|
||||
|
||||
!define StdUtils.Const.ShellVerb.PinToTaskbar 0
|
||||
!define StdUtils.Const.ShellVerb.UnpinFromTaskbar 1
|
||||
!define StdUtils.Const.ShellVerb.PinToStart 2
|
||||
!define StdUtils.Const.ShellVerb.UnpinFromStart 3
|
||||
|
||||
!endif # !___STDUTILS__NSH___
|
||||
72
tray/ant/windows/nsis/Include/StrLoc.nsh
Normal file
72
tray/ant/windows/nsis/Include/StrLoc.nsh
Normal file
@@ -0,0 +1,72 @@
|
||||
!define StrLoc "!insertmacro StrLoc"
|
||||
|
||||
!macro StrLoc ResultVar String SubString StartPoint
|
||||
Push "${String}"
|
||||
Push "${SubString}"
|
||||
Push "${StartPoint}"
|
||||
Call StrLoc
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
|
||||
Function StrLoc
|
||||
/*After this point:
|
||||
------------------------------------------
|
||||
$R0 = StartPoint (input)
|
||||
$R1 = SubString (input)
|
||||
$R2 = String (input)
|
||||
$R3 = SubStringLen (temp)
|
||||
$R4 = StrLen (temp)
|
||||
$R5 = StartCharPos (temp)
|
||||
$R6 = TempStr (temp)*/
|
||||
|
||||
;Get input from user
|
||||
Exch $R0
|
||||
Exch
|
||||
Exch $R1
|
||||
Exch 2
|
||||
Exch $R2
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
Push $R6
|
||||
|
||||
;Get "String" and "SubString" length
|
||||
StrLen $R3 $R1
|
||||
StrLen $R4 $R2
|
||||
;Start "StartCharPos" counter
|
||||
StrCpy $R5 0
|
||||
|
||||
;Loop until "SubString" is found or "String" reaches its end
|
||||
${Do}
|
||||
;Remove everything before and after the searched part ("TempStr")
|
||||
StrCpy $R6 $R2 $R3 $R5
|
||||
|
||||
;Compare "TempStr" with "SubString"
|
||||
${If} $R6 == $R1
|
||||
${If} $R0 == `<`
|
||||
IntOp $R6 $R3 + $R5
|
||||
IntOp $R0 $R4 - $R6
|
||||
${Else}
|
||||
StrCpy $R0 $R5
|
||||
${EndIf}
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
;If not "SubString", this could be "String"'s end
|
||||
${If} $R5 >= $R4
|
||||
StrCpy $R0 ``
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
;If not, continue the loop
|
||||
IntOp $R5 $R5 + 1
|
||||
${Loop}
|
||||
|
||||
;Return output to user
|
||||
Pop $R6
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Exch
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
66
tray/ant/windows/nsis/Include/StrRep.nsh
Normal file
66
tray/ant/windows/nsis/Include/StrRep.nsh
Normal file
@@ -0,0 +1,66 @@
|
||||
!define StrRep "!insertmacro StrRep"
|
||||
!macro StrRep output string old new
|
||||
Push `${string}`
|
||||
Push `${old}`
|
||||
Push `${new}`
|
||||
;!ifdef __UNINSTALL__
|
||||
; Call un.StrRep
|
||||
;!else
|
||||
Call StrRep
|
||||
;!endif
|
||||
Pop ${output}
|
||||
!macroend
|
||||
|
||||
!macro Func_StrRep un
|
||||
Function ${un}StrRep
|
||||
Exch $R2 ;new
|
||||
Exch 1
|
||||
Exch $R1 ;old
|
||||
Exch 2
|
||||
Exch $R0 ;string
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
Push $R6
|
||||
Push $R7
|
||||
Push $R8
|
||||
Push $R9
|
||||
|
||||
StrCpy $R3 0
|
||||
StrLen $R4 $R1
|
||||
StrLen $R6 $R0
|
||||
StrLen $R9 $R2
|
||||
loop:
|
||||
StrCpy $R5 $R0 $R4 $R3
|
||||
StrCmp $R5 $R1 found
|
||||
StrCmp $R3 $R6 done
|
||||
IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $R5 $R0 $R3
|
||||
IntOp $R8 $R3 + $R4
|
||||
StrCpy $R7 $R0 "" $R8
|
||||
StrCpy $R0 $R5$R2$R7
|
||||
StrLen $R6 $R0
|
||||
IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string
|
||||
Goto loop
|
||||
done:
|
||||
|
||||
Pop $R9
|
||||
Pop $R8
|
||||
Pop $R7
|
||||
Pop $R6
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Push $R0
|
||||
Push $R1
|
||||
Pop $R0
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro Func_StrRep ""
|
||||
;!insertmacro Func_StrRep "un."
|
||||
150
tray/ant/windows/nsis/Include/StrTok.nsh
Normal file
150
tray/ant/windows/nsis/Include/StrTok.nsh
Normal file
@@ -0,0 +1,150 @@
|
||||
!define StrTok "!insertmacro StrTok"
|
||||
|
||||
!macro StrTok ResultVar String Separators ResultPart SkipEmptyParts
|
||||
Push "${String}"
|
||||
Push "${Separators}"
|
||||
Push "${ResultPart}"
|
||||
Push "${SkipEmptyParts}"
|
||||
Call StrTok
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
|
||||
Function StrTok
|
||||
/*After this point:
|
||||
------------------------------------------
|
||||
$0 = SkipEmptyParts (input)
|
||||
$1 = ResultPart (input)
|
||||
$2 = Separators (input)
|
||||
$3 = String (input)
|
||||
$4 = SeparatorsLen (temp)
|
||||
$5 = StrLen (temp)
|
||||
$6 = StartCharPos (temp)
|
||||
$7 = TempStr (temp)
|
||||
$8 = CurrentLoop
|
||||
$9 = CurrentSepChar
|
||||
$R0 = CurrentSepCharNum
|
||||
*/
|
||||
|
||||
;Get input from user
|
||||
Exch $0
|
||||
Exch
|
||||
Exch $1
|
||||
Exch
|
||||
Exch 2
|
||||
Exch $2
|
||||
Exch 2
|
||||
Exch 3
|
||||
Exch $3
|
||||
Exch 3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
Push $7
|
||||
Push $8
|
||||
Push $9
|
||||
Push $R0
|
||||
|
||||
;Parameter defaults
|
||||
${IfThen} $2 == `` ${|} StrCpy $2 `|` ${|}
|
||||
${IfThen} $1 == `` ${|} StrCpy $1 `L` ${|}
|
||||
${IfThen} $0 == `` ${|} StrCpy $0 `0` ${|}
|
||||
|
||||
;Get "String" and "Separators" length
|
||||
StrLen $4 $2
|
||||
StrLen $5 $3
|
||||
;Start "StartCharPos" and "ResultPart" counters
|
||||
StrCpy $6 0
|
||||
StrCpy $8 -1
|
||||
|
||||
;Loop until "ResultPart" is met, "Separators" is found or
|
||||
;"String" reaches its end
|
||||
ResultPartLoop: ;"CurrentLoop" Loop
|
||||
|
||||
;Increase "CurrentLoop" counter
|
||||
IntOp $8 $8 + 1
|
||||
|
||||
StrSearchLoop:
|
||||
${Do} ;"String" Loop
|
||||
;Remove everything before and after the searched part ("TempStr")
|
||||
StrCpy $7 $3 1 $6
|
||||
|
||||
;Verify if it's the "String" end
|
||||
${If} $6 >= $5
|
||||
;If "CurrentLoop" is what the user wants, remove the part
|
||||
;after "TempStr" and itself and get out of here
|
||||
${If} $8 == $1
|
||||
${OrIf} $1 == `L`
|
||||
StrCpy $3 $3 $6
|
||||
${Else} ;If not, empty "String" and get out of here
|
||||
StrCpy $3 ``
|
||||
${EndIf}
|
||||
StrCpy $R0 `End`
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
|
||||
;Start "CurrentSepCharNum" counter (for "Separators" Loop)
|
||||
StrCpy $R0 0
|
||||
|
||||
${Do} ;"Separators" Loop
|
||||
;Use one "Separators" character at a time
|
||||
${If} $R0 <> 0
|
||||
StrCpy $9 $2 1 $R0
|
||||
${Else}
|
||||
StrCpy $9 $2 1
|
||||
${EndIf}
|
||||
|
||||
;Go to the next "String" char if it's "Separators" end
|
||||
${IfThen} $R0 >= $4 ${|} ${ExitDo} ${|}
|
||||
|
||||
;Or, if "TempStr" equals "CurrentSepChar", then...
|
||||
${If} $7 == $9
|
||||
StrCpy $7 $3 $6
|
||||
|
||||
;If "String" is empty because this result part doesn't
|
||||
;contain data, verify if "SkipEmptyParts" is activated,
|
||||
;so we don't return the output to user yet
|
||||
|
||||
${If} $7 == ``
|
||||
${AndIf} $0 = 1 ;${TRUE}
|
||||
IntOp $6 $6 + 1
|
||||
StrCpy $3 $3 `` $6
|
||||
StrCpy $6 0
|
||||
Goto StrSearchLoop
|
||||
${ElseIf} $8 == $1
|
||||
StrCpy $3 $3 $6
|
||||
StrCpy $R0 "End"
|
||||
${ExitDo}
|
||||
${EndIf} ;If not, go to the next result part
|
||||
IntOp $6 $6 + 1
|
||||
StrCpy $3 $3 `` $6
|
||||
StrCpy $6 0
|
||||
Goto ResultPartLoop
|
||||
${EndIf}
|
||||
|
||||
;Increase "CurrentSepCharNum" counter
|
||||
IntOp $R0 $R0 + 1
|
||||
${Loop}
|
||||
${IfThen} $R0 == "End" ${|} ${ExitDo} ${|}
|
||||
|
||||
;Increase "StartCharPos" counter
|
||||
IntOp $6 $6 + 1
|
||||
${Loop}
|
||||
|
||||
/*After this point:
|
||||
------------------------------------------
|
||||
$3 = ResultVar (output)*/
|
||||
|
||||
;Return output to user
|
||||
|
||||
Pop $R0
|
||||
Pop $9
|
||||
Pop $8
|
||||
Pop $7
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $0
|
||||
Pop $1
|
||||
Pop $2
|
||||
Exch $3
|
||||
FunctionEnd
|
||||
BIN
tray/ant/windows/nsis/Plugins/Release_ANSI/AccessControl.dll
Normal file
BIN
tray/ant/windows/nsis/Plugins/Release_ANSI/AccessControl.dll
Normal file
Binary file not shown.
BIN
tray/ant/windows/nsis/Plugins/Release_ANSI/StdUtils.dll
Normal file
BIN
tray/ant/windows/nsis/Plugins/Release_ANSI/StdUtils.dll
Normal file
Binary file not shown.
BIN
tray/ant/windows/nsis/Plugins/Release_Unicode/AccessControl.dll
Normal file
BIN
tray/ant/windows/nsis/Plugins/Release_Unicode/AccessControl.dll
Normal file
Binary file not shown.
BIN
tray/ant/windows/nsis/Plugins/Release_Unicode/StdUtils.dll
Normal file
BIN
tray/ant/windows/nsis/Plugins/Release_Unicode/StdUtils.dll
Normal file
Binary file not shown.
BIN
tray/ant/windows/nsis/console.ico
Normal file
BIN
tray/ant/windows/nsis/console.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 420 KiB |
BIN
tray/ant/windows/nsis/uninstall.ico
Normal file
BIN
tray/ant/windows/nsis/uninstall.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
BIN
tray/ant/windows/nsis/welcome.bmp
Normal file
BIN
tray/ant/windows/nsis/welcome.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 KiB |
Reference in New Issue
Block a user