I am trying to get the byte size of all operands in a given instruction from IDA Pro. At first I tried using GetOperandValue(ea,n)
to see how large the value was and calculate how many bytes were necessary to store that value, but it doesn't return leading zeros, which means that it doesn't work.
Now I am trying to use OpHex(ea,n)
to get the answer, but it's just returning True
(as do OpDecimal
, OpBinary
, and OpOctal
).
How can I find the number of bytes used for operands of a particular instruction and why is OpHex
returning true?
Edit: My current solution works, but I would still like one that is more technically correct and bulletproof. Right now I am just using GetOperandValue(ea, op)
to get both operands for all instructions (even if they have neither or only one) and then checking to make sure the operand value is greater than FF
. If It's greater than FF
I just assume it is an address, which in this case is four bytes. If both operands meet this condition, I assign the size to be eight bytes.
This works for the moment, but will encounter difficulties in eventual moves to other architectures (right now I'm just working with x86-64).
mov
or the size of a data structure to which some pointer is pointing?