HexRaysPyTools
HexRaysPyTools copied to clipboard
Idea: adding recasting/renaming for assignments with structure members
One idea that may not be hard to implement since what HexraysPyTools does is already more complicated would be to add support for recasting/renaming simple assignments:
So something similar to https://github.com/igogo-x86/HexRaysPyTools#recasting-shiftr-shiftl-renaming-shiftn-ctrlshiftn but for assignments
So the idea is if we have, with PVOID v1
, and struct1 { int arg1};
:
v1 = (PVOID)struct1->arg1;
When we click on v1
and hit SHIFT+L
it would change the type of v1
to int
:
v1 = struct1->arg1;
Then we hit SHIFT+N
and it would rename v1
to arg1
:
arg1 = struct1->arg1;
We just need to support appending an underscore to the name until the rename succeeds as the name may already exist, so it could generate something like:
arg1___ = struct1->arg1;
We could also imagine supporting the other direction (i.e. renaming the right part based on the left part but I think the initial idea is more useful.
What do you think?
Re-reading the linked part, it is actually already supported for simple assignments, but not for structure members
Another example would be this function call:
result = Func1(
whatever,
struct2->InputBuffer,
struct2->OutputBuffer,
struct2->OutputBufferLength,
&struct2->total_size);
and the prototype of Func1:
int __stdcall Func1(WHATEVER*whatever, _BYTE *a2, void *a3, unsigned int a4, _DWORD *a5)
It would be nice if we could name a2 = InputBuffer
, a3 = OutputBuffer
, a4 = OutputBufferLength
and a5 = total_size
just by using the recasting/renaming shortcuts.
Yeah that's good ideas, there're more minor facilities like this can be added. I hope to get around to implementing it