Huw Davies : ole32: Add a stub advise sink object to the data cache.
Alexandre Julliard
julliard at winehq.org
Mon Nov 1 11:54:40 CDT 2010
Module: wine
Branch: master
Commit: 4d137e4702349c3dabea18f4e31faf2f7a5d1d34
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4d137e4702349c3dabea18f4e31faf2f7a5d1d34
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Oct 26 14:35:14 2010 +0100
ole32: Add a stub advise sink object to the data cache.
---
dlls/ole32/datacache.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index db4cc0c..9f183b7 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -126,6 +126,10 @@ struct DataCache
const IOleCache2Vtbl* lpvtblIOleCache2;
const IOleCacheControlVtbl* lpvtblIOleCacheControl;
+ /* The sink that is connected to a remote object.
+ The other interfaces are not available by QI'ing the sink and vice-versa */
+ const IAdviseSinkVtbl* lpvtblIAdviseSink;
+
/*
* Reference count of this object
*/
@@ -193,6 +197,11 @@ static inline DataCache *impl_from_IOleCacheControl( IOleCacheControl *iface )
return (DataCache *)((char*)iface - FIELD_OFFSET(DataCache, lpvtblIOleCacheControl));
}
+static inline DataCache *impl_from_IAdviseSink( IAdviseSink *iface )
+{
+ return (DataCache *)((char*)iface - FIELD_OFFSET(DataCache, lpvtblIAdviseSink));
+}
+
static const char * debugstr_formatetc(const FORMATETC *formatetc)
{
return wine_dbg_sprintf("{ cfFormat = 0x%x, ptd = %p, dwAspect = %d, lindex = %d, tymed = %d }",
@@ -2163,6 +2172,64 @@ static HRESULT WINAPI DataCache_OnStop(
return E_NOTIMPL;
}
+/************************************************************************
+ * IAdviseSink methods.
+ * This behaves as an internal object to the data cache. QI'ing its ptr doesn't
+ * give access to the cache's other interfaces. We don't maintain a ref count,
+ * the object exists as long as the cache is around.
+ */
+static HRESULT WINAPI DataCache_IAdviseSink_QueryInterface(IAdviseSink *iface, REFIID iid, void **obj)
+{
+ *obj = NULL;
+ if (IsEqualIID(&IID_IUnknown, iid) ||
+ IsEqualIID(&IID_IAdviseSink, iid))
+ {
+ *obj = iface;
+ }
+
+ if(*obj)
+ {
+ IAdviseSink_AddRef(iface);
+ return S_OK;
+ }
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI DataCache_IAdviseSink_AddRef(IAdviseSink *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI DataCache_IAdviseSink_Release(IAdviseSink *iface)
+{
+ return 1;
+}
+
+static void WINAPI DataCache_OnDataChange(IAdviseSink *iface, FORMATETC *fmt, STGMEDIUM *med)
+{
+ FIXME("stub\n");
+}
+
+static void WINAPI DataCache_OnViewChange(IAdviseSink *iface, DWORD aspect, LONG index)
+{
+ FIXME("stub\n");
+}
+
+static void WINAPI DataCache_OnRename(IAdviseSink *iface, IMoniker *mk)
+{
+ FIXME("stub\n");
+}
+
+static void WINAPI DataCache_OnSave(IAdviseSink *iface)
+{
+ FIXME("stub\n");
+}
+
+static void WINAPI DataCache_OnClose(IAdviseSink *iface)
+{
+ FIXME("stub\n");
+}
+
/*
* Virtual function tables for the DataCache class.
*/
@@ -2240,6 +2307,19 @@ static const IOleCacheControlVtbl DataCache_IOleCacheControl_VTable =
DataCache_OnStop
};
+static const IAdviseSinkVtbl DataCache_IAdviseSink_VTable =
+{
+ DataCache_IAdviseSink_QueryInterface,
+ DataCache_IAdviseSink_AddRef,
+ DataCache_IAdviseSink_Release,
+ DataCache_OnDataChange,
+ DataCache_OnViewChange,
+ DataCache_OnRename,
+ DataCache_OnSave,
+ DataCache_OnClose
+};
+
+
/******************************************************************************
* CreateDataCache [OLE32.@]
*
@@ -2338,6 +2418,7 @@ static DataCache* DataCache_Construct(
newObject->lpvtblIViewObject = &DataCache_IViewObject2_VTable;
newObject->lpvtblIOleCache2 = &DataCache_IOleCache2_VTable;
newObject->lpvtblIOleCacheControl = &DataCache_IOleCacheControl_VTable;
+ newObject->lpvtblIAdviseSink = &DataCache_IAdviseSink_VTable;
/*
* Start with one reference count. The caller of this function
More information about the wine-cvs
mailing list