As per this already answered question How to get the CPU architecture via Idapython?, for reasons I'm unable to figure out, both inf.is_64bit() and inf.is_32bit() are not working for me. I'm using IDA C++ SDK v7.1. Even if the executable in the database is 64-bit, it still goes through the 32-bit check. Any idea why this is happening?
I figured it out. To determine if the binary is
- 32-bit: (inf.is_32bit() && !inf.is_64bit())
- 64-bit: (inf.is_64bit() && inf.is_32bit())
As of IDA 8.x you can find the following in
ida.hpp which clarifies the above (trimmed to be more concise):
// unfortunately the name inf_is_32bit was used in the past to mean inf_is_32bit_or_higher. // it was misleading, this is why we have more explicit names now. bool inf_is_32bit_or_higher(void); bool inf_is_32bit_exactly(void);