3

My HexRays decompiler output often looks like:

  v0 = LoadLibraryW(L"wininet.dll");
  v1 = v0;
  if ( !v0 )
    goto LABEL_1;
  v2 = GetProcAddress(v0, "InternetOpenW");
  v3 = GetProcAddress(v1, "InternetConnectW");
  v4 = v2;
  v5 = v4;

To me, there's just a couple variables here. v0, v2, and v3. The rest are entirely duplicate. Is it possible to clean up my decompiler output to eliminate these extraneous variables?

5

Locate cursor at v1 and press = . If I remember it correctly since IDA 6.6 it will allow you to define that some variable is actually same as other.

2

Starting from v6.6, IDA supports decompiler API. The documentation is poor, almost non-existing. Yet, in theory, it should be possible to write a plugin to perform static analysis on the abstract syntax tree (AST) produced by the decompiler, thereby eliminating useless unit assignments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.