本文整理汇总了C++中IStream_AddRef函数的典型用法代码示例。如果您正苦于以下问题:C++ IStream_AddRef函数的具体用法?C++ IStream_AddRef怎么用?C++ IStream_AddRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IStream_AddRef函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IStream_fnQueryInterface
/**************************************************************************
* IStream_fnQueryInterface
*/
static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface,
REFIID riid,
LPVOID *ppvObj)
{
IUMCacheStream *This = (IUMCacheStream *)iface;
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IStream))
{
*ppvObj = This;
}
if(*ppvObj)
{
IStream_AddRef((IStream*)*ppvObj);
TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE("-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:28,代码来源:umstream.c
示例2: IWICStreamImpl_InitializeFromIStreamRegion
static HRESULT WINAPI IWICStreamImpl_InitializeFromIStreamRegion(IWICStream *iface,
IStream *pIStream, ULARGE_INTEGER ulOffset, ULARGE_INTEGER ulMaxSize)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
StreamOnStreamRange *pObject;
TRACE("(%p,%p)\n", iface, pIStream);
if (!pIStream) return E_INVALIDARG;
if (This->pStream) return WINCODEC_ERR_WRONGSTATE;
pObject = HeapAlloc(GetProcessHeap(), 0, sizeof(StreamOnStreamRange));
if (!pObject) return E_OUTOFMEMORY;
pObject->IStream_iface.lpVtbl = &StreamOnStreamRange_Vtbl;
pObject->ref = 1;
IStream_AddRef(pIStream);
pObject->stream = pIStream;
pObject->pos.QuadPart = 0;
pObject->offset = ulOffset;
pObject->max_size = ulMaxSize;
InitializeCriticalSection(&pObject->lock);
pObject->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": StreamOnStreamRange.lock");
if (InterlockedCompareExchangePointer((void**)&This->pStream, pObject, NULL))
{
/* Some other thread set the stream first. */
IStream_Release(&pObject->IStream_iface);
return WINCODEC_ERR_WRONGSTATE;
}
return S_OK;
}
开发者ID:RareHare,项目名称:reactos,代码行数:32,代码来源:stream.c
示例3: IcnsEncoder_Initialize
static HRESULT WINAPI IcnsEncoder_Initialize(IWICBitmapEncoder *iface,
IStream *pIStream, WICBitmapEncoderCacheOption cacheOption)
{
IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
HRESULT hr = S_OK;
TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOption);
EnterCriticalSection(&This->lock);
if (This->icns_family)
{
hr = WINCODEC_ERR_WRONGSTATE;
goto end;
}
This->icns_family = (IconFamilyHandle)NewHandle(0);
if (!This->icns_family)
{
WARN("error creating icns family\n");
hr = E_FAIL;
goto end;
}
IStream_AddRef(pIStream);
This->stream = pIStream;
end:
LeaveCriticalSection(&This->lock);
return hr;
}
开发者ID:AndreRH,项目名称:wine,代码行数:30,代码来源:icnsformat.c
示例4: ProtocolStream_QueryInterface
static HRESULT WINAPI ProtocolStream_QueryInterface(IStream *iface,
REFIID riid, void **ppv)
{
ProtocolStream *This = STREAM_THIS(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = STREAM(This);
} else if(IsEqualGUID(&IID_ISequentialStream, riid)) {
TRACE("(%p)->(IID_ISequentialStream %p)\n", This, ppv);
*ppv = STREAM(This);
} else if(IsEqualGUID(&IID_IStream, riid)) {
TRACE("(%p)->(IID_IStream %p)\n", This, ppv);
*ppv = STREAM(This);
}
if(*ppv) {
IStream_AddRef(STREAM(This));
return S_OK;
}
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
开发者ID:mikekap,项目名称:wine,代码行数:26,代码来源:binding.c
示例5: StgStreamImpl_QueryInterface
/***
* This implements the IUnknown method QueryInterface for this
* class
*/
static HRESULT WINAPI StgStreamImpl_QueryInterface(
IStream* iface,
REFIID riid, /* [in] */
void** ppvObject) /* [iid_is][out] */
{
StgStreamImpl* This = impl_from_IStream(iface);
if (ppvObject==0)
return E_INVALIDARG;
*ppvObject = 0;
if (IsEqualIID(&IID_IUnknown, riid) ||
IsEqualIID(&IID_ISequentialStream, riid) ||
IsEqualIID(&IID_IStream, riid))
{
*ppvObject = &This->IStream_iface;
}
else
return E_NOINTERFACE;
IStream_AddRef(iface);
return S_OK;
}
开发者ID:GYGit,项目名称:reactos,代码行数:29,代码来源:stg_stream.c
示例6: PngEncoder_Initialize
static HRESULT WINAPI PngEncoder_Initialize(IWICBitmapEncoder *iface,
IStream *pIStream, WICBitmapEncoderCacheOption cacheOption)
{
PngEncoder *This = impl_from_IWICBitmapEncoder(iface);
jmp_buf jmpbuf;
TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOption);
EnterCriticalSection(&This->lock);
if (This->png_ptr)
{
LeaveCriticalSection(&This->lock);
return WINCODEC_ERR_WRONGSTATE;
}
/* initialize libpng */
This->png_ptr = ppng_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!This->png_ptr)
{
LeaveCriticalSection(&This->lock);
return E_FAIL;
}
This->info_ptr = ppng_create_info_struct(This->png_ptr);
if (!This->info_ptr)
{
ppng_destroy_write_struct(&This->png_ptr, NULL);
This->png_ptr = NULL;
LeaveCriticalSection(&This->lock);
return E_FAIL;
}
IStream_AddRef(pIStream);
This->stream = pIStream;
/* set up setjmp/longjmp error handling */
if (setjmp(jmpbuf))
{
ppng_destroy_write_struct(&This->png_ptr, &This->info_ptr);
This->png_ptr = NULL;
IStream_Release(This->stream);
This->stream = NULL;
LeaveCriticalSection(&This->lock);
return E_FAIL;
}
ppng_set_error_fn(This->png_ptr, jmpbuf, user_error_fn, user_warning_fn);
/* set up custom i/o handling */
ppng_set_write_fn(This->png_ptr, This, user_write_data, user_flush);
LeaveCriticalSection(&This->lock);
return S_OK;
}
开发者ID:DeltaYang,项目名称:wine,代码行数:55,代码来源:pngformat.c
示例7: BmpEncoder_Initialize
static HRESULT WINAPI BmpEncoder_Initialize(IWICBitmapEncoder *iface,
IStream *pIStream, WICBitmapEncoderCacheOption cacheOption)
{
BmpEncoder *This = impl_from_IWICBitmapEncoder(iface);
TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOption);
IStream_AddRef(pIStream);
This->stream = pIStream;
return S_OK;
}
开发者ID:Dimillian,项目名称:wine,代码行数:12,代码来源:bmpencode.c
示例8: CopyStgMedium
/***********************************************************************
* CopyStgMedium ([email protected])
*/
HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
{
TRACE("(%p %p)\n", src, dst);
if(!src || !dst)
return E_POINTER;
*dst = *src;
switch(dst->tymed) {
case TYMED_NULL:
break;
case TYMED_FILE:
if(src->u.lpszFileName && !src->pUnkForRelease) {
DWORD size = (strlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
dst->u.lpszFileName = CoTaskMemAlloc(size);
if(!dst->u.lpszFileName)
return E_OUTOFMEMORY;
memcpy(dst->u.lpszFileName, src->u.lpszFileName, size);
}
break;
case TYMED_ISTREAM:
if(dst->u.pstm)
IStream_AddRef(dst->u.pstm);
break;
case TYMED_ISTORAGE:
if(dst->u.pstg)
IStorage_AddRef(dst->u.pstg);
break;
case TYMED_HGLOBAL:
if(dst->u.hGlobal) {
SIZE_T size = GlobalSize(src->u.hGlobal);
char *src_ptr, *dst_ptr;
dst->u.hGlobal = GlobalAlloc(GMEM_FIXED, size);
if(!dst->u.hGlobal)
return E_OUTOFMEMORY;
dst_ptr = GlobalLock(dst->u.hGlobal);
src_ptr = GlobalLock(src->u.hGlobal);
memcpy(dst_ptr, src_ptr, size);
GlobalUnlock(src_ptr);
GlobalUnlock(dst_ptr);
}
break;
default:
FIXME("Unimplemented tymed %d\n", src->tymed);
}
if(dst->pUnkForRelease)
IUnknown_AddRef(dst->pUnkForRelease);
return S_OK;
}
开发者ID:GYGit,项目名称:reactos,代码行数:56,代码来源:urlmon_main.c
示例9: stgmed_stream_get_result
static HRESULT stgmed_stream_get_result(stgmed_obj_t *obj, DWORD bindf, void **result)
{
ProtocolStream *stream = (ProtocolStream*)obj;
if(!(bindf & BINDF_ASYNCHRONOUS) && stream->buf->file == INVALID_HANDLE_VALUE
&& (stream->buf->hres != S_FALSE || stream->buf->size))
return INET_E_DATA_NOT_AVAILABLE;
IStream_AddRef(STREAM(stream));
*result = STREAM(stream);
return S_OK;
}
开发者ID:mikekap,项目名称:wine,代码行数:12,代码来源:binding.c
示例10: TestStream_QueryInterface
static HRESULT WINAPI TestStream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
{
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_ISequentialStream) ||
IsEqualIID(riid, &IID_IStream))
{
*ppv = iface;
IStream_AddRef(iface);
return S_OK;
}
*ppv = NULL;
return E_NOINTERFACE;
}
开发者ID:Barrell,项目名称:wine,代码行数:13,代码来源:hglobalstream.c
示例11: JpegEncoder_Initialize
static HRESULT WINAPI JpegEncoder_Initialize(IWICBitmapEncoder *iface,
IStream *pIStream, WICBitmapEncoderCacheOption cacheOption)
{
JpegEncoder *This = impl_from_IWICBitmapEncoder(iface);
jmp_buf jmpbuf;
TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOption);
EnterCriticalSection(&This->lock);
if (This->initialized)
{
LeaveCriticalSection(&This->lock);
return WINCODEC_ERR_WRONGSTATE;
}
pjpeg_std_error(&This->jerr);
This->jerr.error_exit = error_exit_fn;
This->jerr.emit_message = emit_message_fn;
This->cinfo.err = &This->jerr;
This->cinfo.client_data = jmpbuf;
if (setjmp(jmpbuf))
{
LeaveCriticalSection(&This->lock);
return E_FAIL;
}
pjpeg_CreateCompress(&This->cinfo, JPEG_LIB_VERSION, sizeof(struct jpeg_compress_struct));
This->stream = pIStream;
IStream_AddRef(pIStream);
This->dest_mgr.next_output_byte = This->dest_buffer;
This->dest_mgr.free_in_buffer = sizeof(This->dest_buffer);
This->dest_mgr.init_destination = dest_mgr_init_destination;
This->dest_mgr.empty_output_buffer = dest_mgr_empty_output_buffer;
This->dest_mgr.term_destination = dest_mgr_term_destination;
This->cinfo.dest = &This->dest_mgr;
This->initialized = TRUE;
LeaveCriticalSection(&This->lock);
return S_OK;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:51,代码来源:jpegformat.c
示例12: BmpEncoder_CreateNewFrame
static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
IWICBitmapFrameEncode **ppIFrameEncode, IPropertyBag2 **ppIEncoderOptions)
{
BmpEncoder *This = impl_from_IWICBitmapEncoder(iface);
BmpFrameEncode *encode;
HRESULT hr;
static const PROPBAG2 opts[1] =
{
{ PROPBAG2_TYPE_DATA, VT_BOOL, 0, 0, (LPOLESTR)wszEnableV5Header32bppBGRA },
};
TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
if (This->frame) return WINCODEC_ERR_UNSUPPORTEDOPERATION;
if (!This->stream) return WINCODEC_ERR_NOTINITIALIZED;
if (ppIEncoderOptions)
{
hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr)) return hr;
}
encode = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpFrameEncode));
if (!encode)
{
IPropertyBag2_Release(*ppIEncoderOptions);
*ppIEncoderOptions = NULL;
return E_OUTOFMEMORY;
}
encode->IWICBitmapFrameEncode_iface.lpVtbl = &BmpFrameEncode_Vtbl;
encode->ref = 2;
IStream_AddRef(This->stream);
encode->stream = This->stream;
encode->initialized = FALSE;
encode->width = 0;
encode->height = 0;
encode->bits = NULL;
encode->format = NULL;
encode->xres = 0.0;
encode->yres = 0.0;
encode->lineswritten = 0;
encode->colors = 0;
encode->committed = FALSE;
*ppIFrameEncode = &encode->IWICBitmapFrameEncode_iface;
This->frame = encode;
return S_OK;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:50,代码来源:bmpencode.c
示例13: MSI_RecordCopyField
UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n,
MSIRECORD *out_rec, UINT out_n )
{
UINT r = ERROR_SUCCESS;
msiobj_lock( &in_rec->hdr );
if ( in_n > in_rec->count || out_n > out_rec->count )
r = ERROR_FUNCTION_FAILED;
else if ( in_rec != out_rec || in_n != out_n )
{
LPWSTR str;
MSIFIELD *in, *out;
in = &in_rec->fields[in_n];
out = &out_rec->fields[out_n];
switch ( in->type )
{
case MSIFIELD_NULL:
break;
case MSIFIELD_INT:
out->u.iVal = in->u.iVal;
break;
case MSIFIELD_INTPTR:
out->u.pVal = in->u.pVal;
break;
case MSIFIELD_WSTR:
if ((str = msi_strdupW( in->u.szwVal, in->len )))
{
out->u.szwVal = str;
out->len = in->len;
}
else r = ERROR_OUTOFMEMORY;
break;
case MSIFIELD_STREAM:
IStream_AddRef( in->u.stream );
out->u.stream = in->u.stream;
break;
default:
ERR("invalid field type %d\n", in->type);
}
if (r == ERROR_SUCCESS)
out->type = in->type;
}
msiobj_unlock( &in_rec->hdr );
return r;
}
开发者ID:GYGit,项目名称:reactos,代码行数:49,代码来源:record.c
示例14: MSI_RecordSetIStream
UINT MSI_RecordSetIStream( MSIRECORD *rec, UINT iField, IStream *stm )
{
TRACE("%p %d %p\n", rec, iField, stm);
if( iField > rec->count )
return ERROR_INVALID_FIELD;
MSI_FreeField( &rec->fields[iField] );
rec->fields[iField].type = MSIFIELD_STREAM;
rec->fields[iField].u.stream = stm;
IStream_AddRef( stm );
return ERROR_SUCCESS;
}
开发者ID:GYGit,项目名称:reactos,代码行数:15,代码来源:record.c
示例15: MSI_RecordGetIStream
UINT MSI_RecordGetIStream( MSIRECORD *rec, UINT iField, IStream **pstm)
{
TRACE("%p %d %p\n", rec, iField, pstm);
if( iField > rec->count )
return ERROR_INVALID_FIELD;
if( rec->fields[iField].type != MSIFIELD_STREAM )
return ERROR_INVALID_FIELD;
*pstm = rec->fields[iField].u.stream;
IStream_AddRef( *pstm );
return ERROR_SUCCESS;
}
开发者ID:GYGit,项目名称:reactos,代码行数:15,代码来源:record.c
示例16: CliprdrStream_QueryInterface
HRESULT STDMETHODCALLTYPE CliprdrStream_QueryInterface(IStream* This, REFIID riid, void** ppvObject)
{
CliprdrStream* instance = (CliprdrStream*) This;
if (IsEqualIID(riid, &IID_IStream) || IsEqualIID(riid, &IID_IUnknown))
{
IStream_AddRef(This);
*ppvObject = This;
return S_OK;
}
else
{
*ppvObject = 0;
return E_NOINTERFACE;
}
}
开发者ID:C4rt,项目名称:FreeRDP,代码行数:16,代码来源:wf_cliprdr.c
示例17: Test_IStream_QueryInterface
static HRESULT WINAPI Test_IStream_QueryInterface(IStream *iface,
REFIID riid, LPVOID *ppvObj)
{
if (ppvObj == NULL) return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IStream))
{
*ppvObj = iface;
IStream_AddRef(iface);
return S_OK;
}
*ppvObj = NULL;
return E_NOINTERFACE;
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:16,代码来源:usrmarshal.c
示例18: IStream_fnQueryInterface
/**************************************************************************
* IStream_fnQueryInterface
*/
static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj)
{
ISHFileStream *This = impl_from_IStream(iface);
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IStream))
{
IStream_AddRef(iface);
*ppvObj = iface;
return S_OK;
}
return E_NOINTERFACE;
}
开发者ID:GYGit,项目名称:reactos,代码行数:20,代码来源:istream.c
示例19: StgStreamImpl_QueryInterface
/***
* This implements the IUnknown method QueryInterface for this
* class
*/
static HRESULT WINAPI StgStreamImpl_QueryInterface(
IStream* iface,
REFIID riid, /* [in] */
void** ppvObject) /* [iid_is][out] */
{
StgStreamImpl* const This=(StgStreamImpl*)iface;
/*
* Perform a sanity check on the parameters.
*/
if (ppvObject==0)
return E_INVALIDARG;
/*
* Initialize the return parameter.
*/
*ppvObject = 0;
/*
* Compare the riid with the interface IDs implemented by this object.
*/
if (IsEqualIID(&IID_IUnknown, riid) ||
IsEqualIID(&IID_IPersist, riid) ||
IsEqualIID(&IID_IPersistStream, riid) ||
IsEqualIID(&IID_ISequentialStream, riid) ||
IsEqualIID(&IID_IStream, riid))
{
*ppvObject = This;
}
/*
* Check that we obtained an interface.
*/
if ((*ppvObject)==0)
return E_NOINTERFACE;
/*
* Query Interface always increases the reference count by one when it is
* successful
*/
IStream_AddRef(iface);
return S_OK;
}
开发者ID:pstrealer,项目名称:wine,代码行数:48,代码来源:stg_stream.c
示例20: ITSS_IStream_QueryInterface
static HRESULT WINAPI ITSS_IStream_QueryInterface(
IStream* iface,
REFIID riid,
void** ppvObject)
{
IStream_Impl *This = impl_from_IStream(iface);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_ISequentialStream)
|| IsEqualGUID(riid, &IID_IStream))
{
IStream_AddRef(iface);
*ppvObject = This;
return S_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
return E_NOINTERFACE;
}
开发者ID:GYGit,项目名称:reactos,代码行数:19,代码来源:storage.c
注:本文中的IStream_AddRef函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论