Contrib/Patcher: Make the client use realmListBn config instead of having to deal with portal and hosts rewrites

This commit is contained in:
Shauren
2014-05-18 22:29:26 +02:00
parent 1094783715
commit a078c1555c
4 changed files with 13 additions and 56 deletions

View File

@@ -25,6 +25,7 @@ namespace Connection_Patcher.Offsets
public static readonly long Send = 0x889CA;
public static readonly long Recv = 0x86EEE;
public static readonly long Signature = 0x20B79;
public static readonly long RealmList = 0x228D6C;
}
public static class x64
@@ -33,6 +34,7 @@ namespace Connection_Patcher.Offsets
public static readonly long Send = 0xAAB6B;
public static readonly long Recv = 0xA9FA3;
public static readonly long Signature = 0;
public static readonly long RealmList = 0x2BB33C;
}
}
}

View File

@@ -22,12 +22,13 @@ namespace Connection_Patcher.Patches
{
public static class x86
{
//public static byte[] BNet = { 0xC7, 0x40, 0x0C, 0xD5, 0xF8, 0x7F, 0x82 };
public static byte[] BNet = { 0x89, 0x48, 0x08, 0xC7, 0x40, 0x0C, 0xD5, 0xF8, 0x7F, 0x82, 0x90 };
public static byte[] Send = { 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90, 0xEB };
public static byte[] Recv = { 0xB8, 0x00, 0x00, 0x00, 0x00 };
public static byte[] Password = { 0x75 };
public static byte[] Signature = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE9 };
public static byte[] RealmList = { 0x08 };
public static byte[] RealmListBn = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
}
public static class x64
@@ -37,6 +38,7 @@ namespace Connection_Patcher.Patches
public static byte[] Send = { 0x45, 0x33, 0xED, 0x90, 0x90, 0x90 };
public static byte[] Recv = { 0xB8, 0x00, 0x00, 0x00, 0x00, 0x90 };
public static byte[] Password = { 0x75 };
public static byte[] RealmList = { 0x4C, 0x8B, 0xEA };
//public static byte[] Signature = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE9 };
public static byte[] Signature = { };
}

View File

@@ -23,6 +23,7 @@ namespace Connection_Patcher.Patterns
public static class x86
{
public static byte[] Password = { 0x74, 0x89, 0x8B, 0x16, 0x8B, 0x42, 0x04 };
public static byte[] RealmListBn = { 0x2E, 0x6C, 0x6F, 0x67, 0x6F, 0x6E, 0x2E, 0x62, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x2E, 0x6E, 0x65, 0x74 };
}
public static class x64

View File

@@ -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
{