I am trying to get IDA to recognize some data as code. I can press 'C' and it works fine, but when I use IDAPython it does not work. I can patch the JMP+1 using PatchByte(ea). I have used do_unknown_range, MakeUnkn on the data portion of the file before calling MakeCode, but the results are the same.
text:000009F4
.text:000009F4 loc_9F4: ; CODE XREF: .text:loc_9F4j
.text:000009F4 jmp short near ptr loc_9F4+1
.text:000009F4 ; ---------------------------------------------------------------------------
.text:000009F6 dw 48C0h
.text:000009F8 dd 0FFEB4840h, 58064BC3h
I am trying to get the data at 09F6 - 09FF to get converted to code. Any help would be appreciated. Here is the code I have so far:
seg_start = SegByName(".text")
seg_end = SegEnd(seg_start)
start_data = 0
obfu = 0
for head in Heads(seg_start, seg_end):
current_ea = NextHead(head, seg_end)
if (Byte(current_ea)== 0xEB and Byte(current_ea + 1) == 0xFF and isData(GetFlags(current_ea +2))):
PatchByte(current_ea, 0x90)
MakeCode(current_ea)
obfu = 1
start_data_ea = NextHead(current_ea, seg_end)
continue
if (isData(GetFlags(current_ea)) and obfu == 1):
data_ea = current_ea
MakeUnkn(current_ea,0)
if (isCode(GetFlags(current_ea))):
if (obfu):
obfu = 0
range = data_ea - start_data_ea
while(start_data_ea < current_ea):
print "At: ", hex(start_data_ea)
#MakeCode(start_data_ea)
start_data_ea = nextaddr(start_data_ea)
#print "start: ", hex(start_data_ea), "data: ", hex(current_ea - 1), "current: ", hex(current_ea)







