IDiaInjectedSource

访问插入了 DIA 数据源中存储的源代码。

IDiaInjectedSource : IUnknown

方法按 Vtable 顺序

下表显示 IDiaInjectedSource方法。

方法

说明

IDiaInjectedSource::get_crc

从源代码的字节 (CRC)检索计算的循环冗余检查。

IDiaInjectedSource::get_length

检索字节数代码。

IDiaInjectedSource::get_filename

检索数据源的文件名。

IDiaInjectedSource::get_objectFilename

检索该源编译的对象文件名称。

IDiaInjectedSource::get_virtualFilename

检索该名称将非文件源代码;即插入代码。

IDiaInjectedSource::get_sourceCompression

检索使用的源压缩的指示符。

IDiaInjectedSource::get_source

检索源代码字节。

备注

插入的源是在编译时插入的文本。 这并不意味着预处理器在 C++ 的 #include 。

调用方的说明

通过调用 IDiaEnumInjectedSources::ItemIDiaEnumInjectedSources::Next 方法获取此接口。 用于获取 IDiaInjectedSource 接口的示例参见 IDiaEnumInjectedSources 接口。

示例

此示例演示数据可从 IDiaInjectedSource 接口。 有关使用 IDiaPropertyStorage 接口的替代方法,请参见。 IDiaEnumInjectedSources 接口的示例。

void PrintInjectedSource(IDiaInjectedSource* pSource)
{
    ULONGLONG codeLength      = 0;
    DWORD     crc             = 0;
    DWORD     compressionType = 0;
    BSTR      sourceFilename  = NULL;
    BSTR      objectFilename  = NULL;
    BSTR      virtualFilename = NULL;

    std::cout << "Injected Source:" << std::endl;
    if (pSource != NULL)
    {
        if (pSource->get_crc(&crc) == S_OK &&
            pSource->get_sourceCompression(&compressionType) == S_OK &&
            pSource->get_length(&codeLength) == S_OK)
        {
            wprintf(L"  crc = %lu\n", crc);
            wprintf(L"  code length = %I64u\n",codeLength);
            wprintf(L"  compression type code = %lu\n", compressionType);
        }

        wprintf(L"  source filename: ");
        if (pSource->get_filename(&sourceFilename) == S_OK)
        {
            wprintf(L"%s", sourceFilename);
        }
        else
        {
            wprintf(L"<none>");
        }
        wprintf(L"\n");

        wprintf(L"  object filename: ");
        if (pSource->get_filename(&objectFilename) == S_OK)
        {
            wprintf(L"%s", objectFilename);
        }
        else
        {
            wprintf(L"<none>");
        }
        wprintf(L"\n");

        wprintf(L"  virtual filename: ");
        if (pSource->get_filename(&virtualFilename) == S_OK)
        {
            wprintf(L"%s", virtualFilename);
        }
        else
        {
            wprintf(L"<none>");
        }
        wprintf(L"\n");

        SysFreeString(sourceFilename);
        SysFreeString(objectFilename);
        SysFreeString(virtualFilename);
    }
}

要求

标题:Dia2.h

库:diaguids.lib

DLL:msdia80.dll

请参见

参考

IDiaEnumInjectedSources::Item

IDiaEnumInjectedSources::Next

IDiaEnumInjectedSources

其他资源

接口(调试接口访问 SDK)