Gold mine of Visual C++ tricks!
Posts tagged UnDecorateSymbolName
Name Mangling – How to Undecorate a decorated C++ function name.
111396 days
![]()
For generating unique function names C++ decorates the function names to wired form. This is best known as Name Mangling. You can see sample of decorated function names by using dependency walker. Open any DLL in dependency walker and in the exported section, most probably you can see a list of decorated function names.
![]()
So, if you want to see the real function prototype of that decorated function name, what to do? Just use, UnDecorateSymbolName() function. Please see the following code block.
// Buffer for undecorating Function Name.
TCHAR tchUnDecoratedName[ 512 ];
// The Decorated function Name.
TCHAR tchDecoratedName[] =
_T( "?classCDataPathProperty@CDataPathProperty@@2UCRuntimeClass@@B" );
if( UnDecorateSymbolName( tchDecoratedName, // Decorated Name.
tchUnDecoratedName, // UnDecorated Name.
512, // Buffer size.
UNDNAME_COMPLETE )) // Flags.
{
// Display the undecorated function name.
CString csUndecoratedName( tchUnDecoratedName );
AfxMessageBox( csUndecoratedName );
}
![]()
Don’t forget to include the header file – “Dbghelp.h” and library file – “Dbghelp.lib“.
![]()
Targeted Audience – Intermediate.