I am trying to get a list of parameters and the return type from a mangled function compiled in visual studio.
I know that I can use
UnDecorateSymbolName(function.c_str(), undecoratedName, 200, UNDNAME_COMPLETE))
but this just gives me another string, and I have to figure out if the string starts with a return type, or a specifier.
Is there a function to return SymbolNameInfo? Something along the lines:
struct SymbolInfo
{
char[255] symbolName
char[255] returnType
char[255] parameters
};
This feature has now been released in the latest product update released version Visual Studio 2019 version 16.8. To access this feature, you will need to turn this option on in Tools > Options > Text Editor > C# or Basic > Advanced and select Display inline parameter name hints (experimental).
You can trigger IntelliSense in any editor window by typing Ctrl+Space or by typing a trigger character (such as the dot character (.)
Inline Parameter refactoring This refactoring allows you to replace a method parameter with argument value from a method call. If there are several calls, you can choose the call to take the argument from.
I managed to find an answer. It's not perfect, maybe someone else will have some better idea.
What I did was use
UnDecorateSymbolName(function.c_str(), undecoratedName, 200, UNDNAME_COMPLETE))
with different flags.
The flags I used with explanation:
UNDNAME_COMPLETE // this returns the whole undecorated name.
UNDNAME_NAME_ONLY // this return just the name of the symbol
UNDNAME_NO_FUNCTION_RETURNS // this return a string like UNDNAME_COMPLETE
// but without the return type
I used these 3 flags to do the following:
How this looks after test:
function : ?encrypt@@YAPADPAD@Z
fullName : char * __cdecl encrypt(char*)
SymbolInfo.name : encrypt
SymbolInfo.returnType : char *
SymbolInfo.parameters : (char *)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With