The title says most of it. Say I have a Windows PE (x86, 32bit) binary (just so we have case to discuss), the imports list will usually only show the imports found in the import directory. The attributes it shows are address of the function, name and library from which it got imported as shown in this screenshot snippet:
Is there a way for me through scripting (IDC or Python, I don't care too much), to add imports of my own to the list and, for example, have them point (the address attribute) to code such as this (highlighted line)?:
I.e. the line would in such case look like:
0DCBA987 GetLongPathNameW kernel32.dll
or even just
0DCBA987 GetLongPathNameW ???
assuming the above call GetProcAddress
would be at address 0DCBA987
.
The advantage to me would be readability. But it would also yield a more comprehensive list of imports (and consequently xrefs) as some functions are frequently imported dynamically due to their availability in the various Windows versions.
It should be quite trivial given a certain binary to figure out all xrefs to candidate functions that retrieve the imported function's address (such as GetProcAddress
) and then walk their calls to find which function was imported. The DLL part may be more complicated to find out, but it could be left empty or entered manually. But I didn't find a function that would allow me to add imports. Is there a way?
import_node
(exported from the SDK's nalt.hpp), but it's unclear if IDA re-reads thosenetnode
s every time it redraws the list of imports.