Browse Source

initial commit

Kolja Strohm 6 years ago
commit
6f5c264de7
13 changed files with 1222 additions and 0 deletions
  1. 63 0
      .gitattributes
  2. 263 0
      .gitignore
  3. 28 0
      Start.sln
  4. BIN
      Start/Framework.dll
  5. 18 0
      Start/Keys.cpp
  6. 43 0
      Start/Keys.h
  7. BIN
      Start/Network.dll
  8. 197 0
      Start/Netzwerk.cpp
  9. 32 0
      Start/Netzwerk.h
  10. 184 0
      Start/Start.vcxproj
  11. 36 0
      Start/Start.vcxproj.filters
  12. 355 0
      Start/start.cpp
  13. 3 0
      build.bat

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 263 - 0
.gitignore

@@ -0,0 +1,263 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+Start/data
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc

+ 28 - 0
Start.sln

@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.22823.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Start", "Start\Start.vcxproj", "{7612A0F9-B370-4505-8A72-1FE64FBC793D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Debug|Win32.Build.0 = Debug|Win32
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Debug|x64.ActiveCfg = Debug|x64
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Debug|x64.Build.0 = Debug|x64
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Release|Win32.ActiveCfg = Release|Win32
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Release|Win32.Build.0 = Release|Win32
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Release|x64.ActiveCfg = Release|x64
+		{7612A0F9-B370-4505-8A72-1FE64FBC793D}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

BIN
Start/Framework.dll


+ 18 - 0
Start/Keys.cpp

@@ -0,0 +1,18 @@
+#include "Keys.h"
+#include <Datei.h>
+
+using namespace Framework;
+
+// Konstruktor
+Keys::Keys()
+{}
+
+// Gibt den Schlüssel eines Servers zurück
+//  key: Ein Zeiger auf ein array von bytes. Wird als ausgabe verwendet. Enthält nach aufruf den gewünschten Key
+//  length: Enthält nach aufruf die Länge des Schlüssels
+//  sTyp: Der Servertyp, zu dem der Schlüssel ermittelt werden soll
+//  kTyp: Die art des Schlüssels der ermittelt werden soll
+void Keys::getServerKey( char **key, int &length, Server sTyp, Key kTyp )
+{
+    // Diese Methode ist nicht open source
+}

+ 43 - 0
Start/Keys.h

@@ -0,0 +1,43 @@
+#pragma once
+
+class Keys
+{
+    // Konstruktor
+    Keys();
+public:
+    enum Server;
+    enum Key;
+
+    // Gibt den Schlüssel eines Servers zurück
+    //  key: Ein Zeiger auf ein array von bytes. Wird als ausgabe verwendet. Enthält nach aufruf den gewünschten Key
+    //  length: Enthält nach aufruf die Länge des Schlüssels
+    //  sTyp: Der Servertyp, zu dem der Schlüssel ermittelt werden soll
+    //  kTyp: Die art des Schlüssels der ermittelt werden soll
+    static void getServerKey( char **key, int &length, Server sTyp, Key kTyp );
+
+    // Servertypen
+    enum Server
+    {
+        MAIN = 0,
+        ANMELDUNG = 1,
+        CHAT = 2,
+        EDITOR = 3,
+        HISTORIE = 4,
+        INFORMATION = 5,
+        KARTEN = 6,
+        LOGIN = 7,
+        NEWS = 8,
+        REGISTER = 9,
+        SHOP = 10,
+        SPIEL = 11,
+        PATCH = 12,
+        ERHALTUNG = 13
+    };
+
+    // Keytypen
+    enum Key
+    {
+        EMPFANGEN = 0,
+        SENDEN = 0
+    };
+};

BIN
Start/Network.dll


+ 197 - 0
Start/Netzwerk.cpp

@@ -0,0 +1,197 @@
+#include "Netzwerk.h"
+#include "Keys.h"
+
+// Inhalt der ErhaltungKlient Klasse aus Netzwerk.h
+// Konstruktor
+ErhaltungKlient::ErhaltungKlient( int klientId )
+: Thread()
+{
+	klient = 0;
+	this->klientId = klientId;
+	abmel = 0;
+	trenn = 0;
+	ref = 1;
+}
+
+// Destruktor
+ErhaltungKlient::~ErhaltungKlient()
+{
+	ende();
+	if( klient )
+		klient->release();
+}
+
+// nicht constant
+void ErhaltungKlient::verbinden( int mSP, Text *zMSIp, char *netwSchlüssel, char netwSchlüsselLän )
+{
+	if( !klient )
+	{
+		klient = new Klient();
+        int l = 0;
+        char *key;
+        Keys::getServerKey( &key, l, Keys::MAIN, Keys::SENDEN );
+        klient->setSendeKey( key, l );
+        delete[] key;
+        Keys::getServerKey( &key, l, Keys::MAIN, Keys::EMPFANGEN );
+        klient->setEmpfangKey( key, l );
+        delete[] key;
+		if( !klient->verbinde( mSP, zMSIp->getText() ) )
+		{
+			klient = klient->release();
+			return;
+		}
+		klient->sende( "\0", 1 ); // Verschlüsselung aktivieren
+		klient->sendeEncrypted( "\1", 1 );
+		klient->sendeEncrypted( (char*)&klientId, 4 );
+		char serverReturn = 0;
+		klient->getNachrichtEncrypted( &serverReturn, 1 );
+		if( serverReturn == 3 )
+		{
+			char län = 0;
+			klient->getNachrichtEncrypted( &län, 1 );
+			char *nachricht = new char[ län + 1 ];
+			nachricht[ län ] = 0;
+			klient->getNachrichtEncrypted( nachricht, län );
+			delete[]nachricht;
+			klient->sendeEncrypted( "\3", 1 );
+			klient->getNachrichtEncrypted( &serverReturn, 1 );
+			klient->trenne();
+			klient = klient->release();
+			return;
+		}
+		klient->setSendeKey( (char*)netwSchlüssel, netwSchlüsselLän );
+		klient->setEmpfangKey( (char*)netwSchlüssel, netwSchlüsselLän );
+		klient->sendeEncrypted( "\6\x8", 2 );
+		char byte = 0;
+		klient->getNachrichtEncrypted( &byte, 1 );
+		if( byte == 2 )
+		{
+			unsigned char lsIp[ 4 ];
+			klient->getNachrichtEncrypted( (char *)lsIp, 4 );
+			unsigned short lsPort = 0;
+			klient->getNachrichtEncrypted( (char*)&lsPort, 2 );
+			klient->sendeEncrypted( "\3", 1 );
+			klient->getNachrichtEncrypted( &serverReturn, 1 );
+			klient->trenne();
+			Text *lsIpT = new Text( "" );
+			lsIpT->append( (int)lsIp[ 0 ] );
+			lsIpT->append( "." );
+			lsIpT->append( (int)lsIp[ 1 ] );
+			lsIpT->append( "." );
+			lsIpT->append( (int)lsIp[ 2 ] );
+			lsIpT->append( "." );
+			lsIpT->append( (int)lsIp[ 3 ] );
+            int l = 0;
+            char *key;
+            Keys::getServerKey( &key, l, Keys::ERHALTUNG, Keys::SENDEN );
+            klient->setSendeKey( key, l );
+            delete[] key;
+            Keys::getServerKey( &key, l, Keys::ERHALTUNG, Keys::EMPFANGEN );
+            klient->setEmpfangKey( key, l );
+            delete[] key;
+			klient->verbinde( lsPort, lsIpT->getText() );
+			lsIpT = lsIpT->release();
+			klient->sende( "\0", 1 ); // Verschlüsselung aktivieren
+			klient->sendeEncrypted( "\3", 1 );
+			klient->getNachrichtEncrypted( &serverReturn, 1 );
+			klient->trenne();
+		}
+		if( byte == 3 )
+		{
+			klient->getNachrichtEncrypted( &byte, 1 );
+			char *f = new char[ byte + 1 ];
+			f[ byte ] = 0;
+			klient->getNachrichtEncrypted( f, byte );
+			delete[]f;
+			klient->sendeEncrypted( "\3", 1 );
+			klient->getNachrichtEncrypted( &serverReturn, 1 );
+			klient->trenne();
+			klient = klient->release();
+			return;
+		}
+	}
+	if( klient->verbinde( klient->getServerPort(), klient->getServerIp() ) )
+	{
+		klient->sende( "\0", 1 ); // Verschlüsselung Aktivieren
+		if( klient->sendeEncrypted( "\1", 1 ) )
+		{
+			klient->sendeEncrypted( (char*)&klientId, 4 );
+			char serverReturn = 0;
+			klient->getNachrichtEncrypted( &serverReturn, 1 );
+			if( serverReturn == 3 )
+			{
+				char byte = 0;
+				klient->getNachrichtEncrypted( &byte, 1 );
+				char *f = new char[ byte + 1 ];
+				f[ byte ] = 0;
+				klient->getNachrichtEncrypted( f, byte );
+				delete[]f;
+				klient->sendeEncrypted( "\3", 1 );
+				klient->getNachrichtEncrypted( &serverReturn, 1 );
+				klient->trenne();
+				return;
+			}
+			klient->setSendeKey( (char*)netwSchlüssel, netwSchlüsselLän );
+			klient->setEmpfangKey( (char*)netwSchlüssel, netwSchlüsselLän );
+			start();
+		}
+		else
+			klient = klient->release();
+	}
+	else
+		klient = klient->release();
+}
+
+void ErhaltungKlient::abmelden()
+{
+	abmel = 1;
+}
+
+void ErhaltungKlient::trennen()
+{
+	trenn = 1;
+}
+
+void ErhaltungKlient::thread()
+{
+	while( 1 )
+	{
+		char n = 0;
+		klient->getNachrichtEncrypted( &n, 1 );
+		if( n != 1 )
+		{
+			Sleep( 250 );
+			continue;
+		}
+		if( trenn )
+		{
+			if( abmel )
+			{
+				klient->sendeEncrypted( "\1", 1 );
+				klient->getNachrichtEncrypted( &n, 1 );
+			}
+			klient->trenne();
+			run = 0;
+			return;
+		}
+		else
+			klient->sendeEncrypted( "\0", 1 );
+	}
+}
+
+// constant
+
+// Reference Counting
+ErhaltungKlient *ErhaltungKlient::getThis()
+{
+	ref++;
+	return this;
+}
+
+ErhaltungKlient *ErhaltungKlient::release()
+{
+	ref--;
+	if( !ref )
+		delete this;
+	return 0;
+}

+ 32 - 0
Start/Netzwerk.h

@@ -0,0 +1,32 @@
+#include <Klient.h>
+#include <Thread.h>
+#include <Text.h>
+
+using namespace Network;
+using namespace Framework;
+
+class ErhaltungKlient : public Thread
+{
+private:
+	Klient *klient;
+	int klientId;
+	bool abmel;
+	bool trenn;
+	int ref;
+
+public:
+	// Konstruktor
+	ErhaltungKlient( int klientId );
+	// Destruktor
+	~ErhaltungKlient();
+	// nicht constant
+	void verbinden( int mSP, Text *zMSIp, char *netwSchlüssel, char netwSchlüsselLän );
+	void abmelden();
+	void trennen();
+	virtual void thread();
+	// constant
+
+	// Reference Counting
+	ErhaltungKlient *getThis();
+	ErhaltungKlient *release();
+};

+ 184 - 0
Start/Start.vcxproj

@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{7612A0F9-B370-4505-8A72-1FE64FBC793D}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>Start</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v141</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v141</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v141</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v141</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <IncludePath>..\..\..\..\Allgemein\Network\Network;..\..\..\..\Allgemein\Framework;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\..\..\Allgemein\Framework\x64\Debug;..\..\..\..\Allgemein\Network\x64\Debug;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>..\..\..\..\Allgemein\Framework;..\..\..\..\Allgemein\Network\Network;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\..\..\Allgemein\Framework\Release;..\..\..\..\Allgemein\Network\Release;$(LibraryPath)</LibraryPath>
+    <CustomBuildBeforeTargets>Build</CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>..\..\..\..\Allgemein\Framework;..\..\..\..\Allgemein\Network\Network;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\..\..\Allgemein\Framework\x64\Release;..\..\..\..\Allgemein\Network\x64\Release;$(LibraryPath)</LibraryPath>
+    <CustomBuildBeforeTargets>Build</CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>Framework.lib;Network.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Command>copy "..\x64\Debug\Start.exe" "..\..\Fertig\Debug\x64\start.exe"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>Framework.lib;Network.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Command>copy "..\Release\Start.exe" "..\..\Fertig\x32\start.exe"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>Framework.lib;Network.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Command>copy "..\x64\Release\Start.exe" "..\..\Fertig\x64\start.exe"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="Keys.cpp" />
+    <ClCompile Include="Netzwerk.cpp" />
+    <ClCompile Include="start.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Keys.h" />
+    <ClInclude Include="Netzwerk.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 36 - 0
Start/Start.vcxproj.filters

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Ressourcendateien">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="start.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="Netzwerk.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="Keys.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Netzwerk.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Keys.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 355 - 0
Start/start.cpp

@@ -0,0 +1,355 @@
+#include "Netzwerk.h"
+#include <main.h>
+#include <Datei.h>
+#include <Fenster.h>
+#include <Globals.h>
+#include <InitDatei.h>
+#include "Keys.h"
+
+int KSGStart Framework::Start( Startparam p )
+{
+	Network::Start( 10 );
+	char serverReturn = 0;
+
+	HANDLE Mutex = OpenMutex( MUTEX_ALL_ACCESS, false, "KSG_Client" );
+	if( Mutex == NULL )
+	{
+		Mutex = CreateMutex( NULL, true, "KSG_Client" );
+		DateiRemove( new Text( "data/tmp/k.id" ) );
+		DateiRemove( new Text( "data/tmp/keinabsturz" ) );
+	}
+	else
+	{
+		WMessageBox( 0, new Text( "Fehler" ), new Text( "Das Programm läuft bereits. Wenn dieß nicht der Fall ist,\nmusst du den Komputer neu starten." ), MB_ICONERROR );
+		Network::Exit();
+		return 0;
+	}
+
+	if( DateiExistiert( new Text( "data/update/unable/list.patch" ) ) )
+	{
+		PROCESS_INFORMATION prozessinfo3;
+		STARTUPINFO startinfo3;
+		ZeroMemory( &startinfo3, sizeof( STARTUPINFOW ) );
+		startinfo3.cb = sizeof( STARTUPINFOW );
+
+		if( CreateProcess( 0, "data/patch/bin/übernehmen.exe", 0, 0, 0, 0, 0, 0, &startinfo3, &prozessinfo3 ) == 1 )
+		{
+			Network::Exit();
+			DateiRemove( new Text( "data/tmp" ) );
+			exit( 0 );
+		}
+		else
+		{
+			WMessageBox( 0, new Text( "Fehler" ), new Text( "Bei dem Übernehen der Änderungen ist ein Fehler aufgetreten.\nBitte starte den Komputer neu. Sollte diese Meldung weiterhin\nerscheinen, so musst du das Spiel neu Installieren." ), MB_ICONERROR );
+			exit( 0 );
+		}
+	}
+
+	PROCESS_INFORMATION prozessinfo1;
+	STARTUPINFO startinfo1;
+	startinfo1.cb = sizeof( STARTUPINFOW );
+	ZeroMemory( &startinfo1, sizeof( STARTUPINFOW ) );
+	bool pe = 0;
+
+	if( CreateProcess( 0, "data/start/icon.exe", 0, 0, 0, 0, 0, 0, &startinfo1, &prozessinfo1 ) == 1 )
+	{
+		CloseHandle( prozessinfo1.hThread );
+		pe = 1;
+	}
+
+	InitDatei *iDat = new InitDatei( "data/optionen.ini" );
+	iDat->laden();
+	if( !iDat->zWert( "ServerIP" ) )
+		iDat->addWert( "ServerIP", "127.0.0.1" );
+	if( !iDat->zWert( "ServerPort" ) )
+		iDat->addWert( "ServerPort", "4253" );
+	iDat->speichern();
+	Text *ipT = iDat->getWert( "ServerIP" );
+	unsigned short port = (unsigned short)TextZuInt( iDat->zWert( "ServerPort" )->getText(), 10 );
+	iDat->release();
+	Klient *klient = new Klient();
+    int l = 0;
+    char *key;
+    Keys::getServerKey( &key, l, Keys::MAIN, Keys::SENDEN );
+	klient->setSendeKey( key, l );
+    delete[] key;
+    Keys::getServerKey( &key, l, Keys::MAIN, Keys::EMPFANGEN );
+	klient->setEmpfangKey( key, l );
+    delete[] key;
+	if( !klient->verbinde( port, ipT->getText() ) )
+	{
+		Text *message = new Text( "Der Server wurde nicht gefunden.\nServer Ip:" );
+		message->append( ipT->getText() );
+		message->append( "\nServer Port:" );
+		message->append( (int)port );
+		WMessageBox( 0, new Text( "Fehler" ), message, MB_ICONERROR );
+		ipT->release();
+		klient->release();
+		Network::Exit();
+		return 0;
+	}
+	klient->sende( "\0", 1 ); // Verschlüsselung aktivieren
+	klient->sendeEncrypted( "\1\0\0\0\0", 5 );
+	char byte = 0;
+	klient->getNachrichtEncrypted( &byte, 1 );
+	if( byte == 3 )
+	{
+		klient->getNachrichtEncrypted( &byte, 1 );
+		char *message = new char[ byte + 1 ];
+		message[ byte ] = 0;
+		klient->getNachrichtEncrypted( message, byte );
+		Text *nachricht = new Text( "Fehler während der Identifikation beim Server.\nServer Rückgabe:\n " );
+		nachricht->append( message );
+		WMessageBox( 0, new Text( "Server Fehler" ), nachricht, MB_ICONERROR );
+		delete[]message;
+		ipT->release();
+		klient->sendeEncrypted( "\3", 1 );
+		klient->getNachrichtEncrypted( &serverReturn, 1 );
+		klient->trenne();
+		klient->release();
+		Network::Exit();
+		return 0;
+	}
+	int klientNummer = 0;
+	char *netwSchlüssel = 0;
+	char netwSchlüsselLän = 0;
+	if( byte == 1 )
+	{
+		klient->getNachrichtEncrypted( (char*)&klientNummer, 4 );
+		klient->getNachrichtEncrypted( &netwSchlüsselLän, 1 );
+		if( netwSchlüsselLän )
+		{
+			netwSchlüssel = new char[ netwSchlüsselLän ];
+			klient->getNachrichtEncrypted( netwSchlüssel, netwSchlüsselLän );
+			klient->setSendeKey( netwSchlüssel, netwSchlüsselLän );
+			klient->setEmpfangKey( netwSchlüssel, netwSchlüsselLän );
+			Datei *dat = new Datei();
+			dat->setDatei( "data/tmp/schlüssel.netw" );
+			dat->erstellen();
+			dat->open( Datei::Style::schreiben );
+			dat->schreibe( &netwSchlüsselLän, 1 );
+			dat->schreibe( netwSchlüssel, netwSchlüsselLän );
+			dat->close();
+			dat->release();
+		}
+	}
+	else
+	{
+		WMessageBox( 0, new Text( "Server Fehler" ), new Text( "Unbekannte Rückgabe vom Server.\nEventuell ist deine Version des Spiels veraltet." ), MB_ICONERROR );
+		ipT->release();
+		klient->sendeEncrypted( "\3", 1 );
+		klient->getNachrichtEncrypted( &serverReturn, 1 );
+		klient->trenne();
+		klient->release();
+		Network::Exit();
+		delete[] netwSchlüssel;
+		return 0;
+	}
+	Datei *dat = new Datei();
+	dat->setDatei( "data/tmp/k.id" );
+	dat->erstellen();
+	dat->open( Datei::Style::schreiben );
+	dat->schreibe( (char*)&klientNummer, 4 );
+	dat->close();
+	dat->release();
+	klient->sendeEncrypted( "\3", 1 );
+	klient->getNachrichtEncrypted( &serverReturn, 1 );
+	klient->trenne();
+	klient->release();
+
+	ErhaltungKlient *erhaltung = new ErhaltungKlient( klientNummer );
+	erhaltung->verbinden( port, ipT, netwSchlüssel, netwSchlüsselLän );
+
+	if( pe )
+	{
+		while( WaitForSingleObject( prozessinfo1.hProcess, 1000 ) == WAIT_TIMEOUT );
+		CloseHandle( prozessinfo1.hProcess );
+	}
+
+	PROCESS_INFORMATION prozessinfo2;
+	STARTUPINFO startinfo2;
+	startinfo2.cb = sizeof( STARTUPINFOW );
+	ZeroMemory( &startinfo2, sizeof( STARTUPINFOW ) );
+
+	if( CreateProcess( 0, "data/patch/bin/patcher.exe", 0, 0, 0, 0, 0, 0, &startinfo2, &prozessinfo2 ) == 1 )
+	{
+		CloseHandle( prozessinfo2.hThread );
+		while( WaitForSingleObject( prozessinfo2.hProcess, 5000 ) == WAIT_TIMEOUT );
+		unsigned long erfolg = 0;
+		GetExitCodeProcess( prozessinfo2.hProcess, &erfolg );
+		if( erfolg != 0 && DateiExistiert( new Text( "data/tmp/keinabsturz" ) ) )
+		{
+			bool gamestart = erfolg == 2;
+			if( erfolg == 1 )
+			{
+				PROCESS_INFORMATION prozessinfo3;
+				STARTUPINFO startinfo3;
+				startinfo3.cb = sizeof( STARTUPINFOW );
+				ZeroMemory( &startinfo3, sizeof( STARTUPINFOW ) );
+
+				if( CreateProcess( 0, "data/patch/bin/übernehmen.exe", 0, 0, 0, 0, 0, 0, &startinfo3, &prozessinfo3 ) == 1 )
+				{
+					if( DateiExistiert( new Text( "data/tmp/keinabsturz" ) ) )
+						erhaltung->abmelden();
+					erhaltung->trennen();
+					erhaltung->warteAufThread( 5000 );
+					erhaltung->release();
+					klient = new Klient();
+                    int l = 0;
+                    char *key;
+                    Keys::getServerKey( &key, l, Keys::MAIN, Keys::SENDEN );
+                    klient->setSendeKey( key, l );
+                    delete[] key;
+                    Keys::getServerKey( &key, l, Keys::MAIN, Keys::EMPFANGEN );
+                    klient->setEmpfangKey( key, l );
+                    delete[] key;
+					if( !klient->verbinde( port, ipT->getText() ) )
+					{
+						WMessageBox( 0, new Text( "Fehler" ), new Text( "Die Verbindung zum Server ist abgebrochen." ), MB_ICONERROR );
+						ipT->release();
+						klient->release();
+						Network::Exit();
+						delete[] netwSchlüssel;
+						return 0;
+					}
+					klient->sende( "\0", 1 ); // Verschlüsselung aktivieren
+					klient->sendeEncrypted( "\1", 1 );
+					klient->sendeEncrypted( (char*)&klientNummer, 4 );
+					klient->getNachrichtEncrypted( &serverReturn, 1 );
+					if( serverReturn == 3 )
+					{
+						klient->getNachrichtEncrypted( &byte, 1 );
+						char *message = new char[ byte + 1 ];
+						message[ byte ] = 0;
+						klient->getNachrichtEncrypted( message, byte );
+						Text *nachricht = new Text( "Fehler während der Identifikation beim Server.\nServer Rückgabe:\n " );
+						nachricht->append( message );
+						WMessageBox( 0, new Text( "Server Fehler" ), nachricht, MB_ICONERROR );
+						delete[] message;
+					}
+					else
+					{
+						klient->setSendeKey( netwSchlüssel, netwSchlüsselLän );
+						klient->setEmpfangKey( netwSchlüssel, netwSchlüsselLän );
+					}
+					klient->sendeEncrypted( "\7", 1 );
+					klient->getNachrichtEncrypted( &serverReturn, 1 );
+					if( serverReturn == 3 )
+					{
+						klient->getNachrichtEncrypted( &byte, 1 );
+						char *message = new char[ byte + 1 ];
+						message[ byte ] = 0;
+						klient->getNachrichtEncrypted( message, byte );
+						Text *nachricht = new Text( "Fehler während der Abmeldung beim Server.\nServer Rückgabe:\n " );
+						nachricht->append( message );
+						WMessageBox( 0, new Text( "Server Fehler" ), nachricht, MB_ICONERROR );
+						delete[]message;
+					}
+					klient->sendeEncrypted( "\3", 1 );
+					klient->getNachrichtEncrypted( &serverReturn, 1 );
+					klient->trenne();
+					ipT->release();
+					klient->release();
+					Network::Exit();
+
+					DateiRemove( new Text( "data/tmp" ) );
+
+					exit( 0 );
+				}
+				else
+					gamestart = 0;
+				if( !gamestart )
+					WMessageBox( 0, new Text( "Fehler" ), new Text( "Bei dem Übernehen der Änderungen ist ein Fehler aufgetreten." ), MB_ICONERROR );
+			}
+			if( gamestart )
+			{
+				PROCESS_INFORMATION prozessinfo3;
+				STARTUPINFO startinfo3;
+				startinfo3.cb = sizeof( STARTUPINFOW );
+				ZeroMemory( &startinfo3, sizeof( STARTUPINFOW ) );
+				DateiRemove( new Text( "data/tmp/keinabsturz" ) );
+
+				if( CreateProcess( 0, "\"data/client/bin/game client.exe\"", 0, 0, 0, 0, 0, 0, &startinfo3, &prozessinfo3 ) == 1 )
+				{
+					CloseHandle( prozessinfo3.hThread );
+					while( WaitForSingleObject( prozessinfo3.hProcess, 5000 ) == WAIT_TIMEOUT );
+					CloseHandle( prozessinfo3.hProcess );
+				}
+				else
+					WMessageBox( 0, new Text( "Fehler" ), new Text( "Das Spiel konnte nicht gestartet werden." ), MB_ICONERROR );
+			}
+		}
+		CloseHandle( prozessinfo2.hProcess );
+	}
+	else
+	{
+		WMessageBox( 0, new Text( "Fehler" ), new Text( "Der Patcher konnte nicht gestartet werden." ), MB_ICONERROR );
+	}
+	if( DateiExistiert( new Text( "data/tmp/keinabsturz" ) ) )
+		erhaltung->abmelden();
+	erhaltung->trennen();
+	erhaltung->warteAufThread( 5000 );
+	erhaltung->release();
+
+	klient = new Klient();
+    Keys::getServerKey( &key, l, Keys::MAIN, Keys::SENDEN );
+    klient->setSendeKey( key, l );
+    delete[] key;
+    Keys::getServerKey( &key, l, Keys::MAIN, Keys::EMPFANGEN );
+    klient->setEmpfangKey( key, l );
+    delete[] key;
+	if( !klient->verbinde( port, ipT->getText() ) )
+	{
+		WMessageBox( 0, new Text( "Fehler" ), new Text( "Die Verbindung zum Server ist abgebrochen." ), MB_ICONERROR );
+		ipT->release();
+		klient->release();
+		Network::Exit();
+		delete[] netwSchlüssel;
+		return 0;
+	}
+	klient->sende( "\0", 1 ); // Verschlüsselung aktivieren
+	klient->sendeEncrypted( "\1", 1 );
+	klient->sendeEncrypted( (char*)&klientNummer, 4 );
+	klient->getNachrichtEncrypted( &serverReturn, 1 );
+	if( serverReturn == 3 )
+	{
+		klient->getNachrichtEncrypted( &byte, 1 );
+		char *message = new char[ byte + 1 ];
+		message[ byte ] = 0;
+		klient->getNachrichtEncrypted( message, byte );
+		Text *nachricht = new Text( "Fehler während der Identifikation beim Server.\nServer Rückgabe:\n " );
+		nachricht->append( message );
+		WMessageBox( 0, new Text( "Server Fehler" ), nachricht, MB_ICONERROR );
+		delete[]message;
+	}
+	else
+	{
+		klient->setSendeKey( netwSchlüssel, netwSchlüsselLän );
+		klient->setEmpfangKey( netwSchlüssel, netwSchlüsselLän );
+	}
+	klient->sendeEncrypted( "\7", 1 );
+	klient->getNachrichtEncrypted( &serverReturn, 1 );
+	if( serverReturn == 3 )
+	{
+		klient->getNachrichtEncrypted( &byte, 1 );
+		char *message = new char[ byte + 1 ];
+		message[ byte ] = 0;
+		klient->getNachrichtEncrypted( message, byte );
+		Text *nachricht = new Text( "Fehler während der Abmeldung beim Server.\nServer Rückgabe:\n " );
+		nachricht->append( message );
+		WMessageBox( 0, new Text( "Server Fehler" ), nachricht, MB_ICONERROR );
+		delete[]message;
+	}
+	klient->sendeEncrypted( "\3", 1 );
+	klient->getNachrichtEncrypted( &serverReturn, 1 );
+	klient->trenne();
+	ipT->release();
+	klient->release();
+	Network::Exit();
+
+	DateiRemove( new Text( "data/tmp" ) );
+
+	delete[] netwSchlüssel;
+
+	return 0;
+}

+ 3 - 0
build.bat

@@ -0,0 +1,3 @@
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Start.sln" /p:configuration=release /p:platform=win32
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Start.sln" /p:configuration=release /p:platform=x64
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "Start.sln" /p:configuration=debug /p:platform=x64