Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Mesiah / haiseM on February 12, 2003, 05:11 PM

Title: Checkrevision: Checksum value
Post by: Mesiah / haiseM on February 12, 2003, 05:11 PM
Im sure lots of people use CheckVersion or CheckRevision

Result = CheckVersion(HashDir & "starcraft.exe", HashDir & "storm.dll", HashDir & "battle.snp", Hash, version, Checksum, ExeInfo, MPQName)

pBuffer.InsertDWORD Checksum

I was wondering if anybody has any info on how that checksum is actually calculated, not source code, just how its reached.
Title: What would you like to know more about?
Post by: Kp on February 12, 2003, 08:10 PM
The checksum is reached by modifying in-memory variables based on the contents of the file.  Thus, if the file is corrupt or an incorrect version, the final result of the variable will be wrong and the server will reject you.  Of course, you could've guessed this from reading the source to that function.  Similarly, you could get the details of exactly what is done to arrive at the value by reading the function.  Different people use different variations of CheckRevision, some of which are more efficient than others; therefore, I can't add comments to the one you're using since I don't have it. :)

If you'll post back with a more specific question, I can try to offer a better answer.
Title: Re: Checkrevision: Checksum value
Post by: Atom@school on February 13, 2003, 04:33 AM
Ok i understand all that, but why do i sometimes get a different result?
Title: Different result
Post by: Kp on February 13, 2003, 06:12 AM
You mean, you receive a value other than what the server wanted?  Two potential answers to this:

1) The server changed its mind about the current "correct" answer before you responded.  Given the low number of clients in existence versus the high number of people connecting at any given time, it would make sense to cache the results of a checkrevision serverside.  That is, it comes up with some answer and says "For the next 2 minutes, this is the correct answer for Brood War logons."  If you happen to connect and get the version string seconds before it's due to change, you might not get your result back until the answer has changed - at which point, you are now "wrong."  This is simply bad luck, and really cannot be avoided without predicting when the answer will change and timing your version checks accordingly.  As far as I know, none outside Blizzard can make such a prediction with any accuracy.
2) Your implementation is flawed.  Some behavior of the checksumming algorithm was not properly duplicated in the implementation you're using.  You'll need to identify what is incorrect and fix it.
Title: Re: Checkrevision: Checksum value
Post by: Mesiah / haiseM on February 13, 2003, 10:12 AM
What i wanted to find out is how to calculate it based on the mpq ver and hash equation. Im horrible at math, and reading the c++ source (a language i dont know :() totally confused me, i just wanted to know if there was any way if i could return the checksum value from a website, cause i dont have any 24/7 computer to run a remote hashing server, i just wanted to do somethin simple for my bots brood war login, so it doesnt require local hashing or file updating, im guessing thats not really possible..
Title: Re: Checkrevision: Checksum value
Post by: Yoni on February 13, 2003, 11:17 AM
Hi? BNLS (http://www.valhallalegends.com/yoni/BNLSProtocolSpec.txt) has done that (and more) for months!
Title: Re: Checkrevision: Checksum value
Post by: Mesiah / haiseM on February 13, 2003, 12:00 PM
Quotei just wanted to do somethin simple

Dont want to have to use a whole new binary protocol server just to login, wanted something mega mega simple.
Title: Re: Checkrevision: Checksum value
Post by: UserLoser on February 13, 2003, 12:49 PM
What about adding game or realm support to BNLS? I'm the lazy type sortof :-/
Title: Re: Checkrevision: Checksum value
Post by: Noodlez on February 13, 2003, 01:38 PM
you can connect to realm using BNLS
Title: Re: Checkrevision: Checksum value
Post by: UserLoser on February 13, 2003, 02:39 PM
Is there something I havn't seen on the BNLS document? Last time i looked...last update was changing the server or adding the 2nd one or something...
Title: Re: Checkrevision: Checksum value
Post by: Yoni on February 14, 2003, 01:44 AM
QuoteDont want to have to use a whole new binary protocol server just to login, wanted something mega mega simple.
How simple can it get? All you have to do is connect, authorize (the function for generating an authorization checksum is *given* in the specification in both VB and C++), and use the version check packet (which seems to be the only packet you care about at this moment). It's all documented in the specification, and you only care about 3 BNLS packets (2 to authorize and 1 to CheckRevision), so you don't even have to read the whole thing.

If you change your mind, ask me on Battle.net and I'll make you an account.

Noodlez/UserLoser: BNLS doesn't have any support for realm logons. It probably never will. The realm logon is documented in BnetDocs and there is no special processing of any kind that needs to be done. You just copy a data block from the chat server to the realm server.
Title: Re: Checkrevision: Checksum value
Post by: Noodlez on February 14, 2003, 07:35 AM
you need to use hashdata though yoni! :-p
Title: Re: Checkrevision: Checksum value
Post by: Mesiah / haiseM on February 14, 2003, 09:42 AM
Yoni, i dont want any authorization or crap like that, it delays login time. I just wanted to send all the stuff required to reach the checksum value, to a script on my site, calculate it, and echo the value back to the bot. thats what i mean when i say simple. IIRC, i already have a bnls account.
Title: Re: Checkrevision: Checksum value
Post by: Yoni on February 14, 2003, 10:22 AM
Quoteyou need to use hashdata though yoni! :-p
Not if you just want to CheckRevision.
Title: Re: Checkrevision: Checksum value
Post by: Noodlez on February 14, 2003, 09:05 PM
userloser was saying you need to add realm support to bnls, i said there already is (hashdata is all you need) ..not talking about checkrevision
Title: Re: Checkrevision: Checksum value
Post by: Atom on February 15, 2003, 04:26 AM
I dont understand why people want to send 3 BNLS packets for one Battle.net Packet.