本文整理汇总了C++中IDiaSymbol::get_undecoratedNameEx方法的典型用法代码示例。如果您正苦于以下问题:C++ IDiaSymbol::get_undecoratedNameEx方法的具体用法?C++ IDiaSymbol::get_undecoratedNameEx怎么用?C++ IDiaSymbol::get_undecoratedNameEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDiaSymbol
的用法示例。
在下文中一共展示了IDiaSymbol::get_undecoratedNameEx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAddr
AddrInfo GetAddr(wstring req)
{
uint32_t module;
uint64_t addr;
int charsRead = swscanf_s(req.c_str(), L"%d %llu", &module, &addr);
AddrInfo ret;
ZeroMemory(&ret, sizeof(ret));
if(module > 0 && module < modules.size())
{
SymTagEnum tag = SymTagFunction;
IDiaSymbol *pFunc = NULL;
HRESULT hr = modules[module].pSession->findSymbolByVA(addr, tag, &pFunc);
if(hr != S_OK)
{
if(pFunc)
pFunc->Release();
// try again looking for public symbols
tag = SymTagPublicSymbol;
hr = modules[module].pSession->findSymbolByVA(addr, tag, &pFunc);
if(hr != S_OK)
{
if(pFunc)
pFunc->Release();
return ret;
}
}
DWORD opts = 0;
opts |= UNDNAME_NO_LEADING_UNDERSCORES;
opts |= UNDNAME_NO_MS_KEYWORDS;
opts |= UNDNAME_NO_FUNCTION_RETURNS;
opts |= UNDNAME_NO_ALLOCATION_MODEL;
opts |= UNDNAME_NO_ALLOCATION_LANGUAGE;
opts |= UNDNAME_NO_THISTYPE;
opts |= UNDNAME_NO_ACCESS_SPECIFIERS;
opts |= UNDNAME_NO_THROW_SIGNATURES;
opts |= UNDNAME_NO_MEMBER_TYPE;
opts |= UNDNAME_NO_RETURN_UDT_MODEL;
opts |= UNDNAME_32_BIT_DECODE;
opts |= UNDNAME_NO_LEADING_UNDERSCORES;
// first try undecorated name
BSTR file;
hr = pFunc->get_undecoratedNameEx(opts, &file);
// if not, just try name
if(hr != S_OK)
{
hr = pFunc->get_name(&file);
if(hr != S_OK)
{
pFunc->Release();
SysFreeString(file);
return ret;
}
wcsncpy_s(ret.funcName, file, 126);
}
else
{
wcsncpy_s(ret.funcName, file, 126);
wchar_t *voidparam = wcsstr(ret.funcName, L"(void)");
// remove stupid (void) for empty parameters
if(voidparam != NULL)
{
*(voidparam + 1) = L')';
*(voidparam + 2) = 0;
}
}
pFunc->Release();
pFunc = NULL;
SysFreeString(file);
// find the line numbers touched by this address.
IDiaEnumLineNumbers *lines = NULL;
hr = modules[module].pSession->findLinesByVA(addr, DWORD(4), &lines);
if(FAILED(hr))
{
if(lines)
lines->Release();
return ret;
}
IDiaLineNumber *line = NULL;
ULONG count = 0;
// just take the first one
if(SUCCEEDED(lines->Next(1, &line, &count)) && count == 1)
{
IDiaSourceFile *dia_source = NULL;
//.........这里部分代码省略.........