• Welcome to Valhalla Legends Archive.
 

[C++] Dynamic SCBW Verbyte Retrieval

Started by devcode, October 16, 2007, 08:52 PM

Previous topic - Next topic

devcode

http://www.bnetdocs.org/verbyte.html

Open source release motivated by Don Cullen, and you know what it is ;)

* Made a mistake, SEC_IMAGE from CreateFileMapping should be removed :o

Barabajagal

#1
Well, that simplifies matters a bit, doesn't it?

Got bored and ported it to vb:
Option Explicit
Private Declare Sub RtlMoveMemory Lib "kernel32" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Private Sub Form_Load()
Dim sData   As String
Dim I       As Long
Dim FindStr As String
Dim RVal    As Long
    Open "C:\Path\To\STAR\Starcraft.exe" For Binary Access Read As #1
    sData = Space(LOF(1))
    Get #1, , sData
    Close #1
    FindStr = Chr$(&HC7) & Chr$(&H46) & Chr$(&H10) & "????" & Chr$(&HC7) & Chr$(&H46) & Chr$(&H18) & "????" & Chr$(&HC7) & Chr$(&H46)
    For I = 1 To Len(sData)
        If Mid$(sData, I, 16) Like FindStr Then
            RtlMoveMemory RVal, ByVal Mid$(sData, I + 3, 4), 4
        End If
    Next I
    Debug.Print "VerByte: " & RVal
End Sub


(And no, I'm not planning on using it or taking any credit)

Edit: Works for War2 as well.

Don Cullen

Thanks DevCode for releasing it, it is certainly much appreciated. :)
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

devcode

Quote from: devcode on October 16, 2007, 08:52 PM
* Made a mistake, SEC_IMAGE from CreateFileMapping should be removed :o

and yea, guess it works for W2BN as well, not for any other games though, at least with the supplied pattern.

squiggly

Quote from: Andy on October 16, 2007, 09:14 PM
Well, that simplifies matters a bit, doesn't it?

Got bored and ported it to vb:
Option Explicit
Private Declare Sub RtlMoveMemory Lib "kernel32" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Private Sub Form_Load()
Dim sData   As String
Dim I       As Long
Dim FindStr As String
Dim RVal    As Long
    Open "C:\Path\To\STAR\Starcraft.exe" For Binary Access Read As #1
    sData = Space(LOF(1))
    Get #1, , sData
    Close #1
    FindStr = Chr$(&HC7) & Chr$(&H46) & Chr$(&H10) & "????" & Chr$(&HC7) & Chr$(&H46) & Chr$(&H18) & "????" & Chr$(&HC7) & Chr$(&H46)
    For I = 1 To Len(sData)
        If Mid$(sData, I, 16) Like FindStr Then
            RtlMoveMemory RVal, ByVal Mid$(sData, I + 3, 4), 4
        End If
    Next I
    Debug.Print "VerByte: " & RVal
End Sub


(And no, I'm not planning on using it or taking any credit)

Edit: Works for War2 as well.

What do you mean, got bored? You live on the side of a mountain in the middle of nowhere, what else do you have to do besides go on the internet and shoot squirrels for food?
- Posso usar um tradutor de lĂ­ngua, devo ser fresco agora!

Don Cullen

Lay off, squiggly. Don't flame him for his lifestyle preferences.
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Hdx

Anyone feel like finding the patterns for D2/WC3/JSTR and the like?
I would like to see how this stands up to a new patch. *sits down and waits for one*
But, What is the use? When it comes without a form of patching the files. You're pretty much not gunna find the hashes without finding the verbyte posted a long with it.
I can see where this would come in handy. (Working with stealthbot -.-) But I am merely concerned with it's reliability. But, We'll see.
~Hdx

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Don Cullen

Quote from: Hdx on October 16, 2007, 10:07 PM
Anyone feel like finding the patterns for D2/WC3/JSTR and the like?
I would like to see how this stands up to a new patch. *sits down and waits for one*
But, What is the use? When it comes without a form of patching the files. You're pretty much not gunna find the hashes without finding the verbyte posted a long with it.
I can see where this would come in handy. (Working with stealthbot -.-) But I am merely concerned with it's reliability. But, We'll see.
~Hdx

RealityRipple is working on it.

As for patches:

http://img148.imageshack.us/img148/6759/vbyteow4.png

DevCode tested it against various versions of Starcraft, and all of them apparently came up with the correct VerBytes. So I assume it would work for future patches.
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Warrior

Quote from: squiggly on October 16, 2007, 10:03 PM
What do you mean, got bored? You live on the side of a mountain in the middle of nowhere, what else do you have to do besides go on the internet and shoot squirrels for food?

I want to be like you.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Hdx

Would you mind e-mailing me any past hash files you have? (By any I mean any product, Any version)
Zip em on up.
~Hdx

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Don Cullen

For StarCraft?

I don't have any past hashes, but I could ask DevCode to send them to me so I can host them on bnetdocs.
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Hdx

Well, Anyone with any old hashes. I would be interested in obtaining.
BUT, I would highly advise against hosting the files on Redux. Thats just asking for a DMCA.
~Hdx

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

devcode

Quote from: Warrior on October 16, 2007, 10:14 PM
Quote from: squiggly on October 16, 2007, 10:03 PM
What do you mean, got bored? You live on the side of a mountain in the middle of nowhere, what else do you have to do besides go on the internet and shoot squirrels for food?

I want to be like you.

You want to be like him and he wants to be like me, so I'm making the deduction here that you want to be like me??!?

Yegg

Quote from: Hdx on October 16, 2007, 10:14 PM
Would you mind e-mailing me any past hash files you have? (By any I mean any product, Any version)
Zip em on up.
~Hdx

Just a thought, but when you first install the game client, it has the oldest possible hash files for that particular game. When you run the client for the first time it updates to the latest hash files. Is there really a need to see if the pattern matching code works with any hash files other than the oldest hash files and the newest, assuming they [Battle.net] didn't use pattern A for the oldest hash files, pattern B for anything inbetween, and pattern A again for the newest? Unless I missed something, I'm pretty sure you just need the oldest hash files and the newest.

Barabajagal

Yegg: that's only if you have the oldest cd.

Topaz: No.

Everyone else: I don't care enough to gather all the other values. It's not that big of a deal to me. Someone else can do it.