Author | Message | Time |
---|---|---|
Evan1993 | At bnet docs the packet info for SID_AUTH_INFO's format: (DWORD) Platform ID (DWORD) Product ID (DWORD) Version Byte (DWORD) Product language (DWORD) Local IP for NAT compatibility* (DWORD) Time zone bias* (DWORD) Locale ID* (DWORD) Language ID* (STRING) Country abreviation (STRING) Country then in under remarks it has MPQ Locale ID after Product language, do I really need to send this, and how would I find the proper value? | May 15, 2008, 9:28 PM |
HdxBmx27 | If I remember correctlly its simply GetUserDefaultLCID. ~Hdx | May 15, 2008, 9:40 PM |
Barabajagal | Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long GetUserDefaultLCID is used in LOCALEINFO. | May 15, 2008, 10:45 PM |
Evan1993 | like this? Protocol ID: 0 Platform ID: IX86 Product ID: WAR3 Version Byte: 0x15 Product language: (bnet docs) This field is under investigation. It can safely be set to 0. MPQ Locale ID: 1033 (?) Local IP: (inet_addr("MyIPHere")) Timezone bias: -240 Language ID: 9503753 Country Abbreviation: USA Country: United States | May 16, 2008, 12:57 AM |
HdxBmx27 | [quote author=Evan1993 link=topic=17498.msg178302#msg178302 date=1210899458] like this? Protocol ID: 0 Platform ID: IX86 Product ID: WAR3 Version Byte: 0x15 Product language: (bnet docs) This field is under investigation. It can safely be set to 0. MPQ Locale ID: 1033 (?) Local IP: (inet_addr("MyIPHere")) Timezone bias: -240 Language ID: 9503753 Country Abbreviation: USA Country: United States [/quote]looks good you're english, and from the US right? | May 16, 2008, 1:16 AM |
Barabajagal | Er... Product Language isn't under investigation... Just use the GetLocaleInfo API to get LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME, put them together, and convert them to a DWORD. And 1033 is the language code for enUS (which will be the result of Product Language... | May 16, 2008, 2:02 AM |
Evan1993 | This is what I'm doing right now. [code] Dim LocalIP As Long = inet_addr(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList(0).ToString) Dim packet As New BncsPacket(SID_AUTH_INFO) Dim ProductLanguage As String = CultureInfo.CurrentCulture.Name.Remove(2, 1) Dim MPQLocaleID As Int16 = CultureInfo.CurrentCulture.LCID Dim time As TimeSpan = System.TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now) Dim CountryAbbreviation As String = Globalization.RegionInfo.CurrentRegion.ThreeLetterWindowsRegionName Dim Country As String = Globalization.RegionInfo.CurrentRegion.NativeName 'Right now I only want to get warcraft connection working so Product ID and Version Byte are hard coded. With packet .InsertByte(0) 'Protocol ID .InsertDwordString("IX86") 'Platform ID .InsertDwordString("WAR3") 'Product ID .InsertByte(&H15) 'Version Byte .InsertDwordString(ProductLanguage) 'Product language .InsertInt16(MPQLocaleID) 'MPQ Locale ID .InsertInt64(LocalIP) 'Local IP (in network byte order) .InsertInt16(time.TotalMinutes) 'Timezone bias .InsertInt32(9503753) 'Language ID .InsertCString(CountryAbbreviation) 'Country Abbreviation .InsertCString(Country) 'Country End With AddChat(packet.ToString) [/code] addchat shows: [code] 0000 ff 50 34 00 00 36 38 58 49 33 52 41 57 15 53 55 ÿP4..68XI3RAW.SU 0010 6e 65 09 04 c0 a8 01 07 07 00 00 00 10 ff 09 04 ne..À¨.......ÿ.. 0020 91 00 55 53 41 00 55 6e 69 74 65 64 20 53 74 61 ..USA.United Sta 0030 74 65 73 00 tes. [/code] is every thing corrrect? | May 16, 2008, 6:44 PM |
PyroManiac606 | Everything in the packet. except for the country abbreviation and name, is a DWORD. | May 16, 2008, 7:48 PM |
Evan1993 | Like this? [code].InsertDwordString("0") 'Protocol ID[/code] :-\ | May 16, 2008, 7:52 PM |
UserLoser | [code] void BncsClient::SendAuthInfo(/* 0x50 */) { BncsPacket AuthInfo(SID_AUTH_INFO); TIME_ZONE_INFORMATION tziTimeZone; char szCountryAbbreviation[64], szCountryName[256]; // Initialize memset(szCountryAbbreviation, 0, sizeof(szCountryAbbreviation)); memset(szCountryName, 0, sizeof(szCountryName)); // Get parameters GetTimeZoneInformation(&tziTimeZone); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, szCountryAbbreviation, 64); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGCOUNTRY, szCountryName, 256); AuthInfo.InsertLong(0); AuthInfo.InsertLong('IX86'); AuthInfo.InsertLong(Product.ProductId); AuthInfo.InsertLong(Product.DefaultVersionByte); AuthInfo.InsertLong('enUS'); AuthInfo.InsertLong(0); // TODO AuthInfo.InsertLong(tziTimeZone.Bias); AuthInfo.InsertLong(GetSystemDefaultLCID()); AuthInfo.InsertLong(GetSystemDefaultLangID()); AuthInfo.InsertStringA(szCountryAbbreviation); AuthInfo.InsertStringA(szCountryName); AuthInfo.Finalize(this); return; } [/code] | May 16, 2008, 11:25 PM |
Evan1993 | that won't work for me becuase "Conversion from string "IX86" to type 'Long' is not valid." ect ect. What should I use instead? | May 17, 2008, 12:15 AM |
l2k-Shadow | [quote author=Evan1993 link=topic=17498.msg178321#msg178321 date=1210983325] that won't work for me becuase "Conversion from string "IX86" to type 'Long' is not valid." ect ect. What should I use instead? [/quote] InsertLong(0x49583836); ? | May 17, 2008, 12:18 AM |
HdxBmx27 | [quote author=Evan1993 link=topic=17498.msg178321#msg178321 date=1210983325] that won't work for me becuase "Conversion from string "IX86" to type 'Long' is not valid." ect ect. What should I use instead? [/quote] .net doesn't allow literals?[ if thats the right word, but anyways] #define IX86 0x49583836 If .net dosen't allow you to do that, then ouch... anywho. | May 17, 2008, 12:48 AM |
Evan1993 | I was being a retard is all... wasn't thinking for myself enough. Also what does the " AuthInfo.Finalize(this);" part of your code do? Is my code correct now? [code] Public Sub SendSendAuthInfo(ByVal Product As String) Dim AuthInfo As New BncsPacket(SID_AUTH_INFO) Dim time As TimeSpan = System.TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now) Dim LanguageID As Integer = GetUserDefaultLangID() With AuthInfo .InsertInt64(0) 'Protocol ID .InsertInt64(StringToHex("IX86")) 'Platform ID .InsertInt64(StringToHex(Product)) 'Product ID .InsertInt64(Long.Parse(MBNCSUtil.CheckRevision.GetVersionByte(Product), NumberStyles.Number)) 'Version Byte .InsertInt64(StringToHex(CultureInfo.CurrentCulture.Name.Remove(2, 1))) 'Product language .InsertInt64(CultureInfo.CurrentCulture.LCID) 'MPQ Locale ID .InsertInt64(inet_addr(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList(0).ToString)) 'Local IP (in network byte order) .InsertInt64(time.TotalMinutes) 'Timezone bias .InsertInt64(GetUserDefaultLangID()) 'Language ID .InsertCString(Globalization.RegionInfo.CurrentRegion.ThreeLetterWindowsRegionName) 'Country Abbreviation .InsertCString(Globalization.RegionInfo.CurrentRegion.NativeName) 'Country End With AddChat(AuthInfo.ToString) End Sub [/code] [code] 0000 ff 50 5e 00 00 00 00 00 00 00 00 00 36 38 58 49 ÿP^.........68XI 0010 00 00 00 00 33 52 41 57 00 00 00 00 15 00 00 00 ....3RAW........ 0020 00 00 00 00 53 55 6e 65 00 00 00 00 09 04 00 00 ....SUne........ 0030 00 00 00 00 c0 a8 01 07 07 00 00 00 10 ff ff ff ....À¨.......ÿÿÿ 0040 ff ff ff ff 09 04 00 00 00 00 00 00 55 53 41 00 ÿÿÿÿ........USA. 0050 55 6e 69 74 65 64 20 53 74 61 74 65 73 00 United States. [/code] | May 17, 2008, 2:01 AM |
HdxBmx27 | 1st off, they are 32-bit ints.. not 64... And eww@ StringToHex, thats something andy would do.... Most of the data itself is good, Just treat them as 32-bit ints. Have you tried compiling with simply 'IX86'? I hate .net so iono if thats allowed. If not, make a const. And I presume his finilize is simply, Digest it all [prepend the header] and send it. | May 17, 2008, 2:16 AM |
Evan1993 | Oh, I saw he was using longs and in VB.net a long is 64 bits, sorry.. whats a better way to get a string to a hex(long)? heres what I'm using right now. [code] Public Function StringToHex(ByRef Data As String) As Long 'first take each charcter using substring. 'then convert character into ascii. 'then convert ascii value into Hex Format Dim sValue As String Dim sHex As String = "" Dim s As String = Data While s.Length > 0 sValue = Conversion.Hex(Strings.Asc(s.Substring(0, 1).ToString())) s = s.Substring(1, s.Length - 1) sHex = sHex + sValue End While Return Long.Parse(sHex, NumberStyles.HexNumber) End Function [/code] | May 17, 2008, 2:19 AM |
HdxBmx27 | [quote author=Evan1993 link=topic=17498.msg178326#msg178326 date=1210990787]whats a better way to get a string to a hex(long)?[/quote]Cleaner, Not always better, but use CopyMem psudo: [code]Function ToInt32(value as string) as Integer Dim ret as Integer; CopyMemory(&ret, value, 4); ToInt32 = ret; End Function[/code] | May 17, 2008, 2:23 AM |
Evan1993 | My IP in network byte order is 64 bits... how to I add it as a 32 bit integer? | May 17, 2008, 2:51 AM |
HdxBmx27 | Convert it to a 32 bit int... & 0xffffffff. ~Hdx | May 17, 2008, 2:56 AM |
Evan1993 | [quote author=Hdx link=topic=17498.msg178329#msg178329 date=1210993002] Convert it to a 32 bit int... & 0xffffffff. ~Hdx [/quote] Well I was bing a retard again.. Public Declare Function inet_addr Lib "wsock32" (ByVal s As String) As Integer <--- was long before lolz however i'm such a ninny that I don't get what you mean by "& 0xffffffff" do you mean .InsertInt32(Integer.Parse(&HFFFFFFFF, NumberStyles.HexNumber)) ? | May 17, 2008, 3:10 AM |
HdxBmx27 | [quote author=Evan1993 link=topic=17498.msg178330#msg178330 date=1210993800] [quote author=Hdx link=topic=17498.msg178329#msg178329 date=1210993002] Convert it to a 32 bit int... & 0xffffffff. ~Hdx [/quote] Well I was bing a retard again.. Public Declare Function inet_addr Lib "wsock32" (ByVal s As String) As Integer <--- was long before lolz however i'm such a ninny that I don't get what you mean by "& 0xffffffff" do you mean .InsertInt32(Integer.Parse(&HFFFFFFFF, NumberStyles.HexNumber)) ?[/quote] When converting from a larger int to a smaller, and you don't give a fuck about the high-end. You do the binary and operation on the bits you want. Hence & 0xffffffff will give you the low 32 bits of a 64 bit int | May 17, 2008, 3:37 AM |
Ribose | [code] using MBNCSUtil; using System.Globalization; [...] /// <summary>Sends packet 0x50, SID_AUTH_INFO.</summary> /// <param name="a_sProduct">The Product ID.</param> /// <param name="a_bVerbyte">The Version Byte.</param> private void Send_SID_AUTH_INFO(string a_sProduct, byte a_bVerbyte) { BncsPacket m_pbBncsPacket = new BncsPacket((byte) BattleNetPacketIDs.SID_AUTH_INFO); m_pbBncsPacket.InsertInt32(0x00); // (DWORD) Protocol ID m_pbBncsPacket.InsertDwordString("IX86"); // (DWORD) Platform Code m_pbBncsPacket.InsertDwordString(a_sProduct); // (DWORD) Product Code m_pbBncsPacket.InsertInt32((int) a_bVerbyte); // (DWORD) Version Byte m_pbBncsPacket.InsertInt32(CultureInfo.CurrentUICulture.LCID); // (DWORD) Product Language m_pbBncsPacket.InsertInt32(0); // (DWORD) Local IP m_pbBncsPacket.InsertInt32((int) DateTime.UtcNow.Subtract(DateTime.Now).TotalMinutes); // (DWORD) Timezone Bias m_pbBncsPacket.InsertInt32(CultureInfo.CurrentUICulture.LCID); // (DWORD) Locale ID m_pbBncsPacket.InsertInt32(CultureInfo.CurrentUICulture.LCID); // (DWORD) Language ID m_pbBncsPacket.InsertCString(RegionInfo.CurrentRegion.ThreeLetterISORegionName); // (STRING) Country Abbreviation m_pbBncsPacket.InsertCString(RegionInfo.CurrentRegion.DisplayName); // (STRING) Country name SendPacket(m_pbBncsPacket.GetData()); }[/code] That's how you do it with C#. Here's it in VB: [code] Imports MBNCSUtil Imports System.Globalization [...] ''' <summary>Sends packet 0x50, SID_AUTH_INFO.</summary> ''' <param name="a_sProduct">The Product ID.</param> ''' <param name="a_bVerbyte">The Version Byte.</param> Private Sub Send_SID_AUTH_INFO(ByVal Product As String, ByVal Verbyte As Byte) With (New BncsPacket(0x50)) .InsertInt32(0x00) ' (DWORD) Protocol ID .InsertDwordString("IX86") ' (DWORD) Platform Code .InsertDwordString(Product) ' (DWORD) Product Code .InsertInt32(CInt(Verbyte)); ' (DWORD) Version Byte .InsertInt32(CultureInfo.CurrentUICulture.LCID); ' (DWORD) Product Language .InsertInt32(0); ' (DWORD) Local IP .InsertInt32(CInt(DateTime.UtcNow.Subtract(DateTime.Now).TotalMinutes)) ' (DWORD) Timezone Bias .InsertInt32(CultureInfo.CurrentUICulture.LCID) ' (DWORD) Locale ID .InsertInt32(CultureInfo.CurrentUICulture.LCID) ' (DWORD) Language ID .InsertCString(RegionInfo.CurrentRegion.ThreeLetterISORegionName) ' (STRING) Country Abbreviation .InsertCString(RegionInfo.CurrentRegion.DisplayName) ' (STRING) Country name SendPacket(.GetData()) End With End Sub[/code] Yea, I don't know how to get Local IP or whether all the values are gotten from the correct place... however that's a good way to construct a packet in .Net. In .Net its: Byte -> System.Byte (primitive type: VB Byte, C# byte) Word -> System.Int16 (primitive type: VB Short, C# short) DWord -> System.Int32 (primitive type: VB Integer, C# int) LongLong (QWord) -> System.Int64 (primitive type: VB Long, C# long) of course there are unsigned versions of all of those. | May 18, 2008, 9:25 PM |
Ringo | Dunno if this helps: [code] Public Sub S_B_0x50(ByRef lngSckHdl As Long, _ ByRef lngClient As Long, _ ByRef lngVersionByte As Long, _ ByVal lngAddr As Long, _ ByRef hBuf As clsBuffer) Dim i As Long Dim strCon As String Dim strConAb As String Dim lngCon As Long Dim lngConAb As Long Dim udtTimeZone As TIME_ZONE_INFORMATION '//Get the product language "enUS" (not "enGB") Call GetLocaleInfoA(GetSystemDefaultLCID(), &H59, lngCon, 4) Call GetLocaleInfoA(GetSystemDefaultLCID(), &H5A, lngConAb, 4) strCon = String(64, 0) strConAb = String(64, 0) '//GBR i = GetLocaleInfoA(GetUserDefaultLangID(), &H7, ByVal strConAb, Len(strConAb)) strConAb = Left(strConAb, (i - 1)) '//United Kingdom i = GetLocaleInfoA(GetUserDefaultLangID(), &H1002, ByVal strCon, Len(strCon)) strCon = Left(strCon, (i - 1)) '//Time Bias Call GetTimeZoneInformation(udtTimeZone) With hBuf .Clear .InsertDWORD &H0 'protocol id .InsertDWORD &H49583836 'IX86 .InsertDWORD lngClient .InsertDWORD lngVersionByte .InsertMEM VarPtr(lngConAb), 2 'Product Language "US" .InsertMEM VarPtr(lngCon), 2 'Product Language "en" .InsertDWORD lngAddr 'Local IP .InsertDWORD udtTimeZone.Bias 'TimeZone Bias .InsertDWORD GetUserDefaultLCID() 'Locale ID .InsertDWORD GetUserDefaultLangID() 'Language ID .InsertNTSTRING strConAb 'GBR .InsertNTSTRING strCon 'United Kingdom .InsertHEADER &H50, BNCS_HEADER .SendPacket lngSckHdl End With End Sub [/code] | May 19, 2008, 12:18 AM |
Evan1993 | My packet still looks wrong, does it change any when sent? Becuase I'm not sending it yet. [code] Public Sub SendSendAuthInfo(ByVal Product As String) Dim AuthInfo As New BncsPacket(SID_AUTH_INFO) Dim time As TimeSpan = System.TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now) With AuthInfo .InsertInt32(&H0) 'Protocol ID .InsertDwordString("IX86") 'Platform ID .InsertDwordString(Product) 'Product ID .InsertInt32(CInt(MBNCSUtil.CheckRevision.GetVersionByte(Product))) 'Version Byte .InsertInt32(StringToHex(CultureInfo.CurrentCulture.Name.Remove(2, 1))) 'Product language .InsertInt32(CultureInfo.CurrentCulture.LCID) 'MPQ Locale ID .InsertInt32(inet_addr(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList(0).ToString)) 'Local IP (in network byte order) .InsertInt32(time.TotalMinutes) 'Timezone bias .InsertInt32(CultureInfo.CurrentCulture.LCID) 'Language ID .InsertCString(Globalization.RegionInfo.CurrentRegion.ThreeLetterWindowsRegionName) 'Country Abbreviation .InsertCString(Globalization.RegionInfo.CurrentRegion.NativeName) 'Country AddChat(.ToString) End With End Sub [/code] [code] 0 -Protocol ID IX86 -Platform ID/code W3XP -Product ID/code 21 -Product ID enUS -Product language 1033 -MPQ Locale ID 117549248 -Local IP (in network byte order) -240 -Timezone bias 1033 -Language ID USA -Country Abbreviation United States -Country [/code] addchat shows: [code] 0000 ff 50 3a 00 00 00 00 00 36 38 58 49 50 58 33 57 ÿP:.....68XIPX3W 0010 15 00 00 00 53 55 6e 65 09 04 00 00 c0 a8 01 07 ....SUne....À¨.. 0020 10 ff ff ff 09 04 00 00 55 53 41 00 55 6e 69 74 .ÿÿÿ....USA.Unit 0030 65 64 20 53 74 61 74 65 73 00 ed States. [/code] Warcrafts.. [code] 0000 00 0f 66 30 22 b3 00 01 6c 19 d9 58 08 00 45 00 ..f0"... l..X..E. 0010 00 62 0f 71 40 00 80 06 00 00 c0 a8 01 07 3f f0 .b.q@... ......?. 0020 ca 83 0b 4f 17 e0 05 87 2d 03 de c1 e9 3f 50 18 ...O.... -....?P. 0030 ff ff cc 77 00 00 ff 50 3a 00 00 00 00 00 36 38 ...w...P :.....68 0040 58 49 50 58 33 57 15 00 00 00 53 55 6e 65 c0 a8 XIPX3W.. ..SUne.. 0050 01 07 f0 00 00 00 09 04 00 00 09 04 00 00 55 53 ........ ......US 0060 41 00 55 6e 69 74 65 64 20 53 74 61 74 65 73 00 A.United States. [/code] | May 19, 2008, 5:05 PM |
HdxBmx27 | [code]ff 50 3a 00 ÿP:. - (DWORD) Header 00 00 00 00 .... - (DWORD) Protocol ID (0) 36 38 58 49 68XI - (DWORD) Platform ID 50 58 33 57 PX3W - (DWORD) Product ID 15 00 00 00 .... - (DWORD) Version Byte 53 55 6e 65 SUne - (DWORD) Product language 09 04 00 00 .... - (DWORD) Local IP for NAT compatibility* c0 a8 01 07 À¨.. - (DWORD) Time zone bias* 10 ff ff ff .ÿÿÿ - (DWORD) Locale ID* 09 04 00 00 .... - (DWORD) Language ID* 55 53 41 00 USA. - (STRING) Country abreviation 55 6e 69 74 65 64 20 53 74 61 74 65 73 00 United States. - (STRING) Country ff 50 3a 00 .P:. - (DWORD) Header 00 00 00 00 .... - (DWORD) Protocol ID (0) 36 38 58 49 68XI - (DWORD) Platform ID 50 58 33 57 PX3W - (DWORD) Product ID 15 00 00 00 .... - (DWORD) Version Byte 53 55 6e 65 SUne - (DWORD) Product language c0 a8 01 07 .... - (DWORD) Local IP for NAT compatibility* f0 00 00 00 .... - (DWORD) Time zone bias* 09 04 00 00 .... - (DWORD) Locale ID* 09 04 00 00 .... - (DWORD) Language ID* 55 53 41 00 USA. - (STRING) Country abreviation 55 6e 69 74 65 64 20 53 74 61 74 65 73 00 United States. - (STRING) Country[/code] A few of your values are in the wrong order. Besides that your timezone is a bit messed up. | May 19, 2008, 5:36 PM |
Evan1993 | Heres my packet now, is it fixed? [code] ff 50 3a 00 ÿP:. - (DWORD) Header 00 00 00 00 .... - (DWORD) Protocol ID (0) 36 38 58 49 68XI - (DWORD) Platform ID 50 58 33 57 PX3W - (DWORD) Product ID 15 00 00 00 .... - (DWORD) Version Byte 53 55 6e 65 SUne - (DWORD) Product language c0 a8 01 07 À¨.. - (DWORD) Local IP for NAT compatibility* f0 00 00 00 ð... - (DWORD) Time zone bias* 09 04 00 00 .... - (DWORD) Locale ID* 09 04 00 00 .... - (DWORD) Language ID* 55 53 41 00 USA. - (STRING) Country abreviation 55 6e 69 74 65 64 20 53 74 61 74 65 73 00 United States. - (STRING) Country [/code] My timezone is 240 now, is that fixed? [code] With AuthInfo .InsertInt32(&H0) 'Protocol ID .InsertDwordString("IX86") 'Platform ID .InsertDwordString(Product) 'Product ID .InsertInt32(CInt(MBNCSUtil.CheckRevision.GetVersionByte(Product))) 'Version Byte .InsertInt32(StringToHex(CultureInfo.CurrentCulture.Name.Remove(2, 1))) 'Product language .InsertInt32(inet_addr(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList(0).ToString)) 'Local IP (in network byte order) .InsertInt32(DateTime.UtcNow.Subtract(DateTime.Now).TotalMinutes) 'Timezone bias .InsertInt32(CultureInfo.CurrentCulture.LCID) 'MPQ Locale ID .InsertInt32(CultureInfo.CurrentCulture.LCID) 'Language ID .InsertCString(Globalization.RegionInfo.CurrentRegion.ThreeLetterWindowsRegionName) 'Country Abbreviation .InsertCString(Globalization.RegionInfo.CurrentRegion.NativeName) 'Country AddChat(.ToString) End With [/code] | May 19, 2008, 6:34 PM |
HdxBmx27 | looks good, send her off | May 21, 2008, 1:49 AM |