PRoblem with ps_login hook

05/31/2017 18:38 wurstbrot123#1
Hello guys, i currently ran into a problem while
hooking the Function at 0x406A30 in ps_login.exe.

While the hook works totally fine when my function is
empty ->

Code:
int __fastcall TryLogin( DWORD ecx, DWORD edx, char* username,char* password, int unkw, int unkw2, char* ip )
{
	return oLogin( ecx, edx, username, password, unkw, unkw2, ip );
}
as soon as i add code to it, ps_login will crash. While it doesnt
crash inside the hooked function or after returning, it crashes
somewhat later when it wants to return to the code
that calls the function at 406A30. The Reason is it returns
to the wrong address. So if someone could help with this one
it would be awesome =)

ps:
The original Function is also called with the right arguments etc :3

edit:
posted in the wrong section but already reported that :p

e:
The cause is obviously a stack problem and i could probly fix
that by manipulating the add esp before returning but
as far as i know that normally shouldnt be a problem when the hook
is fine :d
05/31/2017 21:46 Vaka Vaka#2
If I correctly translated and understood what you are talking about when you call the function 0x00406A30 then the calling function should restore the stack, this is seen in the screenshot.
You need to execute "add esp, 14" or change the function call 0x00406A30
06/02/2017 22:32 wurstbrot123#3
the add esp,14 will be executed just normally so that isnt the problem.
However ill debug and get the value i need :P ^^