0

so, I'm writing a script to automate analysis, and the code I'm working with is 64bit.

the pointer size field shown here is the wrong one:

enter image description here

I want to change it from within python to 64bit. I've searched the Idapython documentation and previously similar questions and could not find an answer

1
  • That stuff in the compiler options page comes from the compiler_info_t structure in the documentation. I'm not sure exactly where you're _supposed_ to set it if using IDAPython, but it's part of idainfo. So, you can prolly use the idaapi.inf_* functions, ctypes with the IDA library to call setinf directly, or I think even the "Root Node" netnode iirc. Commented Jan 31 at 16:10

2 Answers 2

1

Thanks to Ali's tip I was able to find the answer

in idapython the following can be used to set the pointer size:

ida_ida.inf_set_cc_cm(ida_typeinf.CM_N16_F32)

the enum/definition for 'CM_N16_F32' is found in ida.hpp:

https://hex-rays.com/products/ida/support/sdkdoc/group___c_m__ptr.html

https://hex-rays.com/products/ida/support/sdkdoc/structcompiler__info__t.html

and to use it in idapython I looked up the function/module Ali mentioned and found ida_ida.inf_set_cc_cm() / ida_ida.inf_get_cc_cm for setting/getting compiler info specifically for the compiler memory model mentioned in the previous links:

https://hex-rays.com//products/ida/support/idapython_docs/ida_ida.html#ida_ida.INF_CC_CM https://hex-rays.com//products/ida/support/idapython_docs/ida_typeinf.html#ida_typeinf.CM_N64

exciting stuff :)

1

As hinted by Ali, this info is stored in the global inf structure. It used to be an actual global variable accessible via the idaapi.cvar wrapper, but now you need to use the various getters/setters in the ida_ida module.

While you can indeed go down that road and use inf_get_cc/inf_set_cc or inf_set_cc_cm, in case you only need to change the pointers to 64-bit, normally it should be enough to call inf_set_64bit(True).

1
  • indeed, thats a better way to do it.
    – serv0
    Commented Feb 1 at 16:35

Your Answer

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

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