0

I want to get first argument value (it's a string). For instance, I have the following instruction:

instructions

I have a list of instructions, sometimes there can be other arguments, and there might be other strings. How can I get the first argument only?

I tried to iterate through instructions, from the call I went higher, until I meet the ldstr instruction. But it won't work if there are two string arguments passed. Any possible fix for it?

misticos
  • 718
  • 5
  • 22

1 Answers1

-1

If you want to retrieve "OnLoseCondition" from what was akin to

Interface.CallHook("OnLoseCondition", <some variable>)

you'll need something a little smarter than an instruction disassembler - not necessarily a full decompiler, but at least something that can step over instructions that are encountered in arguments of your function calls of interest so that you can then backtrack to the first argument in the call.

If the method seems to be always called with a single-instruction second argument, this would be as simple as getting a list of instructions (see ex.2 for getting to method's instructions), finding your call, finding the instruction at -2 offset, verifying that it's a ldstr, and finally getting the Operand from it.

YellowAfterlife
  • 2,967
  • 1
  • 16
  • 24