本文整理汇总了C++中IUnknown_Release函数的典型用法代码示例。如果您正苦于以下问题:C++ IUnknown_Release函数的具体用法?C++ IUnknown_Release怎么用?C++ IUnknown_Release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IUnknown_Release函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WriteUsingWIC
static HRESULT WriteUsingWIC(const char* out_file_name, int use_stdout,
REFGUID container_guid,
uint8_t* rgb, int stride,
uint32_t width, uint32_t height, int has_alpha) {
HRESULT hr = S_OK;
IWICImagingFactory* factory = NULL;
IWICBitmapFrameEncode* frame = NULL;
IWICBitmapEncoder* encoder = NULL;
IStream* stream = NULL;
WICPixelFormatGUID pixel_format = has_alpha ? GUID_WICPixelFormat32bppBGRA
: GUID_WICPixelFormat24bppBGR;
IFS(CoInitialize(NULL));
IFS(CoCreateInstance(MAKE_REFGUID(CLSID_WICImagingFactory), NULL,
CLSCTX_INPROC_SERVER,
MAKE_REFGUID(IID_IWICImagingFactory),
(LPVOID*)&factory));
if (hr == REGDB_E_CLASSNOTREG) {
fprintf(stderr,
"Couldn't access Windows Imaging Component (are you running "
"Windows XP SP3 or newer?). PNG support not available. "
"Use -ppm or -pgm for available PPM and PGM formats.\n");
}
IFS(CreateOutputStream(out_file_name, use_stdout, &stream));
IFS(IWICImagingFactory_CreateEncoder(factory, container_guid, NULL,
&encoder));
IFS(IWICBitmapEncoder_Initialize(encoder, stream,
WICBitmapEncoderNoCache));
IFS(IWICBitmapEncoder_CreateNewFrame(encoder, &frame, NULL));
IFS(IWICBitmapFrameEncode_Initialize(frame, NULL));
IFS(IWICBitmapFrameEncode_SetSize(frame, width, height));
IFS(IWICBitmapFrameEncode_SetPixelFormat(frame, &pixel_format));
IFS(IWICBitmapFrameEncode_WritePixels(frame, height, stride,
height * stride, rgb));
IFS(IWICBitmapFrameEncode_Commit(frame));
IFS(IWICBitmapEncoder_Commit(encoder));
if (SUCCEEDED(hr) && use_stdout) {
HGLOBAL image;
IFS(GetHGlobalFromStream(stream, &image));
if (SUCCEEDED(hr)) {
HANDLE std_output = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD mode;
const BOOL update_mode = GetConsoleMode(std_output, &mode);
const void* const image_mem = GlobalLock(image);
DWORD bytes_written = 0;
// Clear output processing if necessary, then output the image.
if (update_mode) SetConsoleMode(std_output, 0);
if (!WriteFile(std_output, image_mem, (DWORD)GlobalSize(image),
&bytes_written, NULL) ||
bytes_written != GlobalSize(image)) {
hr = E_FAIL;
}
if (update_mode) SetConsoleMode(std_output, mode);
GlobalUnlock(image);
}
}
if (frame != NULL) IUnknown_Release(frame);
if (encoder != NULL) IUnknown_Release(encoder);
if (factory != NULL) IUnknown_Release(factory);
if (stream != NULL) IUnknown_Release(stream);
return hr;
}
开发者ID:CoderDqZhang,项目名称:Private-travel,代码行数:65,代码来源:dwebp.c
示例2: test_readerinput
static void test_readerinput(void)
{
IXmlReaderInput *reader_input;
IXmlReader *reader, *reader2;
IUnknown *obj, *input;
IStream *stream;
HRESULT hr;
LONG ref;
hr = pCreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
hr = pCreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ref = IStream_AddRef(stream);
ok(ref == 2, "Expected 2, got %d\n", ref);
IStream_Release(stream);
hr = pCreateXmlReaderInputWithEncodingName((IUnknown*)stream, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* IXmlReaderInput grabs a stream reference */
ref = IStream_AddRef(stream);
ok(ref == 3, "Expected 3, got %d\n", ref);
IStream_Release(stream);
/* try ::SetInput() with valid IXmlReaderInput */
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ref = IUnknown_AddRef(reader_input);
ok(ref == 2, "Expected 2, got %d\n", ref);
IUnknown_Release(reader_input);
hr = IXmlReader_SetInput(reader, reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
test_read_state(reader, XmlReadState_Initial, -1, FALSE);
/* IXmlReader grabs a IXmlReaderInput reference */
ref = IUnknown_AddRef(reader_input);
ok(ref == 3, "Expected 3, got %d\n", ref);
IUnknown_Release(reader_input);
ref = IStream_AddRef(stream);
ok(ref == 4, "Expected 4, got %d\n", ref);
IStream_Release(stream);
/* reset input and check state */
hr = IXmlReader_SetInput(reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
test_read_state(reader, XmlReadState_Initial, XmlReadState_Closed, FALSE);
IXmlReader_Release(reader);
ref = IStream_AddRef(stream);
ok(ref == 3, "Expected 3, got %d\n", ref);
IStream_Release(stream);
ref = IUnknown_AddRef(reader_input);
ok(ref == 2, "Expected 2, got %d\n", ref);
IUnknown_Release(reader_input);
/* IID_IXmlReaderInput */
/* it returns a kind of private undocumented vtable incompatible with IUnknown,
so it's not a COM interface actually.
Such query will be used only to check if input is really IXmlReaderInput */
obj = (IUnknown*)0xdeadbeef;
hr = IUnknown_QueryInterface(reader_input, &IID_IXmlReaderInput, (void**)&obj);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ref = IUnknown_AddRef(reader_input);
ok(ref == 3, "Expected 3, got %d\n", ref);
IUnknown_Release(reader_input);
IUnknown_Release(reader_input);
IUnknown_Release(reader_input);
IStream_Release(stream);
/* test input interface selection sequence */
hr = testinput_createinstance((void**)&input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
input_iids.count = 0;
ref = IUnknown_AddRef(input);
ok(ref == 2, "Expected 2, got %d\n", ref);
IUnknown_Release(input);
hr = pCreateXmlReaderInputWithEncodingName(input, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok_iids(&input_iids, empty_seq, NULL, FALSE);
/* IXmlReaderInput stores stream interface as IUnknown */
ref = IUnknown_AddRef(input);
ok(ref == 3, "Expected 3, got %d\n", ref);
IUnknown_Release(input);
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,代码来源:reader.c
示例3: getRefcount
static ULONG getRefcount(IUnknown *iface)
{
IUnknown_AddRef(iface);
return IUnknown_Release(iface);
}
开发者ID:AndreRH,项目名称:wine,代码行数:5,代码来源:filtermapper.c
示例4: AtlAxCreateControlEx
/***********************************************************************
* AtlAxCreateControlEx [[email protected]]
*
* REMARKS
* See http://www.codeproject.com/com/cwebpage.asp for some background
*
*/
HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR lpszName, HWND hWnd,
IStream *pStream, IUnknown **ppUnkContainer, IUnknown **ppUnkControl,
REFIID iidSink, IUnknown *punkSink)
{
CLSID controlId;
HRESULT hRes;
IOleObject *pControl;
IUnknown *pUnkControl;
IPersistStreamInit *pPSInit;
IUnknown *pContainer;
enum {IsGUID=0,IsHTML=1,IsURL=2} content;
TRACE("(%s %p %p %p %p %p %p)\n", debugstr_w(lpszName), hWnd, pStream,
ppUnkContainer, ppUnkControl, iidSink, punkSink);
hRes = CLSIDFromString( lpszName, &controlId );
if ( FAILED(hRes) )
hRes = CLSIDFromProgID( lpszName, &controlId );
if ( SUCCEEDED( hRes ) )
content = IsGUID;
else {
/* FIXME - check for MSHTML: prefix! */
content = IsURL;
controlId = CLSID_WebBrowser;
}
hRes = CoCreateInstance( &controlId, 0, CLSCTX_ALL, &IID_IOleObject,
(void**) &pControl );
if ( FAILED( hRes ) )
{
WARN( "cannot create ActiveX control %s instance - error 0x%08x\n",
debugstr_guid( &controlId ), hRes );
return hRes;
}
hRes = IOleObject_QueryInterface( pControl, &IID_IPersistStreamInit, (void**) &pPSInit );
if ( SUCCEEDED( hRes ) )
{
if (!pStream)
IPersistStreamInit_InitNew( pPSInit );
else
IPersistStreamInit_Load( pPSInit, pStream );
IPersistStreamInit_Release( pPSInit );
} else
WARN("cannot get IID_IPersistStreamInit out of control\n");
IOleObject_QueryInterface( pControl, &IID_IUnknown, (void**) &pUnkControl );
IOleObject_Release( pControl );
hRes = AtlAxAttachControl( pUnkControl, hWnd, &pContainer );
if ( FAILED( hRes ) )
WARN("cannot attach control to window\n");
if ( content == IsURL )
{
IWebBrowser2 *browser;
hRes = IOleObject_QueryInterface( pControl, &IID_IWebBrowser2, (void**) &browser );
if ( !browser )
WARN( "Cannot query IWebBrowser2 interface: %08x\n", hRes );
else {
VARIANT url;
IWebBrowser2_put_Visible( browser, VARIANT_TRUE ); /* it seems that native does this on URL (but do not on MSHTML:! why? */
V_VT(&url) = VT_BSTR;
V_BSTR(&url) = SysAllocString( lpszName );
hRes = IWebBrowser2_Navigate2( browser, &url, NULL, NULL, NULL, NULL );
if ( FAILED( hRes ) )
WARN( "IWebBrowser2::Navigate2 failed: %08x\n", hRes );
SysFreeString( V_BSTR(&url) );
IWebBrowser2_Release( browser );
}
}
if (ppUnkContainer)
{
*ppUnkContainer = pContainer;
if ( pContainer )
IUnknown_AddRef( pContainer );
}
if (ppUnkControl)
{
*ppUnkControl = pUnkControl;
if ( pUnkControl )
IUnknown_AddRef( pUnkControl );
}
if ( pUnkControl )
IUnknown_Release( pUnkControl );
//.........这里部分代码省略.........
开发者ID:RazZziel,项目名称:wine,代码行数:101,代码来源:atl_ax.c
示例5: getref
static ULONG getref(IUnknown *obj) {
IUnknown_AddRef(obj);
return IUnknown_Release(obj);
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:4,代码来源:d3d9ex.c
示例6: get_ref
static inline int get_ref(IUnknown *obj)
{
IUnknown_AddRef(obj);
return IUnknown_Release(obj);
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:5,代码来源:surface.c
示例7: test_simple_streaming
static void test_simple_streaming(IXAudio2 *xa)
{
HRESULT hr;
IXAudio2MasteringVoice *master;
IXAudio2SourceVoice *src, *src2;
IUnknown *vumeter;
WAVEFORMATEX fmt;
XAUDIO2_BUFFER buf, buf2;
XAUDIO2_VOICE_STATE state;
XAUDIO2_EFFECT_DESCRIPTOR effect;
XAUDIO2_EFFECT_CHAIN chain;
memset(&ecb_state, 0, sizeof(ecb_state));
memset(&src1_state, 0, sizeof(src1_state));
memset(&src2_state, 0, sizeof(src2_state));
XA2CALL_0V(StopEngine);
/* Tests show in native XA2.8, ECB is called from a mixer thread, but VCBs
* may be called from other threads in any order. So we can't rely on any
* sequencing between VCB calls.
*
* XA2.7 does all mixing from a single thread, so call sequence can be
* tested. */
XA2CALL(RegisterForCallbacks, &ecb);
ok(hr == S_OK, "RegisterForCallbacks failed: %08x\n", hr);
if(xaudio27)
hr = IXAudio27_CreateMasteringVoice((IXAudio27*)xa, &master, 2, 44100, 0, 0, NULL);
else
hr = IXAudio2_CreateMasteringVoice(xa, &master, 2, 44100, 0, NULL, NULL, AudioCategory_GameEffects);
ok(hr == S_OK, "CreateMasteringVoice failed: %08x\n", hr);
/* create first source voice */
fmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
fmt.nChannels = 2;
fmt.nSamplesPerSec = 44100;
fmt.wBitsPerSample = 32;
fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8;
fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign;
fmt.cbSize = 0;
XA2CALL(CreateSourceVoice, &src, &fmt, 0, 1.f, &vcb1, NULL, NULL);
ok(hr == S_OK, "CreateSourceVoice failed: %08x\n", hr);
memset(&buf, 0, sizeof(buf));
buf.AudioBytes = 22050 * fmt.nBlockAlign;
buf.pAudioData = HeapAlloc(GetProcessHeap(), 0, buf.AudioBytes);
fill_buf((float*)buf.pAudioData, &fmt, 440, 22050);
hr = IXAudio2SourceVoice_SubmitSourceBuffer(src, &buf, NULL);
ok(hr == S_OK, "SubmitSourceBuffer failed: %08x\n", hr);
hr = IXAudio2SourceVoice_Start(src, 0, XAUDIO2_COMMIT_NOW);
ok(hr == S_OK, "Start failed: %08x\n", hr);
/* create second source voice */
XA2CALL(CreateSourceVoice, &src2, &fmt, 0, 1.f, &vcb2, NULL, NULL);
ok(hr == S_OK, "CreateSourceVoice failed: %08x\n", hr);
memset(&buf2, 0, sizeof(buf2));
buf2.AudioBytes = 22050 * fmt.nBlockAlign;
buf2.pAudioData = HeapAlloc(GetProcessHeap(), 0, buf2.AudioBytes);
fill_buf((float*)buf2.pAudioData, &fmt, 220, 22050);
hr = IXAudio2SourceVoice_SubmitSourceBuffer(src2, &buf2, NULL);
ok(hr == S_OK, "SubmitSourceBuffer failed: %08x\n", hr);
hr = IXAudio2SourceVoice_Start(src2, 0, XAUDIO2_COMMIT_NOW);
ok(hr == S_OK, "Start failed: %08x\n", hr);
XA2CALL_0(StartEngine);
ok(hr == S_OK, "StartEngine failed: %08x\n", hr);
/* hook up volume meter */
if(xaudio27){
hr = CoCreateInstance(&CLSID_AudioVolumeMeter, NULL,
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&vumeter);
ok(hr == S_OK, "CoCreateInstance(AudioVolumeMeter) failed: %08x\n", hr);
}else{
hr = pCreateAudioVolumeMeter(&vumeter);
ok(hr == S_OK, "CreateAudioVolumeMeter failed: %08x\n", hr);
}
effect.InitialState = TRUE;
effect.OutputChannels = 2;
effect.pEffect = vumeter;
chain.EffectCount = 1;
chain.pEffectDescriptors = &effect;
hr = IXAudio2MasteringVoice_SetEffectChain(master, &chain);
ok(hr == S_OK, "SetEffectchain failed: %08x\n", hr);
IUnknown_Release(vumeter);
while(1){
if(xaudio27)
IXAudio27SourceVoice_GetState((IXAudio27SourceVoice*)src, &state);
else
//.........这里部分代码省略.........
开发者ID:ghaith,项目名称:wine,代码行数:101,代码来源:xaudio2.c
示例8: DirectSoundFullDuplexCreate
/***************************************************************************
* DirectSoundFullDuplexCreate [DSOUND.10]
*
* Create and initialize a DirectSoundFullDuplex interface.
*
* PARAMS
* pcGuidCaptureDevice [I] Address of sound capture device GUID.
* pcGuidRenderDevice [I] Address of sound render device GUID.
* pcDSCBufferDesc [I] Address of capture buffer description.
* pcDSBufferDesc [I] Address of render buffer description.
* hWnd [I] Handle to application window.
* dwLevel [I] Cooperative level.
* ppDSFD [O] Address where full duplex interface returned.
* ppDSCBuffer8 [0] Address where capture buffer interface returned.
* ppDSBuffer8 [0] Address where render buffer interface returned.
* pUnkOuter [I] Must be NULL.
*
* RETURNS
* Success: DS_OK
* Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
* DSERR_OUTOFMEMORY DSERR_INVALIDCALL DSERR_NODRIVER
*/
HRESULT WINAPI
DirectSoundFullDuplexCreate(
LPCGUID pcGuidCaptureDevice,
LPCGUID pcGuidRenderDevice,
LPCDSCBUFFERDESC pcDSCBufferDesc,
LPCDSBUFFERDESC pcDSBufferDesc,
HWND hWnd,
DWORD dwLevel,
LPDIRECTSOUNDFULLDUPLEX *ppDSFD,
LPDIRECTSOUNDCAPTUREBUFFER8 *ppDSCBuffer8,
LPDIRECTSOUNDBUFFER8 *ppDSBuffer8,
LPUNKNOWN pUnkOuter)
{
HRESULT hres;
IDirectSoundFullDuplexImpl *This = NULL;
TRACE("(%s,%s,%p,%p,%p,%x,%p,%p,%p,%p)\n",
debugstr_guid(pcGuidCaptureDevice), debugstr_guid(pcGuidRenderDevice),
pcDSCBufferDesc, pcDSBufferDesc, hWnd, dwLevel, ppDSFD, ppDSCBuffer8,
ppDSBuffer8, pUnkOuter);
if (pUnkOuter) {
WARN("pUnkOuter != 0\n");
*ppDSFD = NULL;
return DSERR_NOAGGREGATION;
}
if (pcDSCBufferDesc == NULL) {
WARN("invalid parameter: pcDSCBufferDesc == NULL\n");
*ppDSFD = NULL;
return DSERR_INVALIDPARAM;
}
if (pcDSBufferDesc == NULL) {
WARN("invalid parameter: pcDSBufferDesc == NULL\n");
*ppDSFD = NULL;
return DSERR_INVALIDPARAM;
}
if (ppDSFD == NULL) {
WARN("invalid parameter: ppDSFD == NULL\n");
return DSERR_INVALIDPARAM;
}
if (ppDSCBuffer8 == NULL) {
WARN("invalid parameter: ppDSCBuffer8 == NULL\n");
*ppDSFD = NULL;
return DSERR_INVALIDPARAM;
}
if (ppDSBuffer8 == NULL) {
WARN("invalid parameter: ppDSBuffer8 == NULL\n");
*ppDSFD = NULL;
return DSERR_INVALIDPARAM;
}
hres = DSOUND_FullDuplexCreate(&IID_IDirectSoundFullDuplex, (LPDIRECTSOUNDFULLDUPLEX*)&This);
if (FAILED(hres)) return hres;
hres = IDirectSoundFullDuplexImpl_Initialize((LPDIRECTSOUNDFULLDUPLEX)This,
pcGuidCaptureDevice,
pcGuidRenderDevice,
pcDSCBufferDesc,
pcDSBufferDesc,
hWnd, dwLevel, ppDSCBuffer8,
ppDSBuffer8);
if (hres != DS_OK) {
IUnknown_Release((LPDIRECTSOUNDFULLDUPLEX)This);
WARN("IDirectSoundFullDuplexImpl_Initialize failed\n");
*ppDSFD = NULL;
} else
*ppDSFD = (LPDIRECTSOUNDFULLDUPLEX)This;
return hres;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:96,代码来源:duplex.c
示例9: BindProtocol_StartEx
static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
DWORD grfPI, HANDLE *dwReserved)
{
BindProtocol *This = impl_from_IInternetProtocolEx(iface);
IInternetProtocol *protocol = NULL;
IInternetProtocolEx *protocolex;
IInternetPriority *priority;
IServiceProvider *service_provider;
BOOL urlmon_protocol = FALSE;
CLSID clsid = IID_NULL;
LPOLESTR clsid_str;
HRESULT hres;
TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink, pOIBindInfo, grfPI, dwReserved);
if(!pUri || !pOIProtSink || !pOIBindInfo)
return E_INVALIDARG;
This->pi = grfPI;
IUri_AddRef(pUri);
This->uri = pUri;
hres = IInternetProtocolSink_QueryInterface(pOIProtSink, &IID_IServiceProvider,
(void**)&service_provider);
if(SUCCEEDED(hres)) {
/* FIXME: What's protocol CLSID here? */
IServiceProvider_QueryService(service_provider, &IID_IInternetProtocol,
&IID_IInternetProtocol, (void**)&protocol);
IServiceProvider_Release(service_provider);
}
if(!protocol) {
IClassFactory *cf;
IUnknown *unk;
hres = get_protocol_handler(pUri, &clsid, &urlmon_protocol, &cf);
if(FAILED(hres))
return hres;
if(This->from_urlmon) {
hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&protocol);
IClassFactory_Release(cf);
if(FAILED(hres))
return hres;
}else {
hres = IClassFactory_CreateInstance(cf, (IUnknown*)&This->IInternetBindInfo_iface,
&IID_IUnknown, (void**)&unk);
IClassFactory_Release(cf);
if(FAILED(hres))
return hres;
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&protocol);
IUnknown_Release(unk);
if(FAILED(hres))
return hres;
}
}
StringFromCLSID(&clsid, &clsid_str);
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_PROTOCOLCLASSID, clsid_str);
CoTaskMemFree(clsid_str);
This->protocol = protocol;
if(urlmon_protocol) {
IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&This->wininet_info);
IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&This->wininet_http_info);
}
set_binding_sink(This, pOIProtSink, pOIBindInfo);
hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
if(SUCCEEDED(hres)) {
IInternetPriority_SetPriority(priority, This->priority);
IInternetPriority_Release(priority);
}
hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
if(SUCCEEDED(hres)) {
hres = IInternetProtocolEx_StartEx(protocolex, pUri, &This->IInternetProtocolSink_iface,
&This->IInternetBindInfo_iface, 0, NULL);
IInternetProtocolEx_Release(protocolex);
}else {
hres = IUri_GetDisplayUri(pUri, &This->display_uri);
if(FAILED(hres))
return hres;
hres = IInternetProtocol_Start(protocol, This->display_uri, &This->IInternetProtocolSink_iface,
&This->IInternetBindInfo_iface, 0, 0);
}
if(SUCCEEDED(hres))
process_tasks(This);
return hres;
}
开发者ID:Eltechs,项目名称:wine,代码行数:97,代码来源:bindprot.c
示例10: IUnknown_Release_Proxy
ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
{
StdProxyImpl *This = impl_from_proxy_obj( iface );
TRACE("(%p)->Release() %s\n",This,This->name);
return IUnknown_Release(This->pUnkOuter);
}
开发者ID:AlexSteel,项目名称:wine,代码行数:6,代码来源:cproxy.c
示例11: check_release
static inline void check_release(IUnknown *obj, int exp)
{
int ref = IUnknown_Release(obj);
ok (ref == exp, "Invalid refcount. Expected %d, got %d\n", exp, ref);
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:5,代码来源:surface.c
示例12: IRecordInfoImpl_RecordClear
static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvExisting)
{
IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
int i;
PVOID var;
TRACE("(%p)->(%p)\n", This, pvExisting);
if(!pvExisting)
return E_INVALIDARG;
for(i=0; i<This->n_vars; i++) {
if(This->fields[i].varkind != VAR_PERINSTANCE) {
ERR("varkind != VAR_PERINSTANCE\n");
continue;
}
var = ((PBYTE)pvExisting)+This->fields[i].offset;
switch(This->fields[i].vt) {
case VT_BSTR:
SysFreeString(*(BSTR*)var);
*(BSTR*)var = NULL;
break;
case VT_I2:
case VT_I4:
case VT_R4:
case VT_R8:
case VT_CY:
case VT_DATE:
case VT_ERROR:
case VT_BOOL:
case VT_DECIMAL:
case VT_I1:
case VT_UI1:
case VT_UI2:
case VT_UI4:
case VT_I8:
case VT_UI8:
case VT_INT:
case VT_UINT:
case VT_HRESULT:
break;
case VT_INT_PTR:
case VT_UINT_PTR:
*(void**)var = NULL;
break;
case VT_SAFEARRAY:
SafeArrayDestroy(var);
break;
case VT_UNKNOWN:
case VT_DISPATCH:
{
IUnknown *unk = *(IUnknown**)var;
if (unk)
IUnknown_Release(unk);
*(void**)var = NULL;
break;
}
default:
FIXME("Not supported vt = %d\n", This->fields[i].vt);
break;
}
}
return S_OK;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:65,代码来源:recinfo.c
示例13: OleObject_SetClientSite
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
{
HTMLDocument *This = impl_from_IOleObject(iface);
IOleCommandTarget *cmdtrg = NULL;
IOleWindow *ole_window;
IBrowserService *browser_service;
BOOL hostui_setup;
VARIANT silent;
HWND hwnd;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pClientSite);
if(pClientSite == This->doc_obj->client)
return S_OK;
if(This->doc_obj->client) {
IOleClientSite_Release(This->doc_obj->client);
This->doc_obj->client = NULL;
This->doc_obj->usermode = UNKNOWN_USERMODE;
}
if(This->doc_obj->client_cmdtrg) {
IOleCommandTarget_Release(This->doc_obj->client_cmdtrg);
This->doc_obj->client_cmdtrg = NULL;
}
if(This->doc_obj->hostui && !This->doc_obj->custom_hostui) {
IDocHostUIHandler_Release(This->doc_obj->hostui);
This->doc_obj->hostui = NULL;
}
if(This->doc_obj->doc_object_service) {
IDocObjectService_Release(This->doc_obj->doc_object_service);
This->doc_obj->doc_object_service = NULL;
}
if(This->doc_obj->webbrowser) {
IUnknown_Release(This->doc_obj->webbrowser);
This->doc_obj->webbrowser = NULL;
}
if(This->doc_obj->browser_service) {
IUnknown_Release(This->doc_obj->browser_service);
This->doc_obj->browser_service = NULL;
}
if(This->doc_obj->travel_log) {
ITravelLog_Release(This->doc_obj->travel_log);
This->doc_obj->travel_log = NULL;
}
memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
if(!pClientSite)
return S_OK;
IOleClientSite_AddRef(pClientSite);
This->doc_obj->client = pClientSite;
hostui_setup = This->doc_obj->hostui_setup;
if(!This->doc_obj->hostui) {
IDocHostUIHandler *uihandler;
This->doc_obj->custom_hostui = FALSE;
hres = IOleClientSite_QueryInterface(pClientSite, &IID_IDocHostUIHandler, (void**)&uihandler);
if(SUCCEEDED(hres))
This->doc_obj->hostui = uihandler;
}
if(This->doc_obj->hostui) {
DOCHOSTUIINFO hostinfo;
LPOLESTR key_path = NULL, override_key_path = NULL;
IDocHostUIHandler2 *uihandler2;
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
hres = IDocHostUIHandler_GetHostInfo(This->doc_obj->hostui, &hostinfo);
if(SUCCEEDED(hres)) {
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
update_hostinfo(This->doc_obj, &hostinfo);
This->doc_obj->hostinfo = hostinfo;
}
if(!hostui_setup) {
hres = IDocHostUIHandler_GetOptionKeyPath(This->doc_obj->hostui, &key_path, 0);
if(hres == S_OK && key_path) {
if(key_path[0]) {
/* FIXME: use key_path */
FIXME("key_path = %s\n", debugstr_w(key_path));
}
CoTaskMemFree(key_path);
}
hres = IDocHostUIHandler_QueryInterface(This->doc_obj->hostui, &IID_IDocHostUIHandler2,
(void**)&uihandler2);
//.........这里部分代码省略.........
开发者ID:AndreRH,项目名称:wine,代码行数:101,代码来源:oleobj.c
示例14: _expect_ref
static void _expect_ref(IUnknown* obj, ULONG ref, int line)
{
ULONG rc = IUnknown_AddRef(obj);
IUnknown_Release(obj);
ok_(__FILE__,line)(rc-1 == ref, "expected refcount %d, got %d\n", ref, rc-1);
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:6,代码来源:saxreader.c
示例15: test_bom
static void test_bom(void)
{
static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0};
static const WCHAR utf16W[] = {'u','t','f','-','1','6',0};
static const WCHAR xmlW[] = {'x','m','l',0};
static const WCHAR aW[] = {'a',0};
IXmlWriterOutput *output;
unsigned char *ptr;
IXmlWriter *writer;
IStream *stream;
HGLOBAL hglobal;
HRESULT hr;
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_SetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, TRUE);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* BOM is on by default */
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = GetHGlobalFromStream(stream, &hglobal);
ok(hr == S_OK, "got 0x%08x\n", hr);
ptr = GlobalLock(hglobal);
ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]);
GlobalUnlock(hglobal);
IStream_Release(stream);
IUnknown_Release(output);
/* start with PI */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = GetHGlobalFromStream(stream, &hglobal);
ok(hr == S_OK, "got 0x%08x\n", hr);
ptr = GlobalLock(hglobal);
ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]);
GlobalUnlock(hglobal);
IUnknown_Release(output);
IStream_Release(stream);
/* start with element */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = GetHGlobalFromStream(stream, &hglobal);
ok(hr == S_OK, "got 0x%08x\n", hr);
ptr = GlobalLock(hglobal);
ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]);
GlobalUnlock(hglobal);
IUnknown_Release(output);
IStream_Release(stream);
/* WriteElementString */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,代码来源:writer.c
示例16: DestroyVideoService
void DestroyVideoService(vlc_va_t *va, directx_sys_t *dx_sys)
{
dx_sys->pf_destroy_video_service(va);
if (dx_sys->d3ddec)
IUnknown_Release(dx_sys->d3ddec);
}
开发者ID:kiran272,项目名称:vlc,代码行数:6,代码来源:directx_va.c
示例17: gst_wasapi_sink_prepare
static gboolean
gst_wasapi_sink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
{
GstWasapiSink *self = GST_WASAPI_SINK (asink);
gboolean res = FALSE;
HRESULT hr;
REFERENCE_TIME latency_rt, def_period, min_period;
WAVEFORMATEXTENSIBLE format;
IAudioRenderClient *render_client = NULL;
hr = IAudioClient_GetDevicePeriod (self->client, &def_period, &min_period);
if (hr != S_OK) {
GST_ERROR_OBJECT (self, "IAudioClient::GetDevicePeriod () failed");
goto beach;
}
gst_wasapi_util_audio_info_to_waveformatex (&spec->info, &format);
self->info = spec->info;
hr = IAudioClient_Initialize (self->client, AUDCLNT_SHAREMODE_SHARED,
AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
spec->buffer_time / 100, 0, (WAVEFORMATEX *) & format, NULL);
if (hr != S_OK) {
GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ, (NULL),
("IAudioClient::Initialize () failed: %s",
gst_wasapi_util_hresult_to_string (hr)));
goto beach;
}
hr = IAudioClient_GetStreamLatency (self->client, &latency_rt);
if (hr != S_OK) {
GST_ERROR_OBJECT (self, "IAudioClient::GetStreamLatency () failed");
goto beach;
}
GST_INFO_OBJECT (self, "default period: %d (%d ms), "
"minimum period: %d (%d ms), "
"latency: %d (%d ms)",
(guint32) def_period, (guint32) def_period / 10000,
(guint32) min_period, (guint32) min_period / 10000,
(guint32) latency_rt, (guint32) latency_rt / 10000);
/* FIXME: What to do with the latency? */
hr = IAudioClient_SetEventHandle (self->client, self->event_handle);
if (hr != S_OK) {
GST_ERROR_OBJECT (self, "IAudioClient::SetEventHandle () failed");
goto beach;
}
if (!gst_wasapi_util_get_render_client (GST_ELEMENT (self), self->client,
&render_client)) {
goto beach;
}
hr = IAudioClient_Start (self->client);
if (hr != S_OK) {
GST_ERROR_OBJECT (self, "IAudioClient::Start failed");
goto beach;
}
self->render_client = render_client;
render_client = NULL;
res = TRUE;
beach:
if (render_client != NULL)
IUnknown_Release (render_client);
return res;
}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gst-plugins-bad,代码行数:72,代码来源:gstwasapisink.c
示例18: DestroyDevice
void DestroyDevice(vlc_va_t *va, directx_sys_t *dx_sys)
{
dx_sys->pf_destroy_device(va);
if (dx_sys->d3ddev)
IUnknown_Release( dx_sys->d3ddev );
}
开发者ID:kiran272,项目名称:vlc,代码行数:6,代码来源:directx_va.c
示例19: DEVENUM_IMediaCatMoniker_BindToObject
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(IMoniker *iface, IBindCtx *pbc,
IMoniker *pmkToLeft, REFIID riidResult, void **ppvResult)
{
MediaCatMoniker *This = impl_from_IMoniker(iface);
IUnknown * pObj = NULL;
IPropertyBag * pProp = NULL;
CLSID clsID;
VARIANT var;
HRESULT res = E_FAIL;
TRACE("(%p)->(%p, %p, %s, %p)\n", This, pbc, pmkToLeft, debugstr_guid(riidResult), ppvResult);
VariantInit(&var);
*ppvResult = NULL;
if(pmkToLeft==NULL)
{
/* first activation of this class */
LPVOID pvptr;
res=IMoniker_BindToStorage(iface, NULL, NULL, &IID_IPropertyBag, &pvptr);
pProp = pvptr;
if (SUCCEEDED(res))
{
V_VT(&var) = VT_LPWSTR;
res = IPropertyBag_Read(pProp, clsid_keyname, &var, NULL);
}
if (SUCCEEDED(res))
{
res = CLSIDFromString(V_UNION(&var,bstrVal), &clsID);
CoTaskMemFree(V_UNION(&var, bstrVal));
}
if (SUCCEEDED(res))
{
res=CoCreateInstance(&clsID,NULL,CLSCTX_ALL,&IID_IUnknown,&pvptr);
pObj = pvptr;
}
}
if (pObj!=NULL)
{
/* get the requested interface from the loaded class */
res = S_OK;
if (pProp) {
HRESULT res2;
LPVOID ppv = NULL;
res2 = IUnknown_QueryInterface(pObj, &IID_IPersistPropertyBag, &ppv);
if (SUCCEEDED(res2)) {
res = IPersistPropertyBag_Load((IPersistPropertyBag *) ppv, pProp, NULL);
IPersistPropertyBag_Release((IPersistPropertyBag *) ppv);
}
}
if (SUCCEEDED(res))
res= IUnknown_QueryInterface(pObj,riidResult,ppvResult);
IUnknown_Release(pObj);
}
if (pProp)
{
IPropertyBag_Release(pProp);
}
TRACE("<- 0x%x\n", res);
return res;
}
开发者ID:Kelimion,项目名称:wine,代码行数:65,代码来源:mediacatenum.c
示例20: ConnectionPointContainer_Release
static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
{
ConnectionPointContainer *This = CONPTCONT_THIS(iface);
return IUnknown_Release(This->outer);
}
开发者ID:bilboed,项目名称:wine,代码行数:5,代码来源:conpoint.c
注:本文中的IUnknown_Release函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论