Description
Is your feature request related to a problem? Please describe.
Working with C++ API means dealing with large vftables; as an example, I just stubbed out one that had 147 functions in it. Since I mostly don't care what the functions do, just what the caller intended to do when they invoked (*thing->vftable[0x70])(...)
I can get away with a struct containing void* <name>
for every slot.
That way I get useful names like (*thing->vftable->EnumAdapters)(...)
, and can focus on understanding the intend of the code calling them. Then for the other 140 functions that are basically unused I can never think about them again. :)
Anyway, it is much easier and faster to generate those stubs with a bit of external copy-paste, to generate stubs/whatever.h
containing code like:
struct IDXGIAdapter_vftable {
void* QueryInterface;
void* AddRef;
void* Release;
// etc, etc
};
struct IDXGIAdapter { IDXGIAdapter_vftable* vftable; };
I also want to share those types across the current project, and ideally without interrupting my workflow any more than is strictly necessary. So, in a project with one EXE and seven DLL files, that means a project type archive.
Right now, "Parse C Code" is great for getting the stuff into place, and working on these stubs in my preferred C/C++ and text editing environment is also very fast compared to the clicky GUI interface in Ghidra for large scale things.
The problem it has is that I need to manually copy those types into the shared type archive, or worse, forget to do that and end up with divergent types — or interrupt what I was doing to go produce the relevant stub, only to discover that I already did, and just didn't share it.
Describe the solution you'd like
I'd like to be able to Parse C Code
directly into a project type archive that I have open in the current project. Just like "Parse to Program", except selected from the open (for write) shared archives.
I'd double-plus like it if I could just paste the C code directly somewhere into Ghidra, without having to go through and intermediate file-on-disk along the way, since that'd make the workflow much faster, and be very usable even for small types. (that is, some sort of "create struct for C code" equivalent of "create struct" on the right click menu in the data type manager.)