Go Back   BWHacks > Development > Reverse Engineering > Code Snippets and Tutorials

Code Snippets and Tutorials The place for open source releases, great information, and tutorials written by other members.

Reply
 
LinkBack Thread Tools

Old 04-13-2007, 05:56 PM   #1 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default [WarCraft III] Game State Checking (v1.21)

Thanks again to Palomino's notes for clarification on the global class.

Code:
.data

        WC3FXN_GlobalClass      dd 6F84CC20h 

.code

Warcraft_CheckGameState proc

        ;Get the pointer to Warcraft's global class.
        mov eax, WC3FXN_GlobalClass
        mov eax, dword ptr ds:[eax]

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

Warcraft_CheckGameState endp
Perma 15 0FF11|\|3   Reply With Quote
Advertisement
 
Advertisement
Advertisement Sponsored links


Old 08-06-2007, 08:41 PM   #2 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

Moved to the Warcraft hacking related section.
Perma 15 0FF11|\|3   Reply With Quote

Old 08-06-2007, 10:13 PM   #3 (permalink)
SC_Modder
Loading javascript...
Senior Member
Moderator

Inquisitor
 
SC_Modder's Avatar
 
Join Date: Nov 2004
Posts: 4,523
SC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond repute
Send a message via AIM to SC_Modder
Default

uhm, wouldn't you be better off just doing, say:
Code:
Warcraft_CheckGameState proc

        ;Get the pointer to Warcraft's global class.
        mov eax, WC3FXN_GlobalClass
        mov eax, dword ptr ds:[eax]

        ;Check to see if we're in a game and return true/false.
        mov eax, dword ptr ds:[eax+1AC]
        ret

Warcraft_CheckGameState endp
It'll still work the same way if you are using boolean logic.
__________________
AaronOpfer.com - My music
SC_Modder 15 0FF11|\|3   Reply With Quote

Old 08-06-2007, 10:48 PM   #4 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

Suppose it would.
Perma 15 0FF11|\|3   Reply With Quote

Old 09-20-2007, 05:34 PM   #5 (permalink)
tinman

Heretic
 
Join Date: Sep 2007
Posts: 14
tinman is on a distinguished road
Default

how do i implement the hooked function into my cheating program?
tinman 15 0FF11|\|3   Reply With Quote

Old 09-21-2007, 01:50 AM   #6 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

If your program is written in Masm, then you can simply do:

Code:
call Warcraft_CheckGameState
Perma 15 0FF11|\|3   Reply With Quote

Old 09-21-2007, 09:19 AM   #7 (permalink)
tinman

Heretic
 
Join Date: Sep 2007
Posts: 14
tinman is on a distinguished road
Default

i'm using C, inject an DLL that compiled with this function and call it when needed?
tinman 15 0FF11|\|3   Reply With Quote

Old 09-21-2007, 03:06 PM   #8 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

That's correct. It will return true if the user is in a game, and false if not.
Perma 15 0FF11|\|3   Reply With Quote

Old 09-21-2007, 05:17 PM   #9 (permalink)
tinman

Heretic
 
Join Date: Sep 2007
Posts: 14
tinman is on a distinguished road
Default

I tried the text out function and Game State checking function... both end up with fatal error after calling the functions.
tinman 15 0FF11|\|3   Reply With Quote

Old 09-21-2007, 10:24 PM   #10 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

Perhaps one of more C-oriented gurus can help you with this, but I assume that the function would have to be a naked function. Maybe post your converted C function here so I can check it?
Perma 15 0FF11|\|3   Reply With Quote

Old 09-22-2007, 09:13 AM   #11 (permalink)
tinman

Heretic
 
Join Date: Sep 2007
Posts: 14
tinman is on a distinguished road
Default

Code:
int Warcraft_CheckGameState()
{
	static int WC3FXN_GlobalClass = 0x6F84CC20;
	__asm
	{
		;Get the pointer to Warcraft's global class.
		mov eax, WC3FXN_GlobalClass
		mov eax, dword ptr ds:[eax]

		;Check to see if we're in a game and return true/false.
		mov eax, dword ptr ds:[eax+1AC]
		ret  
	}
}
tinman 15 0FF11|\|3   Reply With Quote

Old 09-22-2007, 05:35 PM   #12 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

Pretty sure the address should be stored as a long, and I don't think you can use those comments in C either.
Perma 15 0FF11|\|3   Reply With Quote

Old 09-23-2007, 03:40 AM   #13 (permalink)
dt
Administrator

Inquisitor
 
dt's Avatar
 
Join Date: Jul 2004
Location: Germany
Posts: 4,545
dt has a reputation beyond reputedt has a reputation beyond reputedt has a reputation beyond reputedt has a reputation beyond reputedt has a reputation beyond reputedt has a reputation beyond reputedt has a reputation beyond reputedt has a reputation beyond reputedt has a reputation beyond repute
Default

Code:
#define GameState (*(int*)(*(int*)0x6F84CC20+0x1AC))
Simple as that.
dt 15 0|\|11|\|3 |\|0\/\/   Reply With Quote

Old 09-23-2007, 06:14 AM   #14 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

What he said.
Perma 15 0FF11|\|3   Reply With Quote

Old 09-23-2007, 02:00 PM   #15 (permalink)
tinman

Heretic
 
Join Date: Sep 2007
Posts: 14
tinman is on a distinguished road
Default

Code:
int Warcraft_CheckGameState()
{
	static long WC3FXN_GlobalClass = 0x6F84CC20;
	__asm
	{
		mov eax, WC3FXN_GlobalClass
		mov eax, dword ptr ds:[eax]
		mov eax, dword ptr ds:[eax+0x1AC]
		ret
	}
}
these are the changes i made.
when it executes mov eax, dword ptr ds:[eax]
it still causes fatal error.
tinman 15 0FF11|\|3   Reply With Quote

Old 09-23-2007, 02:12 PM   #16 (permalink)
tinman

Heretic
 
Join Date: Sep 2007
Posts: 14
tinman is on a distinguished road
Default

Quote:
Originally Posted by dt View Post
Code:
#define GameState (*(int*)(*(int*)0x6F84CC20+0x1AC))
Simple as that.
simple statement... complicated pointers

1. get the pointer from 0x6F84CC20, assume it is A
2. A + 0x1AC, assume it is B
3. get the pointer from B, return the value.

Did i understand it correctly?

what is the purpose of the type cast (int *)?
tinman 15 0FF11|\|3   Reply With Quote

Old 07-18-2008, 03:58 PM   #17 (permalink)
oMBra

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

Can this be made with autoIT?
oMBra 15 0FF11|\|3   Reply With Quote

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

Quote:
Originally Posted by oMBra View Post
Can this be made with autoIT?
Of course, if AutoIt has the capability to read memory of another process.

The code in this thread seems to be obsolete, a updated version has been posted by Rufus in this thread.
Epsilon 15 0FF11|\|3   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Advertisement

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)