Nikolay Sivov : oledb32: Added IConnectionPointContainer stub.

Alexandre Julliard julliard at winehq.org
Fri Aug 2 09:53:39 CDT 2013


Module: wine
Branch: master
Commit: 2111d70c252ebeba145552f64aa03a2abafb8dc0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2111d70c252ebeba145552f64aa03a2abafb8dc0

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Aug  2 09:44:43 2013 +0400

oledb32: Added IConnectionPointContainer stub.

---

 dlls/oledb32/rowpos.c         |   52 +++++++++++++++++++++++++++++++++++++++++
 dlls/oledb32/tests/database.c |   40 +++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/dlls/oledb32/rowpos.c b/dlls/oledb32/rowpos.c
index d789c19..88cdb6e 100644
--- a/dlls/oledb32/rowpos.c
+++ b/dlls/oledb32/rowpos.c
@@ -33,6 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(oledb);
 typedef struct
 {
     IRowPosition IRowPosition_iface;
+    IConnectionPointContainer IConnectionPointContainer_iface;
     LONG ref;
 
     IRowset *rowset;
@@ -43,6 +44,11 @@ static inline rowpos *impl_from_IRowPosition(IRowPosition *iface)
     return CONTAINING_RECORD(iface, rowpos, IRowPosition_iface);
 }
 
+static inline rowpos *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
+{
+    return CONTAINING_RECORD(iface, rowpos, IConnectionPointContainer_iface);
+}
+
 static HRESULT WINAPI rowpos_QueryInterface(IRowPosition* iface, REFIID riid, void **obj)
 {
     rowpos *This = impl_from_IRowPosition(iface);
@@ -56,6 +62,10 @@ static HRESULT WINAPI rowpos_QueryInterface(IRowPosition* iface, REFIID riid, vo
     {
         *obj = iface;
     }
+    else if (IsEqualIID(riid, &IID_IConnectionPointContainer))
+    {
+        *obj = &This->IConnectionPointContainer_iface;
+    }
     else
     {
         FIXME("interface %s not implemented\n", debugstr_guid(riid));
@@ -143,6 +153,47 @@ static const struct IRowPositionVtbl rowpos_vtbl =
     rowpos_SetRowPosition
 };
 
+static HRESULT WINAPI cpc_QueryInterface(IConnectionPointContainer *iface, REFIID riid, void **obj)
+{
+    rowpos *This = impl_from_IConnectionPointContainer(iface);
+    return IRowPosition_QueryInterface(&This->IRowPosition_iface, riid, obj);
+}
+
+static ULONG WINAPI cpc_AddRef(IConnectionPointContainer *iface)
+{
+    rowpos *This = impl_from_IConnectionPointContainer(iface);
+    return IRowPosition_AddRef(&This->IRowPosition_iface);
+}
+
+static ULONG WINAPI cpc_Release(IConnectionPointContainer *iface)
+{
+    rowpos *This = impl_from_IConnectionPointContainer(iface);
+    return IRowPosition_Release(&This->IRowPosition_iface);
+}
+
+static HRESULT WINAPI cpc_EnumConnectionPoints(IConnectionPointContainer *iface, IEnumConnectionPoints **enum_points)
+{
+    rowpos *This = impl_from_IConnectionPointContainer(iface);
+    FIXME("(%p)->(%p): stub\n", This, enum_points);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI cpc_FindConnectionPoint(IConnectionPointContainer *iface, REFIID riid, IConnectionPoint **point)
+{
+    rowpos *This = impl_from_IConnectionPointContainer(iface);
+    FIXME("(%p)->(%s %p): stub\n", This, debugstr_guid(riid), point);
+    return E_NOTIMPL;
+}
+
+static const struct IConnectionPointContainerVtbl rowpos_cpc_vtbl =
+{
+    cpc_QueryInterface,
+    cpc_AddRef,
+    cpc_Release,
+    cpc_EnumConnectionPoints,
+    cpc_FindConnectionPoint
+};
+
 HRESULT create_oledb_rowpos(IUnknown *outer, void **obj)
 {
     rowpos *This;
@@ -157,6 +208,7 @@ HRESULT create_oledb_rowpos(IUnknown *outer, void **obj)
     if(!This) return E_OUTOFMEMORY;
 
     This->IRowPosition_iface.lpVtbl = &rowpos_vtbl;
+    This->IConnectionPointContainer_iface.lpVtbl = &rowpos_cpc_vtbl;
     This->ref = 1;
     This->rowset = NULL;
 
diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c
index d54d546..7b129b8 100644
--- a/dlls/oledb32/tests/database.c
+++ b/dlls/oledb32/tests/database.c
@@ -17,6 +17,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #include <stdarg.h>
+#include <stdio.h>
 
 #define COBJMACROS
 #define NONAMELESSUNION
@@ -37,6 +38,21 @@ DEFINE_GUID(CSLID_MSDAER, 0xc8b522cf,0x5cf3,0x11ce,0xad,0xe5,0x00,0xaa,0x00,0x44
 
 static WCHAR initstring_default[] = {'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y',';',0};
 
+static const char *debugstr_guid(REFIID riid)
+{
+    static char buf[50];
+
+    if(!riid)
+        return "(null)";
+
+    sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+            riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
+            riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
+            riid->Data4[5], riid->Data4[6], riid->Data4[7]);
+
+    return buf;
+}
+
 static void test_GetDataSource(WCHAR *initstring)
 {
     IDataInitialize *datainit = NULL;
@@ -188,12 +204,36 @@ static void test_initializationstring(void)
 
 static void test_rowposition(void)
 {
+    IEnumConnectionPoints *enum_points;
+    IConnectionPointContainer *cpc;
+    IConnectionPoint *cp;
     IRowPosition *rowpos;
     HRESULT hr;
+    IID iid;
 
     hr = CoCreateInstance(&CLSID_OLEDB_ROWPOSITIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IRowPosition, (void**)&rowpos);
     ok(hr == S_OK, "got %08x\n", hr);
 
+    hr = IRowPosition_QueryInterface(rowpos, &IID_IConnectionPointContainer, (void**)&cpc);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    hr = IConnectionPointContainer_EnumConnectionPoints(cpc, &enum_points);
+todo_wine
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+if (hr == S_OK) {
+    hr = IEnumConnectionPoints_Next(enum_points, 1, &cp, NULL);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    hr = IConnectionPoint_GetConnectionInterface(cp, &iid);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(IsEqualIID(&iid, &IID_IRowPositionChange), "got %s\n", debugstr_guid(&iid));
+    IConnectionPoint_Release(cp);
+
+    hr = IEnumConnectionPoints_Next(enum_points, 1, &cp, NULL);
+    ok(hr == S_FALSE, "got 0x%08x\n", hr);
+
+    IEnumConnectionPoints_Release(enum_points);
+}
+    IConnectionPointContainer_Release(cpc);
     IRowPosition_Release(rowpos);
 }
 




More information about the wine-cvs mailing list