

![]() |
![]() |
|
|||||||
![]() |
![]() |
| Code Snippets and Tutorials The place for open source releases, great information, and tutorials written by other members. |
![]() |
|
|
LinkBack | Thread Tools |
![]() |
![]() |
|
|
#1 (permalink) |
|
rol 3905h, 8
Senior Member
Administrator ![]() ![]() Saint Join Date: Jul 2004
Location: Canada
Posts: 5,414
![]() |
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
|
|
|
|
![]() |
![]() |
|
Advertisement
|
|
![]() |
![]() |
|
|
#3 (permalink) |
|
Loading javascript...
Senior Member
Moderator ![]() Inquisitor |
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
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#10 (permalink) |
|
rol 3905h, 8
Senior Member
Administrator ![]() ![]() Saint Join Date: Jul 2004
Location: Canada
Posts: 5,414
![]() |
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?
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#11 (permalink) |
![]() Heretic Join Date: Sep 2007
Posts: 14
![]() |
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
}
}
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#15 (permalink) |
![]() Heretic Join Date: Sep 2007
Posts: 14
![]() |
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
}
}
when it executes mov eax, dword ptr ds:[eax] it still causes fatal error. |
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#16 (permalink) | |
![]() Heretic Join Date: Sep 2007
Posts: 14
![]() |
Quote:
![]() 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 *)? |
|
|
|
|
![]() |
![]() |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |