Jacek Caban : atl100: Added AtlAdvise implementation.
Alexandre Julliard
julliard at winehq.org
Thu Jan 3 13:31:13 CST 2013
Module: wine
Branch: master
Commit: e57b22b960c086ed4ce789c9cd881870be24e61f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e57b22b960c086ed4ce789c9cd881870be24e61f
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Jan 3 11:45:44 2013 +0100
atl100: Added AtlAdvise implementation.
---
dlls/atl100/atl.c | 22 ++++++-
dlls/atl100/tests/Makefile.in | 2 +-
dlls/atl100/tests/atl.c | 128 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 148 insertions(+), 4 deletions(-)
diff --git a/dlls/atl100/atl.c b/dlls/atl100/atl.c
index 1033952..00d62de 100644
--- a/dlls/atl100/atl.c
+++ b/dlls/atl100/atl.c
@@ -41,10 +41,26 @@ static ICatRegister *catreg;
/***********************************************************************
* AtlAdvise [atl100.@]
*/
-HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, LPDWORD pdw)
+HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
{
- FIXME("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw);
- return E_FAIL;
+ IConnectionPointContainer *container;
+ IConnectionPoint *cp;
+ HRESULT hres;
+
+ TRACE("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw);
+
+ hres = IUnknown_QueryInterface(pUnkCP, &IID_IConnectionPointContainer, (void**)&container);
+ if(FAILED(hres))
+ return hres;
+
+ hres = IConnectionPointContainer_FindConnectionPoint(container, iid, &cp);
+ IConnectionPointContainer_Release(container);
+ if(FAILED(hres))
+ return hres;
+
+ hres = IConnectionPoint_Advise(cp, pUnk, pdw);
+ IConnectionPoint_Release(cp);
+ return hres;
}
/***********************************************************************
diff --git a/dlls/atl100/tests/Makefile.in b/dlls/atl100/tests/Makefile.in
index 7af0bcd..0b8353e 100644
--- a/dlls/atl100/tests/Makefile.in
+++ b/dlls/atl100/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = atl100.dll
-IMPORTS = atl100 oleaut32 ole32 advapi32
+IMPORTS = uuid atl100 oleaut32 ole32 advapi32
EXTRADEFS = -D_ATL_VER=_ATL_VER_100
C_SRCS = \
diff --git a/dlls/atl100/tests/atl.c b/dlls/atl100/tests/atl.c
index c640003..8b5edae 100644
--- a/dlls/atl100/tests/atl.c
+++ b/dlls/atl100/tests/atl.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#define COBJMACROS
+#define CONST_VTABLE
#include <atlbase.h>
@@ -207,6 +208,132 @@ static void test_typelib(void)
ITypeLib_Release(typelib);
}
+static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID riid, void **ppv)
+{
+ if(IsEqualGUID(&IID_IConnectionPoint, riid)) {
+ *ppv = iface;
+ return S_OK;
+ }
+
+ ok(0, "unexpected call\n");
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
+ IConnectionPointContainer **ppCPC)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink,
+ DWORD *pdwCookie)
+{
+ ok(pUnkSink == (IUnknown*)0xdead0000, "pUnkSink = %p\n", pUnkSink);
+ *pdwCookie = 0xdeadbeef;
+ return S_OK;
+}
+
+static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
+ IEnumConnections **ppEnum)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static const IConnectionPointVtbl ConnectionPointVtbl =
+{
+ ConnectionPoint_QueryInterface,
+ ConnectionPoint_AddRef,
+ ConnectionPoint_Release,
+ ConnectionPoint_GetConnectionInterface,
+ ConnectionPoint_GetConnectionPointContainer,
+ ConnectionPoint_Advise,
+ ConnectionPoint_Unadvise,
+ ConnectionPoint_EnumConnections
+};
+
+static IConnectionPoint ConnectionPoint = { &ConnectionPointVtbl };
+
+static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
+ REFIID riid, void **ppv)
+{
+ if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
+ *ppv = iface;
+ return S_OK;
+ }
+
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
+ IEnumConnectionPoints **ppEnum)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
+ REFIID riid, IConnectionPoint **ppCP)
+{
+ ok(IsEqualGUID(riid, &CLSID_Test), "unexpected riid\n");
+ *ppCP = &ConnectionPoint;
+ return S_OK;
+}
+
+static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
+ ConnectionPointContainer_QueryInterface,
+ ConnectionPointContainer_AddRef,
+ ConnectionPointContainer_Release,
+ ConnectionPointContainer_EnumConnectionPoints,
+ ConnectionPointContainer_FindConnectionPoint
+};
+
+static IConnectionPointContainer ConnectionPointContainer = { &ConnectionPointContainerVtbl };
+
+static void test_cp(void)
+{
+ DWORD cookie = 0;
+ HRESULT hres;
+
+ hres = AtlAdvise((IUnknown*)&ConnectionPointContainer, (IUnknown*)0xdead0000, &CLSID_Test, &cookie);
+ ok(hres == S_OK, "AtlAdvise failed: %08x\n", hres);
+ ok(cookie == 0xdeadbeef, "cookie = %x\n", cookie);
+}
+
START_TEST(atl)
{
CoInitialize(NULL);
@@ -214,6 +341,7 @@ START_TEST(atl)
test_winmodule();
test_regcat();
test_typelib();
+ test_cp();
CoUninitialize();
}
More information about the wine-cvs
mailing list