Author | Message | Time |
---|---|---|
soccerist | I am designing a bot in Linux using g++. That mentioned, I was wondering if anyone had information on how to extract the exe version from the starcraft.exe executable. I did a hexdump of starcraft.exe to look for the 4-byte exe version i packetlogged. I'm pretty sure it's not just an offset in the file though. I'm looking for the methods and the process behind extracting it. Any resources would be appreciated as well. | April 3, 2004, 8:27 PM |
UserLoser. | The values come from a function called CheckRevision. This is found in the DLLs extracted from the MPQ specified by Battle.net during the logon process | April 3, 2004, 9:51 PM |
soccerist | [quote]The values come from a function called CheckRevision.[/quote] The EXE Version of a file surely does not come from a function? If the version of an executable IS stored in DLLs, how exactly is that value extracted? I'm looking to write my own function to extract this value, not use someone else's CheckRevision function. | April 3, 2004, 10:15 PM |
Stealth | The value is calculated by CheckRevision(). | April 3, 2004, 10:57 PM |
UserLoser. | [quote author=soccerist link=board=17;threadid=6144;start=0#msg53378 date=1081030512] [quote]The values come from a function called CheckRevision.[/quote] The EXE Version of a file surely does not come from a function? If the version of an executable IS stored in DLLs, how exactly is that value extracted? I'm looking to write my own function to extract this value, not use someone else's CheckRevision function. [/quote] CheckRevision is the function that the real game clients use which was written by Blizzard. It is called from example: IX86ver1.dll. (which can be extracted from IX86ver1.mpq, via Storm.dll. These MPQs are downloaded from Battle.net during the logon process, packet log a connection on any Battle.net client and see for your self) If you want to write your own function, then I suggest you do some disassembly in the versioning DLLs to figure it out. | April 3, 2004, 11:47 PM |
Arta | The version is in the exe's resource info. Getting that under win32 is pretty easy (GetFileVersionInfoSize/GetFileVersionInfo/VerQueryValue), but I have no idea how you'd do it under linux. Version *bytes* on the other hand are different. That value isn't present in the exe. You just have to know it. Edit: CheckRevision gets this value for you (someone mentioned that ) and CheckRevision has been ported to linux. You might want to look into finding an open source linux bot (perhaps prolix?) and having a dig around. | April 4, 2004, 1:55 AM |
iago | As far as I know, it's just hardcoded 0x0101001 (or whatever it is) into it. I'm pretty sure those are windows-specific functions since they read information about windows exe files. | April 4, 2004, 2:22 AM |
soccerist | [quote]The version is in the exe's resource info. Getting that under win32 is pretty easy (GetFileVersionInfoSize/GetFileVersionInfo/VerQueryValue), but I have no idea how you'd do it under linux. [/quote] Arta[vL], This is EXACTLY the problem I have run into. I'm trying to figure out how I would do it. It would be nice to understand more about the exe's resource info in the process as well. [quote]Edit: CheckRevision gets this value for you (someone mentioned that ) and CheckRevision has been ported to linux. You might want to look into finding an open source linux bot (perhaps prolix?) and having a dig around.[/quote] Prolix has the value hardcoded as a random value. Prolix was made for bnetd, which is in many ways similar to the actual Battle.net(tm). The only difference is that Bnetd is not as strict for logon values. [quote]As far as I know, it's just hardcoded 0x0101001 (or whatever it is) into it. I'm pretty sure those are windows-specific functions since they read information about windows exe files.[/quote] I'm sure there is a way to do it without hardcoding. I am trying to avoid hardcoding if possible. If a new version of starcraft comes out, my value would be incorrect. The GetFileVersionInfoSize/GetFileVersionInfo/VerQueryValue ARE windows-specific functions (windows.h) which are not part of the c++ standard. (I realize that these functions were actually written before C++'s time, in C, but are available in VC++ and VB (maybe?). My point is, they _were_ written at some point in time, so there's a way to do it. All in all, I suppose what I am asking is if anyone knows what they really do. | April 4, 2004, 3:58 AM |
Soul Taker | You could always request the version byte from BNLS if you have to. | April 4, 2004, 5:31 PM |
iago | [quote author=Soul Taker link=board=17;threadid=6144;start=0#msg53429 date=1081099893] You could always request the version byte from BNLS if you have to. [/quote] Yes, and then you wouldn't have had a version byte for the last 16 hours :P | April 4, 2004, 5:51 PM |
Arta | You'll have to read up on the format of resource data then :) | April 4, 2004, 6:09 PM |
zorm | Well I was going to say to take a look at zDSBot, however, those values are hardcoded which is another option you have givin how little they change. | April 4, 2004, 7:43 PM |
Adron | [quote author=soccerist link=board=17;threadid=6144;start=0#msg53426 date=1081051134] All in all, I suppose what I am asking is if anyone knows what they really do. [/quote] Soulburner was recently doing this (rewriting the version resource finding functions) and got a lot of help from some routines in wine. You might want to go look there. You can also parse out the exe headers yourself, the version info is a resource, so all you have to do is find the resources, look up the right one, and read the information. I found the structure definitions for exe files in winnt.h in msvc, I'm sure there are definitions in the wine headers as well. | April 4, 2004, 11:12 PM |
soccerist | Wow, thx Adron. I should have thought to look at wine. ::) I'm curious what structure definitions are in winnt.h. I'll try to get ahold of it somewhere to take a peek. Thx all for your help. | April 5, 2004, 4:27 AM |
iago | And of course, if you figure it out, don't forget to post your solution here :) | April 5, 2004, 9:30 AM |
Soul Taker | [quote author=iago link=board=17;threadid=6144;start=0#msg53432 date=1081101077] [quote author=Soul Taker link=board=17;threadid=6144;start=0#msg53429 date=1081099893] You could always request the version byte from BNLS if you have to. [/quote] Yes, and then you wouldn't have had a version byte for the last 16 hours :P [/quote] Yea, that's the only thing I hate about BNLS. But... what are you gonna do *shrug*. | April 5, 2004, 10:35 AM |
soccerist | [quote] And of course, if you figure it out, don't forget to post your solution here[/quote] Gladly ;) | April 5, 2004, 12:02 PM |
soccerist | [quote author=Adron link=board=17;threadid=6144;start=0#msg53473 date=1081120357] Soulburner was recently doing this (rewriting the version resource finding functions) and got a lot of help from some routines in wine. You might want to go look there. [/quote] Does anyone know how I can get in contact with Soulburner? I took a look at wine and went through some of the code for it. (wine is huge!) Apparently wine comes with it's own compiler, winegcc to compile your programs linking to the wine libraries so that the windows API is functional. What I tried to do was create a working program that's sole purpose is to extract the version. I got my mini program to compile, but it crashed upon execution. Running starcraft under wine works untill I try to log on to bnet. Partially through the bnet login, starcraft crashes. (hmm...) Maybe wine's still having problems with some of the functions I need? It'd be nice to ask Soulburner about some of what he has done. | May 6, 2004, 7:34 PM |
Forged | I hate wine, it is the devils program... | May 7, 2004, 2:27 AM |
Dyndrilliac | Wouldn't the Version Byte be in Battle.snp or Storm.dll instead(depending on which of them handles login routines) of the executable anyway? | May 7, 2004, 2:32 AM |
LoRd | [quote author=Dyndrilliac link=board=17;threadid=6144;start=15#msg58879 date=1083897122] Wouldn't the Version Byte be in Battle.snp or Storm.dll instead(depending on which of them handles login routines) of the executable anyway? [/quote] The version byte and the file version are two different things. | May 7, 2004, 4:45 AM |
UserLoser. | [quote author=Dyndrilliac link=board=17;threadid=6144;start=15#msg58879 date=1083897122] Wouldn't the Version Byte be in Battle.snp or Storm.dll instead(depending on which of them handles login routines) of the executable anyway? [/quote] Battle.snp handles most of the Battle.net connection related stuff in games such as Starcraft, Warcraft II, Diablo. I believe the version byte is passed over from Storm.dll into Battle.snp, but not sure exactly how/where yet. | May 7, 2004, 12:22 PM |