1337
1337

Reputation: 317

Unmangle C++ DLL Function Names

I have a dll which exports 3 function:

.h file

extern "C"
{
__declspec(dllexport) BOOLEAN __stdcall InitializeChangeNotify(void);
__declspec(dllexport) BOOLEAN __stdcall PasswordFilter(LPCWSTR AccountName,LPCWSTR FullName,LPCWSTR Password,BOOLEAN SetOperation);
__declspec(dllexport) NTSTATUS __stdcall PasswordChangeNotify(LPCWSTR UserName,ULONG RelativeId,LPCWSTR NewPassword);
}

.c file

extern "C"
{
    __declspec(dllexport) BOOLEAN __stdcall InitializeChangeNotify(void)
{
    writeToLog("InitializeChangeNotify()");
    return TRUE;
}

__declspec(dllexport) BOOLEAN __stdcall PasswordFilter(LPCWSTR AccountName,LPCWSTR FullName,LPCWSTR Password,BOOLEAN SetOperation)
{
    writeToLog("PasswordFilter()");
    return TRUE;
}

__declspec(dllexport) NTSTATUS __stdcall PasswordChangeNotify(LPCWSTR UserName,ULONG RelativeId,LPCWSTR NewPassword)
{
    writeToLog("PasswordChangeNotify()");
    return 0;
}
}

i compile in VS 2010.

I see the function names in depends like: _InitializeChangeNotify@0, _PasswordChangeNotify@12. How do I unmangle the functions?

Upvotes: 1

Views: 1998

Answers (3)

devbeacon
devbeacon

Reputation: 1

I also encountered this.and solve it by specifying a def file. e.g:

a.def:

EXPORTS

InitializeChangeNotify

in project setting, set Link>> Input>>Module definition file to a.def and rebuild. HTH

Upvotes: 0

dpp
dpp

Reputation: 1758

Looks like undname.exe on windows is the 'c++filt' equivalent.

I've it under "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\undname.exe" in my PC.

From the page,

You can use the undname.exe to convert a decorated name to its undecorated form. For example,

C:\>undname ?func1@a@@AAEXH@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation 1981-2000. All rights reserved.Undecoration
of :- "?func1@a@@AAEXH@Z"
is :- "private: void __thiscall a::func1(int)"

Upvotes: 6

Evgenii Gostiukhin
Evgenii Gostiukhin

Reputation: 980

_xxx@x mean that this is __stdcall calling convention. Digit after @ mean summary size of arguments in bytes.

Upvotes: 1

Related Questions