Commit 6ac2cb3d authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: Reimplement SendOnDataChange using the connection enumerator.

parent d5c66bc2
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <string.h> #include <string.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -804,40 +806,42 @@ static HRESULT WINAPI DataAdviseHolder_EnumAdvise(IDataAdviseHolder *iface, ...@@ -804,40 +806,42 @@ static HRESULT WINAPI DataAdviseHolder_EnumAdvise(IDataAdviseHolder *iface,
* DataAdviseHolder_SendOnDataChange * DataAdviseHolder_SendOnDataChange
*/ */
static HRESULT WINAPI DataAdviseHolder_SendOnDataChange(IDataAdviseHolder *iface, static HRESULT WINAPI DataAdviseHolder_SendOnDataChange(IDataAdviseHolder *iface,
IDataObject *pDataObject, IDataObject *data_obj,
DWORD dwReserved, DWORD advf) DWORD dwReserved, DWORD advf)
{ {
DataAdviseHolder *This = impl_from_IDataAdviseHolder(iface); IEnumSTATDATA *pEnum;
DWORD index; HRESULT hr;
STGMEDIUM stg;
HRESULT res;
TRACE("(%p)->(%p,%08x,%08x)\n", This, pDataObject, dwReserved, advf); TRACE("(%p)->(%p, %08x, %08x)\n", iface, data_obj, dwReserved, advf);
for(index = 0; index < This->maxCons; index++) hr = IDataAdviseHolder_EnumAdvise(iface, &pEnum);
if (SUCCEEDED(hr))
{ {
if(This->connections[index].pAdvSink != NULL) STATDATA statdata;
while (IEnumSTATDATA_Next(pEnum, 1, &statdata, NULL) == S_OK)
{ {
memset(&stg, 0, sizeof(stg)); STGMEDIUM stg;
if(!(This->connections[index].advf & ADVF_NODATA)) stg.tymed = TYMED_NULL;
stg.u.pstg = NULL;
stg.pUnkForRelease = NULL;
if(!(statdata.advf & ADVF_NODATA))
{ {
TRACE("Calling IDataObject_GetData\n"); hr = IDataObject_GetData(data_obj, &statdata.formatetc, &stg);
res = IDataObject_GetData(pDataObject,
&(This->connections[index].formatetc),
&stg);
TRACE("returns %08x\n", res);
} }
TRACE("Calling IAdviseSink_OnDataChange\n");
IAdviseSink_OnDataChange(This->connections[index].pAdvSink, IAdviseSink_OnDataChange(statdata.pAdvSink, &statdata.formatetc, &stg);
&(This->connections[index].formatetc),
&stg); if(statdata.advf & ADVF_ONLYONCE)
TRACE("Done IAdviseSink_OnDataChange\n"); {
if(This->connections[index].advf & ADVF_ONLYONCE) { IDataAdviseHolder_Unadvise(iface, statdata.dwConnection);
TRACE("Removing connection\n");
DataAdviseHolder_Unadvise(iface, This->connections[index].dwConnection);
} }
release_statdata(&statdata);
} }
IEnumSTATDATA_Release(pEnum);
} }
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment