summaryrefslogtreecommitdiff
path: root/other-licenses/nsis/Contrib
diff options
context:
space:
mode:
Diffstat (limited to 'other-licenses/nsis/Contrib')
-rw-r--r--other-licenses/nsis/Contrib/ApplicationID/ApplicationID.rc101
-rw-r--r--other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj206
-rw-r--r--other-licenses/nsis/Contrib/ApplicationID/Set.cpp219
-rw-r--r--other-licenses/nsis/Contrib/ApplicationID/resource.h14
-rw-r--r--other-licenses/nsis/Contrib/CertCheck/CertCheck.cpp385
-rw-r--r--other-licenses/nsis/Contrib/CertCheck/CertCheck.dsp159
-rw-r--r--other-licenses/nsis/Contrib/CertCheck/CertCheck.dsw29
-rw-r--r--other-licenses/nsis/Contrib/CityHash/CityHash.cpp82
-rw-r--r--other-licenses/nsis/Contrib/CityHash/CityHash.def3
-rw-r--r--other-licenses/nsis/Contrib/CityHash/CityHash.dsp159
-rw-r--r--other-licenses/nsis/Contrib/CityHash/CityHash.dsw29
-rw-r--r--other-licenses/nsis/Contrib/CityHash/CityHash.h33
-rw-r--r--other-licenses/nsis/Contrib/CityHash/CityHash.vcproj223
-rw-r--r--other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp307
-rw-r--r--other-licenses/nsis/Contrib/CityHash/cityhash/city.h91
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/SConscript25
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdll.c44
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdll.dpr118
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdll.dsp111
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdll.dsw29
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdll.h234
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdll_with_unit.dpr31
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdllutil.cpp131
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/exdllutil.h119
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/extdll.inc145
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/nsis.pas126
-rw-r--r--other-licenses/nsis/Contrib/ExDLL/tchar.h210
-rw-r--r--other-licenses/nsis/Contrib/InetBgDL/InetBgDL.cpp672
-rw-r--r--other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsp159
-rw-r--r--other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsw29
-rw-r--r--other-licenses/nsis/Contrib/InetBgDL/InetBgDL.h65
-rw-r--r--other-licenses/nsis/Contrib/README34
-rw-r--r--other-licenses/nsis/Contrib/ServicesHelper/Services.cpp241
-rw-r--r--other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsp115
-rw-r--r--other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsw29
-rw-r--r--other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.rc99
-rw-r--r--other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.sln20
-rw-r--r--other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.vcproj212
-rw-r--r--other-licenses/nsis/Contrib/ServicesHelper/resource.h14
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/License.txt17
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/ReadMe.txt39
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/Sample.nsi25
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/exdll.h97
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/liteFirewall.cpp408
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsp204
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsw29
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/liteFirewall.sln23
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/liteFirewall.vcproj390
-rw-r--r--other-licenses/nsis/Contrib/liteFirewall/netfw.tlbbin0 -> 12184 bytes
49 files changed, 6284 insertions, 0 deletions
diff --git a/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.rc b/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.rc
new file mode 100644
index 0000000000..77a48f6a83
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.rc
@@ -0,0 +1,101 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "NSIS Plug-in for managing Application Modal ID resources"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "ApplicationID"
+ VALUE "LegalCopyright", "Original code Copyright (c) 2009 Mike Anchor"
+ VALUE "OriginalFilename", "ApplicationID.dll"
+ VALUE "ProductName", "ApplicationID"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj b/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj
new file mode 100644
index 0000000000..6df3794340
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ApplicationID"
+ ProjectGUID="{EBB19D89-C251-4281-BC02-04559F609530}"
+ RootNamespace="ApplicationID"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;APPLICATIONID_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ ATLMinimizesCRunTimeLibraryUsage="true"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;APPLICATIONID_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\Set.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\ApplicationID.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/other-licenses/nsis/Contrib/ApplicationID/Set.cpp b/other-licenses/nsis/Contrib/ApplicationID/Set.cpp
new file mode 100644
index 0000000000..82cb77e16f
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ApplicationID/Set.cpp
@@ -0,0 +1,219 @@
+/*
+ * Module : Set.cpp
+ * Purpose: NSIS Plug-in for setting shortcut ApplicationID property
+ * Created: 27/12/2009
+ * Original code Copyright (c) 2009 Mike Anchor.
+ */
+
+/*
+ * Additional Mozilla contributions:
+ * Unicode support
+ * Jump list deletion on uninstall
+ * Pinned item removal on uninstall
+ * contrib: <jmathies@mozilla.com>
+ */
+
+#define INITGUID
+
+#include <windows.h>
+#include <shlobj.h>
+#include <propvarutil.h>
+#include <propkey.h>
+#include <stdio.h>
+
+#pragma comment (lib, "shlwapi.lib")
+
+#define MAX_STRLEN 1024
+
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[MAX_PATH];
+} stack_t;
+
+stack_t **g_stacktop;
+unsigned int g_stringsize;
+TCHAR *g_variables;
+
+// Indicates that an application supports dual desktop and immersive modes. In Windows 8, this property is only applicable for web browsers.
+DEFINE_PROPERTYKEY(PKEY_AppUserModel_IsDualMode, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 11);
+
+int popstring(TCHAR *str, int len);
+void pushstring(const TCHAR *str, int len);
+
+extern "C" void __declspec(dllexport) Set(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
+{
+ g_stringsize = string_size;
+ g_stacktop = stacktop;
+ g_variables = variables;
+
+ {
+ IPropertyStore *m_pps = NULL;
+ WCHAR wszPath[MAX_PATH];
+ WCHAR wszAppID[MAX_PATH];
+ TCHAR szPath[MAX_PATH];
+ TCHAR szAppID[MAX_PATH];
+ TCHAR szDualMode[MAX_PATH];
+ bool success = false;
+
+ ZeroMemory(wszPath, sizeof(wszPath));
+ ZeroMemory(wszAppID, sizeof(wszAppID));
+ ZeroMemory(szPath, sizeof(szPath));
+ ZeroMemory(szAppID, sizeof(szAppID));
+ ZeroMemory(szDualMode, sizeof(szDualMode));
+
+ popstring(szPath, MAX_PATH);
+ popstring(szAppID, MAX_PATH);
+ bool dualMode = (popstring(szDualMode, MAX_PATH) == 0); // optional
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, szPath, -1, wszPath, MAX_PATH);
+ MultiByteToWideChar(CP_ACP, 0, szAppID, -1, wszAppID, MAX_PATH);
+ if (dualMode && stricmp(szDualMode, "true") != 0) {
+ dualMode = false;
+ }
+#else
+ wcscpy_s(wszPath, szPath);
+ wcscpy_s(wszAppID, szAppID);
+ if (dualMode && _wcsicmp(szDualMode, L"true") != 0) {
+ dualMode = false;
+ }
+#endif
+
+ CoInitialize(NULL);
+
+ if (SUCCEEDED(SHGetPropertyStoreFromParsingName(wszPath, NULL, GPS_READWRITE, IID_PPV_ARGS(&m_pps))))
+ {
+ PROPVARIANT propvar;
+ if (SUCCEEDED(InitPropVariantFromString(wszAppID, &propvar))) {
+ if (SUCCEEDED(m_pps->SetValue(PKEY_AppUserModel_ID, propvar))) {
+ if (dualMode) {
+ InitPropVariantFromBoolean(true, &propvar);
+ m_pps->SetValue(PKEY_AppUserModel_IsDualMode, propvar);
+ }
+ if (SUCCEEDED(m_pps->Commit())) {
+ success = true;
+ }
+ }
+ }
+ }
+ if (m_pps != NULL)
+ m_pps->Release();
+
+ CoUninitialize();
+
+ pushstring(success == true ? TEXT("0") : TEXT("-1"), MAX_PATH);
+ }
+}
+
+extern "C" void __declspec(dllexport) UninstallJumpLists(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
+{
+ g_stringsize = string_size;
+ g_stacktop = stacktop;
+ g_variables = variables;
+
+ ICustomDestinationList *m_cdl = NULL;
+ WCHAR wszAppID[MAX_PATH];
+ TCHAR szAppID[MAX_PATH];
+ bool success = false;
+
+ ZeroMemory(wszAppID, sizeof(wszAppID));
+ ZeroMemory(szAppID, sizeof(szAppID));
+
+ popstring(szAppID, MAX_PATH);
+
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, szAppID, -1, wszAppID, MAX_PATH);
+#else
+ wcscpy_s(wszAppID, szAppID);
+#endif
+
+ CoInitialize(NULL);
+
+ CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER,
+ IID_ICustomDestinationList, (void**)&m_cdl);
+
+ if (m_cdl) {
+ if (SUCCEEDED(m_cdl->DeleteList(wszAppID))) {
+ success = true;
+ }
+ }
+
+ if (m_cdl)
+ m_cdl->Release();
+
+ CoUninitialize();
+
+ pushstring(success == true ? TEXT("0") : TEXT("-1"), MAX_PATH);
+}
+
+extern "C" void __declspec(dllexport) UninstallPinnedItem(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
+{
+ g_stringsize = string_size;
+ g_stacktop = stacktop;
+ g_variables = variables;
+
+ IShellItem *pItem = NULL;
+ IStartMenuPinnedList *pPinnedList = NULL;
+ WCHAR wszPath[MAX_PATH];
+ TCHAR szPath[MAX_PATH];
+ bool success = false;
+
+ ZeroMemory(wszPath, sizeof(wszPath));
+ ZeroMemory(szPath, sizeof(szPath));
+
+ popstring(szPath, MAX_PATH);
+
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, szPath, -1, wszPath, MAX_PATH);
+#else
+ wcscpy_s(wszPath, szPath);
+#endif
+
+ CoInitialize(NULL);
+
+ HRESULT hr;
+ hr = SHCreateItemFromParsingName(wszPath, NULL, IID_PPV_ARGS(&pItem));
+
+ if (SUCCEEDED(hr)) {
+
+ hr = CoCreateInstance(CLSID_StartMenuPin,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARGS(&pPinnedList));
+
+ if (SUCCEEDED(hr)) {
+ hr = pPinnedList->RemoveFromList(pItem);
+ pPinnedList->Release();
+ success = true;
+ }
+
+ pItem->Release();
+ }
+
+ CoUninitialize();
+
+ pushstring(success == true ? TEXT("0") : TEXT("-1"), MAX_PATH);
+}
+
+//Function: Removes the element from the top of the NSIS stack and puts it in the buffer
+int popstring(TCHAR *str, int len)
+{
+ stack_t *th;
+ if (!g_stacktop || !*g_stacktop) return 1;
+ th=(*g_stacktop);
+ lstrcpyn(str,th->text, len);
+ *g_stacktop=th->next;
+ GlobalFree((HGLOBAL)th);
+ return 0;
+}
+
+//Function: Adds an element to the top of the NSIS stack
+void pushstring(const TCHAR *str, int len)
+{
+ stack_t *th;
+
+ if (!g_stacktop) return;
+ th=(stack_t*)GlobalAlloc(GPTR, sizeof(stack_t) + len);
+ lstrcpyn(th->text, str, len);
+ th->next=*g_stacktop;
+ *g_stacktop=th;
+}
diff --git a/other-licenses/nsis/Contrib/ApplicationID/resource.h b/other-licenses/nsis/Contrib/ApplicationID/resource.h
new file mode 100644
index 0000000000..03194f3a5b
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ApplicationID/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by ApplicationID.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/other-licenses/nsis/Contrib/CertCheck/CertCheck.cpp b/other-licenses/nsis/Contrib/CertCheck/CertCheck.cpp
new file mode 100644
index 0000000000..172ca22f6a
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CertCheck/CertCheck.cpp
@@ -0,0 +1,385 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <softpub.h>
+#include <wintrust.h>
+
+#pragma comment(lib, "wintrust.lib")
+#pragma comment(lib, "crypt32.lib")
+
+#ifdef UNICODE
+
+#ifndef _T
+#define __T(x) L ## x
+#define _T(x) __T(x)
+#define _TEXT(x) __T(x)
+#endif
+
+#else
+
+#ifndef _T
+#define _T(x) x
+#define _TEXT(x) x
+#endif
+
+#endif // UNICODE
+
+static const int ENCODING = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
+
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[MAX_PATH];
+} stack_t;
+
+int popstring(stack_t **stacktop, LPTSTR str, int len);
+void pushstring(stack_t **stacktop, LPCTSTR str, int len);
+
+struct CertificateCheckInfo
+{
+ LPCWSTR name;
+ LPCWSTR issuer;
+};
+
+/**
+ * Checks to see if a file stored at filePath matches the specified info. This
+ * only supports the name and issuer attributes currently.
+ *
+ * @param certContext The certificate context of the file
+ * @param infoToMatch The acceptable information to match
+ * @return FALSE if the info does not match or if any error occurs in the check
+ */
+BOOL
+DoCertificateAttributesMatch(PCCERT_CONTEXT certContext,
+ CertificateCheckInfo &infoToMatch)
+{
+ DWORD dwData;
+ LPTSTR szName = NULL;
+
+ // Pass in NULL to get the needed size of the issuer buffer.
+ dwData = CertGetNameString(certContext,
+ CERT_NAME_SIMPLE_DISPLAY_TYPE,
+ CERT_NAME_ISSUER_FLAG, NULL,
+ NULL, 0);
+
+ if (!dwData) {
+ return FALSE;
+ }
+
+ // Allocate memory for Issuer name buffer.
+ szName = (LPTSTR)LocalAlloc(LPTR, dwData * sizeof(WCHAR));
+ if (!szName) {
+ return FALSE;
+ }
+
+ // Get Issuer name.
+ if (!CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE,
+ CERT_NAME_ISSUER_FLAG, NULL, szName, dwData)) {
+ LocalFree(szName);
+ return FALSE;
+ }
+
+ // If the issuer does not match, return a failure.
+ if (!infoToMatch.issuer ||
+ wcscmp(szName, infoToMatch.issuer)) {
+ LocalFree(szName);
+ return FALSE;
+ }
+
+ LocalFree(szName);
+ szName = NULL;
+
+ // Pass in NULL to get the needed size of the name buffer.
+ dwData = CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE,
+ 0, NULL, NULL, 0);
+ if (!dwData) {
+ return FALSE;
+ }
+
+ // Allocate memory for the name buffer.
+ szName = (LPTSTR)LocalAlloc(LPTR, dwData * sizeof(WCHAR));
+ if (!szName) {
+ return FALSE;
+ }
+
+ // Obtain the name.
+ if (!(CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0,
+ NULL, szName, dwData))) {
+ LocalFree(szName);
+ return FALSE;
+ }
+
+ // If the issuer does not match, return a failure.
+ if (!infoToMatch.name ||
+ wcscmp(szName, infoToMatch.name)) {
+ LocalFree(szName);
+ return FALSE;
+ }
+
+ // We have a match!
+ LocalFree(szName);
+
+ // If there were any errors we would have aborted by now.
+ return TRUE;
+}
+
+/**
+ * Checks to see if a file stored at filePath matches the specified info. This
+ * only supports the name and issuer attributes currently.
+ *
+ * @param filePath The PE file path to check
+ * @param infoToMatch The acceptable information to match
+ * @return ERROR_SUCCESS if successful, ERROR_NOT_FOUND if the info
+ * does not match, or the last error otherwise.
+ */
+DWORD
+CheckCertificateForPEFile(LPCWSTR filePath,
+ CertificateCheckInfo &infoToMatch)
+{
+ HCERTSTORE certStore = NULL;
+ HCRYPTMSG cryptMsg = NULL;
+ PCCERT_CONTEXT certContext = NULL;
+ PCMSG_SIGNER_INFO signerInfo = NULL;
+ DWORD lastError = ERROR_SUCCESS;
+
+ // Get the HCERTSTORE and HCRYPTMSG from the signed file.
+ DWORD encoding, contentType, formatType;
+ BOOL result = CryptQueryObject(CERT_QUERY_OBJECT_FILE,
+ filePath,
+ CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED,
+ CERT_QUERY_CONTENT_FLAG_ALL,
+ 0, &encoding, &contentType,
+ &formatType, &certStore, &cryptMsg, NULL);
+ if (!result) {
+ lastError = GetLastError();
+ goto cleanup;
+ }
+
+ // Pass in NULL to get the needed signer information size.
+ DWORD signerInfoSize;
+ result = CryptMsgGetParam(cryptMsg, CMSG_SIGNER_INFO_PARAM, 0,
+ NULL, &signerInfoSize);
+ if (!result) {
+ lastError = GetLastError();
+ goto cleanup;
+ }
+
+ // Allocate the needed size for the signer information.
+ signerInfo = (PCMSG_SIGNER_INFO)LocalAlloc(LPTR, signerInfoSize);
+ if (!signerInfo) {
+ lastError = GetLastError();
+ goto cleanup;
+ }
+
+ // Get the signer information (PCMSG_SIGNER_INFO).
+ // In particular we want the issuer and serial number.
+ result = CryptMsgGetParam(cryptMsg, CMSG_SIGNER_INFO_PARAM, 0,
+ (PVOID)signerInfo, &signerInfoSize);
+ if (!result) {
+ lastError = GetLastError();
+ goto cleanup;
+ }
+
+ // Search for the signer certificate in the certificate store.
+ CERT_INFO certInfo;
+ certInfo.Issuer = signerInfo->Issuer;
+ certInfo.SerialNumber = signerInfo->SerialNumber;
+ certContext = CertFindCertificateInStore(certStore, ENCODING, 0,
+ CERT_FIND_SUBJECT_CERT,
+ (PVOID)&certInfo, NULL);
+ if (!certContext) {
+ lastError = GetLastError();
+ goto cleanup;
+ }
+
+ if (!DoCertificateAttributesMatch(certContext, infoToMatch)) {
+ lastError = ERROR_NOT_FOUND;
+ goto cleanup;
+ }
+
+cleanup:
+ if (signerInfo) {
+ LocalFree(signerInfo);
+ }
+ if (certContext) {
+ CertFreeCertificateContext(certContext);
+ }
+ if (certStore) {
+ CertCloseStore(certStore, 0);
+ }
+ if (cryptMsg) {
+ CryptMsgClose(cryptMsg);
+ }
+ return lastError;
+}
+
+/**
+ * Compares the certificate name and issuer values for a signed file's with the
+ * values provided.
+ *
+ * @param stacktop A pointer to the top of the stack. The stack should contain
+ * from the top the file's path, the expected value for the
+ * certificate's name attribute, and the expected value for
+ * the certificate's issuer attribute.
+ * @param variables A pointer to the NSIS variables
+ * @return 1 if the certificate name and issuer attributes matched the expected
+ * values, 0 if they don't match the expected values.
+ */
+extern "C" void __declspec(dllexport)
+VerifyCertNameIssuer(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop, void *extra)
+{
+ TCHAR tmp1[MAX_PATH + 1] = { _T('\0') };
+ TCHAR tmp2[MAX_PATH + 1] = { _T('\0') };
+ TCHAR tmp3[MAX_PATH + 1] = { _T('\0') };
+ WCHAR filePath[MAX_PATH + 1] = { L'\0' };
+ WCHAR certName[MAX_PATH + 1] = { L'\0' };
+ WCHAR certIssuer[MAX_PATH + 1] = { L'\0' };
+
+ popstring(stacktop, tmp1, MAX_PATH);
+ popstring(stacktop, tmp2, MAX_PATH);
+ popstring(stacktop, tmp3, MAX_PATH);
+
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, tmp1, -1, filePath, MAX_PATH);
+ MultiByteToWideChar(CP_ACP, 0, tmp2, -1, certName, MAX_PATH);
+ MultiByteToWideChar(CP_ACP, 0, tmp3, -1, certIssuer, MAX_PATH);
+#else
+ wcsncpy(filePath, tmp1, MAX_PATH);
+ wcsncpy(certName, tmp2, MAX_PATH);
+ wcsncpy(certIssuer, tmp3, MAX_PATH);
+#endif
+
+ CertificateCheckInfo allowedCertificate = {
+ certName,
+ certIssuer,
+ };
+
+ LONG retCode = CheckCertificateForPEFile(filePath, allowedCertificate);
+ if (retCode == ERROR_SUCCESS) {
+ pushstring(stacktop, TEXT("1"), 2);
+ } else {
+ pushstring(stacktop, TEXT("0"), 2);
+ }
+}
+
+/**
+ * Verifies the trust of a signed file's certificate.
+ *
+ * @param filePath The file path to check.
+ * @return ERROR_SUCCESS if successful, or the last error code otherwise.
+ */
+DWORD
+VerifyCertificateTrustForFile(LPCWSTR filePath)
+{
+ // Setup the file to check.
+ WINTRUST_FILE_INFO fileToCheck;
+ ZeroMemory(&fileToCheck, sizeof(fileToCheck));
+ fileToCheck.cbStruct = sizeof(WINTRUST_FILE_INFO);
+ fileToCheck.pcwszFilePath = filePath;
+
+ // Setup what to check, we want to check it is signed and trusted.
+ WINTRUST_DATA trustData;
+ ZeroMemory(&trustData, sizeof(trustData));
+ trustData.cbStruct = sizeof(trustData);
+ trustData.pPolicyCallbackData = NULL;
+ trustData.pSIPClientData = NULL;
+ trustData.dwUIChoice = WTD_UI_NONE;
+ trustData.fdwRevocationChecks = WTD_REVOKE_NONE;
+ trustData.dwUnionChoice = WTD_CHOICE_FILE;
+ trustData.dwStateAction = 0;
+ trustData.hWVTStateData = NULL;
+ trustData.pwszURLReference = NULL;
+ // no UI
+ trustData.dwUIContext = 0;
+ trustData.pFile = &fileToCheck;
+
+ GUID policyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
+ // Check if the file is signed by something that is trusted.
+ LONG ret = WinVerifyTrust(NULL, &policyGUID, &trustData);
+ return ret;
+}
+
+/**
+ * Verifies the trust of a signed file's certificate.
+ *
+ * @param stacktop A pointer to the top of the stack. This should be the file
+ * path for the file that will have its trust verified.
+ * @param variables A pointer to the NSIS variables
+ * @return 1 if the file's trust was verified successfully, 0 if it was not
+ */
+extern "C" void __declspec(dllexport)
+VerifyCertTrust(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop, void *extra)
+{
+ TCHAR tmp[MAX_PATH + 1] = { _T('\0') };
+ WCHAR filePath[MAX_PATH + 1] = { L'\0' };
+
+ popstring(stacktop, tmp, MAX_PATH);
+
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, tmp, -1, filePath, MAX_PATH);
+#else
+ wcsncpy(filePath, tmp, MAX_PATH);
+#endif
+
+ LONG retCode = VerifyCertificateTrustForFile(filePath);
+ if (retCode == ERROR_SUCCESS) {
+ pushstring(stacktop, TEXT("1"), 2);
+ } else {
+ pushstring(stacktop, TEXT("0"), 2);
+ }
+}
+
+BOOL WINAPI
+DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
+{
+ return TRUE;
+}
+
+/**
+ * Removes an element from the top of the NSIS stack
+ *
+ * @param stacktop A pointer to the top of the stack
+ * @param str The string to pop to
+ * @param len The max length
+ * @return 0 on success
+*/
+int popstring(stack_t **stacktop, TCHAR *str, int len)
+{
+ // Removes the element from the top of the stack and puts it in the buffer
+ stack_t *th;
+ if (!stacktop || !*stacktop) {
+ return 1;
+ }
+
+ th = (*stacktop);
+ lstrcpyn(str,th->text, len);
+ *stacktop = th->next;
+ GlobalFree((HGLOBAL)th);
+ return 0;
+}
+
+/**
+ * Adds an element to the top of the NSIS stack
+ *
+ * @param stacktop A pointer to the top of the stack
+ * @param str The string to push on the stack
+ * @param len The length of the string to push on the stack
+ * @return 0 on success
+*/
+void pushstring(stack_t **stacktop, const TCHAR *str, int len)
+{
+ stack_t *th;
+ if (!stacktop) {
+ return;
+ }
+
+ th = (stack_t*)GlobalAlloc(GPTR, sizeof(stack_t) + len);
+ lstrcpyn(th->text, str, len);
+ th->next = *stacktop;
+ *stacktop = th;
+}
diff --git a/other-licenses/nsis/Contrib/CertCheck/CertCheck.dsp b/other-licenses/nsis/Contrib/CertCheck/CertCheck.dsp
new file mode 100644
index 0000000000..b0c0625166
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CertCheck/CertCheck.dsp
@@ -0,0 +1,159 @@
+# Microsoft Developer Studio Project File - Name="CertCheck" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=CertCheck - Win32 Debug Unicode
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CertCheck.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CertCheck.mak" CFG="CertCheck - Win32 Debug Unicode"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CertCheck - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CertCheck - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CertCheck - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CertCheck - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CertCheck - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/CertCheck.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "CertCheck - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ELSEIF "$(CFG)" == "CertCheck - Win32 Release Unicode"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "CertCheck___Win32_Release_Unicode"
+# PROP BASE Intermediate_Dir "CertCheck___Win32_Release_Unicode"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_Unicode"
+# PROP Intermediate_Dir "Release_Unicode"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/CertCheck.dll" /opt:nowin98
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 wininet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /out:"./Unicode/CertCheck.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none /nodefaultlib
+
+!ELSEIF "$(CFG)" == "CertCheck - Win32 Debug Unicode"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "CertCheck___Win32_Debug_Unicode"
+# PROP BASE Intermediate_Dir "CertCheck___Win32_Debug_Unicode"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_Unicode"
+# PROP Intermediate_Dir "Debug_Unicode"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CertCheck_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "CertCheck - Win32 Release"
+# Name "CertCheck - Win32 Debug"
+# Name "CertCheck - Win32 Release Unicode"
+# Name "CertCheck - Win32 Debug Unicode"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\CertCheck.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/other-licenses/nsis/Contrib/CertCheck/CertCheck.dsw b/other-licenses/nsis/Contrib/CertCheck/CertCheck.dsw
new file mode 100644
index 0000000000..afcc201729
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CertCheck/CertCheck.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "CertCheck"=.\CertCheck.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/other-licenses/nsis/Contrib/CityHash/CityHash.cpp b/other-licenses/nsis/Contrib/CityHash/CityHash.cpp
new file mode 100644
index 0000000000..9998fb627d
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/CityHash.cpp
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "CityHash.h"
+#include "cityhash/city.h"
+#include <tchar.h>
+
+#define MAX_STRLEN 1024
+
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[MAX_STRLEN];
+} stack_t;
+
+stack_t **g_stacktop;
+char *g_variables;
+
+BOOL APIENTRY DllMain(HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved)
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+bool popString(TCHAR *result)
+{
+ stack_t *th;
+ if (!g_stacktop || !*g_stacktop) return false;
+ th = (*g_stacktop);
+ lstrcpyn(result, th->text, MAX_STRLEN);
+ *g_stacktop = th->next;
+ GlobalFree((HGLOBAL)th);
+ return true;
+}
+
+void pushString(const TCHAR *str)
+{
+ stack_t *th;
+ int strLen = wcslen(str)+1;
+ if (!g_stacktop) return;
+ th = (stack_t*)GlobalAlloc(GPTR, sizeof(stack_t) + (MAX_STRLEN*sizeof(TCHAR)));
+ lstrcpyn(th->text, str, strLen);
+ th->next = *g_stacktop;
+ *g_stacktop = th;
+}
+
+extern "C"
+{
+
+void GetCityHash64(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
+{
+ TCHAR hashString[MAX_STRLEN];
+ TCHAR hexResult[18] = { _T('\0') };
+
+ g_stacktop = stacktop;
+ g_variables = variables;
+
+ memset(hashString, 0, sizeof(hashString));
+ memset(hexResult, 0, sizeof(hexResult));
+
+ if (!popString(hashString)) {
+ pushString(L"error");
+ return;
+ }
+ uint64 result = CityHash64((const char*)&hashString[0], wcslen(hashString)*sizeof(TCHAR));
+ // If the hash happens to work out to less than 16 hash digits it will just
+ // use less of the buffer.
+ swprintf(hexResult, L"%I64X", result);
+ pushString(hexResult);
+}
+
+}
diff --git a/other-licenses/nsis/Contrib/CityHash/CityHash.def b/other-licenses/nsis/Contrib/CityHash/CityHash.def
new file mode 100644
index 0000000000..61acb6e427
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/CityHash.def
@@ -0,0 +1,3 @@
+LIBRARY CityHash
+EXPORTS
+ GetCityHash64 @1
diff --git a/other-licenses/nsis/Contrib/CityHash/CityHash.dsp b/other-licenses/nsis/Contrib/CityHash/CityHash.dsp
new file mode 100644
index 0000000000..2113913549
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/CityHash.dsp
@@ -0,0 +1,159 @@
+# Microsoft Developer Studio Project File - Name="CityHash" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=CityHash - Win32 Debug Unicode
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CityHash.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CityHash.mak" CFG="CityHash - Win32 Debug Unicode"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CityHash - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CityHash - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CityHash - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CityHash - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CityHash - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/CityHash.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "CityHash - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ELSEIF "$(CFG)" == "CityHash - Win32 Release Unicode"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "CityHash___Win32_Release_Unicode"
+# PROP BASE Intermediate_Dir "CityHash___Win32_Release_Unicode"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_Unicode"
+# PROP Intermediate_Dir "Release_Unicode"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/CityHash.dll" /opt:nowin98
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 wininet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /out:"./Unicode/CityHash.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none /nodefaultlib
+
+!ELSEIF "$(CFG)" == "CityHash - Win32 Debug Unicode"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "CityHash___Win32_Debug_Unicode"
+# PROP BASE Intermediate_Dir "CityHash___Win32_Debug_Unicode"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_Unicode"
+# PROP Intermediate_Dir "Debug_Unicode"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CityHash_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "CityHash - Win32 Release"
+# Name "CityHash - Win32 Debug"
+# Name "CityHash - Win32 Release Unicode"
+# Name "CityHash - Win32 Debug Unicode"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\CityHash.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/other-licenses/nsis/Contrib/CityHash/CityHash.dsw b/other-licenses/nsis/Contrib/CityHash/CityHash.dsw
new file mode 100644
index 0000000000..5a77a3c94b
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/CityHash.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "CityHash"=.\CityHash.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/other-licenses/nsis/Contrib/CityHash/CityHash.h b/other-licenses/nsis/Contrib/CityHash/CityHash.h
new file mode 100644
index 0000000000..fcb246e2f8
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/CityHash.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef WINVER
+#define WINVER 0x0600
+#endif
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+#endif
+
+#ifndef _WIN32_WINDOWS
+#define _WIN32_WINDOWS 0x0410
+#endif
+
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0700
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#ifdef CITYHASH_EXPORTS
+#define CITYHASH_API __declspec(dllexport)
+#else
+#define CITYHASH_API __declspec(dllimport)
+#endif
+
+#ifndef ssize_t
+typedef int ssize_t;
+#endif
diff --git a/other-licenses/nsis/Contrib/CityHash/CityHash.vcproj b/other-licenses/nsis/Contrib/CityHash/CityHash.vcproj
new file mode 100644
index 0000000000..21f4533aca
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/CityHash.vcproj
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="CityHash"
+ ProjectGUID="{D98B80BB-829B-4739-9F93-EFF7D01C69CC}"
+ RootNamespace="CityHash"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CITYHASH_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CITYHASH_EXPORTS"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\cityhash\city.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CityHash.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ CompileAsManaged="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ CompileAsManaged="0"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\cityhash\city.h"
+ >
+ </File>
+ <File
+ RelativePath=".\CityHash.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp b/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp
new file mode 100644
index 0000000000..8ac4b52349
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp
@@ -0,0 +1,307 @@
+// Copyright (c) 2011 Google, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+// CityHash Version 1, by Geoff Pike and Jyrki Alakuijala
+//
+// This file provides CityHash64() and related functions.
+//
+// It's probably possible to create even faster hash functions by
+// writing a program that systematically explores some of the space of
+// possible hash functions, by using SIMD instructions, or by
+// compromising on hash quality.
+
+#include "city.h"
+
+#include <algorithm>
+
+using namespace std;
+
+#define UNALIGNED_LOAD64(p) (*(const uint64*)(p))
+#define UNALIGNED_LOAD32(p) (*(const uint32*)(p))
+
+#if !defined(LIKELY)
+#if defined(__GNUC__)
+#define LIKELY(x) (__builtin_expect(!!(x), 1))
+#else
+#define LIKELY(x) (x)
+#endif
+#endif
+
+// Some primes between 2^63 and 2^64 for various uses.
+static const uint64 k0 = 0xc3a5c85c97cb3127;
+static const uint64 k1 = 0xb492b66fbe98f273;
+static const uint64 k2 = 0x9ae16a3b2f90404f;
+static const uint64 k3 = 0xc949d7c7509e6557;
+
+// Bitwise right rotate. Normally this will compile to a single
+// instruction, especially if the shift is a manifest constant.
+static uint64 Rotate(uint64 val, int shift) {
+ // Avoid shifting by 64: doing so yields an undefined result.
+ return shift == 0 ? val : ((val >> shift) | (val << (64 - shift)));
+}
+
+// Equivalent to Rotate(), but requires the second arg to be non-zero.
+// On x86-64, and probably others, it's possible for this to compile
+// to a single instruction if both args are already in registers.
+static uint64 RotateByAtLeast1(uint64 val, int shift) {
+ return (val >> shift) | (val << (64 - shift));
+}
+
+static uint64 ShiftMix(uint64 val) {
+ return val ^ (val >> 47);
+}
+
+static uint64 HashLen16(uint64 u, uint64 v) {
+ return Hash128to64(uint128(u, v));
+}
+
+static uint64 HashLen0to16(const char *s, size_t len) {
+ if (len > 8) {
+ uint64 a = UNALIGNED_LOAD64(s);
+ uint64 b = UNALIGNED_LOAD64(s + len - 8);
+ return HashLen16(a, RotateByAtLeast1(b + len, len)) ^ b;
+ }
+ if (len >= 4) {
+ uint64 a = UNALIGNED_LOAD32(s);
+ return HashLen16(len + (a << 3), UNALIGNED_LOAD32(s + len - 4));
+ }
+ if (len > 0) {
+ uint8 a = s[0];
+ uint8 b = s[len >> 1];
+ uint8 c = s[len - 1];
+ uint32 y = static_cast<uint32>(a) + (static_cast<uint32>(b) << 8);
+ uint32 z = len + (static_cast<uint32>(c) << 2);
+ return ShiftMix(y * k2 ^ z * k3) * k2;
+ }
+ return k2;
+}
+
+// This probably works well for 16-byte strings as well, but it may be overkill
+// in that case.
+static uint64 HashLen17to32(const char *s, size_t len) {
+ uint64 a = UNALIGNED_LOAD64(s) * k1;
+ uint64 b = UNALIGNED_LOAD64(s + 8);
+ uint64 c = UNALIGNED_LOAD64(s + len - 8) * k2;
+ uint64 d = UNALIGNED_LOAD64(s + len - 16) * k0;
+ return HashLen16(Rotate(a - b, 43) + Rotate(c, 30) + d,
+ a + Rotate(b ^ k3, 20) - c + len);
+}
+
+// Return a 16-byte hash for 48 bytes. Quick and dirty.
+// Callers do best to use "random-looking" values for a and b.
+static pair<uint64, uint64> WeakHashLen32WithSeeds(
+ uint64 w, uint64 x, uint64 y, uint64 z, uint64 a, uint64 b) {
+ a += w;
+ b = Rotate(b + a + z, 21);
+ uint64 c = a;
+ a += x;
+ a += y;
+ b += Rotate(a, 44);
+ return make_pair(a + z, b + c);
+}
+
+// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
+static pair<uint64, uint64> WeakHashLen32WithSeeds(
+ const char* s, uint64 a, uint64 b) {
+ return WeakHashLen32WithSeeds(UNALIGNED_LOAD64(s),
+ UNALIGNED_LOAD64(s + 8),
+ UNALIGNED_LOAD64(s + 16),
+ UNALIGNED_LOAD64(s + 24),
+ a,
+ b);
+}
+
+// Return an 8-byte hash for 33 to 64 bytes.
+static uint64 HashLen33to64(const char *s, size_t len) {
+ uint64 z = UNALIGNED_LOAD64(s + 24);
+ uint64 a = UNALIGNED_LOAD64(s) + (len + UNALIGNED_LOAD64(s + len - 16)) * k0;
+ uint64 b = Rotate(a + z, 52);
+ uint64 c = Rotate(a, 37);
+ a += UNALIGNED_LOAD64(s + 8);
+ c += Rotate(a, 7);
+ a += UNALIGNED_LOAD64(s + 16);
+ uint64 vf = a + z;
+ uint64 vs = b + Rotate(a, 31) + c;
+ a = UNALIGNED_LOAD64(s + 16) + UNALIGNED_LOAD64(s + len - 32);
+ z = UNALIGNED_LOAD64(s + len - 8);
+ b = Rotate(a + z, 52);
+ c = Rotate(a, 37);
+ a += UNALIGNED_LOAD64(s + len - 24);
+ c += Rotate(a, 7);
+ a += UNALIGNED_LOAD64(s + len - 16);
+ uint64 wf = a + z;
+ uint64 ws = b + Rotate(a, 31) + c;
+ uint64 r = ShiftMix((vf + ws) * k2 + (wf + vs) * k0);
+ return ShiftMix(r * k0 + vs) * k2;
+}
+
+uint64 CityHash64(const char *s, size_t len) {
+ if (len <= 32) {
+ if (len <= 16) {
+ return HashLen0to16(s, len);
+ } else {
+ return HashLen17to32(s, len);
+ }
+ } else if (len <= 64) {
+ return HashLen33to64(s, len);
+ }
+
+ // For strings over 64 bytes we hash the end first, and then as we
+ // loop we keep 56 bytes of state: v, w, x, y, and z.
+ uint64 x = UNALIGNED_LOAD64(s);
+ uint64 y = UNALIGNED_LOAD64(s + len - 16) ^ k1;
+ uint64 z = UNALIGNED_LOAD64(s + len - 56) ^ k0;
+ pair<uint64, uint64> v = WeakHashLen32WithSeeds(s + len - 64, len, y);
+ pair<uint64, uint64> w = WeakHashLen32WithSeeds(s + len - 32, len * k1, k0);
+ z += ShiftMix(v.second) * k1;
+ x = Rotate(z + x, 39) * k1;
+ y = Rotate(y, 33) * k1;
+
+ // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
+ len = (len - 1) & ~static_cast<size_t>(63);
+ do {
+ x = Rotate(x + y + v.first + UNALIGNED_LOAD64(s + 16), 37) * k1;
+ y = Rotate(y + v.second + UNALIGNED_LOAD64(s + 48), 42) * k1;
+ x ^= w.second;
+ y ^= v.first;
+ z = Rotate(z ^ w.first, 33);
+ v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
+ w = WeakHashLen32WithSeeds(s + 32, z + w.second, y);
+ std::swap(z, x);
+ s += 64;
+ len -= 64;
+ } while (len != 0);
+ return HashLen16(HashLen16(v.first, w.first) + ShiftMix(y) * k1 + z,
+ HashLen16(v.second, w.second) + x);
+}
+
+uint64 CityHash64WithSeed(const char *s, size_t len, uint64 seed) {
+ return CityHash64WithSeeds(s, len, k2, seed);
+}
+
+uint64 CityHash64WithSeeds(const char *s, size_t len,
+ uint64 seed0, uint64 seed1) {
+ return HashLen16(CityHash64(s, len) - seed0, seed1);
+}
+
+// A subroutine for CityHash128(). Returns a decent 128-bit hash for strings
+// of any length representable in ssize_t. Based on City and Murmur.
+static uint128 CityMurmur(const char *s, size_t len, uint128 seed) {
+ uint64 a = Uint128Low64(seed);
+ uint64 b = Uint128High64(seed);
+ uint64 c = 0;
+ uint64 d = 0;
+ ssize_t l = len - 16;
+ if (l <= 0) { // len <= 16
+ c = b * k1 + HashLen0to16(s, len);
+ d = Rotate(a + (len >= 8 ? UNALIGNED_LOAD64(s) : c), 32);
+ } else { // len > 16
+ c = HashLen16(UNALIGNED_LOAD64(s + len - 8) + k1, a);
+ d = HashLen16(b + len, c + UNALIGNED_LOAD64(s + len - 16));
+ a += d;
+ do {
+ a ^= ShiftMix(UNALIGNED_LOAD64(s) * k1) * k1;
+ a *= k1;
+ b ^= a;
+ c ^= ShiftMix(UNALIGNED_LOAD64(s + 8) * k1) * k1;
+ c *= k1;
+ d ^= c;
+ s += 16;
+ l -= 16;
+ } while (l > 0);
+ }
+ a = HashLen16(a, c);
+ b = HashLen16(d, b);
+ return uint128(a ^ b, HashLen16(b, a));
+}
+
+uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed) {
+ if (len < 128) {
+ return CityMurmur(s, len, seed);
+ }
+
+ // We expect len >= 128 to be the common case. Keep 56 bytes of state:
+ // v, w, x, y, and z.
+ pair<uint64, uint64> v, w;
+ uint64 x = Uint128Low64(seed);
+ uint64 y = Uint128High64(seed);
+ uint64 z = len * k1;
+ v.first = Rotate(y ^ k1, 49) * k1 + UNALIGNED_LOAD64(s);
+ v.second = Rotate(v.first, 42) * k1 + UNALIGNED_LOAD64(s + 8);
+ w.first = Rotate(y + z, 35) * k1 + x;
+ w.second = Rotate(x + UNALIGNED_LOAD64(s + 88), 53) * k1;
+
+ // This is the same inner loop as CityHash64(), manually unrolled.
+ do {
+ x = Rotate(x + y + v.first + UNALIGNED_LOAD64(s + 16), 37) * k1;
+ y = Rotate(y + v.second + UNALIGNED_LOAD64(s + 48), 42) * k1;
+ x ^= w.second;
+ y ^= v.first;
+ z = Rotate(z ^ w.first, 33);
+ v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
+ w = WeakHashLen32WithSeeds(s + 32, z + w.second, y);
+ std::swap(z, x);
+ s += 64;
+ x = Rotate(x + y + v.first + UNALIGNED_LOAD64(s + 16), 37) * k1;
+ y = Rotate(y + v.second + UNALIGNED_LOAD64(s + 48), 42) * k1;
+ x ^= w.second;
+ y ^= v.first;
+ z = Rotate(z ^ w.first, 33);
+ v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
+ w = WeakHashLen32WithSeeds(s + 32, z + w.second, y);
+ std::swap(z, x);
+ s += 64;
+ len -= 128;
+ } while (LIKELY(len >= 128));
+ y += Rotate(w.first, 37) * k0 + z;
+ x += Rotate(v.first + z, 49) * k0;
+ // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s.
+ for (size_t tail_done = 0; tail_done < len; ) {
+ tail_done += 32;
+ y = Rotate(y - x, 42) * k0 + v.second;
+ w.first += UNALIGNED_LOAD64(s + len - tail_done + 16);
+ x = Rotate(x, 49) * k0 + w.first;
+ w.first += v.first;
+ v = WeakHashLen32WithSeeds(s + len - tail_done, v.first, v.second);
+ }
+ // At this point our 48 bytes of state should contain more than
+ // enough information for a strong 128-bit hash. We use two
+ // different 48-byte-to-8-byte hashes to get a 16-byte final result.
+ x = HashLen16(x, v.first);
+ y = HashLen16(y, w.first);
+ return uint128(HashLen16(x + v.second, w.second) + y,
+ HashLen16(x + w.second, y + v.second));
+}
+
+uint128 CityHash128(const char *s, size_t len) {
+ if (len >= 16) {
+ return CityHash128WithSeed(s + 16,
+ len - 16,
+ uint128(UNALIGNED_LOAD64(s) ^ k3,
+ UNALIGNED_LOAD64(s + 8)));
+ } else if (len >= 8) {
+ return CityHash128WithSeed(NULL,
+ 0,
+ uint128(UNALIGNED_LOAD64(s) ^ (len * k0),
+ UNALIGNED_LOAD64(s + len - 8) ^ k1));
+ } else {
+ return CityHash128WithSeed(s, len, uint128(k0, k1));
+ }
+}
diff --git a/other-licenses/nsis/Contrib/CityHash/cityhash/city.h b/other-licenses/nsis/Contrib/CityHash/cityhash/city.h
new file mode 100644
index 0000000000..6d9e13dc55
--- /dev/null
+++ b/other-licenses/nsis/Contrib/CityHash/cityhash/city.h
@@ -0,0 +1,91 @@
+// Copyright (c) 2011 Google, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+// CityHash Version 1, by Geoff Pike and Jyrki Alakuijala
+//
+// This file provides a few functions for hashing strings. On x86-64
+// hardware in 2011, CityHash64() is faster than other high-quality
+// hash functions, such as Murmur. This is largely due to higher
+// instruction-level parallelism. CityHash64() and CityHash128() also perform
+// well on hash-quality tests.
+//
+// CityHash128() is optimized for relatively long strings and returns
+// a 128-bit hash. For strings more than about 2000 bytes it can be
+// faster than CityHash64().
+//
+// Functions in the CityHash family are not suitable for cryptography.
+//
+// WARNING: This code has not been tested on big-endian platforms!
+// It is known to work well on little-endian platforms that have a small penalty
+// for unaligned reads, such as current Intel and AMD moderate-to-high-end CPUs.
+//
+// By the way, for some hash functions, given strings a and b, the hash
+// of a+b is easily derived from the hashes of a and b. This property
+// doesn't hold for any hash functions in this file.
+
+#ifndef CITY_HASH_H_
+#define CITY_HASH_H_
+
+#include "../CityHash.h" // added by moz, specific to nsis project
+
+#include <stdlib.h> // for size_t.
+#include <utility>
+
+typedef unsigned __int8 uint8;
+typedef unsigned __int32 uint32;
+typedef unsigned __int64 uint64;
+typedef std::pair<uint64, uint64> uint128;
+
+inline uint64 Uint128Low64(const uint128& x) { return x.first; }
+inline uint64 Uint128High64(const uint128& x) { return x.second; }
+
+// Hash function for a byte array.
+uint64 CityHash64(const char *buf, size_t len);
+
+// Hash function for a byte array. For convenience, a 64-bit seed is also
+// hashed into the result.
+uint64 CityHash64WithSeed(const char *buf, size_t len, uint64 seed);
+
+// Hash function for a byte array. For convenience, two seeds are also
+// hashed into the result.
+uint64 CityHash64WithSeeds(const char *buf, size_t len,
+ uint64 seed0, uint64 seed1);
+
+// Hash function for a byte array.
+uint128 CityHash128(const char *s, size_t len);
+
+// Hash function for a byte array. For convenience, a 128-bit seed is also
+// hashed into the result.
+uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed);
+
+// Hash 128 input bits down to 64 bits of output.
+// This is intended to be a reasonably good hash function.
+inline uint64 Hash128to64(const uint128& x) {
+ // Murmur-inspired hashing.
+ const uint64 kMul = 0x9ddfea08eb382d69;
+ uint64 a = (Uint128Low64(x) ^ Uint128High64(x)) * kMul;
+ a ^= (a >> 47);
+ uint64 b = (Uint128High64(x) ^ a) * kMul;
+ b ^= (b >> 47);
+ b *= kMul;
+ return b;
+}
+
+#endif // CITY_HASH_H_
diff --git a/other-licenses/nsis/Contrib/ExDLL/SConscript b/other-licenses/nsis/Contrib/ExDLL/SConscript
new file mode 100644
index 0000000000..2c6308545f
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/SConscript
@@ -0,0 +1,25 @@
+# FIXME: install assembly and pascal includes into the correct locations
+
+c_devel = Split("""
+ exdll.h
+""")
+
+example = Split("""
+ exdll.c
+ exdll.dpr
+ exdll.dsp
+ exdll.dsw
+ exdll_with_unit.dpr
+ nsis.pas
+ extdll.inc
+""")
+
+Import('defenv')
+
+if defenv['PLATFORM'] == 'win32':
+ example += c_devel
+else:
+ defenv.DistributeIncC(c_devel)
+
+defenv.DistributeExamples(example, path='Plugin')
+
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdll.c b/other-licenses/nsis/Contrib/ExDLL/exdll.c
new file mode 100644
index 0000000000..c46e621a03
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdll.c
@@ -0,0 +1,44 @@
+// Unicode support by Jim Park -- 08/02/2007
+
+#include <windows.h>
+#include "tchar.h"
+#include "exdll.h"
+
+HINSTANCE g_hInstance;
+
+HWND g_hwndParent;
+
+// To work with Unicode version of NSIS, please use TCHAR-type
+// functions for accessing the variables and the stack.
+
+void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop,
+ extra_parameters *extra)
+{
+ g_hwndParent=hwndParent;
+
+ EXDLL_INIT();
+
+
+ // note if you want parameters from the stack, pop them off in order.
+ // i.e. if you are called via exdll::myFunction file.dat poop.dat
+ // calling popstring() the first time would give you file.dat,
+ // and the second time would give you poop.dat.
+ // you should empty the stack of your parameters, and ONLY your
+ // parameters.
+
+ // do your stuff here
+ {
+ TCHAR buf[1024];
+ wsprintf(buf,_T("$0=%s\n"),getuservariable(INST_0));
+ MessageBox(g_hwndParent,buf,0,MB_OK);
+ }
+}
+
+
+
+BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
+{
+ g_hInstance=hInst;
+ return TRUE;
+}
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdll.dpr b/other-licenses/nsis/Contrib/ExDLL/exdll.dpr
new file mode 100644
index 0000000000..ab3f03d3dd
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdll.dpr
@@ -0,0 +1,118 @@
+{
+ NSIS ExDLL example
+ (C) 2001 - Peter Windridge
+
+ Fixed and formatted by Brett Dever
+ http://editor.nfscheats.com/
+
+ Tested in Delphi 7.0
+}
+
+library exdll;
+
+uses Windows;
+
+type
+ VarConstants = (
+ INST_0,
+ INST_1, // $1
+ INST_2, // $2
+ INST_3, // $3
+ INST_4, // $4
+ INST_5, // $5
+ INST_6, // $6
+ INST_7, // $7
+ INST_8, // $8
+ INST_9, // $9
+ INST_R0, // $R0
+ INST_R1, // $R1
+ INST_R2, // $R2
+ INST_R3, // $R3
+ INST_R4, // $R4
+ INST_R5, // $R5
+ INST_R6, // $R6
+ INST_R7, // $R7
+ INST_R8, // $R8
+ INST_R9, // $R9
+ INST_CMDLINE, // $CMDLINE
+ INST_INSTDIR, // $INSTDIR
+ INST_OUTDIR, // $OUTDIR
+ INST_EXEDIR, // $EXEDIR
+ INST_LANG, // $LANGUAGE
+ __INST_LAST
+ );
+ TVariableList = INST_0..__INST_LAST;
+ pstack_t = ^stack_t;
+ stack_t = record
+ next: pstack_t;
+ text: PChar;
+ end;
+
+var
+ g_stringsize: integer;
+ g_stacktop: ^pstack_t;
+ g_variables: PChar;
+ g_hwndParent: HWND;
+
+function PopString(): string;
+var
+ th: pstack_t;
+begin
+ if integer(g_stacktop^) <> 0 then begin
+ th := g_stacktop^;
+ Result := PChar(@th.text);
+ g_stacktop^ := th.next;
+ GlobalFree(HGLOBAL(th));
+ end;
+end;
+
+procedure PushString(const str: string='');
+var
+ th: pstack_t;
+begin
+ if integer(g_stacktop) <> 0 then begin
+ th := pstack_t(GlobalAlloc(GPTR, SizeOf(stack_t) + g_stringsize));
+ lstrcpyn(@th.text, PChar(str), g_stringsize);
+ th.next := g_stacktop^;
+ g_stacktop^ := th;
+ end;
+end;
+
+function GetUserVariable(const varnum: TVariableList): string;
+begin
+ if (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
+ Result := g_variables + integer(varnum) * g_stringsize
+ else
+ Result := '';
+end;
+
+procedure SetUserVariable(const varnum: TVariableList; const value: string);
+begin
+ if (value <> '') and (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
+ lstrcpy(g_variables + integer(varnum) * g_stringsize, PChar(value))
+end;
+
+procedure NSISDialog(const text, caption: string; const buttons: integer);
+begin
+ MessageBox(g_hwndParent, PChar(text), PChar(caption), buttons);
+end;
+
+procedure ex_dll(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
+begin
+ // setup global variables
+ g_stringsize := string_size;
+ g_hwndParent := hwndParent;
+ g_stacktop := stacktop;
+ g_variables := variables;
+ // end global variable setup
+
+ NSISDialog(GetUserVariable(INST_0), 'The value of $0', MB_OK);
+ NSISDialog(PopString, 'pop', MB_OK);
+ PushString('Hello, this is a push');
+ SetUserVariable(INST_0, 'This is user var $0');
+end;
+
+exports ex_dll;
+
+begin
+end.
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdll.dsp b/other-licenses/nsis/Contrib/ExDLL/exdll.dsp
new file mode 100644
index 0000000000..9888726515
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdll.dsp
@@ -0,0 +1,111 @@
+# Microsoft Developer Studio Project File - Name="exdll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=exdll - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "exdll.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "exdll.mak" CFG="exdll - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "exdll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "exdll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "exdll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/exdll.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "exdll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "exdll - Win32 Release"
+# Name "exdll - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\exdll.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\exdll.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdll.dsw b/other-licenses/nsis/Contrib/ExDLL/exdll.dsw
new file mode 100644
index 0000000000..f40ce32de8
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdll.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "exdll"=.\exdll.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdll.h b/other-licenses/nsis/Contrib/ExDLL/exdll.h
new file mode 100644
index 0000000000..c923c5197d
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdll.h
@@ -0,0 +1,234 @@
+// Unicode support added by Jim Park -- 07/27/2007
+// Unicode support requires that all plugins take TCHARs instead as well. This
+// means existing plugins will not work for the Unicode version of NSIS unless
+// recompiled. You have been warned.
+
+#ifndef _EXDLL_H_
+#define _EXDLL_H_
+
+#include <windows.h>
+#include "tchar.h"
+
+#if defined(__GNUC__)
+#define UNUSED __attribute__((unused))
+#else
+#define UNUSED
+#endif
+
+// only include this file from one place in your DLL.
+// (it is all static, if you use it in two places it will fail)
+
+#define EXDLL_INIT() { \
+ g_stringsize=string_size; \
+ g_stacktop=stacktop; \
+ g_variables=variables; }
+
+// For page showing plug-ins
+#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
+#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
+
+/* Jim Park: This char is compared as an int value and therefore
+ it's fine as an ASCII. Do not need to change to wchar_t since
+ it will get the same integer value. */
+#define NOTIFY_BYE_BYE _T('x')
+
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[1]; // this should be the length of string_size
+} stack_t;
+
+
+static unsigned int g_stringsize;
+static stack_t **g_stacktop;
+static TCHAR *g_variables;
+
+static int __stdcall popstring(TCHAR *str) UNUSED; // 0 on success, 1 on empty stack
+static void __stdcall pushstring(const TCHAR *str) UNUSED;
+static TCHAR * __stdcall getuservariable(const int varnum) UNUSED;
+static void __stdcall setuservariable(const int varnum, const TCHAR *var) UNUSED;
+
+enum
+{
+INST_0, // $0
+INST_1, // $1
+INST_2, // $2
+INST_3, // $3
+INST_4, // $4
+INST_5, // $5
+INST_6, // $6
+INST_7, // $7
+INST_8, // $8
+INST_9, // $9
+INST_R0, // $R0
+INST_R1, // $R1
+INST_R2, // $R2
+INST_R3, // $R3
+INST_R4, // $R4
+INST_R5, // $R5
+INST_R6, // $R6
+INST_R7, // $R7
+INST_R8, // $R8
+INST_R9, // $R9
+INST_CMDLINE, // $CMDLINE
+INST_INSTDIR, // $INSTDIR
+INST_OUTDIR, // $OUTDIR
+INST_EXEDIR, // $EXEDIR
+INST_LANG, // $LANGUAGE
+__INST_LAST
+};
+
+typedef struct {
+ int autoclose;
+ int all_user_var;
+ int exec_error;
+ int abort;
+ int exec_reboot;
+ int reboot_called;
+ int XXX_cur_insttype; // deprecated
+ int XXX_insttype_changed; // deprecated
+ int silent;
+ int instdir_error;
+ int rtl;
+ int errlvl;
+ int alter_reg_view;
+ int status_update;
+} exec_flags_type;
+
+typedef struct {
+ exec_flags_type *exec_flags;
+ int (__stdcall *ExecuteCodeSegment)(int, HWND);
+ void (__stdcall *validate_filename)(TCHAR *);
+} extra_parameters;
+
+// utility functions (not required but often useful)
+static int __stdcall popstring(TCHAR *str)
+{
+ stack_t *th;
+ if (!g_stacktop || !*g_stacktop) return 1;
+ th=(*g_stacktop);
+ lstrcpy(str,th->text);
+ *g_stacktop = th->next;
+ GlobalFree((HGLOBAL)th);
+ return 0;
+}
+
+static void __stdcall pushstring(const TCHAR *str)
+{
+ stack_t *th;
+ if (!g_stacktop) return;
+ th=(stack_t*)GlobalAlloc(GPTR,(sizeof(stack_t)+(g_stringsize)*sizeof(TCHAR)));
+ lstrcpyn(th->text,str,g_stringsize);
+ th->next=*g_stacktop;
+ *g_stacktop=th;
+}
+
+static TCHAR * __stdcall getuservariable(const int varnum)
+{
+ if (varnum < 0 || varnum >= __INST_LAST) return NULL;
+ return g_variables+varnum*g_stringsize;
+}
+
+static void __stdcall setuservariable(const int varnum, const TCHAR *var)
+{
+ if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
+ lstrcpy(g_variables + varnum*g_stringsize, var);
+}
+
+#ifdef _UNICODE
+#define PopStringW(x) popstring(x)
+#define PushStringW(x) pushstring(x)
+#define SetUserVariableW(x,y) setuservariable(x,y)
+
+static int __stdcall PopStringA(char* ansiStr)
+{
+ wchar_t* wideStr = (wchar_t*) GlobalAlloc(GPTR, g_stringsize*sizeof(wchar_t));
+ int rval = popstring(wideStr);
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+ GlobalFree((HGLOBAL)wideStr);
+ return rval;
+}
+
+static void __stdcall PushStringA(const char* ansiStr)
+{
+ wchar_t* wideStr = (wchar_t*) GlobalAlloc(GPTR, g_stringsize*sizeof(wchar_t));
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+ pushstring(wideStr);
+ GlobalFree((HGLOBAL)wideStr);
+ return;
+}
+
+static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr)
+{
+ lstrcpyW(wideStr, getuservariable(varnum));
+}
+
+static void __stdcall GetUserVariableA(const int varnum, char* ansiStr)
+{
+ wchar_t* wideStr = getuservariable(varnum);
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+}
+
+static void __stdcall SetUserVariableA(const int varnum, const char* ansiStr)
+{
+ if (ansiStr != NULL && varnum >= 0 && varnum < __INST_LAST)
+ {
+ wchar_t* wideStr = g_variables + varnum * g_stringsize;
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+ }
+}
+
+#else
+// ANSI defs
+
+#define PopStringA(x) popstring(x)
+#define PushStringA(x) pushstring(x)
+#define SetUserVariableA(x,y) setuservariable(x,y)
+
+static int __stdcall PopStringW(wchar_t* wideStr)
+{
+ char* ansiStr = (char*) GlobalAlloc(GPTR, g_stringsize);
+ int rval = popstring(ansiStr);
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+ GlobalFree((HGLOBAL)ansiStr);
+ return rval;
+}
+
+static void __stdcall PushStringW(wchar_t* wideStr)
+{
+ char* ansiStr = (char*) GlobalAlloc(GPTR, g_stringsize);
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+ pushstring(ansiStr);
+ GlobalFree((HGLOBAL)ansiStr);
+}
+
+static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr)
+{
+ char* ansiStr = getuservariable(varnum);
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+}
+
+static void __stdcall GetUserVariableA(const int varnum, char* ansiStr)
+{
+ lstrcpyA(ansiStr, getuservariable(varnum));
+}
+
+static void __stdcall SetUserVariableW(const int varnum, const wchar_t* wideStr)
+{
+ if (wideStr != NULL && varnum >= 0 && varnum < __INST_LAST)
+ {
+ char* ansiStr = g_variables + varnum * g_stringsize;
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+ }
+}
+#endif
+
+static BOOL __stdcall IsUnicode(void)
+{
+#ifdef _UNICODE
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+#endif//_EXDLL_H_
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdll_with_unit.dpr b/other-licenses/nsis/Contrib/ExDLL/exdll_with_unit.dpr
new file mode 100644
index 0000000000..007e350dc0
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdll_with_unit.dpr
@@ -0,0 +1,31 @@
+{
+ NSIS ExDLL2 example
+ Original is ExDLL
+ (C) 2001 - Peter Windridge
+
+ Changed with delphi unit nsis.pas
+ by bernhard mayer
+
+ Tested in Delphi 7.0
+}
+
+library exdll;
+
+uses
+ nsis, windows;
+
+procedure ex_dll(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
+begin
+ // set up global variables
+ Init(hwndParent, string_size, variables, stacktop);
+
+ NSISDialog(GetUserVariable(INST_0), 'The value of $0', MB_OK);
+ NSISDialog(PopString, 'pop', MB_OK);
+ PushString('Hello, this is a push');
+ SetUserVariable(INST_0, 'This is user var $0');
+end;
+
+exports ex_dll;
+
+begin
+end.
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdllutil.cpp b/other-licenses/nsis/Contrib/ExDLL/exdllutil.cpp
new file mode 100644
index 0000000000..f1413767aa
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdllutil.cpp
@@ -0,0 +1,131 @@
+// Unicode support by Jim Park -- 08/23/2007
+
+#include <windows.h>
+#include "exdllutil.h"
+
+// utility functions (not required but often useful)
+static int __stdcall popstring(TCHAR *str)
+{
+ stack_t *th;
+ if (!g_stacktop || !*g_stacktop) return 1;
+ th=(*g_stacktop);
+ lstrcpy(str,th->text);
+ *g_stacktop = th->next;
+ GlobalFree((HGLOBAL)th);
+ return 0;
+}
+
+static void __stdcall pushstring(const TCHAR *str)
+{
+ stack_t *th;
+ if (!g_stacktop) return;
+ th=(stack_t*)GlobalAlloc(GPTR,(sizeof(stack_t)+(g_stringsize)*sizeof(TCHAR)));
+ lstrcpyn(th->text,str,g_stringsize);
+ th->next=*g_stacktop;
+ *g_stacktop=th;
+}
+
+static TCHAR * __stdcall getuservariable(const int varnum)
+{
+ if (varnum < 0 || varnum >= __INST_LAST) return NULL;
+ return g_variables+varnum*g_stringsize;
+}
+
+static void __stdcall setuservariable(const int varnum, const TCHAR *var)
+{
+ if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
+ lstrcpy(g_variables + varnum*g_stringsize, var);
+}
+
+#ifdef _UNICODE
+static int __stdcall PopStringA(char* ansiStr)
+{
+ wchar_t* wideStr = (wchar_t*) GlobalAlloc(GPTR, g_stringsize*sizeof(wchar_t));
+ int rval = popstring(wideStr);
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+ GlobalFree((HGLOBAL)wideStr);
+ return rval;
+}
+
+static void __stdcall PushStringA(const char* ansiStr)
+{
+ wchar_t* wideStr = (wchar_t*) GlobalAlloc(GPTR, g_stringsize*sizeof(wchar_t));
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+ pushtring(wideStr);
+ GlobalFree((HGLOBAL)wideStr);
+ return;
+}
+
+static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr)
+{
+ lstrcpyW(wideStr, getuservariable(varnum));
+}
+
+static void __stdcall GetUserVariableA(const int varnum, char* ansiStr)
+{
+ wchar_t* wideStr = getuservariable(varnum);
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+}
+
+static void __stdcall SetUserVariableA(const int varnum, const char* ansiStr)
+{
+ if (ansiStr != NULL && varnum >= 0 && varnum < __INST_LAST)
+ {
+ wchar_t* wideStr = g_variables + varnum * g_stringsize;
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+ }
+}
+
+#else
+// ANSI defs
+static int __stdcall PopStringW(wchar_t* wideStr)
+{
+ char* ansiStr = (char*) GlobalAlloc(GPTR, g_stringsize);
+ int rval = popstring(ansiStr);
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+ GlobalFree((HGLOBAL)ansiStr);
+ return rval;
+}
+
+static void __stdcall PushStringW(wchar_t* wideStr)
+{
+ char* ansiStr = (char*) GlobalAlloc(GPTR, g_stringsize);
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+ pushstring(ansiStr);
+ GlobalFree((HGLOBAL)ansiStr);
+}
+
+static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr)
+{
+ char* ansiStr = getuservariable(varnum);
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
+}
+
+static void __stdcall GetUserVariableA(const int varnum, char* ansiStr)
+{
+ lstrcpyA(ansiStr, getuservariable(varnum));
+}
+
+static void __stdcall SetUserVariableW(const int varnum, const wchar_t* wideStr)
+{
+ if (wideStr != NULL && varnum >= 0 && varnum < __INST_LAST)
+ {
+ char* ansiStr = g_variables + varnum * g_stringsize;
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
+ }
+}
+#endif
+
+static BOOL __stdcall IsUnicode(void)
+{
+#ifdef _UNICODE
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+static TCHAR* __stdcall AllocString()
+{
+ return (TCHAR*) GlobalAlloc(GPTR, g_stringsize*sizeof(TCHAR));
+}
diff --git a/other-licenses/nsis/Contrib/ExDLL/exdllutil.h b/other-licenses/nsis/Contrib/ExDLL/exdllutil.h
new file mode 100644
index 0000000000..51897fc643
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/exdllutil.h
@@ -0,0 +1,119 @@
+// Unicode support by Jim Park -- 08/23/2007
+// Jim Park: Should probably turn this into a nice class for C++ programs.
+
+#pragma once
+#include <windows.h>
+#include <tchar.h>
+// only include this file from one place in your DLL.
+// (it is all static, if you use it in two places it will fail)
+
+#define EXDLL_INIT() { \
+ g_stringsize=string_size; \
+ g_stacktop=stacktop; \
+ g_variables=variables; }
+
+// For page showing plug-ins
+#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
+#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
+
+/* Jim Park: This char is compared as an int value and therefore
+ it's fine as an ASCII. Do not need to change to wchar_t since
+ it will get the same integer value. */
+#define NOTIFY_BYE_BYE _T('x')
+
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[1]; // this should be the length of string_size
+} stack_t;
+
+static unsigned int g_stringsize;
+static stack_t **g_stacktop;
+static TCHAR *g_variables;
+
+
+enum
+{
+INST_0, // $0
+INST_1, // $1
+INST_2, // $2
+INST_3, // $3
+INST_4, // $4
+INST_5, // $5
+INST_6, // $6
+INST_7, // $7
+INST_8, // $8
+INST_9, // $9
+INST_R0, // $R0
+INST_R1, // $R1
+INST_R2, // $R2
+INST_R3, // $R3
+INST_R4, // $R4
+INST_R5, // $R5
+INST_R6, // $R6
+INST_R7, // $R7
+INST_R8, // $R8
+INST_R9, // $R9
+INST_CMDLINE, // $CMDLINE
+INST_INSTDIR, // $INSTDIR
+INST_OUTDIR, // $OUTDIR
+INST_EXEDIR, // $EXEDIR
+INST_LANG, // $LANGUAGE
+__INST_LAST
+};
+
+typedef struct {
+ int autoclose;
+ int all_user_var;
+ int exec_error;
+ int abort;
+ int exec_reboot;
+ int reboot_called;
+ int XXX_cur_insttype; // deprecated
+ int XXX_insttype_changed; // deprecated
+ int silent;
+ int instdir_error;
+ int rtl;
+ int errlvl;
+ int alter_reg_view;
+} exec_flags_type;
+
+typedef struct {
+ exec_flags_type *exec_flags;
+ int (__stdcall *ExecuteCodeSegment)(int, HWND);
+ void (__stdcall *validate_filename)(TCHAR *);
+} extra_parameters;
+
+static int __stdcall popstring(TCHAR *str); // 0 on success, 1 on empty stack
+static void __stdcall pushstring(const TCHAR *str);
+static char * __stdcall getuservariable(const int varnum);
+static void __stdcall setuservariable(const int varnum, const TCHAR *var);
+
+#ifdef _UNICODE
+#define PopStringW(x) popstring(x)
+#define PushStringW(x) pushstring(x)
+#define SetUserVariableW(x,y) setuservariable(x,y)
+
+static int __stdcall PopStringA(char* ansiStr);
+static void __stdcall PushStringA(const char* ansiStr);
+static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr);
+static void __stdcall GetUserVariableA(const int varnum, char* ansiStr);
+static void __stdcall SetUserVariableA(const int varnum, const char* ansiStr);
+
+#else
+// ANSI defs
+
+#define PopStringA(x) popstring(x)
+#define PushStringA(x) pushstring(x)
+#define SetUserVariableA(x,y) setuservariable(x,y)
+
+static int __stdcall PopStringW(wchar_t* wideStr);
+static void __stdcall PushStringW(wchar_t* wideStr);
+static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr);
+static void __stdcall GetUserVariableA(const int varnum, char* ansiStr);
+static void __stdcall SetUserVariableW(const int varnum, const wchar_t* wideStr);
+
+#endif
+
+static BOOL __stdcall IsUnicode(void)
+static TCHAR* __stdcall AllocString();
+
diff --git a/other-licenses/nsis/Contrib/ExDLL/extdll.inc b/other-licenses/nsis/Contrib/ExDLL/extdll.inc
new file mode 100644
index 0000000000..4c48ae5ce5
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/extdll.inc
@@ -0,0 +1,145 @@
+;################################################################
+; ExtDLL header for MASM32
+;
+; Author: Ramon
+;
+; Obs: This header must be included after windows.inc and kernel32.inc
+; because it need the prototypes for lstrcpy, lstrcpyn,
+; GlobalAlloc and GlobalFree
+;
+;################################################################
+stack_t struct
+ next dd ?
+ text dd ? ; 1 DUP(?) ; this should be the length of string_size
+stack_t ends
+
+.const
+; For page showing plug-ins
+WM_NOTIFY_OUTER_NEXT equ (WM_USER+0x8)
+WM_NOTIFY_CUSTOM_READY equ (WM_USER+0xd)
+NOTIFY_BYE_BYE equ 'x'
+
+INST_0 EQU 0 ; $0
+INST_1 EQU 1 ; $1
+INST_2 EQU 2 ; $2
+INST_3 EQU 3 ; $3
+INST_4 EQU 4 ; $4
+INST_5 EQU 5 ; $5
+INST_6 EQU 6 ; $6
+INST_7 EQU 7 ; $7
+INST_8 EQU 8 ; $8
+INST_9 EQU 9 ; $9
+INST_R0 EQU 10 ; $R0
+INST_R1 EQU 11 ; $R1
+INST_R2 EQU 12 ; $R2
+INST_R3 EQU 13 ; $R3
+INST_R4 EQU 14 ; $R4
+INST_R5 EQU 15 ; $R5
+INST_R6 EQU 16 ; $R6
+INST_R7 EQU 17 ; $R7
+INST_R8 EQU 18 ; $R8
+INST_R9 EQU 19 ; $R9
+INST_CMDLINE EQU 20 ; $CMDLINE
+INST_INSTDIR EQU 21 ; $INSTDIR
+INST_OUTDIR EQU 22 ; $OUTDIR
+INST_EXEDIR EQU 23 ; $EXEDIR
+INST_LANG EQU 24 ; $LANGUAGE
+__INST_LAST EQU 25
+
+.data?
+g_stringsize dd ?
+g_stacktop dd ?
+g_variables dd ?
+
+m2m MACRO M1, M2
+ push M2
+ pop M1
+ENDM
+
+EXDLL_INIT MACRO
+ m2m g_stringsize, string_size
+ m2m g_stacktop, stacktop
+ m2m g_variables, variables
+ENDM
+
+.code
+
+; utility functions (not required but often useful)
+popstring proc uses edi pStr:DWORD
+
+ LOCAL th:DWORD
+
+ mov edi, g_stacktop
+ cmp edi, 0
+ jz STACK_ERR
+ mov edi, [edi]
+ cmp edi, 0
+ jz STACK_ERR
+
+ ASSUME edi:PTR stack_t
+ invoke lstrcpy, pStr, ADDR [edi].text
+ mov th , edi
+ mov edi, [edi].next
+ mov eax, g_stacktop
+ mov [eax], edi
+ invoke GlobalFree, th
+ ASSUME edi:PTR NOTHING
+ mov eax, 0
+ ret
+
+STACK_ERR:
+ mov eax, 1
+ ret
+
+popstring endp
+
+pushstring proc uses edi pStr:DWORD
+
+ cmp g_stacktop, 0
+ jz STACK_ERR
+
+ mov eax, sizeof stack_t
+ add eax, g_stringsize
+ invoke GlobalAlloc, GPTR, eax
+
+ mov edi, eax
+ assume edi:PTR stack_t
+
+ invoke lstrcpyn, ADDR [edi].text, pStr, g_stringsize
+ mov eax, g_stacktop
+ push DWORD PTR[eax]
+ mov [eax], edi
+ pop eax
+ ;lea edi, [edi].next ; Not needed [edi].next == edi
+ mov DWORD PTR[edi], eax
+ ASSUME edi:PTR NOTHING
+
+STACK_ERR:
+ ret
+
+pushstring endp
+
+getuservariable proc varnum:DWORD
+
+ .if varnum < 0 || varnum >= __INST_LAST
+ xor eax, eax
+ .else
+ mov eax, varnum
+ imul eax, g_stringsize
+ add eax, g_variables
+ .endif
+ ret
+
+getuservariable endp
+
+setuservariable proc varnum:DWORD, var:DWORD
+
+ .if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
+ mov eax, varnum
+ imul eax, g_stringsize
+ add eax, g_variables
+ invoke lstrcpy, eax, var
+ .endif
+ ret
+
+setuservariable endp
diff --git a/other-licenses/nsis/Contrib/ExDLL/nsis.pas b/other-licenses/nsis/Contrib/ExDLL/nsis.pas
new file mode 100644
index 0000000000..356d26cbde
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/nsis.pas
@@ -0,0 +1,126 @@
+{
+ Original Code from
+ (C) 2001 - Peter Windridge
+
+ Code in seperate unit and some changes
+ 2003 by Bernhard Mayer
+
+ Fixed and formatted by Brett Dever
+ http://editor.nfscheats.com/
+
+ simply include this unit in your plugin project and export
+ functions as needed
+}
+
+
+unit nsis;
+
+interface
+
+uses
+ windows;
+
+type
+ VarConstants = (
+ INST_0, // $0
+ INST_1, // $1
+ INST_2, // $2
+ INST_3, // $3
+ INST_4, // $4
+ INST_5, // $5
+ INST_6, // $6
+ INST_7, // $7
+ INST_8, // $8
+ INST_9, // $9
+ INST_R0, // $R0
+ INST_R1, // $R1
+ INST_R2, // $R2
+ INST_R3, // $R3
+ INST_R4, // $R4
+ INST_R5, // $R5
+ INST_R6, // $R6
+ INST_R7, // $R7
+ INST_R8, // $R8
+ INST_R9, // $R9
+ INST_CMDLINE, // $CMDLINE
+ INST_INSTDIR, // $INSTDIR
+ INST_OUTDIR, // $OUTDIR
+ INST_EXEDIR, // $EXEDIR
+ INST_LANG, // $LANGUAGE
+ __INST_LAST
+ );
+ TVariableList = INST_0..__INST_LAST;
+ pstack_t = ^stack_t;
+ stack_t = record
+ next: pstack_t;
+ text: PChar;
+ end;
+
+var
+ g_stringsize: integer;
+ g_stacktop: ^pstack_t;
+ g_variables: PChar;
+ g_hwndParent: HWND;
+
+procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer);
+function PopString(): string;
+procedure PushString(const str: string='');
+function GetUserVariable(const varnum: TVariableList): string;
+procedure SetUserVariable(const varnum: TVariableList; const value: string);
+procedure NSISDialog(const text, caption: string; const buttons: integer);
+
+implementation
+
+procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer);
+begin
+ g_stringsize := string_size;
+ g_hwndParent := hwndParent;
+ g_stacktop := stacktop;
+ g_variables := variables;
+end;
+
+function PopString(): string;
+var
+ th: pstack_t;
+begin
+ if integer(g_stacktop^) <> 0 then begin
+ th := g_stacktop^;
+ Result := PChar(@th.text);
+ g_stacktop^ := th.next;
+ GlobalFree(HGLOBAL(th));
+ end;
+end;
+
+procedure PushString(const str: string='');
+var
+ th: pstack_t;
+begin
+ if integer(g_stacktop) <> 0 then begin
+ th := pstack_t(GlobalAlloc(GPTR, SizeOf(stack_t) + g_stringsize));
+ lstrcpyn(@th.text, PChar(str), g_stringsize);
+ th.next := g_stacktop^;
+ g_stacktop^ := th;
+ end;
+end;
+
+function GetUserVariable(const varnum: TVariableList): string;
+begin
+ if (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
+ Result := g_variables + integer(varnum) * g_stringsize
+ else
+ Result := '';
+end;
+
+procedure SetUserVariable(const varnum: TVariableList; const value: string);
+begin
+ if (value <> '') and (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
+ lstrcpy(g_variables + integer(varnum) * g_stringsize, PChar(value))
+end;
+
+procedure NSISDialog(const text, caption: string; const buttons: integer);
+begin
+ MessageBox(g_hwndParent, PChar(text), PChar(caption), buttons);
+end;
+
+begin
+end.
diff --git a/other-licenses/nsis/Contrib/ExDLL/tchar.h b/other-licenses/nsis/Contrib/ExDLL/tchar.h
new file mode 100644
index 0000000000..5c18ffb778
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ExDLL/tchar.h
@@ -0,0 +1,210 @@
+/*
+ * tchar.h
+ *
+ * This file is a part of NSIS.
+ *
+ * Copyright (C) 1999-2007 Nullsoft and Contributors
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.
+ *
+ * For Unicode support by Jim Park -- 08/30/2007
+ */
+
+// Jim Park: Only those we use are listed here.
+
+#pragma once
+
+#ifdef _UNICODE
+
+#ifndef _T
+#define __T(x) L ## x
+#define _T(x) __T(x)
+#define _TEXT(x) __T(x)
+#endif
+typedef wchar_t TCHAR;
+typedef wchar_t _TUCHAR;
+
+// program
+#define _tmain wmain
+#define _tWinMain wWinMain
+#define _tenviron _wenviron
+#define __targv __wargv
+
+// printfs
+#define _ftprintf fwprintf
+#define _sntprintf _snwprintf
+#define _stprintf _swprintf
+#define _tprintf wprintf
+#define _vftprintf vfwprintf
+#define _vsntprintf _vsnwprintf
+#define _vstprintf _vswprintf
+
+// scanfs
+#define _tscanf wscanf
+#define _stscanf swscanf
+
+// string manipulations
+#define _tcscat wcscat
+#define _tcschr wcschr
+#define _tcsclen wcslen
+#define _tcscpy wcscpy
+#define _tcsdup _wcsdup
+#define _tcslen wcslen
+#define _tcsnccpy wcsncpy
+#define _tcsncpy wcsncpy
+#define _tcsrchr wcsrchr
+#define _tcsstr wcsstr
+#define _tcstok wcstok
+
+// string comparisons
+#define _tcscmp wcscmp
+#define _tcsicmp _wcsicmp
+#define _tcsncicmp _wcsnicmp
+#define _tcsncmp wcsncmp
+#define _tcsnicmp _wcsnicmp
+
+// upper / lower
+#define _tcslwr _wcslwr
+#define _tcsupr _wcsupr
+#define _totlower towlower
+#define _totupper towupper
+
+// conversions to numbers
+#define _tcstoi64 _wcstoi64
+#define _tcstol wcstol
+#define _tcstoul wcstoul
+#define _tstof _wtof
+#define _tstoi _wtoi
+#define _tstoi64 _wtoi64
+#define _ttoi _wtoi
+#define _ttoi64 _wtoi64
+#define _ttol _wtol
+
+// conversion from numbers to strings
+#define _itot _itow
+#define _ltot _ltow
+#define _i64tot _i64tow
+#define _ui64tot _ui64tow
+
+// file manipulations
+#define _tfopen _wfopen
+#define _topen _wopen
+#define _tremove _wremove
+#define _tunlink _wunlink
+
+// reading and writing to i/o
+#define _fgettc fgetwc
+#define _fgetts fgetws
+#define _fputts fputws
+#define _gettchar getwchar
+
+// directory
+#define _tchdir _wchdir
+
+// environment
+#define _tgetenv _wgetenv
+#define _tsystem _wsystem
+
+// time
+#define _tcsftime wcsftime
+
+#else // ANSI
+
+#ifndef _T
+#define _T(x) x
+#define _TEXT(x) x
+#endif
+typedef char TCHAR;
+typedef unsigned char _TUCHAR;
+
+// program
+#define _tmain main
+#define _tWinMain WinMain
+#define _tenviron environ
+#define __targv __argv
+
+// printfs
+#define _ftprintf fprintf
+#define _sntprintf _snprintf
+#define _stprintf sprintf
+#define _tprintf printf
+#define _vftprintf vfprintf
+#define _vsntprintf _vsnprintf
+#define _vstprintf vsprintf
+
+// scanfs
+#define _tscanf scanf
+#define _stscanf sscanf
+
+// string manipulations
+#define _tcscat strcat
+#define _tcschr strchr
+#define _tcsclen strlen
+#define _tcscnlen strnlen
+#define _tcscpy strcpy
+#define _tcsdup _strdup
+#define _tcslen strlen
+#define _tcsnccpy strncpy
+#define _tcsrchr strrchr
+#define _tcsstr strstr
+#define _tcstok strtok
+
+// string comparisons
+#define _tcscmp strcmp
+#define _tcsicmp _stricmp
+#define _tcsncmp strncmp
+#define _tcsncicmp _strnicmp
+#define _tcsnicmp _strnicmp
+
+// upper / lower
+#define _tcslwr _strlwr
+#define _tcsupr _strupr
+
+#define _totupper toupper
+#define _totlower tolower
+
+// conversions to numbers
+#define _tcstol strtol
+#define _tcstoul strtoul
+#define _tstof atof
+#define _tstoi atoi
+#define _tstoi64 _atoi64
+#define _tstoi64 _atoi64
+#define _ttoi atoi
+#define _ttoi64 _atoi64
+#define _ttol atol
+
+// conversion from numbers to strings
+#define _i64tot _i64toa
+#define _itot _itoa
+#define _ltot _ltoa
+#define _ui64tot _ui64toa
+
+// file manipulations
+#define _tfopen fopen
+#define _topen _open
+#define _tremove remove
+#define _tunlink _unlink
+
+// reading and writing to i/o
+#define _fgettc fgetc
+#define _fgetts fgets
+#define _fputts fputs
+#define _gettchar getchar
+
+// directory
+#define _tchdir _chdir
+
+// environment
+#define _tgetenv getenv
+#define _tsystem system
+
+// time
+#define _tcsftime strftime
+
+#endif
+
+// is functions (the same in Unicode / ANSI)
+#define _istgraph isgraph
+#define _istascii __isascii
diff --git a/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.cpp b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.cpp
new file mode 100644
index 0000000000..112d073682
--- /dev/null
+++ b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.cpp
@@ -0,0 +1,672 @@
+//
+// Copyright (C) Anders Kjersem. Licensed under the zlib/libpng license
+//
+
+#include "InetBgDL.h"
+
+#define USERAGENT _T("NSIS InetBgDL (Mozilla)")
+
+#define STATUS_COMPLETEDALL 0
+#define STATUS_INITIAL 202
+#define STATUS_CONNECTING STATUS_INITIAL //102
+#define STATUS_DOWNLOADING STATUS_INITIAL
+#define STATUS_ERR_GETLASTERROR 418 //HTTP: I'm a teapot: Win32 error code in $3
+#define STATUS_ERR_LOCALFILEWRITEERROR 450 //HTTP: MS parental control extension
+#define STATUS_ERR_CANCELLED 499
+
+typedef DWORD FILESIZE_T; // Limit to 4GB for now...
+#define FILESIZE_UNKNOWN (-1)
+
+#define MAX_STRLEN 1024
+
+HINSTANCE g_hInst;
+NSIS::stack_t*g_pLocations = NULL;
+HANDLE g_hThread = NULL;
+HANDLE g_hGETStartedEvent = NULL;
+volatile UINT g_FilesTotal = 0;
+volatile UINT g_FilesCompleted = 0;
+volatile UINT g_Status = STATUS_INITIAL;
+volatile FILESIZE_T g_cbCurrXF;
+volatile FILESIZE_T g_cbCurrTot = FILESIZE_UNKNOWN;
+CRITICAL_SECTION g_CritLock;
+UINT g_N_CCH;
+PTSTR g_N_Vars;
+TCHAR g_ServerIP[128] = { _T('\0') };
+
+DWORD g_ConnectTimeout = 0;
+DWORD g_ReceiveTimeout = 0;
+
+#define NSISPI_INITGLOBALS(N_CCH, N_Vars) do { \
+ g_N_CCH = N_CCH; \
+ g_N_Vars = N_Vars; \
+ } while(0)
+
+#define ONELOCKTORULETHEMALL
+#ifdef ONELOCKTORULETHEMALL
+#define TaskLock_AcquireExclusive() EnterCriticalSection(&g_CritLock)
+#define TaskLock_ReleaseExclusive() LeaveCriticalSection(&g_CritLock)
+#define StatsLock_AcquireExclusive() TaskLock_AcquireExclusive()
+#define StatsLock_ReleaseExclusive() TaskLock_ReleaseExclusive()
+#define StatsLock_AcquireShared() StatsLock_AcquireExclusive()
+#define StatsLock_ReleaseShared() StatsLock_ReleaseExclusive()
+#endif
+
+PTSTR NSIS_SetRegStr(UINT Reg, LPCTSTR Value)
+{
+ PTSTR s = g_N_Vars + (Reg * g_N_CCH);
+ lstrcpy(s, Value);
+ return s;
+}
+#define NSIS_SetRegStrEmpty(r) NSIS_SetRegStr(r, _T(""))
+void NSIS_SetRegUINT(UINT Reg, UINT Value)
+{
+ TCHAR buf[32];
+ wsprintf(buf, _T("%u"), Value);
+ NSIS_SetRegStr(Reg, buf);
+}
+#define StackFreeItem(pI) GlobalFree(pI)
+NSIS::stack_t* StackPopItem(NSIS::stack_t**ppST)
+{
+ if (*ppST)
+ {
+ NSIS::stack_t*pItem = *ppST;
+ *ppST = pItem->next;
+ return pItem;
+ }
+ return NULL;
+}
+
+void Reset()
+{
+ // The g_hGETStartedEvent event is used to make sure that the Get() call will
+ // acquire the lock before the Reset() call acquires the lock.
+ if (g_hGETStartedEvent) {
+ TRACE(_T("InetBgDl: waiting on g_hGETStartedEvent\n"));
+ WaitForSingleObject(g_hGETStartedEvent, INFINITE);
+ CloseHandle(g_hGETStartedEvent);
+ g_hGETStartedEvent = NULL;
+ }
+
+ TaskLock_AcquireExclusive();
+#ifndef ONELOCKTORULETHEMALL
+ StatsLock_AcquireExclusive();
+#endif
+ g_FilesTotal = 0; // This causes the Task thread to exit the transfer loop
+ if (g_hThread)
+ {
+ TRACE(_T("InetBgDl: waiting on g_hThread\n"));
+ if (WAIT_OBJECT_0 != WaitForSingleObject(g_hThread, 10 * 1000))
+ {
+ TRACE(_T("InetBgDl: terminating g_hThread\n"));
+ TerminateThread(g_hThread, ERROR_OPERATION_ABORTED);
+ }
+ CloseHandle(g_hThread);
+ g_hThread = NULL;
+ }
+ g_FilesTotal = 0;
+ g_FilesCompleted = 0;
+ g_Status = STATUS_INITIAL;
+#ifndef ONELOCKTORULETHEMALL
+ StatsLock_ReleaseExclusive();
+#endif
+ for (NSIS::stack_t*pTmpTast,*pTask = g_pLocations; pTask ;)
+ {
+ pTmpTast = pTask;
+ pTask = pTask->next;
+ StackFreeItem(pTmpTast);
+ }
+ g_pLocations = NULL;
+ TaskLock_ReleaseExclusive();
+}
+
+UINT_PTR __cdecl NSISPluginCallback(UINT Event)
+{
+ switch(Event)
+ {
+ case NSPIM_UNLOAD:
+ Reset();
+ break;
+ }
+ return NULL;
+}
+
+void __stdcall InetStatusCallback(HINTERNET hInternet, DWORD_PTR dwContext,
+ DWORD dwInternetStatus,
+ LPVOID lpvStatusInformation,
+ DWORD dwStatusInformationLength)
+{
+ if (dwInternetStatus == INTERNET_STATUS_NAME_RESOLVED) {
+ // The documentation states the IP address is a PCTSTR but it is usually a
+ // PCSTR and only sometimes a PCTSTR.
+ StatsLock_AcquireExclusive();
+ wsprintf(g_ServerIP, _T("%S"), lpvStatusInformation);
+ if (wcslen(g_ServerIP) == 1)
+ {
+ wsprintf(g_ServerIP, _T("%s"), lpvStatusInformation);
+ }
+ StatsLock_ReleaseExclusive();
+ }
+
+#if defined(PLUGIN_DEBUG)
+ switch (dwInternetStatus)
+ {
+ case INTERNET_STATUS_RESOLVING_NAME:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_RESOLVING_NAME (%d), name=%s\n"),
+ dwStatusInformationLength, lpvStatusInformation);
+ break;
+ case INTERNET_STATUS_NAME_RESOLVED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_NAME_RESOLVED (%d), resolved name=%s\n"),
+ dwStatusInformationLength, g_ServerIP);
+ break;
+ case INTERNET_STATUS_CONNECTING_TO_SERVER:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_CONNECTING_TO_SERVER (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_CONNECTED_TO_SERVER:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_CONNECTED_TO_SERVER (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_SENDING_REQUEST:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_SENDING_REQUEST (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_REQUEST_SENT:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_REQUEST_SENT (%d), bytes sent=%d\n"),
+ dwStatusInformationLength, lpvStatusInformation);
+ break;
+ case INTERNET_STATUS_RECEIVING_RESPONSE:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_RECEIVING_RESPONSE (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_RESPONSE_RECEIVED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_RESPONSE_RECEIVED (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_CTL_RESPONSE_RECEIVED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_CTL_RESPONSE_RECEIVED (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_PREFETCH:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_PREFETCH (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_CLOSING_CONNECTION:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_CLOSING_CONNECTION (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_CONNECTION_CLOSED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_CONNECTION_CLOSED (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_HANDLE_CREATED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_HANDLE_CREATED (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_HANDLE_CLOSING:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_HANDLE_CLOSING (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_DETECTING_PROXY:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_DETECTING_PROXY (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_REQUEST_COMPLETE:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_REQUEST_COMPLETE (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_REDIRECT:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_REDIRECT (%d), new url=%s\n"),
+ dwStatusInformationLength, lpvStatusInformation);
+ break;
+ case INTERNET_STATUS_INTERMEDIATE_RESPONSE:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_INTERMEDIATE_RESPONSE (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_USER_INPUT_REQUIRED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_USER_INPUT_REQUIRED (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_STATE_CHANGE:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_STATE_CHANGE (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_COOKIE_SENT:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_COOKIE_SENT (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_COOKIE_RECEIVED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_COOKIE_RECEIVED (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_PRIVACY_IMPACTED:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_PRIVACY_IMPACTED (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_P3P_HEADER:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_P3P_HEADER (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_P3P_POLICYREF:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_P3P_POLICYREF (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ case INTERNET_STATUS_COOKIE_HISTORY:
+ TRACE(_T("InetBgDl: INTERNET_STATUS_COOKIE_HISTORY (%d)\n"),
+ dwStatusInformationLength);
+ break;
+ default:
+ TRACE(_T("InetBgDl: Unknown Status %d\n"), dwInternetStatus);
+ break;
+ }
+#endif
+}
+
+DWORD CALLBACK TaskThreadProc(LPVOID ThreadParam)
+{
+ NSIS::stack_t *pURL,*pFile;
+ HINTERNET hInetSes = NULL, hInetFile = NULL;
+ DWORD cbio = sizeof(DWORD);
+ HANDLE hLocalFile;
+ bool completedFile = false;
+startnexttask:
+ hLocalFile = INVALID_HANDLE_VALUE;
+ pFile = NULL;
+ TaskLock_AcquireExclusive();
+ // Now that we've acquired the lock, we can set the event to indicate this.
+ // SetEvent will likely never fail, but if it does we should set it to NULL
+ // to avoid anyone waiting on it.
+ if (!SetEvent(g_hGETStartedEvent)) {
+ CloseHandle(g_hGETStartedEvent);
+ g_hGETStartedEvent = NULL;
+ }
+ pURL = g_pLocations;
+ if (pURL)
+ {
+ pFile = pURL->next;
+ g_pLocations = pFile->next;
+ }
+#ifndef ONELOCKTORULETHEMALL
+ StatsLock_AcquireExclusive();
+#endif
+ if (completedFile)
+ {
+ ++g_FilesCompleted;
+ }
+ completedFile = false;
+ g_cbCurrXF = 0;
+ g_cbCurrTot = FILESIZE_UNKNOWN;
+ if (!pURL)
+ {
+ if (g_FilesTotal)
+ {
+ if (g_FilesTotal == g_FilesCompleted)
+ {
+ g_Status = STATUS_COMPLETEDALL;
+ }
+ }
+ g_hThread = NULL;
+ }
+#ifndef ONELOCKTORULETHEMALL
+ StatsLock_ReleaseExclusive();
+#endif
+ TaskLock_ReleaseExclusive();
+
+ if (!pURL)
+ {
+ if (0)
+ {
+diegle:
+ DWORD gle = GetLastError();
+ //TODO? if (ERROR_INTERNET_EXTENDED_ERROR==gle) InternetGetLastResponseInfo(...)
+ g_Status = STATUS_ERR_GETLASTERROR;
+ }
+ if (hInetSes)
+ {
+ InternetCloseHandle(hInetSes);
+ }
+ if (INVALID_HANDLE_VALUE != hLocalFile)
+ {
+ CloseHandle(hLocalFile);
+ }
+ StackFreeItem(pURL);
+ StackFreeItem(pFile);
+ return 0;
+ }
+
+ if (!hInetSes)
+ {
+ hInetSes = InternetOpen(USERAGENT, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
+ if (!hInetSes)
+ {
+ TRACE(_T("InetBgDl: InternetOpen failed with gle=%u\n"),
+ GetLastError());
+ goto diegle;
+ }
+ InternetSetStatusCallback(hInetSes, (INTERNET_STATUS_CALLBACK)InetStatusCallback);
+
+ //msdn.microsoft.com/library/default.asp?url=/workshop/components/offline/offline.asp#Supporting Offline Browsing in Applications and Components
+ ULONG longOpt;
+ DWORD cbio = sizeof(ULONG);
+ if (InternetQueryOption(hInetSes, INTERNET_OPTION_CONNECTED_STATE, &longOpt, &cbio))
+ {
+ if (INTERNET_STATE_DISCONNECTED_BY_USER&longOpt)
+ {
+ INTERNET_CONNECTED_INFO ci = {INTERNET_STATE_CONNECTED, 0};
+ InternetSetOption(hInetSes, INTERNET_OPTION_CONNECTED_STATE, &ci, sizeof(ci));
+ }
+ }
+
+ // Change the default connect timeout if specified.
+ if(g_ConnectTimeout > 0)
+ {
+ InternetSetOption(hInetSes, INTERNET_OPTION_CONNECT_TIMEOUT,
+ &g_ConnectTimeout, sizeof(g_ConnectTimeout));
+ }
+
+ // Change the default receive timeout if specified.
+ if (g_ReceiveTimeout)
+ {
+ InternetSetOption(hInetSes, INTERNET_OPTION_RECEIVE_TIMEOUT,
+ &g_ReceiveTimeout, sizeof(DWORD));
+ }
+ }
+
+ DWORD ec = ERROR_SUCCESS;
+ hLocalFile = CreateFile(pFile->text, GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_DELETE,NULL,CREATE_ALWAYS, 0, NULL);
+ if (INVALID_HANDLE_VALUE == hLocalFile)
+ {
+ TRACE(_T("InetBgDl: CreateFile file handle invalid\n"));
+ goto diegle;
+ }
+
+ const DWORD IOURedirFlags = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP |
+ INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS;
+ const DWORD IOUCacheFlags = INTERNET_FLAG_RESYNCHRONIZE |
+ INTERNET_FLAG_NO_CACHE_WRITE |
+ INTERNET_FLAG_PRAGMA_NOCACHE |
+ INTERNET_FLAG_RELOAD;
+ const DWORD IOUCookieFlags = INTERNET_FLAG_NO_COOKIES;
+ DWORD IOUFlags = IOURedirFlags | IOUCacheFlags | IOUCookieFlags |
+ INTERNET_FLAG_NO_UI | INTERNET_FLAG_EXISTING_CONNECT;
+
+ TCHAR *hostname = (TCHAR*) GlobalAlloc(GPTR, MAX_STRLEN * sizeof(TCHAR)),
+ *urlpath = (TCHAR*) GlobalAlloc(GPTR, MAX_STRLEN * sizeof(TCHAR)),
+ *extrainfo = (TCHAR*) GlobalAlloc(GPTR, MAX_STRLEN * sizeof(TCHAR));
+
+ URL_COMPONENTS uc = { sizeof(URL_COMPONENTS), NULL, 0, (INTERNET_SCHEME)0,
+ hostname, MAX_STRLEN, (INTERNET_PORT)0, NULL, 0,
+ NULL, 0, urlpath, MAX_STRLEN, extrainfo, MAX_STRLEN};
+ uc.dwHostNameLength = uc.dwUrlPathLength = uc.dwExtraInfoLength = MAX_STRLEN;
+
+ if (!InternetCrackUrl(pURL->text, 0, ICU_ESCAPE, &uc))
+ {
+ // Bad url or param passed in
+ TRACE(_T("InetBgDl: InternetCrackUrl false with url=%s, gle=%u\n"),
+ pURL->text, GetLastError());
+ goto diegle;
+ }
+
+ TRACE(_T("InetBgDl: scheme_id=%d, hostname=%s, port=%d, urlpath=%s, extrainfo=%s\n"),
+ uc.nScheme, hostname, uc.nPort, urlpath, extrainfo);
+
+ // Only http and https are supported
+ if (uc.nScheme != INTERNET_SCHEME_HTTP &&
+ uc.nScheme != INTERNET_SCHEME_HTTPS)
+ {
+ TRACE(_T("InetBgDl: only http and https is supported, aborting...\n"));
+ goto diegle;
+ }
+
+ TRACE(_T("InetBgDl: calling InternetOpenUrl with url=%s\n"), pURL->text);
+ hInetFile = InternetOpenUrl(hInetSes, pURL->text,
+ NULL, 0, IOUFlags |
+ (uc.nScheme == INTERNET_SCHEME_HTTPS ?
+ INTERNET_FLAG_SECURE : 0), 1);
+ if (!hInetFile)
+ {
+ TRACE(_T("InetBgDl: InternetOpenUrl failed with gle=%u\n"),
+ GetLastError());
+ goto diegle;
+ }
+
+ // Get the file length via the Content-Length header
+ FILESIZE_T cbThisFile;
+ cbio = sizeof(cbThisFile);
+ if (!HttpQueryInfo(hInetFile,
+ HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,
+ &cbThisFile, &cbio, NULL))
+ {
+ cbThisFile = FILESIZE_UNKNOWN;
+ }
+ TRACE(_T("InetBgDl: file size=%d bytes\n"), cbThisFile);
+
+ // Setup a buffer of size 256KiB to store the downloaded data.
+ const UINT cbBufXF = 262144;
+ // Use a 4MiB read buffer for the connection.
+ // Bigger buffers will be faster.
+ // cbReadBufXF should be a multiple of cbBufXF.
+ const UINT cbReadBufXF = 4194304;
+ BYTE bufXF[cbBufXF];
+
+ // Up the default internal buffer size from 4096 to internalReadBufferSize.
+ DWORD internalReadBufferSize = cbReadBufXF;
+ if (!InternetSetOption(hInetFile, INTERNET_OPTION_READ_BUFFER_SIZE,
+ &internalReadBufferSize, sizeof(DWORD)))
+ {
+ TRACE(_T("InetBgDl: InternetSetOption failed to set read buffer size to %u bytes, gle=%u\n"),
+ internalReadBufferSize, GetLastError());
+
+ // Maybe it's too big, try half of the optimal value. If that fails just
+ // use the default.
+ internalReadBufferSize /= 2;
+ if (!InternetSetOption(hInetFile, INTERNET_OPTION_READ_BUFFER_SIZE,
+ &internalReadBufferSize, sizeof(DWORD)))
+ {
+ TRACE(_T("InetBgDl: InternetSetOption failed to set read buffer size ") \
+ _T("to %u bytes (using default read buffer size), gle=%u\n"),
+ internalReadBufferSize, GetLastError());
+ }
+ }
+
+ for(;;)
+ {
+ DWORD cbio = 0, cbXF = 0;
+ BOOL retXF = InternetReadFile(hInetFile, bufXF, cbBufXF, &cbio);
+ if (!retXF)
+ {
+ ec = GetLastError();
+ TRACE(_T("InetBgDl: InternetReadFile failed, gle=%u\n"), ec);
+ break;
+ }
+
+ if (0 == cbio)
+ {
+ ASSERT(ERROR_SUCCESS == ec);
+ // EOF or broken connection?
+ // TODO: Can InternetQueryDataAvailable detect this?
+
+ TRACE(_T("InetBgDl: InternetReadFile true with 0 cbio, cbThisFile=%d, gle=%u\n"),
+ cbThisFile, GetLastError());
+ // If we haven't transferred all of the file, and we know how big the file
+ // is, and we have no more data to read from the HTTP request, then set a
+ // broken pipe error. Reading without StatsLock is ok in this thread.
+ if (FILESIZE_UNKNOWN != cbThisFile && g_cbCurrXF != cbThisFile)
+ {
+ TRACE(_T("InetBgDl: downloaded file size of %d bytes doesn't equal ") \
+ _T("expected file size of %d bytes\n"), g_cbCurrXF, cbThisFile);
+ ec = ERROR_BROKEN_PIPE;
+ }
+ break;
+ }
+
+ // Check if we canceled the download
+ if (0 == g_FilesTotal)
+ {
+ TRACE(_T("InetBgDl: 0 == g_FilesTotal, aborting transfer loop...\n"));
+ ec = ERROR_CANCELLED;
+ break;
+ }
+
+ cbXF = cbio;
+ if (cbXF)
+ {
+ retXF = WriteFile(hLocalFile, bufXF, cbXF, &cbio, NULL);
+ if (!retXF || cbXF != cbio)
+ {
+ ec = GetLastError();
+ break;
+ }
+
+ StatsLock_AcquireExclusive();
+ if (FILESIZE_UNKNOWN != cbThisFile) {
+ g_cbCurrTot = cbThisFile;
+ }
+ g_cbCurrXF += cbXF;
+ StatsLock_ReleaseExclusive();
+ }
+ }
+
+ TRACE(_T("InetBgDl: TaskThreadProc completed %s, ec=%u\n"), pURL->text, ec);
+ InternetCloseHandle(hInetFile);
+ if (ERROR_SUCCESS == ec)
+ {
+ if (INVALID_HANDLE_VALUE != hLocalFile)
+ {
+ CloseHandle(hLocalFile);
+ hLocalFile = INVALID_HANDLE_VALUE;
+ }
+ StackFreeItem(pURL);
+ StackFreeItem(pFile);
+ ++completedFile;
+ }
+ else
+ {
+ TRACE(_T("InetBgDl: failed with ec=%u\n"), ec);
+ SetLastError(ec);
+ goto diegle;
+ }
+ goto startnexttask;
+}
+
+NSISPIEXPORTFUNC Get(HWND hwndNSIS, UINT N_CCH, TCHAR*N_Vars, NSIS::stack_t**ppST, NSIS::xparams_t*pX)
+{
+ pX->RegisterPluginCallback(g_hInst, NSISPluginCallback);
+ for (;;)
+ {
+ NSIS::stack_t*pURL = StackPopItem(ppST);
+ if (!pURL)
+ {
+ break;
+ }
+
+ if (lstrcmpi(pURL->text, _T("/connecttimeout")) == 0)
+ {
+ NSIS::stack_t*pConnectTimeout = StackPopItem(ppST);
+ g_ConnectTimeout = _tcstol(pConnectTimeout->text, NULL, 10) * 1000;
+ continue;
+ }
+ else if (lstrcmpi(pURL->text, _T("/receivetimeout")) == 0)
+ {
+ NSIS::stack_t*pReceiveTimeout = StackPopItem(ppST);
+ g_ReceiveTimeout = _tcstol(pReceiveTimeout->text, NULL, 10) * 1000;
+ continue;
+ }
+ else if (lstrcmpi(pURL->text, _T("/reset")) == 0)
+ {
+ StackFreeItem(pURL);
+ Reset();
+ continue;
+ }
+ else if (lstrcmpi(pURL->text, _T("/end")) == 0)
+ {
+freeurlandexit:
+ StackFreeItem(pURL);
+ break;
+ }
+
+ NSIS::stack_t*pFile = StackPopItem(ppST);
+ if (!pFile)
+ {
+ goto freeurlandexit;
+ }
+
+ TaskLock_AcquireExclusive();
+
+ pFile->next = NULL;
+ pURL->next = pFile;
+ NSIS::stack_t*pTasksTail = g_pLocations;
+ while(pTasksTail && pTasksTail->next) pTasksTail = pTasksTail->next;
+ if (pTasksTail)
+ {
+ pTasksTail->next = pURL;
+ }
+ else
+ {
+ g_pLocations = pURL;
+ }
+
+ if (!g_hThread)
+ {
+ DWORD tid;
+ if (g_hGETStartedEvent) {
+ CloseHandle(g_hGETStartedEvent);
+ }
+ g_hGETStartedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ g_hThread = CreateThread(NULL, 0, TaskThreadProc, NULL, 0, &tid);
+ }
+
+ if (!g_hThread)
+ {
+ goto freeurlandexit;
+ }
+
+#ifndef ONELOCKTORULETHEMALL
+ StatsLock_AcquireExclusive();
+#endif
+ ++g_FilesTotal;
+#ifndef ONELOCKTORULETHEMALL
+ StatsLock_ReleaseExclusive();
+#endif
+ TaskLock_ReleaseExclusive();
+ }
+}
+
+NSISPIEXPORTFUNC GetStats(HWND hwndNSIS, UINT N_CCH, TCHAR*N_Vars, NSIS::stack_t**ppST, NSIS::xparams_t*pX)
+{
+ NSISPI_INITGLOBALS(N_CCH, N_Vars);
+ StatsLock_AcquireShared();
+ NSIS_SetRegUINT(0, g_Status);
+ NSIS_SetRegUINT(1, g_FilesCompleted);
+ NSIS_SetRegUINT(2, g_FilesTotal - g_FilesCompleted);
+ NSIS_SetRegUINT(3, g_cbCurrXF);
+ NSIS_SetRegStrEmpty(4);
+ if (FILESIZE_UNKNOWN != g_cbCurrTot)
+ {
+ NSIS_SetRegUINT(4, g_cbCurrTot);
+ }
+ NSIS_SetRegStr(5, g_ServerIP);
+ StatsLock_ReleaseShared();
+}
+
+EXTERN_C BOOL WINAPI _DllMainCRTStartup(HMODULE hInst, UINT Reason, LPVOID pCtx)
+{
+ if (DLL_PROCESS_ATTACH==Reason)
+ {
+ g_hInst=hInst;
+ InitializeCriticalSection(&g_CritLock);
+ }
+ return TRUE;
+}
+
+BOOL WINAPI DllMain(HINSTANCE hInst, ULONG Reason, LPVOID pCtx)
+{
+ return _DllMainCRTStartup(hInst, Reason, pCtx);
+}
+
+// For some reason VC6++ doesn't like wcsicmp and swprintf.
+// If you use them, you get a linking error about _main
+// as an unresolved external.
+int main(int argc, char**argv)
+{
+ return 0;
+}
diff --git a/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsp b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsp
new file mode 100644
index 0000000000..61894633b2
--- /dev/null
+++ b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsp
@@ -0,0 +1,159 @@
+# Microsoft Developer Studio Project File - Name="InetBgDL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=InetBgDL - Win32 Debug Unicode
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "InetBgDL.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "InetBgDL.mak" CFG="InetBgDL - Win32 Debug Unicode"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "InetBgDL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "InetBgDL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "InetBgDL - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "InetBgDL - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "InetBgDL - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/InetBgDL.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "InetBgDL - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ELSEIF "$(CFG)" == "InetBgDL - Win32 Release Unicode"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "InetBgDL___Win32_Release_Unicode"
+# PROP BASE Intermediate_Dir "InetBgDL___Win32_Release_Unicode"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_Unicode"
+# PROP Intermediate_Dir "Release_Unicode"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/InetBgDL.dll" /opt:nowin98
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 wininet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /dll /machine:I386 /out:"./Unicode/InetBgDL.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none /nodefaultlib
+
+!ELSEIF "$(CFG)" == "InetBgDL - Win32 Debug Unicode"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "InetBgDL___Win32_Debug_Unicode"
+# PROP BASE Intermediate_Dir "InetBgDL___Win32_Debug_Unicode"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_Unicode"
+# PROP Intermediate_Dir "Debug_Unicode"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "InetBgDL_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "InetBgDL - Win32 Release"
+# Name "InetBgDL - Win32 Debug"
+# Name "InetBgDL - Win32 Release Unicode"
+# Name "InetBgDL - Win32 Debug Unicode"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\InetBgDL.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsw b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsw
new file mode 100644
index 0000000000..9b3d793a6c
--- /dev/null
+++ b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "InetBgDL"=.\InetBgDL.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.h b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.h
new file mode 100644
index 0000000000..c7fabec2bb
--- /dev/null
+++ b/other-licenses/nsis/Contrib/InetBgDL/InetBgDL.h
@@ -0,0 +1,65 @@
+//
+// Copyright (C) Anders Kjersem. Licensed under the zlib/libpng license
+//
+
+#if (defined(_MSC_VER) && !defined(_DEBUG))
+ #pragma comment(linker,"/opt:nowin98")
+ #pragma comment(linker,"/ignore:4078")
+ #pragma comment(linker,"/merge:.rdata=.text")
+#endif
+
+#ifdef UNICODE
+# ifndef _UNICODE
+# define _UNICODE
+# endif
+#endif
+
+#define _WIN32_WINNT 0x0400
+#include <windows.h>
+#include <tchar.h>
+#include <wininet.h>
+
+#if defined(_DEBUG) || 0
+# define PLUGIN_DEBUG 1
+void MYTRACE(LPCTSTR fmt, ...)
+{
+ va_list argptr;
+ va_start(argptr, fmt);
+ TCHAR buffer[2048] = { _T('\0') };
+ wvsprintf(buffer, fmt, argptr);
+ buffer[(sizeof(buffer)/sizeof(*buffer)) - 1] = _T('\0');
+ OutputDebugString(buffer);
+ va_end(argptr);
+}
+#else
+void MYTRACE(...) { }
+#endif
+# define TRACE MYTRACE
+
+#ifndef ASSERT
+# define ASSERT(x)
+#endif
+
+#define NSISPIEXPORTFUNC EXTERN_C void __declspec(dllexport) __cdecl
+
+namespace NSIS {
+
+#define NSISCALL __stdcall
+typedef struct _xparams_t {
+ LPVOID xx1;//exec_flags_type *exec_flags;
+ int (NSISCALL *ExecuteCodeSegment)(int, HWND);
+ void (NSISCALL *validate_filename)(TCHAR*);
+ int (NSISCALL *RegisterPluginCallback)(HMODULE,LPVOID);
+} xparams_t;
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[1];
+} stack_t;
+
+} // namespace NSIS
+
+enum NSPIM
+{
+ NSPIM_UNLOAD,
+ NSPIM_GUIUNLOAD,
+};
diff --git a/other-licenses/nsis/Contrib/README b/other-licenses/nsis/Contrib/README
new file mode 100644
index 0000000000..8301fe26c4
--- /dev/null
+++ b/other-licenses/nsis/Contrib/README
@@ -0,0 +1,34 @@
+These directories contain modified source code to the NSIS Plugins used by the
+Windows installers.
+
+NSIS project page: http://nsis.sourceforge.net/
+NSIS Unicode port project page: http://www.scratchpaper.com/
+
+APPLICABLE LICENSES
+-------------------
+* All NSIS source code, plug-ins, documentation, examples, header files and
+ graphics, with the exception of the compression modules and where otherwise
+ noted, are licensed under the zlib/libpng license.
+
+* The zlib compression module for NSIS is licensed under the zlib/libpng
+ license.
+
+* The bzip2 compression module for NSIS is licensed under the bzip2 license.
+
+* The LZMA compression module for NSIS is licensed under the Common Public
+ License version 1.0.
+
+-------------------------------------------------------------------------------
+
+ExDLL NSIS Unicode source 2.38.1 for plugin projects
+http://www.scratchpaper.com/
+These files are required to compile the nsProcess and ShellLink plugins. No
+changes were made to these files.
+
+-------------------------------------------------------------------------------
+
+ApplicationID v1.0
+http://nsis.sourceforge.net/ApplicationID_plug-in
+Unicode support and taskbar resource deleteion was added for this plugin. A diff
+of the changes to the source is available at:
+https://bugzilla.mozilla.org/show_bug.cgi?id=521141
diff --git a/other-licenses/nsis/Contrib/ServicesHelper/Services.cpp b/other-licenses/nsis/Contrib/ServicesHelper/Services.cpp
new file mode 100644
index 0000000000..5c3d2fe59f
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ServicesHelper/Services.cpp
@@ -0,0 +1,241 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <windows.h>
+#include "../../../../toolkit/mozapps/update/common/pathhash.h"
+
+#pragma comment(lib, "advapi32.lib")
+
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[MAX_PATH];
+} stack_t;
+
+int popstring(stack_t **stacktop, LPTSTR str, int len);
+void pushstring(stack_t **stacktop, LPCTSTR str, int len);
+
+/**
+ * Determines if the specified service exists or not
+ *
+ * @param serviceName The name of the service to check
+ * @param exists Whether or not the service exists
+ * @return TRUE if there were no errors
+ */
+static BOOL
+IsServiceInstalled(LPCWSTR serviceName, BOOL &exists)
+{
+ exists = FALSE;
+
+ // Get a handle to the local computer SCM database with full access rights.
+ SC_HANDLE serviceManager = OpenSCManager(NULL, NULL,
+ SC_MANAGER_ENUMERATE_SERVICE);
+ if (!serviceManager) {
+ return FALSE;
+ }
+
+ SC_HANDLE serviceHandle = OpenServiceW(serviceManager,
+ serviceName,
+ SERVICE_QUERY_CONFIG);
+ if (!serviceHandle && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) {
+ CloseServiceHandle(serviceManager);
+ return FALSE;
+ }
+
+ if (serviceHandle) {
+ CloseServiceHandle(serviceHandle);
+ exists = TRUE;
+ }
+
+ CloseServiceHandle(serviceManager);
+ return TRUE;
+}
+
+/**
+ * Determines if the specified service is installed or not
+ *
+ * @param stacktop A pointer to the top of the stack
+ * @param variables A pointer to the NSIS variables
+ * @return 0 if the service does not exist
+ * 1 if the service does exist
+ * -1 if there was an error.
+ */
+extern "C" void __declspec(dllexport)
+IsInstalled(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop, void *extra)
+{
+ TCHAR tmp[MAX_PATH] = { L'\0' };
+ WCHAR serviceName[MAX_PATH] = { '\0' };
+ popstring(stacktop, tmp, MAX_PATH);
+
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, tmp, -1, serviceName, MAX_PATH);
+#else
+ wcscpy(serviceName, tmp);
+#endif
+
+ BOOL serviceInstalled;
+ if (!IsServiceInstalled(serviceName, serviceInstalled)) {
+ pushstring(stacktop, TEXT("-1"), 3);
+ } else {
+ pushstring(stacktop, serviceInstalled ? TEXT("1") : TEXT("0"), 2);
+ }
+}
+
+/**
+ * Stops the specified service.
+ *
+ * @param serviceName The name of the service to stop
+ * @return TRUE if the operation was successful
+ */
+static BOOL
+StopService(LPCWSTR serviceName)
+{
+ // Get a handle to the local computer SCM database with full access rights.
+ SC_HANDLE serviceManager = OpenSCManager(NULL, NULL,
+ SC_MANAGER_ENUMERATE_SERVICE);
+ if (!serviceManager) {
+ return FALSE;
+ }
+
+ SC_HANDLE serviceHandle = OpenServiceW(serviceManager,
+ serviceName,
+ SERVICE_STOP);
+ if (!serviceHandle) {
+ CloseServiceHandle(serviceManager);
+ return FALSE;
+ }
+
+ //Stop the service so it deletes faster and so the uninstaller
+ // can actually delete its EXE.
+ DWORD totalWaitTime = 0;
+ SERVICE_STATUS status;
+ static const int maxWaitTime = 1000 * 60; // Never wait more than a minute
+ BOOL stopped = FALSE;
+ if (ControlService(serviceHandle, SERVICE_CONTROL_STOP, &status)) {
+ do {
+ Sleep(status.dwWaitHint);
+ // + 10 milliseconds to make sure we always approach maxWaitTime
+ totalWaitTime += (status.dwWaitHint + 10);
+ if (status.dwCurrentState == SERVICE_STOPPED) {
+ stopped = true;
+ break;
+ } else if (totalWaitTime > maxWaitTime) {
+ break;
+ }
+ } while (QueryServiceStatus(serviceHandle, &status));
+ }
+
+ CloseServiceHandle(serviceHandle);
+ CloseServiceHandle(serviceManager);
+ return stopped;
+}
+
+/**
+ * Stops the specified service
+ *
+ * @param stacktop A pointer to the top of the stack
+ * @param variables A pointer to the NSIS variables
+ * @return 1 if the service was stopped, 0 on error
+ */
+extern "C" void __declspec(dllexport)
+Stop(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop, void *extra)
+{
+ TCHAR tmp[MAX_PATH] = { L'\0' };
+ WCHAR serviceName[MAX_PATH] = { '\0' };
+
+ popstring(stacktop, tmp, MAX_PATH);
+
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, tmp, -1, serviceName, MAX_PATH);
+#else
+ wcscpy(serviceName, tmp);
+#endif
+
+ if (StopService(serviceName)) {
+ pushstring(stacktop, TEXT("1"), 2);
+ } else {
+ pushstring(stacktop, TEXT("0"), 2);
+ }
+}
+
+/**
+ * Determines a unique registry path from a file or directory path
+ *
+ * @param stacktop A pointer to the top of the stack
+ * @param variables A pointer to the NSIS variables
+ * @return The unique registry path or an empty string on error
+ */
+extern "C" void __declspec(dllexport)
+PathToUniqueRegistryPath(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop,
+ void *extra)
+{
+ TCHAR tmp[MAX_PATH] = { L'\0' };
+ WCHAR installBasePath[MAX_PATH] = { '\0' };
+ popstring(stacktop, tmp, MAX_PATH);
+
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, tmp, -1, installBasePath, MAX_PATH);
+#else
+ wcscpy(installBasePath, tmp);
+#endif
+
+ WCHAR registryPath[MAX_PATH + 1] = { '\0' };
+ if (CalculateRegistryPathFromFilePath(installBasePath, registryPath)) {
+ pushstring(stacktop, registryPath, wcslen(registryPath) + 1);
+ } else {
+ pushstring(stacktop, TEXT(""), 1);
+ }
+}
+
+BOOL WINAPI
+DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
+{
+ return TRUE;
+}
+
+/**
+ * Removes an element from the top of the NSIS stack
+ *
+ * @param stacktop A pointer to the top of the stack
+ * @param str The string to pop to
+ * @param len The max length
+ * @return 0 on success
+*/
+int popstring(stack_t **stacktop, TCHAR *str, int len)
+{
+ // Removes the element from the top of the stack and puts it in the buffer
+ stack_t *th;
+ if (!stacktop || !*stacktop) {
+ return 1;
+ }
+
+ th = (*stacktop);
+ lstrcpyn(str,th->text, len);
+ *stacktop = th->next;
+ GlobalFree((HGLOBAL)th);
+ return 0;
+}
+
+/**
+ * Adds an element to the top of the NSIS stack
+ *
+ * @param stacktop A pointer to the top of the stack
+ * @param str The string to push on the stack
+ * @param len The length of the string to push on the stack
+ * @return 0 on success
+*/
+void pushstring(stack_t **stacktop, const TCHAR *str, int len)
+{
+ stack_t *th;
+ if (!stacktop) {
+ return;
+ }
+
+ th = (stack_t*)GlobalAlloc(GPTR, sizeof(stack_t) + len);
+ lstrcpyn(th->text, str, len);
+ th->next = *stacktop;
+ *stacktop = th;
+}
diff --git a/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsp b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsp
new file mode 100644
index 0000000000..8c9577c516
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsp
@@ -0,0 +1,115 @@
+# Microsoft Developer Studio Project File - Name="ServicesHelper" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=ServicesHelper - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ServicesHelper.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ServicesHelper.mak" CFG="ServicesHelper - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ServicesHelper - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ServicesHelper - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ServicesHelper - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "_USRDLL" /D "EXDLL_EXPORTS" /D _WIN32_WINNT=0x0400 /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib MSVCRT.LIB /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/ServicesHelper.dll" /opt:nowin98
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "ServicesHelper - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "ServicesHelper - Win32 Release"
+# Name "ServicesHelper - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=\toolkit\mozapps\update\common\pathhash.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=\toolkit\mozapps\update\common\pathhash.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Services.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsw b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsw
new file mode 100644
index 0000000000..c144217016
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "ServicesHelper"=.\ServicesHelper.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.rc b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.rc
new file mode 100644
index 0000000000..3e64f62c44
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.rc
@@ -0,0 +1,99 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "NSIS Plug-in for managing Windows services"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "ServicesHelper"
+ VALUE "LegalCopyright", "MPL 1.1+/GPL 2.0+/LGPL 2.1+"
+ VALUE "OriginalFilename", "ServicesHelper.dll"
+ VALUE "ProductName", "ServicesHelper"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.sln b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.sln
new file mode 100644
index 0000000000..348a8e3003
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServicesHelper", "ServicesHelper.vcproj", "{A0D0AD52-1D8B-402E-92EF-81AE0C320BD7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A0D0AD52-1D8B-402E-92EF-81AE0C320BD7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A0D0AD52-1D8B-402E-92EF-81AE0C320BD7}.Debug|Win32.Build.0 = Debug|Win32
+ {A0D0AD52-1D8B-402E-92EF-81AE0C320BD7}.Release|Win32.ActiveCfg = Release|Win32
+ {A0D0AD52-1D8B-402E-92EF-81AE0C320BD7}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.vcproj b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.vcproj
new file mode 100644
index 0000000000..637fa5110f
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ServicesHelper/ServicesHelper.vcproj
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ServicesHelper"
+ ProjectGUID="{A0D0AD52-1D8B-402E-92EF-81AE0C320BD7}"
+ RootNamespace="ServicesHelper"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Plugins"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../toolkit/components/maintenanceservice/"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;APPLICATIONID_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Plugins"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ ATLMinimizesCRunTimeLibraryUsage="true"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../toolkit/components/maintenanceservice/"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;APPLICATIONID_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\..\toolkit\mozapps\update\common\pathhash.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Services.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\ServicesHelper.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/other-licenses/nsis/Contrib/ServicesHelper/resource.h b/other-licenses/nsis/Contrib/ServicesHelper/resource.h
new file mode 100644
index 0000000000..5b0a02ad34
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ServicesHelper/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by ServicesHelper.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/other-licenses/nsis/Contrib/liteFirewall/License.txt b/other-licenses/nsis/Contrib/liteFirewall/License.txt
new file mode 100644
index 0000000000..5e9673682f
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/License.txt
@@ -0,0 +1,17 @@
+liteFirewall is based on nsisFirewall.
+
+nsisFirewall -- Small NSIS plugin for simple tasks with Windows Firewall
+Web site: http://wiz0u.free.fr/prog/nsisFirewall
+
+Copyright (c) 2007-2009 Olivier Marcoux
+
+This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
diff --git a/other-licenses/nsis/Contrib/liteFirewall/ReadMe.txt b/other-licenses/nsis/Contrib/liteFirewall/ReadMe.txt
new file mode 100644
index 0000000000..42560ae0c0
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/ReadMe.txt
@@ -0,0 +1,39 @@
+liteFirewall 1.0 -- based on nsisFirewall 1.2
+
+http://liangsun.info/portfolio/nsis-plugin-litefirewall/
+http://nsis.sourceforge.net/LiteFirewall_Plugin
+
+---------------------------------------------------------
+liteFirewall resolved the issue nsisFirewall exists on Vista/Windows 7 platforms.
+It support the profiles (private, domain, public) of firewall rules.
+It support Unicode NSIS, while another firewall plugin SimpleFC not.
+------------------------------------------------------------
+
+Usage
+----------------------------------------------------------
+liteFirewall::AddRule "<application path>" "<rule name>"
+liteFirewall::RemoveRule "<application path>" "<rule name>"
+
+<application path> is the full path to the application you want to be authorized to
+ access the network (or accept incoming connections)
+
+<rule name> is the title that will be given to this exception entry in the firewall
+ control panel list
+
+
+Notes
+-----
+1) Your installer must be run with administrator rights for liteFirewall to work
+2) When compiling with more recent compiler than VC60, you need to choose the compilation
+option to use static MFC library.
+
+Sample scripts
+--------------
+
+ ; Add NOTEPAD to the authorized list
+ liteFirewall::AddRule "$WINDIR\Notepad.exe" "liteFirewall Test"
+ Pop $0
+
+ ; Remove NOTEPAD from the authorized list
+ liteFirewall::RemoveRule "$WINDIR\Notepad.exe" "liteFirewall Test"
+ Pop $0 \ No newline at end of file
diff --git a/other-licenses/nsis/Contrib/liteFirewall/Sample.nsi b/other-licenses/nsis/Contrib/liteFirewall/Sample.nsi
new file mode 100644
index 0000000000..20b0be47ca
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/Sample.nsi
@@ -0,0 +1,25 @@
+; liteFirewall - Sample script
+
+!ifdef TARGETDIR
+!addplugindir "${TARGETDIR}"
+!else
+!addplugindir "..\bin"
+!endif
+
+Name "Sample liteFirewall"
+OutFile "Sample.exe"
+ShowInstDetails show
+
+Section "Main program"
+ ; Add NOTEPAD to the authorized list
+ liteFirewallW::AddRule "$WINDIR\Notepad.exe" "liteFirewall Test"
+ Pop $0
+ Exec "rundll32.exe shell32.dll,Control_RunDLL firewall.cpl"
+ MessageBox MB_OK "Program added to Firewall exception list.$\r$\n(close the control panel before clicking OK)"
+
+ ; Remove NOTEPAD from the authorized list
+ liteFirewallW::RemoveRule "$WINDIR\Notepad.exe" "liteFirewall Test"
+ Pop $0
+ Exec "rundll32.exe shell32.dll,Control_RunDLL firewall.cpl"
+ MessageBox MB_OK "Program removed to Firewall exception list"
+SectionEnd
diff --git a/other-licenses/nsis/Contrib/liteFirewall/exdll.h b/other-licenses/nsis/Contrib/liteFirewall/exdll.h
new file mode 100644
index 0000000000..feca246b5a
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/exdll.h
@@ -0,0 +1,97 @@
+#ifndef _EXDLL_H_
+#define _EXDLL_H_
+
+// only include this file from one place in your DLL.
+// (it is all static, if you use it in two places it will fail)
+
+#define EXDLL_INIT() { \
+ g_stringsize=string_size; \
+ g_stacktop=stacktop; \
+ g_variables=variables; }
+
+// For page showing plug-ins
+#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
+#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
+#define NOTIFY_BYE_BYE 'x'
+
+typedef struct _stack_t {
+ struct _stack_t *next;
+ TCHAR text[1]; // this should be the length of string_size
+} stack_t;
+
+
+static unsigned int g_stringsize;
+static stack_t **g_stacktop;
+static TCHAR *g_variables;
+
+static int __stdcall popstring(TCHAR *str); // 0 on success, 1 on empty stack
+static void __stdcall pushstring(const TCHAR *str);
+
+enum
+{
+INST_0, // $0
+INST_1, // $1
+INST_2, // $2
+INST_3, // $3
+INST_4, // $4
+INST_5, // $5
+INST_6, // $6
+INST_7, // $7
+INST_8, // $8
+INST_9, // $9
+INST_R0, // $R0
+INST_R1, // $R1
+INST_R2, // $R2
+INST_R3, // $R3
+INST_R4, // $R4
+INST_R5, // $R5
+INST_R6, // $R6
+INST_R7, // $R7
+INST_R8, // $R8
+INST_R9, // $R9
+INST_CMDLINE, // $CMDLINE
+INST_INSTDIR, // $INSTDIR
+INST_OUTDIR, // $OUTDIR
+INST_EXEDIR, // $EXEDIR
+INST_LANG, // $LANGUAGE
+__INST_LAST
+};
+
+
+// utility functions (not required but often useful)
+static int __stdcall popstring(TCHAR *str)
+{
+ stack_t *th;
+ if (!g_stacktop || !*g_stacktop) return 1;
+ th=(*g_stacktop);
+ lstrcpy(str,th->text);
+ *g_stacktop = th->next;
+ GlobalFree((HGLOBAL)th);
+ return 0;
+}
+
+static void __stdcall pushstring(const TCHAR *str)
+{
+ stack_t *th;
+ if (!g_stacktop) return;
+ th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize*sizeof(TCHAR));
+ lstrcpyn(th->text,str,g_stringsize);
+ th->next=*g_stacktop;
+ *g_stacktop=th;
+}
+
+static TCHAR * __stdcall getuservariable(int varnum)
+{
+ if (varnum < 0 || varnum >= __INST_LAST) return NULL;
+ return g_variables+varnum*g_stringsize;
+}
+
+static void __stdcall setuservariable(int varnum, const TCHAR *var)
+{
+ if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
+ lstrcpy(g_variables + varnum*g_stringsize, var);
+}
+
+
+
+#endif//_EXDLL_H_ \ No newline at end of file
diff --git a/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.cpp b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.cpp
new file mode 100644
index 0000000000..5319938a04
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.cpp
@@ -0,0 +1,408 @@
+/*
+liteFirewall is based on nsisFirewall.
+Modified by Liang Sun on 19, July, 2011
+http://liangsun.info/portfolio/nsis-plugin-litefirewall/
+http://nsis.sourceforge.net/LiteFirewall_Plugin
+http://www.msnlite.org
+*/
+
+/*
+nsisFirewall -- Small NSIS plugin for simple tasks with Windows Firewall
+Web site: http://wiz0u.free.fr/prog/nsisFirewall
+
+Copyright (c) 2007-2009 Olivier Marcoux
+
+This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include <windows.h>
+#include <tchar.h>
+#include <shlwapi.h>
+//#include <stdio.h>
+
+#ifdef NSIS
+#include "exdll.h"
+#endif
+
+//#import "libid:58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08"
+#import "netfw.tlb"
+#include <netfw.h>
+using namespace NetFwTypeLib;
+
+
+#pragma comment( lib, "ole32.lib" )
+#pragma comment( lib, "oleaut32.lib" )
+// Forward declarations
+
+#ifdef NSIS
+HINSTANCE g_hInstance;
+#endif
+
+HRESULT WFCOMInitialize(INetFwPolicy2** ppNetFwPolicy2);
+
+HRESULT AddRule(LPCTSTR ExceptionName, LPCTSTR ProcessPath)
+{
+ HRESULT result = CoInitialize(NULL);
+ if (FAILED(result))
+ return result;
+ result = REGDB_E_CLASSNOTREG;
+
+ HRESULT hrComInit = S_OK;
+ HRESULT hr = S_OK;
+
+ INetFwPolicy2 *pNetFwPolicy2 = NULL;
+ INetFwRules *pFwRules = NULL;
+ INetFwRule *pFwRule = NULL;
+/* Start Mozilla modification */
+ INetFwRule *pFwRuleExisting = NULL;
+
+// long CurrentProfilesBitMask = 0;
+/* End Mozilla modification */
+
+ BSTR bstrRuleName = SysAllocString(ExceptionName);
+ BSTR bstrApplicationName = SysAllocString(ProcessPath);
+ BSTR bstrRuleInterfaceType = SysAllocString(L"All");
+
+ // Initialize COM.
+ hrComInit = CoInitializeEx(
+ 0,
+ COINIT_APARTMENTTHREADED
+ );
+
+ // Ignore RPC_E_CHANGED_MODE; this just means that COM has already been
+ // initialized with a different mode. Since we don't care what the mode is,
+ // we'll just use the existing mode.
+ if (hrComInit != RPC_E_CHANGED_MODE)
+ {
+ if (FAILED(hrComInit))
+ {
+ printf("CoInitializeEx failed: 0x%08lx\n", hrComInit);
+ goto Cleanup;
+ }
+ }
+
+ // Retrieve INetFwPolicy2
+ hr = WFCOMInitialize(&pNetFwPolicy2);
+ if (FAILED(hr))
+ {
+ try
+ {
+ INetFwMgrPtr fwMgr(L"HNetCfg.FwMgr");
+ if (fwMgr)
+ {
+ INetFwAuthorizedApplicationPtr app(L"HNetCfg.FwAuthorizedApplication");
+ if (app)
+ {
+ app->ProcessImageFileName = ProcessPath;
+ app->Name = ExceptionName;
+ app->Scope = NetFwTypeLib::NET_FW_SCOPE_ALL;
+ app->IpVersion = NetFwTypeLib::NET_FW_IP_VERSION_ANY;
+ app->Enabled = VARIANT_TRUE;
+ fwMgr->LocalPolicy->CurrentProfile->AuthorizedApplications->Add(app);
+ }
+ }
+ }
+ catch (_com_error& e)
+ {
+ printf("%s", e.Error());
+ }
+ goto Cleanup;
+ }
+
+ // Retrieve INetFwRules
+ hr = pNetFwPolicy2->get_Rules(&pFwRules);
+ if (FAILED(hr))
+ {
+ printf("get_Rules failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+/* Start Mozilla modification */
+ // Don't add a new rule if there is an existing rule with the same name.
+ hr = pFwRules->Item(bstrRuleName, &pFwRuleExisting);
+ // Release the INetFwRule object
+ if (pFwRuleExisting != NULL)
+ {
+ pFwRuleExisting->Release();
+ }
+ if (SUCCEEDED(hr))
+ {
+ printf("Firewall profile already exists\n");
+ goto Cleanup;
+ }
+
+ // Retrieve Current Profiles bitmask
+// hr = pNetFwPolicy2->get_CurrentProfileTypes(&CurrentProfilesBitMask);
+// if (FAILED(hr))
+// {
+// printf("get_CurrentProfileTypes failed: 0x%08lx\n", hr);
+// goto Cleanup;
+// }
+
+ // When possible we avoid adding firewall rules to the \ profile.
+ // If Public is currently active and it is not the only active profile, we remove it from the bitmask
+// if ((CurrentProfilesBitMask & NET_FW_PROFILE2_PUBLIC) &&
+// (CurrentProfilesBitMask != NET_FW_PROFILE2_PUBLIC))
+// {
+// CurrentProfilesBitMask ^= NET_FW_PROFILE2_PUBLIC;
+// }
+
+ // Create a new Firewall Rule object.
+ hr = CoCreateInstance(
+ __uuidof(NetFwRule),
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ __uuidof(INetFwRule),
+ (void**)&pFwRule);
+ if (FAILED(hr))
+ {
+ printf("CoCreateInstance for Firewall Rule failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+ // Populate the Firewall Rule object
+ pFwRule->put_Name(bstrRuleName);
+ pFwRule->put_Protocol(NetFwTypeLib::NET_FW_IP_PROTOCOL_TCP);
+ pFwRule->put_InterfaceTypes(bstrRuleInterfaceType);
+ pFwRule->put_Profiles(NET_FW_PROFILE2_PRIVATE);
+ pFwRule->put_Action(NET_FW_ACTION_ALLOW);
+ pFwRule->put_Enabled(VARIANT_TRUE);
+
+ pFwRule->put_ApplicationName(bstrApplicationName);
+ // Add the Firewall Rule
+ hr = pFwRules->Add(pFwRule);
+ if (FAILED(hr))
+ {
+ printf("Firewall Rule Add failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+ pFwRule->Release();
+/* End Mozilla modification */
+
+ // Create a new Firewall Rule object.
+ hr = CoCreateInstance(
+ __uuidof(NetFwRule),
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ __uuidof(INetFwRule),
+ (void**)&pFwRule);
+ if (FAILED(hr))
+ {
+ printf("CoCreateInstance for Firewall Rule failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+ // Populate the Firewall Rule object
+ pFwRule->put_Name(bstrRuleName);
+/* Start Mozilla modification */
+// pFwRule->put_Protocol(NET_FW_IP_PROTOCOL_ANY);
+ pFwRule->put_Protocol(NetFwTypeLib::NET_FW_IP_PROTOCOL_UDP);
+/* End Mozilla modification */
+ pFwRule->put_InterfaceTypes(bstrRuleInterfaceType);
+/* Start Mozilla modification */
+// pFwRule->put_Profiles(CurrentProfilesBitMask);
+ pFwRule->put_Profiles(NET_FW_PROFILE2_PRIVATE);
+/* End Mozilla modification */
+ pFwRule->put_Action(NET_FW_ACTION_ALLOW);
+ pFwRule->put_Enabled(VARIANT_TRUE);
+
+ pFwRule->put_ApplicationName(bstrApplicationName);
+ // Add the Firewall Rule
+ hr = pFwRules->Add(pFwRule);
+ if (FAILED(hr))
+ {
+ printf("Firewall Rule Add failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+Cleanup:
+
+ // Free BSTR's
+ SysFreeString(bstrRuleName);
+ SysFreeString(bstrApplicationName);
+ SysFreeString(bstrRuleInterfaceType);
+
+ // Release the INetFwRule object
+ if (pFwRule != NULL)
+ {
+ pFwRule->Release();
+ }
+
+ // Release the INetFwRules object
+ if (pFwRules != NULL)
+ {
+ pFwRules->Release();
+ }
+
+ // Release the INetFwPolicy2 object
+ if (pNetFwPolicy2 != NULL)
+ {
+ pNetFwPolicy2->Release();
+ }
+
+ CoUninitialize();
+ return 0;
+}
+
+HRESULT RemoveRule(LPCTSTR ExceptionName, LPCTSTR ProcessPath)
+{
+ HRESULT result = CoInitialize(NULL);
+ if (FAILED(result))
+ return result;
+ try
+ {
+ INetFwMgrPtr fwMgr(L"HNetCfg.FwMgr");
+ if (fwMgr)
+ {
+ fwMgr->LocalPolicy->CurrentProfile->AuthorizedApplications->Remove(ProcessPath);
+ result = S_OK;
+ }
+ }
+ catch (_com_error& e)
+ {
+ e;
+ }
+ HRESULT hrComInit = S_OK;
+ HRESULT hr = S_OK;
+
+ INetFwPolicy2 *pNetFwPolicy2 = NULL;
+ INetFwRules *pFwRules = NULL;
+
+/* Start Mozilla modification */
+// long CurrentProfilesBitMask = 0;
+/* End Mozilla modification */
+
+ BSTR bstrRuleName = SysAllocString(ExceptionName);
+
+ // Retrieve INetFwPolicy2
+ hr = WFCOMInitialize(&pNetFwPolicy2);
+ if (FAILED(hr))
+ {
+ goto Cleanup;
+ }
+
+ // Retrieve INetFwRules
+ hr = pNetFwPolicy2->get_Rules(&pFwRules);
+ if (FAILED(hr))
+ {
+ printf("get_Rules failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+/* Start Mozilla modification */
+ // Retrieve Current Profiles bitmask
+// hr = pNetFwPolicy2->get_CurrentProfileTypes(&CurrentProfilesBitMask);
+// if (FAILED(hr))
+// {
+// printf("get_CurrentProfileTypes failed: 0x%08lx\n", hr);
+// goto Cleanup;
+// }
+
+ // When possible we avoid adding firewall rules to the Public profile.
+ // If Public is currently active and it is not the only active profile, we remove it from the bitmask
+// if ((CurrentProfilesBitMask & NET_FW_PROFILE2_PUBLIC) &&
+// (CurrentProfilesBitMask != NET_FW_PROFILE2_PUBLIC))
+// {
+// CurrentProfilesBitMask ^= NET_FW_PROFILE2_PUBLIC;
+// }
+/* End Mozilla modification */
+
+ // Remove the Firewall Rule
+ hr = pFwRules->Remove(bstrRuleName);
+ if (FAILED(hr))
+ {
+ printf("Firewall Rule Remove failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+Cleanup:
+
+ // Free BSTR's
+ SysFreeString(bstrRuleName);
+
+ // Release the INetFwRules object
+ if (pFwRules != NULL)
+ {
+ pFwRules->Release();
+ }
+
+ // Release the INetFwPolicy2 object
+ if (pNetFwPolicy2 != NULL)
+ {
+ pNetFwPolicy2->Release();
+ }
+
+ CoUninitialize();
+ return 0;
+}
+
+
+#ifdef NSIS
+extern "C" void __declspec(dllexport) AddRule(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop)
+{
+ EXDLL_INIT();
+
+ TCHAR ExceptionName[256], ProcessPath[MAX_PATH];
+ popstring(ProcessPath);
+ popstring(ExceptionName);
+ HRESULT result = AddRule(ExceptionName, ProcessPath);
+ // push the result back to NSIS
+ TCHAR intBuffer[16];
+ wsprintf(intBuffer, _T("%d"), result);
+ pushstring(intBuffer);
+}
+
+extern "C" void __declspec(dllexport) RemoveRule(HWND hwndParent, int string_size,
+ TCHAR *variables, stack_t **stacktop)
+{
+ EXDLL_INIT();
+
+ TCHAR ExceptionName[256], ProcessPath[MAX_PATH];
+ popstring(ProcessPath);
+ popstring(ExceptionName);
+ HRESULT result = RemoveRule(ExceptionName, ProcessPath);
+ // push the result back to NSIS
+ TCHAR intBuffer[16];
+ wsprintf(intBuffer, _T("%d"), result);
+ pushstring(intBuffer);
+}
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
+{
+ g_hInstance = hInstance;
+ return TRUE;
+}
+#endif
+
+
+// Instantiate INetFwPolicy2
+
+HRESULT WFCOMInitialize(INetFwPolicy2** ppNetFwPolicy2)
+{
+ HRESULT hr = S_OK;
+
+ hr = CoCreateInstance(
+ __uuidof(NetFwPolicy2),
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ __uuidof(INetFwPolicy2),
+ (void**)ppNetFwPolicy2);
+
+ if (FAILED(hr))
+ {
+ printf("CoCreateInstance for INetFwPolicy2 failed: 0x%08lx\n", hr);
+ goto Cleanup;
+ }
+
+Cleanup:
+ return hr;
+}
diff --git a/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsp b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsp
new file mode 100644
index 0000000000..cae606b4cb
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsp
@@ -0,0 +1,204 @@
+# Microsoft Developer Studio Project File - Name="liteFirewall" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=liteFirewall - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "liteFirewall.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "liteFirewall.mak" CFG="liteFirewall - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "liteFirewall - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "liteFirewall - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "liteFirewall - Win32 Release UNICODE" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "liteFirewall - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /Zi /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "NSIS" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib shlwapi.lib /nologo /dll /machine:I386 /out:"../bin/liteFirewall.dll" /OPT:REF /OPT:NOWIN98
+# SUBTRACT LINK32 /pdb:none /debug /nodefaultlib
+# Begin Special Build Tool
+IntDir=.\Release
+ProjDir=.
+TargetDir=\Prog\shared\bin
+SOURCE="$(InputPath)"
+PostBuild_Desc=Building Sample Installer...
+PostBuild_Cmds="%ProgramFiles%\NSIS\makensis" /V2 "/DTARGETDIR=$(TargetDir)" "/DINTDIR=$(IntDir)" "$(ProjDir)\Sample.nsi"
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "liteFirewall - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "NSIS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib shlwapi.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# SUBTRACT LINK32 /nodefaultlib
+# Begin Special Build Tool
+IntDir=.\Debug
+ProjDir=.
+TargetDir=.\Debug
+SOURCE="$(InputPath)"
+PostBuild_Desc=Building Sample Installer...
+PostBuild_Cmds="%ProgramFiles%\NSIS\makensis" /V4 /DTARGETDIR=$(TargetDir) /DINTDIR=$(IntDir) $(ProjDir)\Sample.nsi
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "liteFirewall - Win32 Release UNICODE"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_UNICODE"
+# PROP BASE Intermediate_Dir "Release_UNICODE"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_UNICODE"
+# PROP Intermediate_Dir "Release_UNICODE"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /Zi /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "NSIS" /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "NSIS" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib shlwapi.lib /nologo /dll /machine:I386 /out:"../bin/liteFirewall.dll" /OPT:REF /OPT:NOWIN98
+# SUBTRACT BASE LINK32 /pdb:none /debug /nodefaultlib
+# ADD LINK32 kernel32.lib user32.lib shlwapi.lib /nologo /dll /machine:I386 /out:"../bin/liteFirewallW.dll" /OPT:REF /OPT:NOWIN98
+# SUBTRACT LINK32 /pdb:none /debug /nodefaultlib
+# Begin Special Build Tool
+IntDir=.\Release_UNICODE
+ProjDir=.
+TargetDir=\Prog\shared\bin
+SOURCE="$(InputPath)"
+PostBuild_Desc=Building Sample Installer...
+PostBuild_Cmds="%ProgramFiles%\NSIS\makensis" /V2 "/DTARGETDIR=$(TargetDir)" "/DINTDIR=$(IntDir)" "$(ProjDir)\Sample.nsi"
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "liteFirewall - Win32 Release"
+# Name "liteFirewall - Win32 Debug"
+# Name "liteFirewall - Win32 Release UNICODE"
+# Begin Source File
+
+SOURCE=.\exdll.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\License.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\liteFirewall.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sample.nsi
+
+!IF "$(CFG)" == "liteFirewall - Win32 Release"
+
+# Begin Custom Build
+ProjDir=.
+InputPath=.\Sample.nsi
+
+"$(ProjDir)\Sample.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ rem Force Post-Build Step
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "liteFirewall - Win32 Debug"
+
+# Begin Custom Build
+ProjDir=.
+InputPath=.\Sample.nsi
+
+"$(ProjDir)\Sample.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ rem Force Post-Build Step
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "liteFirewall - Win32 Release UNICODE"
+
+# Begin Custom Build
+ProjDir=.
+InputPath=.\Sample.nsi
+
+"$(ProjDir)\Sample.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ rem Force Post-Build Step
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsw b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsw
new file mode 100644
index 0000000000..d4ca962de0
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "liteFirewall"=.\liteFirewall.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.sln b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.sln
new file mode 100644
index 0000000000..e62a48e344
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.sln
@@ -0,0 +1,23 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liteFirewall", "liteFirewall.vcproj", "{F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release UNICODE|Win32 = Release UNICODE|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}.Debug|Win32.Build.0 = Debug|Win32
+ {F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}.Release UNICODE|Win32.ActiveCfg = Release UNICODE|Win32
+ {F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}.Release UNICODE|Win32.Build.0 = Release UNICODE|Win32
+ {F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}.Release|Win32.ActiveCfg = Release|Win32
+ {F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.vcproj b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.vcproj
new file mode 100644
index 0000000000..e1832b7ce6
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/liteFirewall.vcproj
@@ -0,0 +1,390 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="liteFirewall"
+ ProjectGUID="{F7462DF9-A430-4185-9AFC-8FAEA0FB98EA}"
+ TargetFrameworkVersion="0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/liteFirewall.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;UNICODE;NSIS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/liteFirewall.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="shlwapi.lib"
+ OutputFile=".\Debug/liteFirewall.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/liteFirewall.pdb"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/liteFirewall.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/liteFirewall.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Building Sample Installer..."
+ CommandLine="&quot;E:\Program Files (x86)\NSIS\Unicode\makensis&quot; /V4 /DTARGETDIR=$(TargetDir) /DINTDIR=$(IntDir) $(ProjectDir)Sample.nsi"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release UNICODE|Win32"
+ OutputDirectory=".\Release_UNICODE"
+ IntermediateDirectory=".\Release_UNICODE"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release_UNICODE/liteFirewall.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;UNICODE;NSIS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release_UNICODE/liteFirewall.pch"
+ AssemblerListingLocation=".\Release_UNICODE/"
+ ObjectFile=".\Release_UNICODE/"
+ ProgramDataBaseFileName=".\Release_UNICODE/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="shlwapi.lib"
+ OutputFile="../bin/liteFirewallW.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release_UNICODE/liteFirewallW.pdb"
+ OptimizeReferences="2"
+ OptimizeForWindows98="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release_UNICODE/liteFirewallW.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release_UNICODE/liteFirewall.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Building Sample Installer..."
+ CommandLine="&quot;E:\Program Files (x86)\NSIS\Unicode\makensis&quot; /V2 /DTARGETDIR=$(TargetDir) /DINTDIR=$(IntDir) $(ProjectDir)Sample.nsi"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/liteFirewall.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;NSIS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/liteFirewall.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="shlwapi.lib"
+ OutputFile="../bin/liteFirewall.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/liteFirewall.pdb"
+ OptimizeReferences="2"
+ OptimizeForWindows98="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release/liteFirewall.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/liteFirewall.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Building Sample Installer..."
+ CommandLine="&quot;E:\Program Files (x86)\NSIS\Unicode\makensis&quot; /V2 /DTARGETDIR=$(TargetDir) /DINTDIR=$(IntDir) $(ProjectDir)Sample.nsi"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="exdll.h"
+ >
+ </File>
+ <File
+ RelativePath="License.txt"
+ >
+ </File>
+ <File
+ RelativePath="liteFirewall.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release UNICODE|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ReadMe.txt"
+ >
+ </File>
+ <File
+ RelativePath="Sample.nsi"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="rem Force Post-Build Step&#x0D;&#x0A;"
+ Outputs="$(ProjectDir)Sample.exe"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release UNICODE|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="rem Force Post-Build Step&#x0D;&#x0A;"
+ Outputs="$(ProjectDir)Sample.exe"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="rem Force Post-Build Step&#x0D;&#x0A;"
+ Outputs="$(ProjectDir)Sample.exe"
+ />
+ </FileConfiguration>
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/other-licenses/nsis/Contrib/liteFirewall/netfw.tlb b/other-licenses/nsis/Contrib/liteFirewall/netfw.tlb
new file mode 100644
index 0000000000..18ff3481a6
--- /dev/null
+++ b/other-licenses/nsis/Contrib/liteFirewall/netfw.tlb
Binary files differ