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


C++ IPersistStream::QueryInterface方法代码示例

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


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

示例1: LoadPropertyStoreFromStream

HRESULT LoadPropertyStoreFromStream(IStream *pstm, REFIID riid, void **ppv)
{
    *ppv = NULL;

    STATSTG stat;
    HRESULT hr = pstm->Stat(&stat, STATFLAG_NONAME);
    if (SUCCEEDED(hr))
    {
        IPersistStream *pps;
        hr = PSCreateMemoryPropertyStore(IID_PPV_ARGS(&pps));
        if (SUCCEEDED(hr))
        {
            if (stat.cbSize.QuadPart == 0)
            {
                hr = S_OK; // empty stream => empty property store
            }
            else if (stat.cbSize.QuadPart > (128 * 1024))
            {
                hr = STG_E_MEDIUMFULL; // can't be that large
            }
            else
            {
                hr = pps->Load(pstm);
            }

            if (SUCCEEDED(hr))
            {
                hr = pps->QueryInterface(riid, ppv);
            }
            pps->Release();
        }
    }
    return hr;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:34,代码来源:PropertyStoreHelpers.cpp

示例2: HError

HRESULT CPkcs7::SaveIntoJavaClassFile(FILEHANDLE hFile,LPCOLESTR wszFileName,BOOL fClearDirty)
// Save this signed data (presumably already signed) into the right place in the class file
	{
	HRESULT hr = S_OK;
	CFileStream stm;
	if (stm.OpenFileForWriting(hFile, wszFileName, FALSE))
		{
		IPersistStream* pPerStream;
		hr = CJavaClassFile::CreateInstance(NULL, IID_IPersistStream, (LPVOID*)&pPerStream);
		if (hr == S_OK)
			{
			hr = pPerStream->Load(&stm);						// load the class file
			if (hr == S_OK)
				{
				BLOB b;
				hr = CPersistMemoryHelper2::Save(&b, FALSE);	// get our bits
				if (hr == S_OK)
					{
					IInsertSig* pSig;
					hr = pPerStream->QueryInterface(IID_IInsertSig, (LPVOID*)&pSig);
					if (hr == S_OK)
						{
						hr = pSig->SaveSig(&b);					// stuff our bits in
						pSig->Release();
						}
					FreeTaskMem(b);
					}
				if (hr == S_OK)
					{
					stm.Reset();
					stm.Truncate();
					hr = pPerStream->Save(&stm, FALSE);			// save the class file
					}
				}
			pPerStream->Release();
			}
		}
	else
		hr = HError();

	if (hr == S_OK && fClearDirty)
		m_isDirty = FALSE;

	return hr;
	}
开发者ID:mingpen,项目名称:OpenNT,代码行数:45,代码来源:pkcs7.cpp


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