Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Ollydbg?

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?
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++).


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Assembly] by HardStoNApr 25, 2021 10:59 PM 3 407 Apr 25, 2021 10:59 PM
Last Post: Vector Dynamics
[Help] by FlaxmanJul 27, 2014 10:50 AM 0 101 Jul 27, 2014 10:50 AM
Last Post: Flaxman
[Assembly] by hgdfhsdgdfgdfhNov 29, 2013 12:27 PM 13 651 Nov 29, 2013 12:27 PM
Last Post: Masm4ever