Go Back   BWHacks > Development > Reverse Engineering

Reverse Engineering Game hacking discussion and open source development.

Reply
 
LinkBack Thread Tools

Old 07-18-2008, 11:56 PM   #1 (permalink)
Rufus
A God Among Men

Disciple
 
Rufus's Avatar
 
Join Date: May 2007
Posts: 423
Rufus is on a distinguished road
Default [Warcraft III] Game State Checking 1.22

Since no one posted an update to this yet :p.

This works by checking the opcode of a game class that is null unless you are inside a game.


Code:
Warcraft_CheckGameState proc
;//Game state checking function

.data
    FXN_GameClass dd 6FAA1988h

.code

    ;//Move GameClass into EAX
    mov eax, FXN_GameClass

    ;//Check to see if we're in a game and return true/false.
    .if byte ptr [eax] == 0h
        mov eax, 0
    .else
        mov eax, 1
    .endif
    ret

Warcraft_CheckGameState endp
__________________
Quote:
DrubZ says:
IpwnU would be a great hack name... cuz like.. it's right in ur face
Rufus is offline   Reply With Quote

Old 07-21-2008, 02:06 PM   #2 (permalink)
Epsilon
Mortal
 
Join Date: Jul 2008
Posts: 3
Epsilon is on a distinguished road
Default

Quote:
Originally Posted by Rufus View Post
Since no one posted an update to this yet :p.

This works by checking the opcode of a game class that is null unless you are inside a game.
I think it's not exactly a class, but the address of a global variable inside Game.dll's .data section which points to the address of the first member of a dynamically allocated structure.

Last edited by Epsilon : 07-21-2008 at 03:22 PM.
Epsilon is offline   Reply With Quote

Old 07-21-2008, 08:50 PM   #3 (permalink)
oMBra

Deviant
 
Join Date: Jul 2008
Posts: 41
oMBra is on a distinguished road
Default

can this be made with autoit?
oMBra is offline   Reply With Quote

Old 07-21-2008, 11:29 PM   #4 (permalink)
Rufus
A God Among Men

Disciple
 
Rufus's Avatar
 
Join Date: May 2007
Posts: 423
Rufus is on a distinguished road
Default

Quote:
Originally Posted by oMBra View Post
can this be made with autoit?
I have never used auto-it or any other cheap shot easy-make programs, but I'm sure if auto-it can read the process memory it shouldn't be a problem.
__________________
Quote:
DrubZ says:
IpwnU would be a great hack name... cuz like.. it's right in ur face
Rufus is offline   Reply With Quote

Old 07-22-2008, 11:03 AM   #5 (permalink)
oMBra

Deviant
 
Join Date: Jul 2008
Posts: 41
oMBra is on a distinguished road
Default

yes he can read / write etc but i dunno how to go to " mov eax, FXN_GameClass "... what language is that?

Last edited by oMBra : 07-22-2008 at 11:13 AM.
oMBra is offline   Reply With Quote

Old 07-22-2008, 11:24 AM   #6 (permalink)
Rufus
A God Among Men

Disciple
 
Rufus's Avatar
 
Join Date: May 2007
Posts: 423
Rufus is on a distinguished road
Default

ignore all that and just read the memory for offset 6FAA1988 and if its 00h it means no game is active.
__________________
Quote:
DrubZ says:
IpwnU would be a great hack name... cuz like.. it's right in ur face
Rufus is offline   Reply With Quote

Old 07-22-2008, 11:40 AM   #7 (permalink)
oMBra

Deviant
 
Join Date: Jul 2008
Posts: 41
oMBra is on a distinguished road
Default

with 00h do u mean the value located at that offset?
oMBra is offline   Reply With Quote

Old 07-22-2008, 11:42 AM   #8 (permalink)
Zephyrix
Ereetu.
Senior Member
Game Hacking Staff

High Priest
 
Zephyrix's Avatar
 
Join Date: Oct 2005
Location: xor 1D27,1337
Posts: 1,549
Zephyrix is a name known to allZephyrix is a name known to allZephyrix is a name known to allZephyrix is a name known to all
Default

Quote:
Originally Posted by oMBra View Post
with 00h do u mean the value located at that offset?
Precisely.
__________________


Zephyrix is offline   Reply With Quote

Old 07-22-2008, 11:52 AM   #9 (permalink)
oMBra

Deviant
 
Join Date: Jul 2008
Posts: 41
oMBra is on a distinguished road
Default

I searched it and I didnt found that
oMBra is offline   Reply With Quote

Old 07-22-2008, 10:10 PM   #10 (permalink)
Rufus
A God Among Men

Disciple
 
Rufus's Avatar
 
Join Date: May 2007
Posts: 423
Rufus is on a distinguished road
Default

Pretty sure you did not have to search for anything.
__________________
Quote:
DrubZ says:
IpwnU would be a great hack name... cuz like.. it's right in ur face
Rufus is offline   Reply With Quote

Old 07-24-2008, 04:17 AM   #11 (permalink)
Dyndrilliac

Blessed
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,333
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via MSN to Dyndrilliac
Default

Quote:
Originally Posted by Rufus View Post
This works by checking the opcode of a game class that is null unless you are inside a game.
Quote:
Originally Posted by Epsilon View Post
I think it's not exactly a class, but the address of a global variable inside Game.dll's .data section which points to the address of the first member of a dynamically allocated structure.
Actually, it's a byte pointer (a pointer to a byte).
__________________
Ultimate Guide/Resource/Tutorial/Book Thread
Technobabble! - My Blog About All Things Technological
Quote:
Originally Posted by Edsger W. Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.
Dyndrilliac is offline   Reply With Quote

Old 07-24-2008, 12:58 PM   #12 (permalink)
zev
Gold Member

Deviant
 
zev's Avatar
 
Join Date: Nov 2007
Posts: 73
zev is on a distinguished road
Default

Quote:
Originally Posted by Dyndrilliac View Post
Actually, it's a byte pointer (a pointer to a byte).
No, I don't think it is.

Blizzard most likely did it like this:

Code:
typedef struct tStructure {
        // Members
} STRUCTURE, *PSTRUCTURE;
 
PSTRUCTURE g_pStructure = ( PSTRUCTURE )malloc( sizeof( STRUCTURE ));
zev is offline   Reply With Quote

Old 07-24-2008, 03:51 PM   #13 (permalink)
Dyndrilliac

Blessed
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,333
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via MSN to Dyndrilliac
Default

You're wrong. Think about it. The code reads a value from a given address, which is always going to be a one or zero. This is traditionally called a boolean. And while a boolean could be fit into a single bit, bytes are the smallest common data unit, and it is more likely that Blizzard's developers simply used either C++'s intrinsic "bool" type, or C's "BOOL" typedef, both of which resolves to bytes. Therefore, an address that points to this byte, must therefore be a byte pointer. As a matter of fact, if you read the code, the address is placed in EAX, and then the code treats EAX as a byte pointer. Ipso facto, it's a byte pointer. While we're on the subject...
Code:
bool AreYouInGame() {
     return (*(BYTE*)(0x6FAA1988));
}
__________________
Ultimate Guide/Resource/Tutorial/Book Thread
Technobabble! - My Blog About All Things Technological
Quote:
Originally Posted by Edsger W. Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

Last edited by Dyndrilliac : 07-24-2008 at 04:06 PM.
Dyndrilliac is offline   Reply With Quote

Old 07-24-2008, 04:03 PM   #14 (permalink)
zev
Gold Member

Deviant
 
zev's Avatar
 
Join Date: Nov 2007
Posts: 73
zev is on a distinguished road
Default

Quote:
Originally Posted by Dyndrilliac View Post
You're wrong. Think about it. The code reads a value from a given address, which is always going to be a one or zero. This is traditionally called a boolean. And while a boolean could be fit into a single bit, bytes are the smallest common data unit, and it is more likely that Blizzard's developers simply used either C++'s intrinsic "bool" type, or C's "BOOL" typedef, both of which resolves to bytes. Therefore, an address that points to this byte, must therefore be a byte pointer. As a matter of fact, if you read the code, the address is placed in EAX, and then the code treats EAX as a byte pointer. Ipso facto, it's a byte pointer.
It does read an address which points to a class initialised at gamestart, if the user isn't ingame, it points to NULL.

I understand your logic, but I reversed those parts of Warcraft's game code myself and it's not a boolean.

Of course, you can still apply boolean logic to it :p

Although, it could be that we'r talking about different topics, are you refering to Rufus' code or to the actual data?

Last edited by zev : 07-24-2008 at 04:09 PM.
zev is offline   Reply With Quote

Old 07-24-2008, 04:11 PM   #15 (permalink)
Dyndrilliac

Blessed
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,333
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via MSN to Dyndrilliac
Default

...

Ok, I don't know how else to say this. What the **** do you think NULL is? It's a constant for zero. If a piece of data can only be a one or a zero, it is a boolean. Not a pointer to the instance of a class. Do you know why? Because if it were a pointer to the instance of a class, checking for one would not work. The data would be the address at memory where the instance of the class is located, and thus the gamestate check function that was posted would fail.
__________________
Ultimate Guide/Resource/Tutorial/Book Thread
Technobabble! - My Blog About All Things Technological
Quote:
Originally Posted by Edsger W. Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.
Dyndrilliac is offline   Reply With Quote

Old 07-24-2008, 04:22 PM   #16 (permalink)
zev
Gold Member

Deviant
 
zev's Avatar
 
Join Date: Nov 2007
Posts: 73
zev is on a distinguished road
Default

Quote:
Originally Posted by Dyndrilliac View Post
...

Ok, I don't know how else to say this. What the **** do you think NULL is? It's a constant for zero. If a piece of data can only be a one or a zero, it is a boolean. Not a pointer to the instance of a class. Do you know why? Because if it were a pointer to the instance of a class, checking for one would not work. The data would be the address at memory where the instance of the class is located, and thus the gamestate check function that was posted would fail.

Not in game:


In game:


Just because you can apply boolean logic to it, doesn't mean that it was implemented as a boolean by the Blizzard programmer.

The code posted in this thread doesn't check for one either, it checks for 0.
( It could be heavily improved by using boolean logic, though )

Last edited by zev : 07-24-2008 at 04:39 PM.
zev is offline   Reply With Quote

Old 07-24-2008, 05:06 PM   #17 (permalink)
Dyndrilliac

Blessed
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,333
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future