diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index c6b934f..8d492fc 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -1,7 +1,7 @@ # ----------------------------------------------------------------------------- # Build workflow for portable apps # Author: Urs Roesch https://github.com/uroesch -# Version: 0.0.4 +# Version: 0.1.0 # ----------------------------------------------------------------------------- name: build-package @@ -16,13 +16,19 @@ on: jobs: build-package: timeout-minutes: 15 - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest env: DISPLAY: ':7777' PA_DOWNLOAD: https://sourceforge.net/projects/portableapps/files/PortableApps.com%%20%s/%s/download steps: - name: Install Wine ~ hick ~ + if: runner.os == 'Linux' shell: bash run: > sudo dpkg --add-architecture i386 && @@ -30,6 +36,7 @@ jobs: sudo apt-get -y install wine32 - name: Install Virtual Frame Buffer + if: runner.os == 'Linux' shell: bash run: sudo apt-get -y install xvfb @@ -53,6 +60,7 @@ jobs: lfs: true - name: Start Virtual Frame Buffer + if: runner.os == 'Linux' shell: bash run: Xvfb ${DISPLAY} -ac & diff --git a/Other/Source/PortableApps.comInstaller.bmp b/Other/Source/PortableApps.comInstaller.bmp new file mode 100644 index 0000000..f25c2ed Binary files /dev/null and b/Other/Source/PortableApps.comInstaller.bmp differ diff --git a/Other/Source/PortableApps.comInstaller.ico b/Other/Source/PortableApps.comInstaller.ico new file mode 100644 index 0000000..055cbcd --- /dev/null +++ b/Other/Source/PortableApps.comInstaller.ico @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b675fb4a906161ecd824965898ddc7de721b8b587a3531b43df2bc849160365f +size 100002 diff --git a/Other/Source/PortableApps.comInstaller.nsi b/Other/Source/PortableApps.comInstaller.nsi new file mode 100644 index 0000000..85fce18 --- /dev/null +++ b/Other/Source/PortableApps.comInstaller.nsi @@ -0,0 +1,1848 @@ +;Copyright 2007-2020 John T. Haller of PortableApps.com +;Website: http://PortableApps.com/ + +;This software is OSI Certified Open Source Software. +;OSI Certified is a certification mark of the Open Source Initiative. + +;This program is free software; you can redistribute it and/or +;modify it under the terms of the GNU General Public License +;as published by the Free Software Foundation; either version 2 +;of the License, or (at your option) any later version. + +;This program 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 General Public License for more details. + +;You should have received a copy of the GNU General Public License +;along with this program; if not, write to the Free Software +;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +;EXCEPTION: The PortableApps.com Installer can be used with open source +;applications licensed under OSI-approved licenses as well as freeware provided +;it is unmodified and it adheres to the current PortableApps.com Format Specification +;as published at PortableApps.com/development. It may also be used with commercial +;software by contacting PortableApps.com. + +;NSIS3 +Unicode true +ManifestDPIAware true + +!define PORTABLEAPPSINSTALLERVERSION "3.5.16.0" +!define PORTABLEAPPS.COMFORMATVERSION "3.5.16" + +!if ${__FILE__} == "PortableApps.comInstallerPlugin.nsi" + !include PortableApps.comInstallerPluginConfig.nsh + !define PLUGININSTALLER +!else + !include PortableApps.comInstallerConfig.nsh +!endif + +!define MAINSECTIONIDX 0 +!ifdef MAINSECTIONTITLE + !define OPTIONALSECTIONIDX 1 +!endif + +;7z Usage +!ifdef AdvancedExtract1To + !define bolUses7Zip true +!else + !ifdef DoubleExtract1To + !define bolUses7Zip true + !else + !ifdef Download2AdvancedExtract1To + !define bolUses7Zip true + !else + !ifdef Download2DoubleExtract1To + !define bolUses7Zip true + !else + !ifdef CustomCodeUses7zip + !if CustomCodeUses7zip = true + !define bolUses7Zip true + !endif + !endif + !endif + !endif + !endif +!endif + +;=== Program Details +Name "${PORTABLEAPPNAME}" "${PORTABLEAPPNAMEDOUBLEDAMPERSANDS}" +OutFile "..\..\..\${FILENAME}.paf.exe" +!ifdef COMMONFILESPLUGIN + InstallDir "\CommonFiles\${APPID}" +!else + InstallDir "\${APPID}" +!endif +Caption "${PORTABLEAPPNAME} | PortableApps.com Installer" +VIProductVersion "${VERSION}" +VIAddVersionKey ProductName "${PORTABLEAPPNAME}" +VIAddVersionKey Comments "${INSTALLERCOMMENTS}" +VIAddVersionKey CompanyName "PortableApps.com" +VIAddVersionKey LegalCopyright "2007-2020 PortableApps.com, PortableApps.com Installer ${PORTABLEAPPSINSTALLERVERSION}" +VIAddVersionKey FileDescription "${PORTABLEAPPNAME}" +VIAddVersionKey FileVersion "${VERSION}" +VIAddVersionKey ProductVersion "${VERSION}" +VIAddVersionKey InternalName "${PORTABLEAPPNAME}" +VIAddVersionKey LegalTrademarks "${INSTALLERADDITIONALTRADEMARKS}PortableApps.com is a registered trademark of Rare Ideas, LLC." +VIAddVersionKey OriginalFilename "${FILENAME}.paf.exe" +VIAddVersionKey PortableApps.comInstallerVersion "${PORTABLEAPPSINSTALLERVERSION}" +VIAddVersionKey PortableApps.comFormatVersion "${PORTABLEAPPS.COMFORMATVERSION}" +VIAddVersionKey PortableApps.comAppID "${APPID}" +!ifdef DownloadURL ;advertise the needed bits to the PA.c Updater + VIAddVersionKey PortableApps.comDownloadURL "${DownloadURL}" + VIAddVersionKey PortableApps.comDownloadKnockURL "${DownloadKnockURL}" + VIAddVersionKey PortableApps.comDownloadName "${DownloadName}" + VIAddVersionKey PortableApps.comDownloadFileName "${DownloadFileName}" + !ifdef DownloadMD5 + VIAddVersionKey PortableApps.comDownloadMD5 "${DownloadMD5}" + !endif + !ifdef DownloadCachedByPAc + VIAddVersionKey DownloadCachedByPAc "true" + !endif +!endif +!ifdef Download2URL ;advertise the needed bits to the PA.c Updater + VIAddVersionKey PortableApps.comDownload2URL "${Download2URL}" + VIAddVersionKey PortableApps.comDownload2KnockURL "${Download2KnockURL}" + VIAddVersionKey PortableApps.comDownload2Name "${Download2Name}" + VIAddVersionKey PortableApps.comDownload2FileName "${Download2FileName}" + !ifdef Download2MD5 + VIAddVersionKey PortableApps.comDownload2MD5 "${Download2MD5}" + !endif + !ifdef Download2CachedByPAc + VIAddVersionKey Download2CachedByPAc "true" + !endif +!endif + +;=== Runtime Switches +SetCompress Auto +SetCompressor /SOLID lzma +SetCompressorDictSize 32 +SetDatablockOptimize On +CRCCheck on +AutoCloseWindow True +RequestExecutionLevel user +AllowRootDirInstall true + +;=== Include +!include MUI2.nsh +!include FileFunc.nsh +!include LogicLib.nsh +!ifdef PRESERVEFILE1 + !include PortableApps.comInstallerMoveFiles.nsh +!endif +!ifdef COPYLOCALFILES + !include Registry.nsh +!endif +!include TextFunc.nsh +!include WordFunc.nsh +!include PortableApps.comInstallerDriveFreeSpaceCustom.nsh +!include PortableApps.comInstallerDumpLogToFile.nsh +!include PortableApps.comInstallerProcFunc.nsh +!include PortableApps.comInstallerTBProgress.nsh + +;=== Program Icon +Icon "PortableApps.comInstaller.ico" +!define MUI_ICON "PortableApps.comInstaller.ico" +!define MUI_UNICON "PortableApps.comInstaller.ico" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP "PortableApps.comInstallerHeader.bmp" +!define MUI_HEADERIMAGE_BITMAP_RTL "PortableApps.comInstallerHeaderRTL.bmp" +!define MUI_HEADERIMAGE_RIGHT + +;=== Icon & Stye === +BrandingText "PortableApps.com®" + +;=== Pages +!ifdef COPYLOCALFILES + !define MUI_CUSTOMFUNCTION_ABORT CustomAbortFunction +!endif +!define MUI_LANGDLL_WINDOWTITLE "${PORTABLEAPPNAME}" +!define MUI_LANGDLL_INFO "Please select a language for the installer." +!define MUI_WELCOMEFINISHPAGE_BITMAP "PortableApps.comInstaller.bmp" +!ifdef PLUGINNAME + !define MUI_WELCOMEPAGE_TITLE "${PORTABLEAPPNAMEDOUBLEDAMPERSANDS}" +!else + !define MUI_WELCOMEPAGE_TITLE "${PORTABLEAPPNAMEDOUBLEDAMPERSANDS}" +!endif +!define MUI_WELCOMEPAGE_TEXT "$(welcome)" +!define MUI_PAGE_CUSTOMFUNCTION_PRE PreWelcome +!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowWelcome +!define MUI_COMPONENTSPAGE_SMALLDESC +!insertmacro MUI_PAGE_WELCOME +!ifdef LICENSEAGREEMENT + ;!define MUI_LICENSEPAGE_CHECKBOX + !define MUI_PAGE_CUSTOMFUNCTION_PRE PreLicense + !define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowLicense + !define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveLicense + !insertmacro MUI_PAGE_LICENSE "..\..\App\AppInfo\${LICENSEAGREEMENT}" +!endif +!ifdef MAINSECTIONTITLE + !define MUI_PAGE_CUSTOMFUNCTION_PRE PreComponents + !define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowComponents + !insertmacro MUI_PAGE_COMPONENTS +!endif +!define MUI_DIRECTORYPAGE_VERIFYONLEAVE +!define MUI_PAGE_CUSTOMFUNCTION_PRE PreDirectory +!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowDirectory +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveDirectory +!insertmacro MUI_PAGE_DIRECTORY +!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowInstFiles +!insertmacro MUI_PAGE_INSTFILES +!define MUI_FINISHPAGE_TEXT "$(finish)" +!define MUI_PAGE_CUSTOMFUNCTION_PRE PreFinish +!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowFinish +!define MUI_FINISHPAGE_TITLE_3LINES +;!define MUI_FINISHPAGE_CANCEL_ENABLED ;Disabled due to bug in MUI2 +!ifndef PLUGINNAME + !define MUI_FINISHPAGE_RUN_NOTCHECKED + !define MUI_FINISHPAGE_RUN "$INSTDIR\${FINISHPAGERUN}" +!endif +!insertmacro MUI_PAGE_FINISH + +;=== Languages +!ifndef INSTALLERMULTILINGUAL + !insertmacro MUI_LANGUAGE "${INSTALLERLANGUAGE}" + !include PortableApps.comInstallerLanguages\${INSTALLERLANGUAGE}.nsh +!else + !tempfile LangAutoDetectFile + !macro IncludeLang _LANG_NAME + ; define and filename are all uppercase but both case insensitive + !ifdef USES_${_LANG_NAME} + !insertmacro MUI_LANGUAGE "${_LANG_NAME}" + !include PortableApps.comInstallerLanguages\${_LANG_NAME}.nsh + !appendfile "${LangAutoDetectFile}" "${Case} ${LANG_${_LANG_NAME}}$\n" + !endif + !macroend + !define IncludeLang "!insertmacro IncludeLang" + + ${IncludeLang} English + ${IncludeLang} EnglishGB + ${IncludeLang} Afrikaans + ${IncludeLang} Albanian + ${IncludeLang} Arabic + ${IncludeLang} Armenian + ${IncludeLang} Basque + ${IncludeLang} Belarusian + ${IncludeLang} Bosnian + ${IncludeLang} Breton + ${IncludeLang} Bulgarian + ${IncludeLang} Catalan + ${IncludeLang} Cibemba + ${IncludeLang} Croatian + ${IncludeLang} Czech + ${IncludeLang} Danish + ${IncludeLang} Dutch + ${IncludeLang} Efik + ${IncludeLang} Esperanto + ${IncludeLang} Estonian + ${IncludeLang} Farsi + ${IncludeLang} Finnish + ${IncludeLang} French + ${IncludeLang} Galician + ${IncludeLang} Georgian + ${IncludeLang} German + ${IncludeLang} Greek + ${IncludeLang} Hebrew + ${IncludeLang} Hindi + ${IncludeLang} Hungarian + ${IncludeLang} Icelandic + ${IncludeLang} Igbo + ${IncludeLang} Indonesian + ${IncludeLang} Irish + ${IncludeLang} Italian + ${IncludeLang} Japanese + ${IncludeLang} Khmer + ${IncludeLang} Korean + ${IncludeLang} Kurdish + ${IncludeLang} Latvian + ${IncludeLang} Lithuanian + ${IncludeLang} Luxembourgish + ${IncludeLang} Macedonian + ${IncludeLang} Malagasy + ${IncludeLang} Malay + ${IncludeLang} Mongolian + ${IncludeLang} Norwegian + ${IncludeLang} NorwegianNynorsk + ${IncludeLang} Pashto + ${IncludeLang} Polish + ${IncludeLang} Portuguese + ${IncludeLang} PortugueseBR + ${IncludeLang} Romanian + ${IncludeLang} Russian + ${IncludeLang} Serbian + ${IncludeLang} SerbianLatin + ${IncludeLang} SimpChinese + ${IncludeLang} Slovak + ${IncludeLang} Slovenian + ${IncludeLang} Spanish + ${IncludeLang} SpanishInternational + ${IncludeLang} Swahili + ${IncludeLang} Swedish + ${IncludeLang} Thai + ${IncludeLang} TradChinese + ${IncludeLang} Turkish + ${IncludeLang} Ukrainian + ${IncludeLang} Uzbek + ${IncludeLang} Valencia + ${IncludeLang} Vietnamese + ${IncludeLang} Welsh + ${IncludeLang} Yoruba + + !insertmacro MUI_RESERVEFILE_LANGDLL +!endif + +;=== Macros +;Generic macro for use by defined file/directory handling +!macro !insertmacro1-10 _m +!insertmacro ${_m} 1 +!insertmacro ${_m} 2 +!insertmacro ${_m} 3 +!insertmacro ${_m} 4 +!insertmacro ${_m} 5 +!insertmacro ${_m} 6 +!insertmacro ${_m} 7 +!insertmacro ${_m} 8 +!insertmacro ${_m} 9 +!insertmacro ${_m} 10 +!macroend +!define !insertmacro1-10 "!insertmacro !insertmacro1-10" + +!define PageHeaderHackForHighContrast "!insertmacro PageHeaderHackForHighContrast" +!macro PageHeaderHackForHighContrast + !if ${MUI_SYSVERSION} >= 2 + SetCtlColors $mui.Header.Text 0x000000 0xFFFFFF + SetCtlColors $mui.Header.SubText 0x000000 0xFFFFFF + !else + Push $0 + FindWindow $0 "#32770" "" $HWNDPARENT + GetDlgItem $0 $HWNDPARENT 1037 + SetCtlColors $0 0x000000 0xFFFFFF + GetDlgItem $0 $HWNDPARENT 1038 + SetCtlColors $0 0x000000 0xFFFFFF + Pop $0 + !endif +!macroend + +;=== Variables +Var FOUNDPORTABLEAPPSPATH +!ifdef MAINSECTIONTITLE + Var OPTIONAL1DONE +!endif +Var AUTOMATEDINSTALL +Var AUTOCLOSE +Var SILENTLANGUAGEMODE +Var HIDEINSTALLER +Var MINIMIZEINSTALLER +!ifdef LICENSEAGREEMENT + Var EULAVERSIONMATCH +!endif +!ifdef COPYLOCALFILES + Var CopyLocalFilesFrom + Var CopyLocalFilesTo + Var MISSINGFILEORPATH +!endif +!ifdef DOWNLOADURL + Var MD5MISMATCH + Var DOWNLOADRESULT + Var DOWNLOADEDFILE + Var DOWNLOADALREADYEXISTED + Var SECONDDOWNLOADATTEMPT + Var DownloadURLActual +!endif +!ifdef DOWNLOAD2URL + Var DOWNLOAD2RESULT + Var DOWNLOADED2FILE + Var DOWNLOAD2ALREADYEXISTED + Var SECONDDOWNLOAD2ATTEMPT + Var Download2URLActual +!endif +!ifdef LICENSEAGREEMENT + Var INTERNALEULAVERSION +!endif +Var InstallingStatusString +Var bolAppUpgrade +Var bolLogFile +Var PAcLocaleID +Var strLastDirectory +Var strTimeStore +!ifdef DownloadURL + Var intWarnOnZoneCrossing + Var intSecureProtocols +!endif +Var bolHighContrast + +;=== Custom Code +!ifdef USESCUSTOMCODE + !if ${__FILE__} == "PortableApps.comInstallerPlugin.nsi" + !include PortableApps.comInstallerPluginCustom.nsh + !else + !include PortableApps.comInstallerCustom.nsh + !endif +!endif + +!ifdef INSTALLERMULTILINGUAL + !macro CaseLang _LANG_NAME _LANG_ID + !ifdef USES_${_LANG_NAME} + ${Case} ${_LANG_ID} + !endif + !macroend + !define CaseLang "!insertmacro CaseLang" +!endif + +Function .onInit + ;=== Check for high contrast mode from platform + ReadEnvStr $bolHighContrast "PortableApps.comHighContrast" + + StrCpy $ITaskbarList3 0 ;Small hack to avoid warning when installers have no EULA and can't trigger error state + SetSilent normal + + !ifdef DownloadURL + StrCpy $R0 $EXEFILE "" -15 + ${If} $R0 != "_online.paf.exe" + ${AndIf} $R0 != "line.paf[1].exe" ;Handle IE's renaming of files when run directly from a download + ${AndIf} $R0 != "line.paf[2].exe" + ${AndIf} $R0 != "line.paf[3].exe" + ${AndIf} $R0 != "line.paf[4].exe" + ${AndIf} $R0 != "line.paf[5].exe" + ${AndIf} $R0 != "line.paf[6].exe" + ${AndIf} $R0 != "line.paf[7].exe" + ${AndIf} $R0 != "line.paf[8].exe" + ${AndIf} $R0 != "line.paf[9].exe" + MessageBox MB_OK|MB_ICONSTOP `PortableApps.com Installers that download files must end with "_online.paf.exe". This is to ensure that users always know that an installer downloads files before it is run. Please rename the file to end in _online.paf.exe before running.` + Abort + ${EndIf} + !endif + + InitPluginsDir + + !ifdef INSTALLERMULTILINGUAL + ReadEnvStr $PAcLocaleID "PortableApps.comLocaleID" + ${Switch} $PAcLocaleID + ; Use the Case statements formed earlier. + !include "${LangAutoDetectFile}" + !delfile "${LangAutoDetectFile}" + !undef LangAutoDetectFile + StrCpy $LANGUAGE $PAcLocaleID + ${Break} + ${Default} + ${GetOptions} $CMDLINE "/DESTINATION=" $0 + ${IfNot} ${Errors} + ${AndIf} ${FileExists} `$0\PortableApps.com\PortableAppsPlatform.exe` + ;Automated platform install but doesn't support the exact language + + ;Language Fallbacks, if none, then English + ${If} $PAcLocaleID == 3082 ;SpanishInternational + ${AndIf} ${USES_SPANISH} == "true" + StrCpy $LANGUAGE 1034 ;Spanish + ${Else} + ${If} $PAcLocaleID == 1034 ;Spanish + ${AndIf} ${USES_SPANISHINTERNATIONAL} == "true" + StrCpy $LANGUAGE 3082 ;SpanishInternational + ${Else} + ${If} $PAcLocaleID == 1046 ;PortugueseBR + ${AndIf} ${USES_PORTUGUESE} == "true" + StrCpy $LANGUAGE 2070 ;Portuguese + ${Else} + ${If} $PAcLocaleID == 2070 ;Portuguese + ${AndIf} ${USES_PORTUGUESEBR} == "true" + StrCpy $LANGUAGE 1046 ;PortugueseBR + ${Else} + StrCpy $LANGUAGE 1033 ;English as last fallback + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} + ${Else} + !insertmacro MUI_LANGDLL_DISPLAY + ${EndIf} + ${EndSwitch} + !endif + + ;=== Check for logging mode + ${GetOptions} $CMDLINE "/LOG=" $0 + + ${IfNot} ${Errors} + ${AndIf} $0 == "true" + StrCpy $bolLogFile true + ${Else} + ClearErrors + ${EndIf} + + ;=== Check for a specified installation directory + ${GetOptions} $CMDLINE "/DESTINATION=" $0 + + ${IfNot} ${Errors} + !ifdef COMMONFILESPLUGIN + StrCpy $INSTDIR "$0CommonFiles\${APPID}" + !else + ${GetOptions} $CMDLINE "/COPYNUMBER=" $1 + ${IfNot} ${Errors} + StrCpy $INSTDIR "$0${APPID}_Copy_$1" + ${Else} + StrCpy $INSTDIR "$0${APPID}" + ${EndIf} + !endif + + !ifdef LICENSEAGREEMENT + !ifndef EULAVERSION + StrCpy $INTERNALEULAVERSION "1" + !else + StrCpy $INTERNALEULAVERSION ${EULAVERSION} + !endif + ${If} ${FileExists} "$INSTDIR\Data\PortableApps.comInstaller\license.ini" + ReadINIStr $0 "$INSTDIR\Data\PortableApps.comInstaller\license.ini" "PortableApps.comInstaller" "EULAVersion" + ClearErrors + ${If} $0 == $INTERNALEULAVERSION + StrCpy $EULAVERSIONMATCH "true" + ${EndIf} + ${EndIf} + !endif + + ;=== Check for PortableApps.com Platform + ${GetParent} $INSTDIR $0 + !ifdef COMMONFILESPLUGIN + ${GetParent} $0 $0 + !endif + + ;=== Check that it exists at the right location + DetailPrint '$(checkforplatform)' + + ${If} ${FileExists} `$0\PortableApps.com\PortableAppsPlatform.exe` + ;=== Check that it's the real deal + MoreInfo::GetProductName `$0\PortableApps.com\PortableAppsPlatform.exe` + Pop $1 + ${If} $1 == "PortableApps.com Platform" + MoreInfo::GetCompanyName `$0\PortableApps.com\PortableAppsPlatform.exe` + Pop $1 + ${If} $1 == "PortableApps.com" + ;=== Check that it's running + ${If} ${ProcessExists} "PortableAppsPlatform.exe" + ;=== Do a partially automated install + StrCpy $AUTOMATEDINSTALL "true" + + ClearErrors + ${GetOptions} $CMDLINE "/AUTOCLOSE=" $R0 + ${IfNot} ${Errors} + ${AndIf} $R0 == "true" + StrCpy $AUTOCLOSE "true" + ${EndIf} + + ClearErrors + ${GetOptions} $CMDLINE "/HIDEINSTALLER=" $R0 + ${IfNot} ${Errors} + ${AndIf} $R0 == "true" + StrCpy $HIDEINSTALLER "true" + ${EndIf} + + ClearErrors + ${GetOptions} $CMDLINE "/MINIMIZEINSTALLER=" $R0 + ${IfNot} ${Errors} + ${AndIf} $R0 == "true" + StrCpy $MINIMIZEINSTALLER "true" + ${EndIf} + + ClearErrors + ${GetOptions} $CMDLINE "/SILENT=" $R0 + ${IfNot} ${Errors} + ${AndIf} $R0 == "true" + ;Duplicate of the size calculation code, to be functionalized later + SectionGetSize ${MAINSECTIONIDX} $1 ;=== Space Required for App + + !ifdef MAINSECTIONTITLE + SectionGetFlags ${OPTIONALSECTIONIDX} $9 + IntOp $9 $9 & ${SF_SELECTED} + ${If} $9 >= ${SF_SELECTED} + SectionGetSize ${OPTIONALSECTIONIDX} $2 ;=== Space Required for App + IntOp $1 $1 + $2 + ${EndIf} + !endif + ${GetRoot} $INSTDIR $2 + ;${DriveSpace} `$2\` "/D=F /S=M" $3 ;=== Space Free on Device + ${DriveFreeSpaceCustom} "$2\" $3 + + ;Convert app size to MB from KB + IntOp $1 $1 / 1024 + + ${If} $1 == 0 + ;If less than 1MB, round to 1MB + StrCpy $1 1 + ${EndIf} + + ${If} $3 <= $1 + IntOp $1 $1 * 1024 + IntOp $3 $3 * 1024 + !ifndef PLUGININSTALLER ;=== If not a plugin installer, add the current install size to free space + ${If} ${FileExists} $INSTDIR + ${GetSize} `$INSTDIR` "/M=*.* /S=0K /G=0" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Root Install Size + ${GetSize} `$INSTDIR\App` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current App Install Size + ${GetSize} `$INSTDIR\Other` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Other Install Size + + ${If} `${ADDONSDIRECTORYPRESERVE}` != "NONE" + ${AndIf} ${FileExists} `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` + ${GetSize} `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Size of Data directory + IntOp $3 $3 - $4 ;=== Remove the plugins directory from the free space calculation + ${EndIf} + ${EndIf} + !else + !ifdef COMMONFILESPLUGIN ;Duplicate code for now, to do above for CommonFiles as well + ${If} ${FileExists} $INSTDIR + ${GetSize} `$INSTDIR` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Install Size + ${EndIf} + !endif + !endif + ${If} $3 <= $1 + MessageBox MB_OK|MB_ICONEXCLAMATION "$(notenoughspace)" + Abort + ${EndIf} + ${EndIf} + + !ifdef LICENSEAGREEMENT + ${If} $EULAVERSIONMATCH == "true" + SetSilent silent + ${EndIf} + !else + SetSilent silent + !endif + ${EndIf} + + ClearErrors + ${GetOptions} $CMDLINE "/SILENTLANGUAGEMODE=" $R0 + ${IfNot} ${Errors} + ${If} $R0 == "auto" + ${OrIf} $R0 == "never" + ${OrIf} $R0 == "always" + StrCpy $SILENTLANGUAGEMODE $R0 + ${Else} + StrCpy $SILENTLANGUAGEMODE "auto" + ${EndIf} + ${Else} + StrCpy $SILENTLANGUAGEMODE "auto" + ${EndIf} + + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} + ${Else} + ClearErrors + ;=== Check legacy location + ${GetOptions} $CMDLINE "-o" $R0 + ${IfNot} ${Errors} + !ifdef COMMONFILESPLUGIN + StrCpy $INSTDIR "$R0CommonFiles\${APPID}" + !else + StrCpy $INSTDIR "$R0${APPID}" + !endif + ${Else} + ;=== No installation directory found + ClearErrors + ${If} ${FileExists} "$PROFILE\PortableApps\*.*" + StrCpy $FOUNDPORTABLEAPPSPATH "$Profile\PortableApps" + ${Else} + ${GetDrives} "HDD+FDD" GetDrivesCallBack + ${EndIf} + ${If} $FOUNDPORTABLEAPPSPATH != "" + !ifdef COMMONFILESPLUGIN + StrCpy $INSTDIR "$FOUNDPORTABLEAPPSPATH\CommonFiles\${APPID}" + !else + StrCpy $INSTDIR "$FOUNDPORTABLEAPPSPATH\${APPID}" + !endif + ${Else} + ;If within Program Files, TEMP or IE Cache, no default install path + ${WordFind} "$EXEDIR\" "$PROGRAMFILES\" "*" $R0 + ${WordFind} "$EXEDIR\" "$PROGRAMFILES64\" "*" $R1 + ${WordFind} "$EXEDIR\" "$INTERNET_CACHE\" "*" $R2 + ${WordFind} "$EXEDIR\" "$TEMP\" "*" $R3 + + ${If} $R0 > 0 + ${OrIf} $R1 > 0 + ${OrIf} $R2 > 0 + ${OrIf} $R3 > 0 + StrCpy $INSTDIR "" + ${Else} + !ifdef COMMONFILESPLUGIN + StrCpy $INSTDIR "$EXEDIR\CommonFiles\${APPID}" + !else + StrCpy $INSTDIR "$EXEDIR\${APPID}" + !endif + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} + + !ifdef MAINSECTIONTITLE + !ifdef OPTIONALSECTIONPRESELECTEDIFNONENGLISHINSTALL + ;=== If it's not English, select the optional component (languages) by default + ${IfThen} $LANGUAGE != 1033 ${|} SectionSetFlags 1 ${OPTIONALSECTIONIDX} ${|} + !endif + ${If} ${Silent} + ${If} "${OPTIONALSECTIONINSTALLEDWHENSILENT}" == "true" + SectionSetFlags 1 ${OPTIONALSECTIONIDX} + ${ElseIf} "${OptionalSectionSelectedInstallType}" == "Multilingual" + ${If} $SILENTLANGUAGEMODE != "never" + ${If} $SILENTLANGUAGEMODE == "always" + SectionSetFlags 1 ${OPTIONALSECTIONIDX} + ${Else} + ${IfThen} $LANGUAGE != 1033 ${|} SectionSetFlags 1 ${OPTIONALSECTIONIDX} ${|} + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} + + !endif + + !ifdef COPYLOCALFILES + StrCpy $CopyLocalFilesFrom "" + + ${If} "${CopyFromRegPath}" != "" + ${registry::Read} "${CopyFromRegPath}" "${CopyFromRegKey}" $R0 $R1 + ${If} $R0 != "" + ;Strip trailing slash if there + StrCpy $1 $R0 "" -1 + ${If} $1 == "\" + StrCpy $R0 $R0 -1 + ${EndIf} + + ;Go up directories if needed + ${If} "${CopyFromRegRemoveDirectories}" != "" + StrCpy $1 1 + ${Do} + ${GetParent} $R0 $R0 + IntOp $1 $1 + 1 + ${LoopUntil} $1 > "${CopyFromRegRemoveDirectories}" + ${EndIf} + + ;Check for existence + ${If} ${FileExists} "$R0\*.*" + StrCpy $CopyLocalFilesFrom $R0 + ${EndIf} + ${EndIf} + ${EndIf} + + ;Fallback to direct entry + ${If} $CopyLocalFilesFrom == "" + ${AndIf} "${CopyFromDirectory}" != "" + StrCpy $CopyLocalFilesFrom "${CopyFromDirectory}" + ${WordReplace} $CopyLocalFilesFrom "%PROGRAMFILES%" $PROGRAMFILES + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%PROGRAMFILES32%" $PROGRAMFILES32 + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%PROGRAMFILES64%" $PROGRAMFILES64 + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%COMMONFILES%" $COMMONFILES + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%COMMONFILES32%" $COMMONFILES32 + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%COMMONFILES64%" $COMMONFILES64 + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%DESKTOP%" $DESKTOP + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%WINDIR%" $WINDIR + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%SYSDIR%" $SYSDIR + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%APPDATA%" $APPDATA + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%LOCALAPPDATA%" $LOCALAPPDATA + $CopyLocalFilesFrom + ${WordReplace} $CopyLocalFilesFrom "%TEMP%" $TEMP + $CopyLocalFilesFrom + ${EndIf} + ${If} ${FileExists} "$CopyLocalFilesFrom\*.*" + SectionGetSize ${MAINSECTIONIDX} $0 + ${GetSize} $CopyLocalFilesFrom "/M=*.* /S=0K /G=1" $1 $2 $3 + IntOp $0 $0 + $1 + SectionSetSize ${MAINSECTIONIDX} $0 + ${EndIf} + !endif + !ifdef AdditionalInstallSize + SectionGetSize ${MAINSECTIONIDX} $0 + IntOp $0 $0 + ${AdditionalInstallSize} + SectionSetSize ${MAINSECTIONIDX} $0 + !endif + + ${If} "${CHECKRUNNING}" != "NONE" + ;=== Check if app is running? + RunningTryAgain: + ${If} ${ProcessExists} "${CHECKRUNNING}" + MessageBox MB_OKCANCEL|MB_ICONINFORMATION $(runwarning) IDOK RunningTryAgain IDCANCEL RunningCancel + + RunningCancel: + Abort + ${EndIf} + ${EndIf} +FunctionEnd + +Function PreWelcome + ${IfThen} $AUTOMATEDINSTALL == "true" ${|} Abort ${|} +FunctionEnd + +Function ShowWelcome + SetCtlColors $mui.WelcomePage.Title 0x000000 0xFFFFFF + SetCtlColors $mui.WelcomePage.Text 0x000000 0xFFFFFF +FunctionEnd + +!ifdef LICENSEAGREEMENT +Function PreLicense + ${If} $AUTOMATEDINSTALL == "true" + ${AndIf} $EULAVERSIONMATCH == "true" + Abort + ${EndIf} + + !ifndef EULAVERSION + StrCpy $INTERNALEULAVERSION "1" + !else + StrCpy $INTERNALEULAVERSION "${EULAVERSION}" + !endif + ${If} ${FileExists} "$INSTDIR\Data\PortableApps.comInstaller\license.ini" + ReadINIStr $0 "$INSTDIR\Data\PortableApps.comInstaller\license.ini" "PortableApps.comInstaller" "EULAVersion" + ClearErrors + ${If} $0 == $INTERNALEULAVERSION + ${AndIf} $AUTOMATEDINSTALL == "true" + Abort + ${EndIf} + ${EndIf} +FunctionEnd +Function ShowLicense + ${PageHeaderHackForHighContrast} + ${If} $AUTOMATEDINSTALL == "true" + ${TBProgress} 10 + ${TBProgress_State} Paused + ${EndIf} +FunctionEnd +Function LeaveLicense + ${If} $AUTOMATEDINSTALL == "true" + ${TBProgress_State} NoProgress + ${EndIf} +FunctionEnd +!endif + +Function ShowInstFiles + w7tbp::Start + ${PageHeaderHackForHighContrast} +FunctionEnd + +!ifdef MAINSECTIONTITLE + Function PreComponents + ${If} $AUTOCLOSE != "true" + ${OrIfNot} ${FileExists} "$INSTDIR\App\AppInfo\appinfo.ini" + Return + ${EndIf} + + ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" "Details" "InstallType" + ClearErrors + ${If} $0 == "${OPTIONALSECTIONSELECTEDINSTALLTYPE}" + SectionSetFlags 1 ${OPTIONALSECTIONIDX} + Abort + ${EndIf} + + ;=== Check not selected + ${If} $0 == "${OPTIONALSECTIONNOTSELECTEDINSTALLTYPE}" + SectionSetFlags 0 ${OPTIONALSECTIONIDX} + Abort + ${EndIf} + FunctionEnd + + Function ShowComponents + ${PageHeaderHackForHighContrast} + FunctionEnd +!endif + +Function PreDirectory + ${IfThen} $AUTOMATEDINSTALL == "true" ${|} Abort ${|} + ${IfThen} $AUTOMATEDINSTALL != "true" ${|} Return ${|} + + SectionGetSize ${MAINSECTIONIDX} $1 ;=== Space Required for App + !ifdef MAINSECTIONTITLE + SectionGetFlags ${OPTIONALSECTIONIDX} $9 + IntOp $9 $9 & ${SF_SELECTED} + ${If} $9 >= ${SF_SELECTED} + SectionGetSize ${OPTIONALSECTIONIDX} $2 ;=== Space Required for App + IntOp $1 $1 + $2 + ${EndIf} + !endif + ${GetRoot} $INSTDIR $2 + ;${DriveSpace} `$2\` "/D=F /S=M" $3 ;=== Space Free on Device + ${DriveFreeSpaceCustom} "$2\" $3 + + IntOp $1 $1 / 1024 + + ${If} $3 <= $1 + IntOp $1 $1 * 1024 + IntOp $3 $3 * 1024 + + !ifndef PLUGININSTALLER ;=== If not a plugin installer, add the current install size to free space + ${If} ${FileExists} $INSTDIR + ${GetSize} $INSTDIR "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Install Size + + ${If} ${FileExists} `$INSTDIR\Data` + ${GetSize} `$INSTDIR\Data` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Size of Data directory + IntOp $3 $3 - $4 ;=== Remove the data directory from the free space calculation + ${EndIf} + + ${If} `${ADDONSDIRECTORYPRESERVE}` != "NONE" + ${AndIf} ${FileExists} `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` + ${GetSize} `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Size of Data directory + IntOp $3 $3 - $4 ;=== Remove the plugins directory from the free space calculation + ${EndIf} + ${EndIf} + !else + !ifdef COMMONFILESPLUGIN ;Duplicate code for now, to do above for CommonFiles as well + ${If} ${FileExists} $INSTDIR + ${GetSize} `$INSTDIR` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Install Size + ${EndIf} + !endif + !endif + + ${If} $3 <= $1 + MessageBox MB_OK|MB_ICONEXCLAMATION "$(notenoughspace)" + Return + ${EndIf} + ${EndIf} + + ;=== Check if app is running? + ${IfThen} "${CHECKRUNNING}" == "NONE" ${|} Abort ${|} + ${If} ${ProcessExists} "${CHECKRUNNING}" + MessageBox MB_OK|MB_ICONINFORMATION $(runwarning) + ${EndIf} +FunctionEnd + +Function ShowDirectory + ${IfThen} $AUTOMATEDINSTALL == "true" ${|} Abort ${|} + ${PageHeaderHackForHighContrast} +FunctionEnd + +Function LeaveDirectory + ;=== Prevent destination string changes without user verification + ${GetTime} "" "LS" $0 $1 $2 $3 $4 $5 $6 + ${If} $strTimeStore == "$0 $1 $2 $3 $4 $5 $6" + ${GetParent} $INSTDIR $0 + ${GetParent} $0 $0 + StrCpy $1 $0 3 -6 + StrCpy $2 $0 1 -2 + ${If} $2 == "e" + ${AndIf} $1 == "ber" + Abort + ${EndIf} + ${EndIf} + + GetInstDirError $0 + + ;=== Does it already exist? (upgrade) + ${If} ${FileExists} $INSTDIR + ${AndIf} "${CHECKRUNNING}" != "NONE" + ;=== Check if app is running? + ${If} ${ProcessExists} "${CHECKRUNNING}" + MessageBox MB_OK|MB_ICONINFORMATION $(runwarning) + Abort + ${EndIf} + ${EndIf} + + ;=== Check if common files to existing directory with contents + !ifdef COMMONFILESPLUGIN + ${If} ${FileExists} "$INSTDIR\*.*" + ${GetFileName} "$INSTDIR" $0 + ${If} $0 != ${APPID} + ${AndIfNot} ${FileExists} "$INSTDIR\App\AppInfo\plugininstaller.ini" + ;=== Installing to an existing directory with contents that doesn't match the AppID + MessageBox MB_YESNO|MB_ICONQUESTION $(existingfileswarning) /SD IDYES IDYES InstallToPathWithExistingFiles + Abort + InstallToPathWithExistingFiles: + ${EndIf} + ${EndIf} + !endif + + + ; 0 is valid, enough space, all fine + ${Select} $0 + ${Case} 1 + MessageBox MB_OK|MB_ICONINFORMATION $(invaliddirectory) + Abort + + ${Case} 2 + ${IfNot} ${FileExists} $INSTDIR ;=== Is upgrade + MessageBox MB_OK|MB_ICONEXCLAMATION $(notenoughspace) + Abort + ${EndIf} + + SectionGetSize ${MAINSECTIONIDX} $1 ;=== Space Required for App + !ifdef MAINSECTIONTITLE + SectionGetFlags ${OPTIONALSECTIONIDX} $9 + IntOp $9 $9 & ${SF_SELECTED} + ${If} $9 >= ${SF_SELECTED} + SectionGetSize ${OPTIONALSECTIONIDX} $2 ;=== Space Required for App + IntOp $1 $1 + $2 + ${EndIf} + !endif + ${GetRoot} $INSTDIR $2 + ;${DriveSpace} `$2\` "/D=F /S=K" $3 ;=== Space Free on Device + ${DriveFreeSpaceCustom} "$2\" $3 + + + !ifndef PLUGININSTALLER ;=== If not a plugin installer, add the current install size to free space + ${GetSize} `$INSTDIR` "/M=*.* /S=0K /G=0" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Root Install Size + ${GetSize} `$INSTDIR\App` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current App Install Size + ${GetSize} `$INSTDIR\Other` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Other Install Size + + ${If} `${ADDONSDIRECTORYPRESERVE}` != "NONE" + ${AndIf} ${FileExists} `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` + ${GetSize} `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Size of Data directory + IntOp $3 $3 - $4 ;=== Remove the plugins directory from the free space calculation + ${EndIf} + !else + !ifdef COMMONFILESPLUGIN ;Duplicate code for now, to do above for CommonFiles as well + ${GetSize} `$INSTDIR` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size + IntOp $3 $3 + $4 ;=== Space Free + Current Install Size + !endif + !endif + + ${If} $3 <= $1 + MessageBox MB_OK|MB_ICONEXCLAMATION "$(notenoughspace)" + Abort + ${EndIf} + ${EndSelect} + + ;Check for Program Files + ReadEnvStr $0 IPromiseNotToComplainWhenPortableAppsDontWorkRightInProgramFiles + ${If} $0 != "I understand that this may not work and that I can not ask for help with any of my apps when operating in this fashion." + ${WordFind} "$INSTDIR\" "$PROGRAMFILES\" "*" $R0 + ${If} $R0 > 0 + MessageBox MB_OK|MB_ICONINFORMATION "$(invaliddirectory) [$PROGRAMFILES or sub-directories]" + Abort + ${EndIf} + ${WordFind} "$INSTDIR\" "$PROGRAMFILES64\" "*" $R0 + ${If} $R0 > 0 + MessageBox MB_OK|MB_ICONINFORMATION "$(invaliddirectory) [$PROGRAMFILES64 or sub-directories]" + Abort + ${EndIf} + ${EndIf} +FunctionEnd + +Function .onVerifyInstDir + ${If} $INSTDIR != "" + ${AndIf} $strLastDirectory != "" + StrLen $0 $INSTDIR + StrLen $1 $strLastDirectory + IntOp $2 $1 + 2 + IntOp $3 $1 - 2 + ${If} $0 > $2 + ${OrIf} $0 < $3 + ${GetTime} "" "LS" $0 $1 $2 $3 $4 $5 $6 + StrCpy $strTimeStore "$0 $1 $2 $3 $4 $5 $6" + ${EndIf} + ${EndIf} + StrCpy $strLastDirectory $INSTDIR +FunctionEnd + +Function PreFinish + ${IfThen} $AUTOCLOSE == "true" ${|} Abort ${|} +FunctionEnd + +;Annoying hack to fix MUI2's broken cancel button +!ifndef SC_CLOSE +!define SC_CLOSE 0xF060 +!endif + +Function ShowFinish + ;Annoying hack to fix MUI2's broken cancel button Pt2 + EnableWindow $mui.Button.Cancel 1 + System::Call 'USER32::GetSystemMenu(i $hwndparent,i0)i.s' + System::Call 'USER32::EnableMenuItem(is,i${SC_CLOSE},i0)' + + SetCtlColors $mui.FinishPage.Title 0x000000 0xFFFFFF + SetCtlColors $mui.FinishPage.Text 0x000000 0xFFFFFF + + !ifndef PLUGINNAME + ;These should work but do not + SetCtlColors $mui.Finishpage.Run 0x000000 0xFFFFFF + ${If} $bolHighContrast == "true" + ;Annoying hack to ensure checkboxes are visible when high contrast is on + SetCtlColors $mui.Finishpage.Run 0x000000 0x888888 + ${EndIf} + !endif +FunctionEnd + +Function GetDrivesCallBack + ;=== Skip usual floppy letters + ${If} $8 == "FDD" + ${If} $9 == "A:\" + ${OrIf} $9 == "B:\" + Push $0 + Return + ${EndIf} + ${EndIf} + + ${If} ${FileExists} $9PortableApps + StrCpy $FOUNDPORTABLEAPPSPATH $9PortableApps + ${EndIf} + + Push $0 +FunctionEnd + +!ifdef MAINSECTIONTITLE + Section "${MAINSECTIONTITLE}" +!else + Section "App Portable (required)" +!endif + + ${If} $MINIMIZEINSTALLER == "true" + ShowWindow $HWNDPARENT ${SW_MINIMIZE} + ${EndIf} + ${If} $HIDEINSTALLER == "true" + ShowWindow $HWNDPARENT ${SW_HIDE} + ${EndIf} + + ${If} ${FileExists} "$INSTDIR\*.*" + StrCpy $bolAppUpgrade true + ${EndIf} + + ${If} $(installingstatus) != "" + StrCpy $InstallingStatusString "$(installingstatus)" + ${Else} + StrCpy $InstallingStatusString "$(MUI_TEXT_INSTALLING_TITLE)" + ${EndIf} + + SectionIn RO + SetOutPath $INSTDIR + + ${If} $bolAppUpgrade == true + ${If} $(prepareupgrade) == "" + DetailPrint $InstallingStatusString + ${Else} + DetailPrint $(prepareupgrade) + ${EndIf} + ${Else} + DetailPrint $InstallingStatusString + ${EndIf} + SetDetailsPrint ListOnly + + ;=== Download Files +!ifdef DownloadURL + ${If} ${FileExists} `$EXEDIR\${DownloadFileName}` + !ifdef DownloadMD5 + md5dll::GetMD5File "$EXEDIR\${DownloadFileName}" + Pop $R0 + ${If} $R0 == ${DownloadMD5} + StrCpy $DOWNLOADALREADYEXISTED "true" + StrCpy $DOWNLOADRESULT "OK" + ${EndIf} + !else + StrCpy $DOWNLOADALREADYEXISTED "true" + StrCpy $DOWNLOADRESULT "OK" + !endif + ${EndIf} + + ${If} $DOWNLOADALREADYEXISTED == "true" + StrCpy $DOWNLOADEDFILE "$EXEDIR\${DownloadFileName}" + ${Else} + StrCpy $DownloadURLActual ${DownloadURL} + DownloadTheFile: + CreateDirectory `$PLUGINSDIR\Downloaded` + SetDetailsPrint both + ${If} $(downloading) != "" + DetailPrint $(downloading) + ${Else} + DetailPrint "Downloading ${DownloadName}..." + ${EndIf} + + + !ifdef DownloadKnockURL + ReadRegDWORD $intWarnOnZoneCrossing HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" + + ReadRegDWORD $intSecureProtocols HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" 0x00000000 + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" 0x00000a80 + ${EndIf} + + SetDetailsPrint none + Delete "$PLUGINSDIR\Downloaded\KnockURL.html" + ${If} $(downloading) != "" + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE $(downloading) $(downloadconnecting) $(downloadsecond) $(downloadminute) $(downloadhour) $(downloadplural) "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s $(downloadremaining))" "${DownloadKnockURL}" "$PLUGINSDIR\Downloaded\KnockURL.html" /END + ${Else} + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE "Downloading %s..." "Connecting..." second minute hour s "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s remaining)" "${DownloadKnockURL}" "$PLUGINSDIR\Downloaded\KnockURL.html" /END + ${EndIf} + SetDetailsPrint ListOnly + Pop $0 + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" $intWarnOnZoneCrossing + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" $intSecureProtocols + ${EndIf} + !endif + + SetDetailsPrint none + Delete "$PLUGINSDIR\Downloaded\${DownloadName}" + Delete "$PLUGINSDIR\Downloaded\${DownloadFilename}" + + ReadRegDWORD $intWarnOnZoneCrossing HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" + + ReadRegDWORD $intSecureProtocols HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" 0x00000000 + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" 0x00000a80 + ${EndIf} + + ${If} $(downloading) != "" + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE $(downloading) $(downloadconnecting) $(downloadsecond) $(downloadminute) $(downloadhour) $(downloadplural) "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s $(downloadremaining))" "$DownloadURLActual" "$PLUGINSDIR\Downloaded\${DownloadName}" /END + ${Else} + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE "Downloading %s..." "Connecting..." second minute hour s "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s remaining)" "$DownloadURLActual" "$PLUGINSDIR\Downloaded\${DownloadName}" /END + ${EndIf} + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" $intWarnOnZoneCrossing + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" $intSecureProtocols + ${EndIf} + + SetDetailsPrint both + DetailPrint $InstallingStatusString + SetDetailsPrint ListOnly + Pop $DOWNLOADRESULT + ${If} $DOWNLOADRESULT == "OK" + Rename "$PLUGINSDIR\Downloaded\${DownloadName}" "$PLUGINSDIR\Downloaded\${DownloadFilename}" + StrCpy $DOWNLOADEDFILE "$PLUGINSDIR\Downloaded\${DownloadFilename}" + !ifdef DownloadMD5 + md5dll::GetMD5File "$DOWNLOADEDFILE" + Pop $R0 + ${If} $R0 != ${DownloadMD5} + ${If} $SECONDDOWNLOADATTEMPT != true + StrCpy $SECONDDOWNLOADATTEMPT true + Goto DownloadTheFile + ${EndIf} + StrCpy $MD5MISMATCH "true" + + Delete "$INTERNET_CACHE\${DownloadFileName}" + Delete "$PLUGINSDIR\Downloaded\${DownloadFilename}" + SetDetailsPrint textonly + DetailPrint "" + SetDetailsPrint listonly + ${TBProgress_State} Error + ${If} $(downloadfilemismatch) != "" + MessageBox MB_OK|MB_ICONEXCLAMATION $(downloadfilemismatch) + DetailPrint $(downloadfilemismatch) + ${Else} + MessageBox MB_OK|MB_ICONEXCLAMATION `The downloaded copy of ${DownloadName} is not valid and can not be installed. Please try installing again.` + DetailPrint `The downloaded copy of ${DownloadName} is not valid and can not be installed. Please try installing again.` + ${EndIf} + ${TBProgress_State} NoProgress + Abort + ${EndIf} + !endif + ${Else} + Delete "$INTERNET_CACHE\${DownloadFileName}" + Delete "$PLUGINSDIR\Downloaded\${DownloadFilename}" + StrCpy $0 $DownloadURLActual + + ;Use backup PA.c download server if necessary + ${WordFind} "$DownloadURLActual" "http://downloads.portableapps.com" "#" $R0 + ${If} $R0 == 1 + ${WordReplace} "$DownloadURLActual" "http://downloads.portableapps.com" "http://downloads2.portableapps.com" "+" $DownloadURLActual + Goto DownloadTheFile + ${EndIf} + + ${If} $SECONDDOWNLOADATTEMPT != true + ${AndIf} $DOWNLOADRESULT != "Cancelled" + StrCpy $SECONDDOWNLOADATTEMPT true + Goto DownloadTheFile + ${EndIf} + SetDetailsPrint textonly + DetailPrint "" + SetDetailsPrint listonly + ${TBProgress_State} Error + ${If} $(downloadfailed) != "" + MessageBox MB_OK|MB_ICONEXCLAMATION $(downloadfailed) + DetailPrint $(downloadfailed) + ${Else} + MessageBox MB_OK|MB_ICONEXCLAMATION `The installer was unable to download ${DownloadName}. The installation of the portable app will be incomplete without it. Please try installing again. (ERROR: $DOWNLOADRESULT)` + DetailPrint `The installer was unable to download ${DownloadName}. The installation of the portable app will be incomplete without it. Please try installing again. (ERROR: $DOWNLOADRESULT)` + ${EndIf} + ${TBProgress_State} NoProgress + Abort + ${EndIf} + ${EndIf} +!endif + +!ifdef Download2URL + ${If} ${FileExists} `$EXEDIR\${Download2FileName}` + !ifdef Download2MD5 + md5dll::GetMD5File "$EXEDIR\${Download2FileName}" + Pop $R0 + ${If} $R0 == ${Download2MD5} + StrCpy $DOWNLOAD2ALREADYEXISTED "true" + StrCpy $DOWNLOAD2RESULT "OK" + ${EndIf} + !else + StrCpy $DOWNLOAD2ALREADYEXISTED "true" + StrCpy $DOWNLOAD2RESULT "OK" + !endif + ${EndIf} + + ${If} $DOWNLOAD2ALREADYEXISTED == "true" + StrCpy $DOWNLOADED2FILE "$EXEDIR\${Download2FileName}" + ${Else} + StrCpy $Download2URLActual ${Download2URL} + Download2TheFile: + CreateDirectory `$PLUGINSDIR\Downloaded-2` + SetDetailsPrint both + ${If} $(downloading) != "" + ${WordReplace} `$(downloading)` `${DownloadName}` `${Download2Name}` "+" $0 + DetailPrint $0 + ${Else} + DetailPrint "Downloading ${Download2Name}..." + ${EndIf} + + + !ifdef Download2KnockURL + ReadRegDWORD $intWarnOnZoneCrossing HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" + + ReadRegDWORD $intSecureProtocols HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" 0x00000000 + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" 0x00000a80 + ${EndIf} + + SetDetailsPrint none + Delete "$PLUGINSDIR\Downloaded-2\KnockURL.html" + ${If} $(downloading) != "" + ${WordReplace} `$(downloading)` `${DownloadName}` `${Download2Name}` "+" $0 + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE $0 $(downloadconnecting) $(downloadsecond) $(downloadminute) $(downloadhour) $(downloadplural) "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s $(downloadremaining))" "${Download2KnockURL}" "$PLUGINSDIR\Downloaded-2\KnockURL.html" /END + ${Else} + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE "Downloading %s..." "Connecting..." second minute hour s "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s remaining)" "${Download2KnockURL}" "$PLUGINSDIR\Downloaded-2\KnockURL.html" /END + ${EndIf} + SetDetailsPrint ListOnly + Pop $0 + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" $intWarnOnZoneCrossing + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" $intSecureProtocols + ${EndIf} + !endif + + SetDetailsPrint none + Delete "$PLUGINSDIR\Downloaded-2\${Download2Name}" + Delete "$PLUGINSDIR\Downloaded-2\${Download2Filename}" + + ReadRegDWORD $intWarnOnZoneCrossing HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" + + ReadRegDWORD $intSecureProtocols HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" 0x00000000 + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" 0x00000a80 + ${EndIf} + + ${If} $(downloading) != "" + ${WordReplace} `$(downloading)` `${DownloadName}` `${Download2Name}` "+" $0 + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE $0 $(downloadconnecting) $(downloadsecond) $(downloadminute) $(downloadhour) $(downloadplural) "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s $(downloadremaining))" "$Download2URLActual" "$PLUGINSDIR\Downloaded-2\${Download2Name}" /END + ${Else} + inetc::get /CONNECTTIMEOUT 30 /NOCOOKIES /TRANSLATE "Downloading %s..." "Connecting..." second minute hour s "%dkB (%d%%) $(downloadof) %dkB @ %d.%01dkB/s" " (%d %s%s remaining)" "$Download2URLActual" "$PLUGINSDIR\Downloaded-2\${Download2Name}" /END + ${EndIf} + + ${If} $intWarnOnZoneCrossing != 0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "WarnonZoneCrossing" $intWarnOnZoneCrossing + ${EndIf} + + ${If} $intSecureProtocols < 640 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" "SecureProtocols" $intSecureProtocols + ${EndIf} + + SetDetailsPrint both + DetailPrint $InstallingStatusString + SetDetailsPrint ListOnly + Pop $DOWNLOAD2RESULT + ${If} $DOWNLOAD2RESULT == "OK" + Rename "$PLUGINSDIR\Downloaded-2\${Download2Name}" "$PLUGINSDIR\Downloaded-2\${Download2Filename}" + StrCpy $DOWNLOADED2FILE "$PLUGINSDIR\Downloaded-2\${Download2Filename}" + !ifdef Download2MD5 + md5dll::GetMD5File "$DOWNLOADED2FILE" + Pop $R0 + StrCpy $MD5MISMATCH "false" + ${If} $R0 != ${Download2MD5} + ${If} $SECONDDOWNLOAD2ATTEMPT != true + StrCpy $SECONDDOWNLOAD2ATTEMPT true + Goto Download2TheFile + ${EndIf} + StrCpy $MD5MISMATCH "true" + + Delete "$INTERNET_CACHE\${Download2FileName}" + Delete "$PLUGINSDIR\Downloaded-2\${Download2Filename}" + SetDetailsPrint textonly + DetailPrint "" + SetDetailsPrint listonly + ${TBProgress_State} Error + ${If} $(downloadfilemismatch) != "" + ${WordReplace} `$(downloadfilemismatch)` "${DownloadName}" "${Download2Name}" "+" $0 + MessageBox MB_OK|MB_ICONEXCLAMATION `$0` + DetailPrint $0 + ${Else} + MessageBox MB_OK|MB_ICONEXCLAMATION `The downloaded copy of ${Download2Name} is not valid and can not be installed. Please try installing again.` + DetailPrint `The downloaded copy of ${Download2Name} is not valid and can not be installed. Please try installing again.` + ${EndIf} + ${TBProgress_State} NoProgress + Abort + ${EndIf} + !endif + ${Else} + Delete "$INTERNET_CACHE\${Download2FileName}" + Delete "$PLUGINSDIR\Downloaded-2\${Download2Filename}" + StrCpy $0 $Download2URLActual + + ;Use backup PA.c download server if necessary + ${WordFind} "$Download2URLActual" "http://downloads.portableapps.com" "#" $R0 + ${If} $R0 == 1 + ${WordReplace} "$Download2URLActual" "http://downloads.portableapps.com" "http://downloads2.portableapps.com" "+" $Download2URLActual + Goto Download2TheFile + ${EndIf} + + ${If} $SECONDDOWNLOAD2ATTEMPT != true + ${AndIf} $DOWNLOAD2RESULT != "Cancelled" + StrCpy $SECONDDOWNLOAD2ATTEMPT true + Goto Download2TheFile + ${EndIf} + SetDetailsPrint textonly + DetailPrint "" + SetDetailsPrint listonly + ${TBProgress_State} Error + ${If} $(downloadfailed) != "" + ${WordReplace} `$(downloadfailed)` "${DownloadName}" "${Download2Name}" "+" $0 + MessageBox MB_OK|MB_ICONEXCLAMATION $0 + DetailPrint $0 + ${Else} + MessageBox MB_OK|MB_ICONEXCLAMATION `The installer was unable to download ${Download2Name}. The installation of the portable app will be incomplete without it. Please try installing again. (ERROR: $DOWNLOADRESULT)` + DetailPrint `The installer was unable to download ${Download2Name}. The installation of the portable app will be incomplete without it. Please try installing again. (ERROR: $DOWNLOAD2RESULT)` + ${EndIf} + ${TBProgress_State} NoProgress + Abort + ${EndIf} + ${EndIf} +!endif + +!ifdef MAINSECTIONTITLE + SectionGetFlags 1 $0 + IntOp $0 $0 & ${SF_SELECTED} + ${If} $0 != ${SF_SELECTED} + ;=== BEGIN: OPTIONAL NOT SELECTED CLEANUP CODE === + ;This will be executed before install if the optional section (additional languages, etc) is not selected + !ifmacrodef CustomCodeOptionalCleanup + !insertmacro CustomCodeOptionalCleanup + !endif + ;=== END: OPTIONAL NOT SELECTED CLEANUP CODE === + ${EndIf} +!endif + + ;=== BEGIN: PRE-INSTALL CODE === + ;This will be executed before the app is installed. Useful for cleaning up files no longer used. + !ifmacrodef CustomCodePreInstall + !insertmacro CustomCodePreInstall + !endif + ;=== END: PRE-INSTALL CODE === + + ;=== Remove specific files + !macro RemoveFile _n + !ifdef REMOVEFILE${_n} + Delete `$INSTDIR\${REMOVEFILE${_n}}` + !endif + !macroend + ${!insertmacro1-10} RemoveFile + + ;=== Rename the preserved files so they're not deleted in the next part + !macro PreserveFilePre _n + !ifdef PRESERVEFILE${_n} + ${GetFileName} `$INSTDIR\${PRESERVEFILE${_n}}` $1 + ${GetParent} `$INSTDIR\${PRESERVEFILE${_n}}` $2 + CreateDirectory `$INSTDIR\~PRESERVEFILE${_n}` + ${MoveFiles} DOS $1 $2 `$INSTDIR\~PRESERVEFILE${_n}` + !endif + !macroend + ${!insertmacro1-10} PreserveFilePre + + ;=== Remove specific directories + !macro RemoveDirectory _n + !ifdef REMOVEDIRECTORY${_n} + RMDir /r `$INSTDIR\${REMOVEDIRECTORY${_n}}` + !endif + !macroend + ${!insertmacro1-10} RemoveDirectory + + ;=== Rename the preserved directories so they're not deleted in the next part + !macro PreserveDirectoryPre _n + !ifdef PRESERVEDIRECTORY${_n} + ${If} ${FileExists} `$INSTDIR\${PRESERVEDIRECTORY${_n}}\*.*` + TryRenamePreserveDirectoryPre${_n}: + Rename `$INSTDIR\${PRESERVEDIRECTORY${_n}}\` `$INSTDIR\~PRESERVEDIRECTORY${_n}\` + ${IfNot} ${FileExists} `$INSTDIR\~PRESERVEDIRECTORY${_n}\*.*` + StrCpy $0 `$INSTDIR\${PRESERVEDIRECTORY${_n}}` + MessageBox MB_ICONQUESTION|MB_RETRYCANCEL `$(^FileError_NoIgnore)` IDRETRY TryRenamePreserveDirectoryPre${_n} + MessageBox MB_ICONEXCLAMATION|MB_OK `$(^RemoveFolder) $0` + ${EndIf} + ${EndIf} + !endif + !macroend + ${!insertmacro1-10} PreserveDirectoryPre + + ;=== Remove main directories if necessary + !ifdef REMOVEAPPDIRECTORY + !ifdef COMMONFILESPLUGIN + ${GetParent} $INSTDIR $0 + ${For} $1 1 10 + Rename `$INSTDIR\~PRESERVEFILE$1\` `$0\~PRESERVEFILE$1\` + Rename `$INSTDIR\~PRESERVEDIRECTORY$1\` `$0\~PRESERVEDIRECTORY$1\` + ${Next} + RMDir /r $INSTDIR + CreateDirectory $INSTDIR + ${For} $1 1 10 + Rename `$0\~PRESERVEFILE$1\` `$INSTDIR\~PRESERVEFILE$1\` + Rename `$0\~PRESERVEDIRECTORY$1\` `$INSTDIR\~PRESERVEDIRECTORY$1\` + ${Next} + !else + RMDir /r `$INSTDIR\App` + !endif + !endif + !ifdef REMOVEOTHERDIRECTORY + RMDir /r `$INSTDIR\Other` + !endif + + ;=== Rename the preserved directories back to their proper names + !macro PreserveDirectoryPost _n + !ifdef PRESERVEDIRECTORY${_n} + ${GetParent} `$INSTDIR\${PRESERVEDIRECTORY${_n}}\` $R0 + CreateDirectory $R0 + Rename `$INSTDIR\~PRESERVEDIRECTORY${_n}\` `$INSTDIR\${PRESERVEDIRECTORY${_n}}\` + !endif + !macroend + ${!insertmacro1-10} PreserveDirectoryPost + + ;=== Rename the preserved files back to their proper names + !macro PreserveFilePost _n + !ifdef PRESERVEFILE${_n} + ${GetFileName} `$INSTDIR\${PRESERVEFILE${_n}}` $1 + ${GetParent} `$INSTDIR\${PRESERVEFILE${_n}}` $2 + CreateDirectory $2 + ${MoveFiles} DOS $1 `$INSTDIR\~PRESERVEFILE${_n}` $2 + RMDir `$INSTDIR\~PRESERVEFILE${_n}` + !endif + !macroend + ${!insertmacro1-10} PreserveFilePost + + ${If} $bolAppUpgrade == true + SetDetailsPrint both + DetailPrint $InstallingStatusString + SetDetailsPrint ListOnly + ${EndIf} + + !ifndef PLUGININSTALLER + File /x thumbs.db "..\..\*.exe" + File /x thumbs.db "..\..\*.html" + SetOutPath $INSTDIR\App + File /r /x thumbs.db "..\..\App\*.*" + !else ifdef COMMONFILESPLUGIN + SetOutPath $INSTDIR + File /r /x thumbs.db /x PortableApps.comInstaller*.* "..\..\*.*" + !else ; non-CommonFiles plugin installer + SetOutPath $INSTDIR\Data + File /nonfatal /r /x thumbs.db "..\..\Data\*.*" + SetOutPath $INSTDIR\App + File /nonfatal /r /x thumbs.db "..\..\App\*.*" + !endif + + SetOutPath $INSTDIR\Other + File /nonfatal /r /x thumbs.db /x PortableApps.comInstaller*.* "..\..\Other\*.*" + + SetOutPath $INSTDIR\Other\Source + !ifdef USESCUSTOMCODE + !if ${__FILE__} == "PortableApps.comInstallerPlugin.nsi" + File "..\..\Other\Source\PortableApps.comInstallerPluginCustom.nsh" + !else + File "..\..\Other\Source\PortableApps.comInstallerCustom.nsh" + !endif + !endif + !ifndef PLUGININSTALLER + CreateDirectory "$INSTDIR\Data" + !endif + + !ifdef INCLUDEINSTALLERSOURCE + File /r /x PortableApps.comInstallerCustom.nsh /x PortableApps.comInstallerPluginCustom.nsh "..\..\Other\Source\PortableApps.comInstaller*.*" + !endif + + ;=== Extract 7-Zip if we're using it + !ifdef bolUses7Zip + CreateDirectory "$INSTDIR\7zTemp" + SetOutPath "$INSTDIR\7zTemp" + File "${NSISDIR}\..\7zip\7z.exe" + File "${NSISDIR}\..\7zip\7z.dll" + SetOutPath $INSTDIR + !endif + + ;=== Extract Download Files + !ifdef DownloadURL + !ifdef DownloadTo + ;Just copy the file + CopyFiles /SILENT "$DOWNLOADEDFILE" "$INSTDIR\${DownloadTo}" + !else + ;Process the file + !ifdef AdvancedExtract1To + ; The original code didn't have a !ifdef for 1, but we + ; know it will be defined, and it doesn't matter if we + ; check if it is because it will be. + !macro AdvancedExtractFilter _n + !ifdef AdvancedExtract${_n}To + CreateDirectory "$INSTDIR\${AdvancedExtract${_n}To}" + ${If} "${AdvancedExtract${_n}Filter}" == "**" + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x -r "$DOWNLOADEDFILE" -o"$INSTDIR\${AdvancedExtract${_n}To}" * -aoa -y` + ${Else} + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x "$DOWNLOADEDFILE" -o"$INSTDIR\${AdvancedExtract${_n}To}" "${AdvancedExtract${_n}Filter}" -aoa -y` + ${EndIf} + Pop $R0 + ${If} $R0 <> 0 + DetailPrint "ERROR: (${DownloadFilename} > ${AdvancedExtract${_n}To})" + Abort + ${EndIf} + !endif + !macroend + ${!insertmacro1-10} AdvancedExtractFilter + !endif + !ifdef DoubleExtractFilename + CreateDirectory "$PLUGINSDIR\Downloaded2" + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x "$DOWNLOADEDFILE" -o"$PLUGINSDIR\Downloaded2" "${DoubleExtractFilename}" -aoa -y` + Pop $R0 + ${If} $R0 <> 0 + DetailPrint "ERROR: (${DownloadFilename} > ${DoubleExtractFilename})" + Abort + ${EndIf} + + ; The original code didn't have a !ifdef for 1, but we + ; know it will be defined, and it doesn't matter if we + ; check if it is because it will be. + !macro DoubleExtractTo _n + !ifdef DoubleExtract${_n}To + CreateDirectory "$INSTDIR\${DoubleExtract${_n}To}" + ${If} "${DoubleExtract${_n}Filter}" == "**" + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x -r "$PLUGINSDIR\Downloaded2\${DoubleExtractFilename}" -o"$INSTDIR\${DoubleExtract${_n}To}" * -aoa -y` + ${Else} + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x "$PLUGINSDIR\Downloaded2\${DoubleExtractFilename}" -o"$INSTDIR\${DoubleExtract${_n}To}" "${DoubleExtract${_n}Filter}" -aoa -y` + ${EndIf} + Pop $R0 + ${If} $R0 <> 0 + DetailPrint "ERROR: (${DoubleExtractFilename} > ${DoubleExtract${_n}To})" + Abort + ${EndIf} + !endif + !macroend + ${!insertmacro1-10} DoubleExtractTo + !endif + !endif + !endif + + !ifdef Download2URL + !ifdef Download2To + ;Just copy the file + CopyFiles /SILENT "$DOWNLOADED2FILE" "$INSTDIR\${Download2To}" + !else + ;Process the file + !ifdef Download2AdvancedExtract1To + ; The original code didn't have a !ifdef for 1, but we + ; know it will be defined, and it doesn't matter if we + ; check if it is because it will be. + !macro Download2AdvancedExtractFilter _n + !ifdef Download2AdvancedExtract${_n}To + CreateDirectory "$INSTDIR\${Download2AdvancedExtract${_n}To}" + ${If} "${Download2AdvancedExtract${_n}Filter}" == "**" + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x -r "$DOWNLOADED2FILE" -o"$INSTDIR\${Download2AdvancedExtract${_n}To}" * -aoa -y` + ${Else} + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x "$DOWNLOADED2FILE" -o"$INSTDIR\${Download2AdvancedExtract${_n}To}" "${AdvancedExtract${_n}Filter}" -aoa -y` + ${EndIf} + Pop $R0 + ${If} $R0 <> 0 + DetailPrint "ERROR: (${Download2Filename} > ${Download2AdvancedExtract${_n}To})" + Abort + ${EndIf} + !endif + !macroend + ${!insertmacro1-10} Download2AdvancedExtractFilter + !endif + !ifdef Download2DoubleExtractFilename + CreateDirectory "$PLUGINSDIR\Downloaded-22" + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x "$DOWNLOADED2FILE" -o"$PLUGINSDIR\Downloaded-22" "${Download2DoubleExtractFilename}" -aoa -y` + Pop $R0 + ${If} $R0 <> 0 + DetailPrint "ERROR: (${Download2Filename} > ${Download2DoubleExtractFilename})" + Abort + ${EndIf} + + ; The original code didn't have a !ifdef for 1, but we + ; know it will be defined, and it doesn't matter if we + ; check if it is because it will be. + !macro Download2DoubleExtractTo _n + !ifdef Download2DoubleExtract${_n}To + CreateDirectory "$INSTDIR\${Download2DoubleExtract${_n}To}" + ${If} "${Download2DoubleExtract${_n}Filter}" == "**" + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x -r "$PLUGINSDIR\Downloaded-22\${Download2DoubleExtractFilename}" -o"$INSTDIR\${Download2DoubleExtract${_n}To}" * -aoa -y` + ${Else} + nsExec::Exec `"$INSTDIR\7zTemp\7z.exe" x "$PLUGINSDIR\Downloaded-22\${Download2DoubleExtractFilename}" -o"$INSTDIR\${Download2DoubleExtract${_n}To}" "${DoubleExtract${_n}Filter}" -aoa -y` + ${EndIf} + Pop $R0 + ${If} $R0 <> 0 + DetailPrint "ERROR: (${Download2DoubleExtractFilename} > ${Download2DoubleExtract${_n}To})" + Abort + ${EndIf} + !endif + !macroend + ${!insertmacro1-10} Download2DoubleExtractTo + !endif + !endif + !endif + + ;=== Copy Local Files + !ifdef COPYLOCALFILES + ${If} ${FileExists} "$CopyLocalFilesFrom\*.*" + CreateDirectory "$INSTDIR\${CopyToDirectory}" + CopyFiles /SILENT "$CopyLocalFilesFrom\*.*" "$INSTDIR\${CopyToDirectory}" + ${Else} + StrCpy $MISSINGFILEORPATH $CopyLocalFilesFrom + ${If} $(copylocalfilesnotfound) != "" + MessageBox MB_OK|MB_ICONINFORMATION $(copylocalfilesnotfound) + ${Else} + MessageBox MB_OK|MB_ICONINFORMATION `This installer copies a local version of the application and makes it portable. Unfortunately, a local copy of the application was not found. You may reinstall or copy the files yourself to complete the installation at a later time. (ERROR: $MISSINGFILEORPATH could not be found.)` + ${EndIf} + ${EndIf} + !endif + + ;=== BEGIN: POST-INSTALL CODE === + ;This will be executed after the app is installed. Useful for updating configuration files. + !ifmacrodef CustomCodePostInstall + !insertmacro CustomCodePostInstall + !endif + ;=== END: POST-INSTALL CODE === + + ;Remove 7-Zip if we used it + !ifdef bolUses7Zip + Delete "$INSTDIR\7zTemp\7z.exe" + Delete "$INSTDIR\7zTemp\7z.dll" + RMDir "$INSTDIR\7zTemp" + !endif + + !ifndef PLUGININSTALLER + ;=== Refresh PortableApps.com Menu (not final version) + ${GetParent} $INSTDIR $0 + ;=== Check that it exists at the right location + SetDetailsPrint both + DetailPrint '$(checkforplatform)' + ${If} ${FileExists} `$0\PortableApps.com\PortableAppsPlatform.exe` + ;=== Check that it's the real deal so we aren't hanging with no response + MoreInfo::GetProductName `$0\PortableApps.com\PortableAppsPlatform.exe` + Pop $1 + ${If} $1 == "PortableApps.com Platform" + MoreInfo::GetCompanyName `$0\PortableApps.com\PortableAppsPlatform.exe` + Pop $1 + ${If} $1 == "PortableApps.com" + + ;=== Check that it's running + ${If} ${ProcessExists} "PortableAppsPlatform.exe" + ;=== Send message for the Menu to refresh + CreateDirectory "$0\PortableApps.com\Data" + WriteINIStr "$0\PortableApps.com\Data\NewApp.ini" "NewApp" "AppID" "${APPID}" + + DetailPrint '$(refreshmenu)' + ${IfNot} ${FileExists} `$0\PortableApps.com\App\PortableAppsPlatform.exe` + StrCpy $2 'PortableApps.comPlatformWindowMessageToRefresh$0\PortableApps.com\PortableAppsPlatform.exe' + System::Call "user32::RegisterWindowMessage(t r2) i .r3" + SendMessage 65535 $3 0 0 /TIMEOUT=1 + ${Else} ; old message + StrCpy $2 'PortableApps.comPlatformWindowMessageToRefresh$0\PortableApps.com\App\PortableAppsPlatform.exe' + System::Call "user32::RegisterWindowMessage(t r2) i .r3" + SendMessage 65535 $3 0 0 /TIMEOUT=1 + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} + !endif + DetailPrint $InstallingStatusString + SetDetailsPrint listonly + +!ifdef LICENSEAGREEMENT + CreateDirectory "$INSTDIR\Data\PortableApps.comInstaller" + WriteINIStr "$INSTDIR\Data\PortableApps.comInstaller\license.ini" "PortableApps.comInstaller" "EULAVersion" $INTERNALEULAVERSION + ClearErrors +!endif + +!ifdef DownloadURL + Delete "$INTERNET_CACHE\${DownloadFileName}" +!endif + +!ifndef PLUGININSTALLER + WriteINIStr "$INSTDIR\App\AppInfo\pac_installer_log.ini" "PortableApps.comInstaller" "Info2" "This file was generated by the PortableApps.com Installer wizard and modified by the official PortableApps.com Installer TM Rare Ideas, LLC as the app was installed." + WriteINIStr "$INSTDIR\App\AppInfo\pac_installer_log.ini" "PortableApps.comInstaller" "Run" "true" + WriteINIStr "$INSTDIR\App\AppInfo\pac_installer_log.ini" "PortableApps.comInstaller" "InstallerVersion" "${PORTABLEAPPSINSTALLERVERSION}" + ${GetTime} "" "L" $R0 $R1 $R2 $R3 $R4 $R5 $R6 + WriteINIStr "$INSTDIR\App\AppInfo\pac_installer_log.ini" "PortableApps.comInstaller" "InstallDate" "$R2-$R1-$R0" + WriteINIStr "$INSTDIR\App\AppInfo\pac_installer_log.ini" "PortableApps.comInstaller" "InstallTime" "$R4:$R5:$R6" +!endif + + ${If} $bolLogFile == true + ${DumpLogToFile} "$EXEDIR\$EXEFILE.log" + ${EndIf} + SetOutPath $INSTDIR +SectionEnd + +!ifdef MAINSECTIONTITLE + Section /o "${OPTIONALSECTIONTITLE}" + SetOutPath $INSTDIR + File /r "..\..\Optional1\*.*" + StrCpy $OPTIONAL1DONE "true" + SectionEnd + + Section "-UpdateAppInfo" SecUpdateAppInfo + !ifndef PLUGININSTALLER + ${If} $OPTIONAL1DONE != "true" + ${AndIf} "${OPTIONALSECTIONNOTSELECTEDINSTALLTYPE}" != "" + WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Details" "InstallType" "${OPTIONALSECTIONNOTSELECTEDINSTALLTYPE}" + ${ElseIf} "${OPTIONALSECTIONSELECTEDINSTALLTYPE}" != "" + WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Details" "InstallType" "${OPTIONALSECTIONSELECTEDINSTALLTYPE}" + ${EndIf} + !endif + SectionEnd + + !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${MAINSECTIONIDX} "${MAINSECTIONDESCRIPTION}" + !insertmacro MUI_DESCRIPTION_TEXT ${OPTIONALSECTIONIDX} "${OPTIONALSECTIONDESCRIPTION}" + !insertmacro MUI_FUNCTION_DESCRIPTION_END +!endif + +Function .onInstFailed + !ifdef COPYLOCALFILES + ${registry::Unload} + !endif + RMDir $INSTDIR ;remove directory if empty +FunctionEnd + +!ifdef COPYLOCALFILES + Function .onInstSuccess + ${registry::Unload} + FunctionEnd + Function CustomAbortFunction + ${registry::Unload} + FunctionEnd +!endif \ No newline at end of file diff --git a/Other/Source/PortableApps.comInstallerConfig.nsh b/Other/Source/PortableApps.comInstallerConfig.nsh new file mode 100644 index 0000000..8c77750 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerConfig.nsh differ diff --git a/Other/Source/PortableApps.comInstallerDriveFreeSpaceCustom.nsh b/Other/Source/PortableApps.comInstallerDriveFreeSpaceCustom.nsh new file mode 100644 index 0000000..c6612cf --- /dev/null +++ b/Other/Source/PortableApps.comInstallerDriveFreeSpaceCustom.nsh @@ -0,0 +1,29 @@ +;NSIS' built-in DriveSpace function fails for unmapped UNC paths +;This function retrieves the free space on a local, mapped or UNC path in MB + +!ifndef DriveFreeSpaceCustom + +!define DriveFreeSpaceCustom "!insertmacro DriveFreeSpaceCustom" + +!macro DriveFreeSpaceCustom DRIVE_OR_UNC FREE_SPACE + push `${DRIVE_OR_UNC}` + call DriveFreeSpaceCustom + pop `${FREE_SPACE}` +!macroend + +Function DriveFreeSpaceCustom + Exch $0 ;DRIVE_OR_UNC + Push $1 ;Free space variable + + System::Call 'kernel32::GetDiskFreeSpaceEx(t, *l, *l, *l) i(r0,.r1,.,.)' + System::Int64Op $1 / 1024 + Pop $1 + System::Int64Op $1 / 1024 + Pop $1 + + Exch + Pop $0 + Exch $1 +FunctionEnd + +!endif \ No newline at end of file diff --git a/Other/Source/PortableApps.comInstallerDumpLogToFile.nsh b/Other/Source/PortableApps.comInstallerDumpLogToFile.nsh new file mode 100644 index 0000000..e0528de --- /dev/null +++ b/Other/Source/PortableApps.comInstallerDumpLogToFile.nsh @@ -0,0 +1,64 @@ +;http://nsis.sourceforge.net/Docs/AppendixD.html#D.4 +;Define added by John T. Haller of PortableApps.com + +!ifndef DumpLogToFile + +!define DumpLogToFile "!insertmacro DumpLogToFile" +!macro DumpLogToFile logfilename + Delete `${logfilename}` + push `${logfilename}` + call DumpLog +!macroend + +!ifndef LVM_GETITEMCOUNT + !define LVM_GETITEMCOUNT 0x1004 +!endif +!ifndef LVM_GETITEMTEXT + !define LVM_GETITEMTEXT 0x1073 +!endif + +Function DumpLog + Exch $5 + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $6 + + FindWindow $0 "#32770" "" $HWNDPARENT + GetDlgItem $0 $0 1016 + StrCmp $0 0 error + FileOpen $5 $5 "w" + FileWriteWord $5 0xfeff ; Write the BOM + StrCmp $5 0 error + SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6 + System::StrAlloc ${NSIS_MAX_STRLEN} + Pop $3 + StrCpy $2 0 + System::Call "*(i, i, i, i, i, i, i, i, i) i \ + (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1" + loop: StrCmp $2 $6 done + System::Call "User32::SendMessageW(i, i, i, i) i \ + ($0, ${LVM_GETITEMTEXT}, $2, r1)" + System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)" + FileWriteUTF16LE $5 "$4$\r$\n" + IntOp $2 $2 + 1 + Goto loop + done: + FileClose $5 + System::Free $1 + System::Free $3 + Goto exit + error: + ;MessageBox MB_OK error + exit: + Pop $6 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + Exch $5 +FunctionEnd +!endif \ No newline at end of file diff --git a/Other/Source/PortableApps.comInstallerHeader.bmp b/Other/Source/PortableApps.comInstallerHeader.bmp new file mode 100644 index 0000000..017d0cc Binary files /dev/null and b/Other/Source/PortableApps.comInstallerHeader.bmp differ diff --git a/Other/Source/PortableApps.comInstallerHeaderRTL.bmp b/Other/Source/PortableApps.comInstallerHeaderRTL.bmp new file mode 100644 index 0000000..a9251af Binary files /dev/null and b/Other/Source/PortableApps.comInstallerHeaderRTL.bmp differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Afrikaans.nsh b/Other/Source/PortableApps.comInstallerLanguages/Afrikaans.nsh new file mode 100644 index 0000000..22bf775 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Afrikaans.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Albanian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Albanian.nsh new file mode 100644 index 0000000..551e11f Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Albanian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Arabic.nsh b/Other/Source/PortableApps.comInstallerLanguages/Arabic.nsh new file mode 100644 index 0000000..51c6d3f Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Arabic.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Armenian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Armenian.nsh new file mode 100644 index 0000000..ab8da9b Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Armenian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Asturian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Asturian.nsh new file mode 100644 index 0000000..bd860cc Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Asturian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Basque.nsh b/Other/Source/PortableApps.comInstallerLanguages/Basque.nsh new file mode 100644 index 0000000..1b0f847 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Basque.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Belarusian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Belarusian.nsh new file mode 100644 index 0000000..9851e00 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Belarusian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Bosnian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Bosnian.nsh new file mode 100644 index 0000000..523487e Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Bosnian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Breton.nsh b/Other/Source/PortableApps.comInstallerLanguages/Breton.nsh new file mode 100644 index 0000000..3fd8e05 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Breton.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Bulgarian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Bulgarian.nsh new file mode 100644 index 0000000..25491d3 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Bulgarian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Catalan.nsh b/Other/Source/PortableApps.comInstallerLanguages/Catalan.nsh new file mode 100644 index 0000000..fb2fa6c Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Catalan.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Cibemba.nsh b/Other/Source/PortableApps.comInstallerLanguages/Cibemba.nsh new file mode 100644 index 0000000..05ca2f8 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Cibemba.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Croatian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Croatian.nsh new file mode 100644 index 0000000..2bd4e18 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Croatian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Czech.nsh b/Other/Source/PortableApps.comInstallerLanguages/Czech.nsh new file mode 100644 index 0000000..9f2c2a8 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Czech.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Danish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Danish.nsh new file mode 100644 index 0000000..17816ec Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Danish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Dutch.nsh b/Other/Source/PortableApps.comInstallerLanguages/Dutch.nsh new file mode 100644 index 0000000..ab0e013 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Dutch.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Efik.nsh b/Other/Source/PortableApps.comInstallerLanguages/Efik.nsh new file mode 100644 index 0000000..fd1f4ed Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Efik.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/English.nsh b/Other/Source/PortableApps.comInstallerLanguages/English.nsh new file mode 100644 index 0000000..0162aaa Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/English.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/EnglishGB.nsh b/Other/Source/PortableApps.comInstallerLanguages/EnglishGB.nsh new file mode 100644 index 0000000..5b1dad5 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/EnglishGB.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Esperanto.nsh b/Other/Source/PortableApps.comInstallerLanguages/Esperanto.nsh new file mode 100644 index 0000000..01446f8 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Esperanto.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Estonian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Estonian.nsh new file mode 100644 index 0000000..e5c22e3 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Estonian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Farsi.nsh b/Other/Source/PortableApps.comInstallerLanguages/Farsi.nsh new file mode 100644 index 0000000..cbddb52 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Farsi.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Finnish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Finnish.nsh new file mode 100644 index 0000000..b01bb1c Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Finnish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/French.nsh b/Other/Source/PortableApps.comInstallerLanguages/French.nsh new file mode 100644 index 0000000..5d6a4f0 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/French.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Galician.nsh b/Other/Source/PortableApps.comInstallerLanguages/Galician.nsh new file mode 100644 index 0000000..19b0176 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Galician.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Georgian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Georgian.nsh new file mode 100644 index 0000000..1e5c362 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Georgian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/German.nsh b/Other/Source/PortableApps.comInstallerLanguages/German.nsh new file mode 100644 index 0000000..974a686 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/German.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Greek.nsh b/Other/Source/PortableApps.comInstallerLanguages/Greek.nsh new file mode 100644 index 0000000..1abe272 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Greek.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Hebrew.nsh b/Other/Source/PortableApps.comInstallerLanguages/Hebrew.nsh new file mode 100644 index 0000000..c3d0acf Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Hebrew.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Hindi.nsh b/Other/Source/PortableApps.comInstallerLanguages/Hindi.nsh new file mode 100644 index 0000000..291748b Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Hindi.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Hungarian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Hungarian.nsh new file mode 100644 index 0000000..2bdc5b9 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Hungarian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Icelandic.nsh b/Other/Source/PortableApps.comInstallerLanguages/Icelandic.nsh new file mode 100644 index 0000000..6e59f7e Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Icelandic.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Igbo.nsh b/Other/Source/PortableApps.comInstallerLanguages/Igbo.nsh new file mode 100644 index 0000000..9d4db9e Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Igbo.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Indonesian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Indonesian.nsh new file mode 100644 index 0000000..730876b Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Indonesian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Irish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Irish.nsh new file mode 100644 index 0000000..3def6c4 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Irish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Italian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Italian.nsh new file mode 100644 index 0000000..5764a38 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Italian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Japanese.nsh b/Other/Source/PortableApps.comInstallerLanguages/Japanese.nsh new file mode 100644 index 0000000..4a9c14b Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Japanese.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Khmer.nsh b/Other/Source/PortableApps.comInstallerLanguages/Khmer.nsh new file mode 100644 index 0000000..ad2703a Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Khmer.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Korean.nsh b/Other/Source/PortableApps.comInstallerLanguages/Korean.nsh new file mode 100644 index 0000000..ff70062 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Korean.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Kurdish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Kurdish.nsh new file mode 100644 index 0000000..18a93d3 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Kurdish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Latvian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Latvian.nsh new file mode 100644 index 0000000..bcd624c Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Latvian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Lithuanian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Lithuanian.nsh new file mode 100644 index 0000000..f570924 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Lithuanian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Luxembourgish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Luxembourgish.nsh new file mode 100644 index 0000000..7419dc9 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Luxembourgish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Macedonian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Macedonian.nsh new file mode 100644 index 0000000..a891426 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Macedonian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Malagasy.nsh b/Other/Source/PortableApps.comInstallerLanguages/Malagasy.nsh new file mode 100644 index 0000000..29c5d3e Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Malagasy.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Malay.nsh b/Other/Source/PortableApps.comInstallerLanguages/Malay.nsh new file mode 100644 index 0000000..b970e99 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Malay.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Mongolian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Mongolian.nsh new file mode 100644 index 0000000..e15ac7e Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Mongolian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Norwegian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Norwegian.nsh new file mode 100644 index 0000000..e73fcd2 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Norwegian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/NorwegianNynorsk.nsh b/Other/Source/PortableApps.comInstallerLanguages/NorwegianNynorsk.nsh new file mode 100644 index 0000000..6c61766 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/NorwegianNynorsk.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Pashto.nsh b/Other/Source/PortableApps.comInstallerLanguages/Pashto.nsh new file mode 100644 index 0000000..1415ede Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Pashto.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Polish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Polish.nsh new file mode 100644 index 0000000..f1edf0e Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Polish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Portuguese.nsh b/Other/Source/PortableApps.comInstallerLanguages/Portuguese.nsh new file mode 100644 index 0000000..feb507d Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Portuguese.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/PortugueseBR.nsh b/Other/Source/PortableApps.comInstallerLanguages/PortugueseBR.nsh new file mode 100644 index 0000000..6ced5ed Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/PortugueseBR.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Romanian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Romanian.nsh new file mode 100644 index 0000000..117b943 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Romanian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Russian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Russian.nsh new file mode 100644 index 0000000..fcc5694 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Russian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Serbian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Serbian.nsh new file mode 100644 index 0000000..6dbb09a Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Serbian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/SerbianLatin.nsh b/Other/Source/PortableApps.comInstallerLanguages/SerbianLatin.nsh new file mode 100644 index 0000000..d14f719 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/SerbianLatin.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/SimpChinese.nsh b/Other/Source/PortableApps.comInstallerLanguages/SimpChinese.nsh new file mode 100644 index 0000000..df1c26a Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/SimpChinese.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Slovak.nsh b/Other/Source/PortableApps.comInstallerLanguages/Slovak.nsh new file mode 100644 index 0000000..3db0230 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Slovak.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Slovenian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Slovenian.nsh new file mode 100644 index 0000000..fefbac2 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Slovenian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Spanish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Spanish.nsh new file mode 100644 index 0000000..4dd14ee Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Spanish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/SpanishInternational.nsh b/Other/Source/PortableApps.comInstallerLanguages/SpanishInternational.nsh new file mode 100644 index 0000000..b25bc8c Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/SpanishInternational.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Swahili.nsh b/Other/Source/PortableApps.comInstallerLanguages/Swahili.nsh new file mode 100644 index 0000000..762dc00 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Swahili.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Swedish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Swedish.nsh new file mode 100644 index 0000000..435ef35 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Swedish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Thai.nsh b/Other/Source/PortableApps.comInstallerLanguages/Thai.nsh new file mode 100644 index 0000000..73f3d55 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Thai.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/TradChinese.nsh b/Other/Source/PortableApps.comInstallerLanguages/TradChinese.nsh new file mode 100644 index 0000000..6efb066 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/TradChinese.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Turkish.nsh b/Other/Source/PortableApps.comInstallerLanguages/Turkish.nsh new file mode 100644 index 0000000..da05f2d Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Turkish.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Ukrainian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Ukrainian.nsh new file mode 100644 index 0000000..5c26ec0 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Ukrainian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Uzbek.nsh b/Other/Source/PortableApps.comInstallerLanguages/Uzbek.nsh new file mode 100644 index 0000000..2be3f08 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Uzbek.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Valencian.nsh b/Other/Source/PortableApps.comInstallerLanguages/Valencian.nsh new file mode 100644 index 0000000..9488bac Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Valencian.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Vietnamese.nsh b/Other/Source/PortableApps.comInstallerLanguages/Vietnamese.nsh new file mode 100644 index 0000000..3048172 Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Vietnamese.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Welsh.nsh b/Other/Source/PortableApps.comInstallerLanguages/Welsh.nsh new file mode 100644 index 0000000..8cb689b Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Welsh.nsh differ diff --git a/Other/Source/PortableApps.comInstallerLanguages/Yoruba.nsh b/Other/Source/PortableApps.comInstallerLanguages/Yoruba.nsh new file mode 100644 index 0000000..68e449f Binary files /dev/null and b/Other/Source/PortableApps.comInstallerLanguages/Yoruba.nsh differ diff --git a/Other/Source/PortableApps.comInstallerMoveFiles.nsh b/Other/Source/PortableApps.comInstallerMoveFiles.nsh new file mode 100644 index 0000000..fd3d344 --- /dev/null +++ b/Other/Source/PortableApps.comInstallerMoveFiles.nsh @@ -0,0 +1,104 @@ +; Copyright (c) 2008, Harold E Austin Jr +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; * Neither the name of the organization nor the +; names of its contributors may be used to endorse or promote products +; derived from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY Harold E Austin Jr ``AS IS'' AND ANY +; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +; DISCLAIMED. IN NO EVENT SHALL Harold E Austin Jr BE LIABLE FOR ANY +; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* + MoveFiles.nsh -- version 1.0 (May 5, 2008) + move files matching "filespec" from "source-directory" to "destination-directory" + + usage: + !include MoveFiles.nsh + + ${MoveFiles} mode "filespec" "source-directory" "destination-directory" + + where: + mode can be DOS, DIR, FORCE or DIR+FORCE (anything else = DOS): + DOS means act like the DOS MOVE command (move only files) + DIR means move files AND directories + FORCE means overwrite destination files (like MOVE/Y) + + example: + CreateDirectory "C:\NEW\DIR" + DetailPrint "Moving files and directories..." + ${MoveFiles} DIR+FORCE "*" "C:\OLD\DIR" "C:\NEW\DIR" + DetailPrint `"Processing"...` + Sleep 2000 + DetailPrint "Moving only the files back..." + ${MoveFiles} DOS "*" "C:\NEW\DIR" "C:\OLD\DIR" + DetailPrint "Moving the directories back..." + ${MoveFiles} DIR "*" "C:\NEW\DIR" "C:\OLD\DIR" +*/ +!ifndef MoveFiles +!define MoveFiles "!insertmacro MoveFiles" +!macro MoveFiles mode filespec sourcedir destdir + push `${destdir}` + push `${sourcedir}` + push `${filespec}` + push `${mode}` + call MoveFiles +!macroend + +Function MoveFiles ; mode filespec sourcedir destdir + Exch $0 ; mode, directory mode + Exch + Exch $1 ; filespec, force mode + Exch 2 + Exch $2 ; source directory + Exch 3 + Exch $3 ; destination directory + Push $4 ; FindFirst/FindNext search handle + Push $5 ; current filename matching filespec in sourcedir + FindFirst $4 $5 "$2\$1" + StrCpy $1 "" ; FORCE mode disabled by default + StrCmp $0 FORCE 0 +2 + StrCpy $1 FORCE + StrCmp $0 DIR+FORCE 0 +3 + StrCpy $0 DIR + StrCpy $1 FORCE + loop: + StrCmp $5 "" done ; $5 == "", if no more matching files + StrCmp $5 . next + StrCmp $5 .. next + StrCmp $0 DIR +2 + ; DIR mode disabled: ignore directories that match ${filespec} + IfFileExists "$2\$5\*.*" next + StrCmp $1 FORCE 0 +4 + ; FORCE mode: make sure destination doesn't exist + Delete "$3\$5" + StrCmp $0 DIR 0 +2 + RMDir /R "$3\$5" + Rename "$2\$5" "$3\$5" + next: + FindNext $4 $5 + Goto loop + done: + FindClose $4 ; finished with this search; close handle + Pop $5 + Pop $4 + Pop $3 + Pop $0 + Pop $1 + Pop $2 +FunctionEnd +!endif diff --git a/Other/Source/PortableApps.comInstallerProcFunc.nsh b/Other/Source/PortableApps.comInstallerProcFunc.nsh new file mode 100644 index 0000000..23ce710 --- /dev/null +++ b/Other/Source/PortableApps.comInstallerProcFunc.nsh @@ -0,0 +1,835 @@ +/* +_____________________________________________________________________________ + + Process Functions Header v2.2 +_____________________________________________________________________________ + + 2008-2010 Erik Pilsits aka wraithdu + License: zlib/libpng + + See documentation for more information about the following functions. + + Usage in script: + 1. !include "ProcFunc.nsh" + 2. [Section|Function] + ${ProcFunction} "Param1" "Param2" "..." $var + [SectionEnd|FunctionEnd] + + + ProcFunction=[GetProcessPID|GetProcessPath|GetProcessParent|GetProcessName| + EnumProcessPaths|ProcessWait|ProcessWait2|ProcessWaitClose| + CloseProcess|TerminateProcess|Execute] + + There is also a LogicLib extension: + ${If} ${ProcessExists} file.exe + ... + ${EndIf} + +_____________________________________________________________________________ + + Thanks to: +_____________________________________________________________________________ + +Some functions based on work by Donald Miller and Phoenix1701@gmail.com + +_____________________________________________________________________________ + + Individual documentation: +_____________________________________________________________________________ + +${ProcessExists} "[process]" + "[process]" ; Name or PID + + Use with a LogicLib conditional command like If or Unless. + Evaluates to true if the process exists or false if it does not or + the CreateToolhelp32Snapshot fails. + +${GetProcessPID} "[process]" $var + "[process]" ; Name or PID + + $var(output) ; -2 - CreateToolhelp32Snapshot failed + ; 0 - process does not exist + ; >0 - PID + +${GetProcessPath} "[process]" $var + "[process]" ; Name or PID + + $var(output) ; -2 - CreateToolhelp32Snapshot failed + ; -1 - OpenProcess failed + ; 0 - process does not exist + ; Or path to process + +${GetProcessParent} "[process]" $var + "[process]" ; Name or PID + + $var(output) ; -2 - CreateToolhelp32Snapshot failed + ; 0 - process does not exist + ; Or PPID + +${GetProcessName} "[PID]" $var + "[PID]" ; PID + + $var(output) ; -2 - CreateToolhelp32Snapshot failed + ; 0 - process does not exist + ; Or process name + +${EnumProcessPaths} "Function" $var + "Function" ; Callback function + $var(output) ; -2 - EnumProcesses failed + ; 1 - success + + Function "Function" + Pop $var1 ; matching path string + Pop $var2 ; matching process PID + ...user commands + Push [1/0] ; must return 1 on the stack to continue + ; must return some value or corrupt the stack + ; DO NOT save data in $0-$9 + FunctionEnd + +${ProcessWait} "[process]" "[timeout]" $var + "[process]" ; Name + "[timeout]" ; -1 - do not timeout + ; >0 - timeout in milliseconds + + $var(output) ; -2 - CreateToolhelp32Snapshot failed + ; -1 - operation timed out + ; Or PID + +${ProcessWait2} "[process]" "[timeout]" $var + "[process]" ; Name + "[timeout]" ; -1 - do not timeout + ; >0 - timeout in milliseconds + + $var(output) ; -1 - operation timed out + ; Or PID + +${ProcessWaitClose} "[process]" "[timeout]" $var + "[process]" ; Name + "[timeout]" ; -1 - do not timeout + ; >0 - timeout in milliseconds + + $var(output) ; -1 - operation timed out + ; 0 - process does not exist + ; Or PID of ended process + +${CloseProcess} "[process]" $var + "[process]" ; Name or PID + + $var(output) ; 0 - process does not exist + ; Or PID of ended process + +${TerminateProcess} "[process]" $var + "[process]" ; Name or PID + + $var(output) ; -1 - operation failed + ; 0 - process does not exist + ; Or PID of ended process + +${Execute} "[command]" "[working_dir]" $var + "[command]" ; '"X:\path\to\prog.exe" arg1 arg2 "arg3 with space"' + "[working_dir]" ; Working directory ("X:\path\to\dir") or nothing ("") + + $var(output) ; 0 - failed to create process + ; Or PID +*/ + + +;_____________________________________________________________________________ +; +; Macros +;_____________________________________________________________________________ +; +; Change log window verbosity (default: 3=no script) +; +; Example: +; !include "ProcFunc.nsh" +; ${PROCFUNC_VERBOSE} 4 # all verbosity +; ${PROCFUNC_VERBOSE} 3 # no script + +!ifndef PROCFUNC_INCLUDED +!define PROCFUNC_INCLUDED + +!include Util.nsh +!include LogicLib.nsh + +!verbose push +!verbose 3 +!ifndef _PROCFUNC_VERBOSE + !define _PROCFUNC_VERBOSE 3 +!endif +!verbose ${_PROCFUNC_VERBOSE} +!define PROCFUNC_VERBOSE `!insertmacro PROCFUNC_VERBOSE` +!verbose pop + +!macro PROCFUNC_VERBOSE _VERBOSE + !verbose push + !verbose 3 + !undef _PROCFUNC_VERBOSE + !define _PROCFUNC_VERBOSE ${_VERBOSE} + !verbose pop +!macroend + +!define PROCESS_QUERY_INFORMATION 0x0400 +!define PROCESS_TERMINATE 0x0001 +!define PROCESS_VM_READ 0x0010 +!define SYNCHRONIZE 0x00100000 + +!define WAIT_TIMEOUT 0x00000102 + +!ifdef NSIS_UNICODE + !define _PROCFUNC_WSTRING "&w260" +!else + !define _PROCFUNC_WSTRING "&w520" +!endif + +!macro ProcessExists + !error "ProcessExists has been renamed to GetProcessPID" +!macroend +!macro _ProcessExists _a _b _t _f + !insertmacro _LOGICLIB_TEMP + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push `${_b}` + ${CallArtificialFunction} LLProcessExists_ + IntCmp $_LOGICLIB_TEMP 0 `${_f}` + Goto `${_t}` + !verbose pop +!macroend +!define ProcessExists `"" ProcessExists` + +!macro GetProcessPID +!macroend +!define GetProcessPID "!insertmacro GetProcessPIDCall" +!macro GetProcessPIDCall process outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push 0 + Push `${process}` + !ifdef CallArtificialFunction_TYPE ; macro nesting disallowed, breaks otherwise if used from WaitClose + ${CallArtificialFunction2} ProcFuncs_ + !else + ${CallArtificialFunction} ProcFuncs_ + !endif + Pop ${outVar} + !verbose pop +!macroend + +!macro GetProcessPath +!macroend +!define GetProcessPath "!insertmacro GetProcessPathCall" +!macro GetProcessPathCall process outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push 1 + Push `${process}` + ${CallArtificialFunction} ProcFuncs_ + Pop ${outVar} + !verbose pop +!macroend + +!macro GetProcessParent +!macroend +!define GetProcessParent "!insertmacro GetProcessParentCall" +!macro GetProcessParentCall process outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push 2 + Push `${process}` + ${CallArtificialFunction} ProcFuncs_ + Pop ${outVar} + !verbose pop +!macroend + +!macro GetProcessName +!macroend +!define GetProcessName "!insertmacro GetProcessNameCall" +!macro GetProcessNameCall process outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push 6 + Push `${process}` + ${CallArtificialFunction} ProcFuncs_ + Pop ${outVar} + !verbose pop +!macroend + +!macro EnumProcessPaths +!macroend +!define EnumProcessPaths "!insertmacro EnumProcessPathsCall" +!macro EnumProcessPathsCall user_func outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push $0 + GetFunctionAddress $0 `${user_func}` + Push `$0` + ${CallArtificialFunction} EnumProcessPaths_ + Exch + Pop $0 + Pop ${outVar} + !verbose pop +!macroend + +!macro ProcessWait +!macroend +!define ProcessWait "!insertmacro ProcessWaitCall" +!macro ProcessWaitCall process timeout outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push `${timeout}` + Push `${process}` + ${CallArtificialFunction} ProcessWait_ + Pop ${outVar} + !verbose pop +!macroend + +!macro ProcessWait2 +!macroend +!define ProcessWait2 "!insertmacro ProcessWait2Call" +!macro ProcessWait2Call process timeout outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push `${timeout}` + Push `${process}` + ${CallArtificialFunction} ProcessWait2_ + Pop ${outVar} + !verbose pop +!macroend + +!macro ProcessWaitClose +!macroend +!define ProcessWaitClose "!insertmacro ProcessWaitCloseCall" +!macro ProcessWaitCloseCall process timeout outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push `${timeout}` + Push `${process}` + ${CallArtificialFunction} ProcessWaitClose_ + Pop ${outVar} + !verbose pop +!macroend + +!macro CloseProcess +!macroend +!define CloseProcess "!insertmacro CloseProcessCall" +!macro CloseProcessCall process outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push `${process}` + ${CallArtificialFunction} CloseProcess_ + Pop ${outVar} + !verbose pop +!macroend + +!macro TerminateProcess +!macroend +!define TerminateProcess "!insertmacro TerminateProcessCall" +!macro TerminateProcessCall process outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push `${process}` + ${CallArtificialFunction} TerminateProcess_ + Pop ${outVar} + !verbose pop +!macroend + +!macro Execute +!macroend +!define Execute "!insertmacro ExecuteCall" +!macro ExecuteCall cmdline wrkdir outVar + !verbose push + !verbose ${_PROCFUNC_VERBOSE} + Push `${wrkdir}` + Push `${cmdline}` + ${CallArtificialFunction} Execute_ + Pop ${outVar} + !verbose pop +!macroend + +!macro ProcFuncs_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; process / PID + Pop $1 ; mode + + Push 0 ; set return value if not found + + ; set mode of operation in $1 + ${Select} $1 ; mode 0 = GetProcessPID, mode 1 = GetProcessPath, mode 2 = GetProcessParent + ${Case} 0 + StrCpy $2 $0 4 -4 + ${If} $2 == ".exe" + ; exists from process name + StrCpy $1 0 + ${Else} + ; exists from pid + StrCpy $1 1 + ${EndIf} + ${Case} 1 + StrCpy $2 $0 4 -4 + ${If} $2 == ".exe" + ; get path from process name + StrCpy $1 2 + ${Else} + ; get path from pid + StrCpy $1 3 + ${EndIf} + ${Case} 2 + StrCpy $2 $0 4 -4 + ${If} $2 == ".exe" + ; get parent from process name + StrCpy $1 4 + ${Else} + ; get parent from pid + StrCpy $1 5 + ${EndIf} + ${EndSelect} + + System::Call '*(&l4,i,i,i,i,i,i,i,i,${_PROCFUNC_WSTRING})i .r2' ; $2 = PROCESSENTRY32W structure + ; take system process snapshot in $3 + System::Call 'kernel32::CreateToolhelp32Snapshot(i 2, i 0)i .r3' + ${Unless} $3 = -1 + System::Call 'kernel32::Process32FirstW(i r3, i r2)i .r4' + ${Unless} $4 = 0 + ${Do} + ${Select} $1 + ${Case3} 0 2 4 + ; get process name in $5 + System::Call '*$2(i,i,i,i,i,i,i,i,i,${_PROCFUNC_WSTRING} .r5)' + ${Case4} 1 3 5 6 + ; get process PID in $5 + System::Call '*$2(i,i,i .r5)' + ${EndSelect} + ; is this process the one we are looking for? + ${If} $5 == $0 ; string test works ok for numeric PIDs as well + ${Select} $1 ; mode 0/1 = GetProcessPID, mode 2/3 = GetProcessPath, mode 4/5 = GetProcessParent, mode 6 = GetProcessName + ${Case2} 0 1 + ; return pid + Pop $5 ; old return value + System::Call '*$2(i,i,i .s)'; process pid to stack + ${Case2} 2 3 + ; return full path + Pop $5 + ; open process + System::Call '*$2(i,i,i .s)'; process pid to stack + System::Call 'kernel32::OpenProcess(i ${PROCESS_QUERY_INFORMATION}|${PROCESS_VM_READ}, i 0, i s)i .r5' ; process handle to $5 + ${Unless} $5 = 0 + ; full path to stack + System::Call 'psapi::GetModuleFileNameExW(i r5, i 0, w .s, i ${NSIS_MAX_STRLEN})' + System::Call 'kernel32::CloseHandle(i r5)' + ${Else} + Push -1 ; OpenProcess failure return value + ${EndUnless} + ${Case2} 4 5 + ; return parent PID + Pop $5 + System::Call '*$2(i,i,i,i,i,i,i .s)'; parent pid to stack + ${Case} 6 + ; return base name + Pop $5 + System::Call '*$2(i,i,i,i,i,i,i,i,i,${_PROCFUNC_WSTRING} .s)' + ${EndSelect} + ${Break} + ${EndIf} + System::Call 'kernel32::Process32NextW(i r3, i r2)i .r4' + ${LoopUntil} $4 = 0 + System::Call 'kernel32::CloseHandle(i r3)' ; close snapshot + ${EndUnless} + ${Else} + Pop $5 + Push -2 ; function failure return value + ${EndUnless} + System::Free $2 ; free buffer + + System::Store "l" ; restore registers +!macroend + +!macro EnumProcessPaths_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; user_func + + StrCpy $1 1 ; OK to loop + + System::Alloc 1024 + Pop $2 ; process list buffer + ; get an array of all process ids + System::Call 'psapi::EnumProcesses(i r2, i 1024, *i .r3)i .r4' ; $3 = sizeof buffer + ${Unless} $4 = 0 + IntOp $3 $3 / 4 ; Divide by sizeof(DWORD) to get $3 process count + IntOp $3 $3 - 1 ; decrement for 0 base loop + ${For} $4 0 $3 + ${IfThen} $1 != 1 ${|} ${Break} ${|} + ; get a PID from the array + IntOp $5 $4 * 4 ; calculate offset + IntOp $5 $5 + $2 ; add offset to original buffer address + System::Call '*$5(i .r5)' ; get next PID = $5 + ${Unless} $5 = 0 + System::Call 'kernel32::OpenProcess(i ${PROCESS_QUERY_INFORMATION}|${PROCESS_VM_READ}, i 0, i r5)i .r6' + ${Unless} $6 = 0 ; $6 is hProcess + ; get full path + System::Call 'psapi::GetModuleFileNameExW(i r6, i 0, w .r7, i ${NSIS_MAX_STRLEN})i .r8' ; $7 = path + ${Unless} $8 = 0 ; no path + System::Store "s" ; store registers in System's private stack + Push $5 ; PID to stack + Push $7 ; path to stack + Call $0 ; user func must return 1 on the stack to continue looping + System::Store "l" ; restore registers + Pop $1 ; continue? + ${EndUnless} + System::Call 'kernel32::CloseHandle(i r6)' + ${EndUnless} + ${EndUnless} + ${Next} + Push 1 ; return value + ${Else} + Push -2 ; function failure return value + ${EndUnless} + System::Free $2 ; free buffer + + System::Store "l" ; restore registers +!macroend + +!macro ProcessWait_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; process + Pop $1 ; timeout + + StrCpy $6 1 ; initialize loop + StrCpy $7 0 ; initialize timeout counter + + System::Call '*(&l4,i,i,i,i,i,i,i,i,${_PROCFUNC_WSTRING})i .r2' ; $2 = PROCESSENTRY32W structure + ${DoWhile} $6 = 1 ; processwait loop + ; take system process snapshot in $3 + System::Call 'kernel32::CreateToolhelp32Snapshot(i 2, i 0)i .r3' + ${Unless} $3 = -1 + System::Call 'kernel32::Process32FirstW(i r3, i r2)i .r4' + ${Unless} $4 = 0 + ${Do} + ; get process name in $5 + System::Call '*$2(i,i,i,i,i,i,i,i,i,${_PROCFUNC_WSTRING} .r5)' + ${If} $5 == $0 + ; exists, return pid + System::Call '*$2(i,i,i .s)'; process pid to stack ; process pid + StrCpy $6 0 ; end loop + ${Break} + ${EndIf} + System::Call 'kernel32::Process32NextW(i r3, i r2)i .r4' + ${LoopUntil} $4 = 0 + System::Call 'kernel32::CloseHandle(i r3)' ; close snapshot + ${EndUnless} + ${Else} + Push -2 + ${Break} + ${EndUnless} + ; timeout loop + ${If} $6 = 1 + ${If} $1 >= 0 + IntOp $7 $7 + 500 ; increment timeout counter + ${AndIf} $7 >= $1 ; timed out, break loop + Push -1 ; timeout return value + ${Break} ; end loop if timeout + ${EndIf} + Sleep 500 ; pause before looping + ${EndIf} + ${Loop} ; processwaitloop + System::Free $2 ; free buffer + + System::Store "l" ; restore registers +!macroend + +!macro ProcessWait2_ + System::Store "s" ; store registers in System's private stack + System::Store "P0" ; FindProcDLL return value + Pop $0 ; process + Pop $1 ; timeout + + StrCpy $2 0 ; initialize timeout counter + + ${Do} + FindProcDLL::FindProc $0 + ${IfThen} $R0 = 1 ${|} ${Break} ${|} + ${If} $1 >= 0 + IntOp $2 $2 + 250 + ${AndIf} $2 >= $1 + Push -1 ; timeout return value + ${Break} + ${EndIf} + Sleep 250 + ${Loop} + + ${If} $R0 = 1 ; success, get pid + ${GetProcessPID} $0 $0 + Push $0 ; return pid + ${EndIf} + + System::Store "R0" ; restore registers + System::Store "l" +!macroend + +!macro ProcessWaitClose_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; process / PID + Pop $1 ; timeout + + ; passed process name or pid + StrCpy $2 $0 4 -4 + ${If} $2 == ".exe" + ${GetProcessPID} $0 $0 + ${EndIf} + + ; else passed pid directly + + ${Unless} $0 = 0 + System::Call 'kernel32::OpenProcess(i ${SYNCHRONIZE}, i 0, i r0)i .r2' + ${Unless} $2 = 0 ; $2 is hProcess + System::Call 'kernel32::WaitForSingleObject(i r2, i $1)i .r1' + ${If} $1 = ${WAIT_TIMEOUT} + Push -1 ; timed out + ${Else} + Push $0 ; return pid of ended process + ${EndIf} + System::Call 'kernel32::CloseHandle(i r2)' + ${Else} + Push 0 ; failure return value + ${EndUnless} + ${Else} + Push 0 ; failure return value + ${EndUnless} + + System::Store "l" ; restore registers +!macroend + +!macro CloseProcess_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; process / PID + + ; passed process name or pid + StrCpy $1 $0 4 -4 + ${If} $1 == ".exe" + ${GetProcessPID} $0 $0 + ${EndIf} + + ; else passed pid directly + + ${Unless} $0 = 0 ; $0 = target pid + Push $0 ; return pid of process + ; use EnumWindows and a callback + System::Get '(i .r1, i)i sr4' ; $1 = hwnd, $4 = callback#, s (stack) = source for return value + Pop $3 ; $3 = callback address + System::Call 'user32::EnumWindows(k r3, i)i' ; enumerate top-level windows + ${DoWhile} $4 == "callback1" + System::Call 'user32::GetWindowThreadProcessId(i r1, *i .r2)i' ; $2 = pid that created the window + ${If} $2 = $0 ; match to target pid + SendMessage $1 16 0 0 /TIMEOUT=1 ; send WM_CLOSE to all top-level windows owned by process, timeout immediately + ${EndIf} + Push 1 ; callback return value; keep enumerating windows (returning 0 stops) + StrCpy $4 "" ; clear callback# + System::Call '$3' ; return from callback + ${Loop} + System::Free $3 ; free callback + ${Else} + Push 0 ; failure return value + ${EndUnless} + + System::Store "l" ; restore registers +!macroend + +!macro TerminateProcess_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; process / PID + + ; passed process name or pid + StrCpy $1 $0 4 -4 + ${If} $1 == ".exe" + ${GetProcessPID} $0 $0 + ${EndIf} + + ; else passed pid directly + + ${Unless} $0 = 0 + System::Call 'kernel32::OpenProcess(i ${PROCESS_TERMINATE}, i 0, i r0)i .r1' + ${Unless} $1 = 0 ; $1 is hProcess + System::Call 'kernel32::TerminateProcess(i r1, i 0)i .r1' + ${If} $1 = 0 ; fail + Push -1 + ${Else} + Push $0 ; return pid of ended process + ${EndIf} + System::Call 'kernel32::CloseHandle(i r1)' + ${Else} + Push 0 ; failure return value + ${EndUnless} + ${Else} + Push 0 ; failure return value + ${EndUnless} + + System::Store "l" ; restore registers +!macroend + +!macro Execute_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; cmdline + Pop $1 ; wrkdir + + System::Alloc 68 ; 4*16 + 2*2 / STARTUPINFO structure = $2 + Pop $2 + System::Call '*$2(i 68)' ; set cb = sizeof(STARTUPINFO) + System::Call '*(i,i,i,i)i .r3' ; PROCESS_INFORMATION structure = $3 + + ${If} $1 == "" + StrCpy $1 "i" + ${Else} + StrCpy $1 'w "$1"' + ${EndIf} + + System::Call `kernel32::CreateProcessW(i, w '$0', i, i, i 0, i 0, i, $1, i r2, i r3)i .r4` ; return 0 if fail + ${Unless} $4 = 0 ; failed to create process + System::Call '*$3(i .r4, i .r5, i .r6)' ; read handles and PID + System::Call 'kernel32::CloseHandle(i $4)' ; close hProcess + System::Call 'kernel32::CloseHandle(i $5)' ; close hThread + Push $6 ; return PID + ${Else} + Push 0 ; return val if failed + ${EndUnless} + + System::Free $2 ; free STARTUPINFO struct + System::Free $3 ; free PROCESS_INFORMATION struct + + System::Store "l" ; restore registers +!macroend + +!macro LLProcessExists_ + System::Store "s" ; store registers in System's private stack + Pop $0 ; process name + + StrCpy $_LOGICLIB_TEMP 0 + + System::Call '*(&l4,i,i,i,i,i,i,i,i,${_PROCFUNC_WSTRING})i .r2' ; $2 = PROCESSENTRY32W structure + ; take system process snapshot in $3 + System::Call 'kernel32::CreateToolhelp32Snapshot(i 2, i 0)i .r3' + IntCmp $3 -1 done + System::Call 'kernel32::Process32FirstW(i r3, i r2)i .r4' + IntCmp $4 0 endloop + loop: + System::Call '*$2(i,i,i,i,i,i,i,i,i,${_PROCFUNC_WSTRING} .r5)' + StrCmp $5 $0 0 next_process + StrCpy $_LOGICLIB_TEMP 1 + Goto endloop + next_process: + System::Call 'kernel32::Process32NextW(i r3, i r2)i .r4' + IntCmp $4 0 endloop + Goto loop + endloop: + System::Call 'kernel32::CloseHandle(i r3)' ; close snapshot + done: + System::Free $2 ; free buffer + + System::Store "l" ; restore registers +!macroend + +!endif ; PROCFUNC_INCLUDED + +/**************************************************************************** + Functions + ========= + + HANDLE WINAPI OpenProcess( + __in DWORD dwDesiredAccess, + __in BOOL bInheritHandle, + __in DWORD dwProcessId + ); + + BOOL WINAPI CreateProcess( + __in_opt LPCTSTR lpApplicationName, + __inout_opt LPTSTR lpCommandLine, + __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes, + __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes, + __in BOOL bInheritHandles, + __in DWORD dwCreationFlags, + __in_opt LPVOID lpEnvironment, + __in_opt LPCTSTR lpCurrentDirectory, + __in LPSTARTUPINFO lpStartupInfo, + __out LPPROCESS_INFORMATION lpProcessInformation + ); + + typedef struct _STARTUPINFO { + DWORD cb; + LPTSTR lpReserved; + LPTSTR lpDesktop; + LPTSTR lpTitle; + DWORD dwX; + DWORD dwY; + DWORD dwXSize; + DWORD dwYSize; + DWORD dwXCountChars; + DWORD dwYCountChars; + DWORD dwFillAttribute; + DWORD dwFlags; + WORD wShowWindow; + WORD cbReserved2; + LPBYTE lpReserved2; + HANDLE hStdInput; + HANDLE hStdOutput; + HANDLE hStdError; + } STARTUPINFO, + *LPSTARTUPINFO; + + typedef struct _PROCESS_INFORMATION { + HANDLE hProcess; + HANDLE hThread; + DWORD dwProcessId; + DWORD dwThreadId; + } PROCESS_INFORMATION, + *LPPROCESS_INFORMATION; + + BOOL WINAPI EnumProcesses( + __out DWORD* pProcessIds, + __in DWORD cb, + __out DWORD* pBytesReturned + ); + + DWORD WINAPI GetModuleBaseName( + __in HANDLE hProcess, + __in_opt HMODULE hModule, + __out LPTSTR lpBaseName, + __in DWORD nSize + ); + + DWORD WINAPI GetModuleFileNameEx( + __in HANDLE hProcess, + __in_opt HMODULE hModule, + __out LPTSTR lpFilename, + __in DWORD nSize + ); + + BOOL WINAPI CloseHandle( + __in HANDLE hObject + ); + + DWORD WINAPI WaitForSingleObject( + __in HANDLE hHandle, + __in DWORD dwMilliseconds + ); + + BOOL WINAPI TerminateProcess( + __in HANDLE hProcess, + __in UINT uExitCode + ); + + BOOL EnumWindows( + __in WNDENUMPROC lpEnumFunc, + __in LPARAM lParam + ); + + DWORD GetWindowThreadProcessId( + __in HWND hWnd, + __out LPDWORD lpdwProcessId + ); + + BOOL PostMessage( + __in HWND hWnd, + __in UINT Msg, + __in WPARAM wParam, + __in LPARAM lParam + ); + +****************************************************************************/ diff --git a/Other/Source/PortableApps.comInstallerTBProgress.nsh b/Other/Source/PortableApps.comInstallerTBProgress.nsh new file mode 100644 index 0000000..4e40fdf --- /dev/null +++ b/Other/Source/PortableApps.comInstallerTBProgress.nsh @@ -0,0 +1,59 @@ +!include "LogicLib.nsh" + +!ifndef CLSCTX_INPROC_SERVER + !define CLSCTX_INPROC_SERVER 1 +!endif + +!define CLSID_ITaskbarList {56fdf344-fd6d-11d0-958a-006097c9a090} + +!define IID_ITaskbarList3 {ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf} +!define ITaskbarList3->SetProgressState $ITaskbarList3->10 +!define ITaskbarList3->SetProgressValue $ITaskbarList3->9 + +!define TBPF_NOPROGRESS 0x00000000 ; Normal state / no progress bar +!define TBPF_INDETERMINATE 0x00000001 ; Marquee style progress bar +!define TBPF_NORMAL 0x00000002 ; Standard progress bar +!define TBPF_ERROR 0x00000004 ; Red taskbar button to indicate an error occurred +!define TBPF_PAUSED 0x00000008 ; Yellow taskbar button to indicate user attention + ; (input) is required to resume progress + +Var ITaskbarList3 + +!macro TBProgress_Init + !ifndef TBProgressInitialized + !define TBProgressInitialized + ${Unless} ${Silent} + System::Call "ole32::CoCreateInstance( \ + g '${CLSID_ITaskbarList}', \ + i 0, \ + i ${CLSCTX_INPROC_SERVER}, \ + g '${IID_ITaskbarList3}', \ + *i .s)" + Pop $ITaskbarList3 + ${Else} + StrCpy $ITaskbarList3 0 + ${EndIf} + !endif +!macroend +!define TBProgress_Init `!insertmacro TBProgress_Init` + +!macro TBProgress_Progress Val Max + ${TBProgress_Init} + ${If} $ITaskbarList3 <> 0 + System::Call "${ITaskbarList3->SetProgressValue}(i$HWNDPARENT, l${Val}, l${Max})" + ${EndIf} +!macroend +!define TBProgress_Progress `!insertmacro TBProgress_Progress` + +!macro TBProgress Val + ${TBProgress_Progress} ${Val} 100 +!macroend +!define TBProgress `!insertmacro TBProgress` + +!macro TBProgress_State State + ${TBProgress_Init} + ${If} $ITaskbarList3 <> 0 + System::Call "${ITaskbarList3->SetProgressState}(i$HWNDPARENT, i${TBPF_${State}})" + ${EndIf} +!macroend +!define TBProgress_State `!insertmacro TBProgress_State` \ No newline at end of file diff --git a/Other/Update/Update.ps1 b/Other/Update/Update.ps1 index f1e4be8..6493d1b 100644 --- a/Other/Update/Update.ps1 +++ b/Other/Update/Update.ps1 @@ -6,7 +6,7 @@ # ----------------------------------------------------------------------------- # Globals # ----------------------------------------------------------------------------- -$Version = "0.0.15-alpha" +$Version = "0.0.17-alpha" $AppRoot = $(Convert-Path "$PSScriptRoot\..\..") $AppDir = "$AppRoot\App" $AppInfoDir = "$AppDir\AppInfo" @@ -218,12 +218,13 @@ Function Download-File { Invoke-WebRequest -Uri $Download.URL ` -OutFile "$($Download.OutFile()).part" - Debug info "Move file $($Download.OutFile).part to $($Download.OutFile())" + Debug info "Move file $($Download.OutFile()).part to $($Download.OutFile())" Move-Item -Path "$($Download.OutFile()).part" ` -Destination $Download.OutFile() } If (!(Check-Sum -Download $Download)) { - Debug fatal "Checksum for $($Download.OutFile()) does not match '$Checksum'" + Debug fatal "Checksum for $($Download.OutFile()) " ` + "does not match '$($Donwload.Checksum)'" Exit 1 } Debug info "Downloaded file '$($Download.OutFile())'" @@ -351,7 +352,7 @@ Function Fix-Path() { # Convert Path only Works on Existing Directories :( param( [string] $Path ) Switch (Is-Unix) { - $True { + $True { $From = '\' $To = '/' break; @@ -411,20 +412,23 @@ Function Invoke-Helper() { $AppPath = (Get-Location) Switch (Is-Unix) { - $True { $Prefix = "timeout $Timeout wine"; break } - default { $Prefix = '' } + $True { + $Arguments = "$Command $(Windows-Path $AppPath)" + $Command = "wine" + break + } + default { + $Arguments = Windows-Path $AppPath + } } - If ($Sleep) { - Debug info "Waiting for filsystem cache to catch up" - Start-Sleep $Sleep - } + #If ($Sleep) { + # Debug info "Waiting for filsystem cache to catch up" + # Start-Sleep $Sleep + #} - Debug info "Run PA Command $Prefix $Command $(Windows-Path $AppPath)" - Invoke-Expression "$Prefix $Command $(Windows-Path $AppPath)" - If (!(Is-Unix)) { - Wait-Process -Name $(Get-Item $Command).Basename -Timeout $Timeout - } + Debug info "Run PA $Command $Arguments" + Start-Process $Command -ArgumentList $Arguments -NoNewWindow -Wait } # -----------------------------------------------------------------------------