Ghidra: datatype for pointer to code. Can this be entered?

Created on 13 Apr 2019  路  2Comments  路  Source: NationalSecurityAgency/ghidra

Internally, ghidra presents some pointers to code as "code ", yet this type cannot be entered as function args or data structure elements. Neither can declarations like "int ()(int)". Currently, I am using "void *", which isn't too terrible, but I would prefer a more correct way to specify this.

Is there a way to specify a pointer to code? If not, consider this a feature request...

Question

Most helpful comment

Generally, if you know that a specific function pointer has a specific return type/function parameters, it IS possible to make a function pointer type in the data structure area then use THAT as the type of parameter. I do this by going to the data type manager, create a function definition, then you can use that function definition as a function pointer (e.g. I recreated the _PVFV function from VS with _cdecl calling convention and the definition being void _PVFV(void) and now I can set function pointers to be _PVFV* after that). Otherwise, the best way to deal with that should probably be pointer32 or pointer64 from what I can tell for unknown function pointer types.

All 2 comments

I personally use pointer32 or pointer64 which seem to work better with it than void*. Although if there's a designated type for it, I'd like to know it as well.

Generally, if you know that a specific function pointer has a specific return type/function parameters, it IS possible to make a function pointer type in the data structure area then use THAT as the type of parameter. I do this by going to the data type manager, create a function definition, then you can use that function definition as a function pointer (e.g. I recreated the _PVFV function from VS with _cdecl calling convention and the definition being void _PVFV(void) and now I can set function pointers to be _PVFV* after that). Otherwise, the best way to deal with that should probably be pointer32 or pointer64 from what I can tell for unknown function pointer types.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gemini00 picture gemini00  路  3Comments

rrivera1849 picture rrivera1849  路  3Comments

tambry picture tambry  路  3Comments

huettenhain picture huettenhain  路  3Comments

marcushall42 picture marcushall42  路  3Comments