hi all,
i'm currently fixing my classandinterfacetonames.py, because it seems that IDA sometimes doesn't create the structures IID and CLSID even if there are GUIDs in the code.
the thing that happens with my script is, that it indeed finds and sets the IID and CLSID names, but it isn't able to set the structure by using do_struct, as it doesn't exist in some cases. so i've decided to check this case in my script and tried to add the structures by myself.
id=GetStrucIdByName("IID")
if id == 0xffffffff:
id = AddStrucEx(-1,"IID",0)
id = GetStrucIdByName("IID");
AddStrucMember(id,"Data1",0x0,0x20000400, -1,4);
AddStrucMember(id,"Data2",0x4,0x10000400, -1,2);
AddStrucMember(id,"Data3",0x6,0x10000400, -1,2);
AddStrucMember(id,"Data4",0x8,0x00000400, -1,8);
but the first thing that happens is:
Reading c:\programme\ida\interfaces.txt into memory...
Scanning for interface UUIDs...
Traceback (most recent call last):
File "<string>", line 1, in ?
File "c:\programme\ida\python\init.py", line 55, in runscript
execfile(script, globals())
File "C:/Programme/IDA/ClassAndInterfaceToNames.py", line 171, in ?
main()
File "C:/Programme/IDA/ClassAndInterfaceToNames.py", line 96, in main
id = AddStrucEx(-1,"IID",0)
File "c:\programme\ida\python\idc.py", line 4492, in AddStrucEx
return idaapi.add_struc(index, name, is_union)
File "c:\programme\ida\python\idaapi.py", line 5675, in add_struc
return _idaapi.add_struc(*args)
OverflowError: in method 'add_struc', argument 1 of type 'uval_t'
the same code as IDC script:
auto id;
id = AddStrucEx(-1,"IID",0);
id = GetStrucIdByName("IID");
AddStrucMember(id,"Data1",0x0,0x20000400, -1,4);
AddStrucMember(id,"Data2",0x4,0x10000400, -1,2);
AddStrucMember(id,"Data3",0x6,0x10000400, -1,2);
AddStrucMember(id,"Data4",0x8,0x00000400, -1,8);
works fine. and if i set the first parameter of AddStrucMember to 0 it's fine too, but then next bug occures:
Reading c:\programme\ida\interfaces.txt into memory...
Scanning for interface UUIDs...
Traceback (most recent call last):
File "<string>", line 1, in ?
File "c:\programme\ida\python\init.py", line 55, in runscript
execfile(script, globals())
File "C:/Programme/IDA/ClassAndInterfaceToNames.py", line 171, in ?
main()
File "C:/Programme/IDA/ClassAndInterfaceToNames.py", line 98, in main
AddStrucMember(id,"Data1",0x0,0x20000400, -1,4);
File "c:\programme\ida\python\idc.py", line 4606, in AddStrucMember
raise HELL
NameError: global name 'HELL' is not defined
this time an exception called HELL was raised and again the same code as IDC works fine.
any comments?







