├── .gitmodules ├── installer ├── src │ ├── res │ │ ├── back.bmp │ │ ├── header.bmp │ │ ├── StatusAlert.png │ │ ├── StatusInfo.png │ │ ├── AlgoIconBlack.ico │ │ ├── StatusCritical.png │ │ └── COPYING.rtf │ ├── GenProdId.sh │ ├── batch │ │ └── setenv.cmd │ ├── dprintf.h │ ├── MessageDlg.wxs │ ├── Makefile │ ├── WelcomeDlg_2.wxs │ ├── NodeConfigDlg.wxs │ ├── UI.wxs │ ├── CustomActions.cpp │ └── AlgorandNode.wxs └── README.md ├── .gitignore ├── algodsvc ├── README ├── Makefile ├── dprintf.h ├── algodsvc.mc └── algodsvc.cpp ├── README.md └── LICENSE /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "go-algorand"] 2 | path = go-algorand 3 | url = https://github.com/algorand/go-algorand 4 | -------------------------------------------------------------------------------- /installer/src/res/back.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/randlabs/algorand-windows-node/HEAD/installer/src/res/back.bmp -------------------------------------------------------------------------------- /installer/src/res/header.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/randlabs/algorand-windows-node/HEAD/installer/src/res/header.bmp -------------------------------------------------------------------------------- /installer/src/res/StatusAlert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/randlabs/algorand-windows-node/HEAD/installer/src/res/StatusAlert.png -------------------------------------------------------------------------------- /installer/src/res/StatusInfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/randlabs/algorand-windows-node/HEAD/installer/src/res/StatusInfo.png -------------------------------------------------------------------------------- /installer/src/GenProdId.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo -n $1 | sha256sum | cut -c 1-32 | sed 's/./&-/8;s/./&-/13;s/./&-/18;s/./&-/23' 3 | 4 | -------------------------------------------------------------------------------- /installer/src/res/AlgoIconBlack.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/randlabs/algorand-windows-node/HEAD/installer/src/res/AlgoIconBlack.ico -------------------------------------------------------------------------------- /installer/src/res/StatusCritical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/randlabs/algorand-windows-node/HEAD/installer/src/res/StatusCritical.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pdb 2 | *.obj 3 | /algodsvc/*.exe 4 | /algodsvc/algodsvc.h 5 | /algodsvc/*.rc 6 | /algodsvc/*.o 7 | /algodsvc/MSG*.bin 8 | /installer/src/*.wixobj 9 | /installer/src/*.msi 10 | /installer/src/*.wixpdb 11 | /installer/src/cabs 12 | /installer/src/*.dll 13 | /installer/src/*.gch 14 | installer/src/msi-* 15 | installer/src/obj-* 16 | -------------------------------------------------------------------------------- /installer/src/batch/setenv.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Algorand Command-line Tools for Windows Environment Setup 3 | echo. 4 | 5 | pushd .. 6 | for %%* in (.) do set ALGORAND_NETWORK=%%~nx* 7 | set ALGORAND_TOOLS=%cd% 8 | popd 9 | 10 | set ALGORAND_DATA=%PROGRAMDATA%\Algorand\data\%ALGORAND_NETWORK% 11 | set PATH=%PATH%;%ALGORAND_TOOLS% 12 | 13 | echo * Set ALGORAND_DATA=%ALGORAND_DATA% 14 | echo * Added "%ALGORAND_TOOLS%" to this session PATH. 15 | 16 | echo Done. 17 | 18 | if "%1" == "/walkback" cd.. -------------------------------------------------------------------------------- /algodsvc/README: -------------------------------------------------------------------------------- 1 | 2 | To install the service and it's associated keys: 3 | 4 | ``` 5 | # Sample arguments. Use your own. 6 | make install SVCEXE="C:\src\go-algorand-rl\windows\algodsvc\algodsvc.exe" NETWORK=testnet ALGODEXE="E:\algod\algod.exe" NODEDATADIR="E:\algod\data" 7 | ``` 8 | 9 | Replace SVCEXE, ALGODEXE, NODEDATADIR with your desired locations for service executable, algod daemon executable and data directory. 10 | Use NETWORK to specify testnet,mainnet or betanet. 11 | 12 | This way algodsvc can serve multiple algod daemons for different networks in Windows systems. 13 | 14 | Use the following target to remove service entry from Windows registry: 15 | 16 | ``` 17 | make uninstall NETWORK= 18 | ``` 19 | 20 | 21 | -------------------------------------------------------------------------------- /algodsvc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Algodsvc Makefile. 3 | # (C) 2021 Randlabs. 4 | # 5 | # Licensed under AGPL3. 6 | # 7 | # You should have received a copy of the GNU Affero General Public License 8 | # along with this program. If not, see . 9 | # 10 | 11 | SC=sc 12 | RC=windres 13 | MC=windmc 14 | REG=reg 15 | SERVICENAME=AlgodSvc 16 | SERVICEDISPLAYNAME="Algorand Node Windows Service" 17 | CC=g++ 18 | CFLAGS=-Wall -static -pedantic -O2 -g -fanalyzer -D_FORTIFY_SOURCE=2 -fstack-protector 19 | LDFLAGS=-municode 20 | OUTNAME=algodsvc 21 | TARGET=$(OUTNAME).exe 22 | RCOUT=$(OUTNAME).rc 23 | RESOUT=$(OUTNAME)_res.o 24 | HDROUT=$(OUTNAME).h 25 | MSGBIN=MSG00001.BIN 26 | SOURCES=algodsvc.cpp 27 | 28 | all: $(RCOUT) $(HDROUT) $(MSGBIN) $(RESOUT) $(TARGET) 29 | 30 | $(RCOUT) $(HDROUT) $(MSGBIN): $(OUTNAME).mc 31 | $(MC) .\$(OUTNAME).mc 32 | 33 | $(RESOUT): $(OUTNAME).rc 34 | $(RC) -i .\$(OUTNAME).rc -o $(RESOUT) 35 | 36 | $(TARGET): $(SOURCES) 37 | $(CC) $(CFLAGS) $(SOURCES) $(RESOUT) $(LDFLAGS) -o $(TARGET) 38 | 39 | .PHONY: clean install uninstall 40 | 41 | clean: 42 | @rm -f $(TARGET) 43 | @rm -f $(RCOUT) 44 | @rm -f $(RESOUT) 45 | @rm -f $(HDROUT) 46 | @rm -f $(MSGBIN) 47 | 48 | install: 49 | $(SC) create $(SERVICENAME)_$(NETWORK) binPath= "$(SVCEXE) $(NETWORK) \"$(ALGODEXE)\" \"$(NODEDATADIR)\"" DisplayName= $(SERVICEDISPLAYNAME) obj= "NT AUTHORITY\NetworkService" 50 | $(REG) add "HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Algorand Node Service" /v EventMessageFile /d $(SVCEXE) 51 | 52 | uninstall: 53 | $(SC) delete $(SERVICENAME)_$(NETWORK) 54 | 55 | -------------------------------------------------------------------------------- /installer/README.md: -------------------------------------------------------------------------------- 1 | Algorand Node Windows Installer 2 | =============================== 3 | 4 | ChangeLog 5 | --------- 6 | 7 | **V1.0.0 (210119)**: Initial version. 8 | 9 | 10 | How to build 11 | ------------ 12 | 13 | * Install Wix Toolset (https://wixtoolset.org/). Version 3.11 or higher is required. 14 | * Build the algorand node following instructions at https://developer.algorand.org/tutorials/compile-and-run-the-algorand-node-natively-windows/ until step 3. Make sure `make` ends successfully. 15 | * Build the Windows Service at this repository under directory `windows/algodsvc`. Follow the `README.md` steps there. 16 | * Execute `make` with the `NETWORK` parameter specifying which kind of node you want to build, e.g to create a testnet node installer you must issue: 17 | 18 | ``` 19 | make NETWORK=testnet 20 | ``` 21 | 22 | The build process should take a while. It will generate a MSI installer named `algorand-node-testnet.msi` or similar depending on your chosen Algorand network. 23 | 24 | License 25 | ------- 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU Affero General Public License as 29 | published by the Free Software Foundation, either version 3 of the 30 | License, or (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU Affero General Public License for more details. 36 | 37 | You should have received a copy of the GNU Affero General Public License 38 | along with this program. If not, see . 39 | -------------------------------------------------------------------------------- /algodsvc/dprintf.h: -------------------------------------------------------------------------------- 1 | // 2 | // Algorand Node for Windows -- Service implementation 3 | // Copyright (C) 2021 Rand Labs 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | // 18 | #ifndef __DPRINTF_H__ 19 | #define __DPRINTF_H__ 20 | 21 | #include 22 | #include 23 | 24 | inline void dprintfW(const wchar_t* fmt, ...) 25 | { 26 | const size_t MAX_MSG = 255; 27 | 28 | va_list args; 29 | va_start(args, fmt); 30 | 31 | wchar_t msg[MAX_MSG]; 32 | StringCbVPrintfW(msg, MAX_MSG * sizeof(wchar_t), fmt, args); 33 | OutputDebugStringW(msg); 34 | 35 | va_end(args); 36 | } 37 | 38 | inline void dprintfA(const char* fmt, ...) 39 | { 40 | const size_t MAX_MSG = 255; 41 | 42 | va_list args; 43 | va_start(args, fmt); 44 | 45 | char msg[MAX_MSG]; 46 | StringCbVPrintfA(msg, MAX_MSG, fmt, args); 47 | OutputDebugStringA(msg); 48 | 49 | va_end(args); 50 | } 51 | 52 | #ifdef _DEBUG 53 | #define _TRACE dprintf(L"At %s line %d",__FUNCTIONW__,__LINE__) 54 | #else 55 | #define _TRACE 56 | #endif 57 | 58 | #endif // __DPRINTF_H__ -------------------------------------------------------------------------------- /installer/src/dprintf.h: -------------------------------------------------------------------------------- 1 | // 2 | // Algorand Node for Windows -- Service implementation 3 | // Copyright (C) 2021 Rand Labs 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | // 18 | #ifndef __DPRINTF_H__ 19 | #define __DPRINTF_H__ 20 | 21 | #include 22 | #include 23 | 24 | inline void dprintfW(const wchar_t* fmt, ...) 25 | { 26 | const size_t MAX_MSG = 255; 27 | 28 | va_list args; 29 | va_start(args, fmt); 30 | 31 | wchar_t msg[MAX_MSG]; 32 | StringCbVPrintfW(msg, MAX_MSG * sizeof(wchar_t), fmt, args); 33 | OutputDebugStringW(msg); 34 | 35 | va_end(args); 36 | } 37 | 38 | inline void dprintfA(const char* fmt, ...) 39 | { 40 | const size_t MAX_MSG = 255; 41 | 42 | va_list args; 43 | va_start(args, fmt); 44 | 45 | char msg[MAX_MSG]; 46 | StringCbVPrintfA(msg, MAX_MSG, fmt, args); 47 | OutputDebugStringA(msg); 48 | 49 | va_end(args); 50 | } 51 | 52 | #ifdef _DEBUG 53 | #define _TRACE dprintf(L"At %s line %d",__FUNCTIONW__,__LINE__) 54 | #else 55 | #define _TRACE 56 | #endif 57 | 58 | #endif // __DPRINTF_H__ -------------------------------------------------------------------------------- /installer/src/MessageDlg.wxs: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 1 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /installer/src/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for WiX-based windows Installer 3 | # Author: Hernán Di Pietro 4 | # (c) 2021 Rand Labs. 5 | # 6 | # Licensed under AGPL3. 7 | # 8 | # You should have received a copy of the GNU Affero General Public License 9 | # along with this program. If not, see . 10 | # 11 | # ----------------------------------------------------------------------------- 12 | # 13 | # Product GUIDs are correlated to the x.y.z version and network of the product 14 | # by calculating SHA256 of "x.y.z-network" string and formatting it as GUID, e.g: 15 | # 16 | # * See GenProdId.sh for details. For example, 2.3.0-testnet Producit GUID is 17 | # 14df32b6-c41a-3fde-1a39-79f7b7f27ef6 18 | # ----------------------------------------------------------------------------- 19 | 20 | CABASENAME=CustomActions 21 | CASOURCE=$(CABASENAME).cpp 22 | PCHSOURCE=./inc/json.hpp 23 | PCHOUT=json.hpp.gch 24 | CADLL=$(CABASENAME).dll 25 | CC=g++ 26 | CFLAGS=-Wall -Wextra -static -shared -pedantic -O2 -g -fanalyzer -D_FORTIFY_SOURCE=2 -fstack-protector -lmsi -municode 27 | SOURCES=AlgorandNode.wxs UI.wxs WelcomeDlg_2.wxs NodeConfigDlg.wxs MessageDlg.wxs 28 | SUFFIX=$(ALGOVERSION)-$(NETWORK) 29 | OBJDIR=./obj-$(SUFFIX)/ 30 | MSIDIR=./msi-$(SUFFIX)/ 31 | OBJ=$(OBJDIR)AlgorandNode.wixobj 32 | CANDLE=$(WIX)bin/candle.exe 33 | LIGHT=$(WIX)bin/light.exe 34 | GOBINFOLDER=$(HOME)/go/bin 35 | SVCBINFOLDER=../../algodsvc 36 | BATCHFOLDER=./batch 37 | ALGOVERSION := $(shell $(GOBINFOLDER)/goal.exe --version | awk 'FNR == 2 { print $$1 }' | awk -F "." 'BEGIN{OFS=""} { print $$1,".",$$2,".",$$3 }') 38 | MSI=$(MSIDIR)AlgorandNode-$(SUFFIX)_amd64.msi 39 | THISPRODUCTID := $(shell echo -n $(SUFFIX) | sha256sum | cut -c 1-32 | sed 's/./&-/8;s/./&-/13;s/./&-/18;s/./&-/23') 40 | 41 | all: $(PCHOUT) $(CADLL) $(OBJ) $(MSI) 42 | 43 | $(PCHOUT): $(PCHSOURCE) 44 | $(CC) $(PCHSOURCE) -o $(PCHOUT) $(CFLAGS) 45 | 46 | $(CADLL): $(CASOURCE) $(PCHOUT) 47 | $(CC) $(CASOURCE) -include $(PCHSOURCE) -o $(CADLL) $(CFLAGS) 48 | 49 | $(OBJ): $(SOURCES) $(CADLL) 50 | "$(CANDLE)" $(SOURCES) -ext WixUtilExtension -out "$(OBJDIR)" -arch x64 -dTHISPRODUCTID=$(THISPRODUCTID) -dALGOVERSION=$(ALGOVERSION) -dGOBINFOLDER=$(GOBINFOLDER) -dSVCBINFOLDER=$(SVCBINFOLDER) -dBATCHFOLDER=$(BATCHFOLDER) -dNETWORK=$(NETWORK) -v 51 | 52 | $(MSI): $(OBJ) 53 | "$(LIGHT)" $(OBJDIR)*.wixobj -ext WixUtilExtension -ext WixUIExtension -out $(MSI) -reusecab -cc cabs -v 54 | 55 | clean: 56 | @rm -f $(CADLL) 57 | @rm -f *.gch 58 | @rm -f $(OBJDIR)\*.wixobj 59 | @rm -f $(MSIDIR)\*.wixpdb 60 | @rm -f $(MSIDIR)\*.msi 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /algodsvc/algodsvc.mc: -------------------------------------------------------------------------------- 1 | ; // 2 | ; // Algodsvc Message File 3 | ; // (c)2021 Rand Labs. 4 | ; // 5 | ; #ifndef __ALGOSVC_MC_H__ 6 | ; #define __ALGOSVC_MC_H__ 7 | 8 | SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS 9 | Informational=0x1:STATUS_SEVERITY_INFORMATIONAL 10 | Warning=0x2:STATUS_SEVERITY_WARNING 11 | Error=0x3:STATUS_SEVERITY_ERROR 12 | ) 13 | 14 | MessageIdTypedef=DWORD 15 | 16 | MessageId=3000 17 | Severity=Informational 18 | SymbolicName=MSG_ALGODSVC_STARTED 19 | Language=English 20 | Algorand Node Service has started for network %1. Algod executable '%2' using data directory '%3' 21 | . 22 | 23 | MessageId=3001 24 | Severity=Informational 25 | SymbolicName=MSG_ALGODSVC_EXIT 26 | Language=English 27 | Algorand Node Service is stopping for network '%1'. Reason: algod executable exited normally. 28 | . 29 | 30 | MessageId=3002 31 | Severity=Warning 32 | SymbolicName=MSG_ALGODSVC_TERMINATED 33 | Language=English 34 | Algorand Node Service is stopping for network '%1'. Reason: algod executable terminated abnormally with exit code: %2. 35 | . 36 | 37 | MessageId=3003 38 | Severity=Error 39 | SymbolicName=MSG_ALGODSVC_CONFIGERROR 40 | Language=English 41 | Algorand Node Service could not start. Required configuration registry entries not found. 42 | . 43 | 44 | MessageId=3004 45 | Severity=Error 46 | SymbolicName=MSG_ALGODSVC_CREATEPROCESS 47 | Language=English 48 | Algorand Node Service could not start for network '%1'. Reason: The algod executable '%2' failed to start. CreateProcess Win32 error code is %3. 49 | . 50 | 51 | MessageId=3005 52 | Severity=Informational 53 | SymbolicName=MSG_ALGODSVC_STOPPED 54 | Language=English 55 | Algorand Node Service for network '%1' has been stopped. 56 | . 57 | 58 | MessageId=3006 59 | Severity=Error 60 | SymbolicName=MSG_ALGODSVC_ARGCOUNTERROR 61 | Language=English 62 | Algorand Node Service could not start. Invalid number of arguments at ServiceMain entry point. 63 | . 64 | 65 | MessageId=3007 66 | Severity=Error 67 | SymbolicName=MSG_ALGODSVC_INVALIDNETWORK 68 | Language=English 69 | Algorand Node Service could not start. Invalid network parameter (%1) must be testnet, mainnet or betanet. 70 | . 71 | 72 | MessageId=3008 73 | Severity=Error 74 | SymbolicName=MSG_ALGODSVC_INVALIDNODEDATADIR 75 | Language=English 76 | Algorand Node Service could not start. Invalid, non existent or non-accesible node data directory specified (%1). 77 | . 78 | 79 | MessageId=3009 80 | Severity=Informational 81 | SymbolicName=MSG_ALGODSVC_PREFLIGHTCONFIGDATA 82 | Language=English 83 | Algorand Node Service for network '%1'. Pre-flight configuration: algod.exe='%2' Node Data Directory='%3' 84 | . 85 | 86 | 87 | ; #endif 88 | -------------------------------------------------------------------------------- /installer/src/WelcomeDlg_2.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Installed AND PATCH 9 | 10 | 11 | 1 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | NOT Installed OR NOT PATCH OR NOT WIX_UPGRADE_DETECTED 24 | Installed AND PATCH OR WIX_UPGRADE_DETECTED 25 | 26 | 27 | 28 | 29 | WIX_UPGRADE_DETECTED 30 | NOT WIX_UPGRADE_DETECTED 31 | 32 | 33 | 35 | 36 | randlabs.io]]> 37 | 38 | 39 | algorand.foundation]]> 40 | 41 | 42 | algorand.com]]> 43 | 44 | 45 | 46 | 47 | 1 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /installer/src/NodeConfigDlg.wxs: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | Installed AND PATCH 24 | 25 | 26 | 1 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Installed 43 | NOT Installed 44 | 45 | 46 | Installed 47 | NOT Installed 48 | 49 | 50 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /installer/src/UI.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 1 48 | "1"]]> 49 | 50 | 1 51 | 52 | NOT WIX_UPGRADE_DETECTED OR NOT Installed 53 | Installed AND PATCH 54 | 55 | 1 56 | LicenseAccepted = "1" AND NOT WIX_UPGRADE_DETECTED 57 | LicenseAccepted = "1" AND WIX_UPGRADE_DETECTED 58 | 59 | 1 60 | 1 61 | NOT WIXUI_DONTVALIDATEPATH 62 | "1"]]> 63 | NOT WIX_UPGRADE_DETECTED AND (WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1") 64 | WIX_UPGRADE_DETECTED AND (WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1") 65 | 1 66 | 1 67 | 68 | NOT Installed 69 | 1 70 | VALIDPORTNUMBER = "0" 71 | VALIDPORTNUMBER = "0" 72 | VALIDPORTNUMBER = "1" 73 | 74 | NOT WIX_UPGRADE_DETECTED 75 | WIX_UPGRADE_DETECTED 76 | Installed AND NOT WIX_UPGRADE_DETECTED 77 | Installed AND PATCH 78 | 79 | 1 80 | 81 | 1 82 | 1 83 | 1 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Algorand Node for Windows 2 | 3 | This repository contains the supporting software for running an Algorand Node under Windows systems, including a native Windows service, companion tools and proper MSI based installer and uninstaller. 4 | 5 | > :warning: 32-bit Windows is not supported. 6 | 7 | ## How to Install 8 | 9 | To install Algorand Node for Windows, please download and execute the package you prefer from the **Releases** section on this repository. They follow the **stable** branch and version scheme of the official node. 10 | 11 | ## Preliminary Information 12 | 13 | Please read the following usage guidelines and advices. 14 | 15 | * As they may have different binaries, testnet, betanet, mainnet packages are considered products on their own, so: 16 | 17 | * Installations for different networks and/or versions can co exist in the same system. 18 | * Upgrades can be performed *only* between packages of the same network node. e.g: 2.2.0-testnet to 2.3.0-testnet. 19 | 20 | * Once the product is installed, do not modify the network it's operating on by changing the configuration file. Use the proper installer. 21 | 22 | * Automatic downgrades are not supported. If you want to install a previous version, uninstall the current version completely first. 23 | 24 | ### Known bugs :warning: 25 | 26 | * Coexisting installations may show only one set of shortcuts. 27 | 28 | * The Node Watch Status window displays ANSI escape codes instead of interpreting them properly. This does not interfere with its functionality. 29 | 30 | * Using the _Maintenance_ or _Repair_ Dialog from the installation MSI does not work. Please use the **Add/Remove Programs** entry in the **System Settings** panel. 31 | 32 | 33 | ## Installation 34 | 35 | > :lock: Administrative rights are required to complete the installation. 36 | 37 | To launch the installation process just double click the MSI file. Read and accept the license agreement and choose your target installation directory. We recommend to use the default installation place. 38 | 39 | The installer will display a dialog to configure your node with the following options: 40 | 41 | * **Port Number** A port where the node server will listen to. You can select zero for autoconfiguration, or a fixed port number. Take caution to choose a port that does not clash with existing software. Also, you may need to open your firewall for certain range of ports. 42 | 43 | * **Public Access** If you select this option, your server will be accessible from the outside. 44 | 45 | * **Archival Mode** Enabling Archival will synchronize the entire ledger, greatly increasing disk requirements. 46 | 47 | * **Start service at boot** Self-descriptive, check if you want to start Algorand Node service with your machine. Otherwise, it will be set in "demand" mode, requiring manual start through the **Services** management console or the command-line. 48 | 49 | * **Start on installation** Check if you want to start the Algorand node service and start syncing at end of installation. 50 | 51 | Once you are sure, press Continue and wait the installer to finish. 52 | 53 | The installer will create: 54 | 55 | * A new windows Service (algodsvc) for controlling the Algorand Node. The name of the service is `algodsvc_` followed by the network the node is connected to. According to this scheme, your service will be named `algodsvc_testnet`, `algodsvc_betanet` or `algodsvc_mainnet`. 56 | * "Command Line Tools" shortcut to access the binary directory where all the Algorand tools reside. 57 | * A shortcut to the configuration text file. 58 | * A shortcut to watch the node status in realtime. 59 | 60 | At this stage you should be able to click on "Node Status Watch" shortcut in your Start Menu to verify that you are synchronizing. If you unchecked "Start on installation" you will need to start the service manually. 61 | 62 | ## Manual Configuration 63 | 64 | Please click the "Configuration" shortcut in your Start Menu, under the "Algorand Node" group, to start the proper `config.json` file. **To make the changes operative, please restart the Windows service** 65 | 66 | ## Usage 67 | 68 | > :memo: In the following examples, `service_name` is `algodsvc_` followed by the network the node is connected to. According to this scheme, your service will be named `algodsvc_testnet`, `algodsvc_betanet` or `algodsvc_mainnet`. 69 | 70 | 71 | Start the Algorand Service by using the "Services" management console. You can launch the "Run..." panel by pressing Windows + R and executing `services.msc`. Alternatively, you can use the `sc start ` command in a shell with administrative privileges. 72 | 73 | The status of the service can be inspected with the Services management console, or by executing `sc query ` command in a shell with administrative privileges. 74 | 75 | In the same way, stopping the node can be done with the Services management console, or by executing `sc stop ` command in a shell with administrative privileges. 76 | 77 | > :warning: Forcefully terminating the controlled ALGOD.EXE executable, either by user action or by fatal system error, will trigger the stopping of the Windows service. This will get reported to the Windows Event Log as a 3002 event. 78 | 79 | ### Monitoring the node 80 | 81 | The node can be monitored using the "Node Status Watch" shortcut. Access it by going to your Start Menu, "Algorand ..." group, Node Watch shortcut. This is equivalent of running the `goal node status` command. 82 | 83 | ### Using the Windows Event Log 84 | 85 | Open the Event Log by pressing Windows + R and executing `eventvwr`. The service will write entries with origin named `Algorand Windows Service`. Current emitted events are on the following list: 86 | 87 | | Event ID | Cause | 88 | |----------| ----- | 89 | | 3000 | Service started. | 90 | | 3001 | Algod.exe executable finished normally. | 91 | 3002 | Algod.exe executable terminated abnormally. 92 | 3003 | Configuration error. 93 | 3004 | Algod.exe child process could not be spawned. 94 | 3005 | Service stopped. 95 | 3006 | Invalid number of arguments for service start. 96 | 3007 | Invalid network parameter. 97 | 3008 | Invalid, nonexistent or inaccesible node data directory. 98 | 3009 | Pre-flight configuration information. 99 | 100 | ### Data directory setting for Release before 2.8.0 101 | 102 | If you install any release < 2.8.0, all commands requiring data directory specification should be supplied with: 103 | 104 | 1. ``` 105 | %PROGRAMDATA%\Algorand\data\ 106 | ``` 107 | Replace `` with the node you are operating on. For example, on the Command Line Tools you could type: 108 | 109 | ``` 110 | goal account changeonlinestatus -a o=%address% -d %PROGRAMDATA%\Algorand\data\testnet 111 | ``` 112 | 113 | or alternatively, 114 | 2. Set `ALGORAND_DATA` environment variable as follows 115 | 116 | ``` 117 | %PROGRAMDATA%\Algorand\data\ 118 | ``` 119 | 120 | ## Building How-TO 121 | 122 | The following information applies to power users and developer that are interested in doing a manual build of the Algorand Service and installer. 123 | 124 | ### Prerequisites 125 | 126 | To build the algorand node, service and installer you need to install the following software distributions: 127 | 128 | * **MSYS2 x64** from https://www.msys2.org/. MSYS2 is an environment to build and run Linux and UNIX software natively in Windows. 129 | * **WiX Toolset** from https://wixtoolset.org (>= v3.11) to compile and build the MSI installer package. 130 | 131 | The two projects contained herein are: 132 | 133 | * **algodsvc** The native Windows Service. 134 | * **installer** The native MSI-based installer. 135 | 136 | ### Building the go-algorand project 137 | 138 | * The installer requires the generated files off the Algorand node code base, referenced in the `go-algorand` submodule. Keep this submodule up-to-date first with: 139 | 140 | ``` 141 | git submodule init 142 | git submodule update 143 | ``` 144 | 145 | For additional information about working with git submodules see https://git-scm.com/book/en/v2/Git-Tools-Submodules 146 | 147 | The installer mechanism uses the Algorand node versioning scheme for upgrades, so you need to select the release channel you want checking out the proper branch, e.g: 148 | 149 | ``` 150 | cd go-algorand 151 | git checkout rel/stable 152 | ``` 153 | 154 | Replace `rel/stable` with `rel/nightly` or `rel/beta` if you want to make your installer based on 'bleeding-edge' or beta releases. 155 | 156 | * Start your MSYS2-MinGW x64 environment and follow the instructions in steps 1, 2 and 3 at https://developer.algorand.org/tutorials/compile-and-run-the-algorand-node-natively-windows to build the Algorand binaries, but **instead of cloning the go-algorand project, use the `go-algorand` subdirectory in this repository instead**. 157 | 158 | * After the `make` stage finishes, you can do a quick verification checking your node software version: 159 | 160 | ``` 161 | $ $HOME/go/bin/goal.exe --version 162 | 8590162778 163 | 2.3.97114.master [master] (commit #1f59409f) 164 | go-algorand is licensed with AGPLv3.0 165 | source code available at https://github.com/algorand/go-algorand 166 | ``` 167 | 168 | ### Building the Windows Service 169 | 170 | Switch to the `algodsvc` subdirectory and execute 171 | 172 | ``` 173 | make 174 | ``` 175 | 176 | to generate the `algodsvc.exe` binary file. 177 | 178 | ### Building the Windows MSI Installer 179 | 180 | * Switch to the `installer\src` subdirectory. 181 | * Execute `make` with the `NETWORK` parameter specifying which kind of node you want to build (`testnet`, `mainnet` or `betanet` ), e.g to create a testnet node installer you must issue: 182 | 183 | ``` 184 | make NETWORK=testnet 185 | ``` 186 | 187 | The build process should take a while. It will generate a MSI installer named `AlgoRand-testnet.msi` or similar depending on your chosen Algorand network. 188 | 189 | 190 | 191 | ## License 192 | 193 | [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](LICENSE) 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /algodsvc/algodsvc.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Algorand Node for Windows -- Service implementation 3 | // Copyright (C) 2021 Rand Labs 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | // 18 | 19 | #include "algodsvc.h" 20 | #include "dprintf.h" 21 | #include 22 | #include 23 | 24 | // 25 | // Globals 26 | // 27 | const int DEFAULT_WAIT_HINT_MS = 5000; 28 | WCHAR g_serviceName[] = L"AlgodSvc_XXXXXXX"; 29 | WCHAR g_serviceDesc[] = L"Algorand Node Windows Service"; 30 | WCHAR g_szNetwork[7] = {0}; 31 | WCHAR g_szNodeDataDir[MAX_PATH] = {0}; 32 | WCHAR g_szAlgodExePath[MAX_PATH] = {0}; 33 | int g_svcCheckpoint = 0; 34 | SERVICE_STATUS_HANDLE g_hSvc = NULL; 35 | HANDLE g_hWaitAlgod = NULL; 36 | PROCESS_INFORMATION g_algodProcInfo; 37 | bool g_stopAllowed = false; 38 | 39 | // 40 | // Forward declarations 41 | // 42 | void WINAPI ServiceMain (DWORD dwNumServicesArgs, LPWSTR *lpServiceArgVectors); 43 | void StopService(); 44 | DWORD HandlerProc(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext); 45 | BOOL ServiceUpdateStatus(DWORD currentState, DWORD win32ExitCode, 46 | DWORD serviceSpecificExitCode, DWORD checkPoint, DWORD waitHint); 47 | BOOL LoadConfiguration(WCHAR* szAlgodExeFileName, DWORD* pcbAlgodExeFileName, WCHAR* szNodeDataDir, 48 | DWORD* pcbNodeDataDir); 49 | VOID CALLBACK AlgodWaitOrTimerCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired); 50 | void Log(DWORD id, std::vector insertionStrings); 51 | 52 | // -------------------------------------------------------------------------------------------------- 53 | // 54 | // Program Entry point. 55 | // 56 | // -------------------------------------------------------------------------------------------------- 57 | int wmain(int argc, wchar_t** argv) 58 | { 59 | int status = 0; 60 | 61 | if (argc != 4) 62 | { 63 | Log(MSG_ALGODSVC_ARGCOUNTERROR, {}); 64 | return 1; 65 | } 66 | 67 | wcsncpy(g_szNetwork, argv[1], 7); 68 | wcsncpy(g_szAlgodExePath, argv[2], MAX_PATH); 69 | wcsncpy(g_szNodeDataDir, argv[3], MAX_PATH); 70 | 71 | if (wcscmp(g_szNetwork, L"betanet") != 0 && 72 | wcscmp(g_szNetwork, L"testnet") != 0 && 73 | wcscmp(g_szNetwork, L"mainnet") != 0 ) 74 | { 75 | Log(MSG_ALGODSVC_INVALIDNETWORK,{ g_szNetwork }); 76 | return ERROR_INVALID_PARAMETER; 77 | } 78 | 79 | wcsncpy(g_serviceName + 9, g_szNetwork ,7); 80 | dprintfW(L"algodsvc: This service Name %s, parameters: %s %s %s", g_serviceName, g_szNetwork, g_szAlgodExePath, g_szNodeDataDir); 81 | 82 | // Slash trailing slash that WiX may add, but not for root directory specs like "C:\" 83 | 84 | if (g_szNodeDataDir[wcslen(g_szNodeDataDir) - 1] == L'\\' && wcslen(g_szNodeDataDir) > 3) 85 | g_szNodeDataDir[wcslen(g_szNodeDataDir) - 1] = (wchar_t)0; 86 | 87 | if (GetFileAttributes(g_szNodeDataDir) == INVALID_FILE_ATTRIBUTES) 88 | { 89 | Log(MSG_ALGODSVC_INVALIDNODEDATADIR, { g_szNodeDataDir }); 90 | return ERROR_PATH_NOT_FOUND; 91 | } 92 | 93 | Log(MSG_ALGODSVC_PREFLIGHTCONFIGDATA, { g_szNetwork, g_szAlgodExePath, g_szNodeDataDir }); 94 | 95 | SERVICE_TABLE_ENTRY serviceTable[] = 96 | { 97 | {g_serviceName, (LPSERVICE_MAIN_FUNCTION)ServiceMain}, 98 | {NULL, NULL} 99 | }; 100 | 101 | if (!StartServiceCtrlDispatcher(serviceTable)) 102 | { 103 | status = static_cast(GetLastError()); 104 | dprintfW(L"algodsvc: StartServiceCtrlDispatcher failed with error %d", GetLastError()); 105 | } 106 | 107 | return status; 108 | } 109 | 110 | // 111 | // The main routine for this service 112 | // 113 | // Arguments are as follows: 114 | // lpServiceArgVectors[0] Service Name 115 | // lpServiceArgVectors[1] Network type (testnet,mainnet or betanet) 116 | // lpServiceArgVectors[2] Quoted full path to ALGOD.EXE 117 | // lpServiceArgVectors[3] Quoted full path to Node Data Directory 118 | // 119 | void WINAPI ServiceMain (DWORD dwNumServicesArgs, LPWSTR *lpServiceArgVectors) 120 | { 121 | dprintfW(L"%d",dwNumServicesArgs); 122 | g_hSvc = RegisterServiceCtrlHandlerEx(g_serviceName, HandlerProc, NULL); 123 | if (!g_hSvc) 124 | { 125 | dprintfW(L"algodsvc: RegisterServiceCtrlHandlerEx failed with error %d", GetLastError()); 126 | return; 127 | } 128 | 129 | if (ServiceUpdateStatus(SERVICE_START_PENDING, 0, 0, g_svcCheckpoint++, DEFAULT_WAIT_HINT_MS)) 130 | { 131 | // Start the algod node executable. 132 | 133 | WCHAR szCmdLine[1024]{'\0'}; 134 | wcsncpy(szCmdLine, g_szAlgodExePath, wcslen(g_szAlgodExePath)); 135 | wcsncat(szCmdLine, L" -d ", 4); 136 | wcsncat(szCmdLine, g_szNodeDataDir, wcslen(g_szNodeDataDir)); 137 | 138 | STARTUPINFO si; 139 | ZeroMemory(&si, sizeof(STARTUPINFO)); 140 | ZeroMemory(&g_algodProcInfo, sizeof(PROCESS_INFORMATION)); 141 | 142 | dprintfW(L"algodsvc: invoking: %s %s", g_szAlgodExePath, szCmdLine); 143 | if (!CreateProcessW(NULL, szCmdLine, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &g_algodProcInfo)) 144 | { 145 | dprintfW(L"algodsvc: CreateProcess failed. Win32 Err: %d", GetLastError()); 146 | 147 | wchar_t lasterr[255]; 148 | StringCchPrintfW(lasterr, 255, L"%d", GetLastError()); 149 | Log(MSG_ALGODSVC_CREATEPROCESS, { g_szNetwork, g_szAlgodExePath, lasterr }); 150 | 151 | ServiceUpdateStatus(SERVICE_STOPPED, GetLastError(), 0, g_svcCheckpoint++, DEFAULT_WAIT_HINT_MS); 152 | return; 153 | } 154 | 155 | if (!RegisterWaitForSingleObject(&g_hWaitAlgod, g_algodProcInfo.hProcess, AlgodWaitOrTimerCallback, NULL, INFINITE, WT_EXECUTEONLYONCE)) 156 | { 157 | dprintfW(L"algodsvc: RegisterWaitForSingleObject failed. Win32 Err: %d", GetLastError()); 158 | ServiceUpdateStatus(SERVICE_STOPPED, GetLastError(), 0, g_svcCheckpoint++, DEFAULT_WAIT_HINT_MS); 159 | return; 160 | } 161 | 162 | // We are finally booted up. 163 | 164 | g_stopAllowed = true; 165 | ServiceUpdateStatus(SERVICE_RUNNING, NO_ERROR, 0, g_svcCheckpoint++, DEFAULT_WAIT_HINT_MS); 166 | Log(MSG_ALGODSVC_STARTED, { g_szNetwork, g_szAlgodExePath, g_szNodeDataDir }); 167 | } 168 | } 169 | 170 | // 171 | // Handles the algod process termination and stop the service. 172 | // 173 | VOID CALLBACK AlgodWaitOrTimerCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired) 174 | { 175 | DWORD dwExit; 176 | GetExitCodeProcess(g_algodProcInfo.hProcess, &dwExit); 177 | dprintfW(L"algodsvc: Process terminated. Exit Code = %d", dwExit); 178 | 179 | ServiceUpdateStatus(SERVICE_STOP_PENDING, dwExit == 0 ? NO_ERROR : ERROR_PROCESS_ABORTED, 0, 1, DEFAULT_WAIT_HINT_MS); 180 | if (dwExit == 0) 181 | { 182 | Log(MSG_ALGODSVC_EXIT, { g_szNetwork }); 183 | } 184 | else 185 | { 186 | wchar_t exit[255]; 187 | StringCchPrintfW(exit, 255, L"%d", dwExit); 188 | Log(MSG_ALGODSVC_TERMINATED, { g_szNetwork, exit}); 189 | } 190 | 191 | BOOL ret = UnregisterWait(g_hWaitAlgod); 192 | if (!ret && GetLastError() != ERROR_IO_PENDING) 193 | { 194 | dprintfW(L"algodsvc: UnregisterWait returned error %d", GetLastError()); 195 | return; 196 | } 197 | 198 | CloseHandle(g_algodProcInfo.hProcess); 199 | CloseHandle(g_algodProcInfo.hThread); 200 | 201 | ServiceUpdateStatus(SERVICE_STOPPED, dwExit == 0 ? NO_ERROR : ERROR_PROCESS_ABORTED, 0, 2, DEFAULT_WAIT_HINT_MS); 202 | } 203 | 204 | // 205 | // Loads the configuration keys for this service from Windows registry. 206 | // 207 | BOOL LoadConfiguration(WCHAR* szAlgodExeFileName, DWORD* pcbAlgodExeFileName, 208 | WCHAR* szNodeDataDir, DWORD* pcbNodeDataDir) 209 | { 210 | WCHAR szSubkey[255]; 211 | wcsncpy(szSubkey, L"SYSTEM\\CurrentControlSet\\Services\\", 34); 212 | wcsncat(szSubkey, g_serviceName, wcslen(g_serviceName)); 213 | wcsncat(szSubkey, L"\\Parameters", 11); 214 | 215 | HKEY hKey; 216 | DWORD dwType = REG_SZ; 217 | 218 | if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szSubkey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) 219 | { 220 | dprintfW(L"algodsvc: Configuration error, service algodsvc key not found."); 221 | return FALSE; 222 | } 223 | 224 | LRESULT l0 = RegQueryValueEx(hKey, L"AlgodExeFileName", 0, &dwType, (BYTE *)szAlgodExeFileName, pcbAlgodExeFileName); 225 | LRESULT l1 = RegQueryValueEx(hKey, L"NodeDataDirectory", 0, &dwType, (BYTE *)szNodeDataDir, pcbNodeDataDir); 226 | RegCloseKey(hKey); 227 | 228 | if (l0 != ERROR_SUCCESS || l1 != ERROR_SUCCESS || *pcbAlgodExeFileName <= 2 || *pcbNodeDataDir <= 2) 229 | { 230 | dprintfW(L"algodsvc: Configuration error, check missing keys"); 231 | return FALSE; 232 | } 233 | 234 | return TRUE; 235 | } 236 | 237 | // 238 | // SCM Service status callback handling routine. 239 | // 240 | DWORD HandlerProc(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext) 241 | { 242 | DWORD status = NO_ERROR; 243 | switch(dwControl) 244 | { 245 | case SERVICE_CONTROL_SHUTDOWN: 246 | case SERVICE_CONTROL_STOP: 247 | StopService(); 248 | break; 249 | break; 250 | case SERVICE_CONTROL_INTERROGATE: 251 | break; 252 | default: 253 | status = ERROR_CALL_NOT_IMPLEMENTED; 254 | } 255 | return status; 256 | } 257 | 258 | // 259 | // Do the chores to stop the service, which involves requesting 260 | // our algod child process to exit accordingly. 261 | // 262 | void StopService() 263 | { 264 | g_svcCheckpoint = 0; 265 | if(ServiceUpdateStatus(SERVICE_STOP_PENDING, NO_ERROR, 0, g_svcCheckpoint++, DEFAULT_WAIT_HINT_MS)) 266 | { 267 | // This hack attaches temporarily our process to the algod.exe spawned console, 268 | // so we are in a console process group, and send a Ctrl+C signal to trigger a proper exit. 269 | // Just to be safe, we disable ctrl-c events for our own service. 270 | 271 | // Keep in mind that we dont stop the service here but wait for the process 272 | // termination callback AlgodWaitOrTimerCallback to do it when algod exits. 273 | // If for any reason that does not get called, the service will terminate after timeout. 274 | 275 | dprintfW(L"Algodsvc: SERVICE_STOP_PENDING set. Sending CTRL_C_EVENT to algod PID %d", g_algodProcInfo.dwProcessId); 276 | 277 | FreeConsole(); 278 | if (AttachConsole(g_algodProcInfo.dwProcessId)) 279 | { 280 | SetConsoleCtrlHandler(NULL, true); 281 | if (!GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0)) 282 | { 283 | dprintfW(L"Algodsvc: GenerateConsoleCtrlEvent failed with err: %d", GetLastError()); 284 | } 285 | FreeConsole(); 286 | } 287 | else 288 | { 289 | dprintfW(L"Algodsvc: AttachConsole failed with err: %d", GetLastError()); 290 | } 291 | } 292 | } 293 | 294 | // 295 | // Report the SCM a status change. 296 | // 297 | BOOL ServiceUpdateStatus(DWORD currentState, DWORD win32ExitCode, 298 | DWORD serviceSpecificExitCode, DWORD checkPoint, DWORD waitHint) 299 | { 300 | SERVICE_STATUS ss; 301 | ss.dwServiceType = SERVICE_WIN32_OWN_PROCESS; 302 | ss.dwCurrentState = currentState; 303 | ss.dwServiceSpecificExitCode = serviceSpecificExitCode; 304 | ss.dwCheckPoint = checkPoint; 305 | ss.dwWaitHint = waitHint; 306 | ss.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN | (g_stopAllowed ? SERVICE_ACCEPT_STOP : 0); 307 | ss.dwWin32ExitCode = 308 | serviceSpecificExitCode == 0 309 | ? win32ExitCode 310 | : ERROR_SERVICE_SPECIFIC_ERROR; 311 | 312 | if (currentState == SERVICE_STOPPED) 313 | { 314 | Log(MSG_ALGODSVC_STOPPED,{ g_szNetwork }); 315 | } 316 | 317 | BOOL ret = SetServiceStatus(g_hSvc, &ss); 318 | if(!ret) 319 | dprintfW(L"algodsvc: SetServiceStatus to 0x%08x returned error %d", currentState, GetLastError() ); 320 | 321 | return ret; 322 | } 323 | 324 | // 325 | // Converts message-file severity codes to Eventlog Entry types. 326 | // 327 | WORD SeverityToEventType(DWORD id) 328 | { 329 | return ((id >> 30) == STATUS_SEVERITY_ERROR) ? EVENTLOG_ERROR_TYPE : 330 | (((id >> 30) == STATUS_SEVERITY_INFORMATIONAL) ? EVENTLOG_INFORMATION_TYPE : 331 | EVENTLOG_WARNING_TYPE); 332 | } 333 | 334 | // 335 | // Write an entry to the Windows Log. 336 | // 337 | void Log(DWORD id, std::vector insertionStrings) 338 | { 339 | wchar_t szEventSrc[512] = {0}; 340 | StringCchPrintf(szEventSrc, 512, L"Algorand Node Service (%s)", g_szNetwork); 341 | HANDLE hEventSrc = RegisterEventSource(NULL, szEventSrc); 342 | if (!hEventSrc) 343 | { 344 | dprintfW(L"algodsvc: Cannot register event source. Error is %d", GetLastError()); 345 | return; 346 | } 347 | 348 | // NOTE: &rgMsg[0] is possible due to C++ spec where std::vector is contiguous in memory. 349 | 350 | ReportEventW(hEventSrc, SeverityToEventType(id), 0, id, NULL, insertionStrings.size(), 0, &insertionStrings[0], NULL); 351 | DeregisterEventSource(hEventSrc); 352 | } 353 | 354 | -------------------------------------------------------------------------------- /installer/src/CustomActions.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Algorand Node for Windows -- Custom Actions DLL for Wix Installer 3 | // Copyright (C) 2021 Rand Labs 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | // 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "dprintf.h" 30 | 31 | #include "inc/json.hpp" 32 | 33 | using json = nlohmann::json; 34 | 35 | #define EXPORT __declspec(dllexport) __stdcall 36 | #define MAX_ACTION_DATA 2048 37 | 38 | static VOID WriteLog(MSIHANDLE hInstall, LPCWSTR szFormatW, ...) 39 | { 40 | WCHAR szBufW[2048]; 41 | MSIHANDLE hRecord; 42 | va_list argptr; 43 | 44 | va_start(argptr, szFormatW); 45 | _vsnwprintf_s(szBufW, _countof(szBufW), _TRUNCATE, szFormatW, argptr); 46 | va_end(argptr); 47 | hRecord = ::MsiCreateRecord(1); 48 | if (hRecord != 0) 49 | { 50 | ::MsiRecordSetStringW(hRecord, 1, szBufW); 51 | ::MsiRecordSetStringW(hRecord, 0, L"[1]"); 52 | ::MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hRecord); 53 | ::MsiCloseHandle(hRecord); 54 | } 55 | return; 56 | } 57 | 58 | static UINT __stdcall ScheduleDeferredCA (MSIHANDLE hInstall, LPCWSTR szActionName, LPWSTR szActionData) 59 | { 60 | if (!szActionName || !szActionData) 61 | return ERROR_INVALID_PARAMETER; 62 | 63 | if (szActionName[0] == L'\0') 64 | return ERROR_INVALID_PARAMETER; 65 | 66 | UINT r = MsiSetPropertyW(hInstall, szActionName, szActionData); 67 | if (r != ERROR_SUCCESS) 68 | return r; 69 | 70 | return MsiDoActionW(hInstall, szActionName); 71 | } 72 | 73 | static DWORD CalcSvcControlWaitTime(LPSERVICE_STATUS ssStatus) 74 | { 75 | // Do not wait longer than the wait hint. A good interval is 76 | // one-tenth of the wait hint but not less than 1 second 77 | // and not more than 10 seconds. 78 | 79 | DWORD dwWaitTime = ssStatus->dwWaitHint / 10; 80 | 81 | if(dwWaitTime < 1000) 82 | dwWaitTime = 1000; 83 | else if (dwWaitTime > 10000) 84 | dwWaitTime = 10000; 85 | 86 | return dwWaitTime; 87 | } 88 | 89 | extern "C" UINT EXPORT ValidatePortNumber (MSIHANDLE hInstall) 90 | { 91 | wchar_t szPortNum[8]; 92 | DWORD cchPortNum = 8; 93 | MsiGetPropertyW(hInstall, L"PORTNUMBER", szPortNum, &cchPortNum); 94 | 95 | try 96 | { 97 | auto sPort = std::wstring(szPortNum); 98 | bool valid = std::all_of(sPort.begin(), sPort.end(), [](wchar_t c) { return (c >= L'0' && c <= L'9') || c == L' '; }); 99 | int x = std::stoi(sPort); 100 | if (x < 0 || x > 65535 || !valid) 101 | { 102 | throw( std::out_of_range("invalid port number")); 103 | } 104 | MsiSetPropertyW(hInstall, L"VALIDPORTNUMBER", L"1"); 105 | } 106 | catch (std::exception& e) 107 | { 108 | MsiSetPropertyW(hInstall, L"VALIDPORTNUMBER", L"0"); 109 | } 110 | 111 | return ERROR_SUCCESS; 112 | } 113 | 114 | extern "C" UINT EXPORT SetMsgDlgProp_InvalidPort (MSIHANDLE hInstall) 115 | { 116 | MsiSetPropertyW(hInstall, L"MESSAGEDLGTITLE", L"Information"); 117 | MsiSetPropertyW(hInstall, L"MESSAGEDLGHEADER", L"Invalid port"); 118 | MsiSetPropertyW(hInstall, L"MESSAGEDLGTEXT", L"Please enter a valid port number in the range from 0 to 65535."); 119 | MsiSetPropertyW(hInstall, L"MESSAGEDLGICONID", L"StatusAlert"); 120 | return ERROR_SUCCESS; 121 | } 122 | 123 | extern "C" UINT EXPORT SchedApplyConfigToFile(MSIHANDLE hInstall) 124 | { 125 | wchar_t szConfigFile[MAX_PATH]; 126 | wchar_t szEnableArchival[10]; 127 | wchar_t szPortNum[8]; 128 | wchar_t szNetwork[8]; 129 | wchar_t szPublicAccess[8]; 130 | DWORD cchConfigFile = sizeof(szConfigFile) / sizeof(wchar_t); 131 | DWORD cchEnableArchival = sizeof(szEnableArchival) / sizeof(wchar_t); 132 | DWORD cchPortNum = sizeof(szPortNum) / sizeof(wchar_t); 133 | DWORD cchNetwork = sizeof(szNetwork) / sizeof(wchar_t); 134 | DWORD cchPublicAccess = sizeof(szPublicAccess) / sizeof (wchar_t); 135 | 136 | MsiGetPropertyW(hInstall, L"NodeDataDirAlgorandDataNetSpecific", szConfigFile, &cchConfigFile); 137 | MsiGetPropertyW(hInstall, L"ENABLEARCHIVALMODE", szEnableArchival, &cchEnableArchival); 138 | MsiGetPropertyW(hInstall, L"PORTNUMBER", szPortNum, &cchPortNum); 139 | MsiGetPropertyW(hInstall, L"THISNETWORK", szNetwork, &cchNetwork); 140 | MsiGetPropertyW(hInstall, L"PUBLICACCESS", szPublicAccess, &cchPublicAccess); 141 | 142 | if (wcscmp(szPublicAccess, L"") == 0) 143 | wcscpy_s(szPublicAccess, L"0"); 144 | 145 | if (wcscmp(szEnableArchival, L"") == 0) 146 | wcscpy_s(szEnableArchival, L"0"); 147 | 148 | wchar_t szActionData[MAX_ACTION_DATA] = { 0 }; 149 | wcscpy_s(szActionData, L"\""); 150 | wcscat_s(szActionData, szConfigFile); 151 | wcscat_s(szActionData, L"\" "); 152 | wcscat_s(szActionData, szEnableArchival); 153 | wcscat_s(szActionData, L" "); 154 | wcscat_s(szActionData, szPortNum); 155 | wcscat_s(szActionData, L" "); 156 | wcscat_s(szActionData, szNetwork); 157 | wcscat_s(szActionData, L" "); 158 | wcscat_s(szActionData, szPublicAccess); 159 | 160 | return ScheduleDeferredCA(hInstall, L"ApplyConfigToFile", szActionData); 161 | } 162 | 163 | extern "C" UINT EXPORT RequestUninstallDataDir(MSIHANDLE hInstall) 164 | { 165 | int ret = 0; 166 | wchar_t szCaData[MAX_ACTION_DATA] = { 0 }; 167 | DWORD cchCaData = MAX_ACTION_DATA; 168 | MsiGetPropertyW(hInstall, L"CustomActionData", szCaData, &cchCaData); 169 | 170 | szCaData[wcslen(szCaData)+1] = wchar_t(0); // Ensure double zero at end for ShFileOperationW 171 | 172 | WriteLog(hInstall, L"algorand-install-CA: Initiating SHFileOperationW to remove %s", szCaData); 173 | 174 | SHFILEOPSTRUCTW fop; 175 | ZeroMemory(&fop, sizeof(SHFILEOPSTRUCTW)); 176 | fop.wFunc = FO_DELETE; 177 | fop.pFrom = szCaData; 178 | fop.fFlags = FOF_NO_UI; 179 | if ( (ret = SHFileOperationW(&fop)) ) 180 | { 181 | WriteLog(hInstall, L"algorand-install-CA: SHFileOperationW FAILED with code %d", ret); 182 | return ERROR_IO_DEVICE; 183 | } 184 | else 185 | { 186 | WriteLog(hInstall, L"algorand-install-CA: SHFileOperationW success.", ret); 187 | } 188 | 189 | return ERROR_SUCCESS; 190 | } 191 | 192 | extern "C" UINT EXPORT SchedRequestUninstallDataDir (MSIHANDLE hInstall) 193 | { 194 | MSIHANDLE hRec = MsiCreateRecord(0); 195 | MsiRecordSetStringW(hRec, 0, L"Do you want to keep your data directory?" 196 | "\nThis includes configuration files and Algorand chain synchronization data.\n\n" 197 | "If you delete your chain data, you will need to wait for resync of your node from scratch."); 198 | int ret = MsiProcessMessage(hInstall, (INSTALLMESSAGE) (INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON1), hRec); 199 | MsiCloseHandle(hRec); 200 | 201 | if (ret == IDCANCEL) 202 | { 203 | return ERROR_INSTALL_USEREXIT; 204 | } 205 | else if (ret == IDNO) 206 | { 207 | wchar_t szDir[MAX_PATH + 1] = { 0 }; // we need double-zeroed end for SHFileOperationW 208 | DWORD cchDir = MAX_PATH; 209 | 210 | MsiGetPropertyW(hInstall, L"ALGORANDNETDATAFOLDER", szDir, &cchDir); 211 | return ScheduleDeferredCA(hInstall, L"RequestUninstallDataDir", szDir); 212 | } 213 | return ERROR_SUCCESS; 214 | } 215 | 216 | extern "C" DWORD EXPORT StartServiceRoutine (MSIHANDLE hInstall) 217 | { 218 | wchar_t szCaData[MAX_ACTION_DATA] = { 0 }; 219 | DWORD cchCaData = MAX_ACTION_DATA; 220 | MsiGetPropertyW(hInstall, L"CustomActionData", szCaData, &cchCaData); 221 | 222 | auto hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 223 | if (!hSCM) 224 | return GetLastError(); 225 | 226 | 227 | wchar_t szSvcName[32] = {0}; 228 | wcsncpy(szSvcName, L"algodsvc_", 9); 229 | wcsncat(szSvcName, szCaData, wcslen(szCaData)); 230 | 231 | auto hService = OpenService(hSCM, szSvcName, SERVICE_ALL_ACCESS); 232 | if(!hService) 233 | { 234 | CloseServiceHandle(hSCM); 235 | return GetLastError(); 236 | } 237 | 238 | SERVICE_STATUS_PROCESS ssStatus; 239 | DWORD dwBytesNeeded = 0; 240 | if(!QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded)) 241 | { 242 | WriteLog(hInstall, L"algorand-install-CA: QueryServiceStatusEx failed (%d)\n", GetLastError()); 243 | CloseServiceHandle(hService); 244 | CloseServiceHandle(hSCM); 245 | return GetLastError(); 246 | } 247 | 248 | // 249 | // We expect this to be stopped at this point. 250 | // 251 | if (ssStatus.dwCurrentState != SERVICE_STOPPED) 252 | { 253 | WriteLog(hInstall, L"algorand-install-CA: Unexpected svc status (%d)\n", ssStatus.dwCurrentState); 254 | CloseServiceHandle(hService); 255 | CloseServiceHandle(hSCM); 256 | return ERROR_SERVICE_ALREADY_RUNNING; 257 | } 258 | 259 | // Do not wait longer than the wait hint. A good interval is 260 | // one-tenth of the wait hint but not less than 1 second 261 | // and not more than 10 seconds. 262 | 263 | DWORD dwWaitTime = CalcSvcControlWaitTime((LPSERVICE_STATUS)&ssStatus); 264 | 265 | if (StartService(hService, 0, NULL)) 266 | { 267 | QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded); 268 | 269 | while (ssStatus.dwCurrentState == SERVICE_START_PENDING) 270 | { 271 | Sleep(dwWaitTime); 272 | QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded); 273 | } 274 | 275 | if (ssStatus.dwCurrentState == SERVICE_RUNNING) 276 | { 277 | WriteLog(hInstall, L"algorand-install-CA: StartService success."); 278 | } 279 | else 280 | { 281 | WriteLog(hInstall, L"algorand-install-CA: Service did not pass to RUNNING state"); 282 | } 283 | } 284 | else 285 | { 286 | WriteLog(hInstall, L"algorand-install-CA: StartService failed (%d)\n", ssStatus.dwCurrentState); 287 | } 288 | 289 | CloseServiceHandle(hService); 290 | CloseServiceHandle(hSCM); 291 | return ERROR_SUCCESS; 292 | } 293 | 294 | extern "C" UINT EXPORT StopService (MSIHANDLE hInstall) 295 | { 296 | wchar_t szCaData[MAX_ACTION_DATA] = { 0 }; 297 | DWORD cchCaData = MAX_ACTION_DATA; 298 | MsiGetPropertyW(hInstall, L"CustomActionData", szCaData, &cchCaData); 299 | 300 | auto hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 301 | if (!hSCM) 302 | return GetLastError(); 303 | 304 | wchar_t szSvcName[32] = {0}; 305 | wcsncpy(szSvcName, L"algodsvc_", 9); 306 | wcsncat(szSvcName, szCaData, wcslen(szCaData)); 307 | 308 | auto hService = OpenService(hSCM, szSvcName, SERVICE_ALL_ACCESS); 309 | if(!hService) 310 | { 311 | CloseServiceHandle(hSCM); 312 | return GetLastError(); 313 | } 314 | 315 | SERVICE_STATUS_PROCESS ssStatus; 316 | DWORD dwBytesNeeded = 0; 317 | if(!QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded)) 318 | { 319 | WriteLog(hInstall, L"algorand-install-CA: QueryServiceStatusEx failed (%d)\n", GetLastError()); 320 | CloseServiceHandle(hService); 321 | CloseServiceHandle(hSCM); 322 | return GetLastError(); 323 | } 324 | 325 | if(!ControlService(hService, SERVICE_CONTROL_STOP, (LPSERVICE_STATUS)&ssStatus)) 326 | { 327 | WriteLog(hInstall, L"algorand-install-CA: ControlService to stop failed (%d)\n", GetLastError()); 328 | CloseServiceHandle(hService); 329 | CloseServiceHandle(hSCM); 330 | return GetLastError(); 331 | } 332 | 333 | DWORD dwWaitTime = CalcSvcControlWaitTime((LPSERVICE_STATUS)&ssStatus); 334 | 335 | while (ssStatus.dwCurrentState != SERVICE_STOPPED) 336 | { 337 | Sleep( dwWaitTime ); 338 | QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded); 339 | } 340 | 341 | CloseServiceHandle(hService); 342 | CloseServiceHandle(hSCM); 343 | return ERROR_SUCCESS; 344 | } 345 | 346 | extern "C" UINT EXPORT SetServiceStartMode (MSIHANDLE hInstall) 347 | { 348 | wchar_t szCaData[MAX_ACTION_DATA] = { 0 }; 349 | DWORD cchCaData = MAX_ACTION_DATA; 350 | int numArgs; 351 | MsiGetPropertyW(hInstall, L"CustomActionData", szCaData, &cchCaData); 352 | 353 | LPWSTR* argv = CommandLineToArgvW(szCaData, &numArgs ); 354 | 355 | if (numArgs != 2) 356 | { 357 | WriteLog(hInstall, L"algorand-install-CA: invalid num of arguments %d (expected 2)", numArgs); 358 | return ERROR_BAD_ARGUMENTS; 359 | } 360 | 361 | LPWSTR szNetwork = argv[0]; 362 | LPWSTR szStartType = argv[1]; 363 | 364 | auto hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 365 | if (!hSCM) 366 | return GetLastError(); 367 | 368 | wchar_t szSvcName[32] = {0}; 369 | wcsncpy(szSvcName, L"algodsvc_", 9); 370 | wcsncat(szSvcName, szCaData, wcslen(szNetwork)); 371 | 372 | auto hService = OpenService(hSCM, szSvcName, SERVICE_ALL_ACCESS); 373 | if(!hService) 374 | { 375 | CloseServiceHandle(hSCM); 376 | return GetLastError(); 377 | } 378 | 379 | if (!ChangeServiceConfigW(hService, 380 | SERVICE_NO_CHANGE, 381 | _wtoi(szStartType), 382 | SERVICE_NO_CHANGE, 383 | NULL, 384 | NULL, 385 | NULL, 386 | NULL, 387 | NULL, 388 | NULL, 389 | NULL)) 390 | { 391 | WriteLog(hInstall, L"algorand-install-CA: cannot change service boot mode, status: %d", GetLastError()); 392 | } 393 | 394 | CloseServiceHandle(hService); 395 | CloseServiceHandle(hSCM); 396 | return ERROR_SUCCESS; 397 | 398 | } 399 | 400 | extern "C" UINT EXPORT SchedSetServiceStartMode(MSIHANDLE hInstall) 401 | { 402 | wchar_t szIsChecked[4]; 403 | DWORD cchIsChecked = 4; 404 | MsiGetPropertyW(hInstall, L"STARTSVC_AT_BOOT", szIsChecked, &cchIsChecked); 405 | 406 | DWORD startMode = (wcsncmp(szIsChecked, L"1", 4) == 0 ? SERVICE_AUTO_START : SERVICE_DEMAND_START); 407 | 408 | wchar_t szActionData[MAX_ACTION_DATA]; 409 | wchar_t szNetwork[8]; 410 | DWORD cchNetwork = 8; 411 | MsiGetPropertyW(hInstall, L"THISNETWORK", szNetwork, &cchNetwork); 412 | 413 | if ((wcsncmp(szNetwork, L"testnet", 8) != 0) && (wcsncmp(szNetwork, L"betanet", 8) != 0) && (wcsncmp(szNetwork, L"mainnet", 8) != 0)) 414 | { 415 | WriteLog(hInstall, L"algorand-install-CA: StartServiceRoutine: bad network name: %s", szNetwork); 416 | return ERROR_INVALID_NETNAME; 417 | } 418 | 419 | StringCchPrintfW(szActionData, MAX_ACTION_DATA, L"%s %d", szNetwork, startMode); 420 | return ScheduleDeferredCA(hInstall, L"SetServiceStartMode", szActionData); 421 | } 422 | 423 | extern "C" UINT EXPORT SchedStartService (MSIHANDLE hInstall) 424 | { 425 | wchar_t szIsChecked[4]; 426 | DWORD cchIsChecked = 4; 427 | MsiGetPropertyW(hInstall, L"STARTSVC_AT_INSTALL", szIsChecked, &cchIsChecked); 428 | 429 | if (!wcsncmp(szIsChecked, L"1", 4)) 430 | { 431 | wchar_t szNetwork[8]; 432 | DWORD cchNetwork = 8; 433 | MsiGetPropertyW(hInstall, L"THISNETWORK", szNetwork, &cchNetwork); 434 | 435 | if ( (wcsncmp(szNetwork, L"testnet" ,8) != 0) 436 | && (wcsncmp(szNetwork, L"betanet" ,8) != 0) 437 | && (wcsncmp(szNetwork, L"mainnet" ,8) != 0)) 438 | { 439 | WriteLog(hInstall, L"algorand-install-CA: StartServiceRoutine: bad network name: %s", szNetwork); 440 | return ERROR_INVALID_NETNAME; 441 | } 442 | 443 | return ScheduleDeferredCA(hInstall, L"StartServiceRoutine", szNetwork); 444 | } 445 | 446 | return ERROR_SUCCESS; 447 | } 448 | 449 | extern "C" UINT EXPORT SchedStopService(MSIHANDLE hInstall) 450 | { 451 | wchar_t szNetwork[8]; 452 | DWORD cchNetwork = 8; 453 | MsiGetPropertyW(hInstall, L"THISNETWORK", szNetwork, &cchNetwork); 454 | 455 | if ((wcsncmp(szNetwork, L"testnet", 8) != 0) && (wcsncmp(szNetwork, L"betanet", 8) != 0) && (wcsncmp(szNetwork, L"mainnet", 8) != 0)) 456 | { 457 | WriteLog(hInstall, L"algorand-install-CA: SchedStopService: bad network name: %s", szNetwork); 458 | return ERROR_INVALID_NETNAME; 459 | } 460 | 461 | return ScheduleDeferredCA(hInstall, L"StopService", szNetwork); 462 | } 463 | 464 | extern "C" UINT EXPORT RemoveTrailingSlash (MSIHANDLE hInstall) 465 | { 466 | wchar_t szNodeDataDir[MAX_PATH]; 467 | DWORD cchNodeDataDir = MAX_PATH; 468 | 469 | MsiGetPropertyW(hInstall, L"NodeDataDirAlgorandDataNetSpecific", szNodeDataDir, &cchNodeDataDir); 470 | if (szNodeDataDir[wcslen(szNodeDataDir) - 1] == L'\\' && wcslen(szNodeDataDir) > 3) 471 | szNodeDataDir[wcslen(szNodeDataDir) - 1] = (wchar_t)0; 472 | 473 | MsiSetPropertyW(hInstall, L"NodeDataDirAlgorandDataNetSpecific2", szNodeDataDir); 474 | return ERROR_SUCCESS; 475 | } 476 | 477 | extern "C" UINT EXPORT ReadConfigFromFile (MSIHANDLE hInstall) 478 | { 479 | wchar_t szConfigFile[MAX_PATH]; 480 | 481 | DWORD cchConfigFile = sizeof(szConfigFile) / sizeof(wchar_t); 482 | MsiGetPropertyW(hInstall, L"NodeDataDirAlgorandDataNetSpecific", szConfigFile, &cchConfigFile); 483 | 484 | wcsncat(szConfigFile, L"config.json", wcslen(L"config.json")); 485 | 486 | HANDLE hFile = CreateFileW(szConfigFile, 487 | GENERIC_READ, 488 | 0, 489 | NULL, 490 | OPEN_EXISTING, 491 | FILE_ATTRIBUTE_NORMAL, 492 | NULL); 493 | 494 | WriteLog(hInstall, L"algorand-install-CA: ReadConfigFromFile Open %s, status %d", szConfigFile, GetLastError()); 495 | 496 | if (hFile != INVALID_HANDLE_VALUE) 497 | { 498 | DWORD dwFileSize = GetFileSize(hFile, NULL); 499 | DWORD dwBytesRead = 0; 500 | if (dwFileSize > 0) 501 | { 502 | auto buffer = std::make_unique(dwFileSize + 1); 503 | if (ReadFile(hFile, buffer.get(), dwFileSize, &dwBytesRead, NULL)) 504 | { 505 | WriteLog(hInstall, L"algorand-install-CA: ReadConfigFromFile Read %d bytes from config.json", dwBytesRead); 506 | 507 | auto configJson = json::parse(buffer.get(), nullptr, false, true); 508 | 509 | if (!configJson.is_discarded()) 510 | { 511 | wchar_t szPortNum[8] = { 0 }; 512 | 513 | bool archival = configJson["Archival"].get(); 514 | std::string endpointAddr = configJson["EndpointAddress"]; 515 | endpointAddr.erase(0, endpointAddr.find_first_not_of(" \t")); 516 | 517 | if (endpointAddr.find(":") == std::string::npos) { 518 | WriteLog(hInstall, L"algorand-install-CA: Bad EndpointAddress entry %s", endpointAddr.c_str()); 519 | } 520 | else 521 | { 522 | StringCchPrintf(szPortNum, 8, L"%d", std::stoi(endpointAddr.substr(endpointAddr.find(":") + 1))); 523 | MsiSetPropertyW(hInstall, L"PORTNUMBER", szPortNum); 524 | 525 | if (endpointAddr.at(0) == ':') 526 | { 527 | MsiSetPropertyW(hInstall, L"PUBLICACCESS", L"1"); 528 | } 529 | } 530 | if (archival) 531 | { 532 | MsiSetPropertyW(hInstall, L"ENABLEARCHIVALMODE", L"1"); 533 | } 534 | } 535 | else 536 | { 537 | WriteLog(hInstall, L"algorand-install-CA: ReadConfigFromFile cannot parse existing JSON, ignoring"); 538 | } 539 | } 540 | else 541 | { 542 | WriteLog(hInstall, L"algorand-install-CA: ReadFile error %d", GetLastError()); 543 | } 544 | } 545 | 546 | CloseHandle(hFile); 547 | } 548 | 549 | return ERROR_SUCCESS; 550 | 551 | } 552 | 553 | extern "C" UINT EXPORT ApplyConfigToFile (MSIHANDLE hInstall) 554 | { 555 | DWORD status = ERROR_SUCCESS; 556 | 557 | wchar_t szCaData[MAX_ACTION_DATA] = { 0 }; 558 | DWORD cchCaData = MAX_ACTION_DATA; 559 | int numArgs; 560 | MsiGetPropertyW(hInstall, L"CustomActionData", szCaData, &cchCaData); 561 | 562 | LPWSTR* argv = CommandLineToArgvW(szCaData, &numArgs ); 563 | 564 | if (numArgs != 5) 565 | { 566 | WriteLog(hInstall, L"algorand-install-CA: invalid num of arguments %d (expected 5)", numArgs); 567 | return ERROR_BAD_ARGUMENTS; 568 | } 569 | 570 | LPWSTR szConfigPath = argv[0]; 571 | LPWSTR szEnableArchival = argv[1]; 572 | LPWSTR szPortNum = argv[2]; 573 | LPWSTR szNetwork = argv[3]; 574 | LPWSTR szPublicAccess = argv[4]; 575 | 576 | WriteLog(hInstall, L"algorand-install-CA: ApplyConfigToFile custom data Got properties: %s,%s,%s,%s,%s", 577 | szConfigPath, szEnableArchival, szPortNum, szNetwork, szPublicAccess); 578 | 579 | std::wstring configFile = std::wstring(szConfigPath).append(L"config.json"); 580 | 581 | HANDLE hFile = CreateFileW(configFile.c_str(), 582 | GENERIC_READ|GENERIC_WRITE, 583 | FILE_SHARE_READ, 584 | NULL, 585 | OPEN_EXISTING, 586 | FILE_ATTRIBUTE_NORMAL, 587 | NULL); 588 | 589 | WriteLog(hInstall, L"algorand-install-CA: ApplyConfigToFile Open %s, status %d", configFile.c_str(), GetLastError()); 590 | 591 | if (hFile == INVALID_HANDLE_VALUE) 592 | status = GetLastError(); 593 | else 594 | { 595 | DWORD dwFileSize = GetFileSize(hFile, NULL); 596 | DWORD dwBytesRead = 0, dwBytesWritten = 0; 597 | if (dwFileSize == 0) 598 | { 599 | status = ERROR_FILE_CORRUPT; 600 | } 601 | else 602 | { 603 | auto buffer = std::make_unique(dwFileSize + 1); 604 | if (ReadFile(hFile, buffer.get(), dwFileSize, &dwBytesRead, NULL)) 605 | { 606 | char wNetwork[8], wPort[8]; 607 | WideCharToMultiByte(CP_UTF8, 0, szNetwork, 8, wNetwork, 8, NULL, NULL); 608 | WideCharToMultiByte(CP_UTF8, 0, szPortNum, 8, wPort, 8, NULL, NULL); 609 | 610 | WriteLog(hInstall, L"algorand-install-CA: ApplyConfigToFile Read %d bytes from config.json", dwBytesRead); 611 | 612 | auto configJson = json::parse(buffer.get(), nullptr, false); 613 | if (!configJson.is_discarded()) 614 | { 615 | std::string addr = wcscmp(szPublicAccess, L"1") == 0 ? ":" : "127.0.0.1:"; 616 | configJson["DNSBootstrapID"] = std::string(wNetwork).append(".algorand.network"); 617 | configJson["EndpointAddress"] = addr.append(wPort); 618 | configJson["Archival"] = wcscmp(szEnableArchival, L"1") == 0 ? true : false; 619 | 620 | std::string str = configJson.dump(4); 621 | 622 | SetFilePointer(hFile, 0, 0, FILE_BEGIN); 623 | if (!WriteFile(hFile, str.c_str(), str.size(), &dwBytesWritten, NULL)) 624 | status = GetLastError(); 625 | 626 | SetEndOfFile(hFile); 627 | 628 | WriteLog(hInstall, L"algorand-install-CA: ApplyConfigToFile Write %d bytes to config.json", dwBytesRead); 629 | 630 | FlushFileBuffers(hFile); 631 | } 632 | else 633 | { 634 | WriteLog(hInstall, L"algorand-install-CA: json::parse failed"); 635 | status = ERROR_FILE_CORRUPT; 636 | } 637 | } 638 | else 639 | { 640 | status = GetLastError(); 641 | } 642 | } 643 | } 644 | 645 | CloseHandle(hFile); 646 | 647 | WriteLog(hInstall, L"algorand-install-CA: ApplyConfigToFile Exiting with status %d", status); 648 | return status; 649 | } -------------------------------------------------------------------------------- /installer/src/AlgorandNode.wxs: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 65 | 74 | 75 | 78 | 79 | 80 | 81 | = 602]]> 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | NOT WIX_UPGRADE_DETECTED AND NOT Installed 133 | NOT REMOVE 134 | NOT UPGRADINGPRODUCTCODE AND REMOVE~="ALL" 135 | Installed OR WIX_UPGRADE_DETECTED 136 | NOT Installed 137 | NOT Installed 138 | 139 | 140 | 141 | NOT WIX_UPGRADE_DETECTED AND NOT Installed 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 213 | 214 | 219 | 220 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . -------------------------------------------------------------------------------- /installer/src/res/COPYING.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} 2 | {\colortbl ;\red0\green0\blue255;} 3 | {\*\generator Riched20 10.0.19041}\viewkind4\uc1 4 | \pard\f0\fs16\lang11274 Algorand's node software is released under the Affero General Public License,\par 5 | version 3, with Additional Terms pursuant to Section 7e of the AGPL v3.0\par 6 | license. Please see the very bottom of this file for the Additional Terms.\par 7 | \par 8 | \b GNU AFFERO GENERAL PUBLIC LICENSE\par 9 | Version 3, 19 November 2007\par 10 | \b0\par 11 | Copyright (C) 2007 Free Software Foundation, Inc. <{{\field{\*\fldinst{HYPERLINK "https://fsf.org/"}}{\fldrslt{https://fsf.org/\ul0\cf0}}}}\f0\fs16 >\par 12 | Everyone is permitted to copy and distribute verbatim copies\par 13 | of this license document, but changing it is not allowed.\par 14 | \par 15 | Preamble\par 16 | \par 17 | The GNU Affero General Public License is a free, copyleft license for\par 18 | software and other kinds of works, specifically designed to ensure\par 19 | cooperation with the community in the case of network server software.\par 20 | \par 21 | The licenses for most software and other practical works are designed\par 22 | to take away your freedom to share and change the works. By contrast,\par 23 | our General Public Licenses are intended to guarantee your freedom to\par 24 | share and change all versions of a program--to make sure it remains free\par 25 | software for all its users.\par 26 | \par 27 | When we speak of free software, we are referring to freedom, not\par 28 | price. Our General Public Licenses are designed to make sure that you\par 29 | have the freedom to distribute copies of free software (and charge for\par 30 | them if you wish), that you receive source code or can get it if you\par 31 | want it, that you can change the software or use pieces of it in new\par 32 | free programs, and that you know you can do these things.\par 33 | \par 34 | Developers that use our General Public Licenses protect your rights\par 35 | with two steps: (1) assert copyright on the software, and (2) offer\par 36 | you this License which gives you legal permission to copy, distribute\par 37 | and/or modify the software.\par 38 | \par 39 | A secondary benefit of defending all users' freedom is that\par 40 | improvements made in alternate versions of the program, if they\par 41 | receive widespread use, become available for other developers to\par 42 | incorporate. Many developers of free software are heartened and\par 43 | encouraged by the resulting cooperation. However, in the case of\par 44 | software used on network servers, this result may fail to come about.\par 45 | The GNU General Public License permits making a modified version and\par 46 | letting the public access it on a server without ever releasing its\par 47 | source code to the public.\par 48 | \par 49 | The GNU Affero General Public License is designed specifically to\par 50 | ensure that, in such cases, the modified source code becomes available\par 51 | to the community. It requires the operator of a network server to\par 52 | provide the source code of the modified version running there to the\par 53 | users of that server. Therefore, public use of a modified version, on\par 54 | a publicly accessible server, gives the public access to the source\par 55 | code of the modified version.\par 56 | \par 57 | An older license, called the Affero General Public License and\par 58 | published by Affero, was designed to accomplish similar goals. This is\par 59 | a different license, not a version of the Affero GPL, but Affero has\par 60 | released a new version of the Affero GPL which permits relicensing under\par 61 | this license.\par 62 | \par 63 | The precise terms and conditions for copying, distribution and\par 64 | modification follow.\par 65 | \par 66 | TERMS AND CONDITIONS\par 67 | \par 68 | 0. Definitions.\par 69 | \par 70 | "This License" refers to version 3 of the GNU Affero General Public License.\par 71 | \par 72 | "Copyright" also means copyright-like laws that apply to other kinds of\par 73 | works, such as semiconductor masks.\par 74 | \par 75 | "The Program" refers to any copyrightable work licensed under this\par 76 | License. Each licensee is addressed as "you". "Licensees" and\par 77 | "recipients" may be individuals or organizations.\par 78 | \par 79 | To "modify" a work means to copy from or adapt all or part of the work\par 80 | in a fashion requiring copyright permission, other than the making of an\par 81 | exact copy. The resulting work is called a "modified version" of the\par 82 | earlier work or a work "based on" the earlier work.\par 83 | \par 84 | A "covered work" means either the unmodified Program or a work based\par 85 | on the Program.\par 86 | \par 87 | To "propagate" a work means to do anything with it that, without\par 88 | permission, would make you directly or secondarily liable for\par 89 | infringement under applicable copyright law, except executing it on a\par 90 | computer or modifying a private copy. Propagation includes copying,\par 91 | distribution (with or without modification), making available to the\par 92 | public, and in some countries other activities as well.\par 93 | \par 94 | To "convey" a work means any kind of propagation that enables other\par 95 | parties to make or receive copies. Mere interaction with a user through\par 96 | a computer network, with no transfer of a copy, is not conveying.\par 97 | \par 98 | An interactive user interface displays "Appropriate Legal Notices"\par 99 | to the extent that it includes a convenient and prominently visible\par 100 | feature that (1) displays an appropriate copyright notice, and (2)\par 101 | tells the user that there is no warranty for the work (except to the\par 102 | extent that warranties are provided), that licensees may convey the\par 103 | work under this License, and how to view a copy of this License. If\par 104 | the interface presents a list of user commands or options, such as a\par 105 | menu, a prominent item in the list meets this criterion.\par 106 | \par 107 | 1. Source Code.\par 108 | \par 109 | The "source code" for a work means the preferred form of the work\par 110 | for making modifications to it. "Object code" means any non-source\par 111 | form of a work.\par 112 | \par 113 | A "Standard Interface" means an interface that either is an official\par 114 | standard defined by a recognized standards body, or, in the case of\par 115 | interfaces specified for a particular programming language, one that\par 116 | is widely used among developers working in that language.\par 117 | \par 118 | The "System Libraries" of an executable work include anything, other\par 119 | than the work as a whole, that (a) is included in the normal form of\par 120 | packaging a Major Component, but which is not part of that Major\par 121 | Component, and (b) serves only to enable use of the work with that\par 122 | Major Component, or to implement a Standard Interface for which an\par 123 | implementation is available to the public in source code form. A\par 124 | "Major Component", in this context, means a major essential component\par 125 | (kernel, window system, and so on) of the specific operating system\par 126 | (if any) on which the executable work runs, or a compiler used to\par 127 | produce the work, or an object code interpreter used to run it.\par 128 | \par 129 | The "Corresponding Source" for a work in object code form means all\par 130 | the source code needed to generate, install, and (for an executable\par 131 | work) run the object code and to modify the work, including scripts to\par 132 | control those activities. However, it does not include the work's\par 133 | System Libraries, or general-purpose tools or generally available free\par 134 | programs which are used unmodified in performing those activities but\par 135 | which are not part of the work. For example, Corresponding Source\par 136 | includes interface definition files associated with source files for\par 137 | the work, and the source code for shared libraries and dynamically\par 138 | linked subprograms that the work is specifically designed to require,\par 139 | such as by intimate data communication or control flow between those\par 140 | subprograms and other parts of the work.\par 141 | \par 142 | The Corresponding Source need not include anything that users\par 143 | can regenerate automatically from other parts of the Corresponding\par 144 | Source.\par 145 | \par 146 | The Corresponding Source for a work in source code form is that\par 147 | same work.\par 148 | \par 149 | 2. Basic Permissions.\par 150 | \par 151 | All rights granted under this License are granted for the term of\par 152 | copyright on the Program, and are irrevocable provided the stated\par 153 | conditions are met. This License explicitly affirms your unlimited\par 154 | permission to run the unmodified Program. The output from running a\par 155 | covered work is covered by this License only if the output, given its\par 156 | content, constitutes a covered work. This License acknowledges your\par 157 | rights of fair use or other equivalent, as provided by copyright law.\par 158 | \par 159 | You may make, run and propagate covered works that you do not\par 160 | convey, without conditions so long as your license otherwise remains\par 161 | in force. You may convey covered works to others for the sole purpose\par 162 | of having them make modifications exclusively for you, or provide you\par 163 | with facilities for running those works, provided that you comply with\par 164 | the terms of this License in conveying all material for which you do\par 165 | not control copyright. Those thus making or running the covered works\par 166 | for you must do so exclusively on your behalf, under your direction\par 167 | and control, on terms that prohibit them from making any copies of\par 168 | your copyrighted material outside their relationship with you.\par 169 | \par 170 | Conveying under any other circumstances is permitted solely under\par 171 | the conditions stated below. Sublicensing is not allowed; section 10\par 172 | makes it unnecessary.\par 173 | \par 174 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\par 175 | \par 176 | No covered work shall be deemed part of an effective technological\par 177 | measure under any applicable law fulfilling obligations under article\par 178 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or\par 179 | similar laws prohibiting or restricting circumvention of such\par 180 | measures.\par 181 | \par 182 | When you convey a covered work, you waive any legal power to forbid\par 183 | circumvention of technological measures to the extent such circumvention\par 184 | is effected by exercising rights under this License with respect to\par 185 | the covered work, and you disclaim any intention to limit operation or\par 186 | modification of the work as a means of enforcing, against the work's\par 187 | users, your or third parties' legal rights to forbid circumvention of\par 188 | technological measures.\par 189 | \par 190 | 4. Conveying Verbatim Copies.\par 191 | \par 192 | You may convey verbatim copies of the Program's source code as you\par 193 | receive it, in any medium, provided that you conspicuously and\par 194 | appropriately publish on each copy an appropriate copyright notice;\par 195 | keep intact all notices stating that this License and any\par 196 | non-permissive terms added in accord with section 7 apply to the code;\par 197 | keep intact all notices of the absence of any warranty; and give all\par 198 | recipients a copy of this License along with the Program.\par 199 | \par 200 | You may charge any price or no price for each copy that you convey,\par 201 | and you may offer support or warranty protection for a fee.\par 202 | \par 203 | 5. Conveying Modified Source Versions.\par 204 | \par 205 | You may convey a work based on the Program, or the modifications to\par 206 | produce it from the Program, in the form of source code under the\par 207 | terms of section 4, provided that you also meet all of these conditions:\par 208 | \par 209 | a) The work must carry prominent notices stating that you modified\par 210 | it, and giving a relevant date.\par 211 | \par 212 | b) The work must carry prominent notices stating that it is\par 213 | released under this License and any conditions added under section\par 214 | 7. This requirement modifies the requirement in section 4 to\par 215 | "keep intact all notices".\par 216 | \par 217 | c) You must license the entire work, as a whole, under this\par 218 | License to anyone who comes into possession of a copy. This\par 219 | License will therefore apply, along with any applicable section 7\par 220 | additional terms, to the whole of the work, and all its parts,\par 221 | regardless of how they are packaged. This License gives no\par 222 | permission to license the work in any other way, but it does not\par 223 | invalidate such permission if you have separately received it.\par 224 | \par 225 | d) If the work has interactive user interfaces, each must display\par 226 | Appropriate Legal Notices; however, if the Program has interactive\par 227 | interfaces that do not display Appropriate Legal Notices, your\par 228 | work need not make them do so.\par 229 | \par 230 | A compilation of a covered work with other separate and independent\par 231 | works, which are not by their nature extensions of the covered work,\par 232 | and which are not combined with it such as to form a larger program,\par 233 | in or on a volume of a storage or distribution medium, is called an\par 234 | "aggregate" if the compilation and its resulting copyright are not\par 235 | used to limit the access or legal rights of the compilation's users\par 236 | beyond what the individual works permit. Inclusion of a covered work\par 237 | in an aggregate does not cause this License to apply to the other\par 238 | parts of the aggregate.\par 239 | \par 240 | 6. Conveying Non-Source Forms.\par 241 | \par 242 | You may convey a covered work in object code form under the terms\par 243 | of sections 4 and 5, provided that you also convey the\par 244 | machine-readable Corresponding Source under the terms of this License,\par 245 | in one of these ways:\par 246 | \par 247 | a) Convey the object code in, or embodied in, a physical product\par 248 | (including a physical distribution medium), accompanied by the\par 249 | Corresponding Source fixed on a durable physical medium\par 250 | customarily used for software interchange.\par 251 | \par 252 | b) Convey the object code in, or embodied in, a physical product\par 253 | (including a physical distribution medium), accompanied by a\par 254 | written offer, valid for at least three years and valid for as\par 255 | long as you offer spare parts or customer support for that product\par 256 | model, to give anyone who possesses the object code either (1) a\par 257 | copy of the Corresponding Source for all the software in the\par 258 | product that is covered by this License, on a durable physical\par 259 | medium customarily used for software interchange, for a price no\par 260 | more than your reasonable cost of physically performing this\par 261 | conveying of source, or (2) access to copy the\par 262 | Corresponding Source from a network server at no charge.\par 263 | \par 264 | c) Convey individual copies of the object code with a copy of the\par 265 | written offer to provide the Corresponding Source. This\par 266 | alternative is allowed only occasionally and noncommercially, and\par 267 | only if you received the object code with such an offer, in accord\par 268 | with subsection 6b.\par 269 | \par 270 | d) Convey the object code by offering access from a designated\par 271 | place (gratis or for a charge), and offer equivalent access to the\par 272 | Corresponding Source in the same way through the same place at no\par 273 | further charge. You need not require recipients to copy the\par 274 | Corresponding Source along with the object code. If the place to\par 275 | copy the object code is a network server, the Corresponding Source\par 276 | may be on a different server (operated by you or a third party)\par 277 | that supports equivalent copying facilities, provided you maintain\par 278 | clear directions next to the object code saying where to find the\par 279 | Corresponding Source. Regardless of what server hosts the\par 280 | Corresponding Source, you remain obligated to ensure that it is\par 281 | available for as long as needed to satisfy these requirements.\par 282 | \par 283 | e) Convey the object code using peer-to-peer transmission, provided\par 284 | you inform other peers where the object code and Corresponding\par 285 | Source of the work are being offered to the general public at no\par 286 | charge under subsection 6d.\par 287 | \par 288 | A separable portion of the object code, whose source code is excluded\par 289 | from the Corresponding Source as a System Library, need not be\par 290 | included in conveying the object code work.\par 291 | \par 292 | A "User Product" is either (1) a "consumer product", which means any\par 293 | tangible personal property which is normally used for personal, family,\par 294 | or household purposes, or (2) anything designed or sold for incorporation\par 295 | into a dwelling. In determining whether a product is a consumer product,\par 296 | doubtful cases shall be resolved in favor of coverage. For a particular\par 297 | product received by a particular user, "normally used" refers to a\par 298 | typical or common use of that class of product, regardless of the status\par 299 | of the particular user or of the way in which the particular user\par 300 | actually uses, or expects or is expected to use, the product. A product\par 301 | is a consumer product regardless of whether the product has substantial\par 302 | commercial, industrial or non-consumer uses, unless such uses represent\par 303 | the only significant mode of use of the product.\par 304 | \par 305 | "Installation Information" for a User Product means any methods,\par 306 | procedures, authorization keys, or other information required to install\par 307 | and execute modified versions of a covered work in that User Product from\par 308 | a modified version of its Corresponding Source. The information must\par 309 | suffice to ensure that the continued functioning of the modified object\par 310 | code is in no case prevented or interfered with solely because\par 311 | modification has been made.\par 312 | \par 313 | If you convey an object code work under this section in, or with, or\par 314 | specifically for use in, a User Product, and the conveying occurs as\par 315 | part of a transaction in which the right of possession and use of the\par 316 | User Product is transferred to the recipient in perpetuity or for a\par 317 | fixed term (regardless of how the transaction is characterized), the\par 318 | Corresponding Source conveyed under this section must be accompanied\par 319 | by the Installation Information. But this requirement does not apply\par 320 | if neither you nor any third party retains the ability to install\par 321 | modified object code on the User Product (for example, the work has\par 322 | been installed in ROM).\par 323 | \par 324 | The requirement to provide Installation Information does not include a\par 325 | requirement to continue to provide support service, warranty, or updates\par 326 | for a work that has been modified or installed by the recipient, or for\par 327 | the User Product in which it has been modified or installed. Access to a\par 328 | network may be denied when the modification itself materially and\par 329 | adversely affects the operation of the network or violates the rules and\par 330 | protocols for communication across the network.\par 331 | \par 332 | Corresponding Source conveyed, and Installation Information provided,\par 333 | in accord with this section must be in a format that is publicly\par 334 | documented (and with an implementation available to the public in\par 335 | source code form), and must require no special password or key for\par 336 | unpacking, reading or copying.\par 337 | \par 338 | 7. Additional Terms.\par 339 | \par 340 | "Additional permissions" are terms that supplement the terms of this\par 341 | License by making exceptions from one or more of its conditions.\par 342 | Additional permissions that are applicable to the entire Program shall\par 343 | be treated as though they were included in this License, to the extent\par 344 | that they are valid under applicable law. If additional permissions\par 345 | apply only to part of the Program, that part may be used separately\par 346 | under those permissions, but the entire Program remains governed by\par 347 | this License without regard to the additional permissions.\par 348 | \par 349 | When you convey a copy of a covered work, you may at your option\par 350 | remove any additional permissions from that copy, or from any part of\par 351 | it. (Additional permissions may be written to require their own\par 352 | removal in certain cases when you modify the work.) You may place\par 353 | additional permissions on material, added by you to a covered work,\par 354 | for which you have or can give appropriate copyright permission.\par 355 | \par 356 | Notwithstanding any other provision of this License, for material you\par 357 | add to a covered work, you may (if authorized by the copyright holders of\par 358 | that material) supplement the terms of this License with terms:\par 359 | \par 360 | a) Disclaiming warranty or limiting liability differently from the\par 361 | terms of sections 15 and 16 of this License; or\par 362 | \par 363 | b) Requiring preservation of specified reasonable legal notices or\par 364 | author attributions in that material or in the Appropriate Legal\par 365 | Notices displayed by works containing it; or\par 366 | \par 367 | c) Prohibiting misrepresentation of the origin of that material, or\par 368 | requiring that modified versions of such material be marked in\par 369 | reasonable ways as different from the original version; or\par 370 | \par 371 | d) Limiting the use for publicity purposes of names of licensors or\par 372 | authors of the material; or\par 373 | \par 374 | e) Declining to grant rights under trademark law for use of some\par 375 | trade names, trademarks, or service marks; or\par 376 | \par 377 | f) Requiring indemnification of licensors and authors of that\par 378 | material by anyone who conveys the material (or modified versions of\par 379 | it) with contractual assumptions of liability to the recipient, for\par 380 | any liability that these contractual assumptions directly impose on\par 381 | those licensors and authors.\par 382 | \par 383 | All other non-permissive additional terms are considered "further\par 384 | restrictions" within the meaning of section 10. If the Program as you\par 385 | received it, or any part of it, contains a notice stating that it is\par 386 | governed by this License along with a term that is a further\par 387 | restriction, you may remove that term. If a license document contains\par 388 | a further restriction but permits relicensing or conveying under this\par 389 | License, you may add to a covered work material governed by the terms\par 390 | of that license document, provided that the further restriction does\par 391 | not survive such relicensing or conveying.\par 392 | \par 393 | If you add terms to a covered work in accord with this section, you\par 394 | must place, in the relevant source files, a statement of the\par 395 | additional terms that apply to those files, or a notice indicating\par 396 | where to find the applicable terms.\par 397 | \par 398 | Additional terms, permissive or non-permissive, may be stated in the\par 399 | form of a separately written license, or stated as exceptions;\par 400 | the above requirements apply either way.\par 401 | \par 402 | 8. Termination.\par 403 | \par 404 | You may not propagate or modify a covered work except as expressly\par 405 | provided under this License. Any attempt otherwise to propagate or\par 406 | modify it is void, and will automatically terminate your rights under\par 407 | this License (including any patent licenses granted under the third\par 408 | paragraph of section 11).\par 409 | \par 410 | However, if you cease all violation of this License, then your\par 411 | license from a particular copyright holder is reinstated (a)\par 412 | provisionally, unless and until the copyright holder explicitly and\par 413 | finally terminates your license, and (b) permanently, if the copyright\par 414 | holder fails to notify you of the violation by some reasonable means\par 415 | prior to 60 days after the cessation.\par 416 | \par 417 | Moreover, your license from a particular copyright holder is\par 418 | reinstated permanently if the copyright holder notifies you of the\par 419 | violation by some reasonable means, this is the first time you have\par 420 | received notice of violation of this License (for any work) from that\par 421 | copyright holder, and you cure the violation prior to 30 days after\par 422 | your receipt of the notice.\par 423 | \par 424 | Termination of your rights under this section does not terminate the\par 425 | licenses of parties who have received copies or rights from you under\par 426 | this License. If your rights have been terminated and not permanently\par 427 | reinstated, you do not qualify to receive new licenses for the same\par 428 | material under section 10.\par 429 | \par 430 | 9. Acceptance Not Required for Having Copies.\par 431 | \par 432 | You are not required to accept this License in order to receive or\par 433 | run a copy of the Program. Ancillary propagation of a covered work\par 434 | occurring solely as a consequence of using peer-to-peer transmission\par 435 | to receive a copy likewise does not require acceptance. However,\par 436 | nothing other than this License grants you permission to propagate or\par 437 | modify any covered work. These actions infringe copyright if you do\par 438 | not accept this License. Therefore, by modifying or propagating a\par 439 | covered work, you indicate your acceptance of this License to do so.\par 440 | \par 441 | 10. Automatic Licensing of Downstream Recipients.\par 442 | \par 443 | Each time you convey a covered work, the recipient automatically\par 444 | receives a license from the original licensors, to run, modify and\par 445 | propagate that work, subject to this License. You are not responsible\par 446 | for enforcing compliance by third parties with this License.\par 447 | \par 448 | An "entity transaction" is a transaction transferring control of an\par 449 | organization, or substantially all assets of one, or subdividing an\par 450 | organization, or merging organizations. If propagation of a covered\par 451 | work results from an entity transaction, each party to that\par 452 | transaction who receives a copy of the work also receives whatever\par 453 | licenses to the work the party's predecessor in interest had or could\par 454 | give under the previous paragraph, plus a right to possession of the\par 455 | Corresponding Source of the work from the predecessor in interest, if\par 456 | the predecessor has it or can get it with reasonable efforts.\par 457 | \par 458 | You may not impose any further restrictions on the exercise of the\par 459 | rights granted or affirmed under this License. For example, you may\par 460 | not impose a license fee, royalty, or other charge for exercise of\par 461 | rights granted under this License, and you may not initiate litigation\par 462 | (including a cross-claim or counterclaim in a lawsuit) alleging that\par 463 | any patent claim is infringed by making, using, selling, offering for\par 464 | sale, or importing the Program or any portion of it.\par 465 | \par 466 | 11. Patents.\par 467 | \par 468 | A "contributor" is a copyright holder who authorizes use under this\par 469 | License of the Program or a work on which the Program is based. The\par 470 | work thus licensed is called the contributor's "contributor version".\par 471 | \par 472 | A contributor's "essential patent claims" are all patent claims\par 473 | owned or controlled by the contributor, whether already acquired or\par 474 | hereafter acquired, that would be infringed by some manner, permitted\par 475 | by this License, of making, using, or selling its contributor version,\par 476 | but do not include claims that would be infringed only as a\par 477 | consequence of further modification of the contributor version. For\par 478 | purposes of this definition, "control" includes the right to grant\par 479 | patent sublicenses in a manner consistent with the requirements of\par 480 | this License.\par 481 | \par 482 | Each contributor grants you a non-exclusive, worldwide, royalty-free\par 483 | patent license under the contributor's essential patent claims, to\par 484 | make, use, sell, offer for sale, import and otherwise run, modify and\par 485 | propagate the contents of its contributor version.\par 486 | \par 487 | In the following three paragraphs, a "patent license" is any express\par 488 | agreement or commitment, however denominated, not to enforce a patent\par 489 | (such as an express permission to practice a patent or covenant not to\par 490 | sue for patent infringement). To "grant" such a patent license to a\par 491 | party means to make such an agreement or commitment not to enforce a\par 492 | patent against the party.\par 493 | \par 494 | If you convey a covered work, knowingly relying on a patent license,\par 495 | and the Corresponding Source of the work is not available for anyone\par 496 | to copy, free of charge and under the terms of this License, through a\par 497 | publicly available network server or other readily accessible means,\par 498 | then you must either (1) cause the Corresponding Source to be so\par 499 | available, or (2) arrange to deprive yourself of the benefit of the\par 500 | patent license for this particular work, or (3) arrange, in a manner\par 501 | consistent with the requirements of this License, to extend the patent\par 502 | license to downstream recipients. "Knowingly relying" means you have\par 503 | actual knowledge that, but for the patent license, your conveying the\par 504 | covered work in a country, or your recipient's use of the covered work\par 505 | in a country, would infringe one or more identifiable patents in that\par 506 | country that you have reason to believe are valid.\par 507 | \par 508 | If, pursuant to or in connection with a single transaction or\par 509 | arrangement, you convey, or propagate by procuring conveyance of, a\par 510 | covered work, and grant a patent license to some of the parties\par 511 | receiving the covered work authorizing them to use, propagate, modify\par 512 | or convey a specific copy of the covered work, then the patent license\par 513 | you grant is automatically extended to all recipients of the covered\par 514 | work and works based on it.\par 515 | \par 516 | A patent license is "discriminatory" if it does not include within\par 517 | the scope of its coverage, prohibits the exercise of, or is\par 518 | conditioned on the non-exercise of one or more of the rights that are\par 519 | specifically granted under this License. You may not convey a covered\par 520 | work if you are a party to an arrangement with a third party that is\par 521 | in the business of distributing software, under which you make payment\par 522 | to the third party based on the extent of your activity of conveying\par 523 | the work, and under which the third party grants, to any of the\par 524 | parties who would receive the covered work from you, a discriminatory\par 525 | patent license (a) in connection with copies of the covered work\par 526 | conveyed by you (or copies made from those copies), or (b) primarily\par 527 | for and in connection with specific products or compilations that\par 528 | contain the covered work, unless you entered into that arrangement,\par 529 | or that patent license was granted, prior to 28 March 2007.\par 530 | \par 531 | Nothing in this License shall be construed as excluding or limiting\par 532 | any implied license or other defenses to infringement that may\par 533 | otherwise be available to you under applicable patent law.\par 534 | \par 535 | 12. No Surrender of Others' Freedom.\par 536 | \par 537 | If conditions are imposed on you (whether by court order, agreement or\par 538 | otherwise) that contradict the conditions of this License, they do not\par 539 | excuse you from the conditions of this License. If you cannot convey a\par 540 | covered work so as to satisfy simultaneously your obligations under this\par 541 | License and any other pertinent obligations, then as a consequence you may\par 542 | not convey it at all. For example, if you agree to terms that obligate you\par 543 | to collect a royalty for further conveying from those to whom you convey\par 544 | the Program, the only way you could satisfy both those terms and this\par 545 | License would be to refrain entirely from conveying the Program.\par 546 | \par 547 | 13. Remote Network Interaction; Use with the GNU General Public License.\par 548 | \par 549 | Notwithstanding any other provision of this License, if you modify the\par 550 | Program, your modified version must prominently offer all users\par 551 | interacting with it remotely through a computer network (if your version\par 552 | supports such interaction) an opportunity to receive the Corresponding\par 553 | Source of your version by providing access to the Corresponding Source\par 554 | from a network server at no charge, through some standard or customary\par 555 | means of facilitating copying of software. This Corresponding Source\par 556 | shall include the Corresponding Source for any work covered by version 3\par 557 | of the GNU General Public License that is incorporated pursuant to the\par 558 | following paragraph.\par 559 | \par 560 | Notwithstanding any other provision of this License, you have\par 561 | permission to link or combine any covered work with a work licensed\par 562 | under version 3 of the GNU General Public License into a single\par 563 | combined work, and to convey the resulting work. The terms of this\par 564 | License will continue to apply to the part which is the covered work,\par 565 | but the work with which it is combined will remain governed by version\par 566 | 3 of the GNU General Public License.\par 567 | \par 568 | 14. Revised Versions of this License.\par 569 | \par 570 | The Free Software Foundation may publish revised and/or new versions of\par 571 | the GNU Affero General Public License from time to time. Such new versions\par 572 | will be similar in spirit to the present version, but may differ in detail to\par 573 | address new problems or concerns.\par 574 | \par 575 | Each version is given a distinguishing version number. If the\par 576 | Program specifies that a certain numbered version of the GNU Affero General\par 577 | Public License "or any later version" applies to it, you have the\par 578 | option of following the terms and conditions either of that numbered\par 579 | version or of any later version published by the Free Software\par 580 | Foundation. If the Program does not specify a version number of the\par 581 | GNU Affero General Public License, you may choose any version ever published\par 582 | by the Free Software Foundation.\par 583 | \par 584 | If the Program specifies that a proxy can decide which future\par 585 | versions of the GNU Affero General Public License can be used, that proxy's\par 586 | public statement of acceptance of a version permanently authorizes you\par 587 | to choose that version for the Program.\par 588 | \par 589 | Later license versions may give you additional or different\par 590 | permissions. However, no additional obligations are imposed on any\par 591 | author or copyright holder as a result of your choosing to follow a\par 592 | later version.\par 593 | \par 594 | 15. Disclaimer of Warranty.\par 595 | \par 596 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\par 597 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\par 598 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY\par 599 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\par 600 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\par 601 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\par 602 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\par 603 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\par 604 | \par 605 | 16. Limitation of Liability.\par 606 | \par 607 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\par 608 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\par 609 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\par 610 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\par 611 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\par 612 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\par 613 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\par 614 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\par 615 | SUCH DAMAGES.\par 616 | \par 617 | 17. Interpretation of Sections 15 and 16.\par 618 | \par 619 | If the disclaimer of warranty and limitation of liability provided\par 620 | above cannot be given local legal effect according to their terms,\par 621 | reviewing courts shall apply local law that most closely approximates\par 622 | an absolute waiver of all civil liability in connection with the\par 623 | Program, unless a warranty or assumption of liability accompanies a\par 624 | copy of the Program in return for a fee.\par 625 | \par 626 | END OF TERMS AND CONDITIONS\par 627 | \par 628 | How to Apply These Terms to Your New Programs\par 629 | \par 630 | If you develop a new program, and you want it to be of the greatest\par 631 | possible use to the public, the best way to achieve this is to make it\par 632 | free software which everyone can redistribute and change under these terms.\par 633 | \par 634 | To do so, attach the following notices to the program. It is safest\par 635 | to attach them to the start of each source file to most effectively\par 636 | state the exclusion of warranty; and each file should have at least\par 637 | the "copyright" line and a pointer to where the full notice is found.\par 638 | \par 639 | \par 640 | Copyright (C) \par 641 | \par 642 | This program is free software: you can redistribute it and/or modify\par 643 | it under the terms of the GNU Affero General Public License as published by\par 644 | the Free Software Foundation, either version 3 of the License, or\par 645 | (at your option) any later version.\par 646 | \par 647 | This program is distributed in the hope that it will be useful,\par 648 | but WITHOUT ANY WARRANTY; without even the implied warranty of\par 649 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\par 650 | GNU Affero General Public License for more details.\par 651 | \par 652 | You should have received a copy of the GNU Affero General Public License\par 653 | along with this program. If not, see <{{\field{\*\fldinst{HYPERLINK "https://www.gnu.org/licenses/"}}{\fldrslt{https://www.gnu.org/licenses/\ul0\cf0}}}}\f0\fs16 >.\par 654 | \par 655 | Also add information on how to contact you by electronic and paper mail.\par 656 | \par 657 | If your software can interact with users remotely through a computer\par 658 | network, you should also make sure that it provides a way for users to\par 659 | get its source. For example, if your program is a web application, its\par 660 | interface could display a "Source" link that leads users to an archive\par 661 | of the code. There are many ways you could offer source, and different\par 662 | solutions will be better for different programs; see section 13 for the\par 663 | specific requirements.\par 664 | \par 665 | You should also get your employer (if you work as a programmer) or school,\par 666 | if any, to sign a "copyright disclaimer" for the program, if necessary.\par 667 | For more information on this, and how to apply and follow the GNU AGPL, see\par 668 | <{{\field{\*\fldinst{HYPERLINK "https://www.gnu.org/licenses/"}}{\fldrslt{https://www.gnu.org/licenses/\ul0\cf0}}}}\f0\fs16 >.\par 669 | \par 670 | -------------------------------------------------------------------------------\par 671 | ADDITIONAL TERMS AS PERMITTED BY SECTION 7e OF AGPLv3.0\par 672 | -------------------------------------------------------------------------------\par 673 | \par 674 | Algorand owns all rights, title and interest in and to the Algorand trademarks \par 675 | including, without limitation, the trademarks ALGORAND, ALGORAND FOUNDATION, \par 676 | ALGORAND & Design, ALGO, THE BORDERLESS ECONOMY, ALGORAND THE BORDERLESS ECONOMY, \par 677 | DEMOCRATIZED FINANCE, PURE PROOF OF STAKE, ALGORAND, BUILD OPPORTUNITY, \par 678 | THE BLOCKCHAIN FOR BUSINESS and any other trademarks owned or used by Algorand \par 679 | now or in the future regardless of whether the trademarks have been registered \par 680 | in the United States or elsewhere (together, the "Algorand Trademarks").\par 681 | \par 682 | Nothing contained herein shall grant to Licensee any rights, title or interest in \par 683 | or to, including the right to use, the ALGORAND Trademarks. Licensee may request \par 684 | the right to use the Algorand Trademarks by contacting Algorand at\par 685 | trademark@algorand.com. \par 686 | \par 687 | } 688 | --------------------------------------------------------------------------------