Skip to content
Permalink
Browse files

Added some emulation overrides

Protocol ID, Platform ID, and Product Language.

Changed CustomUDPString to just UDPString.

GetDWORDOverride function is now adapted for the new config (it no
longer reads the file itself, just reverses the given value and converts
it to a DWORD).
  • Loading branch information...
Davnit committed Apr 10, 2016
1 parent 86c02d9 commit 6e3612ab6def11f29b24f325fbc330595304e056
Showing with 56 additions and 52 deletions.
  1. +45 −9 trunk/clsConfig.cls
  2. +11 −43 trunk/modBNCS.bas
@@ -199,7 +199,7 @@ Private m_PingSpoofing As Byte
Private m_UseUDP As Boolean
Private m_CustomStatstring As String
Private m_ForceDefaultLocaleID As Boolean
Private m_CustomUDPString As String
Private m_UDPString As String
Private m_CDKeyOwnerName As String
Private m_UseLowerCasePassword As Boolean
Private m_IgnoreVersionCheck As Boolean
@@ -210,6 +210,9 @@ Private m_AutoCreateChannels As String
Private m_RegisterEmailAction As String
Private m_RegisterEmailDefault As String
Private m_RealmServerPassword As String
Private m_ProtocolID As Long
Private m_PlatformID As String
Private m_ProductLanguage As String
Private m_VersionBytes(8) As Long 'XXVerByte
Private m_LogonSystems(8) As Long 'XXLogonSystem

@@ -1346,12 +1349,12 @@ Public Property Let ForceDefaultLocaleID(ByVal sValue As Boolean)
m_ForceDefaultLocaleID = sValue
End Property

Public Property Get CustomUDPString() As String
CustomUDPString = m_CustomUDPString
Public Property Get UDPString() As String
UDPString = m_UDPString
End Property

Public Property Let CustomUDPString(ByVal sValue As String)
m_CustomUDPString = sValue
Public Property Let UDPString(ByVal sValue As String)
m_UDPString = sValue
End Property

Public Property Get CDKeyOwnerName() As String
@@ -1434,6 +1437,30 @@ Public Property Let RealmServerPassword(ByVal sValue As String)
m_RealmServerPassword = sValue
End Property

Public Property Get ProtocolID() As Long
ProtocolID = m_ProtocolID
End Property

Public Property Let ProtocolID(ByVal lValue As Long)
m_ProtocolID = lValue
End Property

Public Property Get PlatformID() As String
PlatformID = m_PlatformID
End Property

Public Property Let PlatformID(ByVal sValue As String)
m_PlatformID = sValue
End Property

Public Property Get ProductLanguage() As String
ProductLanguage = m_ProductLanguage
End Property

Public Property Let ProductLanguage(ByVal sValue As String)
m_ProductLanguage = sValue
End Property


'-------------------------
' SECTION: DEBUG
@@ -1702,7 +1729,7 @@ Public Sub Save(Optional ByVal sFilePath As String = vbNullString)
WriteSetting SECTION_EMULATION, "UseUDP", m_UseUDP
WriteSetting SECTION_EMULATION, "CustomStatstring", m_CustomStatstring
WriteSetting SECTION_EMULATION, "ForceDefaultLocaleID", m_ForceDefaultLocaleID
WriteSetting SECTION_EMULATION, "UDPString", m_CustomUDPString
WriteSetting SECTION_EMULATION, "UDPString", m_UDPString
WriteSetting SECTION_EMULATION, "KeyOwner", m_CDKeyOwnerName
WriteSetting SECTION_EMULATION, "LowerCasePassword", m_UseLowerCasePassword
WriteSetting SECTION_EMULATION, "IgnoreVersionCheck", m_IgnoreVersionCheck
@@ -1713,6 +1740,9 @@ Public Sub Save(Optional ByVal sFilePath As String = vbNullString)
WriteSetting SECTION_EMULATION, "RegisterEmailAction", m_RegisterEmailAction
WriteSetting SECTION_EMULATION, "RegisterEmailDefault", m_RegisterEmailDefault
WriteSetting SECTION_EMULATION, "RealmServerPassword", m_RealmServerPassword
WriteSetting SECTION_EMULATION, "ProtocolID", m_ProtocolID
WriteSetting SECTION_EMULATION, "PlatformID", m_PlatformID
WriteSetting SECTION_EMULATION, "ProductLanguage", m_ProductLanguage

WriteSetting SECTION_DEBUG, "Warden", m_DebugWarden

@@ -1890,7 +1920,7 @@ Private Sub LoadDefaults()
m_UseUDP = False
m_CustomStatstring = vbNullString
m_ForceDefaultLocaleID = False
m_CustomUDPString = vbNullString
m_UDPString = "bnet"
m_CDKeyOwnerName = vbNullString
m_UseLowerCasePassword = True
m_IgnoreVersionCheck = False
@@ -1901,6 +1931,9 @@ Private Sub LoadDefaults()
m_RegisterEmailAction = "PROMPT"
m_RegisterEmailDefault = vbNullString
m_RealmServerPassword = "password"
m_ProtocolID = 0
m_PlatformID = "IX86"
m_ProductLanguage = vbNullString

Dim i As Integer
For i = LBound(m_ProductKeys) To UBound(m_ProductKeys)
@@ -2042,7 +2075,7 @@ Private Sub LoadVersion5Config()
m_IgnoreCDKeyLength = ReadSettingB(SECTION_OVERRIDE, "SetKeyIgnoreLength", m_IgnoreCDKeyLength)
m_CustomStatstring = ReadSetting(SECTION_OVERRIDE, "SetBotStatstring", m_CustomStatstring)
m_ForceDefaultLocaleID = ReadSettingB(SECTION_OVERRIDE, "ForceDefaultLocaleId", m_ForceDefaultLocaleID)
m_CustomUDPString = ReadSetting(SECTION_OVERRIDE, "UdpString", m_CustomUDPString)
m_UDPString = ReadSetting(SECTION_OVERRIDE, "UdpString", m_UDPString)
m_CDKeyOwnerName = ReadSetting(SECTION_OVERRIDE, "OwnerName", m_CDKeyOwnerName)
m_UseLowerCasePassword = ReadSettingB(SECTION_OVERRIDE, "LowerCasePassword", m_UseLowerCasePassword)
m_IgnoreVersionCheck = ReadSettingB(SECTION_OVERRIDE, "Ignore0x51Reply", m_IgnoreVersionCheck)
@@ -2218,7 +2251,7 @@ Private Sub LoadVersion6Config()
m_UseUDP = ReadSettingB(SECTION_EMULATION, "UseUDP", m_UseUDP)
m_CustomStatstring = ReadSetting(SECTION_EMULATION, "CustomStatstring", m_CustomStatstring)
m_ForceDefaultLocaleID = ReadSettingB(SECTION_EMULATION, "ForceDefaultLocaleID", m_ForceDefaultLocaleID)
m_CustomUDPString = ReadSetting(SECTION_EMULATION, "UDPString", m_CustomUDPString)
m_UDPString = ReadSetting(SECTION_EMULATION, "UDPString", m_UDPString)
m_CDKeyOwnerName = ReadSetting(SECTION_EMULATION, "KeyOwner", m_CDKeyOwnerName)
m_UseLowerCasePassword = ReadSettingB(SECTION_EMULATION, "LowerCasePassword", m_UseLowerCasePassword)
m_IgnoreVersionCheck = ReadSettingB(SECTION_EMULATION, "IgnoreVersionCheck", m_IgnoreVersionCheck)
@@ -2229,6 +2262,9 @@ Private Sub LoadVersion6Config()
m_RegisterEmailAction = ReadSetting(SECTION_EMULATION, "RegisterEmailAction", m_RegisterEmailAction)
m_RegisterEmailDefault = ReadSetting(SECTION_EMULATION, "RegisterEmailDefault", m_RegisterEmailDefault)
m_RealmServerPassword = ReadSetting(SECTION_EMULATION, "RealmServerPassword", m_RealmServerPassword)
m_ProtocolID = ReadSettingL(SECTION_EMULATION, "ProtocolID", m_ProtocolID)
m_PlatformID = ReadSetting(SECTION_EMULATION, "PlatformID", m_PlatformID)
m_ProductLanguage = ReadSetting(SECTION_EMULATION, "ProductLanguage", m_ProductLanguage)

m_DebugWarden = ReadSettingB(SECTION_DEBUG, "Warden", m_DebugWarden)

@@ -261,7 +261,7 @@ On Error GoTo ERROR_HANDLER:
Dim pBuff As New clsDataBuffer

With pBuff
.InsertDWord GetDWORDOverride("PlatID", PLATFORM_INTEL) 'Platform ID
.InsertDWord GetDWORDOverride(Config.PlatformID) 'Platform ID
.InsertDWord GetDWORD(BotVars.Product) 'Product ID
.InsertDWord IIf(lVerByte = 0, GetVerByte(BotVars.Product), lVerByte) 'VersionByte
.InsertDWord 0 'Unknown
@@ -355,7 +355,7 @@ On Error GoTo ERROR_HANDLER:

Dim pBuff As New clsDataBuffer
With pBuff
.InsertDWord GetDWORDOverride("PlatID", PLATFORM_INTEL) 'Platform ID
.InsertDWord GetDWORDOverride(Config.PlatformID) 'Platform ID
.InsertDWord GetDWORD(BotVars.Product) 'Product ID
.InsertDWord IIf(lVerByte = 0, GetVerByte(BotVars.Product), lVerByte) 'VersionByte
.InsertDWord ds.CRevVersion 'Exe Version
@@ -649,11 +649,7 @@ On Error GoTo ERROR_HANDLER:

Dim pBuff As New clsDataBuffer

If Len(Config.CustomUDPString) = 4 Then
pBuff.InsertNonNTString Config.CustomUDPString
Else
pBuff.InsertDWord &H626E6574 'bnet
End If
pBuff.InsertDWord GetDWORDOverride(Config.UDPString, &H626E6574) 'default: bnet
pBuff.SendPacket SID_UDPPINGRESPONSE

Set pBuff = Nothing
@@ -1378,11 +1374,11 @@ On Error GoTo ERROR_HANDLER:

With pBuff

.InsertDWord GetLongOverride("ProtID", 0) 'ProtocolID
.InsertDWord GetDWORDOverride("PlatID", PLATFORM_INTEL) 'Platform ID
.InsertDWord Config.ProtocolID 'ProtocolID
.InsertDWord GetDWORDOverride(Config.PlatformID, PLATFORM_INTEL) 'Platform ID
.InsertDWord GetDWORD(BotVars.Product) 'Product ID
.InsertDWord IIf(lVerByte = 0, GetVerByte(BotVars.Product), lVerByte) 'VersionByte
.InsertDWord GetLongOverride("ProdLang", 0) 'Product Language
.InsertDWord GetDWORDOverride(Config.ProductLanguage) 'Product Language
.InsertDWord LocalIP 'Local IP
.InsertDWord GetTimeZoneBias 'Time Zone Bias
If Config.ForceDefaultLocaleID Then
@@ -1850,10 +1846,6 @@ On Error GoTo ERROR_HANDLER:

lRet = GetProductInfo(sProduct).KeyCount

sOverride = ReadCfg$("Override", StringFormat("{0}KeyCount", GetProductKey))

If (LenB(sOverride) > 0 And StrictIsNumeric(sOverride)) Then lRet = CLng(sOverride)

GetCDKeyCount = lRet
Exit Function
ERROR_HANDLER:
@@ -1894,40 +1886,16 @@ ERROR_HANDLER:
StringFormat("Error: #{0}: {1} in {2}.GetLogonSystem()", Err.Number, Err.description, OBJECT_NAME))
End Function

'This will return a Long, that is Overrideable by the config, based on product ID, with a default.
'GetProdLongOverride("ProtId", 0, PRODUCT_DRTL) would return 0, unless the user had D1ProtID= something in there config
Private Function GetLongOverride(sKey As String, lDefault As Long) As Long
On Error GoTo ERROR_HANDLER:

Dim sOverride As String
Dim lRet As Long

lRet = lDefault

sOverride = ReadCfg$("Override", StringFormat("{0}{1}", GetProductKey, sKey))

If (LenB(sOverride) > 0 And StrictIsNumeric(sOverride)) Then lRet = CLng(sOverride)

GetLongOverride = lRet
Exit Function
ERROR_HANDLER:
GetLongOverride = lRet
Call frmChat.AddChat(RTBColors.ErrorMessageText, _
StringFormat("Error: #{0}: {1} in {2}.GetLongOverride()", Err.Number, Err.description, OBJECT_NAME))
End Function

'Same as above, except converts the override data to a dword (EXA: "68XI" to 0x49583836)
Private Function GetDWORDOverride(sKey As String, lDefault As Long) As Long
'Converts the normalized (forward: IX86, STAR, etc) string representation of a DWORD into it's numeric equivalent.
Private Function GetDWORDOverride(ByVal sDwordString As String, Optional ByVal lDefault As Long = 0) As Long
On Error GoTo ERROR_HANDLER:

Dim sOverride As String
Dim lRet As Long

lRet = lDefault

sOverride = ReadCfg$("Override", StringFormat("{0}{1}", GetProductKey, sKey))

If (LenB(sOverride) > 0) Then lRet = GetDWORD(sOverride)
If ((LenB(sDwordString) > 0) And (Len(sDwordString) < 5)) Then
lRet = GetDWORD(StrReverse(sDwordString))
End If

GetDWORDOverride = lRet
Exit Function

0 comments on commit 6e3612a

Please sign in to comment.
You can’t perform that action at this time.