Yes, I am "Teh Gnube", and I suck at Vb6! I am tweaking a source to sort of get the feel of programming, and I want to implement BNCSUtil.
Currently, it almost works (I think), but when I compile, I get the error "User-defined variable type not defined", in this code:
'-------------------------------------------------
' SID_AUTH_INFO (0x50) Handler
'-------------------------------------------------
Private Sub HandleAuthInfo(P As Packet) '<-- Highlighted during error!
I don't know how to define "P As Packet", I think it is the Packet part that is throwing it, but again, I am not very knowledgeable on the topic. Please point me in the correct direction.
You are defining p as Packet. Did you declare what Packet is?
btw, a battle.net bot isn't a great way to learn a programming language, try simple things and work your way up.
Quote from: ### Teh Gnube ### on June 25, 2005, 03:21 PM
Yes, I am "Teh Gnube", and I suck at Vb6!
That's ok. Many of us don't know VB6 at all, and are better coders for our lack of support for such a terrible language.
Quote from: ### Teh Gnube ### on June 25, 2005, 03:21 PMI am tweaking a source to sort of get the feel of programming
I'm assuming this is an anonymous source? How does he/she feel about getting "tweaked" just so you can get a feeling? Does this source have any credible documents about abuses by powerful shadowy people?
Quote from: Kp on June 25, 2005, 03:29 PM
Quote from: ### Teh Gnube ### on June 25, 2005, 03:21 PM
Yes, I am "Teh Gnube", and I suck at Vb6!
That's ok. Many of us don't know VB6 at all, and are better coders for our lack of support for such a terrible language.
Quote from: ### Teh Gnube ### on June 25, 2005, 03:21 PMI am tweaking a source to sort of get the feel of programming
I'm assuming this is an anonymous source? How does he/she feel about getting "tweaked" just so you can get a feeling? Does this source have any credible documents about abuses by powerful shadowy people?
Looks like Cloaked's BNCSUtil example bot to me!
It is, well at least the "Connect" module. And I am tweaking a Truimph Bot, which is pretty much already known to be stolen, and the many owners of the scripts in that bot are well aware they are there. Also, I'm not planning to release it... I am actually doing this because my StarCraft disk is broken, and my WarCraft III is MIA... I am just looking to possibly pick up a coding language, as I code for my own personal use...
And I didn't define what a packet was either. Any pointers on how to do so? =\ Sorry to ask so much, but I would like to learn...
Dude....Don't use others sources and 'tweak' them -.-
Do NOT make a Binary bot your 'learning' project. -.-
If you don't know how to declair types, then you shouldn't be making a bot.
Public Type Packet
IDontKnowShitAboutProgrammingAndShouldntBeMakingABot as string
End Type
If you jsut want something to connect and chaton BNet use StealthBot (http://stealthbot.net)
Check This (http://www.vbtutor.net/vbtutor.html) out for some tutorials on VB.
~-~(HDX)~-~
Or you could not use StealthBot. And on top of that, ripping out the guts and putting in new ones is in no way "tweaking", that's full on changing. If you really want to make a Battle.Net bot, get a C++ compiler and a tutorial on telnet plaintext protocol.
The GNU compiler collection (GCC) (http://gcc.gnu.org/) supports C++ if you get the g++ package. I recommend GCC 3.3.6, so grab /releases/gcc-3.3.6/gcc-core-3.3.6.tar.bz2 and /releases/gcc-3.3.6/gcc-g++-3.3.6.tar.bz2 from any of the GCC mirror sites (http://gcc.gnu.org/mirrors.html). If you're stuck using a clunky OS like MS-Windows, check out MinGW (http://www.mingw.org/), a Windows port of GCC. Note that because Windows is such a braindamaged OS, it requires massive patches to the GCC core to produce a Windows-capable GCC, so MinGW may not be up with the latest patches. From looking at their download page (http://www.mingw.org/download.shtml), it looks like the latest 3.3.x GCC they have available (http://prdownloads.sf.net/mingw/gcc-core-3.3.1-20030804-1.tar.gz?download) is 3.3.1.
Also, see Telnet RFC (http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc0318.html) to learn about telnet.
On the topic of cross compilers: http://www.delorie.com/djgpp/
Quote from: Kp on June 26, 2005, 11:23 AM
The GNU compiler collection (GCC) (http://gcc.gnu.org/) supports C++ if you get the g++ package. I recommend GCC 3.3.6, so grab /releases/gcc-3.3.6/gcc-core-3.3.6.tar.bz2 and /releases/gcc-3.3.6/gcc-g++-3.3.6.tar.bz2 from any of the GCC mirror sites (http://gcc.gnu.org/mirrors.html). If you're stuck using a clunky OS like MS-Windows, check out MinGW (http://www.mingw.org/), a Windows port of GCC. Note that because Windows is such a braindamaged OS, it requires massive patches to the GCC core to produce a Windows-capable GCC, so MinGW may not be up with the latest patches. From looking at their download page (http://www.mingw.org/download.shtml), it looks like the latest 3.3.x GCC they have available (http://prdownloads.sf.net/mingw/gcc-core-3.3.1-20030804-1.tar.gz?download) is 3.3.1.
Also, see Telnet RFC (http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc0318.html) to learn about telnet.
MinGW works just fine for me, but if you realllllllllly don't want to bother, get Dev-C++ or something easy like it.
Quote from: rabbit on June 27, 2005, 11:18 AM
MinGW works just fine for me, but if you realllllllllly don't want to bother, get Dev-C++ or something easy like it.
Dev-C++ is just an IDE that uses MinGW as the compiler.
Yeah. It's good if you can't figure out MinGW or don't feel like installing all the packages.
I don't even see the point in addressing these topics anymore..People are just going to do whatever they want to do. The easy way out is usually the path most taken. *sigh*
Errr yeah, I am just doing as I think will work, so I have my packet thing cleared up (to an extent), but now am having another issue.
All right, so here it is:
Public Sub SendAuthInfo()
Dim P As Packet, VerByte As Long, Client As Long, GetSTARByte As String
Set P = New Packet 'Line of error
The error is I am using the "New" keyword incorrectly. I don't understand the concept of this keyword, and can't see how I am using it incorrectly. From what I can infer, it is telling the program that this is a new packet, not linked to any other packets sent... "Set P = New Packet" works in the Sub that preceeds the one above, that being:
Public Sub HandleData(Data As String, Length As Long)
Dim Position As Long
Dim P As Packet
Dim PacketID As Byte
Dim PacketLength As Long
'Packet buffer initializing...
Set P = New Packet
P.SetData Data
There, "Set P = New Packet" has no problems whatsoever... Well, I don't know much about the language, but I have picked up substantially more since my last post. Sooo let's hear the critiques and responses.
new needs to be written in lowercase, and it is only meaningful to assign its result to pointers or references, not instances of objects.
New cannot be written in lowercase, Visual Basic overrides it every time I do... And I had Packet defined incorrectly. I wasn't thinking when I was changing this code to meet my needs, and messed it up. Sorry.
Is packet defined as a class module? If not, then it's probably not an object, therefore, cannot use new.
UserLoser, you were correct, but I beat you to figuring it out. Packet was SUPPOSE to be a class module. (Yes, I'm probably one of the worst programmers around for not seeing that to begin with), so New was to be used there, I have it all working now... Except for one thing.
My bot cannot pass CheckRevision, it fails every time. I am not 100% sure what this is, but I know for a fact I have the correct hashes and verbyte... ANd I'm trying to log on VIA WarCraft III. Any knowledge as to why this would happen? O_o
Quote from: ### Teh Gnube ### on July 03, 2005, 07:22 PM
My bot cannot pass CheckRevision, it fails every time. I am not 100% sure what this is, but I know for a fact I have the correct hashes and verbyte... ANd I'm trying to log on VIA WarCraft III. Any knowledge as to why this would happen? O_o
Assuming you're doing everything (as in, building/formatting the message) correctly, outdated game files and/or bad version byte
With P
.InsertDWORD &H0
.InsertDWORD ARCH_IX86
.InsertDWORD CLIENT_WAR3
.InsertDWORD &H12
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertString "USA"
.InsertString "United States"
.Send frmMain.wS, SID_AUTH_INFO
And that is what is being sent, I assume it's all correct, it's just like the example (Exact...), unless that's incorrect somehow.
That is fine, (Tho I don't like having hardcoded vales...)
But thats only 0x50 we need to see how you handle 0x50 S->c and build 0x51 C->S
~-~-~(HDX)~-~
Well, since nothing was specified as to any parts you wanted to see of those things, here is how I handle 0x50:
Private Sub HandleAuthInfo(P As Packet)
Dim mpqNumber As Long, ChecksumFormula As String
Dim EXEVersion As Long, Checksum As Long, EXEInfo As String
Dim HashFiles(2) As String
Dim decoder As Long ' key decoder handle
Dim KeyHash As String, HashLength As Long
Dim ServerSignature As String * 128
Dim CDKey As String
Dim KeyOwner As Long
Dim O As Packet
Set O = New Packet
On Error GoTo LogonError
dAdd "[Battle.net] Parsing login information...", vbYelow
Select Case P.GetDWORD()
Case 0
UseNLS = False
Case 1
Disconnect
dAdd "[Local Host] Bad NLS system!", vbRed
Exit Sub
Case 2
UseNLS = True
Case Else
Disconnect
dAdd "[Battle.net] Bad logon sequence!", vbRed
Exit Sub
End Select
ServerToken = P.GetDWORD()
P.Skip 12 'Skip UDPvalue and MPQ filetime.
mpqNumber = extractMPQNumber(P.GetString())
If (mpqNumber < 0) Then
Disconnect
dAdd "[Battle.net] Bad MPQ number! (Bad hashes!)", vbRed
Exit Sub
End If
ChecksumFormula = P.GetString()
If (UseNLS) Then
ServerSignature = P.GetFixedString(128)
If (Not nls_check_socket_signature(frmMain.wS.SocketHandle, ServerSignature)) Then
Disconnect
dAdd "[Battle.net] Invalid server signature!", vbRed
End If
End If
GetHashFiles HashFiles
If (checkRevision(ChecksumFormula, HashFiles(0), HashFiles(1), _
HashFiles(2), mpqNumber, Checksum) = False) Then
dAdd "[Battle.net] Check Revision Failed!", vbRed
Disconnect
Exit Sub
ElseIf (checkRevision(ChecksumFormula, HashFiles(0), HashFiles(1), _
HashFiles(2), mpqNumber, Checksum) = True) Then
dAdd "[Battle.net] Check Revision passed!", vbGreen
End If
' Get EXE ver information...
EXEVersion = getExeInfo(HashFiles(0), EXEInfo)
If (EXEVersion = 0) Then
Disconnect
dAdd "[Battle.net] Failed to retrive hashing/EXE information!", vbRed
Exit Sub
End If
' Build SID_AUTH_CHECK
With O
.InsertDWORD ClientToken
.InsertDWORD EXEVersion
.InsertDWORD Checksum
.InsertDWORD 1 'CDKey
.InsertDWORD 0 ' Not using spawn.
' Decode the main CD-key.
decoder = kd_create(CDKey1, Len(CDKey))
If (decoder = -1) Then
Disconnect
dAdd "[Battle.net] Failed to decode your CD-key.", vbRed
Exit Sub
End If
' Calculate key hash.
HashLength = kd_calculateHash(decoder, ClientToken, ServerToken)
If (HashLength = 0) Then
Disconnect
dAdd "Failed to hash your CD-key.", vbRed
Exit Sub
End If
' Retrieve key hash.
KeyHash = String$(HashLength, vbNullChar) ' Initialize buffer.
Call kd_getHash(decoder, KeyHash)
' Adding to buffer...
.InsertDWORD Len(CDKey1)
.InsertDWORD kd_product(decoder)
.InsertDWORD kd_val1(decoder)
.InsertDWORD 0
.InsertNonNTString KeyHash
' Release the key decoder.
Call kd_free(decoder)
.InsertString EXEInfo
.InsertString "Jeremy Fischer"
.Send frmMain.wS, SID_AUTH_CHECK
End With
End Sub
Mmm, yeah, neat isn't it? It's just about exact as BNCSU Examble bot.
0x51, let's see, shall we? Again, it's exactly BNCSU Example bot's...
Public Sub HandleAuthCheck(P As Packet)
Dim strTmp As String
Select Case P.GetDWORD() 'Result
Case &H0
' OK.
Case &H100
Disconnect
dAdd "[Battle.net] Outdated game version!", vbRed
Exit Sub
Case &H101
Disconnect
dAdd "[Battle.net] Invalid game version!", vbRed
Exit Sub
Case &H200
Disconnect
dAdd "[Battle.net] Invalid CDKey!", vbRed
Exit Sub
Case &H201
Disconnect
strTmp = P.GetString()
If LenB(strTmp) > 0 Then
dAdd "[Battle.net] Key in use by " & strTmp, vbRed
Else
dAdd "[Battle.net] Key is in use by an unknown user!", vbRed
End If
Exit Sub
Case &H202
Disconnect
dAdd "[Battle.net] Key is banned!", vbRed
Exit Sub
Case &H203
Disconnect
dAdd "[Battle.net] Your key is for another game.", vbRed
Exit Sub
Case &H210 'IMPOSSIBLE FOR MY USES!
Disconnect
dAdd "[Fatal Error] This isn't possible, you aren't using W2XP or D2XP...", vbRed
Exit Sub
Case &H211
Disconnect
strTmp = P.GetString()
If LenB(strTmp) > 0 Then 'Ditto
Else
End If
Exit Sub
Case &H212 'Ditto
Disconnect
Exit Sub
Case &H213 'Ditto
Disconnect
Exit Sub
Case Else
Disconnect
dAdd "[Battle.net] Authorization failed for an unknown reason!", vbRed
End Select
If UseNLS Then
SendAuthLogon
Else
SendLogonResponse
End If
End Sub
Ok, that's complete... Not original, but complete. If you need 0x53 sender as well (SendAuthLogon), I can post it, but I don't think it's necesary.
Quote
dAdd "[Fatal Error] This isn't possible, you aren't using W2XP or D2XP...", vbRed
I didn't know w
2xp was online, and that it required a second cdkey...
Thanks * 10 for finding a typo, but I seriously doubt that one string would cause my bot to fail CRevisions... =/
honestly/ that thing should be broken up into atleast 3 diffrent subs. One to get the CRev() info,another to get the CDKey info, another to handel extracting from 0x50 and another to handel building 0x51. It's jsut cleaner IMO.
Show us the values for your vareables, when exiting the Checkrevision() function. Also, Why are you preforming it twice... it's a waist of time.
~-~(HDX)~-~
Hmmm, well, here is where I have pinpointed the error (as you probably have too...).
If (checkRevision(ChecksumFormula, HashFiles(0), HashFiles(1), _
HashFiles(2), mpqNumber, Checksum) = False) Then
dAdd "[Battle.net] Check Revision Failed!", vbRed
Disconnect
Exit Sub
'HashFiles(0) is "\WAR3\War3.exe"
'HashFiles(1) is "\WAR3\Storm.dll"
'HashFIles(2) is "\WAR3\Game.dll"
Uhhh, I think that's part of what you wanted... I may be wrong, feel free to clarify.
Use the full path. (App.Path & "\WAR\______.___")
Also, Don't use it in the if statement. Assighn it to a boolean and then use that.
~-~(HDX)~-~
Private Function HashFilesPath(strProduct as String)
Select Case strProduct
Case "SEXP", "STAR"
HashFiles(0) = App.Path & "\STAR\starcraft.exe"
HashFiles(1) = App.Path & "\STAR\storm.dll"
HashFiles(2) = App.Path & "\STAR\battle.snp"
Case "WAR3"
HashFiles(0) = App.Path & "\WAR3\war3.exe"
HashFiles(1) = App.Path & "\WAR3\storm.dll"
HashFiles(2) = App.Path & "\WAR3\game.dll"
Case "W3XP"
HashFiles(0) = App.Path & "\W3XP\war3.exe"
HashFiles(1) = App.Path & "\W3XP\storm.dll"
HashFiles(2) = App.Path & "\W3XP\game.dll"
End Select
End Function
This is just an example function of how you can establish the hashfiles.
Quote from: Archangel on July 04, 2005, 11:34 AM
Private Function HashFilesPath(strProduct as String)
' [snipped]
End Function
This is just an example function of how you can establish the hashfiles.
Or, if he'd "tweaked" the example bot properly:
'-------------------------------------------------
' Hash File Paths
'-------------------------------------------------
Public Sub GetHashFiles(Files() As String)
Select Case GetClient()
Case CLIENT_STAR, CLIENT_SEXP
Files(0) = frmMain.txtHashFolder.Text & "\starcraft.exe"
Files(1) = frmMain.txtHashFolder.Text & "\storm.dll"
Files(2) = frmMain.txtHashFolder.Text & "\battle.snp"
Case CLIENT_W2BN
Files(0) = frmMain.txtHashFolder.Text & "\WarCraft II BNE.exe"
Files(1) = frmMain.txtHashFolder.Text & "\storm.dll"
Files(2) = frmMain.txtHashFolder.Text & "\battle.snp"
Case CLIENT_D2DV, CLIENT_D2XP
Files(0) = frmMain.txtHashFolder.Text & "\Game.exe"
Files(1) = frmMain.txtHashFolder.Text & "\Bnclient.dll"
Files(2) = frmMain.txtHashFolder.Text & "\D2Client.dll"
Case CLIENT_WAR3, CLIENT_W3XP
Files(0) = frmMain.txtHashFolder.Text & "\war3.exe"
Files(1) = frmMain.txtHashFolder.Text & "\Storm.dll"
Files(2) = frmMain.txtHashFolder.Text & "\Game.dll"
End Select
End Sub
Of you can get that function on older bots source codes. :)
Thaaanks, that seems to have worked, maybe, every time I run the program through Visual Basic, it crashes the program... Uhhh, what's with that?
As an aside, wouldn't it be simpler to SetCurrentDirectoryW to the right place, and then use relative paths?
Maybe, but what's done is done... And I need to know why this program crashes every time I run it. ANY ideas?
Error message can be found here: http://frozengaming.net/error.PNG
I SS'd it... Uhhh, yep, no clue what's going wrong here. -_-
Your VB6 install is broken? ::shrug::
Most likely, you corrupted the stack somehow. Check the places where you modify the stack.
I don't understand what you mean by "stack"... I'm newb, remember? I can compile other things just fine, it's just this one project that crashes...
Does it crash when you connect or right when you start up?
If it's crashing during connection make sure you call KD_Init during startup, or before you send hashes out.
Public Declare Function kd_init Lib "bncsutil.dll" () As Long
Try opening the project from the main folder and not from the "Recently Opened" sometimes the project doesn't find the BNCSUtil Library.
Learn how to debug. Start the program, break on the first line, and step through line-by-line until you encounter the crash.
I don't know. That seems pretty obvious to me. But it seems like I've said that a lot lately.
Anyone want to do a debugging tutorial? We could have language experts respectively do one for their preferred environments.
Might be a good addition to BNBDR as well -- I know it was something we had talked about some time ago.
If you want to do the debugging tutorial, contact me. I have privacy enabled on AIM and MSN I believe, so if we haven't talked before, PM me to tell me your name on them, or PM me with your plan for the tutorial. I can get you more specific information that way as well.
Elneroth, thank you for your solution, it was correct. I hadn't thought to call kd_init, and sure enough there was my problem!
Quote from: ### Teh Gnube ### on July 05, 2005, 11:37 AM
Elneroth, thank you for your solution, it was correct. I hadn't thought to call kd_init, and sure enough there was my problem!
Now, how is that supposed to help him learn? Next project that he starts that crashes, he's going to say, "WTF, I'm not using BNCSUtil! Guys, how do I fix it?" Equip people to fix their own stuff, don't enable them.
If he'd started correctly, he could have said, "My program crashes when I call this BNCSUtil routine. What's wrong?" THEN it would have been TRULY beneficial to tell him about kd_init.
I know it was something in BNCS utility, and I knew where it was happening, I just hadn't paid close enough attention to the BNCS module to realize I was missing that, so yes, he actually DID help me, in my eyes.
Quote from: ### Teh Gnube ### on July 05, 2005, 12:24 PM
I know it was something in BNCS utility, and I knew where it was happening, I just hadn't paid close enough attention to the BNCS module to realize I was missing that, so yes, he actually DID help me, in my eyes.
Yeah, but it's a "give a man a fish" versus "teach a man to fish" type of thing. You need to learn how to properly debug these things on your own, or at least know enough to give relevant information to people here.
The purpose of support forums is to either point him in the right direction or help him directly.
You guys were telling him to look at other things.
Now, I could have just said, "Check your BNCSUtil", maybe you'll end up finding what's wrong on your own some day...
No, that doesnt' really help him, and I'm sure someone else would have most likely have said something related to "Oh yeah! You need to initialize BNCSUtil."
Now if I said, check to make sure you're "Initializing" it, it would have been the same thing I said to him.
You people need to learn how to stop flaming random people all over the place. I see it in like every post I see. No flaming = half the posts wouldn't be deleted.
Anyways, what's the point of posting if you're not improving anything here?
Wow, you told me I shouldn't have helped him quite that much, did you improve anything? No. All you did was add another little number to your post count. Whatever makes you happy. The next time you need to 'tell me to stop giving away so much help', just private message me.
You'll most likely post another low-life flame here again just to make me look stupid. But have fun, just another post being deleted.
-Elneroth
Alright, I appologize for that.
I was rather mad for the flaming I've been seeing lately.
I do suppose I could have taught him or let someone else do it.
And sorry, MyndFyre, I would have replied directly to your PM, but I want to appologize to whoever's dealing with this topic and not just you.
-elneroth
No problem dude, and I appreciate it. I know my tone can be harsh, but as I said in my PM, it's sometimes frustrating when we're trying to help people a little more than just a quick-fix engineering solution. :)
Quote from: shadypalm88 on July 05, 2005, 04:08 PM
Yeah, but it's a "give a man a fish" versus "teach a man to fish" type of thing. You need to learn how to properly debug these things on your own, or at least know enough to give relevant information to people here.
OT:
Give a man a fire and he'll be warm for a night.
Set a man on fire and he'll be warm for the rest of his life.