1

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?

2
  • What CPU architectures have you tested? x86/amd64, ARMv7/ARMv8a, or something else?
    – Robert
    Feb 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!
    – Xigma
    Feb 26, 2020 at 18:15

1 Answer 1

1

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);
1
  • I recall this breaking something in RetDec, saw a ticket for this on GitHub, IIRC.
    – 0xC0000022L
    Jul 14 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.