question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to set a structure member's custom type, it always is 'int'

See original GitHub issue

@arizvisa hi, I have to come and ask you questions, I don’t know what went wrong, I can’t set the member’s custom type , it awaly is ‘int’:

import idaapi
import idc


st1 =structure.by_name('TTDBTextInfoGroup')
struct_name = 'TTDBTextInfoGroup*'
f1 = st1.members.by(offset=0)

print f1.typeinfo.dstr()
ordinal = f1.typeinfo.get_ordinal()
f1.typeinfo.set_numbered_type(idaapi.cvar.idati,ordinal,BTF_STRUCT, struct_name)
print f1.typeinfo.dstr()

_Originally posted by @gool123456 in https://github.com/arizvisa/ida-minsc/issues/61#issuecomment-664488530_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
arizvisacommented, Jul 29, 2020

Okay. Try PR #63 again. I also cleaned up the typeinfo so that it’s properly emitted when displaying the structure member or listing them with struc.list().

1reaction
gool123456commented, Jul 28, 2020

@arizvisa Show Error :

Script Default snippet error: Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "C:\Users\Hskyre\AppData\Roaming\Hex-Rays\IDA Pro\base\structure.py", line 1615, in typeinfo
    @typeinfo.setter
  File "C:\Users\Hskyre\AppData\Roaming\Hex-Rays\IDA Pro\base\_utils.py", line 988, in wrapper
    return F(*res, **kwds)
  File "C:\Users\Hskyre\AppData\Roaming\Hex-Rays\IDA Pro\base\structure.py", line 1634, in typeinfo
    res = idaapi.parse_decl2(til, terminated, ti, idaapi.PT_SIL) if idaapi.__version__ < 7.0 else idaapi.parse_decl(ti, til, terminated, idaapi.PT_SIL)
  File "D:\tools\IDA_Pro_v6.8_and_Hex-Rays_Decompiler_(ARM,x64,x86)_Hskyre\python\idaapi.py", line 32392, in parse_decl2
    return _idaapi.parse_decl2(*args)
TypeError: parse_decl2 expected 5 arguments, got 4

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the two names of the struct, and why can't I put the ...
NODE is not the name of the struct. It's a typedef , i.e. an alias for the struct. In the first case, the...
Read more >
Structured Data Types in C Explained - freeCodeCamp
Nesting a structure means having one or more structure variables inside another structure. Like we declare an int member or char member, we...
Read more >
Structs - C# language specification - Microsoft Learn
This chapter defines struct declarations. In many cases, the descriptions are defined using the differences between classes and structs.
Read more >
Making Our Own Types and Typeclasses - Learn You a Haskell
In this chapter, we'll learn how to make our own and how to put them to work! Algebraic data types intro. So far,...
Read more >
Structs, USTRUCTS(), They're Awesome - UE4: Guidebook
Structs enable you to create custom variable types to organize your data, by relating other c++ or UE4 ... Always make USTRUCT variables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found