Hello everyone!
I need to hook the move function of my character in Nostale and use it in c#/c++, can someone help me to do this?
I need to hook the move function of my character in Nostale and use it in c#/c++, can someone help me to do this?
unsigned newPosition = 0x000A000A;
DWORD walkAddress = 0x00490A40;
void __declspec(naked) ourFunct() {
__asm {
mov eax, myPosition
mov edx, newPosition
call walkAddress
}
}
Looks like you use dynamic addresses and no static address. Dynamic addresses vary everytime you run Nostale and allocate new memory.Quote:
Code:unsigned newPosition = 0x000A000A; DWORD walkAddress = 0x00490A40; void __declspec(naked) ourFunct() { __asm { mov eax, myPosition mov edx, newPosition call walkAddress } }
Remember that declaring your function with "naked" removes the prolog and epilog from it (cf [Only registered and activated users can see links. Click Here To Register...]).Quote:
Can someone help me?
I've wrote the asm but when I execute it, the game crashes.
Code:unsigned newPosition = 0x000A000A; DWORD walkAddress = 0x00490A40; void __declspec(naked) ourFunct() { __asm { mov eax, myPosition mov edx, newPosition call walkAddress } }
unsigned newPosition = 0x000A000A;
DWORD walkAddress = 0x00490A40;
void __declspec(naked) ourFunct() {
__asm {
mov eax, myPosition
mov edx, newPosition
call walkAddress
ret
}
}
Hello IceTrailer and thank you for your reply,Quote:
Looks like you use dynamic addresses and no static address. Dynamic addresses vary everytime you run Nostale and allocate new memory.
You have to deduce which address writes to your dynamic address (you have to find the new one) and use then the pointer.
Hello DarkyZShadow and thank you for your reply,Quote:
Remember that declaring your function with "naked" removes the prolog and epilog from it (cf [Only registered and activated users can see links. Click Here To Register...]).
So you have to add the "ret" instruction at the end of your function else your program will continue to execute undefined instructions after the call to "walkAddress".
You can try something like that :
Code:unsigned newPosition = 0x000A000A; DWORD walkAddress = 0x00490A40; void __declspec(naked) ourFunct() { __asm { mov eax, myPosition mov edx, newPosition call walkAddress ret } }
How did you do that ? Using PUSHAD/POPFD instructions ? Also, try to save flags (PUSHFD/POPFD).Quote:
Hello DarkyZ and thank you for your reply,
I've added ret at the end but it doesn't work.
I've tryed also to set all the registers as they normally are before calling the function but steel it doesn't works.
unsigned newPosition = 0x000A000A;
DWORD walkAddress = 0x00490A40;
void __declspec(naked) ourFunct() {
__asm {
; Save registers & flags
pushad
pushfd
mov eax, myPosition
mov edx, newPosition
call walkAddress
; Restore flags & registers: don't forget to reverse the order
popfd
popad
ret
}
}
I've the move function:Quote:
How did you do that ? Using PUSHAD/POPFD instructions ? Also, try to save flags (PUSHFD/POPFD).
If it doesn't work, you probably have a problem when you call the "walk" function (bad address, bad parameters, ...)Code:unsigned newPosition = 0x000A000A; DWORD walkAddress = 0x00490A40; void __declspec(naked) ourFunct() { __asm { ; Save registers & flags pushad pushfd mov eax, myPosition mov edx, newPosition call walkAddress ; Restore flags & registers: don't forget to reverse the order popfd popad ret } }
NostaleClientX.exe+145309 - 6A 01 - push 01
NostaleClientX.exe+14530B - 33 C9 - xor ecx,ecx
NostaleClientX.exe+14530D - 8B 55 FC - mov edx,[ebp-04]
NostaleClientX.exe+145310 - A1 88B78600 - mov eax,[NostaleClientX.exe+46B788] { (0E2AADD0) }
NostaleClientX.exe+145315 - E8 2653FFFF - call NostaleClientX.exe+13A640