Outgoing 0x1A (BNLS) does not match incoming 0x50 (BNCS)...
Notice the mpqTime
[BNCS: INCOMING 50]
0000: 00 00 00 00 FE 48 1D D5 AE BB 4A 00 00 7C E3 E5 ....þH.Õ®»J..|ãå
0010: 72 FC C6 01 6C 6F 63 6B 64 6F 77 6E 2D 49 58 38 rüÆ.lockdown-IX8
0020: 36 2D 31 38 2E 6D 70 71 00 AC F5 8D 80 52 AF E9 6-18.mpq.¬õ..R¯é
0030: C2 92 C4 09 06 54 4D 23 30 00 Â.Ä..TM#0.......
[BNLS: OUTGOING 1A]
0000: 03 00 00 00 00 00 00 00 EC C1 8D 0C 00 7C E3 E5 ........ìÁ...|ãå
0010: 72 FC C6 01 6C 6F 63 6B 64 6F 77 6E 2D 49 58 38 rüÆ.lockdown-IX8
0020: 36 2D 31 38 2E 6D 70 71 00 3F 3F 3F 3F 52 3F 3F 6-18.mpq.????R??
0030: 3F 3F 3F 09 06 54 4D 23 30 00 ???..TM#0.......
I'm using DateTime.FromFileTime() to get DateTime mpqTime; then I am sending it to BNLS as mpqTime.ToFileTime()
Any ideas where I am going wrong?
EDIT: I have also tried using MBNCSUtil's ReadInt32() x2, and ReadByteArray(8) with no luck, the data still seems to be losing characters... Could this be an Encoding problem?
Can you post your actual code?
Sure ;)
Receive 0x50:
case (byte)Constants.PID.SID_AUTH_INFO:
#region SID_AUTH_INFO
int logonStyle = r.ReadInt32();
c.serverKey = r.ReadInt32();
int udp = r.ReadInt32();
c.mpqTime = DateTime.FromFileTime(r.ReadInt64());
c.mpqArchive = r.ReadCString();
c.valueString = r.ReadCString();
switch (logonStyle)
{
case 0x00:
c.AddChat(Color.Yellow, "Using Login Style (Broken SHA-1)..");
break;
case 0x01:
c.AddChat(Color.Red, "New Login Style (Version 1) is not supported!");
c.Disconnect();
return;
case 0x02:
c.AddChat(Color.Yellow, "Using New Login Style (Version 2)..");
break;
default:
c.AddChat(Color.Red, "Unsupported Login Style!");
c.Disconnect();
return;
}
c.AddChat(Color.SlateGray, "Archive: " + c.mpqArchive);
c.AddChat(Color.SlateGray, "Value String: " +
DebugOutput(Encoding.ASCII.GetBytes(c.valueString), c.valueString.Length));
c.SendBnlsVersionCheckEx2();
//c.SendBnlsVersionCheck();
#endregion
break;
Send 0x1A (BNLS):
public void SendBnlsVersionCheckEx2()
{
bot.lblStatus.Text = "Requesting version data...";
DataBuffer b = new DataBuffer();
AddChat(Color.Yellow, "Requesting version data..");
b.InsertInt32(bnlsProduct);
b.InsertInt32(0);
b.InsertInt32(Environment.TickCount);
b.InsertInt64(mpqTime.ToFileTime());
b.InsertCString(mpqArchive);
b.InsertCString(valueString);
bnls.SendPacket((byte)Constants.PID.BNLS_VERSIONCHECKEX2, b.GetData());
}
Also this is only happening on WarCraft II and StarCraft. Diablo II works fine.
You should check to see if you're using Lockdown before attempting to read the value string. Reading the value string by using ReadCString() with no parameters will parse the data as ASCII, as the documentation says (http://www.jinxbot.net/mbncsutil/html/M_MBNCSUtil_DataReader_ReadCString.htm). Alternatively, use the ReadNullTerminatedByteArray (http://www.jinxbot.net/mbncsutil/html/M_MBNCSUtil_DataReader_ReadNullTerminatedByteArray.htm) method.
Ahhh I see, thankyou :)
EDIT: Sweet got it working, thanks alot MyndFyre :)