Jacek Caban : ieframe: Added IConnectionPoint:: EnumConnections implementation.
Alexandre Julliard
julliard at winehq.org
Mon Apr 15 13:09:41 CDT 2013
Module: wine
Branch: master
Commit: e8efc1e630ede221d87301c16dd72028aa886bb9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e8efc1e630ede221d87301c16dd72028aa886bb9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Apr 15 17:41:17 2013 +0200
ieframe: Added IConnectionPoint::EnumConnections implementation.
---
dlls/ieframe/events.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 131 insertions(+), 4 deletions(-)
diff --git a/dlls/ieframe/events.c b/dlls/ieframe/events.c
index 5a426ab..eef1c17 100644
--- a/dlls/ieframe/events.c
+++ b/dlls/ieframe/events.c
@@ -109,8 +109,6 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
return CONNECT_E_NOCONNECTION;
}
-#undef impl_from_IConnectionPointContainer
-
static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl =
{
ConnectionPointContainer_QueryInterface,
@@ -130,6 +128,120 @@ static inline ConnectionPoint *impl_from_IConnectionPoint(IConnectionPoint *ifac
return CONTAINING_RECORD(iface, ConnectionPoint, IConnectionPoint_iface);
}
+typedef struct {
+ IEnumConnections IEnumConnections_iface;
+
+ LONG ref;
+
+ ConnectionPoint *cp;
+ DWORD iter;
+} EnumConnections;
+
+static inline EnumConnections *impl_from_IEnumConnections(IEnumConnections *iface)
+{
+ return CONTAINING_RECORD(iface, EnumConnections, IEnumConnections_iface);
+}
+
+static HRESULT WINAPI EnumConnections_QueryInterface(IEnumConnections *iface, REFIID riid, void **ppv)
+{
+ EnumConnections *This = impl_from_IEnumConnections(iface);
+
+ if(IsEqualGUID(&IID_IUnknown, riid)) {
+ TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+ *ppv = &This->IEnumConnections_iface;
+ }else if(IsEqualGUID(&IID_IEnumConnections, riid)) {
+ TRACE("(%p)->(IID_IEnumConnections %p)\n", This, ppv);
+ *ppv = &This->IEnumConnections_iface;
+ }else {
+ WARN("Unsupported interface %s\n", debugstr_guid(riid));
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI EnumConnections_AddRef(IEnumConnections *iface)
+{
+ EnumConnections *This = impl_from_IEnumConnections(iface);
+ LONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI EnumConnections_Release(IEnumConnections *iface)
+{
+ EnumConnections *This = impl_from_IEnumConnections(iface);
+ LONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ if(!ref) {
+ IConnectionPoint_Release(&This->cp->IConnectionPoint_iface);
+ heap_free(This);
+ }
+
+ return ref;
+}
+
+static HRESULT WINAPI EnumConnections_Next(IEnumConnections *iface, ULONG cConnections, CONNECTDATA *pgcd, ULONG *pcFetched)
+{
+ EnumConnections *This = impl_from_IEnumConnections(iface);
+ ULONG cnt = 0;
+
+ TRACE("(%p)->(%u %p %p)\n", This, cConnections, pgcd, pcFetched);
+
+ while(cConnections--) {
+ while(This->iter < This->cp->sinks_size && !This->cp->sinks[This->iter])
+ This->iter++;
+ if(This->iter == This->cp->sinks_size)
+ break;
+
+ pgcd[cnt].pUnk = (IUnknown*)This->cp->sinks[This->iter];
+ pgcd[cnt].dwCookie = cnt+1;
+ This->iter++;
+ cnt++;
+ }
+
+ if(pcFetched)
+ *pcFetched = cnt;
+ return cnt ? S_OK : S_FALSE;
+}
+
+static HRESULT WINAPI EnumConnections_Skip(IEnumConnections *iface, ULONG cConnections)
+{
+ EnumConnections *This = impl_from_IEnumConnections(iface);
+ FIXME("(%p)->(%u)\n", This, cConnections);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI EnumConnections_Reset(IEnumConnections *iface)
+{
+ EnumConnections *This = impl_from_IEnumConnections(iface);
+ FIXME("(%p)\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI EnumConnections_Clone(IEnumConnections *iface, IEnumConnections **ppEnum)
+{
+ EnumConnections *This = impl_from_IEnumConnections(iface);
+ FIXME("(%p)->(%p)\n", This, ppEnum);
+ return E_NOTIMPL;
+}
+
+static const IEnumConnectionsVtbl EnumConnectionsVtbl = {
+ EnumConnections_QueryInterface,
+ EnumConnections_AddRef,
+ EnumConnections_Release,
+ EnumConnections_Next,
+ EnumConnections_Skip,
+ EnumConnections_Reset,
+ EnumConnections_Clone
+};
+
static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface,
REFIID riid, LPVOID *ppv)
{
@@ -245,8 +357,23 @@ static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
IEnumConnections **ppEnum)
{
ConnectionPoint *This = impl_from_IConnectionPoint(iface);
- FIXME("(%p)->(%p)\n", This, ppEnum);
- return E_NOTIMPL;
+ EnumConnections *ret;
+
+ TRACE("(%p)->(%p)\n", This, ppEnum);
+
+ ret = heap_alloc(sizeof(*ret));
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ ret->IEnumConnections_iface.lpVtbl = &EnumConnectionsVtbl;
+ ret->ref = 1;
+ ret->iter = 0;
+
+ IConnectionPoint_AddRef(&This->IConnectionPoint_iface);
+ ret->cp = This;
+
+ *ppEnum = &ret->IEnumConnections_iface;
+ return S_OK;
}
static const IConnectionPointVtbl ConnectionPointVtbl =
More information about the wine-cvs
mailing list