Changeset 6649 for trunk/src/quartz/iunk.c
- Timestamp:
- Sep 5, 2001, 3:39:12 PM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/quartz/iunk.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/quartz/iunk.c
r6578 r6649 1 /* $Id: iunk.c,v 1.3 2001-09-05 13:36:37 bird Exp $ */ 1 2 /* 2 3 * An implementation of IUnknown. … … 21 22 IUnknown_fnQueryInterface(IUnknown* iface,REFIID riid,LPVOID *ppobj) 22 23 { 23 ICOM_THIS(QUARTZ_IUnkImpl,iface);24 size_tofs;25 DWORDdwIndex;24 ICOM_THIS(QUARTZ_IUnkImpl,iface); 25 size_t ofs; 26 DWORD dwIndex; 26 27 27 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);28 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); 28 29 29 if ( ppobj == NULL )30 return E_POINTER;31 *ppobj = NULL;30 if ( ppobj == NULL ) 31 return E_POINTER; 32 *ppobj = NULL; 32 33 33 ofs = 0;34 ofs = 0; 34 35 35 if ( IsEqualGUID( &IID_IUnknown, riid ) )36 {37 TRACE("IID_IUnknown - returns inner object.\n");38 }39 else40 {41 for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )42 {43 if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )44 {45 ofs = This->pEntries[dwIndex].ofsVTPtr;46 break;47 }48 }49 if ( dwIndex == This->dwEntries )50 {51 FIXME("unknown interface: %s\n",debugstr_guid(riid));52 return E_NOINTERFACE;53 }54 }36 if ( IsEqualGUID( &IID_IUnknown, riid ) ) 37 { 38 TRACE("IID_IUnknown - returns inner object.\n"); 39 } 40 else 41 { 42 for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ ) 43 { 44 if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) ) 45 { 46 ofs = This->pEntries[dwIndex].ofsVTPtr; 47 break; 48 } 49 } 50 if ( dwIndex == This->dwEntries ) 51 { 52 FIXME("unknown interface: %s\n",debugstr_guid(riid)); 53 return E_NOINTERFACE; 54 } 55 } 55 56 56 *ppobj = (LPVOID)(((char*)This) + ofs);57 IUnknown_AddRef((IUnknown*)(*ppobj));57 *ppobj = (LPVOID)(((char*)This) + ofs); 58 IUnknown_AddRef((IUnknown*)(*ppobj)); 58 59 59 return S_OK;60 return S_OK; 60 61 } 61 62 … … 63 64 IUnknown_fnAddRef(IUnknown* iface) 64 65 { 65 ICOM_THIS(QUARTZ_IUnkImpl,iface);66 ICOM_THIS(QUARTZ_IUnkImpl,iface); 66 67 67 TRACE("(%p)->()\n",This);68 TRACE("(%p)->()\n",This); 68 69 69 return ++(This->ref);70 return ++(This->ref); 70 71 } 71 72 … … 73 74 IUnknown_fnRelease(IUnknown* iface) 74 75 { 75 ICOM_THIS(QUARTZ_IUnkImpl,iface);76 ICOM_THIS(QUARTZ_IUnkImpl,iface); 76 77 77 TRACE("(%p)->()\n",This);78 if ( (--(This->ref)) > 0 )79 return This->ref;78 TRACE("(%p)->()\n",This); 79 if ( (--(This->ref)) > 0 ) 80 return This->ref; 80 81 81 QUARTZ_FreeObj(This);82 QUARTZ_FreeObj(This); 82 83 83 return 0;84 return 0; 84 85 } 85 86 86 87 static ICOM_VTABLE(IUnknown) iunknown = 87 88 { 88 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE89 /* IUnknown fields */90 IUnknown_fnQueryInterface,91 IUnknown_fnAddRef,92 IUnknown_fnRelease,89 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 90 /* IUnknown fields */ 91 IUnknown_fnQueryInterface, 92 IUnknown_fnAddRef, 93 IUnknown_fnRelease, 93 94 }; 94 95 … … 96 97 void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter ) 97 98 { 98 TRACE("(%p)\n",pImpl);99 TRACE("(%p)\n",pImpl); 99 100 100 ICOM_VTBL(pImpl) = &iunknown;101 pImpl->pEntries = NULL;102 pImpl->dwEntries = 0;103 pImpl->ref = 1;104 pImpl->punkControl = (IUnknown*)pImpl;101 ICOM_VTBL(pImpl) = &iunknown; 102 pImpl->pEntries = NULL; 103 pImpl->dwEntries = 0; 104 pImpl->ref = 1; 105 pImpl->punkControl = (IUnknown*)pImpl; 105 106 106 /* for delegation. */107 if ( punkOuter != NULL )108 pImpl->punkControl = punkOuter;107 /* for delegation. */ 108 if ( punkOuter != NULL ) 109 pImpl->punkControl = punkOuter; 109 110 } 110 111
Note:
See TracChangeset
for help on using the changeset viewer.
