Exemplo n.º 1
0
void Symbols::Init(HANDLE process, tstring const& server)
{
    mProcess = process;
    mSymSetOption = reinterpret_cast<tSymSetOptions>(GetProcAddress(mDbghlp, "SymSetOptions"));
    mSymInitialize = reinterpret_cast<tSymInitialize>(GetProcAddress(mDbghlp, "SymInitialize"));
    mSymLoadModuleEx = reinterpret_cast<tSymLoadModuleEx>(GetProcAddress(mDbghlp, "SymLoadModuleEx"));
    mSymFromName = reinterpret_cast<tSymFromName>(GetProcAddress(mDbghlp, "SymFromName"));
    mSymCleanup = reinterpret_cast<tSymCleanup>(GetProcAddress(mDbghlp, "SymCleanup"));

    if(!mSymSetOption || !mSymInitialize || !mSymLoadModuleEx || !mSymFromName || !mSymCleanup)
        throw MagicException(_T("Can not load symbol functions"), GetLastError());

    if(!mSymInitialize(mProcess, server.c_str(), FALSE))
        throw MagicException(_T("Can not initialize symbols"), GetLastError());
}
Exemplo n.º 2
0
BOOL DbgHelp::SymInitialize(PCSTR searchPath, BOOL invadeProcess) const
{
  Guard lock(mutex());

  return mSymInitialize(mProcess, searchPath, invadeProcess);
}