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?
-
What CPU architectures have you tested? x86/amd64, ARMv7/ARMv8a, or something else?– RobertFeb 26, 2020 at 18:07
-
The sample I'm testing is a 64-bit Windows executable file loaded into the 64-bit version of IDA. So, if I run both APIs on it, they both return True!– XigmaFeb 26, 2020 at 18:15
1 Answer
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);
-
I recall this breaking something in RetDec, saw a ticket for this on GitHub, IIRC.– 0xC0000022L ♦Jul 14 at 23:07