I am sure that I am sending the BNCS packet 0x12 (SID_LOCALEINFO) incorrectly. This is what I have:
With PacketBuffer
.InsertDWORD 0
.InsertDWORD 0
.InsertDWORD 0
.InsertDWORD 0
.InsertDWORD 0
.InsertDWORD 1033
.InsertDWORD 1033
.InsertDWORD 1033
.InsertNTString MakeLocaleInfo(LOCALE_SABBREVLANGNAME)
.InsertNTString MakeLocaleInfo(LOCALE_ICOUNTRY)
.InsertNTString MakeLocaleInfo(LOCALE_SABBREVCTRYNAME)
.InsertNTString MakeLocaleInfo(LOCALE_SENGCOUNTRY)
.SendBNCSPacket &H12
End With
Public Function MakeLocaleInfo(ByVal id As Long) As String
Dim szBuffer As String, Result As Integer
szBuffer = String(256, vbNullChar)
Result = GetLocaleInfo(LOCALE_USER_DEFAULT, id, szBuffer, Len(szBuffer))
If Result > 0 Then
szBuffer = Left$(szBuffer, Result - 1)
MakeLocaleInfo = szBuffer
End If
End Function
Since this packet is not accessible to me on BnetDocs, I am unable to know it's structure.
Does anyone know the structure of SID_LOCALEINFO? I would like to know what the first 8 DWORDs should be.
Quote from: DeCeP7ioN on August 19, 2004, 08:08 AMDoes anyone know the structure of SID_LOCALEINFO? I would like to know what the first 8 DWORDs should be.
Why not just check how one of the legacy clients builds it? :) I'm pretty sure Diablo still sends it, but I haven't looked in ages.
What the hell,
JSTR Battle.snp to Visual Basic:
Public Sub SendLocaleInfo()
Dim TimeZoneInformation As TIME_ZONE_INFORMATION
Dim SysTime1 As SYSTEMTIME, SysTime2 As SYSTEMTIME
Dim FileTime1 As FILETIME, FileTime2 As FILETIME
Dim TimeZoneBias As Long, SystemDefaultLCID As Long, UserDefaultLCID As Long, UserDefaultLangID As Long
Dim LCData1 As String, LCData2 As String, LCData3 As String, LCData4 As String
Call GetTimeZoneInformation(TimeZoneInformation)
Call GetSystemTime(SysTime1)
Call GetLocalTime(SysTime2)
Call SystemTimeToFileTime(SysTime1, FileTime1)
Call SystemTimeToFileTime(SysTime2, FileTime2)
TimeZoneBias = TimeZoneInformation.Bias
SystemDefaultLCID = GetSystemDefaultLCID()
UserDefaultLCID = GetUserDefaultLCID()
UserDefaultLangID = (GetUserDefaultLangID() And &HFFFF)
LCData1 = String(&H40, vbNullChar): LCData2 = String(&H40, vbNullChar)
LCData3 = String(&H40, vbNullChar): LCData4 = String(&H40, vbNullChar)
Call GetLocaleInfo(LANG_USER_DEFAULT, LOCALE_SABBREVLANGNAME, LCData1, &H40)
Call GetLocaleInfo(LANG_USER_DEFAULT, LOCALE_ICOUNTRY, LCData2, &H40)
Call GetLocaleInfo(LANG_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, LCData3, &H40)
Call GetLocaleInfo(LANG_USER_DEFAULT, LOCALE_SENGCOUNTRY, LCData4, &H40)
LCData1 = Left$(LCData, InStr(1, LCData1, vbNullChar) - 1)
LCData2 = Left$(LCData2, InStr(1, LCData2, vbNullChar) - 1)
LCData3 = Left$(LCData3, InStr(1, LCData3, vbNullChar) - 1)
LCData4 = Left$(LCData4, InStr(1, LCData4, vbNullChar) - 1)
With Bot.sendbuf
.Insert FileTime1.dwLowDateTime
.Insert FileTime1.dwHighDateTime
.Insert FileTime2.dwLowDateTime
.Insert FileTime2.dwHighDateTime
.Insert TimeZoneBias
.Insert SystemDefaultLCID
.Insert UserDefaultLCID
.Insert UserDefaultLangID
.Insert LCData1
.Insert LCData2
.Insert LCData3
.Insert LCData4
.SendPacket SID_LOCALEINFO
End With
End Sub