Skip to content

Commit

Permalink
* Whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
ArachisH committed Jun 7, 2020
1 parent 72de9d3 commit 7054592
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Tanji/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 7054592

Please sign in to comment.