stuff
This commit is contained in:
132
buildfiles/node_modules/app-builder-lib/templates/nsis/include/FileAssociation.nsh
generated
vendored
Normal file
132
buildfiles/node_modules/app-builder-lib/templates/nsis/include/FileAssociation.nsh
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
; fileassoc.nsh
|
||||
; File association helper macros
|
||||
; Written by Saivert
|
||||
;
|
||||
; Features automatic backup system and UPDATEFILEASSOC macro for
|
||||
; shell change notification.
|
||||
;
|
||||
; |> How to use <|
|
||||
; To associate a file with an application so you can double-click it in explorer, use
|
||||
; the APP_ASSOCIATE macro like this:
|
||||
;
|
||||
; Example:
|
||||
; !insertmacro APP_ASSOCIATE "txt" "myapp.textfile" "Description of txt files" \
|
||||
; "$INSTDIR\myapp.exe,0" "Open with myapp" "$INSTDIR\myapp.exe $\"%1$\""
|
||||
;
|
||||
; Never insert the APP_ASSOCIATE macro multiple times, it is only ment
|
||||
; to associate an application with a single file and using the
|
||||
; the "open" verb as default. To add more verbs (actions) to a file
|
||||
; use the APP_ASSOCIATE_ADDVERB macro.
|
||||
;
|
||||
; Example:
|
||||
; !insertmacro APP_ASSOCIATE_ADDVERB "myapp.textfile" "edit" "Edit with myapp" \
|
||||
; "$INSTDIR\myapp.exe /edit $\"%1$\""
|
||||
;
|
||||
; To have access to more options when registering the file association use the
|
||||
; APP_ASSOCIATE_EX macro. Here you can specify the verb and what verb is to be the
|
||||
; standard action (default verb).
|
||||
;
|
||||
; Note, that this script takes into account user versus global installs.
|
||||
; To properly work you must initialize the SHELL_CONTEXT variable via SetShellVarContext.
|
||||
;
|
||||
; And finally: To remove the association from the registry use the APP_UNASSOCIATE
|
||||
; macro. Here is another example just to wrap it up:
|
||||
; !insertmacro APP_UNASSOCIATE "txt" "myapp.textfile"
|
||||
;
|
||||
; |> Note <|
|
||||
; When defining your file class string always use the short form of your application title
|
||||
; then a period (dot) and the type of file. This keeps the file class sort of unique.
|
||||
; Examples:
|
||||
; Winamp.Playlist
|
||||
; NSIS.Script
|
||||
; Photoshop.JPEGFile
|
||||
;
|
||||
; |> Tech info <|
|
||||
; The registry key layout for a global file association is:
|
||||
;
|
||||
; HKEY_LOCAL_MACHINE\Software\Classes
|
||||
; <".ext"> = <applicationID>
|
||||
; <applicationID> = <"description">
|
||||
; shell
|
||||
; <verb> = <"menu-item text">
|
||||
; command = <"command string">
|
||||
;
|
||||
;
|
||||
; The registry key layout for a per-user file association is:
|
||||
;
|
||||
; HKEY_CURRENT_USER\Software\Classes
|
||||
; <".ext"> = <applicationID>
|
||||
; <applicationID> = <"description">
|
||||
; shell
|
||||
; <verb> = <"menu-item text">
|
||||
; command = <"command string">
|
||||
;
|
||||
|
||||
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0"
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}"
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0"
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}"
|
||||
StrCmp "${SHELLNEW}" "0" +2
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}\ShellNew" "NullFile" ""
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" `${DEFAULTVERB}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB
|
||||
DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}\shell\${VERB}`
|
||||
!macroend
|
||||
|
||||
|
||||
!macro APP_UNASSOCIATE EXT FILECLASS
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0"
|
||||
|
||||
DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT
|
||||
ReadRegStr ${OUTPUT} SHELL_CONTEXT "Software\Classes\.${EXT}" ""
|
||||
!macroend
|
||||
|
||||
|
||||
; !defines for use with SHChangeNotify
|
||||
!ifdef SHCNE_ASSOCCHANGED
|
||||
!undef SHCNE_ASSOCCHANGED
|
||||
!endif
|
||||
!define SHCNE_ASSOCCHANGED 0x08000000
|
||||
!ifdef SHCNF_FLUSH
|
||||
!undef SHCNF_FLUSH
|
||||
!endif
|
||||
!define SHCNF_FLUSH 0x1000
|
||||
|
||||
!macro UPDATEFILEASSOC
|
||||
; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we
|
||||
; can update the shell.
|
||||
System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)"
|
||||
!macroend
|
496
buildfiles/node_modules/app-builder-lib/templates/nsis/include/StdUtils.nsh
generated
vendored
Normal file
496
buildfiles/node_modules/app-builder-lib/templates/nsis/include/StdUtils.nsh
generated
vendored
Normal file
@ -0,0 +1,496 @@
|
||||
#################################################################################
|
||||
# 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.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_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___
|
48
buildfiles/node_modules/app-builder-lib/templates/nsis/include/StrContains.nsh
generated
vendored
Normal file
48
buildfiles/node_modules/app-builder-lib/templates/nsis/include/StrContains.nsh
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
; StrContains
|
||||
; This function does a case sensitive searches for an occurrence of a substring in a string.
|
||||
; It returns the substring if it is found.
|
||||
; Otherwise it returns null("").
|
||||
; Written by kenglish_hi
|
||||
; Adapted from StrReplace written by dandaman32
|
||||
|
||||
|
||||
Var STR_HAYSTACK
|
||||
Var STR_NEEDLE
|
||||
Var STR_CONTAINS_VAR_1
|
||||
Var STR_CONTAINS_VAR_2
|
||||
Var STR_CONTAINS_VAR_3
|
||||
Var STR_CONTAINS_VAR_4
|
||||
Var STR_RETURN_VAR
|
||||
|
||||
Function StrContains
|
||||
Exch $STR_NEEDLE
|
||||
Exch 1
|
||||
Exch $STR_HAYSTACK
|
||||
; Uncomment to debug
|
||||
;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
|
||||
StrCpy $STR_RETURN_VAR ""
|
||||
StrCpy $STR_CONTAINS_VAR_1 -1
|
||||
StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
|
||||
StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
|
||||
loop:
|
||||
IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
|
||||
StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
|
||||
StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
|
||||
StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $STR_RETURN_VAR $STR_NEEDLE
|
||||
Goto done
|
||||
done:
|
||||
Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
|
||||
Exch $STR_RETURN_VAR
|
||||
FunctionEnd
|
||||
|
||||
!macro _StrContainsConstructor OUT NEEDLE HAYSTACK
|
||||
Push `${HAYSTACK}`
|
||||
Push `${NEEDLE}`
|
||||
Call StrContains
|
||||
Pop `${OUT}`
|
||||
!macroend
|
||||
|
||||
!define StrContains '!insertmacro "_StrContainsConstructor"'
|
299
buildfiles/node_modules/app-builder-lib/templates/nsis/include/UAC.nsh
generated
vendored
Normal file
299
buildfiles/node_modules/app-builder-lib/templates/nsis/include/UAC.nsh
generated
vendored
Normal file
@ -0,0 +1,299 @@
|
||||
/*** UAC Plug-in ***
|
||||
|
||||
Interactive User (MediumIL) Admin user (HighIL)
|
||||
***[Setup.exe]************* ***[Setup.exe]**************
|
||||
* * * *
|
||||
* +++[.OnInit]+++++++++++ * * +++[.OnInit]++++++++++++ *
|
||||
* + UAC_RunElevated >---+-+----> * + + *
|
||||
* + NSIS.Quit + * * + + *
|
||||
* +++++++++++++++++++++++ * * ++++++++++++++++++++++++ *
|
||||
* * * *
|
||||
* * * *
|
||||
* +++[Section]+++++++++++ * * +++[Section]++++++++++++ *
|
||||
* + + * /--+-+-<UAC_AsUser_ExecShell+ *
|
||||
* +++++++++++++++++++++++ * | * ++++++++++++++++++++++++ *
|
||||
* * | * *
|
||||
* Win32.ShellExecute <---+--/ * *
|
||||
* * * *
|
||||
*************************** ****************************
|
||||
|
||||
*/
|
||||
|
||||
!ifndef UAC_HDR__INC
|
||||
!verbose push
|
||||
!verbose 3
|
||||
!ifndef UAC_VERBOSE
|
||||
!define UAC_VERBOSE 3
|
||||
!endif
|
||||
!verbose ${UAC_VERBOSE}
|
||||
|
||||
!define UAC_HDR__INC 0x00020400 ;MMmmbbrr
|
||||
|
||||
!include LogicLib.nsh
|
||||
|
||||
|
||||
|
||||
/* UAC_RunElevated
|
||||
**
|
||||
** Starts the elevation operation.
|
||||
**
|
||||
** Return values:
|
||||
**
|
||||
** $0: Win32 error code (0 on success, 1223 if user aborted elevation dialog, anything else should be treated as a fatal error)
|
||||
** $1: If $0==0:
|
||||
** 0 UAC is not supported by the OS
|
||||
** 1 Started a elevated child process, the current process should act like a wrapper (Call Quit without any further processing)
|
||||
** 2 The process is already running @ HighIL (Member of admin group)
|
||||
** 3 You should call RunElevated again (This can happen if a user without admin priv. is used in the runas dialog)
|
||||
** $2: If $0==0 && $1==1: ExitCode of the elevated fork process (The NSIS errlvl is also set)
|
||||
** $3: If $0==0: 1 if the user is a member of the admin group or 0 otherwise
|
||||
**/
|
||||
!macro UAC_RunElevated
|
||||
UAC::_ 0
|
||||
!macroend
|
||||
!macro UAC_PageElevation_RunElevated
|
||||
UAC::_ 0
|
||||
!macroend
|
||||
/*!macro UAC_OnInitElevation_RunElevated
|
||||
UAC::_ 0
|
||||
!macroend
|
||||
!macro UAC_OnInitElevation_OnGuiInit
|
||||
!macroend*/
|
||||
|
||||
|
||||
|
||||
/* UAC_GetIntegrityLevel <NSISVar:Output | "s">
|
||||
**
|
||||
** Get integrity level of current process
|
||||
**
|
||||
**/
|
||||
!macro UAC_GetIntegrityLevel outvar
|
||||
UAC::_ 6
|
||||
!if "${outvar}" != "s"
|
||||
Pop ${outvar}
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
/* UAC_IsAdmin
|
||||
**
|
||||
** Is the current process running with administrator privileges? Result in $0
|
||||
**
|
||||
** ${If} ${UAC_IsAdmin} ...
|
||||
**
|
||||
**/
|
||||
!macro UAC_IsAdmin
|
||||
UAC::_ 2
|
||||
!macroend
|
||||
!define UAC_IsAdmin `"" UAC_IsAdmin ""`
|
||||
!macro _UAC_IsAdmin _a _b _t _f
|
||||
!insertmacro _UAC_MakeLL_Cmp _!= 0 2s
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
/* UAC_IsInnerInstance
|
||||
**
|
||||
** Does the current process have a NSIS/UAC parent process that is part of the elevation operation?
|
||||
**
|
||||
** ${If} ${UAC_IsInnerInstance} ...
|
||||
**
|
||||
**/
|
||||
!macro UAC_IsInnerInstance
|
||||
UAC::_ 3
|
||||
!macroend
|
||||
!define UAC_IsInnerInstance `"" UAC_IsInnerInstance ""`
|
||||
!macro _UAC_IsInnerInstance _a _b _t _f
|
||||
!insertmacro _UAC_MakeLL_Cmp _!= 0 3s
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
/* UAC_PageElevation_OnInit, UAC_PageElevation_OnGuiInit,
|
||||
**
|
||||
** Helper macros for elevation on a custom elevation page, see the DualMode example for more information.
|
||||
**
|
||||
**/
|
||||
!macro UAC_Notify_OnGuiInit
|
||||
UAC::_ 4
|
||||
!macroend
|
||||
!macro UAC_PageElevation_OnGuiInit
|
||||
!insertmacro UAC_Notify_OnGuiInit
|
||||
!macroend
|
||||
!macro UAC_PageElevation_OnInit
|
||||
UAC::_ 5
|
||||
${IfThen} ${Errors} ${|} Quit ${|}
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
/* UAC_AsUser_Call <Function|Label> <NSISAddressName> <UAC_* flags>
|
||||
**
|
||||
** Calls a function or label in the user process instance.
|
||||
** All the UAC_AsUser_* macros use this helper macro.
|
||||
**
|
||||
**/
|
||||
!define UAC_SYNCREGISTERS 0x1
|
||||
;define UAC_SYNCSTACK 0x2
|
||||
!define UAC_SYNCOUTDIR 0x4
|
||||
!define UAC_SYNCINSTDIR 0x8
|
||||
;define UAC_CLEARERRFLAG 0x10
|
||||
!macro UAC_AsUser_Call type name flags
|
||||
push $0
|
||||
Get${type}Address $0 ${name}
|
||||
!verbose push
|
||||
!verbose ${UAC_VERBOSE}
|
||||
!insertmacro _UAC_ParseDefineFlagsToInt _UAC_AsUser_Call__flags ${flags}
|
||||
!verbose pop
|
||||
StrCpy $0 "1$0:${_UAC_AsUser_Call__flags}"
|
||||
!undef _UAC_AsUser_Call__flags
|
||||
Exch $0
|
||||
UAC::_
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** UAC_AsUser_GetSection <Flags|InstTypes|Size|Text> <SectionIndex> <NSISVar:Output>
|
||||
*/
|
||||
!macro UAC_AsUser_GetSection secprop secidx outvar
|
||||
!insertmacro _UAC_AsUser_GenOp ${outvar} SectionGet${secprop} ${secidx} ""
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** UAC_AsUser_GetGlobalVar <NSISVar:SourceAndOutput>
|
||||
** UAC_AsUser_GetGlobal <NSISVar:Output> <NSISVar:Source>
|
||||
*/
|
||||
!macro UAC_AsUser_GetGlobalVar var
|
||||
!insertmacro _UAC_AsUser_GenOp ${var} StrCpy "" ${var}
|
||||
!macroend
|
||||
!macro UAC_AsUser_GetGlobal outvar srcvar
|
||||
!insertmacro _UAC_AsUser_GenOp ${outvar} StrCpy "" ${srcvar}
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** UAC_AsUser_ExecShell <Verb> <ApplicationOrFile> <Parameters> <Working Directory> <SW_*>
|
||||
**
|
||||
** Call ExecShell in the user process instance.
|
||||
**
|
||||
*/
|
||||
!macro UAC_AsUser_ExecShell verb command params workdir show
|
||||
!insertmacro _UAC_IncL
|
||||
goto _UAC_L_E_${__UAC_L}
|
||||
_UAC_L_F_${__UAC_L}:
|
||||
ExecShell "${verb}" "${command}" '${params}' ${show}
|
||||
return
|
||||
_UAC_L_E_${__UAC_L}:
|
||||
!if "${workdir}" != ""
|
||||
push $outdir
|
||||
SetOutPath "${workdir}"
|
||||
!endif
|
||||
!insertmacro UAC_AsUser_Call Label _UAC_L_F_${__UAC_L} ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR} #|${UAC_CLEARERRFLAG}
|
||||
!if "${workdir}" != ""
|
||||
pop $outdir
|
||||
SetOutPath $outdir
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
!macro _UAC_MakeLL_Cmp cmpop cmp pluginparams
|
||||
!insertmacro _LOGICLIB_TEMP
|
||||
UAC::_ ${pluginparams}
|
||||
pop $_LOGICLIB_TEMP
|
||||
!insertmacro ${cmpop} $_LOGICLIB_TEMP ${cmp} `${_t}` `${_f}`
|
||||
!macroend
|
||||
!macro _UAC_definemath def val1 op val2
|
||||
!define /math _UAC_definemath "${val1}" ${op} ${val2}
|
||||
!ifdef ${def}
|
||||
!undef ${def}
|
||||
!endif
|
||||
!define ${def} "${_UAC_definemath}"
|
||||
!undef _UAC_definemath
|
||||
!macroend
|
||||
!macro _UAC_ParseDefineFlags_orin parse outflags
|
||||
!searchparse /noerrors ${${parse}} "" _UAC_ParseDefineFlags_orin_f1 "|" _UAC_ParseDefineFlags_orin_f2
|
||||
!define _UAC_ParseDefineFlags_orin_this ${_UAC_ParseDefineFlags_orin_f1}
|
||||
!undef ${parse}
|
||||
!define ${parse} ${_UAC_ParseDefineFlags_orin_f2}
|
||||
!define _UAC_ParseDefineFlags_orin_saveout ${${outflags}}
|
||||
!undef ${outflags}
|
||||
!define /math ${outflags} "${_UAC_ParseDefineFlags_orin_saveout}" | "${_UAC_ParseDefineFlags_orin_this}"
|
||||
!undef _UAC_ParseDefineFlags_orin_saveout
|
||||
!undef _UAC_ParseDefineFlags_orin_this
|
||||
!ifdef _UAC_ParseDefineFlags_orin_f1
|
||||
!undef _UAC_ParseDefineFlags_orin_f1
|
||||
!endif
|
||||
!ifdef _UAC_ParseDefineFlags_orin_f2
|
||||
!undef _UAC_ParseDefineFlags_orin_f2
|
||||
!endif
|
||||
!macroend
|
||||
!macro _UAC_ParseDefineFlags_Begin _outdef _in
|
||||
!define _UAC_PDF${_outdef}_parse "${_in}"
|
||||
!define _UAC_PDF${_outdef}_flags ""
|
||||
!define _UAC_PDF${_outdef}_r 0
|
||||
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x1
|
||||
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x2
|
||||
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x4
|
||||
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x8
|
||||
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x10
|
||||
!macroend
|
||||
!macro _UAC_ParseDefineFlags_End _outdef
|
||||
!define ${_outdef} ${_UAC_PDF${_outdef}_r}
|
||||
!undef _UAC_PDF${_outdef}_r
|
||||
!undef _UAC_PDF${_outdef}_flags
|
||||
!undef _UAC_PDF${_outdef}_parse
|
||||
!macroend
|
||||
!macro _UAC_ParseDefineFlags_IncludeFlag _outdef flag
|
||||
!if ${_UAC_PDF${_outdef}_flags} & ${flag}
|
||||
!insertmacro _UAC_definemath _UAC_PDF${_outdef}_r ${_UAC_PDF${_outdef}_r} | ${flag}
|
||||
!endif
|
||||
!macroend
|
||||
!macro _UAC_ParseDefineFlagsToInt _outdef _in
|
||||
!insertmacro _UAC_ParseDefineFlags_Begin _UAC_ParseDefineFlagsToInt_tmp "${_in}"
|
||||
!define ${_outdef} ${_UAC_PDF_UAC_ParseDefineFlagsToInt_tmp_flags}
|
||||
!insertmacro _UAC_ParseDefineFlags_End _UAC_ParseDefineFlagsToInt_tmp
|
||||
!undef _UAC_ParseDefineFlagsToInt_tmp
|
||||
!macroend
|
||||
!macro _UAC_IncL
|
||||
!insertmacro _UAC_definemath __UAC_L "${__UAC_L}" + 1
|
||||
!macroend
|
||||
!macro _UAC_AsUser_GenOp outvar op opparam1 opparam2
|
||||
!define _UAC_AUGOGR_ID _UAC_AUGOGR_OP${outvar}${op}${opparam1}${opparam2}
|
||||
!ifndef ${_UAC_AUGOGR_ID} ;Has this exact action been done before?
|
||||
!if ${outvar} == $0
|
||||
!define ${_UAC_AUGOGR_ID} $1
|
||||
!else
|
||||
!define ${_UAC_AUGOGR_ID} $0
|
||||
!endif
|
||||
!if "${opparam1}" == ""
|
||||
!define _UAC_AUGOGR_OPP1 ${${_UAC_AUGOGR_ID}}
|
||||
!define _UAC_AUGOGR_OPP2 ${opparam2}
|
||||
!else
|
||||
!define _UAC_AUGOGR_OPP1 ${opparam1}
|
||||
!define _UAC_AUGOGR_OPP2 ${${_UAC_AUGOGR_ID}}
|
||||
!endif
|
||||
goto ${_UAC_AUGOGR_ID}_C
|
||||
${_UAC_AUGOGR_ID}_F:
|
||||
${op} ${_UAC_AUGOGR_OPP1} ${_UAC_AUGOGR_OPP2}
|
||||
return
|
||||
${_UAC_AUGOGR_ID}_C:
|
||||
!undef _UAC_AUGOGR_OPP1
|
||||
!undef _UAC_AUGOGR_OPP2
|
||||
!endif
|
||||
push ${${_UAC_AUGOGR_ID}}
|
||||
!insertmacro UAC_AsUser_Call Label ${_UAC_AUGOGR_ID}_F ${UAC_SYNCREGISTERS}
|
||||
StrCpy ${outvar} ${${_UAC_AUGOGR_ID}}
|
||||
pop ${${_UAC_AUGOGR_ID}}
|
||||
!undef _UAC_AUGOGR_ID
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
!verbose pop
|
||||
!endif /* UAC_HDR__INC */
|
77
buildfiles/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
generated
vendored
Normal file
77
buildfiles/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
!include "nsProcess.nsh"
|
||||
|
||||
!ifmacrondef customCheckAppRunning
|
||||
!include "getProcessInfo.nsh"
|
||||
Var pid
|
||||
!endif
|
||||
|
||||
# http://nsis.sourceforge.net/Allow_only_one_installer_instance
|
||||
!macro ALLOW_ONLY_ONE_INSTALLER_INSTANCE
|
||||
BringToFront
|
||||
!define /ifndef SYSTYPE_PTR p ; NSIS v3.0+
|
||||
System::Call 'kernel32::CreateMutex(${SYSTYPE_PTR}0, i1, t"${APP_GUID}")?e'
|
||||
Pop $0
|
||||
IntCmpU $0 183 0 launch launch ; ERROR_ALREADY_EXISTS
|
||||
StrLen $0 "$(^SetupCaption)"
|
||||
IntOp $0 $0 + 1 ; GetWindowText count includes \0
|
||||
StrCpy $1 "" ; Start FindWindow with NULL
|
||||
loop:
|
||||
FindWindow $1 "#32770" "" "" $1
|
||||
StrCmp 0 $1 notfound
|
||||
System::Call 'user32::GetWindowText(${SYSTYPE_PTR}r1, t.r2, ir0)'
|
||||
StrCmp $2 "$(^SetupCaption)" 0 loop
|
||||
SendMessage $1 0x112 0xF120 0 /TIMEOUT=2000 ; WM_SYSCOMMAND:SC_RESTORE to restore the window if it is minimized
|
||||
System::Call "user32::SetForegroundWindow(${SYSTYPE_PTR}r1)"
|
||||
notfound:
|
||||
Abort
|
||||
launch:
|
||||
!macroend
|
||||
|
||||
!macro CHECK_APP_RUNNING
|
||||
!ifmacrodef customCheckAppRunning
|
||||
!insertmacro customCheckAppRunning
|
||||
!else
|
||||
!insertmacro _CHECK_APP_RUNNING
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro _CHECK_APP_RUNNING
|
||||
${GetProcessInfo} 0 $pid $1 $2 $3 $4
|
||||
${if} $3 != "${APP_EXECUTABLE_FILENAME}"
|
||||
${if} ${isUpdated}
|
||||
# allow app to exit without explicit kill
|
||||
Sleep 300
|
||||
${endIf}
|
||||
|
||||
${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0
|
||||
${if} $R0 == 0
|
||||
${if} ${isUpdated}
|
||||
# allow app to exit without explicit kill
|
||||
Sleep 1000
|
||||
Goto doStopProcess
|
||||
${endIf}
|
||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(appRunning)" /SD IDOK IDOK doStopProcess
|
||||
Quit
|
||||
|
||||
doStopProcess:
|
||||
|
||||
DetailPrint `Closing running "${PRODUCT_NAME}"...`
|
||||
|
||||
# https://github.com/electron-userland/electron-builder/issues/2516#issuecomment-372009092
|
||||
nsExec::Exec `taskkill /t /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"` $R0
|
||||
# to ensure that files are not "in-use"
|
||||
Sleep 300
|
||||
|
||||
${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0
|
||||
${if} $R0 == 0
|
||||
# wait to give a chance to exit gracefully
|
||||
Sleep 1000
|
||||
nsExec::Exec `taskkill /f /t /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"` $R0
|
||||
${If} $R0 != 0
|
||||
DetailPrint `Waiting for "${PRODUCT_NAME}" to close (taskkill exit code $R0).`
|
||||
Sleep 2000
|
||||
${endIf}
|
||||
${endIf}
|
||||
${endIf}
|
||||
${endIf}
|
||||
!macroend
|
91
buildfiles/node_modules/app-builder-lib/templates/nsis/include/extractAppPackage.nsh
generated
vendored
Normal file
91
buildfiles/node_modules/app-builder-lib/templates/nsis/include/extractAppPackage.nsh
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
!macro extractEmbeddedAppPackage
|
||||
!ifdef COMPRESS
|
||||
SetCompress off
|
||||
!endif
|
||||
|
||||
Var /GLOBAL packageArch
|
||||
|
||||
!ifdef APP_64
|
||||
!ifdef APP_ARM64
|
||||
StrCpy $packageArch "ARM64"
|
||||
!else
|
||||
StrCpy $packageArch "64"
|
||||
!endif
|
||||
|
||||
!insertmacro compute_files_for_current_arch
|
||||
!else
|
||||
!insertmacro ia32_app_files
|
||||
!endif
|
||||
|
||||
!ifdef COMPRESS
|
||||
SetCompress "${COMPRESS}"
|
||||
!endif
|
||||
|
||||
!ifdef ZIP_COMPRESSION
|
||||
nsisunz::Unzip "$PLUGINSDIR\app-$packageArch.zip" "$INSTDIR"
|
||||
!else
|
||||
!insertmacro extractUsing7za "$PLUGINSDIR\app-$packageArch.7z"
|
||||
!endif
|
||||
|
||||
# after decompression
|
||||
${if} $packageArch == "ARM64"
|
||||
!ifmacrodef customFiles_arm64
|
||||
!insertmacro customFiles_arm64
|
||||
!endif
|
||||
${elseif} $packageArch == "64"
|
||||
!ifmacrodef customFiles_x64
|
||||
!insertmacro customFiles_x64
|
||||
!endif
|
||||
${else}
|
||||
!ifmacrodef customFiles_ia32
|
||||
!insertmacro customFiles_ia32
|
||||
!endif
|
||||
${endIf}
|
||||
!macroend
|
||||
|
||||
!macro compute_files_for_current_arch
|
||||
!ifdef APP_32
|
||||
!ifdef APP_ARM64
|
||||
${if} ${IsNativeARM64}
|
||||
!insertmacro arm64_app_files
|
||||
${elseif} ${RunningX64}
|
||||
!insertmacro x64_app_files
|
||||
${else}
|
||||
!insertmacro ia32_app_files
|
||||
${endIf}
|
||||
!else
|
||||
${if} ${RunningX64}
|
||||
!insertmacro x64_app_files
|
||||
${else}
|
||||
!insertmacro ia32_app_files
|
||||
${endIf}
|
||||
!endif
|
||||
!else
|
||||
!ifdef APP_ARM64
|
||||
${if} ${IsNativeARM64}
|
||||
!insertmacro arm64_app_files
|
||||
${else}
|
||||
!insertmacro x64_app_files
|
||||
${endIf}
|
||||
!else
|
||||
!insertmacro x64_app_files
|
||||
!endif
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro arm64_app_files
|
||||
File /oname=$PLUGINSDIR\app-arm64.${COMPRESSION_METHOD} "${APP_ARM64}"
|
||||
!macroend
|
||||
|
||||
!macro x64_app_files
|
||||
File /oname=$PLUGINSDIR\app-64.${COMPRESSION_METHOD} "${APP_64}"
|
||||
!macroend
|
||||
|
||||
!macro ia32_app_files
|
||||
StrCpy $packageArch "32"
|
||||
File /oname=$PLUGINSDIR\app-32.${COMPRESSION_METHOD} "${APP_32}"
|
||||
!macroend
|
||||
|
||||
!macro extractUsing7za FILE
|
||||
Nsis7z::Extract "${FILE}"
|
||||
!macroend
|
157
buildfiles/node_modules/app-builder-lib/templates/nsis/include/getProcessInfo.nsh
generated
vendored
Normal file
157
buildfiles/node_modules/app-builder-lib/templates/nsis/include/getProcessInfo.nsh
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
; NSIS PROCESS INFO LIBRARY - GetProcessInfo.nsh
|
||||
; Version 1.1 - Mar 28th, 2011
|
||||
;
|
||||
; Description:
|
||||
; Gets process information.
|
||||
;
|
||||
; Usage example:
|
||||
; ${GetProcessInfo} 0 $0 $1 $2 $3 $4
|
||||
; DetailPrint "pid=$0 parent_pid=$1 priority=$2 process_name=$3 exe=$4"
|
||||
;
|
||||
; History:
|
||||
; 1.1 - 28/03/2011 - Added uninstall function, include guards, file header. Fixed getting full exe path on pre vista systems. (Sergius)
|
||||
;
|
||||
|
||||
!ifndef GETPROCESSINFO_INCLUDED
|
||||
!define GETPROCESSINFO_INCLUDED
|
||||
|
||||
!define PROCESSINFO.TH32CS_SNAPPROCESS 2
|
||||
!define PROCESSINFO.INVALID_HANDLE_VALUE -1
|
||||
|
||||
!define GetProcessInfo '!insertmacro GetProcessInfo'
|
||||
|
||||
;@in pid_in - if 0 - get current process info
|
||||
;@out pid_out - real process id (may be useful, if pid_in=0)
|
||||
;@out ppid - parent process id
|
||||
;@out priority
|
||||
;@out name - name of process
|
||||
;@out fullname - fully-qualified path of process
|
||||
!macro GetProcessInfo pid_in pid_out ppid priority name fullname
|
||||
Push ${pid_in}
|
||||
!ifdef BUILD_UNINSTALLER
|
||||
Call un._GetProcessInfo
|
||||
!else
|
||||
Call _GetProcessInfo
|
||||
!endif
|
||||
;name;pri;ppid;fname;pid;
|
||||
Pop ${name}
|
||||
Pop ${priority}
|
||||
Pop ${ppid}
|
||||
Pop ${fullname}
|
||||
Pop ${pid_out}
|
||||
!macroend
|
||||
|
||||
!macro FUNC_GETPROCESSINFO
|
||||
Exch $R3 ;pid
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $R0 ;hSnapshot
|
||||
Push $R1 ;result
|
||||
Push $R9 ;PROCESSENTRY32;MODULEENTRY32 and so on
|
||||
Push $R8
|
||||
|
||||
;zero registers to waste trash, if error occurred
|
||||
StrCpy $0 ""
|
||||
StrCpy $1 ""
|
||||
StrCpy $2 ""
|
||||
StrCpy $3 ""
|
||||
StrCpy $4 ""
|
||||
StrCpy $5 ""
|
||||
|
||||
IntCmp $R3 0 0 skip_pid_detection skip_pid_detection
|
||||
System::Call 'kernel32::GetCurrentProcess() i.R0'
|
||||
System::Call "Kernel32::GetProcessId(i R0) i.R3"
|
||||
|
||||
skip_pid_detection:
|
||||
System::Call 'Kernel32::CreateToolhelp32Snapshot(i ${PROCESSINFO.TH32CS_SNAPPROCESS},i R3) i.R0'
|
||||
|
||||
IntCmp $R0 ${PROCESSINFO.INVALID_HANDLE_VALUE} end ;someting wrong
|
||||
|
||||
;$R9=PROCESSENTRY32
|
||||
;typedef struct tagPROCESSENTRY32 {
|
||||
; DWORD dwSize;
|
||||
; DWORD cntUsage;
|
||||
; DWORD th32ProcessID;
|
||||
; ULONG_PTR th32DefaultHeapID;
|
||||
; DWORD th32ModuleID;
|
||||
; DWORD cntThreads;
|
||||
; DWORD th32ParentProcessID;
|
||||
; LONG pcPriClassBase;
|
||||
; DWORD dwFlags;
|
||||
; TCHAR szExeFile[MAX_PATH];
|
||||
;}PROCESSENTRY32, *PPROCESSENTRY32;
|
||||
;dwSize=4*9+2*260
|
||||
|
||||
System::Alloc 1024
|
||||
pop $R9
|
||||
System::Call "*$R9(i 556)"
|
||||
|
||||
System::Call 'Kernel32::Process32FirstW(i R0, i $R9) i.R1'
|
||||
StrCmp $R1 0 end
|
||||
|
||||
nnext_iteration:
|
||||
System::Call "*$R9(i,i,i.R1)" ;get PID
|
||||
IntCmp $R1 $R3 exitloop
|
||||
|
||||
System::Call 'Kernel32::Process32NextW(i R0, i $R9) i.R1'
|
||||
IntCmp $R1 0 0 nnext_iteration nnext_iteration
|
||||
|
||||
exitloop:
|
||||
;$0 - pid
|
||||
;$1 - threads
|
||||
;$2 - ppid
|
||||
;$3 - priority
|
||||
;$4 - process name
|
||||
System::Call "*$R9(i,i,i.r0,i,i,i.r1,i.r2,i.r3,i,&w256.r4)" ; Get next module
|
||||
|
||||
;free:
|
||||
System::Free $R9
|
||||
System::Call "Kernel32::CloseToolhelp32Snapshot(i R0)"
|
||||
|
||||
;===============
|
||||
;now get full path and commandline
|
||||
|
||||
System::Call "Kernel32::OpenProcess(i 1040, i 0, i r0)i .R0"
|
||||
|
||||
StrCmp $R0 0 end
|
||||
|
||||
IntOp $R8 0 + 256
|
||||
System::Call "psapi::GetModuleFileNameExW(i R0,i 0,t .r5, *i $R8)i .R1"
|
||||
|
||||
end:
|
||||
Pop $R8
|
||||
Pop $R9
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
Exch $5
|
||||
Exch 1
|
||||
Exch $4
|
||||
Exch 2
|
||||
Exch $3
|
||||
Exch 3
|
||||
Exch $2
|
||||
Exch 4
|
||||
Pop $1
|
||||
Exch 4
|
||||
Exch $0
|
||||
Exch 5
|
||||
Pop $R3
|
||||
!macroend ;FUNC_GETPROCESSINFO
|
||||
|
||||
!ifndef BUILD_UNINSTALLER
|
||||
Function _GetProcessInfo
|
||||
!insertmacro FUNC_GETPROCESSINFO
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
!ifdef BUILD_UNINSTALLER
|
||||
Function un._GetProcessInfo
|
||||
!insertmacro FUNC_GETPROCESSINFO
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
!endif ;GETPROCESSINFO_INCLUDED
|
192
buildfiles/node_modules/app-builder-lib/templates/nsis/include/installUtil.nsh
generated
vendored
Normal file
192
buildfiles/node_modules/app-builder-lib/templates/nsis/include/installUtil.nsh
generated
vendored
Normal file
@ -0,0 +1,192 @@
|
||||
!macro moveFile FROM TO
|
||||
ClearErrors
|
||||
Rename `${FROM}` `${TO}`
|
||||
${if} ${errors}
|
||||
# not clear - can NSIS rename on another drive or not, so, in case of error, just copy
|
||||
ClearErrors
|
||||
!insertmacro copyFile `${FROM}` `${TO}`
|
||||
Delete `${FROM}`
|
||||
${endif}
|
||||
!macroend
|
||||
|
||||
!macro copyFile FROM TO
|
||||
${StdUtils.GetParentPath} $R5 `${TO}`
|
||||
CreateDirectory `$R5`
|
||||
ClearErrors
|
||||
CopyFiles /SILENT `${FROM}` `${TO}`
|
||||
!macroend
|
||||
|
||||
Function GetInQuotes
|
||||
Exch $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
|
||||
StrCpy $R2 -1
|
||||
IntOp $R2 $R2 + 1
|
||||
StrCpy $R3 $R0 1 $R2
|
||||
StrCmp $R3 "" 0 +3
|
||||
StrCpy $R0 ""
|
||||
Goto Done
|
||||
StrCmp $R3 '"' 0 -5
|
||||
|
||||
IntOp $R2 $R2 + 1
|
||||
StrCpy $R0 $R0 "" $R2
|
||||
|
||||
StrCpy $R2 0
|
||||
IntOp $R2 $R2 + 1
|
||||
StrCpy $R3 $R0 1 $R2
|
||||
StrCmp $R3 "" 0 +3
|
||||
StrCpy $R0 ""
|
||||
Goto Done
|
||||
StrCmp $R3 '"' 0 -5
|
||||
|
||||
StrCpy $R0 $R0 $R2
|
||||
Done:
|
||||
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
!macro GetInQuotes Var Str
|
||||
Push "${Str}"
|
||||
Call GetInQuotes
|
||||
Pop "${Var}"
|
||||
!macroend
|
||||
|
||||
Function GetFileParent
|
||||
Exch $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
|
||||
StrCpy $R1 0
|
||||
StrLen $R2 $R0
|
||||
|
||||
loop:
|
||||
IntOp $R1 $R1 + 1
|
||||
IntCmp $R1 $R2 get 0 get
|
||||
StrCpy $R3 $R0 1 -$R1
|
||||
StrCmp $R3 "\" get
|
||||
Goto loop
|
||||
|
||||
get:
|
||||
StrCpy $R0 $R0 -$R1
|
||||
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
Var /GLOBAL isTryToKeepShortcuts
|
||||
|
||||
!macro setIsTryToKeepShortcuts
|
||||
StrCpy $isTryToKeepShortcuts "true"
|
||||
!ifdef allowToChangeInstallationDirectory
|
||||
${ifNot} ${isUpdated}
|
||||
StrCpy $isTryToKeepShortcuts "false"
|
||||
${endIf}
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
# https://nsis-dev.github.io/NSIS-Forums/html/t-172971.html
|
||||
!macro readReg VAR ROOT_KEY SUB_KEY NAME
|
||||
${if} "${ROOT_KEY}" == "SHELL_CONTEXT"
|
||||
ReadRegStr "${VAR}" SHELL_CONTEXT "${SUB_KEY}" "${NAME}"
|
||||
${elseif} "${ROOT_KEY}" == "HKEY_CURRENT_USER"
|
||||
ReadRegStr "${VAR}" HKEY_CURRENT_USER "${SUB_KEY}" "${NAME}"
|
||||
${elseif} "${ROOT_KEY}" == "HKEY_LOCAL_MACHINE"
|
||||
ReadRegStr "${VAR}" HKEY_LOCAL_MACHINE "${SUB_KEY}" "${NAME}"
|
||||
${else}
|
||||
MessageBox MB_OK "Unsupported ${ROOT_KEY}"
|
||||
${endif}
|
||||
!macroend
|
||||
|
||||
# http://stackoverflow.com/questions/24595887/waiting-for-nsis-uninstaller-to-finish-in-nsis-installer-either-fails-or-the-uni
|
||||
Function uninstallOldVersion
|
||||
Var /GLOBAL uninstallerFileName
|
||||
Var /Global uninstallerFileNameTemp
|
||||
Var /GLOBAL installationDir
|
||||
Var /GLOBAL uninstallString
|
||||
Var /GLOBAL rootKey
|
||||
|
||||
ClearErrors
|
||||
Exch $rootKey
|
||||
|
||||
!insertmacro readReg $uninstallString "$rootKey" "${UNINSTALL_REGISTRY_KEY}" UninstallString
|
||||
${if} $uninstallString == ""
|
||||
!ifdef UNINSTALL_REGISTRY_KEY_2
|
||||
!insertmacro readReg $uninstallString "$rootKey" "${UNINSTALL_REGISTRY_KEY_2}" UninstallString
|
||||
!endif
|
||||
${if} $uninstallString == ""
|
||||
Goto Done
|
||||
${endif}
|
||||
${endif}
|
||||
|
||||
# uninstaller should be copied out of app installation dir (because this dir will be deleted), so, extract uninstaller file name
|
||||
!insertmacro GetInQuotes $uninstallerFileName "$uninstallString"
|
||||
|
||||
!insertmacro readReg $installationDir "$rootKey" "${INSTALL_REGISTRY_KEY}" InstallLocation
|
||||
${if} $installationDir == ""
|
||||
${andIf} $uninstallerFileName != ""
|
||||
# https://github.com/electron-userland/electron-builder/issues/735#issuecomment-246918567
|
||||
Push $uninstallerFileName
|
||||
Call GetFileParent
|
||||
Pop $installationDir
|
||||
${endif}
|
||||
|
||||
${if} $installationDir == ""
|
||||
${andIf} $uninstallerFileName == ""
|
||||
Goto Done
|
||||
${endif}
|
||||
|
||||
${if} $installMode == "CurrentUser"
|
||||
${orIf} $rootKey == "HKEY_CURRENT_USER"
|
||||
StrCpy $0 "/currentuser"
|
||||
${else}
|
||||
StrCpy $0 "/allusers"
|
||||
${endif}
|
||||
|
||||
!insertMacro setIsTryToKeepShortcuts
|
||||
|
||||
${if} $isTryToKeepShortcuts == "true"
|
||||
!insertmacro readReg $R5 "$rootKey" "${INSTALL_REGISTRY_KEY}" KeepShortcuts
|
||||
# if true, it means that old uninstaller supports --keep-shortcuts flag
|
||||
${if} $R5 == "true"
|
||||
${andIf} ${FileExists} "$appExe"
|
||||
StrCpy $0 "$0 --keep-shortcuts"
|
||||
${endIf}
|
||||
${endIf}
|
||||
|
||||
${if} ${isDeleteAppData}
|
||||
StrCpy $0 "$0 --delete-app-data"
|
||||
${else}
|
||||
# always pass --updated flag - to ensure that if DELETE_APP_DATA_ON_UNINSTALL is defined, user data will be not removed
|
||||
StrCpy $0 "$0 --updated"
|
||||
${endif}
|
||||
|
||||
StrCpy $uninstallerFileNameTemp "$PLUGINSDIR\old-uninstaller.exe"
|
||||
!insertmacro copyFile "$uninstallerFileName" "$uninstallerFileNameTemp"
|
||||
|
||||
ExecWait '"$uninstallerFileNameTemp" /S /KEEP_APP_DATA $0 _?=$installationDir' $R0
|
||||
ifErrors 0 ExecErrorHandler
|
||||
# the execution failed - might have been caused by some group policy restrictions
|
||||
# we try to execute the uninstaller in place
|
||||
ExecWait '"$uninstallerFileName" /S /KEEP_APP_DATA $0 _?=$installationDir' $R0
|
||||
ifErrors 0 ExecErrorHandler
|
||||
# this also failed...
|
||||
DetailPrint `Aborting, uninstall was not successful. Not able to launch uninstaller!`
|
||||
ExecErrorHandler:
|
||||
${if} $R0 != 0
|
||||
DetailPrint `Aborting, uninstall was not successful. Uninstaller error code: $R0.`
|
||||
${endif}
|
||||
Done:
|
||||
FunctionEnd
|
||||
|
||||
!macro uninstallOldVersion ROOT_KEY
|
||||
Push "${ROOT_KEY}"
|
||||
Call uninstallOldVersion
|
||||
!macroend
|
227
buildfiles/node_modules/app-builder-lib/templates/nsis/include/installer.nsh
generated
vendored
Normal file
227
buildfiles/node_modules/app-builder-lib/templates/nsis/include/installer.nsh
generated
vendored
Normal file
@ -0,0 +1,227 @@
|
||||
# functions (nsis macro) for installer
|
||||
|
||||
!include "extractAppPackage.nsh"
|
||||
|
||||
!ifdef APP_PACKAGE_URL
|
||||
!include webPackage.nsh
|
||||
!endif
|
||||
|
||||
!macro installApplicationFiles
|
||||
!ifdef APP_BUILD_DIR
|
||||
File /r "${APP_BUILD_DIR}\*.*"
|
||||
!else
|
||||
!ifdef APP_PACKAGE_URL
|
||||
Var /GLOBAL packageFile
|
||||
Var /GLOBAL isPackageFileExplicitlySpecified
|
||||
|
||||
${StdUtils.GetParameter} $packageFile "package-file" ""
|
||||
${if} $packageFile == ""
|
||||
!ifdef APP_64_NAME
|
||||
!ifdef APP_32_NAME
|
||||
!ifdef APP_ARM64_NAME
|
||||
${if} ${IsNativeARM64}
|
||||
StrCpy $packageFile "${APP_ARM64_NAME}"
|
||||
StrCpy $1 "${APP_ARM64_HASH}"
|
||||
${elseif} ${IsNativeAMD64}
|
||||
StrCpy $packageFile "${APP_64_NAME}"
|
||||
StrCpy $1 "${APP_64_HASH}"
|
||||
${else}
|
||||
StrCpy $packageFile "${APP_32_NAME}"
|
||||
StrCpy $1 "${APP_32_HASH}"
|
||||
${endif}
|
||||
!else
|
||||
${if} ${RunningX64}
|
||||
StrCpy $packageFile "${APP_64_NAME}"
|
||||
StrCpy $1 "${APP_64_HASH}"
|
||||
${else}
|
||||
StrCpy $packageFile "${APP_32_NAME}"
|
||||
StrCpy $1 "${APP_32_HASH}"
|
||||
${endif}
|
||||
!endif
|
||||
!else
|
||||
StrCpy $packageFile "${APP_64_NAME}"
|
||||
StrCpy $1 "${APP_64_HASH}"
|
||||
!endif
|
||||
!else
|
||||
StrCpy $packageFile "${APP_32_NAME}"
|
||||
StrCpy $1 "${APP_32_HASH}"
|
||||
!endif
|
||||
StrCpy $4 "$packageFile"
|
||||
StrCpy $packageFile "$EXEDIR/$packageFile"
|
||||
StrCpy $isPackageFileExplicitlySpecified "false"
|
||||
${else}
|
||||
StrCpy $isPackageFileExplicitlySpecified "true"
|
||||
${endIf}
|
||||
|
||||
# we do not check file hash is specifed explicitly using --package-file because it is clear that user definitely want to use this file and it is user responsibility to check
|
||||
# 1. auto-updater uses --package-file and validates checksum
|
||||
# 2. user can user another package file (use case - one installer suitable for any app version (use latest version))
|
||||
${if} ${FileExists} "$packageFile"
|
||||
${if} $isPackageFileExplicitlySpecified == "true"
|
||||
Goto fun_extract
|
||||
${else}
|
||||
${StdUtils.HashFile} $3 "SHA2-512" "$packageFile"
|
||||
${if} $3 == $1
|
||||
Goto fun_extract
|
||||
${else}
|
||||
MessageBox MB_OK "Package file $4 found locally, but checksum doesn't match — expected $1, actual $3.$\r$\nLocal file is ignored and package will be downloaded from Internet."
|
||||
${endIf}
|
||||
${endIf}
|
||||
${endIf}
|
||||
|
||||
!insertmacro downloadApplicationFiles
|
||||
|
||||
fun_extract:
|
||||
!insertmacro extractUsing7za "$packageFile"
|
||||
|
||||
# electron always uses per user app data
|
||||
${if} $installMode == "all"
|
||||
SetShellVarContext current
|
||||
${endif}
|
||||
|
||||
!insertmacro moveFile "$packageFile" "$LOCALAPPDATA\${APP_PACKAGE_STORE_FILE}"
|
||||
|
||||
${if} $installMode == "all"
|
||||
SetShellVarContext all
|
||||
${endif}
|
||||
!else
|
||||
!insertmacro extractEmbeddedAppPackage
|
||||
# electron always uses per user app data
|
||||
${if} $installMode == "all"
|
||||
SetShellVarContext current
|
||||
${endif}
|
||||
!insertmacro copyFile "$EXEPATH" "$LOCALAPPDATA\${APP_INSTALLER_STORE_FILE}"
|
||||
${if} $installMode == "all"
|
||||
SetShellVarContext all
|
||||
${endif}
|
||||
!endif
|
||||
!endif
|
||||
|
||||
File "/oname=${UNINSTALL_FILENAME}" "${UNINSTALLER_OUT_FILE}"
|
||||
!macroend
|
||||
|
||||
!macro registryAddInstallInfo
|
||||
WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" InstallLocation "$INSTDIR"
|
||||
WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" KeepShortcuts "true"
|
||||
WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" ShortcutName "${SHORTCUT_NAME}"
|
||||
!ifdef MENU_FILENAME
|
||||
WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" MenuDirectory "${MENU_FILENAME}"
|
||||
!endif
|
||||
|
||||
${if} $installMode == "all"
|
||||
StrCpy $0 "/allusers"
|
||||
StrCpy $1 ""
|
||||
${else}
|
||||
StrCpy $0 "/currentuser"
|
||||
StrCpy $1 ""
|
||||
${endIf}
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" DisplayName "${UNINSTALL_DISPLAY_NAME}$1"
|
||||
# https://github.com/electron-userland/electron-builder/issues/750
|
||||
StrCpy $2 "$INSTDIR\${UNINSTALL_FILENAME}"
|
||||
WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" UninstallString '"$2" $0'
|
||||
WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" QuietUninstallString '"$2" $0 /S'
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
|
||||
!ifdef UNINSTALLER_ICON
|
||||
WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\uninstallerIcon.ico"
|
||||
!else
|
||||
WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$appExe,0"
|
||||
!endif
|
||||
|
||||
!ifdef COMPANY_NAME
|
||||
WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${COMPANY_NAME}"
|
||||
!endif
|
||||
|
||||
WriteRegDWORD SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" NoModify 1
|
||||
WriteRegDWORD SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" NoRepair 1
|
||||
|
||||
# allow user to define ESTIMATED_SIZE to avoid GetSize call
|
||||
!ifdef ESTIMATED_SIZE
|
||||
IntFmt $0 "0x%08X" ${ESTIMATED_SIZE}
|
||||
!else
|
||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||
IntFmt $0 "0x%08X" $0
|
||||
!endif
|
||||
|
||||
WriteRegDWORD SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "EstimatedSize" "$0"
|
||||
!macroend
|
||||
|
||||
!macro cleanupOldMenuDirectory
|
||||
${if} $oldMenuDirectory != ""
|
||||
!ifdef MENU_FILENAME
|
||||
${if} $oldMenuDirectory != "${MENU_FILENAME}"
|
||||
RMDir "$SMPROGRAMS\$oldMenuDirectory"
|
||||
${endIf}
|
||||
!else
|
||||
RMDir "$SMPROGRAMS\$oldMenuDirectory"
|
||||
!endif
|
||||
${endIf}
|
||||
!macroend
|
||||
|
||||
!macro createMenuDirectory
|
||||
!ifdef MENU_FILENAME
|
||||
CreateDirectory "$SMPROGRAMS\${MENU_FILENAME}"
|
||||
ClearErrors
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro addStartMenuLink keepShortcuts
|
||||
!ifndef DO_NOT_CREATE_START_MENU_SHORTCUT
|
||||
# The keepShortcuts mechanism is NOT enabled.
|
||||
# Menu shortcut will be recreated.
|
||||
${if} $keepShortcuts == "false"
|
||||
!insertmacro cleanupOldMenuDirectory
|
||||
!insertmacro createMenuDirectory
|
||||
|
||||
CreateShortCut "$newStartMenuLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}"
|
||||
# clear error (if shortcut already exists)
|
||||
ClearErrors
|
||||
WinShell::SetLnkAUMI "$newStartMenuLink" "${APP_ID}"
|
||||
# The keepShortcuts mechanism IS enabled.
|
||||
# The menu shortcut could either not exist (it shouldn't be recreated) or exist in an obsolete location.
|
||||
${elseif} $oldStartMenuLink != $newStartMenuLink
|
||||
${andIf} ${FileExists} "$oldStartMenuLink"
|
||||
!insertmacro createMenuDirectory
|
||||
|
||||
Rename $oldStartMenuLink $newStartMenuLink
|
||||
WinShell::UninstShortcut "$oldStartMenuLink"
|
||||
WinShell::SetLnkAUMI "$newStartMenuLink" "${APP_ID}"
|
||||
|
||||
!insertmacro cleanupOldMenuDirectory
|
||||
${endIf}
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro addDesktopLink keepShortcuts
|
||||
!ifndef DO_NOT_CREATE_DESKTOP_SHORTCUT
|
||||
# https://github.com/electron-userland/electron-builder/pull/1432
|
||||
${ifNot} ${isNoDesktopShortcut}
|
||||
# The keepShortcuts mechanism is NOT enabled.
|
||||
# Shortcuts will be recreated.
|
||||
${if} $keepShortcuts == "false"
|
||||
CreateShortCut "$newDesktopLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}"
|
||||
ClearErrors
|
||||
WinShell::SetLnkAUMI "$newDesktopLink" "${APP_ID}"
|
||||
# The keepShortcuts mechanism IS enabled.
|
||||
# The desktop shortcut could exist in an obsolete location (due to name change).
|
||||
${elseif} $oldDesktopLink != $newDesktopLink
|
||||
${orIf} ${FileExists} "$oldDesktopLink"
|
||||
Rename $oldDesktopLink $newDesktopLink
|
||||
WinShell::UninstShortcut "$oldDesktopLink"
|
||||
WinShell::SetLnkAUMI "$newDesktopLink" "${APP_ID}"
|
||||
|
||||
!ifdef RECREATE_DESKTOP_SHORTCUT
|
||||
${elseif} $oldDesktopLink != $newDesktopLink
|
||||
${orIfNot} ${FileExists} "$oldDesktopLink"
|
||||
${ifNot} ${isUpdated}
|
||||
CreateShortCut "$newDesktopLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}"
|
||||
ClearErrors
|
||||
WinShell::SetLnkAUMI "$newDesktopLink" "${APP_ID}"
|
||||
${endIf}
|
||||
!endif
|
||||
${endIf}
|
||||
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
|
||||
${endIf}
|
||||
!endif
|
||||
!macroend
|
28
buildfiles/node_modules/app-builder-lib/templates/nsis/include/nsProcess.nsh
generated
vendored
Normal file
28
buildfiles/node_modules/app-builder-lib/templates/nsis/include/nsProcess.nsh
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess`
|
||||
|
||||
!macro nsProcess::FindProcess _FILE _ERR
|
||||
nsProcess::_FindProcess /NOUNLOAD `${_FILE}`
|
||||
Pop ${_ERR}
|
||||
!macroend
|
||||
|
||||
|
||||
!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess`
|
||||
|
||||
!macro nsProcess::KillProcess _FILE _ERR
|
||||
nsProcess::_KillProcess /NOUNLOAD `${_FILE}`
|
||||
Pop ${_ERR}
|
||||
!macroend
|
||||
|
||||
!define nsProcess::CloseProcess `!insertmacro nsProcess::CloseProcess`
|
||||
|
||||
!macro nsProcess::CloseProcess _FILE _ERR
|
||||
nsProcess::_CloseProcess /NOUNLOAD `${_FILE}`
|
||||
Pop ${_ERR}
|
||||
!macroend
|
||||
|
||||
|
||||
!define nsProcess::Unload `!insertmacro nsProcess::Unload`
|
||||
|
||||
!macro nsProcess::Unload
|
||||
nsProcess::_Unload
|
||||
!macroend
|
64
buildfiles/node_modules/app-builder-lib/templates/nsis/include/webPackage.nsh
generated
vendored
Normal file
64
buildfiles/node_modules/app-builder-lib/templates/nsis/include/webPackage.nsh
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
!macro downloadApplicationFiles
|
||||
Var /GLOBAL packageUrl
|
||||
Var /GLOBAL packageArch
|
||||
|
||||
StrCpy $packageUrl "${APP_PACKAGE_URL}"
|
||||
StrCpy $packageArch "${APP_PACKAGE_URL}"
|
||||
|
||||
!ifdef APP_PACKAGE_URL_IS_INCOMLETE
|
||||
!ifdef APP_64_NAME
|
||||
!ifdef APP_32_NAME
|
||||
!ifdef APP_ARM64_NAME
|
||||
${if} ${IsNativeARM64}
|
||||
StrCpy $packageUrl "$packageUrl/${APP_ARM64_NAME}"
|
||||
${elseif} ${IsNativeAMD64}
|
||||
StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
|
||||
${else}
|
||||
StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
|
||||
${endif}
|
||||
!else
|
||||
${if} ${IsNativeAMD64}
|
||||
StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
|
||||
${else}
|
||||
StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
|
||||
${endif}
|
||||
!endif
|
||||
!else
|
||||
StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
|
||||
!endif
|
||||
!else
|
||||
StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
|
||||
!endif
|
||||
!endif
|
||||
|
||||
${if} ${IsNativeARM64}
|
||||
StrCpy $packageArch "ARM64"
|
||||
${elseif} ${IsNativeAMD64}
|
||||
StrCpy $packageArch "64"
|
||||
${else}
|
||||
StrCpy $packageArch "32"
|
||||
${endif}
|
||||
|
||||
download:
|
||||
inetc::get /USERAGENT "electron-builder (Mozilla)" /HEADER "X-Arch: $packageArch" /RESUME "" "$packageUrl" "$PLUGINSDIR\package.7z" /END
|
||||
Pop $0
|
||||
|
||||
${if} $0 == "Cancelled"
|
||||
Quit
|
||||
${endif}
|
||||
|
||||
${if} $0 != "OK"
|
||||
# try without proxy
|
||||
inetc::get /NOPROXY /USERAGENT "electron-builder (Mozilla)" /HEADER "X-Arch: $packageArch" /RESUME "" "$packageUrl" "$PLUGINSDIR\package.7z" /END
|
||||
Pop $0
|
||||
${endif}
|
||||
|
||||
${if} $0 == "Cancelled"
|
||||
quit
|
||||
${elseif} $0 != "OK"
|
||||
Messagebox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Unable to download application package from $packageUrl (status: $0).$\r$\n$\r$\nPlease check you Internet connection and retry." IDRETRY download
|
||||
Quit
|
||||
${endif}
|
||||
|
||||
StrCpy $packageFile "$PLUGINSDIR\package.7z"
|
||||
!macroend
|
Reference in New Issue
Block a user