Code
This line is wrong, arg_n() returns *(int*)(ebp + 4 * (n + 1)), i.e. PUSH arguments.
- Код: Выделить всё
H3Hero *hero = (H3Hero*)(c->arg_n(1));
In this function, H3Hero is a
THIS argument, it is passed to the function through
ECX and at the start of the functions it will be passed to another register (ESI, EDI or EBX usually) for the remainder of the scope of the function.
Try c->local_n(1) instead, it's maybe still in a register but I didn't run the game to check... speaking of which:
h3_MessageBox(aaa->name.String());
There is no safety check in String() whether the string exists (if (!str) return ""), the name has not necessarily been assigned when you checked this.
Breakpoints in Olly.INT3 BreakpointsThese breakpoints are placed over code that will be run.
It will cover only the length of the instruction selected.
Setting a breakpoint : click on an address and press
F2Clearing a breakpoint : same as setting
Memory BreakpointsThese breakpoints are placed over memory, where data is read and written to.
Setting a breakpoint : click on an address and press
SHIFT+F3Clearing a breakpoint : F2
Conditional BreakpointsThese are more advanced format of the INT3 breakpoint where you can add extra specifications.
Setting a breakpoint : click on an address and press
SHIFT+F2Clearing a breakpoint : F2
Few examples...
0x4F6C00 (textbox)
Press F2, now every time a textbox is made, the code will stop and you can examine registers...
You can move forward one step with
F7 which is called 'STEP INTO', that is if there is a CALL instruction, it will go to the called function and always go deeper in the rabbit hole.
There is a similar action with
F8 which is called 'STEP OVER'. It's the same thing as STEP INTO, except it... steps over CALL instructions.
To resume the game normally, press the PLAY button (4th from left) or
F9.
There's another fun one:
CTRL+F9 which automatically runs the remainder of the function, stopping at RETN instruction.
Okay... so now about Conditional Breakpoint.
I want the game to stop at 0x4F6C00 ONLY when I right-click a textbox.
From understanding that RMC textbox requires second argument to be 4 and that this function is __fastcall (which uses both ECX and EDX) then the conditional breakpoint becomes
- Код: Выделить всё
EDX == 4
Now it only stops here if EDX is 4, i.e. RMC textbox.
That's the base! There are more advanced techniques but this alone kept me busy a while when I learned them