aboutsummaryrefslogtreecommitdiff
path: root/contrib/Connection Patcher/Program.cs
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-05-18 22:29:26 +0200
committerShauren <shauren.trinity@gmail.com>2014-05-18 22:29:26 +0200
commita078c1555c7de6bf2d770f1091fbce46deaae427 (patch)
tree16e3766a4d385bbb2b9ede08f12b5f466add3d41 /contrib/Connection Patcher/Program.cs
parent1094783715c16faf7553d2391b8bf23bfc51524d (diff)
Contrib/Patcher: Make the client use realmListBn config instead of having to deal with portal and hosts rewrites
Diffstat (limited to 'contrib/Connection Patcher/Program.cs')
-rw-r--r--contrib/Connection Patcher/Program.cs62
1 files changed, 7 insertions, 55 deletions
diff --git a/contrib/Connection Patcher/Program.cs b/contrib/Connection Patcher/Program.cs
index 5ba7b3e0a87..956741b625b 100644
--- a/contrib/Connection Patcher/Program.cs
+++ b/contrib/Connection Patcher/Program.cs
@@ -39,8 +39,6 @@ namespace Connection_Patcher
Console.ReadKey(true);
var commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
- var system32 = Environment.GetFolderPath(Environment.SpecialFolder.System);
- var hostsPath = Path.Combine(system32, "drivers/etc/hosts");
var modulePath = "";
var moduleFile = "";
@@ -53,10 +51,14 @@ namespace Connection_Patcher
var offsetBNet = Offsets.Windows.x86.BNet;
var patchSignature = Patches.Windows.x86.Signature;
var offsetSignature = Offsets.Windows.x86.Signature;
- var fileName = "";
+ var fileName = args[0].Replace(".exe", "_Patched.exe");
var battleNetFileName = args[0].Replace("Wow.exe", "Battle.net.dll");
var modulePatch = Patches.Windows.x86.Password;
var modulePattern = Patterns.Windows.x86.Password;
+ var realmListPatch = Patches.Windows.x86.RealmList;
+ var realmListoffset = Offsets.Windows.x86.RealmList;
+ var realmListBnPatch = Patches.Windows.x86.RealmListBn;
+ var realmListBnPattern = Patterns.Windows.x86.RealmListBn;
Console.ForegroundColor = ConsoleColor.White;
Console.Write("Creating patched binaries for ");
@@ -93,7 +95,6 @@ namespace Connection_Patcher
// moduleFile = "97eeb2e28e9e56ed6a22d09f44e2ff43c93315e006bbad43bafc0defaa6f50ae.auth";
// modulePatch = Patches.Mac.x64.Password;
// modulePattern = Patterns.Mac.x64.Password;
- // hostsPath = "/private/etc/hosts";
// break;
default:
throw new NotSupportedException("Type: " + patcher.Type + " not supported!");
@@ -109,11 +110,13 @@ namespace Connection_Patcher
{
bnpatcher.Patch(patchBNet, null, offsetBNet);
bnpatcher.Patch(patchSignature, null, offsetSignature);
+ bnpatcher.Patch(realmListBnPatch, realmListBnPattern);
bnpatcher.Finish();
}
patcher.Patch(patchSend, null, offsetSend);
patcher.Patch(patchRecv, null, offsetRecv);
+ patcher.Patch(realmListPatch, null, realmListoffset);
patcher.Binary = fileName;
@@ -127,57 +130,6 @@ namespace Connection_Patcher
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Successfully created your patched binaries.");
}
-
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("Adding host rewrite...");
-
- var host = args.Length == 2 ? args[1] : "127.0.0.1";
- var hostName = args.Length == 3 ? (" " + args[2] + ".logon.battle.net") : " tc.logon.battle.net";
- var exists = false;
-
- using (var sr = new StreamReader(hostsPath))
- {
- while (!sr.EndOfStream)
- {
- var line = sr.ReadLine();
-
- if (line.Contains(hostName))
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("Host rewrite not needed.");
-
- exists = true;
- break;
- }
- }
- }
-
- if (!exists)
- {
- try
- {
- using (var stream = new StreamWriter(hostsPath, true, Encoding.UTF8))
- {
- stream.WriteLine("");
- stream.WriteLine("{0}{1}", host, hostName);
- }
-
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Host rewrite successfully added.");
- }
- catch (Exception e)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine(string.Format("Can't write host file! Exception type: {0}", e.GetType()));
- Console.WriteLine("You must add the following line:");
-
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("{0}{1}", host, hostName);
-
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("to your host file before using Arctium WoD Sandbox!");
- }
- }
}
else
{