public static void HandlePatch(BattlenetPacket packet) { packet.ReadFourCC("ProgramId"); packet.ReadFourCC("Component"); packet.ReadString("Instructions", 0, 8); packet.ReadBoolean("More"); }
public static void HandleConnectionClosing(BattlenetPacket packet) { var packets = packet.Read <int>(0, 6); for (var i = 0; i < packets; ++i) { packet.ReadFourCC("Command", i); packet.Read <uint>("Time", 0, 32, i); packet.Read <ushort>("Size", 0, 16, i); packet.ReadFourCC("Layer", 0, 16, i); packet.Read <ushort>("Offset", 0, 16, i); } packet.Read <ClosingReason>("Reason", 0, 4); packet.ReadByteArray("BadData", 0, 8); if (packet.ReadBoolean()) { packet.Read <ushort>("Command", 0, 6); if (packet.ReadBoolean()) { packet.Read <ushort>("Channel", 0, 4); } } packet.Read <uint>("Now", 0, 32); }
public static void HandleResumeResponse(BattlenetPacket packet) { if (packet.ReadBoolean()) { if (packet.ReadBoolean()) // has module { packet.ReadFixedLengthString("Type", 4, "Strings"); packet.ReadFourCC("Region", "Strings"); var id = Convert.ToHexString(packet.ReadBytes("ModuleId", 32, "Strings")); var dataSize = packet.Read <int>("Data size", 0, 10); var data = packet.ReadBytes(dataSize); var module = new BattlenetModuleHandler(packet); if (!module.HandleData(id, data).HasValue) { packet.Stream.AddValue("Data", data, "Strings"); } } var errorType = packet.Read <byte>(2, 0); if (errorType == 1) { packet.Read <ushort>("Error", 0, 16); packet.Read <uint>("Failure", 0, 32); } } else { var modules = packet.Read <byte>(0, 3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadFixedLengthString("Type", 4, "FinalRequest", i); packet.ReadFourCC("Region", "FinalRequest", i); var id = Convert.ToHexString(packet.ReadBytes("ModuleId", 32, "FinalRequest", i)); var dataSize = packet.Read <int>("Data size", 0, 10, i); var data = packet.ReadBytes(dataSize); if (!module.HandleData(id, data, i).HasValue) { packet.Stream.AddValue("Data", data, "FinalRequest", i); } } packet.Read <uint>("PingTimeout", int.MinValue, 32); if (packet.ReadBoolean()) { Connection.ReadRegulatorInfo(packet, "RegulatorRules"); } } }
public static void HandleToonReady(BattlenetPacket packet) { packet.Read <ulong>("Region", 8); packet.ReadFourCC("Game"); packet.Read <ulong>("Realmaddress", 32); packet.ReadString("Name", packet.Read <int>(7) + 2); packet.Read <ulong>(21); packet.Read <ulong>("Unk64", 64); packet.Read <ulong>("Unk32", 32); packet.Stream.AddValue("Guid", new WowGuid64(packet.Read <ulong>(64))); packet.Read <ulong>("Realmaddress", 32); packet.Read <ulong>("Region", 8); packet.ReadFourCC("Game"); }
public static void HandleToonReady(BattlenetPacket packet) { packet.Read <byte>("Region", 0, 8, "Name"); packet.ReadFourCC("ProgramId", "Name"); packet.Read <uint>("Realm", 0, 32, "Name"); packet.ReadString("Name", 2, 7, "Name"); packet.ReadSkip(21); packet.Read <ulong>("Id", 0, 64, "ProfileAddress"); packet.Read <uint>("Label", 0, 32, "ProfileAddress"); packet.Read <ulong>("Id", 0, 64, "Handle"); packet.Read <uint>("Realm", 0, 32, "Handle"); packet.Read <byte>("Region", 0, 8, "Handle"); packet.ReadFourCC("ProgramId", "Handle"); }
private static void ReadRequestCommon(BattlenetPacket packet, string fieldName) { packet.ReadFourCC("Program", fieldName); packet.ReadFourCC("Platform", fieldName); packet.ReadFourCC("Locale", fieldName); var components = packet.Read <int>(0, 6); for (var i = 0; i < components; ++i) { packet.ReadFourCC("ProgramId", fieldName, i, "Versions"); packet.ReadFourCC("Component", fieldName, i, "Versions"); packet.Read <uint>("Version", 0, 32, fieldName, i, "Versions"); } }
public static void HandleGetStreamItemsRequest(BattlenetPacket packet) { packet.ReadSkip(31); packet.Read<uint>("Token", 0, 32); packet.Read<uint>("ReferenceTime", int.MinValue, 32); packet.Read<StreamDirection>("Direction", 0, 1); packet.Read<byte>("MaxItems", 0, 6); packet.ReadFourCC("Locale"); if (packet.ReadBoolean()) { packet.ReadFourCC("ItemName"); packet.ReadFourCC("Channel"); } else packet.Read<ushort>("Index", 0, 16); }
public static void HandleServerProofRequest(BattlenetPacket packet) { var modules = packet.Read <byte>(3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadString("Type", 4, i); packet.ReadFourCC("Region", i); var id = Utilities.ByteArrayToHexString(packet.ReadBytes(32)); packet.Stream.WriteLine(string.Format("[{0}] ModuleId: {1}", i, id)); var dataSize = packet.Read <int>("Data size", 10, i); var data = packet.ReadBytes(dataSize); var result = module.HandleData(id, data, i); if (!result.HasValue) { packet.Stream.WriteLine(string.Format("[{0}] Data: {1}", i, Utilities.ByteArrayToHexString(data))); } else if (!result.Value) { ModulesWaitingForData.Add(id); } } }
public static void HandleGenerateSingleSignOnTokenRequest2(BattlenetPacket packet) { packet.Read <uint>("Token", 0, 32); if (packet.ReadBoolean()) { packet.ReadFourCC("TargetProgram"); } }
public static void HandleGetStreamItemsRequest(BattlenetPacket packet) { packet.Read <uint>("Unknown3", 31); packet.Read <uint>("Index", 32); packet.Stream.AddValue("Reference time", packet.Read <uint>(32) + int.MinValue); packet.Read <bool>("Direction", 1); packet.Read <byte>("Unknown2", 6); packet.ReadFourCC("Locale"); if (packet.Read <bool>(1)) { packet.ReadFourCC("Item name"); packet.ReadFourCC("Channel"); } else { packet.Read <ushort>("Unknown1", 16); } }
public static void HandleGetStreamItemsRequest(BattlenetPacket packet) { packet.ReadSkip(31); packet.Read <uint>("Token", 0, 32); packet.Read <uint>("ReferenceTime", int.MinValue, 32); packet.Read <StreamDirection>("Direction", 0, 1); packet.Read <byte>("MaxItems", 0, 6); packet.ReadFourCC("Locale"); if (packet.ReadBoolean()) { packet.ReadFourCC("ItemName"); packet.ReadFourCC("Channel"); } else { packet.Read <ushort>("Index", 0, 16); } }
public static void HandleInformationRequest(BattlenetPacket packet) { packet.ReadFourCC("Program"); packet.ReadFourCC("Platform"); packet.ReadFourCC("Locale"); var components = packet.Read <int>(6); for (var i = 0; i < components; ++i) { packet.ReadFourCC("Program", i); packet.ReadFourCC("Platform", i); packet.Read <uint>("Build", 32, i); } if (packet.Read <bool>(1)) { packet.ReadString("Login", packet.Read <int>(9) + 3); } }
public static void HandleGetStreamItemsResponse(BattlenetPacket packet) { packet.Read<ushort>("Offset", 0, 16); packet.Read<ushort>("TotalNumItems", 0, 16); packet.Read<uint>("Token", 0, 32); var items = packet.Read<byte>(0, 6); for (var i = 0; i < items; ++i) { packet.ReadFixedLengthString("Type", 4, "Items", i); packet.ReadFourCC("Region", "Items", i); packet.ReadBytes("ModuleId", 32, "Items", i); packet.ReadSkip(27); packet.Read<uint>("PublicationTime", 0, 32, "Items", i); } }
public static void HandleConnectionClosing(BattlenetPacket packet) { var packets = packet.Read<int>(0, 6); for (var i = 0; i < packets; ++i) { packet.ReadFourCC("Command", i); packet.Read<uint>("Time", 0, 32, i); packet.Read<ushort>("Size", 0, 16, i); packet.ReadFourCC("Layer", 0, 16, i); packet.Read<ushort>("Offset", 0, 16, i); } packet.Read<ClosingReason>("Reason", 0, 4); packet.ReadByteArray("BadData", 0, 8); if (packet.ReadBoolean()) { packet.Read<ushort>("Command", 0, 6); if (packet.ReadBoolean()) packet.Read<ushort>("Channel", 0, 4); } packet.Read<uint>("Now", 0, 32); }
public static void HandleGetStreamItemsResponse(BattlenetPacket packet) { packet.Read <ushort>("Unknown1", 16); packet.Read <ushort>("Unknown2", 16); packet.Read <uint>("Index", 32); var modules = packet.Read <byte>(6); for (var i = 0; i < modules; ++i) { packet.ReadString("Type", 4, i); packet.ReadFourCC("Region", i); packet.Stream.AddValue("ModuleId", Utilities.ByteArrayToHexString(packet.ReadBytes(32)), i); packet.Read <int>(27); // padding packet.Stream.AddValue("Publication time", Utilities.ByteArrayToHexString(BitConverter.GetBytes(packet.Read <uint>(32))), i); } }
public static void HandleGetStreamItemsResponse(BattlenetPacket packet) { packet.Read <ushort>("Offset", 0, 16); packet.Read <ushort>("TotalNumItems", 0, 16); packet.Read <uint>("Token", 0, 32); var items = packet.Read <byte>(0, 6); for (var i = 0; i < items; ++i) { packet.ReadFixedLengthString("Type", 4, "Items", i); packet.ReadFourCC("Region", "Items", i); packet.ReadBytes("ModuleId", 32, "Items", i); packet.ReadSkip(27); packet.Read <uint>("PublicationTime", 0, 32, "Items", i); } }
public static void HandleProofRequest(BattlenetPacket packet) { var modules = packet.Read <byte>(0, 3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadFixedLengthString("Type", 4, i); packet.ReadFourCC("Region", i); var id = Convert.ToHexString(packet.ReadBytes("ModuleId", 32, i)); var dataSize = packet.Read <int>("Data size", 0, 10, i); var data = packet.ReadBytes(dataSize); var result = module.HandleData(id, data, i); if (!result.HasValue) { packet.Stream.AddValue("Data", data, i); } else if (!result.Value) { ModulesWaitingForData.Add(id); } } }
public static void HandleComplete(BattlenetPacket packet) { var failed = packet.Read <bool>(1); if (failed) { if (packet.Read <bool>(1)) // has module { packet.ReadString("Type", 4); packet.ReadFourCC("Region"); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32)); var dataSize = packet.Read <int>("Data size", 10); var data = packet.ReadBytes(dataSize); var module = new BattlenetModuleHandler(packet); if (!module.HandleData(id, data).HasValue) { packet.Stream.AddValue("Data", data); } } var errorType = packet.Read <byte>(2); if (errorType == 1) { packet.Read <ushort>("Result", 16); packet.Read <uint>("Timeout", 32); } } else { var modules = packet.Read <byte>(3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadString("Type", 4); packet.ReadFourCC("Region"); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32)); var dataSize = packet.Read <int>("Data size", 10); var data = packet.ReadBytes(dataSize); if (!module.HandleData(id, data, i).HasValue) { packet.Stream.AddValue("Data", data, i); } } packet.Stream.AddValue("Ping timeout", packet.Read <uint>(32) + int.MinValue); var hasOptionalData = packet.Read <bool>(1); if (hasOptionalData) { var hasConnectionInfo = packet.Read <bool>(1); if (hasConnectionInfo) { packet.Read <uint>("Threshold", 32); packet.Read <uint>("Rate", 32); } } packet.ReadString("First name", packet.Read <int>(8)); packet.ReadString("Last name", packet.Read <int>(8)); packet.Read <uint>("Account id", 32); packet.Read <byte>("Region", 8); packet.Read <ulong>("Account flags", 64); packet.Read <byte>("Game account region", 8); packet.ReadString("Game account name", packet.Read <int>(5) + 1); packet.Read <ulong>("Game account flags", 64); packet.Read <uint>("Failed logins", 32); if (packet.Read <bool>("Has RaF blob", 1)) { packet.ReadBytes("RaF Data", packet.Read <int>(10)); } } }
public static void HandleGetStreamItemsRequest(BattlenetPacket packet) { packet.Read<uint>("Unknown3", 31); packet.Read<uint>("Index", 32); packet.Stream.AddValue("Reference time", packet.Read<uint>(32) + int.MinValue); packet.Read<bool>("Direction", 1); packet.Read<byte>("Unknown2", 6); packet.ReadFourCC("Locale"); if (packet.Read<bool>(1)) { packet.ReadFourCC("Item name"); packet.ReadFourCC("Channel"); } else packet.Read<ushort>("Unknown1", 16); }
public static void HandleGetStreamItemsResponse(BattlenetPacket packet) { packet.Read<ushort>("Unknown1", 16); packet.Read<ushort>("Unknown2", 16); packet.Read<uint>("Index", 32); var modules = packet.Read<byte>(6); for (var i = 0; i < modules; ++i) { packet.ReadString("Type", 4, i); packet.ReadFourCC("Region", i); packet.Stream.AddValue("ModuleId", Utilities.ByteArrayToHexString(packet.ReadBytes(32)), i); packet.Read<int>(27); // padding packet.Stream.AddValue("Publication time", Utilities.ByteArrayToHexString(BitConverter.GetBytes(packet.Read<uint>(32))), i); } }
public static void HandleLogonResponse3(BattlenetPacket packet) { if (packet.ReadBoolean()) { if (packet.ReadBoolean()) // has module { packet.ReadFixedLengthString("Type", 4, "Strings"); packet.ReadFourCC("Region", "Strings"); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "Strings")); var dataSize = packet.Read<int>("Data size", 0, 10); var data = packet.ReadBytes(dataSize); var module = new BattlenetModuleHandler(packet); if (!module.HandleData(id, data).HasValue) packet.Stream.AddValue("Data", data, "Strings"); } var errorType = packet.Read<byte>(2, 0); if (errorType == 1) { packet.Read<ushort>("Error", 0, 16); packet.Read<uint>("Failure", 0, 32); } } else { var modules = packet.Read<byte>(0, 3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadFixedLengthString("Type", 4, "FinalRequest", i); packet.ReadFourCC("Region", "FinalRequest", i); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "FinalRequest", i)); var dataSize = packet.Read<int>("Data size", 0, 10, i); var data = packet.ReadBytes(dataSize); if (!module.HandleData(id, data, i).HasValue) packet.Stream.AddValue("Data", data, "FinalRequest", i); } packet.Read<uint>("PingTimeout", int.MinValue, 32); if (packet.ReadBoolean()) Connection.ReadRegulatorInfo(packet, "RegulatorRules"); packet.ReadString("GivenName", 0, 8); packet.ReadString("Surname", 0, 8); packet.Read<uint>("AccountId", 0, 32); packet.Read<byte>("Region", 0, 8); packet.Read<AccountFlags>("Flags", 0, 64); packet.Read<byte>("GameAccountRegion", 0, 8); packet.ReadString("GameAccountName", 1, 5); packet.Read<GameAccountFlags>("GameAccountFlags", 0, 64); packet.Read<uint>("LogonFailures", 0, 32); if (packet.ReadBoolean()) packet.ReadByteArray("Raf", 0, 10); } }
public static void HandleComplete(BattlenetPacket packet) { var failed = packet.Read<bool>(1); if (failed) { if (packet.Read<bool>(1)) // has module { packet.ReadString("Type", 4); packet.ReadFourCC("Region"); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32)); var dataSize = packet.Read<int>("Data size", 10); var data = packet.ReadBytes(dataSize); var module = new BattlenetModuleHandler(packet); if (!module.HandleData(id, data).HasValue) packet.Stream.AddValue("Data", data); } var errorType = packet.Read<byte>(2); if (errorType == 1) { packet.Read<ushort>("Result", 16); packet.Read<uint>("Timeout", 32); } } else { var modules = packet.Read<byte>(3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadString("Type", 4); packet.ReadFourCC("Region"); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32)); var dataSize = packet.Read<int>("Data size", 10); var data = packet.ReadBytes(dataSize); if (!module.HandleData(id, data, i).HasValue) packet.Stream.AddValue("Data", data, i); } packet.Stream.AddValue("Ping timeout", packet.Read<uint>(32) + int.MinValue); var hasOptionalData = packet.Read<bool>(1); if (hasOptionalData) { var hasConnectionInfo = packet.Read<bool>(1); if (hasConnectionInfo) { packet.Read<uint>("Threshold", 32); packet.Read<uint>("Rate", 32); } } packet.ReadString("First name", packet.Read<int>(8)); packet.ReadString("Last name", packet.Read<int>(8)); packet.Read<uint>("Account id", 32); packet.Read<byte>("Region", 8); packet.Read<ulong>("Account flags", 64); packet.Read<byte>("Game account region", 8); packet.ReadString("Game account name", packet.Read<int>(5) + 1); packet.Read<ulong>("Game account flags", 64); packet.Read<uint>("Failed logins", 32); if (packet.Read<bool>("Has RaF blob", 1)) packet.ReadBytes("RaF Data", packet.Read<int>(10)); } }
private static void ReadRequestCommon(BattlenetPacket packet, string fieldName) { packet.ReadFourCC("Program", fieldName); packet.ReadFourCC("Platform", fieldName); packet.ReadFourCC("Locale", fieldName); var components = packet.Read<int>(0, 6); for (var i = 0; i < components; ++i) { packet.ReadFourCC("ProgramId", fieldName, i, "Versions"); packet.ReadFourCC("Component", fieldName, i, "Versions"); packet.Read<uint>("Version", 0, 32, fieldName, i, "Versions"); } }
public static void HandleServerProofRequest(BattlenetPacket packet) { var modules = packet.Read<byte>(3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadString("Type", 4, i); packet.ReadFourCC("Region", i); var id = Utilities.ByteArrayToHexString(packet.ReadBytes(32)); packet.Stream.WriteLine(string.Format("[{0}] ModuleId: {1}", i, id)); var dataSize = packet.Read<int>("Data size", 10, i); var data = packet.ReadBytes(dataSize); var result = module.HandleData(id, data, i); if (!result.HasValue) packet.Stream.WriteLine(string.Format("[{0}] Data: {1}", i, Utilities.ByteArrayToHexString(data))); else if (!result.Value) ModulesWaitingForData.Add(id); } }
public static void HandleProofRequest(BattlenetPacket packet) { var modules = packet.Read<byte>(0, 3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadFixedLengthString("Type", 4, i); packet.ReadFourCC("Region", i); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, i)); var dataSize = packet.Read<int>("Data size", 0, 10, i); var data = packet.ReadBytes(dataSize); var result = module.HandleData(id, data, i); if (!result.HasValue) packet.Stream.AddValue("Data", data, i); else if (!result.Value) ModulesWaitingForData.Add(id); } }
public static void HandleToonReady(BattlenetPacket packet) { packet.Read<ulong>("Region", 8); packet.ReadFourCC("Game"); packet.Read<ulong>("Realmaddress", 32); packet.ReadString("Name", packet.Read<int>(7) + 2); packet.Read<ulong>(21); packet.Read<ulong>("Unk64", 64); packet.Read<ulong>("Unk32", 32); packet.Stream.AddValue("Guid", new WowGuid64(packet.Read<ulong>(64))); packet.Read<ulong>("Realmaddress", 32); packet.Read<ulong>("Region", 8); packet.ReadFourCC("Game"); }
public static void HandleLogonResponse3(BattlenetPacket packet) { if (packet.ReadBoolean()) { if (packet.ReadBoolean()) // has module { packet.ReadFixedLengthString("Type", 4, "Strings"); packet.ReadFourCC("Region", "Strings"); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "Strings")); var dataSize = packet.Read <int>("Data size", 0, 10); var data = packet.ReadBytes(dataSize); var module = new BattlenetModuleHandler(packet); if (!module.HandleData(id, data).HasValue) { packet.Stream.AddValue("Data", data, "Strings"); } } var errorType = packet.Read <byte>(2, 0); if (errorType == 1) { packet.Read <ushort>("Error", 0, 16); packet.Read <uint>("Failure", 0, 32); } } else { var modules = packet.Read <byte>(0, 3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { packet.ReadFixedLengthString("Type", 4, "FinalRequest", i); packet.ReadFourCC("Region", "FinalRequest", i); var id = Utilities.ByteArrayToHexString(packet.ReadBytes("ModuleId", 32, "FinalRequest", i)); var dataSize = packet.Read <int>("Data size", 0, 10, i); var data = packet.ReadBytes(dataSize); if (!module.HandleData(id, data, i).HasValue) { packet.Stream.AddValue("Data", data, "FinalRequest", i); } } packet.Read <uint>("PingTimeout", int.MinValue, 32); if (packet.ReadBoolean()) { Connection.ReadRegulatorInfo(packet, "RegulatorRules"); } packet.ReadString("GivenName", 0, 8); packet.ReadString("Surname", 0, 8); packet.Read <uint>("AccountId", 0, 32); packet.Read <byte>("Region", 0, 8); packet.Read <AccountFlags>("Flags", 0, 64); packet.Read <byte>("GameAccountRegion", 0, 8); packet.ReadString("GameAccountName", 1, 5); packet.Read <GameAccountFlags>("GameAccountFlags", 0, 64); packet.Read <uint>("LogonFailures", 0, 32); if (packet.ReadBoolean()) { packet.ReadByteArray("Raf", 0, 10); } } }
public static void HandleToonReady(BattlenetPacket packet) { packet.Read<byte>("Region", 0, 8, "Name"); packet.ReadFourCC("ProgramId", "Name"); packet.Read<uint>("Realm", 0, 32, "Name"); packet.ReadString("Name", 2, 7, "Name"); packet.ReadSkip(21); packet.Read<ulong>("Id", 0, 64, "ProfileAddress"); packet.Read<uint>("Label", 0, 32, "ProfileAddress"); packet.Read<ulong>("Id", 0, 64, "Handle"); packet.Read<uint>("Realm", 0, 32, "Handle"); packet.Read<byte>("Region", 0, 8, "Handle"); packet.ReadFourCC("ProgramId", "Handle"); }
public static void HandleComplete(BattlenetPacket packet) { var failed = packet.Read <bool>(1); if (failed) { if (packet.Read <bool>(1)) // has module { var type = packet.ReadString(4); var region = packet.ReadFourCC(); var id = Utilities.ByteArrayToHexString(packet.ReadBytes(32)); var dataSize = packet.Read <int>(10); var data = packet.ReadBytes(dataSize); var module = new BattlenetModuleHandler(packet); packet.Stream.WriteLine(string.Format("Type: {0}", type)); packet.Stream.WriteLine(string.Format("Region: {0}", region)); packet.Stream.WriteLine(string.Format("ModuleId: {0}", id)); packet.Stream.WriteLine(string.Format("Data size: {0}", dataSize)); if (!module.HandleData(id, data).HasValue) { packet.Stream.WriteLine(string.Format("Data: {0}", Utilities.ByteArrayToHexString(data))); } } var errorType = packet.Read <byte>(2); if (errorType == 1) { packet.Stream.WriteLine(string.Format("Result: {0}", packet.Read <ushort>(16))); packet.Stream.WriteLine(string.Format("Unk: {0}", packet.Read <uint>(32))); } } else { var modules = packet.Read <byte>(3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { var type = packet.ReadString(4); var region = packet.ReadFourCC(); var id = Utilities.ByteArrayToHexString(packet.ReadBytes(32)); var dataSize = packet.Read <int>(10); var data = packet.ReadBytes(dataSize); packet.Stream.WriteLine(string.Format("[{0}] Type: {1}", i, type)); packet.Stream.WriteLine(string.Format("[{0}] Region: {1}", i, region)); packet.Stream.WriteLine(string.Format("[{0}] ModuleId: {1}", i, id)); packet.Stream.WriteLine(string.Format("[{0}] Data size: {1}", i, dataSize)); if (!module.HandleData(id, data, i).HasValue) { packet.Stream.WriteLine(string.Format("[{0}] Data: {1}", i, Utilities.ByteArrayToHexString(data))); } } packet.Stream.WriteLine(string.Format("Ping timeout: {0}", packet.Read <uint>(32) + int.MinValue)); var hasOptionalData = packet.Read <bool>(1); if (hasOptionalData) { var hasConnectionInfo = packet.Read <bool>(1); if (hasConnectionInfo) { packet.Read <uint>("Threshold", 32); packet.Read <uint>("Rate", 32); } } packet.ReadString("First name", packet.Read <int>(8)); packet.ReadString("Last name", packet.Read <int>(8)); packet.Read <uint>("Account id", 32); packet.Read <byte>("Unk8", 8); packet.Read <ulong>("Unk64", 64); packet.Read <byte>("Unk8", 8); packet.ReadString("Account name", packet.Read <int>(5) + 1); packet.Read <ulong>("Unk64", 64); packet.Read <uint>("Unk32", 32); if (packet.Read <bool>("Unk1", 1)) { packet.Stream.WriteLine(string.Format("Data: {0}", Utilities.ByteArrayToHexString(packet.ReadBytes(packet.Read <int>(10))))); } } }
public static void HandleGenerateSingleSignOnTokenRequest2(BattlenetPacket packet) { packet.Read<uint>("Token", 0, 32); if (packet.ReadBoolean()) packet.ReadFourCC("TargetProgram"); }
public static void HandleComplete(BattlenetPacket packet) { var failed = packet.Read<bool>(1); if (failed) { if (packet.Read<bool>(1)) // has module { var type = packet.ReadString(4); var region = packet.ReadFourCC(); var id = Utilities.ByteArrayToHexString(packet.ReadBytes(32)); var dataSize = packet.Read<int>(10); var data = packet.ReadBytes(dataSize); var module = new BattlenetModuleHandler(packet); packet.Stream.WriteLine(string.Format("Type: {0}", type)); packet.Stream.WriteLine(string.Format("Region: {0}", region)); packet.Stream.WriteLine(string.Format("ModuleId: {0}", id)); packet.Stream.WriteLine(string.Format("Data size: {0}", dataSize)); if (!module.HandleData(id, data).HasValue) packet.Stream.WriteLine(string.Format("Data: {0}", Utilities.ByteArrayToHexString(data))); } var errorType = packet.Read<byte>(2); if (errorType == 1) { packet.Stream.WriteLine(string.Format("Result: {0}", packet.Read<ushort>(16))); packet.Stream.WriteLine(string.Format("Unk: {0}", packet.Read<uint>(32))); } } else { var modules = packet.Read<byte>(3); var module = new BattlenetModuleHandler(packet); for (var i = 0; i < modules; ++i) { var type = packet.ReadString(4); var region = packet.ReadFourCC(); var id = Utilities.ByteArrayToHexString(packet.ReadBytes(32)); var dataSize = packet.Read<int>(10); var data = packet.ReadBytes(dataSize); packet.Stream.WriteLine(string.Format("[{0}] Type: {1}", i, type)); packet.Stream.WriteLine(string.Format("[{0}] Region: {1}", i, region)); packet.Stream.WriteLine(string.Format("[{0}] ModuleId: {1}", i, id)); packet.Stream.WriteLine(string.Format("[{0}] Data size: {1}", i, dataSize)); if (!module.HandleData(id, data, i).HasValue) packet.Stream.WriteLine(string.Format("[{0}] Data: {1}", i, Utilities.ByteArrayToHexString(data))); } packet.Stream.WriteLine(string.Format("Ping timeout: {0}", packet.Read<uint>(32) + int.MinValue)); var hasOptionalData = packet.Read<bool>(1); if (hasOptionalData) { var hasConnectionInfo = packet.Read<bool>(1); if (hasConnectionInfo) { packet.Read<uint>("Threshold", 32); packet.Read<uint>("Rate", 32); } } packet.ReadString("First name", packet.Read<int>(8)); packet.ReadString("Last name", packet.Read<int>(8)); packet.Read<uint>("Account id", 32); packet.Read<byte>("Unk8", 8); packet.Read<ulong>("Unk64", 64); packet.Read<byte>("Unk8", 8); packet.ReadString("Account name", packet.Read<int>(5) + 1); packet.Read<ulong>("Unk64", 64); packet.Read<uint>("Unk32", 32); if (packet.Read<bool>("Unk1", 1)) packet.Stream.WriteLine(string.Format("Data: {0}", Utilities.ByteArrayToHexString(packet.ReadBytes(packet.Read<int>(10))))); } }
public static void HandleInformationRequest(BattlenetPacket packet) { packet.ReadFourCC("Program"); packet.ReadFourCC("Platform"); packet.ReadFourCC("Locale"); var components = packet.Read<int>(6); for (var i = 0; i < components; ++i) { packet.ReadFourCC("Program", i); packet.ReadFourCC("Platform", i); packet.Read<uint>("Build", 32, i); } if (packet.Read<bool>(1)) packet.ReadString("Login", packet.Read<int>(9) + 3); }