当前位置: 首页>>代码示例>>C++>>正文


C++ PDB::QueryPDBName方法代码示例

本文整理汇总了C++中PDB::QueryPDBName方法的典型用法代码示例。如果您正苦于以下问题:C++ PDB::QueryPDBName方法的具体用法?C++ PDB::QueryPDBName怎么用?C++ PDB::QueryPDBName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PDB的用法示例。


在下文中一共展示了PDB::QueryPDBName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: message

// Open the TypeServer referenced by *pts and initialize a TMTS from it.
// Set *ptm and return TRUE if successful, FALSE otherwise.
//
BOOL DBI1::fOpenTmts(lfTypeServer* pts, SZ_CONST szObjFile, TM** pptm)
{
#pragma message("TODO - DBCS")
    *pptm = 0; // 0 means use 'to' PDB

    char szPDBTo[_MAX_PATH];
    ppdb1->QueryPDBName(szPDBTo);

    if (_strnicmp(szPDBTo, (char*)(pts->name + 1), *(PB)pts->name) == 0) {
        // PDB filenames match, reference to the 'to' PDB
        return TRUE;
    }

    char szPDBFrom[_MAX_PATH];
    strncpy(szPDBFrom, (char*)(pts->name + 1), *(PB)pts->name);
    szPDBFrom[*(PB)pts->name] = 0;

    if (pts->signature == ppdb1->QuerySignature() && pts->age <= ppdb1->QueryAge()) {
        // PDB signature and age match; this 'from' PDB must contain equivalent
        // information (even if it is a copy on some other path).  However, we
        // may have the highly unlikely case of distinct PDBs with equal
        // signatures; to feel better about this case, we won't conclude
        // equivalence unless the PDB base names also match.  In practice this
        // should be exactly conservative enough to avoid false positives and
        // yet prevent accidental reopening of the 'to' PDB.
#pragma message("TODO: DBCS review")
        char* pchBaseFrom = strrchr(szPDBFrom, '\\'); // REVIEW: international?
        char* pchBaseTo = strrchr(szPDBTo, '\\');
        if (_tcsicmp(pchBaseFrom, pchBaseTo) == 0) {
            // even the base names match; reference to the 'to' PDB
            return TRUE;
        }
    }

    // Alas, probably a reference to a different type server.  Open it.
    EC ec;
    char szError[cbErrMax];
    PDB* ppdbFrom;
    char szPathBuf[_MAX_PATH+_MAX_DRIVE];
    char szFullPath[_MAX_PATH+_MAX_DRIVE];

    _fullpath(szFullPath, szObjFile, _MAX_PATH+_MAX_DRIVE);
    _splitpath(szFullPath, szPathBuf, szPathBuf + _MAX_DRIVE, NULL, NULL);
    SZ szPath;
    if (szPathBuf[0] == 0) {
        // no drive spec - set up path without it
        szPath = szPathBuf + _MAX_DRIVE;
    }
    else {
        // concatenate drive and dir to form full path
        szPathBuf[2] = szPathBuf[1];
        szPathBuf[1] = szPathBuf[0];
        szPath = szPathBuf + 1;
    }
    if (!PDB::OpenValidate(szPDBFrom, szPath, ppdb1->fFullBuild ? (pdbRead pdbGetRecordsOnly pdbFullBuild) :(pdbRead pdbGetRecordsOnly),
        pts->signature, pts->age, &ec, szError, &ppdbFrom)) {
        ppdb1->setLastError(ec, szError);
        return FALSE;
    }

    // Check again that the PDB we found along the lib path is the same as the
    // target PDB.
    ppdbFrom->QueryPDBName(szPDBFrom);
    if (_tcsicmp(szPDBTo, szPDBFrom) == 0) {
        // PDB filenames match, reference to the 'to' PDB
        ppdbFrom->Close();
        return TRUE;
    }

    // Create and initialize the TMTS.
    TMTS* ptmts = new TMTS(ppdb1, this, ppdb1->ptpi1);
    if (!ptmts) {
        ppdb1->setOOMError();
        return FALSE;
    }
    if (!ptmts->fInit(ppdbFrom))
        return FALSE;

    *pptm = ptmts;
    return TRUE;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:84,代码来源:dbi.cpp


注:本文中的PDB::QueryPDBName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。