IDiaDataSourceEx2::findNamedStreams

Retrieves all the names of named streams within the datasource that match the optionally given pattern.

Syntax

HRESULT findNamedStreams ( 
   [in, optional] LPCOLESTR              name,
   [in]           DWORD                  compareFlags,
   [out]          IDiaEnumNamedStreams** ppResult
);

Parameters

[in, optional] name

Optionally specifies the name of the streams to be retrieved. Set to NULL for all streams to be retrieved.

[in] compareFlags

Specifies the comparison options applied to name matching. Values from the NameSearchOptions Enumeration enumeration can be used alone or in combination. If name is NULL, this parameter must be nsNone.

[out] ppResult

Returns an IDiaEnumNamedStreams object that contains the list of named streams retrieved.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Example

The following example shows how to find all named streams that begin with "sourcelink" and dump their length.

CComPtr<IDiaEnumNamedStreams> pEnum;
HRESULT hr = pDataSource->findNamedStreams( L"sourcelink*", nsCaseSensitive | nsRegularExpression, &pEnum );
do {
    CComBSTR name;
    hr = pEnum->Next(&name);
    if (FAILED(hr)) {
        // report the error
        return hr;
    }
    if (hr != S_OK) {
        // End of the matches
        return S_OK;
    }
    ULONGLONG cb = 0;
    hr = pDataSource->getStreamSize(name.m_str, &cb);
    if (FAILED(hr)) {
        // report the error
        return hr;
    }
    printf("Stream Name: \"%ls\", Stream Size: %llu byte(s)\n", name.m_str, cb);
} while (true);

See also