• Welcome to Valhalla Legends Archive.
 

MPQ Locale ID?

Started by Evan1993, May 15, 2008, 04:28 PM

Previous topic - Next topic

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?

Hdx

If I remember correctlly its simply GetUserDefaultLCID.
~Hdx

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Barabajagal

#2
Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long

GetUserDefaultLCID is used in LOCALEINFO.

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

Hdx

Quote from: Evan1993 on May 15, 2008, 07:57 PM
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

looks good you're english, and from the US right?

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

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...

Evan1993

This is what I'm doing right now.


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)


addchat shows:

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.


is every thing corrrect?

Pyro

#7
Everything in the packet. except for the country abbreviation and name, is a DWORD.

Evan1993

Like this?
.InsertDwordString("0") 'Protocol ID  :-\

UserLoser


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;
}

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?

l2k-Shadow

Quote from: Evan1993 on May 16, 2008, 07:15 PM
that won't work for me becuase "Conversion from string "IX86" to type 'Long' is not valid." ect ect.

What should I use instead?

InsertLong(0x49583836); ?
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Hdx

Quote from: Evan1993 on May 16, 2008, 07:15 PM
that won't work for me becuase "Conversion from string "IX86" to type 'Long' is not valid." ect ect.

What should I use instead?
.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.

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Evan1993

#13
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?

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




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.

Hdx

#14
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.

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status