Sign in to follow this  
Plerion

[C++] SymGetTypeInfo TI_GET_SYMNAME - LocalFree

Recommended Posts

Hello!

According to all the smaples and docus ive seen so far i need to use LocalFree for the buffer retrieved from SymGetTypeInfo with TI_GET_SYMNAME. Ok, thats what ive did so far:

LPWSTR symName = NULL;
BOOL ret = SymGetTypeInfo(GetCurrentProcess(), inf->ModBase, subType, TI_GET_SYMNAME, &symName);
if(symName == NULL || !ret)
{
msg << _T("unkPtr* ") << inf->Name << _T(" = ") << value;
break;
}
#ifdef UNICODE
msg << symName << _T("* ") << inf->Name << _T(" = ") << value;
#else
int len = wcslen(symName) + 1;
char* symTmp = new char[len];
WideCharToMultiByte(CP_ACP, 0, symName, len, symTmp, len, NULL, NULL);
msg << symTmp << _T("* ") << inf->Name << _T(" = ") << value;
delete [] symTmp;
#endif
LocalFree(symName);



Now my issue is that after LocalFree SymEnumTypes does not call my callback anymore. I suspect that an exception is happening in there. Ive enabled first chance exceptions, but i dont get any.

Is LocalFree wrong? Should it be GlobalFree? Or how do i have to free the buffer?

Thx for any help
Plerion

Share this post


Link to post
Share on other sites
Another problem occured. I dynamically loaded the functions from the DLL at runtime and now i have some errors with SymEnumSymbolsW. It is returning FALSE and GetLastError says ERROR_SUCCESS and the callback is never called.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this