How to undecorate name from decorated name?
-
17-05-2021 - |
문제
At a post of Raymond Chen, he seems to be able to know the function's undecorated name from the decorated name. I have no idea how could he do this.
In this decorated name,
?GetName@PushButton@UILibrary@@UAEPB_WPAPAVStringHolder@2@@Z
What does the each component mean?
해결책
To avoid guessing, and still not really use tools, the UnDecorateSymbolName
function may be of use. I would hope that gives an authoritative correct answer.
To do it manually, this page has some information on the scheme, as do these.
The basic outline is _name@scope@scope@@parameters@something@@something
. I suspect the last two parts are stack size and calling convention or similar, but the documentation likely has more detail.
다른 팁
Name mangling is compiler dependant.
In the article you linked, Raymond is using an MS util (undname) to remove the mangling.
Here is a table showing how common compilers mangle.
Microsoft Visual Studio comes with a undname.exe tool.
http://msdn.microsoft.com/en-us/library/ms937379.aspx
If you have MS VS at a default location you can use:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\undname.exe" ?GetName@PushButton@UILibrary@@UAEPB_WPAPAVStringHolder@2@@Z
Microsoft (R) C++ Name Undecorator Copyright (C) Microsoft Corporation. All rights reserved.
Undecoration of :- "?GetName@PushButton@UILibrary@@UAEPB_WPAPAVStringHolder@2@@Z" is :- "public: virtual wchar_t const * __thiscall UILibrary::PushButton::GetName(class UILibrary::StringHolder * *)"