Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordnobori <da.git@softether.co.jp>2014-01-04 17:00:08 +0400
committerdnobori <da.git@softether.co.jp>2014-01-04 17:00:08 +0400
commit749497dde0a1dd08c434a73b9d4e93dc3e3326d9 (patch)
tree7c83a55919c0f1aa1267c4dbcd008f1644f961ee /src/BuildUtil
parentd433e567a561f8ae094a535025b02c7dc47026c6 (diff)
v4.03-9408-rtm
Diffstat (limited to 'src/BuildUtil')
-rw-r--r--src/BuildUtil/BuildUtil.csproj181
-rw-r--r--src/BuildUtil/BuildUtilCommands.cs1245
-rw-r--r--src/BuildUtil/BuildUtilIcon.icobin0 -> 30208 bytes
-rw-r--r--src/BuildUtil/BuildUtilMain.cs193
-rw-r--r--src/BuildUtil/CodeSign.cs263
-rw-r--r--src/BuildUtil/CopyBuildUtil.cmd2
-rw-r--r--src/BuildUtil/CoreUtil.dllbin0 -> 346624 bytes
-rw-r--r--src/BuildUtil/PEUtil.cs231
-rw-r--r--src/BuildUtil/Properties/AssemblyInfo.cs18
-rw-r--r--src/BuildUtil/Properties/Settings.Designer.cs115
-rw-r--r--src/BuildUtil/Properties/Settings.settings12
-rw-r--r--src/BuildUtil/Test.cs125
-rw-r--r--src/BuildUtil/UnixBuildSoftwares.cs1015
-rw-r--r--src/BuildUtil/VpnBuilder.cs650
-rw-r--r--src/BuildUtil/VpnBuilderConfig.cs513
-rw-r--r--src/BuildUtil/VpnBuilderConfigTypes.cs303
-rw-r--r--src/BuildUtil/Web References/HvSignService/Reference.cs282
-rw-r--r--src/BuildUtil/Web References/HvSignService/Sign.disco6
-rw-r--r--src/BuildUtil/Web References/HvSignService/Sign.wsdl106
-rw-r--r--src/BuildUtil/Web References/SignService/Reference.cs281
-rw-r--r--src/BuildUtil/Web References/SignService/Sign.disco6
-rw-r--r--src/BuildUtil/Web References/SignService/Sign.wsdl105
-rw-r--r--src/BuildUtil/Win32BuildSoftware.cs160
-rw-r--r--src/BuildUtil/Win32BuildUtil.cs1063
-rw-r--r--src/BuildUtil/app.config18
25 files changed, 6893 insertions, 0 deletions
diff --git a/src/BuildUtil/BuildUtil.csproj b/src/BuildUtil/BuildUtil.csproj
new file mode 100644
index 00000000..effc6d26
--- /dev/null
+++ b/src/BuildUtil/BuildUtil.csproj
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{384815C3-333C-4CEC-9DCD-B6AB2602EBB9}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>BuildUtil</RootNamespace>
+ <AssemblyName>BuildUtilTmp</AssemblyName>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ApplicationIcon>BuildUtilIcon.ico</ApplicationIcon>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <StartupObject>BuildUtil.BuildUtilMain</StartupObject>
+ <NoWin32Manifest>true</NoWin32Manifest>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\bin\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;BU_SOFTETHER;BU_OSS</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ <DocumentationFile>
+ </DocumentationFile>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="CoreUtil, Version=1.1.4781.28908, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>.\CoreUtil.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.EnterpriseServices" />
+ <Reference Include="System.Runtime.Serialization.Formatters.Soap" />
+ <Reference Include="System.Transactions" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BuildUtilCommands.cs" />
+ <Compile Include="BuildUtilMain.cs" />
+ <Compile Include="CodeSign.cs" />
+
+ <Compile Include="PEUtil.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ <DependentUpon>Settings.settings</DependentUpon>
+ </Compile>
+ <Compile Include="Test.cs" />
+ <Compile Include="UnixBuildSoftwares.cs" />
+ <Compile Include="VpnBuilder.cs" />
+ <Compile Include="VpnBuilderConfig.cs" />
+ <Compile Include="VpnBuilderConfigTypes.cs" />
+ <Compile Include="Web References\HvSignService\Reference.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Reference.map</DependentUpon>
+ </Compile>
+ <Compile Include="Web References\SignService\Reference.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Reference.map</DependentUpon>
+ </Compile>
+ <Compile Include="Win32BuildSoftware.cs" />
+ <Compile Include="Win32BuildUtil.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <WebReferences Include="Web References\" />
+ </ItemGroup>
+ <ItemGroup>
+ <WebReferenceUrl Include="http://dv/Sign/Sign.asmx">
+ <UrlBehavior>Dynamic</UrlBehavior>
+ <RelPath>Web References\SignService\</RelPath>
+ <UpdateFromURL>http://dv/Sign/Sign.asmx</UpdateFromURL>
+ <ServiceLocationURL>
+ </ServiceLocationURL>
+ <CachedDynamicPropName>
+ </CachedDynamicPropName>
+ <CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
+ <CachedSettingsPropName>BuildUtil_SignService_Sign</CachedSettingsPropName>
+ </WebReferenceUrl>
+ <WebReferenceUrl Include="http://hvsigncode/Sign.asmx">
+ <UrlBehavior>Dynamic</UrlBehavior>
+ <RelPath>Web References\HvSignService\</RelPath>
+ <UpdateFromURL>http://hvsigncode/Sign.asmx</UpdateFromURL>
+ <ServiceLocationURL>
+ </ServiceLocationURL>
+ <CachedDynamicPropName>
+ </CachedDynamicPropName>
+ <CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
+ <CachedSettingsPropName>BuildUtilTmp_HvSignService_Sign</CachedSettingsPropName>
+ </WebReferenceUrl>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <None Include="Web References\HvSignService\Sign.wsdl" />
+ <None Include="Web References\SignService\Reference.map">
+ <Generator>MSDiscoCodeGenerator</Generator>
+ <LastGenOutput>Reference.cs</LastGenOutput>
+ </None>
+ <None Include="Web References\SignService\Sign.disco" />
+ <None Include="Web References\SignService\Sign.wsdl" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="BuildUtilIcon.ico" />
+ <None Include="Web References\HvSignService\Reference.map">
+ <Generator>MSDiscoCodeGenerator</Generator>
+ <LastGenOutput>Reference.cs</LastGenOutput>
+ </None>
+ <None Include="Web References\HvSignService\Sign.disco" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>$(ProjectDir)CopyBuildUtil.cmd</PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/src/BuildUtil/BuildUtilCommands.cs b/src/BuildUtil/BuildUtilCommands.cs
new file mode 100644
index 00000000..9d78477c
--- /dev/null
+++ b/src/BuildUtil/BuildUtilCommands.cs
@@ -0,0 +1,1245 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ public static class BuildUtilCommands
+ {
+ // Perform all
+ [ConsoleCommandMethod(
+ "Builds all sources and releases all packages.",
+ "All [yes|no] [/NORMALIZESRC:yes|no] [/IGNOREERROR:yes|no] [/DEBUG:yes|no] [/SERIAL:yes|no]",
+ "Builds all sources and releases all packages.",
+ "[yes|no]:Specify 'yes' if you'd like to increment the build number.",
+ "NORMALIZESRC:Specity 'yes' if you'd like to normalize the build infomations in the source codes and resource scripts.",
+ "IGNOREERROR:Specify yes if you'd like to ignore the child process to show the error message.",
+ "SERIAL:Specify yes not to use parallel mode.",
+ "DEBUG:Specity yes to enable debug mode. (UNIX only)"
+#if !BU_SOFTETHER
+ , "SEVPN:Build SoftEther VPN Automatically After PacketiX VPN Build"
+#endif
+ )]
+ static int All(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+#if !BU_SOFTETHER
+ new ConsoleParam("[yes|no]", ConsoleService.Prompt, "Increments build number (y/n) ? ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("SEVPN", ConsoleService.Prompt, "Build SoftEther VPN automatically after PacketiX VPN Build (y/n) ? ", ConsoleService.EvalNotEmpty, null),
+#else
+ new ConsoleParam("[yes|no]"),
+#endif
+ new ConsoleParam("IGNOREERROR"),
+ new ConsoleParam("DEBUG"),
+ new ConsoleParam("SERIAL"),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ DateTime start = Time.NowDateTime;
+
+ Win32BuildUtil.ExecCommand(Env.ExeFileName, string.Format("/CMD:BuildWin32 {0} /NORMALIZESRC:{1}",
+ vl["[yes|no]"].BoolValue ? "yes" : "no",
+ "yes"));
+
+ Win32BuildUtil.ExecCommand(Env.ExeFileName, string.Format("/CMD:ReleaseWin32 all /IGNOREERROR:{0} /SERIAL:{1}",
+ vl["IGNOREERROR"].BoolValue ? "yes" : "no",
+ vl["SERIAL"].BoolValue ? "yes" : "no"));
+
+#if !BU_OSS
+ Win32BuildUtil.ExecCommand(Env.ExeFileName, string.Format("/CMD:ReleaseUnix all /IGNOREERROR:{0} /DEBUG:{1} /SERIAL:{2}",
+ vl["IGNOREERROR"].BoolValue ? "yes" : "no",
+ vl["DEBUG"].BoolValue ? "yes" : "no",
+ vl["SERIAL"].BoolValue ? "yes" : "no"));
+#endif
+
+ Win32BuildUtil.ExecCommand(Env.ExeFileName, string.Format("/CMD:CopyRelease"));
+
+#if !BU_SOFTETHER
+ Win32BuildUtil.ExecCommand(Env.ExeFileName, string.Format("/CMD:MakeOpenSource"));
+
+ Win32BuildUtil.ExecCommand(Env.ExeFileName, string.Format("/CMD:MakeSoftEtherDir"));
+
+ if (vl["SEVPN"].BoolValue)
+ {
+ // Build SEVPN
+ Win32BuildUtil.ExecCommand(Paths.CmdFileName, string.Format("/C \"{0}\"", Path.Combine(Paths.SoftEtherBuildDir, @"Main\BuildAll.cmd")));
+ }
+#endif
+
+ DateTime end = Time.NowDateTime;
+
+ Con.WriteLine("Taken time: {0}.", (end - start));
+
+ return 0;
+ }
+
+#if !BU_SOFTETHER
+ // Create SoftEther Edition source
+ [ConsoleCommandMethod(
+ "Make MakeSoftEtherDir Source Dir.",
+ "MakeSoftEtherDir",
+ "Make MakeSoftEtherDir Source Dir."
+ )]
+ static int MakeSoftEtherDir(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ OpenSourceUtil.MakeSoftEtherDir();
+
+ return 0;
+ }
+
+ // Create an open source version of source
+ [ConsoleCommandMethod(
+ "Make MakeOpenSource Source Dir.",
+ "MakeOpenSource",
+ "Make MakeOpenSource Source Dir."
+ )]
+ static int MakeOpenSource(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ OpenSourceUtil.MakeOpenSource();
+
+ return 0;
+ }
+#endif
+
+ // Copy the released files
+ [ConsoleCommandMethod(
+ "Copies all release files.",
+ "CopyRelease",
+ "Copies all release files."
+ )]
+ static int CopyRelease(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ int build, version;
+ string name;
+ DateTime date;
+ Win32BuildUtil.ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+
+ string baseName = string.Format("v{0}-{1}-{2}-{3:D4}.{4:D2}.{5:D2}",
+ BuildHelper.VersionIntToString(version),
+ build,
+ name,
+ date.Year, date.Month, date.Day);
+
+#if !BU_OSS
+ string destDirName = Path.Combine(Paths.ReleaseDestDir,
+ string.Format(@"{0}-{1}-{2}-{3}",
+ Str.DateToStrShort(BuildSoftwareList.ListCreatedDateTime),
+ baseName,
+ Env.MachineName, Env.UserName));
+#else // !BU_OSS
+ string destDirName = Path.Combine(Paths.ReleaseDestDir,
+ string.Format(@"{1}",
+ Str.DateToStrShort(BuildSoftwareList.ListCreatedDateTime),
+ baseName,
+ Env.MachineName, Env.UserName));
+#endif
+
+#if !BU_OSS
+ string publicDir = Path.Combine(destDirName, "Public");
+#else // !BU_OSS
+ string publicDir = destDirName;
+#endif
+
+#if !BU_OSS
+ string filesReleaseDir = Path.Combine(publicDir, baseName);
+#else // !BU_OSS
+ string filesReleaseDir = publicDir;
+#endif
+
+ string autorunReleaseSrcDir = Path.Combine(publicDir, "autorun");
+
+ IO.CopyDir(Paths.ReleaseDir, filesReleaseDir, null, false, true);
+
+#if !BU_OSS
+ IO.CopyDir(Paths.ReleaseSrckitDir, Path.Combine(destDirName, "Private"), null, false, true);
+ IO.CopyDir(Path.Combine(Paths.BaseDirName, @"tmp\lib"), Path.Combine(destDirName, @"Private\lib"), null, false, true);
+#endif
+
+ //IO.MakeDir(autorunReleaseSrcDir);
+
+ /*
+ File.Copy(Path.Combine(Paths.AutorunSrcDir, "Project1.exe"),
+ Path.Combine(autorunReleaseSrcDir, "autorun.exe"), true);
+
+ File.Copy(Path.Combine(Paths.AutorunSrcDir, "autorun.inf"),
+ Path.Combine(autorunReleaseSrcDir, "autorun.inf"), true);
+
+ File.Copy(Path.Combine(Paths.AutorunSrcDir, "packetix.ico"),
+ Path.Combine(autorunReleaseSrcDir, "autorun.ico"), true);*/
+
+ // Create a batch file
+ string batchFileName = Path.Combine(publicDir, "MakeCD.cmd");
+#if !BU_OSS
+ StreamWriter w = new StreamWriter(batchFileName);
+#else // !BU_OSS
+ StringWriter w = new StringWriter();
+#endif
+ w.WriteLine(@"SETLOCAL");
+ w.WriteLine(@"SET BATCH_FILE_NAME=%0");
+ w.WriteLine(@"SET BATCH_DIR_NAME=%0\..");
+ w.WriteLine(@"SET NOW_TMP=%time:~0,2%");
+ w.WriteLine(@"SET NOW=%date:~0,4%%date:~5,2%%date:~8,2%_%NOW_TMP: =0%%time:~3,2%%time:~6,2%");
+ w.WriteLine();
+ w.WriteLine();
+
+ string[] files = Directory.GetFiles(filesReleaseDir, "*", SearchOption.AllDirectories);
+
+ string cddir = "CD";
+ /*string.Format("CD-v{0}.{1}-{2}-{3}-{4:D4}.{5:D2}.{6:D2}",
+ version / 100, version % 100, build, name,
+ date.Year, date.Month, date.Day);*/
+
+ StringWriter txt = new StringWriter();
+
+ foreach (string filename in files)
+ {
+ string file = filename;
+
+ BuildSoftware s = new BuildSoftware(file);
+
+ // Software\Windows\PacketiX VPN Server 4.0\32bit (Intel x86)\filename.exe
+ string cpustr = string.Format("{0} - {1}", CPUBitsUtil.CPUBitsToString(s.Cpu.Bits), s.Cpu.Title).Replace("/", "or");
+ string cpustr2 = cpustr;
+
+ if (s.Cpu == CpuList.intel)
+ {
+ cpustr2 = "";
+ cpustr = "Intel";
+ }
+
+ string tmp = string.Format(@"{1}\{2}\{3}\{5}{4}",
+ 0,
+ s.Os.Title,
+ BuildHelper.GetSoftwareTitle(s.Software),
+ cpustr2,
+ Path.GetFileName(file),
+ ""
+ );
+
+ tmp = Str.ReplaceStr(tmp, "\\\\", "\\");
+
+ w.WriteLine("mkdir \"{1}\\{0}\"", Path.GetDirectoryName(tmp), cddir);
+ w.WriteLine("copy /b /y \"{2}\\{0}\" \"{3}\\{1}\"", IO.GetRelativeFileName(file, filesReleaseDir), tmp, baseName, cddir);
+ w.WriteLine();
+
+ string txt_filename = tmp;
+ txt_filename = Str.ReplaceStr(txt_filename, "\\", "/");
+
+ string txt_description = BuildHelper.GetSoftwareTitle(s.Software);
+
+ string txt_products = BuildHelper.GetSoftwareProductList(s.Software);
+
+ string txt_os = s.Os.Title;
+
+ string txt_cpu = s.Cpu.Title;
+ if (s.Cpu.Bits != CPUBits.Both)
+ {
+ txt_cpu += " (" + CPUBitsUtil.CPUBitsToString(s.Cpu.Bits) + ")";
+ }
+ else
+ {
+ txt_cpu += " (x86 and x64)";
+ }
+
+ string txt_version = BuildHelper.VersionIntToString(version);
+
+ string txt_build = build.ToString();
+
+ string txt_verstr = name;
+
+ string txt_date = Str.DateTimeToStrShortWithMilliSecs(date);
+
+ string txt_lang = "English, Japanese, Simplified Chinese";
+
+ string txt_category = "PacketiX VPN (Commercial)";
+
+#if BU_SOFTETHER
+ txt_category = "SoftEther VPN (Freeware)";
+#endif
+
+ txt.WriteLine("FILENAME\t" + txt_filename);
+ txt.WriteLine("DESCRIPTION\t" + txt_description);
+ txt.WriteLine("CATEGORY\t" + txt_category);
+ txt.WriteLine("PRODUCT\t" + txt_products);
+ txt.WriteLine("OS\t" + txt_os);
+ txt.WriteLine("OSLIST\t" + s.Os.OSSimpleList);
+ txt.WriteLine("CPU\t" + txt_cpu);
+ txt.WriteLine("VERSION\t" + txt_version);
+ txt.WriteLine("BUILD\t" + txt_build);
+ txt.WriteLine("VERSTR\t" + txt_verstr);
+ txt.WriteLine("DATE\t" + txt_date);
+ txt.WriteLine("LANGUAGE\t" + txt_lang);
+ txt.WriteLine("*");
+ txt.WriteLine();
+ }
+
+#if BU_OSS
+ Con.WriteLine("Installer packages are built on '{0}'. Enjoy it !!", publicDir);
+
+ return 0;
+#endif // BU_OSS
+
+ /*
+ w.WriteLine("mkdir \"{0}\\autorun\"", cddir);
+ w.WriteLine("copy /b /y autorun\\autorun.ico \"{0}\\autorun\"", cddir);
+ w.WriteLine("copy /b /y autorun\\autorun.exe \"{0}\\autorun\"", cddir);
+ w.WriteLine("copy /b /y autorun\\autorun.inf \"{0}\\autorun.inf\"", cddir);
+ * */
+
+ string zipFileName = string.Format("VPN-CD-v{0}.{1:D2}-{2}-{3}-{4:D4}.{5:D2}.{6:D2}.zip",
+ version / 100, version % 100, build, name,
+ date.Year, date.Month, date.Day);
+ w.WriteLine("del {0}", zipFileName);
+ w.WriteLine("CD {0}", cddir);
+ w.WriteLine("zip -r -0 ../{0} *", zipFileName);
+ w.WriteLine("cd ..");
+ w.WriteLine("move {0} CD\\", zipFileName);
+ w.WriteLine("rename CD {0}-tree", baseName);
+ w.WriteLine();
+
+ w.Close();
+
+ // Copy of fastcopy
+ string fastcopy_dest = Path.Combine(destDirName, @"Private\fastcopy_bin");
+ IO.MakeDirIfNotExists(fastcopy_dest);
+ File.Copy(Path.Combine(Paths.UtilityDirName, "FastCopy.exe"), Path.Combine(fastcopy_dest, "FastCopy.exe"), true);
+ File.Copy(Path.Combine(Paths.UtilityDirName, "FastEx64.dll"), Path.Combine(fastcopy_dest, "FastEx64.dll"), true);
+ File.Copy(Path.Combine(Paths.UtilityDirName, "FastExt1.dll"), Path.Combine(fastcopy_dest, "FastExt1.dll"), true);
+
+ string fastcopy_exe = @"..\Private\fastcopy_bin\FastCopy.exe";
+
+ // Create a upload batch
+ string uploadBatchFileName = Path.Combine(publicDir, "UploadNow.cmd");
+#if !BU_OSS
+ w = new StreamWriter(uploadBatchFileName);
+#endif // !BU_OSS
+
+ string folder_name = "packetix";
+#if BU_SOFTETHER
+ folder_name = "softether";
+#endif
+ w.WriteLine(@"mkdir \\download\FILES\{1}\{0}-tree", baseName, folder_name);
+ w.WriteLine(@"{0} /cmd=force_copy /exclude={3} /auto_close /force_start /estimate /open_window /error_stop=TRUE /bufsize=128 /disk_mode=diff /speed=full /verify {1}-tree /to=\\download\FILES\{2}\{1}-tree", fastcopy_exe, baseName, folder_name,
+ "\"*files.txt*\"");
+
+ w.WriteLine();
+ /*
+ w.WriteLine(@"mkdir \\downloadjp\FILES\{1}\{0}-tree", baseName, folder_name);
+ w.WriteLine(@"{0} /cmd=force_copy /exclude={3} /auto_close /force_start /estimate /open_window /error_stop=TRUE /bufsize=128 /disk_mode=diff /speed=full /verify {1}-tree /to=\\downloadjp\FILES\{2}\{1}-tree", fastcopy_exe, baseName, folder_name,
+ "\"*files.txt*\"");
+
+ w.WriteLine();*/
+
+ w.WriteLine(@"copy /y /b {0}-tree\files.txt \\download\FILES\{1}\{0}-tree\files.txt", baseName, folder_name);
+ //w.WriteLine(@"copy /y /b {0}-tree\files.txt \\downloadjp\FILES\{1}\{0}-tree\files.txt", baseName, folder_name);
+
+
+ w.WriteLine();
+ w.WriteLine(@"pause");
+ w.WriteLine();
+
+ w.Close();
+
+
+ txt.WriteLine("FILENAME\t" + zipFileName);
+#if BU_SOFTETHER
+ txt.WriteLine("DESCRIPTION\t" + "ZIP CD-ROM Image Package of SoftEther VPN (for Admins)");
+ txt.WriteLine("CATEGORY\t" + "SoftEther VPN (Freeware)");
+ txt.WriteLine("PRODUCT\t" + "ZIP CD-ROM Image Package of SoftEther VPN");
+#else // BU_SOFTETHER
+ txt.WriteLine("DESCRIPTION\t" + "ZIP CD-ROM Image Package of PacketiX VPN (for Admins)");
+ txt.WriteLine("CATEGORY\t" + "PacketiX VPN (Commercial)");
+ txt.WriteLine("PRODUCT\t" + "ZIP CD-ROM Image Package of PacketiX VPN");
+#endif // BU_SOFTETHER
+ txt.WriteLine("OS\t" + "Any");
+ txt.WriteLine("OSLIST\t" + "Any");
+ txt.WriteLine("CPU\t" + "CD-ROM");
+ txt.WriteLine("VERSION\t" + BuildHelper.VersionIntToString(version));
+ txt.WriteLine("BUILD\t" + build.ToString());
+ txt.WriteLine("VERSTR\t" + name);
+ txt.WriteLine("DATE\t" + Str.DateTimeToStrShortWithMilliSecs(date));
+ txt.WriteLine("LANGUAGE\t" + "English, Japanese, Simplified Chinese");
+ txt.WriteLine("*");
+ txt.WriteLine();
+
+ IO.MakeDirIfNotExists(Path.Combine(publicDir, cddir));
+ File.WriteAllText(Path.Combine(Path.Combine(publicDir, cddir), "files.txt"), txt.ToString(), Str.Utf8Encoding);
+
+ // Execution of batch file
+ string old_cd = Environment.CurrentDirectory;
+
+ try
+ {
+ Environment.CurrentDirectory = Path.GetDirectoryName(batchFileName);
+ }
+ catch
+ {
+ }
+
+ Win32BuildUtil.ExecCommand(Paths.CmdFileName, string.Format("/C \"{0}\"", batchFileName));
+
+ try
+ {
+ Environment.CurrentDirectory = old_cd;
+ }
+ catch
+ {
+ }
+
+ Con.WriteLine();
+ Con.WriteLine("'{0}' に出力されました。", destDirName);
+
+ return 0;
+ }
+
+ // UNIX release
+ [ConsoleCommandMethod(
+ "Builds UNIX installer package files.",
+ "ReleaseUnix [id] [/IGNOREERROR:yes|no] [/DEBUG:yes|no] [/SERIAL:yes|no]",
+ "Builds Unix installer package files.",
+ "[id]:Specify target package ID which you'd like to build. If you'd like to erase and rebuild all packages, specify 'all'. Specify 'clean' to delete all release files.",
+ "IGNOREERROR:Specify yes if you'd like to ignore the child process to show the error message.",
+ "SERIAL:Specify yes not to use parallel mode.",
+ "DEBUG:Specity yes to enable debug mode."
+ )]
+ static int ReleaseUnix(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[id]"),
+ new ConsoleParam("IGNOREERROR"),
+ new ConsoleParam("DEBUG"),
+ new ConsoleParam("SERIAL"),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ int version, build;
+ string name;
+ DateTime date;
+ Win32BuildUtil.ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+ BuildSoftware[] softs = BuildSoftwareList.List;
+ bool serial = vl["SERIAL"].BoolValue;
+
+ if (Str.IsEmptyStr(vl.DefaultParam.StrValue))
+ {
+ Con.WriteLine("IDs:");
+ foreach (BuildSoftware soft in softs)
+ {
+ if (soft.Os.IsWindows == false)
+ {
+ soft.SetBuildNumberVersionName(build, version, name, date);
+ Con.WriteLine(" {0}", soft.IDString);
+ Con.WriteLine(" - \"{0}\"", soft.OutputFileName);
+ }
+ }
+ }
+ else
+ {
+ string key = vl.DefaultParam.StrValue;
+ bool all = false;
+
+ if ("all".StartsWith(key, StringComparison.InvariantCultureIgnoreCase))
+ {
+ all = true;
+ }
+
+ if ("clean".StartsWith(key, StringComparison.InvariantCultureIgnoreCase))
+ {
+ // Delete the release directory
+ Paths.DeleteAllReleaseTarGz();
+ Con.WriteLine("Clean completed.");
+ return 0;
+ }
+
+ List<BuildSoftware> o = new List<BuildSoftware>();
+
+ foreach (BuildSoftware soft in softs)
+ {
+ soft.SetBuildNumberVersionName(build, version, name, date);
+
+ if (soft.Os.IsWindows == false)
+ {
+ if (all || soft.IDString.IndexOf(key, StringComparison.InvariantCultureIgnoreCase) != -1)
+ {
+ o.Add(soft);
+ }
+ }
+ }
+
+ if (o.Count == 0)
+ {
+ throw new ApplicationException(string.Format("Software ID '{0}' not found.", key));
+ }
+ else
+ {
+ if (all)
+ {
+ // Delete the release directory
+ Paths.DeleteAllReleaseTarGz();
+ }
+ else
+ {
+ IO.MakeDir(Paths.ReleaseDir);
+ }
+
+ if (serial)
+ {
+ // Build in series
+ int i;
+ for (i = 0; i < o.Count; i++)
+ {
+ Con.WriteLine("{0} / {1}: Executing for '{2}'...",
+ i + 1, o.Count, o[i].IDString);
+
+ BuildHelper.BuildMain(o[i], vl["DEBUG"].BoolValue);
+ }
+ }
+ else if (o.Count == 1)
+ {
+ // To build
+ BuildHelper.BuildMain(o[0], vl["DEBUG"].BoolValue);
+ }
+ else
+ {
+ // Make a child process build
+ Process[] procs = new Process[o.Count];
+
+ int i;
+
+ for (i = 0; i < o.Count; i++)
+ {
+ Con.WriteLine("{0} / {1}: Executing for '{2}'...",
+ i + 1, o.Count, o[i].IDString);
+
+ procs[i] = Kernel.Run(Env.ExeFileName,
+ string.Format("/PAUSEIFERROR:{1} /DT:{2} /CMD:ReleaseUnix /DEBUG:{3} {0}",
+ o[i].IDString, vl["IGNOREERROR"].BoolValue ? "no" : "yes", Str.DateTimeToStrShort(BuildSoftwareList.ListCreatedDateTime), vl["DEBUG"].BoolValue ? "yes" : "no")
+ );
+ }
+
+ Con.WriteLine("Waiting child processes...");
+
+ int numError = 0;
+
+ for (i = 0; i < o.Count; i++)
+ {
+ procs[i].WaitForExit();
+
+ bool ok = procs[i].ExitCode == 0;
+
+ if (ok == false)
+ {
+ numError++;
+ }
+
+ Con.WriteLine("{0} / {1} ({2}):", i + 1, o.Count, o[i].IDString);
+ Con.WriteLine(" {0}", ok ? "Success" : "* Error *");
+ }
+
+ Con.WriteLine();
+ if (numError != 0)
+ {
+ throw new ApplicationException(string.Format("{0} Errors.", numError));
+ }
+ Con.WriteLine("No Errors.");
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ // Win32 Release
+ [ConsoleCommandMethod(
+ "Builds Win32 installer package files.",
+ "ReleaseWin32 [id] [/IGNOREERROR:yes|no] [/SERIAL:yes|no]",
+ "Builds Win32 installer package files.",
+ "[id]:Specify target package ID which you'd like to build. If you'd like to erase and rebuild all packages, specify 'all'. Specify 'clean' to delete all release files.",
+ "SERIAL:Specify yes not to use parallel mode.",
+ "IGNOREERROR:Specify yes if you'd like to ignore the child process to show the error message."
+ )]
+ static int ReleaseWin32(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[id]"),
+ new ConsoleParam("IGNOREERROR"),
+ new ConsoleParam("SERIAL"),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ bool serial = vl["SERIAL"].BoolValue;
+ int version, build;
+ string name;
+ DateTime date;
+ Win32BuildUtil.ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+ BuildSoftware[] softs = BuildSoftwareList.List;
+
+ if (Str.IsEmptyStr(vl.DefaultParam.StrValue))
+ {
+ Con.WriteLine("IDs:");
+ foreach (BuildSoftware soft in softs)
+ {
+ if (soft.Os.IsWindows)
+ {
+ soft.SetBuildNumberVersionName(build, version, name, date);
+ Con.WriteLine(" {0}", soft.IDString);
+ Con.WriteLine(" - \"{0}\"", soft.OutputFileName);
+ }
+ }
+ }
+ else
+ {
+ string key = vl.DefaultParam.StrValue;
+ bool all = false;
+
+ if ("all".StartsWith(key, StringComparison.InvariantCultureIgnoreCase))
+ {
+ all = true;
+ }
+
+ if ("clean".StartsWith(key, StringComparison.InvariantCultureIgnoreCase))
+ {
+ // Delete the release directory
+ Paths.DeleteAllReleaseExe();
+ Con.WriteLine("Clean completed.");
+ return 0;
+ }
+
+ List<BuildSoftware> o = new List<BuildSoftware>();
+
+ foreach (BuildSoftware soft in softs)
+ {
+ soft.SetBuildNumberVersionName(build, version, name, date);
+
+ if (soft.Os.IsWindows)
+ {
+ if (all || soft.IDString.IndexOf(key, StringComparison.InvariantCultureIgnoreCase) != -1)
+ {
+ o.Add(soft);
+ }
+ }
+ }
+
+ if (o.Count == 0)
+ {
+ throw new ApplicationException(string.Format("Software ID '{0}' not found.", key));
+ }
+ else
+ {
+ if (all)
+ {
+ // Delete the release directory
+ Paths.DeleteAllReleaseExe();
+ }
+ else
+ {
+ IO.MakeDir(Paths.ReleaseDir);
+ }
+
+ if (serial)
+ {
+ // Build in series
+ int i;
+ for (i = 0; i < o.Count; i++)
+ {
+ Con.WriteLine("{0} / {1}: Executing for '{2}'...",
+ i + 1, o.Count, o[i].IDString);
+
+ BuildHelper.BuildMain(o[i], false);
+ }
+ }
+ else if (o.Count == 1)
+ {
+ // To build
+ BuildHelper.BuildMain(o[0], false);
+ }
+ else
+ {
+ // Make a child process build
+ Process[] procs = new Process[o.Count];
+
+ int i;
+
+ for (i = 0; i < o.Count; i++)
+ {
+ Con.WriteLine("{0} / {1}: Executing for '{2}'...",
+ i + 1, o.Count, o[i].IDString);
+
+ procs[i] = Kernel.Run(Env.ExeFileName,
+ string.Format("/PAUSEIFERROR:{1} /CMD:ReleaseWin32 {0}",
+ o[i].IDString, vl["IGNOREERROR"].BoolValue ? "no" : "yes"));
+ }
+
+ Con.WriteLine("Waiting child processes...");
+
+ int numError = 0;
+
+ for (i = 0; i < o.Count; i++)
+ {
+ procs[i].WaitForExit();
+
+ bool ok = procs[i].ExitCode == 0;
+
+ if (ok == false)
+ {
+ numError++;
+ }
+
+ Con.WriteLine("{0} / {1} ({2}):", i + 1, o.Count, o[i].IDString);
+ Con.WriteLine(" {0}", ok ? "Success" : "* Error *");
+ }
+
+ Con.WriteLine();
+ if (numError != 0)
+ {
+ throw new ApplicationException(string.Format("{0} Errors.", numError));
+ }
+ Con.WriteLine("No Errors.");
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ // Copy the Unix source
+ [ConsoleCommandMethod(
+ "Copies source codes for Unix.",
+ "CopyUnixSrc [destdir]",
+ "Copies source codes for Unix.",
+ "[destdir]:Specify the destination directory."
+ )]
+ static int CopyUnixSrc(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[destdir]", ConsoleService.Prompt, "Destination directory : ", ConsoleService.EvalNotEmpty, null),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ ((BuildSoftwareUnix)BuildSoftwareList.vpnbridge_linux_x86_ja).CopyUnixSrc(vl.DefaultParam.StrValue);
+
+ return 0;
+ }
+
+ // Win32 build
+ [ConsoleCommandMethod(
+ "Builds all executable files for win32 and HamCore for all OS.",
+ "BuildWin32 [yes|no] [/NORMALIZESRC:yes|no]",
+ "Builds all executable files for win32 and HamCore for all OS.",
+ "[yes|no]:Specify 'yes' if you'd like to increment the build number.",
+ "NORMALIZESRC:Specity 'yes' if you'd like to normalize the build infomations in the source codes and resource scripts."
+ )]
+ static int BuildWin32(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[yes|no]", ConsoleService.Prompt, "Increments build number (y/n) ? ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("NORMALIZESRC", ConsoleService.Prompt, "Normalizes source codes (y/n) ? ", ConsoleService.EvalNotEmpty, null)
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ if (vl.DefaultParam.BoolValue)
+ {
+ Win32BuildUtil.IncrementBuildNumber();
+ }
+ if (vl.DefaultParam.BoolValue || vl["NORMALIZESRC"].BoolValue)
+ {
+ Win32BuildUtil.NormalizeBuildInfo();
+ }
+
+ Paths.DeleteAllReleaseTarGz();
+ Paths.DeleteAllReleaseExe();
+ Paths.DeleteAllReleaseManuals();
+ Paths.DeleteAllReleaseAdminKits();
+
+ Win32BuildUtil.BuildMain();
+ Win32BuildUtil.SignAllBinaryFiles();
+ HamCoreBuildUtil.BuildHamcore();
+ Win32BuildUtil.CopyDebugSnapshot();
+
+ return 0;
+ }
+
+ // Process of post-build
+ [ConsoleCommandMethod(
+ "Process necessary tasks after building.",
+ "PostBuild",
+ "Process necessary tasks after building."
+ )]
+ static int PostBuild(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ Win32BuildUtil.SignAllBinaryFiles();
+ HamCoreBuildUtil.BuildHamcore();
+
+ return 0;
+ }
+
+ // Increment the build number
+ [ConsoleCommandMethod(
+ "Increments the build number.",
+ "IncrementBuildNumber",
+ "Increments the build number written in 'CurrentBuild.txt' text file."
+ )]
+ static int IncrementBuildNumber(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ Win32BuildUtil.IncrementBuildNumber();
+
+ return 0;
+ }
+
+
+ // Test processing
+ [ConsoleCommandMethod(
+ "Run Test Procedure.",
+ "Test",
+ "Run Test Procedure."
+ )]
+ static int Test(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ TestClass.Test();
+
+ return 0;
+ }
+
+ // Build a HamCore
+ [ConsoleCommandMethod(
+ "Builds a HamCore file.",
+ "BuildHamCore",
+ "Builds a HamCore file."
+ )]
+ static int BuildHamCore(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ HamCoreBuildUtil.BuildHamcore();
+
+ return 0;
+ }
+
+ // Sign a binary file
+ [ConsoleCommandMethod(
+ "Sign all binary files.",
+ "SignAll",
+ "Sign all binary files."
+ )]
+ static int SignAll(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ Win32BuildUtil.SignAllBinaryFiles();
+
+ return 0;
+ }
+
+ // Create and sign a Inf file of SeLow for Windows 8
+ [ConsoleCommandMethod(
+ "Generate INF files for SeLow.",
+ "SignSeLowInfFiles",
+ "Generate INF files for SeLow."
+ )]
+ static int SignSeLowInfFiles(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[cpu]", ConsoleService.Prompt, "x86 / x64: ", ConsoleService.EvalNotEmpty, null)
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+#if !BU_OSS
+
+ Win32BuildUtil.SignSeLowInfFiles(vl.DefaultParam.StrValue);
+
+#endif
+
+ return 0;
+ }
+
+ // Create Inf file for Windows 8
+ [ConsoleCommandMethod(
+ "Generate INF files for Windows 8.",
+ "GenerateWin8InfFiles",
+ "Generate INF files for Windows 8."
+ )]
+ static int GenerateWin8InfFiles(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[cpu]", ConsoleService.Prompt, "x86 / x64: ", ConsoleService.EvalNotEmpty, null)
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+#if !BU_OSS
+
+ Win32BuildUtil.GenerateINFFilesForWindows8(vl.DefaultParam.StrValue);
+
+#endif
+
+ return 0;
+ }
+
+ // Set the version of the PE to 4
+ [ConsoleCommandMethod(
+ "Set the version of the PE file to 4.",
+ "SetPE4 [filename]",
+ "Set the version of the PE file to 4.",
+ "[filename]:Specify the target filename."
+ )]
+ static int SetPE4(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[filename]", ConsoleService.Prompt, "Filename: ", ConsoleService.EvalNotEmpty, null)
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ PEUtil.SetPEVersionTo4(vl.DefaultParam.StrValue);
+
+ return 0;
+ }
+
+ // Set the Manifest
+ [ConsoleCommandMethod(
+ "Set the manifest to the executable file.",
+ "SetManifest [filename] [/MANIFEST:manifest_file_name]",
+ "Set the manifest to the executable file.",
+ "[filename]:Specify the target executable filename.",
+ "MANIFEST:Specify the manifest XML file."
+ )]
+ static int SetManifest(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[filename]", ConsoleService.Prompt, "Target Filename: ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("MANIFEST", ConsoleService.Prompt, "Manifest Filename: ", ConsoleService.EvalNotEmpty, null),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ PEUtil.SetManifest(vl.DefaultParam.StrValue, vl["MANIFEST"].StrValue);
+
+ return 0;
+ }
+
+ // Generate a version information resource
+ [ConsoleCommandMethod(
+ "Generate a Version Information Resource File.",
+ "GenerateVersionResource [targetFileName] [/OUT:destFileName]",
+ "Generate a Version Information Resource File.",
+ "[targetFileName]:Specify the target exe/dll file name.",
+ "OUT:Specify the output .res file.",
+ "RC:Specify a template RC file name.")]
+ static int GenerateVersionResource(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[targetFileName]", ConsoleService.Prompt, "Target Filename: ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("OUT", ConsoleService.Prompt, "Dst Filename: ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("RC"),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ string targetFilename = vl.DefaultParam.StrValue;
+ string outFilename = vl["OUT"].StrValue;
+
+ Win32BuildUtil.GenerateVersionInfoResource(targetFilename, outFilename, vl["RC"].StrValue);
+
+ return 0;
+ }
+
+ // Measure the number of lines of code
+ [ConsoleCommandMethod(
+ "Count the number of lines of the sources.",
+ "Count [DIR]",
+ "Count the number of lines of the sources.",
+ "[DIR]:dir name.")]
+ static int Count(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[DIR]", null, null, null, null),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ string dir = vl.DefaultParam.StrValue;
+ if (Str.IsEmptyStr(dir))
+ {
+ dir = Paths.BaseDirName;
+ }
+
+ string[] files = Directory.GetFiles(dir, "*", SearchOption.AllDirectories);
+
+ int numLines = 0;
+ int numBytes = 0;
+ int numComments = 0;
+ int totalLetters = 0;
+
+ Dictionary<string, int> commentsDict = new Dictionary<string, int>();
+
+ foreach (string file in files)
+ {
+ string ext = Path.GetExtension(file);
+
+ if (Str.StrCmpi(ext, ".c") || Str.StrCmpi(ext, ".cpp") || Str.StrCmpi(ext, ".h") ||
+ Str.StrCmpi(ext, ".rc") || Str.StrCmpi(ext, ".stb") || Str.StrCmpi(ext, ".cs")
+ || Str.StrCmpi(ext, ".fx") || Str.StrCmpi(ext, ".hlsl"))
+ {
+ if (Str.InStr(file, "\\.svn\\") == false && Str.InStr(file, "\\seedll\\") == false && Str.InStr(file, "\\see\\") == false && Str.InStr(file, "\\openssl\\") == false)
+ {
+ string[] lines = File.ReadAllLines(file);
+
+ numLines += lines.Length;
+ numBytes += (int)new FileInfo(file).Length;
+
+ foreach (string line in lines)
+ {
+ if (Str.InStr(line, "//") && Str.InStr(line, "// Validate arguments") == false)
+ {
+ if (commentsDict.ContainsKey(line) == false)
+ {
+ commentsDict.Add(line, 1);
+ }
+ numComments++;
+
+ totalLetters += line.Trim().Length - 3;
+ }
+ }
+ }
+ }
+ }
+
+ Con.WriteLine("{0} Lines, {1} Bytes. {2} Comments ({3} distinct, aver: {4})", Str.ToStr3(numLines), Str.ToStr3(numBytes),
+ Str.ToStr3(numComments), commentsDict.Count, totalLetters / numComments);
+
+ return 0;
+ }
+
+ // Add to Cab by compressing OCX
+ [ConsoleCommandMethod(
+ "Compress a OCX and Generate a Cab file.",
+ "GenerateVpnWebOcxCab [src] [/DEST:dest]",
+ "Compress a OCX and Generate a Cab file.",
+ "[src]:Specify the ocx file.",
+ "DEST:Specify the destination cab file.")]
+ static int GenerateVpnWebOcxCab(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[src]", ConsoleService.Prompt, "Src Filename: ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("DEST", ConsoleService.Prompt, "Dst Filename: ", ConsoleService.EvalNotEmpty, null),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+#if !BU_OSS
+ string destFileName = vl["DEST"].StrValue;
+ string srcFileName = vl.DefaultParam.StrValue;
+
+ Win32BuildUtil.GenerateVpnWebOcxCab(destFileName, srcFileName);
+#endif
+
+ return 0;
+ }
+
+
+ // Copy the file
+ [ConsoleCommandMethod(
+ "Copy a File.",
+ "FileCopy [src] [/DEST:dest]",
+ "Copy a File.",
+ "[src]:Specify the source file.",
+ "DEST:Specify the destination file.")]
+ static int FileCopy(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[src]", ConsoleService.Prompt, "Src Filename: ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("DEST", ConsoleService.Prompt, "Dst Filename: ", ConsoleService.EvalNotEmpty, null),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ string destFileName = vl["DEST"].StrValue;
+ string srcFileName = vl.DefaultParam.StrValue;
+
+ IO.FileCopy(srcFileName, destFileName, true, false);
+
+ return 0;
+ }
+
+ // Sign the file
+ [ConsoleCommandMethod(
+ "Sign files using Authenticode certificates.",
+ "SignCode [filename] [/DEST:destfilename] [/COMMENT:comment] [/KERNEL:yes|no]",
+ "Sign files using Authenticode certificates.",
+ "[filename]:Specify the target filename.",
+ "DEST:Specify the destination filename. If this parameter is not specified, the target file will be overwritten.",
+ "COMMENT:Provide a description of the signed content.",
+ "KERNEL:Specify \"yes\" if Windows Vista / 7 Kernel Mode Driver Signing is needed."
+ )]
+ static int SignCode(ConsoleService c, string cmdName, string str)
+ {
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("[filename]", ConsoleService.Prompt, "Filename: ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("DEST"),
+ new ConsoleParam("COMMENT", ConsoleService.Prompt, "Comment: ", ConsoleService.EvalNotEmpty, null),
+ new ConsoleParam("KERNEL"),
+ };
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ string destFileName = vl["DEST"].StrValue;
+ string srcFileName = vl.DefaultParam.StrValue;
+ if (Str.IsEmptyStr(destFileName))
+ {
+ destFileName = srcFileName;
+ }
+ string comment = vl["COMMENT"].StrValue;
+ bool kernel = vl["KERNEL"].BoolValue;
+
+ CodeSign.SignFile(destFileName, srcFileName, comment, kernel);
+
+ return 0;
+ }
+ }
+}
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/BuildUtilIcon.ico b/src/BuildUtil/BuildUtilIcon.ico
new file mode 100644
index 00000000..75d3c4aa
--- /dev/null
+++ b/src/BuildUtil/BuildUtilIcon.ico
Binary files differ
diff --git a/src/BuildUtil/BuildUtilMain.cs b/src/BuildUtil/BuildUtilMain.cs
new file mode 100644
index 00000000..a8f2918b
--- /dev/null
+++ b/src/BuildUtil/BuildUtilMain.cs
@@ -0,0 +1,193 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ public class BuildUtilMain
+ {
+ public static bool pause = false;
+
+ // Main function
+ public static int Main(string[] args)
+ {
+ string errMsg = "";
+
+ int ret = 0;
+
+ ret = ConsoleService.EntryPoint("BuildUtil " + Env.CommandLine, "BuildUtil", typeof(BuildUtilMain), out errMsg);
+
+ if (ret != 0)
+ {
+ Con.WriteLine("{0}: fatal error C0001: {1}", Path.GetFileNameWithoutExtension(Env.ExeFileName), errMsg);
+
+ if (pause)
+ {
+ Console.Write("Press any key to exit...");
+ Console.ReadKey();
+ }
+
+ Environment.Exit(1);
+ }
+
+ return ret;
+ }
+
+ // Command execution
+ [ConsoleCommandMethod(
+ "VPN Build Utility",
+ "[/IN:infile] [/OUT:outfile] [/CSV] [/PAUSEIFERROR:yes|no] [/CMD command_line...]",
+ "VPN Build Utility",
+ "IN:This will specify the text file 'infile' that contains the list of commands that are automatically executed after the connection is completed. If the /IN parameter is specified, the vpncmd program will terminate automatically after the execution of all commands in the file are finished. If the file contains multiple-byte characters, the encoding must be Unicode (UTF-8). This cannot be specified together with /CMD (if /CMD is specified, /IN will be ignored).",
+ "OUT:You can specify the text file 'outfile' to write all strings such as onscreen prompts, message, error and execution results. Note that if the specified file already exists, the contents of the existing file will be overwritten. Output strings will be recorded using Unicode (UTF-8) encoding.",
+ "CMD:If the optional command 'command_line...' is included after /CMD, that command will be executed after the connection is complete and the vpncmd program will terminate after that. This cannot be specified together with /IN (if specified together with /IN, /IN will be ignored). Specify the /CMD parameter after all other vpncmd parameters.",
+ "CSV:Enable CSV Mode.",
+ "PAUSEIFERROR:Specify yes if you'd like to pause before exiting the process if there are any errors."
+ )]
+ public static int BuildUtil(ConsoleService c, string cmdName, string str)
+ {
+ Con.WriteLine("");
+ Con.WriteLine("Copyright (c) SoftEther Corporation. All Rights Reserved.");
+ Con.WriteLine("");
+
+ ConsoleParam[] args =
+ {
+ new ConsoleParam("IN", null, null, null, null),
+ new ConsoleParam("OUT", null, null, null, null),
+ new ConsoleParam("CMD", null, null, null, null),
+ new ConsoleParam("CSV", null, null, null, null),
+ new ConsoleParam("PAUSEIFERROR", null, null, null, null),
+ new ConsoleParam("DT", null, null, null, null),
+ };
+
+ ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);
+
+ pause = vl["PAUSEIFERROR"].BoolValue;
+
+ string cmdline = vl["CMD"].StrValue;
+
+ if (vl["DT"].IsEmpty == false)
+ {
+ BuildSoftwareList.ListCreatedDateTime = Str.StrToDateTime(vl["DT"].StrValue);
+ }
+
+ ConsoleService cs = c;
+
+ while (cs.DispatchCommand(cmdline, "BuildUtil>", typeof(BuildUtilCommands), null))
+ {
+ if (Str.IsEmptyStr(cmdline) == false)
+ {
+ break;
+ }
+ }
+
+ return cs.RetCode;
+ }
+ }
+}
+
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/CodeSign.cs b/src/BuildUtil/CodeSign.cs
new file mode 100644
index 00000000..d699716e
--- /dev/null
+++ b/src/BuildUtil/CodeSign.cs
@@ -0,0 +1,263 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+using BuildUtil.HvSignService;
+
+namespace BuildUtil
+{
+ public static class CodeSign
+ {
+ public const int NumRetries = 1;
+ public const int RetryIntervals = 200;
+
+ public const int NumRetriesForCopy = 50;
+ public const int RetryIntervalsForCopy = 10;
+
+ const string in_dir = @"\\hvsigncode\SIGN\IN";
+ const string out_dir = @"\\hvsigncode\SIGN\OUT";
+
+#if !BU_SOFTETHER
+ public static int UsingCertId = 1;
+#else
+ public static int UsingCertId = 2;
+#endif
+
+ static object lockObj = new object();
+
+ // Digital-sign the data on the memory
+ public static byte[] SignMemory(byte[] srcData, string comment, bool kernelModeDriver, int cert_id)
+ {
+#if !BU_OSS
+ int i;
+ string out_filename = null;
+ byte[] ret = null;
+
+ string in_tmp_filename = Path.Combine(in_dir,
+ Str.DateTimeToStrShortWithMilliSecs(DateTime.Now) + "_" +
+ Env.MachineName + "_" +
+ Secure.Rand63i().ToString() + ".dat");
+
+ IO.SaveFile(in_tmp_filename, srcData);
+
+ for (i = 0; i < NumRetries; i++)
+ {
+ Sign sign = new Sign();
+ sign.Proxy = new WebProxy();
+
+ try
+ {
+ out_filename = sign.ExecSign(Path.GetFileName(in_tmp_filename),
+ kernelModeDriver,
+ comment,
+ cert_id);
+ break;
+ }
+ catch (Exception ex)
+ {
+ if (i != (NumRetries - 1))
+ {
+ Kernel.SleepThread(RetryIntervals);
+ }
+ else
+ {
+ throw ex;
+ }
+ }
+ }
+
+ for (i = 0; i < NumRetriesForCopy; i++)
+ {
+ try
+ {
+ ret = IO.ReadFile(Path.Combine(out_dir, out_filename));
+ }
+ catch (Exception ex)
+ {
+ if (i != (NumRetriesForCopy - 1))
+ {
+ Kernel.SleepThread(RetryIntervalsForCopy);
+ }
+ else
+ {
+ throw ex;
+ }
+ }
+ }
+
+ string tmpFileName = IO.CreateTempFileNameByExt(".exe");
+ try
+ {
+ File.Delete(tmpFileName);
+ }
+ catch
+ {
+ }
+ File.WriteAllBytes(tmpFileName, ret);
+
+ lock (lockObj)
+ {
+ if (ExeSignChecker.CheckFileDigitalSignature(tmpFileName) == false)
+ {
+ throw new ApplicationException("CheckFileDigitalSignature failed.");
+ }
+
+ if (kernelModeDriver)
+ {
+ if (ExeSignChecker.IsKernelModeSignedFile(tmpFileName) == false)
+ {
+ throw new ApplicationException("IsKernelModeSignedFile failed.");
+ }
+ }
+ }
+
+ try
+ {
+ }
+ catch
+ {
+ File.Delete(tmpFileName);
+ }
+
+ return ret;
+#else // BU_OSS
+ return srcData;
+#endif // BU_OSS
+ }
+
+ // Digital-sign the data on the file
+ public static void SignFile(string destFileName, string srcFileName, string comment, bool kernelModeDriver)
+ {
+ int cert_id = UsingCertId;
+
+ SignFile(destFileName, srcFileName, comment, kernelModeDriver, cert_id);
+ }
+ public static void SignFile(string destFileName, string srcFileName, string comment, bool kernelModeDriver, int cert_id)
+ {
+#if !BU_OSS
+ Con.WriteLine("Signing for '{0}'...", Path.GetFileName(destFileName));
+ byte[] srcData = File.ReadAllBytes(srcFileName);
+
+ byte[] destData = SignMemory(srcData, comment, kernelModeDriver, cert_id);
+
+ try
+ {
+ File.Delete(destFileName);
+ }
+ catch
+ {
+ }
+
+ File.WriteAllBytes(destFileName, destData);
+
+ Con.WriteLine("Done.");
+#else // BU_OSS
+ Con.WriteLine("Skipping the code signing for '{0}' in the build process. You can insert your own authenticode sign process here.", srcFileName);
+#endif // BU_OSS
+ }
+ }
+}
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/CopyBuildUtil.cmd b/src/BuildUtil/CopyBuildUtil.cmd
new file mode 100644
index 00000000..18c4d9c5
--- /dev/null
+++ b/src/BuildUtil/CopyBuildUtil.cmd
@@ -0,0 +1,2 @@
+copy %0\..\..\bin\BuildUtilTmp.exe %0\..\..\bin\BuildUtil.exe
+exit /b 0
diff --git a/src/BuildUtil/CoreUtil.dll b/src/BuildUtil/CoreUtil.dll
new file mode 100644
index 00000000..c2da4954
--- /dev/null
+++ b/src/BuildUtil/CoreUtil.dll
Binary files differ
diff --git a/src/BuildUtil/PEUtil.cs b/src/BuildUtil/PEUtil.cs
new file mode 100644
index 00000000..59b71daa
--- /dev/null
+++ b/src/BuildUtil/PEUtil.cs
@@ -0,0 +1,231 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ public static class PEUtil
+ {
+ public const int NumRetries = 5;
+ public const int RetryIntervals = 200;
+ public const string MutexName = "peutil_setmanifest_mutex";
+
+ // Set the version of the PE header to 4 (to work in Windows 98, etc.)
+ public static void SetPEVersionTo4(byte[] srcData)
+ {
+ int offset = 0x140 + (int)((uint)srcData[0x3c] + ((uint)srcData[0x3d] * 256)) - 0xf8;
+
+ if (!((srcData[offset] == 0x04 || srcData[offset] == 0x05) && srcData[offset + 1] == 0x00))
+ {
+ throw new ApplicationException("The specified file is not PE file.");
+ }
+
+ srcData[offset] = 0x04;
+ }
+ public static void SetPEVersionTo4(string fileName)
+ {
+ FileInfo fi = new FileInfo(fileName);
+
+ byte[] data = File.ReadAllBytes(fileName);
+ SetPEVersionTo4(data);
+
+ int i;
+ for (i = 0;; i++)
+ {
+ try
+ {
+ File.WriteAllBytes(fileName, data);
+ break;
+ }
+ catch (Exception ex)
+ {
+ if (i >= (NumRetries - 1))
+ {
+ throw ex;
+ }
+
+ Kernel.SleepThread(RetryIntervals);
+ }
+ }
+
+ File.SetCreationTime(fileName, fi.CreationTime);
+ File.SetLastAccessTime(fileName, fi.LastAccessTime);
+ File.SetLastWriteTime(fileName, fi.LastWriteTime);
+ }
+
+ public static void SetManifest(string exe, string manifestName)
+ {
+ Mutex x = new Mutex(false, MutexName);
+
+ x.WaitOne();
+
+ try
+ {
+ // Manifest file name
+ string filename = Path.Combine(Paths.ManifestsDir, manifestName);
+ if (File.Exists(filename) == false)
+ {
+ throw new FileNotFoundException(filename);
+ }
+
+ FileInfo fi = new FileInfo(exe);
+
+ // Copy exe file to a temporary directory
+ string exeTmp = IO.CreateTempFileNameByExt(".exe");
+ IO.FileCopy(exe, exeTmp);
+
+ // Create a batch file
+ string batFileName = Path.Combine(Paths.TmpDirName, "exec_mt.cmd");
+ StreamWriter bat = new StreamWriter(batFileName, false, Str.ShiftJisEncoding);
+ bat.WriteLine("call \"{0}\"", Paths.VisualStudioVCBatchFileName);
+ bat.WriteLine("echo on");
+ bat.WriteLine("mt.exe -manifest \"{0}\" -outputresource:\"{1}\";1", filename, exeTmp);
+ bat.WriteLine("EXIT /B %ERRORLEVEL%");
+ bat.Close();
+
+ Exception ex = null;
+
+ int i;
+ // Repeated 20 times in order to avoid locking the file by the anti-virus software
+ for (i = 0; i < 20; i++)
+ {
+ try
+ {
+ // Execute
+ Win32BuildUtil.ExecCommand(Paths.CmdFileName, string.Format("/C \"{0}\"", batFileName), true);
+ ex = null;
+
+ break;
+ }
+ catch (Exception ex2)
+ {
+ ex = ex2;
+ }
+
+ ThreadObj.Sleep(Secure.Rand31i() % 50);
+ }
+
+ if (ex != null)
+ {
+ throw new ApplicationException("mt.exe Manifest Processing for '" + exe + "' Failed.");
+ }
+
+ // Revert to the original file
+ IO.FileCopy(exeTmp, exe);
+
+ // Restore the date and time
+ File.SetCreationTime(exe, fi.CreationTime);
+ File.SetLastAccessTime(exe, fi.LastAccessTime);
+ File.SetLastWriteTime(exe, fi.LastWriteTime);
+ }
+ finally
+ {
+ x.ReleaseMutex();
+ }
+ }
+ }
+}
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/Properties/AssemblyInfo.cs b/src/BuildUtil/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..2cff91e2
--- /dev/null
+++ b/src/BuildUtil/Properties/AssemblyInfo.cs
@@ -0,0 +1,18 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("PacketiX VPN / SoftEther VPN Build Utility")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("SoftEther Corporation")]
+[assembly: AssemblyProduct("PacketiX VPN / SoftEther VPN Build Utility")]
+[assembly: AssemblyCopyright("Copyright (c) SoftEther Corporation. All Rights Reserved.")]
+[assembly: AssemblyTrademark("PacketiX(R) and SoftEther(R) is a registered trademark of SoftEther Corporation.")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("5bf63a11-27da-4ca4-ba9d-a60a0f8e1fd7")]
+
+[assembly: AssemblyVersion("1.0.*")]
diff --git a/src/BuildUtil/Properties/Settings.Designer.cs b/src/BuildUtil/Properties/Settings.Designer.cs
new file mode 100644
index 00000000..5715f13d
--- /dev/null
+++ b/src/BuildUtil/Properties/Settings.Designer.cs
@@ -0,0 +1,115 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// このコードはツールによって生成されました。
+// ランタイム バージョン:2.0.50727.5466
+//
+// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
+// コードが再生成されるときに損失したりします。
+// </auto-generated>
+//------------------------------------------------------------------------------
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+namespace BuildUtil.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
+ [global::System.Configuration.DefaultSettingValueAttribute("http://dv/Sign/Sign.asmx")]
+ public string BuildUtil_SignService_Sign {
+ get {
+ return ((string)(this["BuildUtil_SignService_Sign"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
+ [global::System.Configuration.DefaultSettingValueAttribute("http://hvsigncode/Sign.asmx")]
+ public string BuildUtilTmp_HvSignService_Sign {
+ get {
+ return ((string)(this["BuildUtilTmp_HvSignService_Sign"]));
+ }
+ }
+ }
+}
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/Properties/Settings.settings b/src/BuildUtil/Properties/Settings.settings
new file mode 100644
index 00000000..5e8d1669
--- /dev/null
+++ b/src/BuildUtil/Properties/Settings.settings
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BuildUtil.Properties" GeneratedClassName="Settings">
+ <Profiles />
+ <Settings>
+ <Setting Name="BuildUtil_SignService_Sign" Type="(Web Service URL)" Scope="Application">
+ <Value Profile="(Default)">http://dv/Sign/Sign.asmx</Value>
+ </Setting>
+ <Setting Name="BuildUtilTmp_HvSignService_Sign" Type="(Web Service URL)" Scope="Application">
+ <Value Profile="(Default)">http://hvsigncode/Sign.asmx</Value>
+ </Setting>
+ </Settings>
+</SettingsFile> \ No newline at end of file
diff --git a/src/BuildUtil/Test.cs b/src/BuildUtil/Test.cs
new file mode 100644
index 00000000..688be1da
--- /dev/null
+++ b/src/BuildUtil/Test.cs
@@ -0,0 +1,125 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ public static class TestClass
+ {
+ public static void Test()
+ {
+ Language[] langs = BuildHelper.GetLanguageList();
+
+ foreach (Language e in langs)
+ {
+ Con.WriteLine("{0} {1} {2} {3} {5} {4}",
+ e.Number, e.Id, e.Title, e.TitleUnicode, e.UnixLocaleIds, e.WindowsLocaleIds);
+ }
+ }
+ }
+}
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/UnixBuildSoftwares.cs b/src/BuildUtil/UnixBuildSoftwares.cs
new file mode 100644
index 00000000..77bd9eb4
--- /dev/null
+++ b/src/BuildUtil/UnixBuildSoftwares.cs
@@ -0,0 +1,1015 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ // Build the UNIX software
+ public class BuildSoftwareUnix : BuildSoftware
+ {
+ public readonly string[] SrcDirNameList =
+ {
+ @"bin\BuiltHamcoreFiles",
+ @"bin\hamcore",
+ "Cedar",
+ "Ham",
+ "Mayaqua",
+ "Neo",
+ "VGate",
+ "vpnbridge",
+ "vpnclient",
+ "vpncmd",
+ "vpnserver",
+ };
+
+ public readonly string CrossLibName;
+ public readonly string CrossLibBaseDir = Path.Combine(Paths.BaseDirName, @"BuildFiles\CrossLib");
+ public readonly bool UseGccBitsOption;
+ public readonly string CrossCompilerName;
+ public readonly bool NoPThreadOption;
+ public readonly string CrossCompilerOption;
+ public readonly string SrcKitDefaultDir;
+
+ public BuildSoftwareUnix(Software software, int buildNumber, int version, string buildName, Cpu cpu, OS os,
+ string crossLibName, bool useGccBitsOption, string crossCompilerName, bool noPthreadOption, string crossCompilerOption)
+ : base(software, buildNumber, version, buildName, cpu, os)
+ {
+ this.CrossLibName = crossLibName;
+ this.UseGccBitsOption = useGccBitsOption;
+ this.CrossCompilerName = crossCompilerName;
+ this.NoPThreadOption = noPthreadOption;
+ this.CrossCompilerOption = crossCompilerOption;
+
+#if !BU_SOFTETHER
+ this.SrcKitDefaultDir = Env.SystemDir.Substring(0, 2) + @"\tmp\vpn4_srckit";
+#else
+ this.SrcKitDefaultDir = Env.SystemDir.Substring(0, 2) + @"\tmp\se_vpn_srckit";
+#endif
+ }
+
+ // Run the build
+ public void Build(bool debugMode)
+ {
+ string mutexName = "buildsrckit_" + this.CrossLibName;
+
+ Mutex mutex = new Mutex(false, mutexName);
+
+ mutex.WaitOne();
+
+ try
+ {
+ if (this.BuildSrcKit(SrcKitDefaultDir, debugMode))
+ {
+ this.BuildWithCrossCompiler(SrcKitDefaultDir);
+ }
+ }
+ finally
+ {
+ mutex.ReleaseMutex();
+ }
+
+ this.Release(SrcKitDefaultDir);
+ }
+
+ public override void Build()
+ {
+ throw new NotImplementedException();
+ }
+
+ // Delegate to copy the source code
+ public bool CopySrcFilesDelegate(FileInfo info)
+ {
+ string[] ignoreExts =
+ {
+ ".exe", ".sys", ".dll", ".inf", ".vcproj", ".user",
+ ".ico", ".rc",
+ };
+ string name = info.FullName;
+
+ if (Str.InStr(name, @"\.svn\") ||
+ Str.InStr(name, @"\WinPcap\") ||
+ Str.InStr(name, @"_Debug\") ||
+ Str.InStr(name, @"_Release\") ||
+ Str.InStr(name, @"\BuiltHamcoreFiles\win32_"))
+ {
+ return false;
+ }
+
+ foreach (string ext in ignoreExts)
+ {
+ if (name.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Create a release
+ public virtual void Release(string baseOutputDir)
+ {
+ string srcDir = Path.Combine(baseOutputDir, this.CrossLibName + @"\src");
+ string releaseFileName = Path.Combine(Paths.ReleaseDir, this.OutputFileName);
+ Con.WriteLine("Generating '{0}'...", releaseFileName);
+
+ List<string> files = new List<string>();
+ string gccOptionForLink;
+ string gccOptionForCompile;
+
+ generateGccOptions(srcDir, false, false, out gccOptionForLink, out gccOptionForCompile);
+
+ string targetName = this.Software.ToString();
+
+ // Makefile
+ StringWriter mk = GenerateMakeFileForRelease(srcDir);
+ byte[] mkData = Str.NormalizeCrlf(Str.Utf8Encoding.GetBytes(mk.ToString()), new byte[] { 10 });
+
+ TarPacker tar = new TarPacker();
+
+ tar.AddFileSimple(targetName + @"\Makefile", mkData, 0, mkData.Length, DateTime.Now);
+
+ // Install Script
+ string isText = File.ReadAllText(Paths.UnixInstallScript);
+ isText = Str.ReplaceStr(isText, "<TITLE>", TitleString, false);
+ byte[] scriptData = Str.NormalizeCrlf(Str.Utf8Encoding.GetBytes(isText), new byte[] { 10 });
+ tar.AddFileSimple(targetName + @"\.install.sh", scriptData, 0, scriptData.Length, DateTime.Now);
+
+ // EULA
+ Encoding enc = Str.Utf8Encoding;
+
+ if (true)
+ {
+ string srcData = File.ReadAllText(Path.Combine(Paths.BinDirName, @"hamcore\eula.txt"),
+ enc);
+
+ byte[] destData = enc.GetBytes(srcData);
+
+ tar.AddFileSimple(targetName + @"\" + "ReadMeFirst_License.txt", destData, 0, destData.Length, DateTime.Now);
+ }
+
+ if (true)
+ {
+ string srcData = File.ReadAllText(Path.Combine(Paths.BinDirName, @"hamcore\warning_ja.txt"),
+ enc);
+
+ byte[] destData = enc.GetBytes(srcData);
+
+ tar.AddFileSimple(targetName + @"\" + "ReadMeFirst_Important_Notices_ja.txt", destData, 0, destData.Length, DateTime.Now);
+ }
+
+ if (true)
+ {
+ string srcData = File.ReadAllText(Path.Combine(Paths.BinDirName, @"hamcore\warning_en.txt"),
+ enc);
+
+ byte[] destData = enc.GetBytes(srcData);
+
+ tar.AddFileSimple(targetName + @"\" + "ReadMeFirst_Important_Notices_en.txt", destData, 0, destData.Length, DateTime.Now);
+ }
+
+
+ // Codes
+ string[] dirs =
+ {
+ Path.Combine(srcDir, "code"),
+ Path.Combine(srcDir, "lib"),
+ };
+
+ foreach (string dir in dirs)
+ {
+ string[] fileList = Directory.GetFiles(dir, "*.a", SearchOption.TopDirectoryOnly);
+
+ if (Path.GetFileName(dir).Equals("code", StringComparison.InvariantCultureIgnoreCase))
+ {
+ fileList = new string[]
+ {
+ Path.Combine(dir, string.Format("{0}.a", this.Software.ToString())),
+ Path.Combine(dir, "vpncmd.a"),
+ };
+ }
+
+ foreach (string fileName in fileList)
+ {
+ if (Str.StrCmpi(Path.GetFileName(fileName), "libpcap.a") == false)
+ {
+ // Libpcap.a is not included in the release
+ byte[] fileData = File.ReadAllBytes(fileName);
+
+ tar.AddFileSimple(targetName + @"\" + IO.GetRelativeFileName(fileName, srcDir),
+ fileData, 0, fileData.Length, DateTime.Now);
+ }
+ }
+ }
+
+ // License file
+ byte[] lsFileData = File.ReadAllBytes(Path.Combine(CrossLibBaseDir, @"License.txt"));
+ tar.AddFileSimple(targetName + @"\lib\License.txt", lsFileData, 0, lsFileData.Length, DateTime.Now);
+
+ // HamCore
+ byte[] hcData = File.ReadAllBytes(Path.Combine(Paths.BaseDirName, string.Format(@"bin\BuiltHamcoreFiles\hamcore_unix\hamcore.se2")));
+ tar.AddFileSimple(targetName + @"\hamcore.se2", hcData, 0, hcData.Length, DateTime.Now);
+
+ // Generate a tar
+ tar.Finish();
+ byte[] tarData = tar.CompressToGZip();
+
+ File.WriteAllBytes(releaseFileName, tarData);
+
+ Con.WriteLine("Finished.");
+ }
+
+ // Build by cross-compiler
+ public virtual void BuildWithCrossCompiler(string baseOutputDir)
+ {
+ // Create a batch file
+ string outDir = Path.Combine(baseOutputDir, this.CrossLibName);
+ string outSrcDir = Path.Combine(outDir, "src");
+
+ try
+ {
+ string xcDir = Path.Combine(Path.Combine(Paths.CrossCompilerBaseDir, this.CrossCompilerName), "bin");
+
+ if (Directory.Exists(xcDir) == false)
+ {
+ throw new ApplicationException(string.Format("dir '{0}' not found.", xcDir));
+ }
+
+ string batFileName = Path.Combine(outSrcDir, "cross_build.cmd");
+ StreamWriter w = new StreamWriter(batFileName, false, Str.ShiftJisEncoding);
+ w.WriteLine("SET PATH={0};%PATH%", xcDir);
+ w.WriteLine();
+ w.WriteLine(outSrcDir.Substring(0, 2));
+ w.WriteLine("CD {0}", outSrcDir);
+ w.WriteLine();
+ w.WriteLine("make clean");
+ w.WriteLine("make");
+ w.WriteLine();
+ w.WriteLine("EXIT /B %ERRORLEVEL%");
+ w.Close();
+
+ Semaphore sem = new Semaphore(BuildConfig.NumMultipleCompileTasks, BuildConfig.NumMultipleCompileTasks, "vpn_build_cross");
+ Con.WriteLine("Waiting for Semaphore...");
+ sem.WaitOne();
+ Con.WriteLine("Done.");
+ try
+ {
+ Win32BuildUtil.ExecCommand(Paths.CmdFileName, string.Format("/C \"{0}\"", batFileName));
+ }
+ finally
+ {
+ sem.Release();
+ }
+ }
+ catch
+ {
+ string[] files = Directory.GetFiles(Path.Combine(outSrcDir, "code"), "*.a", SearchOption.AllDirectories);
+ foreach (string file in files)
+ {
+ try
+ {
+ File.Delete(file);
+ }
+ catch
+ {
+ }
+ }
+ }
+ }
+
+ // SrcKit file name
+ public string SrcKitFileName
+ {
+ get
+ {
+ int build, version;
+ string name;
+ DateTime date;
+ Win32BuildUtil.ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+ return string.Format("{0}-{3}-{1}.tar.gz", "srckit", this.CrossLibName,
+ Str.DateTimeToStrShort(BuildSoftwareList.ListCreatedDateTime),
+ build);
+ }
+ }
+
+ // Copy the source code
+ public virtual void CopyUnixSrc(string baseOutputDir)
+ {
+ // Generate an Output directory name
+ string outDir = baseOutputDir;
+ string outSrcDir = baseOutputDir;
+ Con.WriteLine("BuildSrcKit for '{0}'...", this.IDString);
+ Con.WriteLine("BuildSrcKit Output Dir = '{0}'.", outDir);
+
+ string tsFile = Path.Combine(outDir, "TimeStamp.txt");
+ string timeStamp = Str.DateTimeToStrShort(BuildSoftwareList.ListCreatedDateTime);
+ Con.WriteLine("timestamp={0}", timeStamp);
+
+ if (Directory.Exists(outDir))
+ {
+ }
+ else
+ {
+ Directory.CreateDirectory(outDir);
+ }
+
+ // Copy the source code
+ foreach (string srcDirName in SrcDirNameList)
+ {
+ string srcFullPath = Path.Combine(Paths.BaseDirName, srcDirName);
+ string destFullPath = Path.Combine(outSrcDir, srcDirName);
+
+ IO.CopyDir(srcFullPath, destFullPath, new IO.CopyDirPreCopyDelegate(CopySrcFilesDelegate), false, true, true, true, true);
+ }
+ IO.FileCopy(Path.Combine(Paths.BaseDirName, "CurrentBuild.txt"), Path.Combine(outSrcDir, "CurrentBuild.txt"), true, false);
+ }
+
+ // Build SrcKit
+ public virtual bool BuildSrcKit(string baseOutputDir, bool debugMode)
+ {
+ // Generate an Output directory name
+ string outDir = Path.Combine(baseOutputDir, this.CrossLibName);
+ string outSrcDir = Path.Combine(outDir, "src");
+ Con.WriteLine("BuildSrcKit for '{0}'...", this.IDString);
+ Con.WriteLine("CrossLib Name: '{0}'.", this.CrossLibName);
+ Con.WriteLine("BuildSrcKit Output Dir = '{0}'.", outDir);
+
+ string tsFile = Path.Combine(outDir, "TimeStamp.txt");
+ string timeStamp = Str.DateTimeToStrShort(BuildSoftwareList.ListCreatedDateTime);
+ Con.WriteLine("timestamp={0}", timeStamp);
+
+ if (Directory.Exists(outDir))
+ {
+ bool ok = false;
+ // See TimeStamp.txt file if the directory already exists
+ try
+ {
+ string[] ts = File.ReadAllLines(tsFile);
+ if (ts[0] == timeStamp)
+ {
+ ok = true;
+ }
+ }
+ catch
+ {
+ }
+
+ if (ok)
+ {
+ Con.WriteLine("Skipped for '{0}'.", this.IDString);
+ return false;
+ }
+ }
+ else
+ {
+ Directory.CreateDirectory(outDir);
+ }
+
+ // Copy the source code
+ foreach (string srcDirName in SrcDirNameList)
+ {
+ string srcFullPath = Path.Combine(Paths.BaseDirName, srcDirName);
+ string destFullPath = Path.Combine(outSrcDir, srcDirName);
+ bool delete_bom = true;
+
+ if (Str.InStr(srcDirName, "\\hamcore"))
+ {
+ delete_bom = false;
+ }
+
+ IO.CopyDir(srcFullPath, destFullPath, new IO.CopyDirPreCopyDelegate(CopySrcFilesDelegate), false, true, true, delete_bom);
+ }
+ IO.FileCopy(Path.Combine(Paths.BaseDirName, "CurrentBuild.txt"), Path.Combine(outSrcDir, "CurrentBuild.txt"), true, false);
+ IO.FileCopy(Path.Combine(Paths.BaseDirName, "GlobalConst.h"), Path.Combine(outSrcDir, "GlobalConst.h"), true, false);
+ IO.FileCopy(Path.Combine(Paths.BaseDirName, @"DebugFiles\Replace.h"), Path.Combine(outSrcDir, "Replace.h"), true, false);
+ IO.FileCopy(Path.Combine(Paths.BaseDirName, @"bin\BuiltHamcoreFiles\hamcore_unix\hamcore.se2"),
+ Path.Combine(outSrcDir, @"bin\hamcore.se2"), true, false);
+
+ // Copy Crosslibs
+ IO.CopyDir(Path.Combine(this.CrossLibBaseDir, this.CrossLibName), Path.Combine(outSrcDir, @"lib"),
+ delegate(FileInfo fi)
+ {
+ if (fi.DirectoryName.IndexOf(@".svn", StringComparison.InvariantCultureIgnoreCase) != -1)
+ {
+ return false;
+ }
+ return true;
+ }, false, true, true, false);
+
+ // Generate Makefile for compilation
+ byte[] makeFileDataForCross = Str.NormalizeCrlf(Str.Utf8Encoding.GetBytes(GenerateMakeFileForCompile(outSrcDir, debugMode, true).ToString()), new byte[] { 10, });
+ byte[] makeFileDataForSelf = Str.NormalizeCrlf(Str.Utf8Encoding.GetBytes(GenerateMakeFileForCompile(outSrcDir, debugMode, false).ToString()), new byte[] { 10, });
+
+ string makeFileName = Path.Combine(outSrcDir, "Makefile");
+ File.WriteAllBytes(makeFileName, makeFileDataForCross);
+
+ // TimeStamp.txt
+ File.WriteAllText(tsFile, timeStamp);
+
+ // Create a tar.gz
+ string tarGzFileName = Path.Combine(outSrcDir, this.SrcKitFileName);
+ Con.WriteLine("Creating '{0}'...", tarGzFileName);
+ List<string> files = new List<string>();
+
+ foreach (string srcDirName in Util.CombineArray<string>(SrcDirNameList, new string[] { "lib" }))
+ {
+ string dirFullPath = Path.Combine(outSrcDir, srcDirName);
+ string[] fileList = Directory.GetFiles(dirFullPath, "*",
+ srcDirName.Equals("lib", StringComparison.InvariantCultureIgnoreCase) ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories);
+ foreach (string fileName in fileList)
+ {
+ files.Add(fileName);
+ }
+ }
+ files.Add(Path.Combine(outSrcDir, @"CurrentBuild.txt"));
+ files.Add(Path.Combine(outSrcDir, @"bin\hamcore.se2"));
+ files.Add(Path.Combine(outSrcDir, @"Replace.h"));
+ files.Add(Path.Combine(outSrcDir, @"GlobalConst.h"));
+
+ files.Sort();
+ TarPacker tar = new TarPacker();
+ foreach (string file in files)
+ {
+ byte[] fileData = File.ReadAllBytes(file);
+ tar.AddFileSimple(@"src\" + IO.GetRelativeFileName(file, outSrcDir),
+ fileData,
+ 0, fileData.Length, File.GetLastWriteTime(file), "0000750", "0000640");
+ }
+ tar.AddFileSimple(@"src\Makefile", makeFileDataForSelf, 0, makeFileDataForSelf.Length, DateTime.Now, "0000750", "0000640");
+ tar.Finish();
+ byte[] tarGzData = tar.CompressToGZip();
+ File.WriteAllBytes(tarGzFileName, tarGzData);
+
+ IO.MakeDir(Paths.ReleaseSrckitDir);
+ File.WriteAllBytes(Path.Combine(Paths.ReleaseSrckitDir, this.SrcKitFileName), tarGzData);
+
+ Con.WriteLine("Completed.");
+
+ return true;
+ }
+
+ // Compilation settings
+ public string Compiler = "gcc";
+ public List<string> GccMacros = new List<string>();
+
+ // Create a Makefile for release
+ public virtual StringWriter GenerateMakeFileForRelease(string srcDir)
+ {
+ string gccOptionForLink;
+ string gccOptionForCompile;
+
+ generateGccOptions(srcDir, false, false, out gccOptionForLink, out gccOptionForCompile);
+
+ string codeDir = Path.Combine(srcDir, "code");
+ string libDir = Path.Combine(srcDir, "lib");
+
+ string[] codeFiles = Directory.GetFiles(codeDir, "*.a");
+ string[] libFiles = Directory.GetFiles(libDir, "*.a");
+
+ StringWriter sr = new StringWriter();
+ sr.WriteLine("# {0}", this.TitleString);
+ sr.WriteLine("# Makefile");
+ sr.WriteLine("# ");
+
+#if !BU_SOFTETHER
+ sr.WriteLine("# Copyright (c) SoftEther Corporation. All Rights Reserved.");
+#else
+ sr.WriteLine("# Copyright (c) SoftEther VPN Project at University of Tsukuba, Japan. All Rights Reserved.");
+#endif
+ sr.WriteLine("# Platform: {0}", this.CrossLibName);
+ sr.WriteLine();
+ sr.WriteLine("CC={0}", this.Compiler);
+ sr.WriteLine("OPTIONS={0}", gccOptionForLink);
+ sr.WriteLine();
+ sr.WriteLine("default:");
+ sr.WriteLine("\t@./.install.sh");
+ sr.WriteLine();
+ sr.WriteLine("# NOTE:");
+ sr.WriteLine("# You have to read and agree the license agreement at the same directory");
+ sr.WriteLine("# before using this software.");
+ sr.WriteLine();
+ sr.WriteLine("i_read_and_agree_the_license_agreement:");
+
+ sr.WriteLine("\t@echo \"Preparing {0}...\"", BuildHelper.GetSoftwareTitle(this.Software));
+
+ foreach (string filename in libFiles)
+ {
+ sr.WriteLine("\t-ranlib lib/{0}", Path.GetFileName(filename));
+ }
+
+ sr.WriteLine("\t-ranlib code/{0}.a", this.Software.ToString());
+ sr.WriteLine("\t$(CC) code/{0}.a $(OPTIONS) -o {0}", this.Software.ToString());
+
+ sr.WriteLine("\t-ranlib code/{0}.a", "vpncmd");
+ sr.WriteLine("\t$(CC) code/{0}.a $(OPTIONS) -o {0}", "vpncmd");
+
+ if (this.Software == Software.vpnserver_vpnbridge || this.Software == Software.vpnbridge || this.Software == Software.vpnserver)
+ {
+ sr.WriteLine("\t./vpncmd /tool /cmd:Check");
+ }
+
+ Language[] langs = BuildHelper.GetLanguageList();
+
+ sr.WriteLine("\t@echo");
+ sr.WriteLine("\t@echo \"--------------------------------------------------------------------\"");
+ sr.WriteLine("\t@echo \"The preparation of {0} is completed !\"", BuildHelper.GetSoftwareTitle(this.Software));
+ sr.WriteLine("\t@echo");
+ sr.WriteLine("\t@echo");
+ sr.WriteLine("\t@echo \"*** How to switch the display language of the {0} Service ***\"", BuildHelper.GetSoftwareTitle(this.Software));
+ sr.WriteLine("\t@echo \"{0} supports the following languages:\"", BuildHelper.GetSoftwareTitle(this.Software));
+
+ foreach (Language lang in langs)
+ {
+ sr.WriteLine("\t@echo \" - {0}\"", lang.Title);
+ }
+
+ sr.WriteLine("\t@echo");
+ sr.WriteLine("\t@echo \"You can choose your prefered language of {0} at any time.\"", BuildHelper.GetSoftwareTitle(this.Software));
+ sr.WriteLine("\t@echo \"To switch the current language, open and edit the 'lang.config' file.\"");
+
+ sr.WriteLine("\t@echo");
+ sr.WriteLine("\t@echo");
+
+ sr.WriteLine("\t@echo \"*** How to start the {0} Service ***\"", BuildHelper.GetSoftwareTitle(this.Software));
+ sr.WriteLine("\t@echo");
+
+ sr.WriteLine("\t@echo \"Please execute './{0} start' to run the {1} Background Service.\"", this.Software.ToString(), BuildHelper.GetSoftwareTitle(this.Software));
+#if !BU_SOFTETHER
+ sr.WriteLine("\t@echo \"And please execute './vpncmd' to run the PacketiX VPN Command-Line Utility to configure {0}.\"", BuildHelper.GetSoftwareTitle(this.Software));
+#else
+ sr.WriteLine("\t@echo \"And please execute './vpncmd' to run the SoftEther VPN Command-Line Utility to configure {0}.\"", BuildHelper.GetSoftwareTitle(this.Software));
+#endif
+ sr.WriteLine("\t@echo \"Of course, you can use the VPN Server Manager GUI Application for Windows on the other Windows PC in order to configure the {0} remotely.\"", BuildHelper.GetSoftwareTitle(this.Software));
+
+ sr.WriteLine("\t@echo \"--------------------------------------------------------------------\"");
+ sr.WriteLine("\t@echo");
+
+ sr.WriteLine();
+
+ sr.WriteLine("clean:");
+ sr.WriteLine("\trm -f {0}", this.Software.ToString());
+ sr.WriteLine("\trm -f {0}", "vpncmd");
+ sr.WriteLine();
+
+ return sr;
+ }
+
+ // Generate Makefile for compilation
+ public virtual StringWriter GenerateMakeFileForCompile(string outDir, bool debugMode, bool crossCompile)
+ {
+ string[] programNames =
+ {
+ "Ham",
+ "vpnserver",
+ "vpnbridge",
+ "vpnclient",
+ "vpncmd",
+ };
+
+ string gccOptionForLinkDebug, gccOptionForLinkRelease;
+ string gccOptionForCompileDebug, gccOptionForCompileRelease;
+
+ generateGccOptions(outDir, false, crossCompile, out gccOptionForLinkRelease, out gccOptionForCompileRelease);
+ generateGccOptions(outDir, true, crossCompile, out gccOptionForLinkDebug, out gccOptionForCompileDebug);
+
+ StringWriter sr = new StringWriter();
+#if !BU_SOFTETHER
+ sr.WriteLine("# PacketiX VPN Source Code");
+ sr.WriteLine("# Copyright (c) SoftEther Corporation. All Rights Reserved.");
+#else
+ sr.WriteLine("# SoftEther VPN Source Code");
+ sr.WriteLine("# Copyright (c) SoftEther VPN Project at University of Tsukuba, Japan. All Rights Reserved.");
+#endif
+ sr.WriteLine("# Platform: {0}", this.CrossLibName);
+ sr.WriteLine();
+
+ // Variable declaration
+ sr.WriteLine("# Variables");
+ sr.WriteLine("CC={0}", this.Compiler);
+ sr.WriteLine();
+ sr.WriteLine("OPTIONS_COMPILE_DEBUG={0}", gccOptionForCompileDebug);
+ sr.WriteLine();
+ sr.WriteLine("OPTIONS_LINK_DEBUG={0}", gccOptionForLinkDebug);
+ sr.WriteLine();
+ sr.WriteLine("OPTIONS_COMPILE_RELEASE={0}", gccOptionForCompileRelease);
+ sr.WriteLine();
+ sr.WriteLine("OPTIONS_LINK_RELEASE={0}", gccOptionForLinkRelease);
+ sr.WriteLine();
+ sr.WriteLine("ifeq ($(DEBUG),YES)");
+ sr.WriteLine("\tOPTIONS_COMPILE=$(OPTIONS_COMPILE_DEBUG)");
+ sr.WriteLine("\tOPTIONS_LINK=$(OPTIONS_LINK_DEBUG)");
+ sr.WriteLine("else");
+ sr.WriteLine("\tOPTIONS_COMPILE=$(OPTIONS_COMPILE_RELEASE)");
+ sr.WriteLine("\tOPTIONS_LINK=$(OPTIONS_LINK_RELEASE)");
+ sr.WriteLine("endif");
+ sr.WriteLine();
+
+ string[] mayaquaHeaders = generateFileList(Path.Combine(outDir, "Mayaqua"), outDir, "*.h");
+ string[] cedarHeaders = generateFileList(Path.Combine(outDir, "Cedar"), outDir, "*.h");
+ string[] mayaquaSrcs = generateFileList(Path.Combine(outDir, "Mayaqua"), outDir, "*.c");
+ string[] cedarSrcs = generateFileList(Path.Combine(outDir, "Cedar"), outDir, "*.c");
+ List<string> mayaquaObjs = new List<string>();
+ List<string> cedarObjs = new List<string>();
+ List<string> progSrcs = new List<string>();
+ List<string> progObjs = new List<string>();
+ List<string> progAs = new List<string>();
+ List<string> progBins = new List<string>();
+
+ foreach (string progName in programNames)
+ {
+ string progName2 = progName;
+
+ if (progName2.Equals("vpnclient", StringComparison.InvariantCultureIgnoreCase) == false)
+ {
+ progSrcs.Add(string.Format("{0}/{0}.c", progName2));
+ }
+ else
+ {
+ progSrcs.Add(string.Format("{0}/vpncsvc.c", progName2));
+ }
+ progObjs.Add(string.Format("object/{0}.o", progName2));
+ progAs.Add(string.Format("code/{0}.a", progName));
+ progBins.Add(string.Format("bin/{0}", progName.ToLower()));
+ }
+
+ int i;
+ for (i = 0; i < mayaquaSrcs.Length; i++)
+ {
+ mayaquaObjs.Add(string.Format("object/Mayaqua/{0}.o", Path.GetFileNameWithoutExtension(mayaquaSrcs[i])));
+ }
+ for (i = 0; i < cedarSrcs.Length; i++)
+ {
+ cedarObjs.Add(string.Format("object/Cedar/{0}.o", Path.GetFileNameWithoutExtension(cedarSrcs[i])));
+ }
+ sr.WriteLine("# Files");
+ sr.WriteLine("HEADERS_MAYAQUA={0}", Str.CombineStringArray(mayaquaHeaders, " "));
+ sr.WriteLine("HEADERS_CEDAR={0}", Str.CombineStringArray(cedarHeaders, " "));
+ sr.WriteLine("OBJECTS_MAYAQUA={0}", Str.CombineStringArray(mayaquaObjs.ToArray(), " "));
+ sr.WriteLine("OBJECTS_CEDAR={0}", Str.CombineStringArray(cedarObjs.ToArray(), " "));
+ sr.WriteLine();
+
+ // Behavior
+ sr.WriteLine("# Build Action");
+ sr.WriteLine("default:\tbuild");
+ sr.WriteLine();
+ sr.WriteLine("build:\t$(OBJECTS_MAYAQUA) $(OBJECTS_CEDAR) {0}", Str.CombineStringArray(progBins.ToArray(), " "));
+ sr.WriteLine();
+
+ sr.WriteLine("# Mayaqua Kernel Code");
+ for (i = 0; i < mayaquaSrcs.Length; i++)
+ {
+ sr.WriteLine("{0}: {1} $(HEADERS_MAYAQUA)", mayaquaObjs[i], mayaquaSrcs[i]);
+ if (i == 0)
+ {
+ sr.WriteLine("\t@mkdir -p object/");
+ sr.WriteLine("\t@mkdir -p object/Mayaqua/");
+ sr.WriteLine("\t@mkdir -p object/Cedar/");
+ sr.WriteLine("\t@mkdir -p code/");
+ }
+ sr.WriteLine("\t$(CC) $(OPTIONS_COMPILE) -c {0} -o {1}", mayaquaSrcs[i], mayaquaObjs[i]);
+ sr.WriteLine();
+ }
+
+ sr.WriteLine("# Cedar Communication Module Code");
+ for (i = 0; i < cedarSrcs.Length; i++)
+ {
+ string line = string.Format("{0}: {1} $(HEADERS_MAYAQUA) $(HEADERS_CEDAR)", cedarObjs[i], cedarSrcs[i]);
+ if (cedarSrcs[i].EndsWith("Bridge.c", StringComparison.InvariantCultureIgnoreCase))
+ {
+ line += " Cedar/BridgeUnix.c";
+ }
+ sr.WriteLine(line);
+ sr.WriteLine("\t$(CC) $(OPTIONS_COMPILE) -c {0} -o {1}", cedarSrcs[i], cedarObjs[i]);
+ sr.WriteLine();
+ }
+
+ for (i = 0; i < programNames.Length; i++)
+ {
+ sr.WriteLine("# {0}", programNames[i]);
+ sr.WriteLine("{0}: {1} $(HEADERS_MAYAQUA) $(HEADERS_CEDAR) $(OBJECTS_MAYAQUA) $(OBJECTS_CEDAR)",
+ progBins[i], progAs[i]);
+ sr.WriteLine("\t$(CC) {0} $(OPTIONS_LINK) -o {1}", progAs[i], progBins[i]);
+ sr.WriteLine();
+ sr.WriteLine("{0}: {1} $(HEADERS_MAYAQUA) $(HEADERS_CEDAR) $(OBJECTS_MAYAQUA) $(OBJECTS_CEDAR)",
+ progAs[i], progObjs[i]);
+ sr.WriteLine("\trm -f {0}", progAs[i]);
+ sr.WriteLine("\tar r {0} $(OBJECTS_MAYAQUA) $(OBJECTS_CEDAR) {1}", progAs[i], progObjs[i]);
+ sr.WriteLine("\tranlib {0}", progAs[i]);
+ sr.WriteLine();
+ sr.WriteLine("{0}: {1} $(HEADERS_MAYAQUA) $(HEADERS_CEDAR) $(OBJECTS_MAYAQUA) $(OBJECTS_CEDAR)",
+ progObjs[i], progSrcs[i]);
+ sr.WriteLine("\t$(CC) $(OPTIONS_COMPILE) -c {0} -o {1}", progSrcs[i], progObjs[i]);
+ sr.WriteLine();
+ }
+
+ sr.WriteLine("# Clean");
+ sr.WriteLine("clean:");
+ sr.WriteLine("\t-rm -f $(OBJECTS_MAYAQUA)");
+ sr.WriteLine("\t-rm -f $(OBJECTS_CEDAR)");
+ for (i = 0; i < programNames.Length; i++)
+ {
+ sr.WriteLine("\t-rm -f {0}", progObjs[i]);
+ sr.WriteLine("\t-rm -f {0}", progAs[i]);
+ sr.WriteLine("\t-rm -f {0}", progBins[i]);
+ }
+ sr.WriteLine();
+
+ sr.WriteLine("# Help Strings");
+ sr.WriteLine("help:");
+ sr.WriteLine("\t@echo \"make [DEBUG=YES]\"");
+ sr.WriteLine();
+
+ return sr;
+ }
+
+ // Create a file list
+ string[] generateFileList(string dir, string baseDir, string searchPattern)
+ {
+ string[] files = Directory.GetFiles(dir, searchPattern, SearchOption.AllDirectories);
+ List<string> ret = new List<string>();
+
+ foreach (string file in files)
+ {
+ string name = IO.GetRelativeFileName(file, baseDir).Replace(@"\", "/");
+ ret.Add(name);
+ }
+
+ ret.Sort();
+
+ return ret.ToArray();
+ }
+
+ // Generate the GCC option string
+ void generateGccOptions(string outDir, bool debugMode, bool crossCompile, out string gccOptionForLink, out string gccOptionForCompile)
+ {
+ List<string> macros = new List<string>(this.GccMacros.ToArray());
+ List<string> includes = new List<string>();
+ List<string> options = new List<string>();
+ List<string> libs = new List<string>();
+
+ // Determine the macro
+ if (debugMode)
+ {
+ macros.Add("_DEBUG");
+ macros.Add("DEBUG");
+ }
+ else
+ {
+ macros.Add("NDEBUG");
+ macros.Add("VPN_SPEED");
+ macros.Add("MAYAQUA_REPLACE");
+ }
+
+ macros.Add("UNIX");
+ macros.Add("_REENTRANT");
+ macros.Add("REENTRANT");
+ macros.Add("_THREAD_SAFE");
+ macros.Add("_THREADSAFE");
+ macros.Add("THREAD_SAFE");
+ macros.Add("THREADSAFE");
+ macros.Add("_FILE_OFFSET_BITS=64");
+
+ // Decide the include directory
+ includes.Add("./");
+ includes.Add("./Cedar/");
+ includes.Add("./Mayaqua/");
+
+ // Determine options
+ if (debugMode)
+ {
+ options.Add("-g");
+ }
+ else
+ {
+ options.Add("-O2");
+ }
+ options.Add("-fsigned-char");
+ if (this.NoPThreadOption == false)
+ {
+ options.Add("-pthread");
+ }
+ if (this.UseGccBitsOption)
+ {
+ if (this.Cpu.Bits == CPUBits.Bits32)
+ {
+ options.Add("-m32");
+ }
+ else
+ {
+ options.Add("-m64");
+ }
+ }
+
+ // Determine library files
+ string[] libNames =
+ {
+ "libssl",
+ "libcrypto",
+ "libiconv",
+ "libcharset",
+ "libedit",
+ "libncurses",
+ "libz",
+ };
+ foreach (string libName in libNames)
+ {
+ libs.Add(string.Format("lib/{0}.a", libName));
+ }
+
+ if (crossCompile)
+ {
+ if (this.Os == OSList.MacOS)
+ {
+ // Include libpcap.a only when cross-compiling for Mac OS X
+ libs.Add(string.Format("lib/{0}.a", "libpcap"));
+ }
+ }
+
+ if (this.Os == OSList.Linux)
+ {
+ if (this.Cpu == CpuList.x86 || this.Cpu == CpuList.x64)
+ {
+ // Include libintelaes.a only for x86 / x64 in Linux
+ libs.Add(string.Format("lib/{0}.a", "libintelaes"));
+ }
+ }
+
+ gccOptionForCompile = MakeGccOptions(macros.ToArray(), includes.ToArray(), options.ToArray(), null);
+
+ if (crossCompile)
+ {
+ if (Str.IsEmptyStr(this.CrossCompilerOption) == false)
+ {
+ options.Add(this.CrossCompilerOption);
+ }
+ }
+
+ options.Add("-lm");
+
+ if (this.Os == OSList.Solaris)
+ {
+ options.Add("-lrt");
+ options.Add("-lnsl");
+ options.Add("-lsocket");
+ options.Add("-ldl");
+ }
+ else if (this.Os == OSList.Linux)
+ {
+ options.Add("-ldl");
+ options.Add("-lrt");
+ }
+ else if (this.Os == OSList.MacOS)
+ {
+ if (crossCompile == false)
+ {
+ // Include -lpcap for the user environment on Mac OS X
+ options.Add("-lpcap");
+ }
+ }
+
+ if (this.Cpu == CpuList.armeabi)
+ {
+ // Prevent to show a warning on linking in EABI binaries
+ // to EABIHF architecture in ARM
+ options.Add("-Wl,--no-warn-mismatch");
+ }
+
+ options.Add("-lpthread");
+
+ gccOptionForLink = MakeGccOptions(new string[0], new string[0], options.ToArray(), libs.ToArray());
+ }
+
+ public static string MakeGccOptions(string[] macros, string[] includeDirs, string[] options, string[] libs)
+ {
+ List<string> o = new List<string>();
+ foreach (string macro in macros)
+ {
+ o.Add(string.Format("-D{0}", macro));
+ }
+ foreach (string dir in includeDirs)
+ {
+ o.Add(string.Format("-I{0}", dir));
+ }
+ foreach (string opt in options)
+ {
+ o.Add(opt);
+ }
+ if (libs != null)
+ {
+ o.Add("-L./");
+ foreach (string lib in libs)
+ {
+ o.Add(lib);
+ }
+ }
+
+ return Str.CombineStringArray(o.ToArray(), " ");
+ }
+ }
+}
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/VpnBuilder.cs b/src/BuildUtil/VpnBuilder.cs
new file mode 100644
index 00000000..c6489c77
--- /dev/null
+++ b/src/BuildUtil/VpnBuilder.cs
@@ -0,0 +1,650 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ // Languages
+ public class Language
+ {
+ public int Number;
+ public string Id;
+ public string Title;
+ public string TitleUnicode;
+ public string WindowsLocaleIds;
+ public string UnixLocaleIds;
+ }
+
+ // Build helper class
+ public static class BuildHelper
+ {
+ // loads the language list text file
+ public static Language[] GetLanguageList()
+ {
+ return GetLanguageList(Path.Combine(Paths.BinDirName, @"hamcore\languages.txt"));
+ }
+ public static Language[] GetLanguageList(string filename)
+ {
+ List<Language> ret = new List<Language>();
+ string[] lines = File.ReadAllLines(filename, Str.Utf8Encoding);
+
+ foreach (string line in lines)
+ {
+ string s = line.Trim();
+
+ if (Str.IsEmptyStr(s) == false)
+ {
+ if (s.StartsWith("#", StringComparison.InvariantCultureIgnoreCase) == false)
+ {
+ string[] sps = { " ", "\t", };
+ string[] tokens = s.Split(sps, StringSplitOptions.RemoveEmptyEntries);
+
+ if (tokens.Length == 6)
+ {
+ Language e = new Language();
+
+ e.Number = Str.StrToInt(tokens[0]);
+ e.Id = tokens[1];
+ e.Title = Str.ReplaceStr(tokens[2], "_", " ");
+ e.TitleUnicode = tokens[3];
+ e.WindowsLocaleIds = tokens[4];
+ e.UnixLocaleIds = tokens[5];
+
+ ret.Add(e);
+
+ Con.WriteLine(tokens.Length);
+ }
+ }
+ }
+ }
+
+ return ret.ToArray();
+ }
+
+ // Build
+ public static void BuildMain(BuildSoftware soft, bool debugModeIfUnix)
+ {
+ int version, build;
+ string name;
+ DateTime date;
+
+ string title = Console.Title;
+ Console.Title = string.Format("Building {0}", soft.IDString);
+
+ try
+ {
+ Win32BuildUtil.ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+
+ soft.SetBuildNumberVersionName(build, version, name, date);
+
+ Con.WriteLine("Building '{0}' - {1}...", soft.IDString, soft.TitleString);
+
+ BuildSoftwareUnix softUnix = soft as BuildSoftwareUnix;
+
+ if (softUnix == null)
+ {
+ soft.Build();
+ }
+ else
+ {
+ softUnix.Build(debugModeIfUnix);
+ }
+ }
+ finally
+ {
+ Console.Title = title;
+ }
+ }
+
+ // Convert the number to a version number
+ public static string VersionIntToString(int version)
+ {
+ return string.Format("{0}.{1:D2}", version / 100, version % 100);
+ }
+
+ // Get a product list that is included in the software
+ public static string GetSoftwareProductList(Software soft)
+ {
+ string ret = "";
+
+ switch (soft)
+ {
+ case Software.vpnbridge:
+ ret = "PacketiX VPN Bridge";
+ break;
+
+ case Software.vpnclient:
+ ret = "PacketiX VPN Client, PacketiX VPN Command-Line Admin Utility (vpncmd)";
+ break;
+
+ case Software.vpnserver:
+ ret = "PacketiX VPN Server, PacketiX VPN Command-Line Admin Utility (vpncmd)";
+ break;
+
+ case Software.vpnserver_vpnbridge:
+ ret = "PacketiX VPN Server, PacketiX VPN Bridge, PacketiX VPN Server Manager for Windows, PacketiX VPN Command-Line Admin Utility (vpncmd)";
+ break;
+
+ default:
+ throw new ApplicationException("invalid soft.");
+ }
+
+#if BU_SOFTETHER
+ ret = Str.ReplaceStr(ret, "PacketiX", "SoftEther", false);
+#endif
+
+ return ret;
+ }
+
+ // Get the title of the software
+ public static string GetSoftwareTitle(Software soft)
+ {
+ string ret = "";
+
+ switch (soft)
+ {
+ case Software.vpnbridge:
+ ret = "PacketiX VPN Bridge";
+ break;
+
+ case Software.vpnclient:
+ ret = "PacketiX VPN Client";
+ break;
+
+ case Software.vpnserver:
+ ret = "PacketiX VPN Server";
+ break;
+
+ case Software.vpnserver_vpnbridge:
+ ret = "PacketiX VPN Server and VPN Bridge";
+ break;
+
+ default:
+ throw new ApplicationException("invalid soft.");
+ }
+
+#if BU_SOFTETHER
+ ret = Str.ReplaceStr(ret, "PacketiX", "SoftEther", false);
+#endif
+
+ return ret;
+ }
+ }
+
+ // Basic path information
+ public static class Paths
+ {
+ public static readonly string ExeFileName = Env.ExeFileName;
+ public static readonly string ExeDirName = Env.ExeFileDir;
+ public static readonly string BinDirName = ExeDirName;
+ public static readonly string BaseDirName = IO.NormalizePath(Path.Combine(BinDirName, @"..\"));
+ public static readonly string UtilityDirName = IO.NormalizePath(Path.Combine(BinDirName, @"..\BuildFiles\Utility"));
+
+#if !BU_SOFTETHER
+ // PacketiX VPN (build by SoftEther)
+ public static readonly string VPN4SolutionFileName = Path.Combine(BaseDirName, "VPN4.sln");
+ public static readonly string DebugSnapshotBaseDir = @"S:\SE4\DebugFilesSnapshot";
+ public static readonly string ReleaseDestDir = @"s:\SE4\Releases";
+ public const string Prefix = "";
+#else
+#if !BU_OSS
+ // SoftEther VPN (build by SoftEther)
+ public static readonly string VPN4SolutionFileName = Path.Combine(BaseDirName, "SEVPN.sln");
+ public static readonly string DebugSnapshotBaseDir = @"S:\SE4\DebugFilesSnapshot_SEVPN";
+ public static readonly string ReleaseDestDir = @"s:\SE4\Releases_SEVPN";
+ public const string Prefix = "softether-";
+#else
+ // SoftEther VPN (build by Open Source Developers)
+ public static readonly string VPN4SolutionFileName = Path.Combine(BaseDirName, "SEVPN.sln");
+ public static readonly string DebugSnapshotBaseDir = IO.NormalizePath(Path.Combine(BaseDirName, @"..\output\debug"));
+ public static readonly string ReleaseDestDir = IO.NormalizePath(Path.Combine(BaseDirName, @"..\output\pkg"));
+ public const string Prefix = "softether_open-";
+#endif
+#endif
+
+ public static readonly string ReleaseDestDir_SEVPN = @"s:\SE4\Releases_SEVPN";
+
+ public static readonly string BuildHamcoreFilesDirName = Path.Combine(BinDirName, "BuiltHamcoreFiles");
+ public static readonly string VisualStudioVCDir;
+ public static readonly string VisualStudioVCBatchFileName;
+ public static readonly string DotNetFramework35Dir;
+ public static readonly string MSBuildFileName;
+ public static readonly string TmpDirName;
+ public static readonly DateTime StartDateTime = DateTime.Now;
+ public static readonly string StartDateTimeStr;
+ public static readonly string CmdFileName;
+ public static readonly string ManifestsDir = Path.Combine(BaseDirName, @"BuildFiles\Manifests");
+ public static readonly string XCopyExeFileName = Path.Combine(Env.SystemDir, "xcopy.exe");
+ public static readonly string ReleaseDir = Path.Combine(BaseDirName, @"tmp\Release");
+ public static readonly string ReleaseSrckitDir = Path.Combine(BaseDirName, @"tmp\ReleaseSrcKit");
+ public static readonly string StringsDir = Path.Combine(BaseDirName, @"BuildFiles\Strings");
+ public static readonly string CrossCompilerBaseDir = @"S:\CommomDev\xc";
+ public static readonly string UnixInstallScript = Path.Combine(BaseDirName, @"BuildFiles\UnixFiles\InstallScript.txt");
+ public static readonly string OssCommentsFile = Path.Combine(StringsDir, "OssComments.txt");
+ public static readonly string AutorunSrcDir = IO.NormalizePath(Path.Combine(BaseDirName, @"..\Autorun"));
+ public static readonly string MicrosoftSDKDir;
+ public static readonly string MakeCatFilename;
+ public static readonly string RcFilename;
+ public static readonly string SoftEtherBuildDir = Env.SystemDir.Substring(0, 2) + @"\tmp\softether_build_dir";
+ public static readonly string OpenSourceDestDir = Env.SystemDir.Substring(0, 2) + @"\tmp\softether_oss_dest_dir";
+
+ // Initialize
+ static Paths()
+ {
+ // Starting date and time string
+ Paths.StartDateTimeStr = Str.DateTimeToStrShort(Paths.StartDateTime);
+
+ // Check whether the execution path is the bin directory in the VPN directory
+ if (Paths.BinDirName.EndsWith(@"\bin", StringComparison.InvariantCultureIgnoreCase) == false)
+ {
+ throw new ApplicationException(string.Format("'{0}' is not a VPN bin directory.", Paths.BinDirName));
+ }
+ if (File.Exists(Paths.VPN4SolutionFileName) == false)
+ {
+ throw new ApplicationException(string.Format("'{0}' is not a VPN base directory.", Paths.BaseDirName));
+ }
+
+ // Get the VC++ directory
+ // Visual Studio 2008
+ Paths.VisualStudioVCDir = IO.RemoteLastEnMark(Reg.ReadStr(RegRoot.LocalMachine, @"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC", "ProductDir"));
+ if (Str.IsEmptyStr(Paths.VisualStudioVCDir))
+ {
+ throw new ApplicationException("Visual C++ directory not found.\n");
+ }
+ if (Directory.Exists(Paths.VisualStudioVCDir) == false)
+ {
+ throw new ApplicationException(string.Format("Directory '{0}' not found.", Paths.VisualStudioVCDir));
+ }
+
+ // Get the VC++ batch file name
+ Paths.VisualStudioVCBatchFileName = Path.Combine(Paths.VisualStudioVCDir, "vcvarsall.bat");
+ if (File.Exists(Paths.VisualStudioVCBatchFileName) == false)
+ {
+ throw new ApplicationException(string.Format("File '{0}' not found.", Paths.VisualStudioVCBatchFileName));
+ }
+
+ bool x86_dir = false;
+
+ // Get Microsoft SDK 6.0a directory
+ Paths.MicrosoftSDKDir = IO.RemoteLastEnMark(Reg.ReadStr(RegRoot.LocalMachine, @"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A", "InstallationFolder"));
+
+ // Get makecat.exe file name
+ Paths.MakeCatFilename = Path.Combine(Paths.MicrosoftSDKDir, @"bin\" + (x86_dir ? @"x86\" : "") + "makecat.exe");
+
+ // Get the rc.exe file name
+ Paths.RcFilename = Path.Combine(Paths.MicrosoftSDKDir, @"bin\" + (x86_dir ? @"x86\" : "") + "rc.exe");
+
+ // Get the cmd.exe file name
+ Paths.CmdFileName = Path.Combine(Env.SystemDir, "cmd.exe");
+ if (File.Exists(Paths.CmdFileName) == false)
+ {
+ throw new ApplicationException(string.Format("File '{0}' not found.", Paths.CmdFileName));
+ }
+
+ // Get .NET Framework 3.5 directory
+ Paths.DotNetFramework35Dir = Path.Combine(Env.WindowsDir, @"Microsoft.NET\Framework\v3.5");
+
+ // Get msbuild.exe directory
+ Paths.MSBuildFileName = Path.Combine(Paths.DotNetFramework35Dir, "MSBuild.exe");
+ if (File.Exists(Paths.MSBuildFileName) == false)
+ {
+ throw new ApplicationException(string.Format("File '{0}' not found.", Paths.MSBuildFileName));
+ }
+
+ // Get the TMP directory
+ Paths.TmpDirName = Path.Combine(Paths.BaseDirName, "tmp");
+ if (Directory.Exists(Paths.TmpDirName) == false)
+ {
+ Directory.CreateDirectory(Paths.TmpDirName);
+ }
+ }
+
+ public static void DeleteAllReleaseTarGz()
+ {
+ if (Directory.Exists(Paths.ReleaseDir))
+ {
+ string[] files = Directory.GetFiles(Paths.ReleaseDir, "*.gz", SearchOption.AllDirectories);
+
+ foreach (string file in files)
+ {
+ File.Delete(file);
+ }
+ }
+
+ if (Directory.Exists(Paths.ReleaseSrckitDir))
+ {
+ string[] files = Directory.GetFiles(Paths.ReleaseSrckitDir, "*.gz", SearchOption.AllDirectories);
+
+ foreach (string file in files)
+ {
+ File.Delete(file);
+ }
+ }
+ }
+
+ public static void DeleteAllReleaseAdminKits()
+ {
+ if (Directory.Exists(Paths.ReleaseDir))
+ {
+ string[] files = Directory.GetFiles(Paths.ReleaseDir, "*.zip", SearchOption.AllDirectories);
+
+ foreach (string file in files)
+ {
+ if (Str.InStr(file, "vpnadminpak"))
+ {
+ File.Delete(file);
+ }
+ }
+ }
+ }
+
+ public static void DeleteAllReleaseManuals()
+ {
+ if (Directory.Exists(Paths.ReleaseDir))
+ {
+ string[] files = Directory.GetFiles(Paths.ReleaseDir, "*", SearchOption.AllDirectories);
+
+ foreach (string file in files)
+ {
+ if (Str.InStr(file, "vpnmanual"))
+ {
+ File.Delete(file);
+ }
+ }
+ }
+ }
+
+ public static void DeleteAllReleaseExe()
+ {
+ if (Directory.Exists(Paths.ReleaseDir))
+ {
+ string[] files = Directory.GetFiles(Paths.ReleaseDir, "*.exe", SearchOption.AllDirectories);
+
+ foreach (string file in files)
+ {
+ if (Str.InStr(file, "vpnmanual") == false)
+ {
+ File.Delete(file);
+ }
+ }
+ }
+ }
+ }
+
+ // HamCore build utility
+ public static class HamCoreBuildUtil
+ {
+ // Identify whether a file is necessary only in the Win32
+ public static bool IsFileForOnlyWin32(string filename)
+ {
+ string[] filesOnlyWin32 =
+ {
+ ".exe",
+ ".dll",
+ ".sys",
+ ".inf",
+ ".wav",
+ };
+
+ foreach (string ext in filesOnlyWin32)
+ {
+ if (filename.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // Delete svn file
+ public static void DeleteSVNFilesFromHamCoreBuilder(HamCoreBuilder b)
+ {
+ List<string> removeFiles = new List<string>();
+ foreach (HamCoreBuilderFileEntry f in b.FileList)
+ {
+ string name = f.Name;
+ if (name.StartsWith(".svn", StringComparison.InvariantCultureIgnoreCase) ||
+ name.IndexOf(@"\.svn", StringComparison.InvariantCultureIgnoreCase) != -1)
+ {
+ removeFiles.Add(name);
+ }
+ }
+ foreach (string file in removeFiles)
+ {
+ b.DeleteFile(file);
+ }
+ }
+
+ // Build Hamcore file
+ public static void BuildHamcore()
+ {
+ string srcDirNameBasic = Path.Combine(Paths.BinDirName, "hamcore");
+ // Create the destination directory
+ string win32DestDir = Path.Combine(Paths.BuildHamcoreFilesDirName, "hamcore_win32");
+ string win32DestFileName = Path.Combine(win32DestDir, "hamcore.se2");
+ string unixDestDir = Path.Combine(Paths.BuildHamcoreFilesDirName, "hamcore_unix");
+ string unixDestFileName = Path.Combine(unixDestDir, "hamcore.se2");
+ IO.MakeDir(win32DestDir);
+ IO.MakeDir(unixDestDir);
+
+
+ BuildHamcoreEx(srcDirNameBasic, win32DestFileName, unixDestFileName);
+
+ // Copy to bin\hamcore.se2
+ try
+ {
+ string binHamcoreFileName = Path.Combine(Paths.BinDirName, "hamcore.se2");
+
+ try
+ {
+ File.Delete(binHamcoreFileName);
+ }
+ catch
+ {
+ }
+
+ File.Copy(win32DestFileName, binHamcoreFileName, true);
+ }
+ catch
+ {
+ }
+ }
+
+ public static void BuildHamcoreEx(string srcDirNameBasic, string win32DestFileName, string unixDestFileName)
+ {
+ HamCoreBuilder b = new HamCoreBuilder();
+ b.AddDir(srcDirNameBasic);
+ Con.WriteLine("* Building hamcore ...");
+
+ DeleteSVNFilesFromHamCoreBuilder(b);
+
+ try
+ {
+ File.Delete(win32DestFileName);
+ }
+ catch
+ {
+ }
+ b.Build(win32DestFileName);
+
+ // unix
+ List<string> removeFiles = new List<string>();
+ foreach (HamCoreBuilderFileEntry f in b.FileList)
+ {
+ if (IsFileForOnlyWin32(f.Name))
+ {
+ removeFiles.Add(f.Name);
+ }
+ }
+ foreach (string removeFile in removeFiles)
+ {
+ b.DeleteFile(removeFile);
+ }
+
+ DeleteSVNFilesFromHamCoreBuilder(b);
+
+ try
+ {
+ File.Delete(unixDestFileName);
+ }
+ catch
+ {
+ }
+ b.Build(unixDestFileName);
+ }
+ }
+
+ // Number of bits
+ public enum CPUBits
+ {
+ Both,
+ Bits32,
+ Bits64,
+ }
+
+ // Conversion a string to the number of bits
+ public static class CPUBitsUtil
+ {
+ public static CPUBits StringToCPUBits(string str)
+ {
+ if (str.Equals("32bit", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return CPUBits.Bits32;
+ }
+ else if (str.Equals("64bit", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return CPUBits.Bits64;
+ }
+ else if (str.Equals("intel", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return CPUBits.Both;
+ }
+
+ throw new ApplicationException(string.Format("Invalid bits string '{0}'.", str));
+ }
+
+ public static string CPUBitsToString(CPUBits bits)
+ {
+ switch (bits)
+ {
+ case CPUBits.Bits32:
+ return "32bit";
+
+ case CPUBits.Bits64:
+ return "64bit";
+
+ case CPUBits.Both:
+ return "intel";
+ }
+
+ throw new ApplicationException("bits invalid.");
+ }
+ }
+}
+
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/VpnBuilderConfig.cs b/src/BuildUtil/VpnBuilderConfig.cs
new file mode 100644
index 00000000..d3d74cc7
--- /dev/null
+++ b/src/BuildUtil/VpnBuilderConfig.cs
@@ -0,0 +1,513 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ // Build settings
+ public static class BuildConfig
+ {
+ public static readonly int NumMultipleCompileTasks = 4;
+ }
+
+ // Software List
+ public static class BuildSoftwareList
+ {
+ // List creation date and time
+ public static DateTime ListCreatedDateTime = DateTime.Now;
+
+ // ========== Windows ==========
+ // Server and Bridge
+ public static readonly BuildSoftware vpnserver_win32_x86x64_ja =
+ new BuildSoftwareWin32(Software.vpnserver_vpnbridge, 0, 0, "", CpuList.intel, OSList.Windows);
+
+ // Client
+ public static readonly BuildSoftware vpnclient_win32_x86x64_ja =
+ new BuildSoftwareWin32(Software.vpnclient, 0, 0, "", CpuList.intel, OSList.Windows);
+
+ // ========== Linux ==========
+ // Server
+ public static readonly BuildSoftware vpnserver_linux_x86_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x86, OSList.Linux,
+ "linux-x86-32bit", true, "linux-x86-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnserver_linux_x64_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x64, OSList.Linux,
+ "linux-x86-64bit", true, "linux-x86-64bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnserver_linux_arm_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.arm, OSList.Linux,
+ "linux-arm-32bit", false, "linux-arm-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnserver_linux_armeabi_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.armeabi, OSList.Linux,
+ "linux-armeabi-32bit", false, "linux-armeabi-32bit-4.3.2", true,
+ null);
+ public static readonly BuildSoftware vpnserver_linux_mipsel_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.mipsel, OSList.Linux,
+ "linux-mipsel-32bit", false, "linux-mipsel-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnserver_linux_ppc_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.ppc32, OSList.Linux,
+ "linux-ppc-32bit", false, "linux-ppc-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnserver_linux_sh4_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.sh4, OSList.Linux,
+ "linux-sh4-32bit", false, "linux-sh4-32bit-3.4.6", false,
+ null);
+
+ // Client
+ public static readonly BuildSoftware vpnclient_linux_x86_ja =
+ new BuildSoftwareUnix(Software.vpnclient, 0, 0, "", CpuList.x86, OSList.Linux,
+ "linux-x86-32bit", true, "linux-x86-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnclient_linux_x64_ja =
+ new BuildSoftwareUnix(Software.vpnclient, 0, 0, "", CpuList.x64, OSList.Linux,
+ "linux-x86-64bit", true, "linux-x86-64bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnclient_linux_arm_ja =
+ new BuildSoftwareUnix(Software.vpnclient, 0, 0, "", CpuList.arm, OSList.Linux,
+ "linux-arm-32bit", false, "linux-arm-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnclient_linux_armeabi_ja =
+ new BuildSoftwareUnix(Software.vpnclient, 0, 0, "", CpuList.armeabi, OSList.Linux,
+ "linux-armeabi-32bit", false, "linux-armeabi-32bit-4.3.2", true,
+ null);
+ public static readonly BuildSoftware vpnclient_linux_mipsel_ja =
+ new BuildSoftwareUnix(Software.vpnclient, 0, 0, "", CpuList.mipsel, OSList.Linux,
+ "linux-mipsel-32bit", false, "linux-mipsel-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnclient_linux_ppc_ja =
+ new BuildSoftwareUnix(Software.vpnclient, 0, 0, "", CpuList.ppc32, OSList.Linux,
+ "linux-ppc-32bit", false, "linux-ppc-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnclient_linux_sh4_ja =
+ new BuildSoftwareUnix(Software.vpnclient, 0, 0, "", CpuList.sh4, OSList.Linux,
+ "linux-sh4-32bit", false, "linux-sh4-32bit-3.4.6", false,
+ null);
+
+ // Bridge
+ public static readonly BuildSoftware vpnbridge_linux_x86_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x86, OSList.Linux,
+ "linux-x86-32bit", true, "linux-x86-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnbridge_linux_x64_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x64, OSList.Linux,
+ "linux-x86-64bit", true, "linux-x86-64bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnbridge_linux_arm_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.arm, OSList.Linux,
+ "linux-arm-32bit", false, "linux-arm-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnbridge_linux_armeabi_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.armeabi, OSList.Linux,
+ "linux-armeabi-32bit", false, "linux-armeabi-32bit-4.3.2", true,
+ null);
+ public static readonly BuildSoftware vpnbridge_linux_mipsel_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.mipsel, OSList.Linux,
+ "linux-mipsel-32bit", false, "linux-mipsel-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnbridge_linux_ppc_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.ppc32, OSList.Linux,
+ "linux-ppc-32bit", false, "linux-ppc-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnbridge_linux_sh4_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.sh4, OSList.Linux,
+ "linux-sh4-32bit", false, "linux-sh4-32bit-3.4.6", false,
+ null);
+
+
+ // ========== FreeBSD ==========
+ // Server
+ public static readonly BuildSoftware vpnserver_bsd_x86_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x86, OSList.FreeBSD,
+ "freebsd-x86-32bit", true, "freebsd-x86-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnserver_bsd_x64_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x64, OSList.FreeBSD,
+ "freebsd-x86-64bit", true, "freebsd-x86-64bit-3.4.6", false,
+ null);
+
+ // Bridge
+ public static readonly BuildSoftware vpnbridge_bsd_x86_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x86, OSList.FreeBSD,
+ "freebsd-x86-32bit", true, "freebsd-x86-32bit-3.4.6", false,
+ null);
+ public static readonly BuildSoftware vpnbridge_bsd_x64_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x64, OSList.FreeBSD,
+ "freebsd-x86-64bit", true, "freebsd-x86-64bit-3.4.6", false,
+ null);
+
+
+ // ========== Mac OS X ==========
+ // Server
+ public static readonly BuildSoftware vpnserver_macos_ppc32_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.ppc32, OSList.MacOS,
+ "macos-ppc-32bit", true, "macos-ppc-32bit-4.0.4", true,
+ "-isysroot /cygdrive/s/CommomDev/xc/common/apple_xcode/xcode_2.4/Developer/SDKs/MacOSX10.4u.sdk");
+ public static readonly BuildSoftware vpnserver_macos_ppc64_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.ppc64, OSList.MacOS,
+ "macos-ppc-64bit", true, "macos-ppc-64bit-4.0.4", true,
+ null);
+ public static readonly BuildSoftware vpnserver_macos_x86_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x86, OSList.MacOS,
+ "macos-x86-32bit", true, "macos-x86-32bit-4.0.4", true,
+ "-isysroot /cygdrive/s/CommomDev/xc/common/apple_xcode/xcode_2.4/Developer/SDKs/MacOSX10.4u.sdk");
+ public static readonly BuildSoftware vpnserver_macos_x64_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x64, OSList.MacOS,
+ "macos-x86-64bit", true, "macos-x86-64bit-4.0.4", true,
+ null);
+
+ // Bridge
+ public static readonly BuildSoftware vpnbridge_macos_ppc32_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.ppc32, OSList.MacOS,
+ "macos-ppc-32bit", true, "macos-ppc-32bit-4.0.4", true,
+ "-isysroot /cygdrive/s/CommomDev/xc/common/apple_xcode/xcode_2.4/Developer/SDKs/MacOSX10.4u.sdk");
+ public static readonly BuildSoftware vpnbridge_macos_ppc64_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.ppc64, OSList.MacOS,
+ "macos-ppc-64bit", true, "macos-ppc-64bit-4.0.4", true,
+ null);
+ public static readonly BuildSoftware vpnbridge_macos_x86_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x86, OSList.MacOS,
+ "macos-x86-32bit", true, "macos-x86-32bit-4.0.4", true,
+ "-isysroot /cygdrive/s/CommomDev/xc/common/apple_xcode/xcode_2.4/Developer/SDKs/MacOSX10.4u.sdk");
+ public static readonly BuildSoftware vpnbridge_macos_x64_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x64, OSList.MacOS,
+ "macos-x86-64bit", true, "macos-x86-64bit-4.0.4", true,
+ null);
+
+ // ========== Solaris ==========
+ // Server
+ public static readonly BuildSoftware vpnserver_solaris_sparc32_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.sparc32, OSList.Solaris,
+ "solaris-sparc-32bit", true, "solaris-sparc-32bit-3.4.6", true,
+ null);
+ public static readonly BuildSoftware vpnserver_solaris_sparc64_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.sparc64, OSList.Solaris,
+ "solaris-sparc-64bit", true, "solaris-sparc-64bit-3.4.6", true,
+ null);
+ public static readonly BuildSoftware vpnserver_solaris_x86_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x86, OSList.Solaris,
+ "solaris-x86-32bit", true, "solaris-x86-32bit-3.4.6", true,
+ null);
+ public static readonly BuildSoftware vpnserver_solaris_x64_ja =
+ new BuildSoftwareUnix(Software.vpnserver, 0, 0, "", CpuList.x64, OSList.Solaris,
+ "solaris-x86-64bit", true, "solaris-x86-64bit-3.4.6", true,
+ null);
+
+ // Bridge
+ public static readonly BuildSoftware vpnbridge_solaris_sparc32_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.sparc32, OSList.Solaris,
+ "solaris-sparc-32bit", true, "solaris-sparc-32bit-3.4.6", true,
+ null);
+ public static readonly BuildSoftware vpnbridge_solaris_sparc64_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.sparc64, OSList.Solaris,
+ "solaris-sparc-64bit", true, "solaris-sparc-64bit-3.4.6", true,
+ null);
+ public static readonly BuildSoftware vpnbridge_solaris_x86_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x86, OSList.Solaris,
+ "solaris-x86-32bit", true, "solaris-x86-32bit-3.4.6", true,
+ null);
+ public static readonly BuildSoftware vpnbridge_solaris_x64_ja =
+ new BuildSoftwareUnix(Software.vpnbridge, 0, 0, "", CpuList.x64, OSList.Solaris,
+ "solaris-x86-64bit", true, "solaris-x86-64bit-3.4.6", true,
+ null);
+
+ static BuildSoftwareList()
+ {
+ foreach (BuildSoftware soft in List)
+ {
+ BuildSoftwareUnix s = soft as BuildSoftwareUnix;
+ if (s != null)
+ {
+ // Make different settings for each OS
+ if (soft.Os == OSList.Linux)
+ {
+ s.GccMacros.Add("UNIX_LINUX");
+ }
+ else if (soft.Os == OSList.FreeBSD)
+ {
+ s.GccMacros.Add("UNIX_BSD");
+ s.GccMacros.Add("BRIDGE_BPF");
+ s.GccMacros.Add("NO_VLAN");
+ }
+ else if (soft.Os == OSList.MacOS)
+ {
+ s.GccMacros.Add("UNIX_MACOS");
+ s.GccMacros.Add("BRIDGE_PCAP");
+ s.GccMacros.Add("NO_VLAN");
+ }
+ else if (soft.Os == OSList.Solaris)
+ {
+ s.GccMacros.Add("UNIX_SOLARIS");
+ s.GccMacros.Add("NO_VLAN");
+ }
+ if (s.Cpu.Bits == CPUBits.Bits64)
+ {
+ s.GccMacros.Add("CPU_64");
+ }
+ s.GccMacros.Add("CPU_" + s.Cpu.Name.ToUpperInvariant());
+ }
+ }
+ }
+
+ public static BuildSoftware[] List
+ {
+ get
+ {
+ List<BuildSoftware> o = new List<BuildSoftware>();
+ foreach (FieldInfo fi in typeof(BuildSoftwareList).GetFields(BindingFlags.Static | BindingFlags.Public))
+ if (fi.FieldType == typeof(BuildSoftware))
+ o.Add((BuildSoftware)fi.GetValue(null));
+ return o.ToArray();
+ }
+ }
+
+ public static BuildSoftware Find(Software soft, OS os, Cpu cpu)
+ {
+ foreach (BuildSoftware s in List)
+ {
+ if (s.Software == soft && s.Os == os && s.Cpu == cpu)
+ {
+ return s;
+ }
+ }
+ return null;
+ }
+ }
+
+ // OS List
+ public static class OSList
+ {
+ // Windows
+ public static readonly OS Windows = new OS("windows", "Windows",
+ "Windows 98 / 98 SE / ME / NT 4.0 SP6a / 2000 SP4 / XP SP2, SP3 / Server 2003 SP2 / Vista SP1, SP2 / Server 2008 SP1, SP2 / Hyper-V Server 2008 / 7 SP1 / Server 2008 R2 SP1 / Hyper-V Server 2008 R2 / 8 / Server 2012 / Hyper-V Server 2012 / 8.1 / Server 2012 R2 / Hyper-V Server 2012 R2",
+ new Cpu[]
+ {
+ CpuList.intel,
+ });
+
+ // Linux
+ public static readonly OS Linux = new OS("linux", "Linux",
+ "Linux Kernel 2.4 / 2.6 / 3.x",
+ new Cpu[]
+ {
+ CpuList.x86,
+ CpuList.x64,
+ CpuList.mipsel,
+ CpuList.ppc32,
+ CpuList.ppc64,
+ CpuList.sh4,
+ CpuList.arm,
+ CpuList.armeabi,
+ });
+
+ // FreeBSD
+ public static readonly OS FreeBSD = new OS("freebsd", "FreeBSD",
+ "FreeBSD 5 / 6 / 7 / 8 / 9",
+ new Cpu[]
+ {
+ CpuList.x86,
+ CpuList.x64,
+ });
+
+ // Solaris
+ public static readonly OS Solaris = new OS("solaris", "Solaris",
+ "Solaris 8 / 9 / 10 / 11",
+ new Cpu[]
+ {
+ CpuList.x86,
+ CpuList.x64,
+ CpuList.sparc32,
+ CpuList.sparc64,
+ });
+
+ // Mac OS X
+ public static readonly OS MacOS = new OS("macos", "Mac OS X",
+ "Mac OS X 10.4 Tiger / 10.5 Leopard / 10.6 Snow Leopard / 10.7 Lion / 10.8 Mountain Lion",
+ new Cpu[]
+ {
+ CpuList.x86,
+ CpuList.x64,
+ CpuList.ppc32,
+ CpuList.ppc64,
+ });
+
+ static OSList()
+ {
+ OSList.Windows.IsWindows = true;
+ }
+
+ public static OS[] List
+ {
+ get
+ {
+ List<OS> o = new List<OS>();
+ foreach (FieldInfo fi in typeof(OSList).GetFields(BindingFlags.Static | BindingFlags.Public))
+ if (fi.FieldType == typeof(OS))
+ o.Add((OS)fi.GetValue(null));
+ return o.ToArray();
+ }
+ }
+
+ public static OS FindByName(string name)
+ {
+ foreach (OS os in List)
+ {
+ if (os.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return os;
+ }
+ }
+
+ throw new ApplicationException(name);
+ }
+ }
+
+ // CPU List
+ public static class CpuList
+ {
+ public static readonly Cpu x86 = new Cpu("x86", "Intel x86", CPUBits.Bits32);
+ public static readonly Cpu x64 = new Cpu("x64", "Intel x64 / AMD64", CPUBits.Bits64);
+ public static readonly Cpu intel = new Cpu("x86_x64", "Intel", CPUBits.Both);
+ public static readonly Cpu arm = new Cpu("arm", "ARM legacy ABI", CPUBits.Bits32);
+ public static readonly Cpu armeabi = new Cpu("arm_eabi", "ARM EABI", CPUBits.Bits32);
+ public static readonly Cpu mipsel = new Cpu("mips_el", "MIPS Little-Endian", CPUBits.Bits32);
+ public static readonly Cpu ppc32 = new Cpu("powerpc", "PowerPC", CPUBits.Bits32);
+ public static readonly Cpu ppc64 = new Cpu("powerpc64", "PowerPC G5", CPUBits.Bits64);
+ public static readonly Cpu sh4 = new Cpu("sh4", "SH-4", CPUBits.Bits32);
+ public static readonly Cpu sparc32 = new Cpu("sparc", "SPARC", CPUBits.Bits32);
+ public static readonly Cpu sparc64 = new Cpu("sparc64", "SPARC", CPUBits.Bits64);
+
+ public static Cpu[] List
+ {
+ get
+ {
+ List<Cpu> o = new List<Cpu>();
+ foreach (FieldInfo fi in typeof(CpuList).GetFields(BindingFlags.Static | BindingFlags.Public))
+ if (fi.FieldType == typeof(Cpu))
+ o.Add((Cpu)fi.GetValue(null));
+ return o.ToArray();
+ }
+ }
+
+ public static Cpu FindByName(string name)
+ {
+ foreach (Cpu c in List)
+ {
+ if (c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return c;
+ }
+ }
+
+ throw new ApplicationException(name);
+ }
+ }
+}
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/VpnBuilderConfigTypes.cs b/src/BuildUtil/VpnBuilderConfigTypes.cs
new file mode 100644
index 00000000..8ef91a6e
--- /dev/null
+++ b/src/BuildUtil/VpnBuilderConfigTypes.cs
@@ -0,0 +1,303 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ // CPU data
+ public class Cpu
+ {
+ public string Name; // CPU name
+ public string Title; // CPU display name
+ public CPUBits Bits; // Bit length
+
+ public Cpu(string name, string title, CPUBits bits)
+ {
+ this.Name = name;
+ this.Title = title;
+ this.Bits = bits;
+ }
+ }
+
+ // OS data
+ public class OS : ICloneable
+ {
+ public string Name; // OS name
+ public string Title; // OS Display Name
+ public string OSSimpleList; // OS simple list
+ public Cpu[] CpuList; // CPU support list
+ public bool IsWindows = false; // Whether Windows
+ public bool IsOnlyFiles = false; // Whether only EXE file package
+
+ public OS(string name, string title, string simpleList, Cpu[] cpuList)
+ {
+ this.Name = name;
+ this.Title = title;
+ this.OSSimpleList = simpleList;
+ this.CpuList = cpuList;
+ }
+
+ public object Clone()
+ {
+ return this.MemberwiseClone();
+ }
+ }
+
+ // Type of software
+ public enum Software
+ {
+ vpnserver,
+ vpnbridge,
+ vpnclient,
+ vpnserver_vpnbridge,
+ }
+
+ // Class to build the software
+ public class BuildSoftware
+ {
+ public Software Software; // Software
+ public int Version; // Version number
+ public int BuildNumber; // Build Number
+ public string BuildName; // Build name
+ public Cpu Cpu; // CPU
+ public OS Os; // OS
+ public DateTime BuildDate; // Build date
+
+ public BuildSoftware(Software software, int buildNumber, int version, string buildName, Cpu cpu, OS os)
+ {
+ this.Software = software;
+ this.BuildNumber = buildNumber;
+ this.Version = version;
+ this.BuildName = buildName;
+ this.Cpu = cpu;
+ this.Os = os;
+ }
+
+ public void SetBuildNumberVersionName(int buildNumber, int version, string buildName, DateTime date)
+ {
+ this.BuildNumber = buildNumber;
+ this.Version = version;
+ this.BuildName = buildName;
+ this.BuildDate = date;
+ }
+
+ public BuildSoftware(string filename)
+ {
+ filename = Path.GetFileName(filename);
+
+ if (filename.StartsWith(Paths.Prefix, StringComparison.InvariantCultureIgnoreCase))
+ {
+ filename = filename.Substring(Paths.Prefix.Length);
+ }
+
+ if (filename.EndsWith(".tar.gz", StringComparison.InvariantCultureIgnoreCase))
+ {
+ filename = Str.ReplaceStr(filename, ".tar.gz", "");
+ }
+ else
+ {
+ filename = Path.GetFileNameWithoutExtension(filename);
+ }
+ char[] sps = {'-'};
+
+ string[] tokens = filename.Split(sps, StringSplitOptions.RemoveEmptyEntries);
+ if (tokens.Length != 8)
+ {
+ throw new ApplicationException(filename);
+ }
+
+ if (tokens[1].StartsWith("v", StringComparison.InvariantCultureIgnoreCase) == false)
+ {
+ throw new ApplicationException(filename);
+ }
+
+ this.Software = (Software)Enum.Parse(typeof(Software), tokens[0], true);
+ this.Version = (int)(double.Parse(tokens[1].Substring(1)) * 100);
+ this.BuildNumber = int.Parse(tokens[2]);
+ this.BuildName = tokens[3];
+
+ string[] ds = tokens[4].Split('.');
+ this.BuildDate = new DateTime(int.Parse(ds[0]), int.Parse(ds[1]), int.Parse(ds[2]));
+ this.Os = OSList.FindByName(tokens[5]);
+ this.Cpu = CpuList.FindByName(tokens[6]);
+ }
+
+ // Generate a string of file name equivalent
+ public virtual string FileNameBaseString
+ {
+ get
+ {
+ return string.Format("{0}-v{6}-{1}-{2}-{8:D4}.{9:D2}.{10:D2}-{4}-{3}-{7}",
+ Paths.Prefix + this.Software.ToString(),
+ this.BuildNumber,
+ this.BuildName,
+ this.Cpu.Name,
+ this.Os.Name,
+ 0,
+ BuildHelper.VersionIntToString(this.Version),
+ CPUBitsUtil.CPUBitsToString(this.Cpu.Bits),
+ BuildDate.Year, BuildDate.Month, BuildDate.Day).ToLower();
+ }
+ }
+
+ // Generate an identifier
+ public virtual string IDString
+ {
+ get
+ {
+ return string.Format("{0}-{2}-{3}-{4}",
+ Paths.Prefix + this.Software.ToString(),
+ 0,
+ this.Os.Name,
+ this.Cpu.Name,
+ CPUBitsUtil.CPUBitsToString(this.Cpu.Bits));
+ }
+ }
+
+ // Generate a title string
+ public virtual string TitleString
+ {
+ get
+ {
+ return string.Format("{0} (Ver {2}, Build {1}, {3}) for {5}", BuildHelper.GetSoftwareTitle(this.Software),
+ this.BuildNumber, BuildHelper.VersionIntToString(this.Version), this.Cpu.Title, 0, this.Os.Title);
+ }
+ }
+
+ // Generate extension
+ public virtual string OutputFileExt
+ {
+ get
+ {
+ if (this.Os.IsWindows)
+ {
+ return ".exe";
+ }
+ else
+ {
+ return ".tar.gz";
+ }
+ }
+ }
+
+ // Generate the output file name
+ public virtual string OutputFileName
+ {
+ get
+ {
+ return this.FileNameBaseString + this.OutputFileExt;
+ }
+ }
+
+ // Run the build
+ public virtual void Build()
+ {
+ throw new NotSupportedException();
+ }
+ }
+}
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/Web References/HvSignService/Reference.cs b/src/BuildUtil/Web References/HvSignService/Reference.cs
new file mode 100644
index 00000000..80e6b8f1
--- /dev/null
+++ b/src/BuildUtil/Web References/HvSignService/Reference.cs
@@ -0,0 +1,282 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// このコードはツールによって生成されました。
+// ランタイム バージョン:2.0.50727.5466
+//
+// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
+// コードが再生成されるときに損失したりします。
+// </auto-generated>
+//------------------------------------------------------------------------------
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+//
+// このソース コードは Microsoft.VSDesigner、バージョン 2.0.50727.5466 によって自動生成されました。
+//
+#pragma warning disable 1591
+
+namespace BuildUtil.HvSignService {
+ using System.Diagnostics;
+ using System.Web.Services;
+ using System.ComponentModel;
+ using System.Web.Services.Protocols;
+ using System;
+ using System.Xml.Serialization;
+
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5420")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Web.Services.WebServiceBindingAttribute(Name="SignSoap", Namespace="http://hvsigncode/")]
+ public partial class Sign : System.Web.Services.Protocols.SoapHttpClientProtocol {
+
+ private System.Threading.SendOrPostCallback HelloWorldOperationCompleted;
+
+ private System.Threading.SendOrPostCallback ExecSignOperationCompleted;
+
+ private bool useDefaultCredentialsSetExplicitly;
+
+ /// <remarks/>
+ public Sign() {
+ this.Url = global::BuildUtil.Properties.Settings.Default.BuildUtilTmp_HvSignService_Sign;
+ if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
+ this.UseDefaultCredentials = true;
+ this.useDefaultCredentialsSetExplicitly = false;
+ }
+ else {
+ this.useDefaultCredentialsSetExplicitly = true;
+ }
+ }
+
+ public new string Url {
+ get {
+ return base.Url;
+ }
+ set {
+ if ((((this.IsLocalFileSystemWebService(base.Url) == true)
+ && (this.useDefaultCredentialsSetExplicitly == false))
+ && (this.IsLocalFileSystemWebService(value) == false))) {
+ base.UseDefaultCredentials = false;
+ }
+ base.Url = value;
+ }
+ }
+
+ public new bool UseDefaultCredentials {
+ get {
+ return base.UseDefaultCredentials;
+ }
+ set {
+ base.UseDefaultCredentials = value;
+ this.useDefaultCredentialsSetExplicitly = true;
+ }
+ }
+
+ /// <remarks/>
+ public event HelloWorldCompletedEventHandler HelloWorldCompleted;
+
+ /// <remarks/>
+ public event ExecSignCompletedEventHandler ExecSignCompleted;
+
+ /// <remarks/>
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://hvsigncode/HelloWorld", RequestNamespace="http://hvsigncode/", ResponseNamespace="http://hvsigncode/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public string HelloWorld() {
+ object[] results = this.Invoke("HelloWorld", new object[0]);
+ return ((string)(results[0]));
+ }
+
+ /// <remarks/>
+ public void HelloWorldAsync() {
+ this.HelloWorldAsync(null);
+ }
+
+ /// <remarks/>
+ public void HelloWorldAsync(object userState) {
+ if ((this.HelloWorldOperationCompleted == null)) {
+ this.HelloWorldOperationCompleted = new System.Threading.SendOrPostCallback(this.OnHelloWorldOperationCompleted);
+ }
+ this.InvokeAsync("HelloWorld", new object[0], this.HelloWorldOperationCompleted, userState);
+ }
+
+ private void OnHelloWorldOperationCompleted(object arg) {
+ if ((this.HelloWorldCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.HelloWorldCompleted(this, new HelloWorldCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
+ /// <remarks/>
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://hvsigncode/ExecSign", RequestNamespace="http://hvsigncode/", ResponseNamespace="http://hvsigncode/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public string ExecSign(string src_filename, bool driver_mode, string description, int cert_id) {
+ object[] results = this.Invoke("ExecSign", new object[] {
+ src_filename,
+ driver_mode,
+ description,
+ cert_id});
+ return ((string)(results[0]));
+ }
+
+ /// <remarks/>
+ public void ExecSignAsync(string src_filename, bool driver_mode, string description, int cert_id) {
+ this.ExecSignAsync(src_filename, driver_mode, description, cert_id, null);
+ }
+
+ /// <remarks/>
+ public void ExecSignAsync(string src_filename, bool driver_mode, string description, int cert_id, object userState) {
+ if ((this.ExecSignOperationCompleted == null)) {
+ this.ExecSignOperationCompleted = new System.Threading.SendOrPostCallback(this.OnExecSignOperationCompleted);
+ }
+ this.InvokeAsync("ExecSign", new object[] {
+ src_filename,
+ driver_mode,
+ description,
+ cert_id}, this.ExecSignOperationCompleted, userState);
+ }
+
+ private void OnExecSignOperationCompleted(object arg) {
+ if ((this.ExecSignCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.ExecSignCompleted(this, new ExecSignCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
+ /// <remarks/>
+ public new void CancelAsync(object userState) {
+ base.CancelAsync(userState);
+ }
+
+ private bool IsLocalFileSystemWebService(string url) {
+ if (((url == null)
+ || (url == string.Empty))) {
+ return false;
+ }
+ System.Uri wsUri = new System.Uri(url);
+ if (((wsUri.Port >= 1024)
+ && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5420")]
+ public delegate void HelloWorldCompletedEventHandler(object sender, HelloWorldCompletedEventArgs e);
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5420")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class HelloWorldCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal HelloWorldCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ /// <remarks/>
+ public string Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((string)(this.results[0]));
+ }
+ }
+ }
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5420")]
+ public delegate void ExecSignCompletedEventHandler(object sender, ExecSignCompletedEventArgs e);
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5420")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class ExecSignCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal ExecSignCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ /// <remarks/>
+ public string Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((string)(this.results[0]));
+ }
+ }
+ }
+}
+
+#pragma warning restore 1591
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/Web References/HvSignService/Sign.disco b/src/BuildUtil/Web References/HvSignService/Sign.disco
new file mode 100644
index 00000000..e5cb0c0b
--- /dev/null
+++ b/src/BuildUtil/Web References/HvSignService/Sign.disco
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
+ <contractRef ref="http://hvsigncode/Sign.asmx?wsdl" docRef="http://hvsigncode/Sign.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
+ <soap address="http://hvsigncode/Sign.asmx" xmlns:q1="http://hvsigncode/" binding="q1:SignSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
+ <soap address="http://hvsigncode/Sign.asmx" xmlns:q2="http://hvsigncode/" binding="q2:SignSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
+</discovery> \ No newline at end of file
diff --git a/src/BuildUtil/Web References/HvSignService/Sign.wsdl b/src/BuildUtil/Web References/HvSignService/Sign.wsdl
new file mode 100644
index 00000000..4a6f0777
--- /dev/null
+++ b/src/BuildUtil/Web References/HvSignService/Sign.wsdl
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://hvsigncode/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://hvsigncode/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified" targetNamespace="http://hvsigncode/">
+ <s:element name="HelloWorld">
+ <s:complexType />
+ </s:element>
+ <s:element name="HelloWorldResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="ExecSign">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="src_filename" type="s:string" />
+ <s:element minOccurs="1" maxOccurs="1" name="driver_mode" type="s:boolean" />
+ <s:element minOccurs="0" maxOccurs="1" name="description" type="s:string" />
+ <s:element minOccurs="1" maxOccurs="1" name="cert_id" type="s:int" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="ExecSignResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="ExecSignResult" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="HelloWorldSoapIn">
+ <wsdl:part name="parameters" element="tns:HelloWorld" />
+ </wsdl:message>
+ <wsdl:message name="HelloWorldSoapOut">
+ <wsdl:part name="parameters" element="tns:HelloWorldResponse" />
+ </wsdl:message>
+ <wsdl:message name="ExecSignSoapIn">
+ <wsdl:part name="parameters" element="tns:ExecSign" />
+ </wsdl:message>
+ <wsdl:message name="ExecSignSoapOut">
+ <wsdl:part name="parameters" element="tns:ExecSignResponse" />
+ </wsdl:message>
+ <wsdl:portType name="SignSoap">
+ <wsdl:operation name="HelloWorld">
+ <wsdl:input message="tns:HelloWorldSoapIn" />
+ <wsdl:output message="tns:HelloWorldSoapOut" />
+ </wsdl:operation>
+ <wsdl:operation name="ExecSign">
+ <wsdl:input message="tns:ExecSignSoapIn" />
+ <wsdl:output message="tns:ExecSignSoapOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SignSoap" type="tns:SignSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="HelloWorld">
+ <soap:operation soapAction="http://hvsigncode/HelloWorld" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="ExecSign">
+ <soap:operation soapAction="http://hvsigncode/ExecSign" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SignSoap12" type="tns:SignSoap">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="HelloWorld">
+ <soap12:operation soapAction="http://hvsigncode/HelloWorld" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="ExecSign">
+ <soap12:operation soapAction="http://hvsigncode/ExecSign" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Sign">
+ <wsdl:port name="SignSoap" binding="tns:SignSoap">
+ <soap:address location="http://hvsigncode/Sign.asmx" />
+ </wsdl:port>
+ <wsdl:port name="SignSoap12" binding="tns:SignSoap12">
+ <soap12:address location="http://hvsigncode/Sign.asmx" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions> \ No newline at end of file
diff --git a/src/BuildUtil/Web References/SignService/Reference.cs b/src/BuildUtil/Web References/SignService/Reference.cs
new file mode 100644
index 00000000..6ad8706a
--- /dev/null
+++ b/src/BuildUtil/Web References/SignService/Reference.cs
@@ -0,0 +1,281 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// このコードはツールによって生成されました。
+// ランタイム バージョン:2.0.50727.4927
+//
+// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
+// コードが再生成されるときに損失したりします。
+// </auto-generated>
+//------------------------------------------------------------------------------
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+//
+// このソース コードは Microsoft.VSDesigner、バージョン 2.0.50727.4927 によって自動生成されました。
+//
+#pragma warning disable 1591
+
+namespace BuildUtil.SignService {
+ using System.Diagnostics;
+ using System.Web.Services;
+ using System.ComponentModel;
+ using System.Web.Services.Protocols;
+ using System;
+ using System.Xml.Serialization;
+
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ [System.Web.Services.WebServiceBindingAttribute(Name="SignSoap", Namespace="http://dv/Sign/")]
+ public partial class Sign : System.Web.Services.Protocols.SoapHttpClientProtocol {
+
+ private System.Threading.SendOrPostCallback HelloWorldOperationCompleted;
+
+ private System.Threading.SendOrPostCallback DoSignOperationCompleted;
+
+ private bool useDefaultCredentialsSetExplicitly;
+
+ /// <remarks/>
+ public Sign() {
+ this.Url = global::BuildUtil.Properties.Settings.Default.BuildUtil_SignService_Sign;
+ if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
+ this.UseDefaultCredentials = true;
+ this.useDefaultCredentialsSetExplicitly = false;
+ }
+ else {
+ this.useDefaultCredentialsSetExplicitly = true;
+ }
+ }
+
+ public new string Url {
+ get {
+ return base.Url;
+ }
+ set {
+ if ((((this.IsLocalFileSystemWebService(base.Url) == true)
+ && (this.useDefaultCredentialsSetExplicitly == false))
+ && (this.IsLocalFileSystemWebService(value) == false))) {
+ base.UseDefaultCredentials = false;
+ }
+ base.Url = value;
+ }
+ }
+
+ public new bool UseDefaultCredentials {
+ get {
+ return base.UseDefaultCredentials;
+ }
+ set {
+ base.UseDefaultCredentials = value;
+ this.useDefaultCredentialsSetExplicitly = true;
+ }
+ }
+
+ /// <remarks/>
+ public event HelloWorldCompletedEventHandler HelloWorldCompleted;
+
+ /// <remarks/>
+ public event DoSignCompletedEventHandler DoSignCompleted;
+
+ /// <remarks/>
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://dv/Sign/HelloWorld", RequestNamespace="http://dv/Sign/", ResponseNamespace="http://dv/Sign/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public string HelloWorld() {
+ object[] results = this.Invoke("HelloWorld", new object[0]);
+ return ((string)(results[0]));
+ }
+
+ /// <remarks/>
+ public void HelloWorldAsync() {
+ this.HelloWorldAsync(null);
+ }
+
+ /// <remarks/>
+ public void HelloWorldAsync(object userState) {
+ if ((this.HelloWorldOperationCompleted == null)) {
+ this.HelloWorldOperationCompleted = new System.Threading.SendOrPostCallback(this.OnHelloWorldOperationCompleted);
+ }
+ this.InvokeAsync("HelloWorld", new object[0], this.HelloWorldOperationCompleted, userState);
+ }
+
+ private void OnHelloWorldOperationCompleted(object arg) {
+ if ((this.HelloWorldCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.HelloWorldCompleted(this, new HelloWorldCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
+ /// <remarks/>
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://dv/Sign/DoSign", RequestNamespace="http://dv/Sign/", ResponseNamespace="http://dv/Sign/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ [return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
+ public byte[] DoSign([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] srcData, bool driverMode, string description) {
+ object[] results = this.Invoke("DoSign", new object[] {
+ srcData,
+ driverMode,
+ description});
+ return ((byte[])(results[0]));
+ }
+
+ /// <remarks/>
+ public void DoSignAsync(byte[] srcData, bool driverMode, string description) {
+ this.DoSignAsync(srcData, driverMode, description, null);
+ }
+
+ /// <remarks/>
+ public void DoSignAsync(byte[] srcData, bool driverMode, string description, object userState) {
+ if ((this.DoSignOperationCompleted == null)) {
+ this.DoSignOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDoSignOperationCompleted);
+ }
+ this.InvokeAsync("DoSign", new object[] {
+ srcData,
+ driverMode,
+ description}, this.DoSignOperationCompleted, userState);
+ }
+
+ private void OnDoSignOperationCompleted(object arg) {
+ if ((this.DoSignCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.DoSignCompleted(this, new DoSignCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
+ /// <remarks/>
+ public new void CancelAsync(object userState) {
+ base.CancelAsync(userState);
+ }
+
+ private bool IsLocalFileSystemWebService(string url) {
+ if (((url == null)
+ || (url == string.Empty))) {
+ return false;
+ }
+ System.Uri wsUri = new System.Uri(url);
+ if (((wsUri.Port >= 1024)
+ && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
+ public delegate void HelloWorldCompletedEventHandler(object sender, HelloWorldCompletedEventArgs e);
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class HelloWorldCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal HelloWorldCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ /// <remarks/>
+ public string Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((string)(this.results[0]));
+ }
+ }
+ }
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
+ public delegate void DoSignCompletedEventHandler(object sender, DoSignCompletedEventArgs e);
+
+ /// <remarks/>
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class DoSignCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal DoSignCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ /// <remarks/>
+ public byte[] Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((byte[])(this.results[0]));
+ }
+ }
+ }
+}
+
+#pragma warning restore 1591
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/Web References/SignService/Sign.disco b/src/BuildUtil/Web References/SignService/Sign.disco
new file mode 100644
index 00000000..2fe47490
--- /dev/null
+++ b/src/BuildUtil/Web References/SignService/Sign.disco
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
+ <contractRef ref="http://dv/Sign/Sign.asmx?wsdl" docRef="http://dv/Sign/Sign.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
+ <soap address="http://dv/Sign/Sign.asmx" xmlns:q1="http://dv/Sign/" binding="q1:SignSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
+ <soap address="http://dv/Sign/Sign.asmx" xmlns:q2="http://dv/Sign/" binding="q2:SignSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
+</discovery> \ No newline at end of file
diff --git a/src/BuildUtil/Web References/SignService/Sign.wsdl b/src/BuildUtil/Web References/SignService/Sign.wsdl
new file mode 100644
index 00000000..fdb6fb28
--- /dev/null
+++ b/src/BuildUtil/Web References/SignService/Sign.wsdl
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://dv/Sign/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://dv/Sign/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified" targetNamespace="http://dv/Sign/">
+ <s:element name="HelloWorld">
+ <s:complexType />
+ </s:element>
+ <s:element name="HelloWorldResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="DoSign">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="srcData" type="s:base64Binary" />
+ <s:element minOccurs="1" maxOccurs="1" name="driverMode" type="s:boolean" />
+ <s:element minOccurs="0" maxOccurs="1" name="description" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="DoSignResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="DoSignResult" type="s:base64Binary" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="HelloWorldSoapIn">
+ <wsdl:part name="parameters" element="tns:HelloWorld" />
+ </wsdl:message>
+ <wsdl:message name="HelloWorldSoapOut">
+ <wsdl:part name="parameters" element="tns:HelloWorldResponse" />
+ </wsdl:message>
+ <wsdl:message name="DoSignSoapIn">
+ <wsdl:part name="parameters" element="tns:DoSign" />
+ </wsdl:message>
+ <wsdl:message name="DoSignSoapOut">
+ <wsdl:part name="parameters" element="tns:DoSignResponse" />
+ </wsdl:message>
+ <wsdl:portType name="SignSoap">
+ <wsdl:operation name="HelloWorld">
+ <wsdl:input message="tns:HelloWorldSoapIn" />
+ <wsdl:output message="tns:HelloWorldSoapOut" />
+ </wsdl:operation>
+ <wsdl:operation name="DoSign">
+ <wsdl:input message="tns:DoSignSoapIn" />
+ <wsdl:output message="tns:DoSignSoapOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SignSoap" type="tns:SignSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="HelloWorld">
+ <soap:operation soapAction="http://dv/Sign/HelloWorld" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="DoSign">
+ <soap:operation soapAction="http://dv/Sign/DoSign" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SignSoap12" type="tns:SignSoap">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="HelloWorld">
+ <soap12:operation soapAction="http://dv/Sign/HelloWorld" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="DoSign">
+ <soap12:operation soapAction="http://dv/Sign/DoSign" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Sign">
+ <wsdl:port name="SignSoap" binding="tns:SignSoap">
+ <soap:address location="http://dv/Sign/Sign.asmx" />
+ </wsdl:port>
+ <wsdl:port name="SignSoap12" binding="tns:SignSoap12">
+ <soap12:address location="http://dv/Sign/Sign.asmx" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions> \ No newline at end of file
diff --git a/src/BuildUtil/Win32BuildSoftware.cs b/src/BuildUtil/Win32BuildSoftware.cs
new file mode 100644
index 00000000..8991da55
--- /dev/null
+++ b/src/BuildUtil/Win32BuildSoftware.cs
@@ -0,0 +1,160 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ // Build Win32 software
+ public class BuildSoftwareWin32 : BuildSoftware
+ {
+ public BuildSoftwareWin32(Software software, int buildNumber, int version, string buildName, Cpu cpu, OS os)
+ : base(software, buildNumber, version, buildName, cpu, os)
+ {
+ }
+
+ // Run the build
+ public override void Build()
+ {
+ Semaphore sem = new Semaphore(BuildConfig.NumMultipleCompileTasks, BuildConfig.NumMultipleCompileTasks, "vpn_build_cross");
+ Con.WriteLine("Waiting for Semaphore...");
+ sem.WaitOne();
+ Con.WriteLine("Done.");
+ try
+ {
+ // Run the build
+ buildInstaller();
+ }
+ finally
+ {
+ sem.Release();
+ }
+ }
+
+ // Build the installer
+ void buildInstaller()
+ {
+ string outFileName = Path.Combine(Paths.ReleaseDir, this.OutputFileName);
+
+ string vpnsetup_exe = Path.Combine(Paths.BinDirName, "vpnsetup.exe");
+
+ try
+ {
+ File.Delete(outFileName);
+ }
+ catch
+ {
+ }
+
+ Win32BuildUtil.ExecCommand(vpnsetup_exe, string.Format("/SFXMODE:{1} /SFXOUT:\"{0}\"",
+ outFileName, Software.ToString()));
+
+ CodeSign.SignFile(outFileName, outFileName, "VPN Software", false);
+ }
+ }
+}
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/Win32BuildUtil.cs b/src/BuildUtil/Win32BuildUtil.cs
new file mode 100644
index 00000000..5f478966
--- /dev/null
+++ b/src/BuildUtil/Win32BuildUtil.cs
@@ -0,0 +1,1063 @@
+// SoftEther VPN Source Code
+// Build Utility
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// 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.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+using System;
+using System.Threading;
+using System.Text;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Security.Cryptography;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using CoreUtil;
+
+namespace BuildUtil
+{
+ // Build utility for Win32
+ public static class Win32BuildUtil
+ {
+ // Generate vpnweb.ocx
+ public static void GenerateVpnWebOcxCab(string dstFileName, string ocxFileName)
+ {
+ int build, version;
+ string name;
+ DateTime date;
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+
+ string cabVer = string.Format("{0},{1},0,{2}", version / 100, version % 100, build);
+ string cabFileName = IO.CreateTempFileNameByExt(".cab");
+ Mutex m = new Mutex(false, "cabtmp_mutex");
+
+ m.WaitOne();
+
+ try
+ {
+ // Building the cab
+ string cabTmpDir = Path.Combine(Paths.TmpDirName, "cabtmp");
+
+ IO.MakeDir(cabTmpDir);
+ IO.DeleteFilesAndSubDirsInDir(cabTmpDir);
+
+ File.Copy(Path.Combine(Paths.BinDirName, ocxFileName), Path.Combine(cabTmpDir, "vpnweb.ocx"));
+
+ string infText = File.ReadAllText(Path.Combine(Path.Combine(Paths.BaseDirName, @"BuildFiles\OcxCabInf"), "vpnweb.inf"));
+ infText = Str.ReplaceStr(infText, "$CAB_VERSION$", cabVer);
+ File.WriteAllText(Path.Combine(cabTmpDir, "vpnweb.inf"), infText);
+
+ Win32BuildUtil.ExecCommand(Path.Combine(Paths.BaseDirName, @"BuildFiles\Utility\cabarc.exe"),
+ string.Format(@"-s 6144 n {0}\vpnweb.cab {0}\vpnweb.ocx {0}\vpnweb.inf", cabTmpDir));
+
+ File.Copy(Path.Combine(cabTmpDir, "vpnweb.cab"), cabFileName, true);
+ }
+ finally
+ {
+ m.ReleaseMutex();
+ }
+
+ CodeSign.SignFile(cabFileName, cabFileName, "VPN Software", false);
+
+ File.Copy(cabFileName, dstFileName, true);
+ }
+
+ // Generate a version information resource
+ public static void GenerateVersionInfoResource(string targetExeName, string outName, string rc_name)
+ {
+ int build, version;
+ string name;
+ DateTime date;
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+
+ if (Str.IsEmptyStr(rc_name))
+ {
+ rc_name = "ver.rc";
+ }
+
+ string templateFileName = Path.Combine(Paths.BaseDirName, @"BuildFiles\VerScript\" + rc_name);
+ string body = Str.ReadTextFile(templateFileName);
+
+ string exeFileName = Path.GetFileName(targetExeName);
+ string internalName = Path.GetFileNameWithoutExtension(exeFileName);
+
+#if !BU_SOFTETHER
+ body = Str.ReplaceStr(body, "$PRODUCTNAME$", "PacketiX VPN");
+#else
+ body = Str.ReplaceStr(body, "$PRODUCTNAME$", "SoftEther VPN");
+#endif
+ body = Str.ReplaceStr(body, "$INTERNALNAME$", internalName);
+ body = Str.ReplaceStr(body, "$YEAR$", date.Year.ToString());
+ body = Str.ReplaceStr(body, "$FILENAME$", exeFileName);
+ body = Str.ReplaceStr(body, "$VER_MAJOR$", (version / 100).ToString());
+ body = Str.ReplaceStr(body, "$VER_MINOR$", (version % 100).ToString());
+ body = Str.ReplaceStr(body, "$VER_BUILD$", build.ToString());
+
+ IO f = IO.CreateTempFileByExt(".rc");
+ string filename = f.Name;
+
+ f.Write(Str.AsciiEncoding.GetBytes(body));
+
+ f.Close();
+
+ ExecCommand(Paths.RcFilename, "\"" + filename + "\"");
+
+ string rcDir = Path.GetDirectoryName(filename);
+ string rcFilename = Path.GetFileName(filename);
+ string rcFilename2 = Path.GetFileNameWithoutExtension(rcFilename);
+
+ string resFilename = Path.Combine(rcDir, rcFilename2) + ".res";
+
+ IO.MakeDirIfNotExists(Path.GetDirectoryName(outName));
+
+ IO.FileCopy(resFilename, outName, true, false);
+ }
+
+ // Flush to disk
+ public static void Flush()
+ {
+ string txt = IO.CreateTempFileNameByExt(".txt");
+ byte[] ret = Secure.Rand(64);
+
+ FileStream f = File.Create(txt);
+
+ f.Write(ret, 0, ret.Length);
+
+ f.Flush();
+
+ f.Close();
+
+ File.Delete(txt);
+ }
+
+ // Increment the build number
+ public static void IncrementBuildNumber()
+ {
+ int build, version;
+ string name;
+ DateTime date;
+
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+ build++;
+
+ WriteBuildInfoToTextFile(build, version, name, date);
+
+ SetNowDate();
+
+ Con.WriteLine("New build number: {0}", build);
+ }
+
+ // Set the date and time
+ public static void SetNowDate()
+ {
+ int build, version;
+ string name;
+ DateTime date;
+
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+
+ date = DateTime.Now;
+
+ WriteBuildInfoToTextFile(build, version, name, date);
+ }
+
+ // Write the build number and the version number in the text file
+ public static void WriteBuildInfoToTextFile(int build, int version, string name, DateTime date)
+ {
+ string filename = Path.Combine(Paths.BaseDirName, "CurrentBuild.txt");
+
+ WriteBuildInfoToTextFile(build, version, name, date, filename);
+ }
+ public static void WriteBuildInfoToTextFile(int build, int version, string name, DateTime date, string filename)
+ {
+ using (StreamWriter w = new StreamWriter(filename))
+ {
+ w.WriteLine("BUILD_NUMBER {0}", build);
+ w.WriteLine("VERSION {0}", version);
+ w.WriteLine("BUILD_NAME {0}", name);
+ w.WriteLine("BUILD_DATE {0}", Str.DateTimeToStrShort(date));
+
+ w.Flush();
+ w.Close();
+ }
+ }
+
+ // Read the build number and the version number from a text file
+ public static void ReadBuildInfoFromTextFile(out int build, out int version, out string name, out DateTime date)
+ {
+ string filename = Path.Combine(Paths.BaseDirName, "CurrentBuild.txt");
+
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date, filename);
+ }
+ public static void ReadBuildInfoFromTextFile(out int build, out int version, out string name, out DateTime date, string filename)
+ {
+ char[] seps = { '\t', ' ', };
+ name = "";
+ date = new DateTime(0);
+
+ using (StreamReader r = new StreamReader(filename))
+ {
+ build = version = 0;
+
+ while (true)
+ {
+ string line = r.ReadLine();
+ if (line == null)
+ {
+ break;
+ }
+
+ string[] tokens = line.Split(seps, StringSplitOptions.RemoveEmptyEntries);
+ if (tokens.Length == 2)
+ {
+ if (tokens[0].Equals("BUILD_NUMBER", StringComparison.InvariantCultureIgnoreCase))
+ {
+ build = int.Parse(tokens[1]);
+ }
+
+ if (tokens[0].Equals("VERSION", StringComparison.InvariantCultureIgnoreCase))
+ {
+ version = int.Parse(tokens[1]);
+ }
+
+ if (tokens[0].Equals("BUILD_NAME", StringComparison.InvariantCultureIgnoreCase))
+ {
+ name = tokens[1];
+
+ name = Str.ReplaceStr(name, "-", "_");
+ }
+
+ if (tokens[0].Equals("BUILD_DATE", StringComparison.InvariantCultureIgnoreCase))
+ {
+ date = Str.StrToDateTime(tokens[1]);
+ }
+ }
+ }
+
+ r.Close();
+
+ if (build == 0 || version == 0 || Str.IsEmptyStr(name) || date.Ticks == 0)
+ {
+ throw new ApplicationException(string.Format("Wrong file data: '{0}'", filename));
+ }
+ }
+ }
+
+ // Normalize the build information
+ public static void NormalizeBuildInfo()
+ {
+ SetNowDate();
+
+ int build, version;
+ string name;
+ DateTime date;
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+ string username = Env.UserName;
+ string pcname = Env.MachineName;
+
+ NormalizeSourceCode(build, version, username, pcname, date);
+ }
+
+ // Apply build number, version number, user name, and PC name to the source code
+ public static void NormalizeSourceCode(int buildNumber, int version, string userName, string pcName, DateTime date)
+ {
+ DateTime now = date;
+ char[] seps = { '\t', ' ', };
+
+ int i = pcName.IndexOf(".");
+ if (i != -1)
+ {
+ pcName = pcName.Substring(0, i);
+ }
+
+ userName = userName.ToLower();
+ pcName = pcName.ToLower();
+
+ string[] files = Util.CombineArray<string>(
+ Directory.GetFiles(Paths.BaseDirName, "*.h", SearchOption.AllDirectories));
+
+ foreach (string file in files)
+ {
+ string dir = Path.GetDirectoryName(file);
+ if (Str.InStr(dir, @"\.svn\") == false &&
+ Str.InStr(IO.GetRelativeFileName(file, Paths.BaseDirName), @"tmp\") == false)
+ {
+ byte[] srcData = File.ReadAllBytes(file);
+
+ int bomSize;
+ Encoding enc = Str.GetEncoding(srcData, out bomSize);
+ if (enc == null)
+ {
+ enc = Str.Utf8Encoding;
+ }
+ StringReader r = new StringReader(enc.GetString(Util.ExtractByteArray(srcData, bomSize, srcData.Length - bomSize)));
+ StringWriter w = new StringWriter();
+ bool somethingChanged = false;
+
+ while (true)
+ {
+ string line = r.ReadLine();
+ if (line == null)
+ {
+ break;
+ }
+ string newLine = null;
+
+ string[] tokens = line.Split(seps, StringSplitOptions.RemoveEmptyEntries);
+
+ if (tokens.Length >= 1)
+ {
+ if (file.EndsWith(".h", StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (tokens.Length == 3)
+ {
+ // Build number portion of the source code
+ if (tokens[0].Equals("//") && tokens[1].Equals("Build") && Str.IsNumber(tokens[2]))
+ {
+ newLine = line.Replace(tokens[2], buildNumber.ToString());
+ }
+ }
+ }
+
+ if (file.EndsWith(".h", StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (tokens.Length == 3)
+ {
+ // String part of the version information of Cedar.h
+ if (tokens[0].Equals("#define") && tokens[1].Equals("CEDAR_BUILD"))
+ {
+ newLine = line.Replace(tokens[2], buildNumber.ToString());
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("CEDAR_VER"))
+ {
+ newLine = line.Replace(tokens[2], version.ToString());
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILDER_NAME"))
+ {
+ newLine = line.Replace(tokens[2], "\"" + userName + "\"");
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILD_PLACE"))
+ {
+ newLine = line.Replace(tokens[2], "\"" + pcName + "\"");
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILD_DATE_Y"))
+ {
+ newLine = line.Replace(tokens[2], date.Year.ToString());
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILD_DATE_M"))
+ {
+ newLine = line.Replace(tokens[2], date.Month.ToString());
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILD_DATE_D"))
+ {
+ newLine = line.Replace(tokens[2], date.Day.ToString());
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILD_DATE_HO"))
+ {
+ newLine = line.Replace(tokens[2], date.Hour.ToString());
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILD_DATE_MI"))
+ {
+ newLine = line.Replace(tokens[2], date.Minute.ToString());
+ }
+
+ if (tokens[0].Equals("#define") && tokens[1].Equals("BUILD_DATE_SE"))
+ {
+ newLine = line.Replace(tokens[2], date.Second.ToString());
+ }
+ }
+
+ if (tokens.Length >= 3)
+ {
+ if (tokens[0].Equals("#define") && tokens[1].Equals("SUPPORTED_WINDOWS_LIST"))
+ {
+ newLine = "#define\tSUPPORTED_WINDOWS_LIST\t\t\"" + OSList.Windows.OSSimpleList + "\"";
+ }
+ }
+ }
+ }
+
+ if (newLine == null || newLine == line)
+ {
+ w.WriteLine(line);
+ }
+ else
+ {
+ w.WriteLine(newLine);
+
+ somethingChanged = true;
+ }
+ }
+
+ if (somethingChanged)
+ {
+ byte[] retData = Str.ConvertEncoding(Str.Utf8Encoding.GetBytes(w.ToString()), enc, bomSize != 0);
+
+ File.WriteAllBytes(file, retData);
+
+ Con.WriteLine("Modified: '{0}'.", file);
+ }
+ }
+ }
+ }
+
+ // Get the DebugSnapshot directory name
+ public static string GetDebugSnapstotDirName()
+ {
+ return Path.Combine(Paths.DebugSnapshotBaseDir, Str.DateTimeToStrShort(BuildSoftwareList.ListCreatedDateTime));
+ }
+
+ // Copy DebugSnapshot
+ public static void CopyDebugSnapshot()
+ {
+ string snapDir = GetDebugSnapstotDirName();
+
+ CopyDebugSnapshot(snapDir);
+ }
+ public static void CopyDebugSnapshot(string snapDir, params string[] exclude_exts)
+ {
+ IO.CopyDir(Paths.BaseDirName, Path.Combine(snapDir, "Main"),
+ delegate(FileInfo fi)
+ {
+ string srcPath = fi.FullName;
+ string[] exts_default =
+ {
+ ".ncb", ".aps", ".suo", ".old", ".scc", ".vssscc", ".vspscc", ".cache", ".psess", ".tmp", ".dmp",
+ };
+
+ List<string> exts = new List<string>();
+
+ foreach (string ext in exts_default)
+ {
+ exts.Add(ext);
+ }
+
+ foreach (string ext in exclude_exts)
+ {
+ exts.Add(ext);
+ }
+
+ if (Str.InStr(srcPath, @"\.svn\", false))
+ {
+ return false;
+ }
+
+ if (Str.InStr(srcPath.Substring(3), @"\tmp\", false))
+ {
+ return false;
+ }
+
+ if (Str.InStr(srcPath, @"_log\", false))
+ {
+ return false;
+ }
+
+ if (Str.InStr(srcPath, @"\backup.vpn_", false))
+ {
+ return false;
+ }
+
+ foreach (string ext in exts)
+ {
+ if (srcPath.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ }
+
+ if (Str.InStr(srcPath, @"\hamcore\", false))
+ {
+ return true;
+ }
+
+ if (Str.InStr(srcPath, @"\hamcore_", false))
+ {
+ return true;
+ }
+
+ return true;
+ },
+ false, true, false, false);
+ }
+
+ // Execute building in Visual Studio
+ public static void BuildMain()
+ {
+ Mutex x = new Mutex(false, "VpnBuilderWin32_BuildMain");
+
+ x.WaitOne();
+
+ try
+ {
+ // Generate the contents of the batch file
+ string batFileName = Path.Combine(Paths.TmpDirName, "vc_build.cmd");
+ StreamWriter bat = new StreamWriter(batFileName, false, Str.ShiftJisEncoding);
+ bat.WriteLine("call \"{0}\"", Paths.VisualStudioVCBatchFileName);
+ bat.WriteLine("echo on");
+ bat.WriteLine("\"{0}\" /toolsversion:3.5 /verbosity:detailed /target:Clean /property:Configuration=Release /property:Platform=Win32 \"{1}\"",
+ Paths.MSBuildFileName, Paths.VPN4SolutionFileName);
+ bat.WriteLine("IF ERRORLEVEL 1 GOTO LABEL_ERROR");
+
+ bat.WriteLine("\"{0}\" /toolsversion:3.5 /verbosity:detailed /target:Clean /property:Configuration=Release /property:Platform=x64 \"{1}\"",
+ Paths.MSBuildFileName, Paths.VPN4SolutionFileName);
+ bat.WriteLine("IF ERRORLEVEL 1 GOTO LABEL_ERROR");
+
+ bat.WriteLine("\"{0}\" /toolsversion:3.5 /verbosity:detailed /target:Rebuild /property:Configuration=Release /property:Platform=Win32 \"{1}\"",
+ Paths.MSBuildFileName, Paths.VPN4SolutionFileName);
+ bat.WriteLine("IF ERRORLEVEL 1 GOTO LABEL_ERROR");
+
+ bat.WriteLine("\"{0}\" /toolsversion:3.5 /verbosity:detailed /target:Rebuild /property:Configuration=Release /property:Platform=x64 \"{1}\"",
+ Paths.MSBuildFileName, Paths.VPN4SolutionFileName);
+ bat.WriteLine("IF ERRORLEVEL 1 GOTO LABEL_ERROR");
+
+ bat.WriteLine(":LABEL_ERROR");
+
+ bat.WriteLine("EXIT %ERRORLEVEL%");
+
+ bat.Close();
+
+ ExecCommand(Paths.CmdFileName, string.Format("/C \"{0}\"", batFileName));
+
+ BuildReplaceHeader();
+ }
+ finally
+ {
+ x.ReleaseMutex();
+ }
+ }
+
+ // Generate the Replace.h
+ public static void BuildReplaceHeader()
+ {
+ List<string> o = new List<string>();
+ int maxLen = 0;
+
+ // Read the map file
+ string[] lines = File.ReadAllLines(Path.Combine(Paths.BaseDirName, @"DebugFiles\map\Win32_Release\vpnserver.map"));
+ char[] sps = { ' ', '\t', };
+
+ foreach (string line in lines)
+ {
+ string[] tokens = line.Trim().Split(sps, StringSplitOptions.RemoveEmptyEntries);
+
+ if (tokens.Length == 5)
+ {
+ if (tokens[0].StartsWith("0001:", StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (tokens[0].Length == 13)
+ {
+ if (tokens[2].Length == 8)
+ {
+ if (tokens[3].Equals("f", StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (tokens[4].StartsWith("Mayaqua:", StringComparison.InvariantCultureIgnoreCase) ||
+ tokens[4].StartsWith("Cedar:", StringComparison.InvariantCultureIgnoreCase))
+ {
+ string name = tokens[1];
+
+ if (name.Length >= 2)
+ {
+ if (Str.InStr(name, "mktime") == false &&
+ Str.InStr(name, "gmtime") == false &&
+ Str.InStr(name, "stdin") == false &&
+ Str.InStr(name, "stdout") == false &&
+ Str.InStr(name, "@") == false &&
+ Str.InStr(name, "localtime") == false)
+ {
+ string tmp = tokens[4].Split(':')[1];
+
+ if (tmp[0] >= 'A' && tmp[0] <= 'Z' &&
+ Str.InStr(tmp, "_") == false)
+ {
+ o.Add(name.Substring(1));
+
+ maxLen = Math.Max(maxLen, name.Length);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ o.Sort();
+
+ // Generate the Replace.h
+ string filename = Path.Combine(Paths.BaseDirName, @"DebugFiles\Replace.h");
+ StreamWriter w = new StreamWriter(filename);
+
+ w.WriteLine("// PacketiX VPN Function Name Replacement Header File");
+ w.WriteLine("//");
+ w.WriteLine("// Copyright (c) SoftEther Corporation.");
+ w.WriteLine("// All Rights Reserved.");
+ w.WriteLine("//");
+ w.WriteLine("// SoftEther Confidential");
+ w.WriteLine("//");
+ w.WriteLine();
+
+ foreach (string name in o)
+ {
+ if (Str.StrCmpi(name, "VLanGetPacketAdapter") == false)
+ {
+ string tmp = Str.ByteToHex(Secure.HashMD5(Str.Utf8Encoding.GetBytes("xx" + name)), "");
+ string tmp2 = "VPN_" + tmp.Substring(0, 12).ToUpper();
+
+ w.WriteLine("#define {0,-" + maxLen.ToString() + "} {1}",
+ name, tmp2);
+ }
+ }
+
+ w.WriteLine();
+
+ w.Flush();
+ w.Close();
+ }
+
+ // Command execution
+ public static void ExecCommand(string exe, string arg)
+ {
+ ExecCommand(exe, arg, false);
+ }
+ public static void ExecCommand(string exe, string arg, bool shell_execute)
+ {
+ Process p = new Process();
+ p.StartInfo.FileName = exe;
+ p.StartInfo.Arguments = arg;
+ p.StartInfo.UseShellExecute = shell_execute;
+
+ if (shell_execute)
+ {
+ p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
+ }
+
+ Con.WriteLine("Executing '{0} {1}'...", exe, arg);
+
+ p.Start();
+
+ p.WaitForExit();
+
+ int ret = p.ExitCode;
+ if (ret != 0)
+ {
+ throw new ApplicationException(string.Format("Child process '{0}' returned error code {1}.", exe, ret));
+ }
+
+ Kernel.SleepThread(50);
+ }
+
+ // Get whether the specified fileis a target of signature
+ public static bool IsFileSignable(string fileName)
+ {
+ if (fileName.IndexOf(@".svn", StringComparison.InvariantCultureIgnoreCase) != -1 ||
+ fileName.StartsWith(".svn", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("vpn16.exe", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("BuildUtil.exe", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("BuildUtilTmp.exe", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("CoreUtil.dll", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("npptools.dll", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("winpcap_installer.exe", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("winpcap_installer_win9x.exe", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("VpnGatePlugin_x64.dll", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (fileName.EndsWith("VpnGatePlugin_x86.dll", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return false;
+ }
+ if (Str.InStr(fileName, "_nosign", false))
+ {
+ return false;
+ }
+
+ if (fileName.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase) ||
+ fileName.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) ||
+ fileName.EndsWith(".ocx", StringComparison.InvariantCultureIgnoreCase) ||
+ fileName.EndsWith(".sys", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ // Create and sign the Inf file and the catalog file for SeLow
+ public static void SignSeLowInfFiles(string cpu)
+ {
+ int build, version;
+ string name;
+ DateTime date;
+
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+
+ string hamcore = Path.Combine(Paths.BinDirName, "hamcore");
+ string sys_src = Path.Combine(hamcore, "SeLow_" + cpu + ".sys");
+ string inf_src = Path.Combine(hamcore, "SeLow_" + cpu + ".inf");
+
+ Con.WriteLine("Generating INF Files for SeLow...");
+
+ string dst_dir = Path.Combine(hamcore, @"inf\selow_" + cpu);
+
+ if (ExeSignChecker.CheckFileDigitalSignature(sys_src) == false ||
+ ExeSignChecker.IsKernelModeSignedFile(sys_src) == false)
+ {
+ throw new ApplicationException(sys_src + " is not signed.");
+ }
+
+ generateINFFilesForPlatform(inf_src, sys_src, null, dst_dir, version, build, date, true);
+
+ Con.WriteLine("Generating INF Files for SeLow Ok.");
+ }
+
+ // Create Inf file for Windows 8
+ public static void GenerateINFFilesForWindows8(string cpu)
+ {
+ int build, version;
+ string name;
+ DateTime date;
+ ReadBuildInfoFromTextFile(out build, out version, out name, out date);
+
+ string hamcore = Path.Combine(Paths.BinDirName, "hamcore");
+ string inf_src_x86 = Path.Combine(hamcore, "vpn_driver.inf");
+ string inf_src_x64 = Path.Combine(hamcore, "vpn_driver_x64.inf");
+ string sys_src_x86 = Path.Combine(hamcore, "vpn_driver.sys");
+ string sys_src_x64 = Path.Combine(hamcore, "vpn_driver_x64.sys");
+ string sys6_src_x86 = Path.Combine(hamcore, "vpn_driver6.sys");
+ string sys6_src_x64 = Path.Combine(hamcore, "vpn_driver6_x64.sys");
+
+ Con.WriteLine("Generating INF Files for Windows 8...");
+
+ string dst_x86 = Path.Combine(hamcore, @"inf\x86");
+ string dst_x64 = Path.Combine(hamcore, @"inf\x64");
+
+ if (Str.StrCmpi(cpu, "x64"))
+ {
+ if (ExeSignChecker.CheckFileDigitalSignature(sys_src_x64) == false || ExeSignChecker.IsKernelModeSignedFile(sys_src_x64) == false)
+ {
+ throw new ApplicationException(sys_src_x64 + " is not signed.");
+ }
+
+ generateINFFilesForPlatform(inf_src_x64, sys_src_x64, sys6_src_x64, dst_x64, version, build, date, false);
+ }
+ else
+ {
+ if (ExeSignChecker.CheckFileDigitalSignature(sys_src_x86) == false || ExeSignChecker.IsKernelModeSignedFile(sys_src_x86) == false)
+ {
+ throw new ApplicationException(sys_src_x86 + " is not signed.");
+ }
+
+ generateINFFilesForPlatform(inf_src_x86, sys_src_x86, sys6_src_x86, dst_x86, version, build, date, false);
+ }
+
+ Con.WriteLine("Generating INF Files for Windows 8 Ok.");
+ }
+ static void generateINFFilesForPlatform(string inf, string sys, string sys6, string dstDir, int ver, int build, DateTime date, bool selow)
+ {
+
+ string cdfFileName = Path.Combine(dstDir, "inf.cdf");
+ string catFileName = Path.Combine(dstDir, "inf.cat");
+ StringWriter sw = new StringWriter();
+
+ string txt = File.ReadAllText(inf, Str.ShiftJisEncoding);
+
+ IO.DeleteFilesAndSubDirsInDir(dstDir);
+ IO.MakeDirIfNotExists(dstDir);
+
+ string dst_sys_name = Path.Combine(dstDir, Path.GetFileName(sys));
+ File.Copy(sys, dst_sys_name, true);
+
+ string dst_sys6_name = null;
+ if (sys6 != null)
+ {
+ dst_sys6_name = Path.Combine(dstDir, Path.GetFileName(sys6));
+ File.Copy(sys6, dst_sys6_name, true);
+ }
+
+ sw.WriteLine("[CatalogHeader]");
+ sw.WriteLine("name=inf.cat");
+ sw.WriteLine();
+ sw.WriteLine("[CatalogFiles]");
+ sw.WriteLine("<hash>{0}={0}", Path.GetFileName(dst_sys_name));
+
+ if (sys6 != null)
+ {
+ sw.WriteLine("<hash>{0}={0}", Path.GetFileName(dst_sys6_name));
+ }
+
+ int i;
+ for (i = 1; i < 128; i++)
+ {
+ string name = "VPN";
+ if (i >= 2)
+ {
+ name += i.ToString();
+ }
+
+ if (selow)
+ {
+ name = "selow";
+ }
+
+ //string mac = "00AC0011" + i.ToString("X2") + "01";
+ string mac = "000001000001";
+ string sys_name = "Neo_" + name + ".sys";
+
+ string body = txt;
+ body = Str.ReplaceStr(body, "$TAG_SYS_NAME$", sys_name);
+ body = Str.ReplaceStr(body, "$TAG_INSTANCE_NAME$", name);
+ body = Str.ReplaceStr(body, "$TAG_MAC_ADDRESS$", mac);
+ body = Str.ReplaceStr(body, "$YEAR$", date.Year.ToString("D4"));
+ body = Str.ReplaceStr(body, "$MONTH$", date.Month.ToString("D2"));
+ body = Str.ReplaceStr(body, "$DAY$", date.Day.ToString("D2"));
+ body = Str.ReplaceStr(body, "$VER_MAJOR$", (ver / 100).ToString());
+ body = Str.ReplaceStr(body, "$VER_MINOR$", (ver % 100).ToString());
+ body = Str.ReplaceStr(body, "$VER_BUILD$", build.ToString());
+ body = Str.ReplaceStr(body, "[Manufacturer]", "CatalogFile.NT\t\t\t\t= inf_" + name + ".cat\r\n\r\n[Manufacturer]");
+
+ string dst_inf_name = Path.Combine(dstDir, "INF_" + name + ".inf");
+
+ if (selow)
+ {
+ dst_inf_name = Path.Combine(dstDir, Path.GetFileName(inf));
+ }
+
+ if (selow)
+ {
+ body += "\r\n; Auto Generated " + Str.DateTimeToStrShortWithMilliSecs(DateTime.Now) + "\r\n\r\n";
+ }
+
+ File.WriteAllText(dst_inf_name, body, Str.ShiftJisEncoding);
+
+ sw.WriteLine("<hash>{0}={0}", Path.GetFileName(dst_inf_name));
+
+ if (selow)
+ {
+ break;
+ }
+ }
+ sw.WriteLine();
+
+ File.WriteAllText(cdfFileName, sw.ToString());
+
+ // generate catalog file
+ Directory.SetCurrentDirectory(dstDir);
+ ExecCommand(Paths.MakeCatFilename, string.Format("\"{0}\"", cdfFileName));
+
+ // sign catalog file
+ CodeSign.SignFile(catFileName, catFileName, "Catalog File", false);
+
+ // delete cdf file
+ File.Delete(cdfFileName);
+
+ // delete sys file
+ File.Delete(dst_sys_name);
+
+ if (sys6 != null)
+ {
+ File.Delete(dst_sys6_name);
+ }
+ }
+
+ // Sign for all binary files (series mode)
+ public static void SignAllBinaryFilesSerial()
+ {
+ string[] files = Directory.GetFiles(Paths.BinDirName, "*", SearchOption.AllDirectories);
+
+ foreach (string file in files)
+ {
+ if (IsFileSignable(file))
+ {
+ bool isDriver = file.EndsWith(".sys", StringComparison.InvariantCultureIgnoreCase);
+
+ // Check whether this file is signed
+ bool isSigned = ExeSignChecker.CheckFileDigitalSignature(file);
+ if (isSigned && isDriver)
+ {
+ isSigned = ExeSignChecker.IsKernelModeSignedFile(file);
+ }
+
+ Con.WriteLine("The file '{0}': {1}.", file, isSigned ? "Already signed" : "Not yet signed");
+
+ if (isSigned == false)
+ {
+ Con.WriteLine("Signing...");
+
+ CodeSign.SignFile(file, file, "VPN Software", isDriver);
+ }
+ }
+ }
+ }
+
+ // Sign for all binary files (parallel mode)
+ public static void SignAllBinaryFiles()
+ {
+ string[] files = Directory.GetFiles(Paths.BinDirName, "*", SearchOption.AllDirectories);
+
+ List<string> filename_list = new List<string>();
+
+ foreach (string file in files)
+ {
+ if (IsFileSignable(file))
+ {
+ bool isDriver = file.EndsWith(".sys", StringComparison.InvariantCultureIgnoreCase);
+
+ // Check whether this file is signed
+ bool isSigned = ExeSignChecker.CheckFileDigitalSignature(file);
+ if (isSigned && isDriver)
+ {
+ isSigned = ExeSignChecker.IsKernelModeSignedFile(file);
+ }
+
+ Con.WriteLine("The file '{0}': {1}.", file, isSigned ? "Already signed" : "Not yet signed");
+
+ if (isSigned == false)
+ {
+ filename_list.Add(file);
+ }
+ }
+ }
+
+ Con.WriteLine("Start ProcessWorkQueue for Signing...\n");
+ ThreadObj.ProcessWorkQueue(sign_thread, 40, filename_list.ToArray());
+ Con.WriteLine("ProcessWorkQueue for Signing completed.\n");
+ }
+
+ // Binary file signature thread
+ static void sign_thread(object param)
+ {
+ string filename = (string)param;
+ bool isDriver = filename.EndsWith(".sys", StringComparison.InvariantCultureIgnoreCase);
+
+ Con.WriteLine("Signing...");
+
+ CodeSign.SignFile(filename, filename, "VPN Software", isDriver);
+ }
+ }
+}
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/BuildUtil/app.config b/src/BuildUtil/app.config
new file mode 100644
index 00000000..39279829
--- /dev/null
+++ b/src/BuildUtil/app.config
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+ <section name="BuildUtil.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </sectionGroup>
+ </configSections>
+ <applicationSettings>
+ <BuildUtil.Properties.Settings>
+ <setting name="BuildUtil_SignService_Sign" serializeAs="String">
+ <value>http://dv/Sign/Sign.asmx</value>
+ </setting>
+ <setting name="BuildUtilTmp_HvSignService_Sign" serializeAs="String">
+ <value>http://hvsigncode/Sign.asmx</value>
+ </setting>
+ </BuildUtil.Properties.Settings>
+ </applicationSettings>
+</configuration> \ No newline at end of file