Module: wine Branch: master Commit: b4bab7679228ef8b3ce4c57cb89117855e9098c8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b4bab7679228ef8b3ce4c57cb8...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Aug 2 09:50:29 2013 +0400
oledb32: Added IConnectionPoint stub for IRowPositionChange notification.
---
dlls/oledb32/oledb_private.h | 10 ++++ dlls/oledb32/rowpos.c | 102 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 109 insertions(+), 3 deletions(-)
diff --git a/dlls/oledb32/oledb_private.h b/dlls/oledb32/oledb_private.h index 3ff8d1d..1570529 100644 --- a/dlls/oledb32/oledb_private.h +++ b/dlls/oledb32/oledb_private.h @@ -21,3 +21,13 @@ HRESULT create_oledb_convert(IUnknown *outer, void **obj) DECLSPEC_HIDDEN; HRESULT create_data_init(IUnknown *outer, void **obj) DECLSPEC_HIDDEN; HRESULT create_error_info(IUnknown *outer, void **obj) DECLSPEC_HIDDEN; HRESULT create_oledb_rowpos(IUnknown *outer, void **obj) DECLSPEC_HIDDEN; + +static inline void *heap_alloc(size_t len) +{ + return HeapAlloc(GetProcessHeap(), 0, len); +} + +static inline BOOL heap_free(void *mem) +{ + return HeapFree(GetProcessHeap(), 0, mem); +} diff --git a/dlls/oledb32/rowpos.c b/dlls/oledb32/rowpos.c index 88cdb6e..96a36a5 100644 --- a/dlls/oledb32/rowpos.c +++ b/dlls/oledb32/rowpos.c @@ -30,14 +30,22 @@
WINE_DEFAULT_DEBUG_CHANNEL(oledb);
+typedef struct rowpos rowpos; typedef struct { + IConnectionPoint IConnectionPoint_iface; + rowpos *container; +} rowpos_cp; + +struct rowpos +{ IRowPosition IRowPosition_iface; IConnectionPointContainer IConnectionPointContainer_iface; LONG ref;
IRowset *rowset; -} rowpos; + rowpos_cp cp; +};
static inline rowpos *impl_from_IRowPosition(IRowPosition *iface) { @@ -49,6 +57,11 @@ static inline rowpos *impl_from_IConnectionPointContainer(IConnectionPointContai return CONTAINING_RECORD(iface, rowpos, IConnectionPointContainer_iface); }
+static inline rowpos_cp *impl_from_IConnectionPoint(IConnectionPoint *iface) +{ + return CONTAINING_RECORD(iface, rowpos_cp, IConnectionPoint_iface); +} + static HRESULT WINAPI rowpos_QueryInterface(IRowPosition* iface, REFIID riid, void **obj) { rowpos *This = impl_from_IRowPosition(iface); @@ -94,7 +107,7 @@ static ULONG WINAPI rowpos_Release(IRowPosition* iface) if (ref == 0) { if (This->rowset) IRowset_Release(This->rowset); - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); }
return ref; @@ -194,6 +207,88 @@ static const struct IConnectionPointContainerVtbl rowpos_cpc_vtbl = cpc_FindConnectionPoint };
+static HRESULT WINAPI rowpos_cp_QueryInterface(IConnectionPoint *iface, REFIID riid, void **obj) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + return IConnectionPointContainer_QueryInterface(&This->container->IConnectionPointContainer_iface, riid, obj); +} + +static ULONG WINAPI rowpos_cp_AddRef(IConnectionPoint *iface) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + return IConnectionPointContainer_AddRef(&This->container->IConnectionPointContainer_iface); +} + +static ULONG WINAPI rowpos_cp_Release(IConnectionPoint *iface) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + return IConnectionPointContainer_Release(&This->container->IConnectionPointContainer_iface); +} + +static HRESULT WINAPI rowpos_cp_GetConnectionInterface(IConnectionPoint *iface, IID *iid) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + + TRACE("(%p)->(%p)\n", This, iid); + + if (!iid) return E_POINTER; + + *iid = IID_IRowPositionChange; + return S_OK; +} + +static HRESULT WINAPI rowpos_cp_GetConnectionPointContainer(IConnectionPoint *iface, IConnectionPointContainer **container) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + + TRACE("(%p)->(%p)\n", This, container); + + if (!container) return E_POINTER; + + *container = &This->container->IConnectionPointContainer_iface; + IConnectionPointContainer_AddRef(*container); + return S_OK; +} + +static HRESULT WINAPI rowpos_cp_Advise(IConnectionPoint *iface, IUnknown *sink, DWORD *cookie) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + FIXME("(%p)->(%p %p): stub\n", This, sink, cookie); + return E_NOTIMPL; +} + +static HRESULT WINAPI rowpos_cp_Unadvise(IConnectionPoint *iface, DWORD cookie) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + FIXME("(%p)->(%d): stub\n", This, cookie); + return E_NOTIMPL; +} + +static HRESULT WINAPI rowpos_cp_EnumConnections(IConnectionPoint *iface, IEnumConnections **enum_c) +{ + rowpos_cp *This = impl_from_IConnectionPoint(iface); + FIXME("(%p)->(%p): stub\n", This, enum_c); + return E_NOTIMPL; +} + +static const struct IConnectionPointVtbl rowpos_cp_vtbl = +{ + rowpos_cp_QueryInterface, + rowpos_cp_AddRef, + rowpos_cp_Release, + rowpos_cp_GetConnectionInterface, + rowpos_cp_GetConnectionPointContainer, + rowpos_cp_Advise, + rowpos_cp_Unadvise, + rowpos_cp_EnumConnections +}; + +static void rowposchange_cp_init(rowpos_cp *cp, rowpos *container) +{ + cp->IConnectionPoint_iface.lpVtbl = &rowpos_cp_vtbl; + cp->container = container; +} + HRESULT create_oledb_rowpos(IUnknown *outer, void **obj) { rowpos *This; @@ -204,13 +299,14 @@ HRESULT create_oledb_rowpos(IUnknown *outer, void **obj)
if(outer) return CLASS_E_NOAGGREGATION;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + This = heap_alloc(sizeof(*This)); if(!This) return E_OUTOFMEMORY;
This->IRowPosition_iface.lpVtbl = &rowpos_vtbl; This->IConnectionPointContainer_iface.lpVtbl = &rowpos_cpc_vtbl; This->ref = 1; This->rowset = NULL; + rowposchange_cp_init(&This->cp, This);
*obj = &This->IRowPosition_iface;