Valhalla Legends Forums Archive | .NET Platform | C# Data Degradation?

AuthorMessageTime
DDA-TriCk-E
Outgoing 0x1A (BNLS) does not match incoming 0x50 (BNCS)...

Notice the mpqTime
[code]
[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.......
[/code]

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?
October 22, 2007, 12:38 AM
Myndfyr
Can you post your actual code?
October 22, 2007, 5:20 AM
DDA-TriCk-E
Sure  ;)

Receive 0x50:
[code]

                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;
[/code]

Send 0x1A (BNLS):
[code]
        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());
        }
[/code]
October 22, 2007, 6:45 AM
DDA-TriCk-E
Also this is only happening on WarCraft II and StarCraft.  Diablo II works fine.
October 22, 2007, 7:27 AM
Myndfyr
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.  Alternatively, use the ReadNullTerminatedByteArray method.
October 22, 2007, 4:57 PM
DDA-TriCk-E
Ahhh I see, thankyou :)

EDIT: Sweet got it working, thanks alot MyndFyre :)
October 22, 2007, 9:41 PM

Search