From 705459268b51cf4247d1bdf132975eb857b641c5 Mon Sep 17 00:00:00 2001 From: ArachisH Date: Sat, 6 Jun 2020 21:31:43 -0700 Subject: [PATCH] * Whoops --- Tanji/Program.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Tanji/Program.cs b/Tanji/Program.cs index bca63c8..21fc5e8 100644 --- a/Tanji/Program.cs +++ b/Tanji/Program.cs @@ -29,14 +29,14 @@ public static class Program [STAThread] private static int Main(string[] args) { - AppDomain.CurrentDomain.UnhandledException += UnhandledException; - using (var identity = WindowsIdentity.GetCurrent()) { HasAdminPrivilages = new WindowsPrincipal(identity).IsInRole(WindowsBuiltInRole.Administrator); } Settings = LoadSettings(); + AppDomain.CurrentDomain.UnhandledException += UnhandledException; + if (args.Length > 0) { switch (args[0].Substring(args[0].Length - 3)) @@ -74,15 +74,15 @@ private static void InstallCertificateAuthority() bool installedRootCA = tanjiCertificateManager.CreateTrustedRootCertificate(); Console.WriteLine("Tanji Certificate Authority Installed: " + installedRootCA); } - private static void PatchClient(FileInfo clientInfo) + private static bool PatchClient(FileInfo clientInfo) { using (var game = new HGame(clientInfo.FullName)) { game.Disassemble(); - game.DisableHostChecks(); - game.InjectKeyShouter(4001); - game.InjectEndPointShouter(4000); - game.InjectEndPoint("127.0.0.1", (int)Settings["ConnectionListenPort"]); + bool disabledHostChecks = game.DisableHostChecks(); + bool injectedKeyShouter = game.InjectKeyShouter(4001); + bool injectedEndPointShouter = game.InjectEndPointShouter(4000); + bool injectedEndPoint = game.InjectEndPoint("127.0.0.1", (int)Settings["ConnectionListenPort"]); string moddedClientPath = Path.Combine(clientInfo.DirectoryName, "MOD_" + clientInfo.Name); using (var fileOutput = File.Open(moddedClientPath, FileMode.Create)) @@ -91,6 +91,7 @@ private static void PatchClient(FileInfo clientInfo) game.Assemble(output, CompressionKind.ZLIB); } MessageBox.Show($"File has been modified/re-assembled successfully at '{moddedClientPath}'.", "Tanji - Alert!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + return disabledHostChecks && injectedKeyShouter && injectedEndPointShouter && injectedEndPoint; } }