I'm looking for a way, to make programmatically change of data type. This is the same as you press 'C' or 'D'.

For example convert this:

.text:00401008 unk_401008      db  55h ; U             ; CODE XREF: start↑p
.text:00401009                 db  8Bh ; ‹
.text:0040100A                 db 0ECh ; ì
.text:0040100B                 db  83h ; ƒ
.text:0040100C                 db 0ECh ; ì

to this:

.text:00401008 loc_401008:                             ; CODE XREF: start↑p
.text:00401008                 push    ebp
.text:00401009                 mov     ebp, esp
.text:0040100B                 sub     esp, 0Ch

and vice versa.

These functions should be listed here https://www.hex-rays.com/products/ida/support/idapython_docs/ but I can't find it.

So far I found only this:

generate_disasm_line(here(), GENDSM_FORCE_CODE)

but it only prints data to output, and does not change the "IDA View" window content.


  • 1
    If you found a solution you should post an answer instead of editing the question. This way it will be useful for others. – Igor Skochinsky Aug 21 '18 at 20:07
  • Modified. Now its ok? – eXp Aug 21 '18 at 20:28
  • 1
    looks good, thanks! by the way, you can even mark as accepted your own answer (but it won't award you the points). – Igor Skochinsky Aug 21 '18 at 21:22

ah, to create code there is:


The last question, when I'm trying to create data from code I'm getting False:

Python>create_data(here(), FF_BYTE, 0x79, 0)

This is because I need previously del_items()

| improve this answer | |
  • If you want to ask another question, ask new question. Don't "bundle" it together with an answer. It's confusing. – user202729 Aug 22 '18 at 15:44
  • ok, next time I will, this is my first experience of using this platform, sorry – eXp Aug 22 '18 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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