Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: adding recasting/renaming for assignments with structure members #61

Open
saidelike opened this issue Jun 18, 2020 · 3 comments
Open

Comments

@saidelike
Copy link

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?

@saidelike
Copy link
Author

Re-reading the linked part, it is actually already supported for simple assignments, but not for structure members

@saidelike saidelike changed the title Idea: adding recasting/renaming for assignments Idea: adding recasting/renaming for assignments with structure members Jun 18, 2020
@saidelike
Copy link
Author

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.

@igogo-x86
Copy link
Owner

Yeah that's good ideas, there're more minor facilities like this can be added. I hope to get around to implementing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants