Hack Forums
Ollydbg? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: Ollydbg? (/showthread.php?tid=2381222)



Ollydbg? - Automatic Coding - Apr 8, 2012

Learning to code cheats for games, so far coded an external hack but now I'm coding one to be injected. I launched up the game with ollydbg, but, how do I tell whether or not when the break-points stop firing if it's the end of the function or not? Let's say for ammo:

onEvent("Fire") {
if(ammo > 0) {
fire();
} else {
reload():
}
}

if I add a break point to fire, it won't break for reload. How do I make sure EVERYTHING in that function break points?
Yes, I am new to olllydbg >:(


EDIT: Worked it out, found two returns surrounded the function:

return 4
jmp/dec/inc/randomshit
return 4

However, I'm not closing this thread because I want to ask:

Is that always the case?


* - bottomy - Apr 8, 2012

Well you can BP multiple times or you can even BP a range of bytes (as well as a whole lot of other typical stuff like conditional BP). So you could just BP both fire and reload, or you could BP the start of the comparison or the start of the onEvent function, etc.

As far as the code, whether (what I assume you're are saying is the retn instruction? Or otherwise leaving the function through other means) it includes that instruction in both comparison result or not, depends entirely on the compiler (and language) and optimizations it makes.

EDIT: I think I may have misunderstood what you were asking about finding the instruction twice. Did you mean you found it before the function and then at the functions end? This could simply be because there's another function above (there might not be subsequent amount of padding, or the retn instruction may even be used as padding) or depending what segment and section of memory this is and the access rights they might be using if for data. Since it's the likely you're in the code segment (so likely readable and executable), it's possible that is a static constant variable (assuming it was coded originally in C/C++).