ReactOS 0.4.16-dev-297-gc569aee
oleobj.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/debug.h"
#include "ole2.h"
#include "compobj_private.h"
Include dependency graph for oleobj.c:

Go to the source code of this file.

Classes

struct  EnumSTATDATA
 
struct  OleAdviseHolderImpl
 
struct  DataAdviseHolder
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define INITIAL_SINKS   10
 
#define WINE_ADVF_REMOTE   0x80000000
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static void release_statdata (STATDATA *data)
 
static HRESULT copy_statdata (STATDATA *dst, const STATDATA *src)
 
static EnumSTATDATAimpl_from_IEnumSTATDATA (IEnumSTATDATA *iface)
 
static HRESULT WINAPI EnumSTATDATA_QueryInterface (IEnumSTATDATA *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI EnumSTATDATA_AddRef (IEnumSTATDATA *iface)
 
static ULONG WINAPI EnumSTATDATA_Release (IEnumSTATDATA *iface)
 
static HRESULT WINAPI EnumSTATDATA_Next (IEnumSTATDATA *iface, ULONG num, LPSTATDATA data, ULONG *fetched)
 
static HRESULT WINAPI EnumSTATDATA_Skip (IEnumSTATDATA *iface, ULONG num)
 
static HRESULT WINAPI EnumSTATDATA_Reset (IEnumSTATDATA *iface)
 
static HRESULT WINAPI EnumSTATDATA_Clone (IEnumSTATDATA *iface, IEnumSTATDATA **ppenum)
 
HRESULT EnumSTATDATA_Construct (IUnknown *holder, ULONG index, DWORD array_len, STATDATA *data, BOOL copy, IEnumSTATDATA **ppenum)
 
static OleAdviseHolderImplimpl_from_IOleAdviseHolder (IOleAdviseHolder *iface)
 
static void OleAdviseHolderImpl_Destructor (OleAdviseHolderImpl *This)
 
static HRESULT WINAPI OleAdviseHolderImpl_QueryInterface (IOleAdviseHolder *iface, REFIID iid, void **obj)
 
static ULONG WINAPI OleAdviseHolderImpl_AddRef (IOleAdviseHolder *iface)
 
static ULONG WINAPI OleAdviseHolderImpl_Release (IOleAdviseHolder *iface)
 
static HRESULT WINAPI OleAdviseHolderImpl_Advise (IOleAdviseHolder *iface, IAdviseSink *pAdvise, DWORD *pdwConnection)
 
static HRESULT WINAPI OleAdviseHolderImpl_Unadvise (IOleAdviseHolder *iface, DWORD dwConnection)
 
static HRESULT WINAPI OleAdviseHolderImpl_EnumAdvise (IOleAdviseHolder *iface, IEnumSTATDATA **enum_advise)
 
static HRESULT WINAPI OleAdviseHolderImpl_SendOnRename (IOleAdviseHolder *iface, IMoniker *pmk)
 
static HRESULT WINAPI OleAdviseHolderImpl_SendOnSave (IOleAdviseHolder *iface)
 
static HRESULT WINAPI OleAdviseHolderImpl_SendOnClose (IOleAdviseHolder *iface)
 
static IOleAdviseHolderOleAdviseHolderImpl_Constructor (void)
 
static DataAdviseHolderimpl_from_IDataAdviseHolder (IDataAdviseHolder *iface)
 
static void DataAdviseHolder_Destructor (DataAdviseHolder *ptrToDestroy)
 
static HRESULT WINAPI DataAdviseHolder_QueryInterface (IDataAdviseHolder *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI DataAdviseHolder_AddRef (IDataAdviseHolder *iface)
 
static ULONG WINAPI DataAdviseHolder_Release (IDataAdviseHolder *iface)
 
static HRESULT WINAPI DataAdviseHolder_Advise (IDataAdviseHolder *iface, IDataObject *pDataObject, FORMATETC *pFetc, DWORD advf, IAdviseSink *pAdvise, DWORD *pdwConnection)
 
static HRESULT WINAPI DataAdviseHolder_Unadvise (IDataAdviseHolder *iface, DWORD dwConnection)
 
static HRESULT WINAPI DataAdviseHolder_EnumAdvise (IDataAdviseHolder *iface, IEnumSTATDATA **enum_advise)
 
static HRESULT WINAPI DataAdviseHolder_SendOnDataChange (IDataAdviseHolder *iface, IDataObject *data_obj, DWORD dwReserved, DWORD advf)
 
HRESULT DataAdviseHolder_OnConnect (IDataAdviseHolder *iface, IDataObject *pDelegate)
 
void DataAdviseHolder_OnDisconnect (IDataAdviseHolder *iface)
 
static IDataAdviseHolderDataAdviseHolder_Constructor (void)
 
HRESULT WINAPI CreateOleAdviseHolder (IOleAdviseHolder **ppOAHolder)
 
HRESULT WINAPI CreateDataAdviseHolder (IDataAdviseHolder **ppDAHolder)
 

Variables

static const IEnumSTATDATAVtbl EnumSTATDATA_VTable
 
static const IOleAdviseHolderVtbl oahvt
 
static const IDataAdviseHolderVtbl DataAdviseHolderImpl_VTable
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file oleobj.c.

◆ INITIAL_SINKS

#define INITIAL_SINKS   10

Definition at line 40 of file oleobj.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 27 of file oleobj.c.

◆ WINE_ADVF_REMOTE

#define WINE_ADVF_REMOTE   0x80000000

Definition at line 544 of file oleobj.c.

Function Documentation

◆ copy_statdata()

static HRESULT copy_statdata ( STATDATA *  dst,
const STATDATA *  src 
)
static

Definition at line 54 of file oleobj.c.

55{
56 HRESULT hr;
57
58 hr = copy_formatetc( &dst->formatetc, &src->formatetc );
59 if (FAILED(hr)) return hr;
60 dst->advf = src->advf;
61 dst->pAdvSink = src->pAdvSink;
62 if (dst->pAdvSink) IAdviseSink_AddRef( dst->pAdvSink );
63 dst->dwConnection = src->dwConnection;
64 return S_OK;
65}
static HRESULT copy_formatetc(FORMATETC *dst, const FORMATETC *src)
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183

Referenced by DataAdviseHolder_Advise(), EnumSTATDATA_Construct(), EnumSTATDATA_Next(), and OleAdviseHolderImpl_Advise().

◆ CreateDataAdviseHolder()

HRESULT WINAPI CreateDataAdviseHolder ( IDataAdviseHolder **  ppDAHolder)

Definition at line 893 of file oleobj.c.

894{
895 TRACE("(%p)\n", ppDAHolder);
896
897 if (ppDAHolder==NULL)
898 return E_POINTER;
899
900 *ppDAHolder = DataAdviseHolder_Constructor();
901
902 if (*ppDAHolder != NULL)
903 return S_OK;
904
905 return E_OUTOFMEMORY;
906}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
static IDataAdviseHolder * DataAdviseHolder_Constructor(void)
Definition: oleobj.c:849
#define TRACE(s)
Definition: solgame.cpp:4
#define E_POINTER
Definition: winerror.h:2365

Referenced by DefaultHandler_DAdvise().

◆ CreateOleAdviseHolder()

HRESULT WINAPI CreateOleAdviseHolder ( IOleAdviseHolder **  ppOAHolder)

Definition at line 875 of file oleobj.c.

876{
877 TRACE("(%p)\n", ppOAHolder);
878
879 if (ppOAHolder==NULL)
880 return E_POINTER;
881
882 *ppOAHolder = OleAdviseHolderImpl_Constructor ();
883
884 if (*ppOAHolder != NULL)
885 return S_OK;
886
887 return E_OUTOFMEMORY;
888}
static IOleAdviseHolder * OleAdviseHolderImpl_Constructor(void)
Definition: oleobj.c:513

Referenced by DefaultHandler_Advise(), SEALED_::NeedAdviseHolder(), and OleObject_Advise().

◆ DataAdviseHolder_AddRef()

static ULONG WINAPI DataAdviseHolder_AddRef ( IDataAdviseHolder iface)
static

Definition at line 609 of file oleobj.c.

610{
612 TRACE("(%p) (ref=%d)\n", This, This->ref);
613 return InterlockedIncrement(&This->ref);
614}
#define InterlockedIncrement
Definition: armddk.h:53
static DataAdviseHolder * impl_from_IDataAdviseHolder(IDataAdviseHolder *iface)
Definition: oleobj.c:546

◆ DataAdviseHolder_Advise()

static HRESULT WINAPI DataAdviseHolder_Advise ( IDataAdviseHolder iface,
IDataObject pDataObject,
FORMATETC *  pFetc,
DWORD  advf,
IAdviseSink pAdvise,
DWORD pdwConnection 
)
static

Definition at line 635 of file oleobj.c.

639{
640 DWORD index;
641 STATDATA new_conn;
643
644 TRACE("(%p)->(%p, %p, %08x, %p, %p)\n", This, pDataObject, pFetc, advf,
645 pAdvise, pdwConnection);
646
647 if (pdwConnection==NULL)
648 return E_POINTER;
649
650 *pdwConnection = 0;
651
652 for (index = 0; index < This->maxCons; index++)
653 {
654 if (This->connections[index].pAdvSink == NULL)
655 break;
656 }
657
658 if (index == This->maxCons)
659 {
660 This->maxCons+=INITIAL_SINKS;
662 This->connections,
663 This->maxCons * sizeof(*This->connections));
664 This->remote_connections = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
665 This->remote_connections,
666 This->maxCons * sizeof(*This->remote_connections));
667 }
668
669 new_conn.pAdvSink = pAdvise;
670 new_conn.advf = advf & ~WINE_ADVF_REMOTE;
671 new_conn.formatetc = *pFetc;
672 new_conn.dwConnection = index + 1; /* 0 is not a valid cookie, so increment the index */
673
674 copy_statdata(This->connections + index, &new_conn);
675
676 if (This->connections[index].pAdvSink != NULL)
677 {
678 /* if we are already connected advise the remote object */
679 if (This->delegate)
680 {
681 HRESULT hr;
682
683 hr = IDataObject_DAdvise(This->delegate, &new_conn.formatetc,
684 new_conn.advf, new_conn.pAdvSink,
685 &This->remote_connections[index]);
686 if (FAILED(hr))
687 {
688 IDataAdviseHolder_Unadvise(iface, new_conn.dwConnection);
689 return hr;
690 }
691 This->connections[index].advf |= WINE_ADVF_REMOTE;
692 }
693 else if(advf & ADVF_PRIMEFIRST)
694 /* only do this if we have no delegate, since in the above case the
695 * delegate will do the priming for us */
696 IDataAdviseHolder_SendOnDataChange(iface, pDataObject, 0, advf);
697 }
698
699 *pdwConnection = new_conn.dwConnection;
700
701 return S_OK;
702}
#define index(s, c)
Definition: various.h:29
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint index
Definition: glext.h:6031
static HRESULT copy_statdata(STATDATA *dst, const STATDATA *src)
Definition: oleobj.c:54
#define WINE_ADVF_REMOTE
Definition: oleobj.c:544
#define INITIAL_SINKS
Definition: oleobj.c:40

◆ DataAdviseHolder_Constructor()

static IDataAdviseHolder * DataAdviseHolder_Constructor ( void  )
static

Definition at line 849 of file oleobj.c.

850{
851 DataAdviseHolder* newHolder;
852
853 newHolder = HeapAlloc(GetProcessHeap(), 0, sizeof(DataAdviseHolder));
854
856 newHolder->ref = 1;
857 newHolder->maxCons = INITIAL_SINKS;
859 newHolder->maxCons * sizeof(*newHolder->connections));
861 newHolder->maxCons * sizeof(*newHolder->remote_connections));
862 newHolder->delegate = NULL;
863
864 TRACE("returning %p\n", &newHolder->IDataAdviseHolder_iface);
865 return &newHolder->IDataAdviseHolder_iface;
866}
#define HeapAlloc
Definition: compat.h:733
static const IDataAdviseHolderVtbl DataAdviseHolderImpl_VTable
Definition: oleobj.c:795
IDataAdviseHolder IDataAdviseHolder_iface
Definition: oleobj.c:534
DWORD * remote_connections
Definition: oleobj.c:539
STATDATA * connections
Definition: oleobj.c:538
IDataObject * delegate
Definition: oleobj.c:540
DWORD maxCons
Definition: oleobj.c:537

Referenced by CreateDataAdviseHolder().

◆ DataAdviseHolder_Destructor()

static void DataAdviseHolder_Destructor ( DataAdviseHolder ptrToDestroy)
static

Definition at line 554 of file oleobj.c.

555{
556 DWORD index;
557 TRACE("%p\n", ptrToDestroy);
558
559 for (index = 0; index < ptrToDestroy->maxCons; index++)
560 {
561 if (ptrToDestroy->connections[index].pAdvSink != NULL)
562 {
563 if (ptrToDestroy->delegate &&
564 (ptrToDestroy->connections[index].advf & WINE_ADVF_REMOTE))
565 IDataObject_DUnadvise(ptrToDestroy->delegate,
566 ptrToDestroy->remote_connections[index]);
567
568 release_statdata(ptrToDestroy->connections + index);
569 }
570 }
571
572 HeapFree(GetProcessHeap(), 0, ptrToDestroy->remote_connections);
573 HeapFree(GetProcessHeap(), 0, ptrToDestroy->connections);
574 HeapFree(GetProcessHeap(), 0, ptrToDestroy);
575}
#define HeapFree(x, y, z)
Definition: compat.h:735
static void release_statdata(STATDATA *data)
Definition: oleobj.c:42

Referenced by DataAdviseHolder_Release().

◆ DataAdviseHolder_EnumAdvise()

static HRESULT WINAPI DataAdviseHolder_EnumAdvise ( IDataAdviseHolder iface,
IEnumSTATDATA **  enum_advise 
)
static

Definition at line 734 of file oleobj.c.

736{
738 IUnknown *unk;
739 HRESULT hr;
740
741 TRACE("(%p)->(%p)\n", This, enum_advise);
742
743 IDataAdviseHolder_QueryInterface(iface, &IID_IUnknown, (void**)&unk);
744 hr = EnumSTATDATA_Construct(unk, 0, This->maxCons, This->connections, TRUE, enum_advise);
745 IUnknown_Release(unk);
746 return hr;
747}
const GUID IID_IUnknown
#define TRUE
Definition: types.h:120
HRESULT EnumSTATDATA_Construct(IUnknown *holder, ULONG index, DWORD array_len, STATDATA *data, BOOL copy, IEnumSTATDATA **ppenum)
Definition: oleobj.c:197

◆ DataAdviseHolder_OnConnect()

HRESULT DataAdviseHolder_OnConnect ( IDataAdviseHolder iface,
IDataObject pDelegate 
)

Definition at line 806 of file oleobj.c.

807{
809 DWORD index;
810 HRESULT hr = S_OK;
811
812 for(index = 0; index < This->maxCons; index++)
813 {
814 if(This->connections[index].pAdvSink != NULL)
815 {
816 hr = IDataObject_DAdvise(pDelegate, &This->connections[index].formatetc,
817 This->connections[index].advf,
818 This->connections[index].pAdvSink,
819 &This->remote_connections[index]);
820 if (FAILED(hr)) break;
821 This->connections[index].advf |= WINE_ADVF_REMOTE;
822 }
823 }
824 This->delegate = pDelegate;
825 return hr;
826}

Referenced by DefaultHandler_DAdvise(), and DefaultHandler_Run().

◆ DataAdviseHolder_OnDisconnect()

void DataAdviseHolder_OnDisconnect ( IDataAdviseHolder iface)

Definition at line 828 of file oleobj.c.

829{
831 DWORD index;
832
833 for(index = 0; index < This->maxCons; index++)
834 {
835 if((This->connections[index].pAdvSink != NULL) &&
836 (This->connections[index].advf & WINE_ADVF_REMOTE))
837 {
838 IDataObject_DUnadvise(This->delegate, This->remote_connections[index]);
839 This->remote_connections[index] = 0;
840 This->connections[index].advf &= ~WINE_ADVF_REMOTE;
841 }
842 }
843 This->delegate = NULL;
844}

Referenced by DefaultHandler_Stop().

◆ DataAdviseHolder_QueryInterface()

static HRESULT WINAPI DataAdviseHolder_QueryInterface ( IDataAdviseHolder iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 580 of file oleobj.c.

582{
584 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
585
586 if ( (This==0) || (ppvObject==0) )
587 return E_INVALIDARG;
588
589 *ppvObject = 0;
590
591 if ( IsEqualIID(&IID_IUnknown, riid) ||
593 {
594 *ppvObject = iface;
595 }
596
597 if ((*ppvObject)==0)
598 {
599 return E_NOINTERFACE;
600 }
601
602 IUnknown_AddRef((IUnknown*)*ppvObject);
603 return S_OK;
604}
#define E_INVALIDARG
Definition: ddrawi.h:101
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IDataAdviseHolder
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ DataAdviseHolder_Release()

static ULONG WINAPI DataAdviseHolder_Release ( IDataAdviseHolder iface)
static

Definition at line 619 of file oleobj.c.

620{
622 ULONG ref;
623 TRACE("(%p) (ref=%d)\n", This, This->ref);
624
627
628 return ref;
629}
#define InterlockedDecrement
Definition: armddk.h:52
static void DataAdviseHolder_Destructor(DataAdviseHolder *ptrToDestroy)
Definition: oleobj.c:554
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ DataAdviseHolder_SendOnDataChange()

static HRESULT WINAPI DataAdviseHolder_SendOnDataChange ( IDataAdviseHolder iface,
IDataObject data_obj,
DWORD  dwReserved,
DWORD  advf 
)
static

Definition at line 752 of file oleobj.c.

755{
756 IEnumSTATDATA *pEnum;
757 HRESULT hr;
758
759 TRACE("(%p)->(%p, %08x, %08x)\n", iface, data_obj, dwReserved, advf);
760
761 hr = IDataAdviseHolder_EnumAdvise(iface, &pEnum);
762 if (SUCCEEDED(hr))
763 {
764 STATDATA statdata;
765 while (IEnumSTATDATA_Next(pEnum, 1, &statdata, NULL) == S_OK)
766 {
767 STGMEDIUM stg;
768 stg.tymed = TYMED_NULL;
769 stg.u.pstg = NULL;
770 stg.pUnkForRelease = NULL;
771
772 if(!(statdata.advf & ADVF_NODATA))
773 {
774 hr = IDataObject_GetData(data_obj, &statdata.formatetc, &stg);
775 }
776
777 IAdviseSink_OnDataChange(statdata.pAdvSink, &statdata.formatetc, &stg);
778
779 if(statdata.advf & ADVF_ONLYONCE)
780 {
781 IDataAdviseHolder_Unadvise(iface, statdata.dwConnection);
782 }
783
784 release_statdata(&statdata);
785 }
786 IEnumSTATDATA_Release(pEnum);
787 }
788
789 return S_OK;
790}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95

◆ DataAdviseHolder_Unadvise()

static HRESULT WINAPI DataAdviseHolder_Unadvise ( IDataAdviseHolder iface,
DWORD  dwConnection 
)
static

Definition at line 707 of file oleobj.c.

709{
711 DWORD index;
712 TRACE("(%p)->(%u)\n", This, dwConnection);
713
714 /* The connection number is 1 more than the index, see DataAdviseHolder_Advise */
715 index = dwConnection - 1;
716
717 if (index >= This->maxCons || This->connections[index].pAdvSink == NULL)
718 return OLE_E_NOCONNECTION;
719
720 if (This->delegate && This->connections[index].advf & WINE_ADVF_REMOTE)
721 {
722 IDataObject_DUnadvise(This->delegate, This->remote_connections[index]);
723 This->remote_connections[index] = 0;
724 }
725
726 release_statdata(This->connections + index);
727
728 return S_OK;
729}
#define OLE_E_NOCONNECTION
Definition: winerror.h:2618

◆ EnumSTATDATA_AddRef()

static ULONG WINAPI EnumSTATDATA_AddRef ( IEnumSTATDATA iface)
static

Definition at line 100 of file oleobj.c.

101{
103 TRACE("()\n");
104 return InterlockedIncrement(&This->ref);
105}
static EnumSTATDATA * impl_from_IEnumSTATDATA(IEnumSTATDATA *iface)
Definition: oleobj.c:82

◆ EnumSTATDATA_Clone()

static HRESULT WINAPI EnumSTATDATA_Clone ( IEnumSTATDATA iface,
IEnumSTATDATA **  ppenum 
)
static

Definition at line 178 of file oleobj.c.

179{
181
182 return EnumSTATDATA_Construct(This->holder, This->index, This->num_of_elems, This->statdata,
183 TRUE, ppenum);
184}

◆ EnumSTATDATA_Construct()

HRESULT EnumSTATDATA_Construct ( IUnknown holder,
ULONG  index,
DWORD  array_len,
STATDATA *  data,
BOOL  copy,
IEnumSTATDATA **  ppenum 
)

Definition at line 197 of file oleobj.c.

199{
200 EnumSTATDATA *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
201 DWORD i, count;
202
203 if (!This) return E_OUTOFMEMORY;
204
205 This->IEnumSTATDATA_iface.lpVtbl = &EnumSTATDATA_VTable;
206 This->ref = 1;
207 This->index = index;
208
209 if (copy)
210 {
211 This->statdata = HeapAlloc(GetProcessHeap(), 0, array_len * sizeof(*This->statdata));
212 if(!This->statdata)
213 {
215 return E_OUTOFMEMORY;
216 }
217
218 for(i = 0, count = 0; i < array_len; i++)
219 {
220 if(data[i].pAdvSink)
221 {
222 copy_statdata(This->statdata + count, data + i);
223 count++;
224 }
225 }
226 }
227 else
228 {
229 This->statdata = data;
230 count = array_len;
231 }
232
233 This->num_of_elems = count;
234 This->holder = holder;
235 if (holder) IUnknown_AddRef(holder);
236 *ppenum = &This->IEnumSTATDATA_iface;
237 return S_OK;
238}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const IEnumSTATDATAVtbl EnumSTATDATA_VTable
Definition: oleobj.c:186

Referenced by DataAdviseHolder_EnumAdvise(), DataCache_EnumCache(), EnumSTATDATA_Clone(), and OleAdviseHolderImpl_EnumAdvise().

◆ EnumSTATDATA_Next()

static HRESULT WINAPI EnumSTATDATA_Next ( IEnumSTATDATA iface,
ULONG  num,
LPSTATDATA  data,
ULONG fetched 
)
static

Definition at line 124 of file oleobj.c.

126{
128 DWORD count = 0;
129 HRESULT hr = S_OK;
130
131 TRACE("(%d, %p, %p)\n", num, data, fetched);
132
133 while(num--)
134 {
135 if (This->index >= This->num_of_elems)
136 {
137 hr = S_FALSE;
138 break;
139 }
140
141 copy_statdata(data + count, This->statdata + This->index);
142
143 count++;
144 This->index++;
145 }
146
147 if (fetched) *fetched = count;
148
149 return hr;
150}
GLuint GLuint num
Definition: glext.h:9618
#define S_FALSE
Definition: winerror.h:2357

◆ EnumSTATDATA_QueryInterface()

static HRESULT WINAPI EnumSTATDATA_QueryInterface ( IEnumSTATDATA iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 87 of file oleobj.c.

88{
89 TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
92 {
93 IEnumSTATDATA_AddRef(iface);
94 *ppv = iface;
95 return S_OK;
96 }
97 return E_NOINTERFACE;
98}
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IEnumSTATDATA

◆ EnumSTATDATA_Release()

static ULONG WINAPI EnumSTATDATA_Release ( IEnumSTATDATA iface)
static

Definition at line 107 of file oleobj.c.

108{
110 LONG refs = InterlockedDecrement(&This->ref);
111 TRACE("()\n");
112 if (!refs)
113 {
114 DWORD i;
115 for(i = 0; i < This->num_of_elems; i++)
116 release_statdata(This->statdata + i);
117 HeapFree(GetProcessHeap(), 0, This->statdata);
118 if (This->holder) IUnknown_Release(This->holder);
120 }
121 return refs;
122}
long LONG
Definition: pedump.c:60

◆ EnumSTATDATA_Reset()

static HRESULT WINAPI EnumSTATDATA_Reset ( IEnumSTATDATA iface)
static

Definition at line 168 of file oleobj.c.

169{
171
172 TRACE("()\n");
173
174 This->index = 0;
175 return S_OK;
176}

◆ EnumSTATDATA_Skip()

static HRESULT WINAPI EnumSTATDATA_Skip ( IEnumSTATDATA iface,
ULONG  num 
)
static

Definition at line 152 of file oleobj.c.

153{
155
156 TRACE("(%d)\n", num);
157
158 if(This->index + num >= This->num_of_elems)
159 {
160 This->index = This->num_of_elems;
161 return S_FALSE;
162 }
163
164 This->index += num;
165 return S_OK;
166}

◆ impl_from_IDataAdviseHolder()

static DataAdviseHolder * impl_from_IDataAdviseHolder ( IDataAdviseHolder iface)
inlinestatic

◆ impl_from_IEnumSTATDATA()

static EnumSTATDATA * impl_from_IEnumSTATDATA ( IEnumSTATDATA iface)
inlinestatic

Definition at line 82 of file oleobj.c.

83{
84 return CONTAINING_RECORD(iface, EnumSTATDATA, IEnumSTATDATA_iface);
85}

Referenced by EnumSTATDATA_AddRef(), EnumSTATDATA_Clone(), EnumSTATDATA_Next(), EnumSTATDATA_Release(), EnumSTATDATA_Reset(), and EnumSTATDATA_Skip().

◆ impl_from_IOleAdviseHolder()

◆ OleAdviseHolderImpl_AddRef()

static ULONG WINAPI OleAdviseHolderImpl_AddRef ( IOleAdviseHolder iface)
static

Definition at line 307 of file oleobj.c.

308{
311
312 TRACE("(%p)->(ref=%d)\n", This, ref - 1);
313
314 return ref;
315}
static OleAdviseHolderImpl * impl_from_IOleAdviseHolder(IOleAdviseHolder *iface)
Definition: oleobj.c:253

◆ OleAdviseHolderImpl_Advise()

static HRESULT WINAPI OleAdviseHolderImpl_Advise ( IOleAdviseHolder iface,
IAdviseSink pAdvise,
DWORD pdwConnection 
)
static

Definition at line 335 of file oleobj.c.

338{
339 DWORD index;
341 STATDATA new_conn;
342 static const FORMATETC empty_fmtetc = {0, NULL, 0, -1, 0};
343
344 TRACE("(%p)->(%p, %p)\n", This, pAdvise, pdwConnection);
345
346 if (pdwConnection==NULL)
347 return E_POINTER;
348
349 *pdwConnection = 0;
350
351 for (index = 0; index < This->max_cons; index++)
352 {
353 if (This->connections[index].pAdvSink == NULL)
354 break;
355 }
356
357 if (index == This->max_cons)
358 {
359 This->max_cons += INITIAL_SINKS;
360 This->connections = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->connections,
361 This->max_cons * sizeof(*This->connections));
362 }
363
364 new_conn.pAdvSink = pAdvise;
365 new_conn.advf = 0;
366 new_conn.formatetc = empty_fmtetc;
367 new_conn.dwConnection = index + 1; /* 0 is not a valid cookie, so increment the index */
368
369 copy_statdata(This->connections + index, &new_conn);
370
371 *pdwConnection = new_conn.dwConnection;
372
373 return S_OK;
374}

◆ OleAdviseHolderImpl_Constructor()

static IOleAdviseHolder * OleAdviseHolderImpl_Constructor ( void  )
static

Definition at line 513 of file oleobj.c.

514{
515 OleAdviseHolderImpl* lpoah;
516
517 lpoah = HeapAlloc(GetProcessHeap(), 0, sizeof(OleAdviseHolderImpl));
518
519 lpoah->IOleAdviseHolder_iface.lpVtbl = &oahvt;
520 lpoah->ref = 1;
521 lpoah->max_cons = INITIAL_SINKS;
523 lpoah->max_cons * sizeof(*lpoah->connections));
524
525 TRACE("returning %p\n", &lpoah->IOleAdviseHolder_iface);
526 return &lpoah->IOleAdviseHolder_iface;
527}
static const IOleAdviseHolderVtbl oahvt
Definition: oleobj.c:496
STATDATA * connections
Definition: oleobj.c:250
IOleAdviseHolder IOleAdviseHolder_iface
Definition: oleobj.c:245

Referenced by CreateOleAdviseHolder().

◆ OleAdviseHolderImpl_Destructor()

static void OleAdviseHolderImpl_Destructor ( OleAdviseHolderImpl This)
static

Definition at line 261 of file oleobj.c.

262{
263 DWORD index;
264 TRACE("%p\n", This);
265
266 for (index = 0; index < This->max_cons; index++)
267 {
268 if (This->connections[index].pAdvSink != NULL)
269 release_statdata(This->connections + index);
270 }
271
272 HeapFree(GetProcessHeap(), 0, This->connections);
274}

Referenced by OleAdviseHolderImpl_Release().

◆ OleAdviseHolderImpl_EnumAdvise()

static HRESULT WINAPI OleAdviseHolderImpl_EnumAdvise ( IOleAdviseHolder iface,
IEnumSTATDATA **  enum_advise 
)
static

Definition at line 401 of file oleobj.c.

402{
404 IUnknown *unk;
405 HRESULT hr;
406
407 TRACE("(%p)->(%p)\n", This, enum_advise);
408
409 IOleAdviseHolder_QueryInterface(iface, &IID_IUnknown, (void**)&unk);
410 hr = EnumSTATDATA_Construct(unk, 0, This->max_cons, This->connections, TRUE, enum_advise);
411 IUnknown_Release(unk);
412 return hr;
413}

◆ OleAdviseHolderImpl_QueryInterface()

static HRESULT WINAPI OleAdviseHolderImpl_QueryInterface ( IOleAdviseHolder iface,
REFIID  iid,
void **  obj 
)
static

Definition at line 279 of file oleobj.c.

281{
283 TRACE("(%p)->(%s,%p)\n",This, debugstr_guid(iid), obj);
284
285 if (obj == NULL)
286 return E_POINTER;
287
288 *obj = NULL;
289
290 if (IsEqualIID(iid, &IID_IUnknown) ||
292 {
293 *obj = &This->IOleAdviseHolder_iface;
294 }
295
296 if(*obj == NULL)
297 return E_NOINTERFACE;
298
299 IUnknown_AddRef((IUnknown*)*obj);
300
301 return S_OK;
302}
const GUID IID_IOleAdviseHolder

◆ OleAdviseHolderImpl_Release()

static ULONG WINAPI OleAdviseHolderImpl_Release ( IOleAdviseHolder iface)
static

Definition at line 320 of file oleobj.c.

321{
323 ULONG ref;
324 TRACE("(%p)->(ref=%d)\n", This, This->ref);
326
328
329 return ref;
330}
static void OleAdviseHolderImpl_Destructor(OleAdviseHolderImpl *This)
Definition: oleobj.c:261

◆ OleAdviseHolderImpl_SendOnClose()

static HRESULT WINAPI OleAdviseHolderImpl_SendOnClose ( IOleAdviseHolder iface)
static

Definition at line 470 of file oleobj.c.

471{
472 IEnumSTATDATA *pEnum;
473 HRESULT hr;
474
475 TRACE("(%p)->()\n", iface);
476
477 hr = IOleAdviseHolder_EnumAdvise(iface, &pEnum);
478 if (SUCCEEDED(hr))
479 {
480 STATDATA statdata;
481 while (IEnumSTATDATA_Next(pEnum, 1, &statdata, NULL) == S_OK)
482 {
483 IAdviseSink_OnClose(statdata.pAdvSink);
484
485 IAdviseSink_Release(statdata.pAdvSink);
486 }
487 IEnumSTATDATA_Release(pEnum);
488 }
489
490 return hr;
491}

◆ OleAdviseHolderImpl_SendOnRename()

static HRESULT WINAPI OleAdviseHolderImpl_SendOnRename ( IOleAdviseHolder iface,
IMoniker pmk 
)
static

Definition at line 418 of file oleobj.c.

419{
420 IEnumSTATDATA *pEnum;
421 HRESULT hr;
422
423 TRACE("(%p)->(%p)\n", iface, pmk);
424
425 hr = IOleAdviseHolder_EnumAdvise(iface, &pEnum);
426 if (SUCCEEDED(hr))
427 {
428 STATDATA statdata;
429 while (IEnumSTATDATA_Next(pEnum, 1, &statdata, NULL) == S_OK)
430 {
431 IAdviseSink_OnRename(statdata.pAdvSink, pmk);
432
433 IAdviseSink_Release(statdata.pAdvSink);
434 }
435 IEnumSTATDATA_Release(pEnum);
436 }
437
438 return hr;
439}

◆ OleAdviseHolderImpl_SendOnSave()

static HRESULT WINAPI OleAdviseHolderImpl_SendOnSave ( IOleAdviseHolder iface)
static

Definition at line 444 of file oleobj.c.

445{
446 IEnumSTATDATA *pEnum;
447 HRESULT hr;
448
449 TRACE("(%p)->()\n", iface);
450
451 hr = IOleAdviseHolder_EnumAdvise(iface, &pEnum);
452 if (SUCCEEDED(hr))
453 {
454 STATDATA statdata;
455 while (IEnumSTATDATA_Next(pEnum, 1, &statdata, NULL) == S_OK)
456 {
457 IAdviseSink_OnSave(statdata.pAdvSink);
458
459 IAdviseSink_Release(statdata.pAdvSink);
460 }
461 IEnumSTATDATA_Release(pEnum);
462 }
463
464 return hr;
465}

◆ OleAdviseHolderImpl_Unadvise()

static HRESULT WINAPI OleAdviseHolderImpl_Unadvise ( IOleAdviseHolder iface,
DWORD  dwConnection 
)
static

Definition at line 379 of file oleobj.c.

381{
383 DWORD index;
384
385 TRACE("(%p)->(%u)\n", This, dwConnection);
386
387 /* The connection number is 1 more than the index, see OleAdviseHolder_Advise */
388 index = dwConnection - 1;
389
390 if (index >= This->max_cons || This->connections[index].pAdvSink == NULL)
391 return OLE_E_NOCONNECTION;
392
393 release_statdata(This->connections + index);
394
395 return S_OK;
396}

◆ release_statdata()

static void release_statdata ( STATDATA *  data)
static

Definition at line 42 of file oleobj.c.

43{
44 CoTaskMemFree(data->formatetc.ptd);
45 data->formatetc.ptd = NULL;
46
47 if(data->pAdvSink)
48 {
49 IAdviseSink_Release(data->pAdvSink);
50 data->pAdvSink = NULL;
51 }
52}
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442

Referenced by DataAdviseHolder_Destructor(), DataAdviseHolder_SendOnDataChange(), DataAdviseHolder_Unadvise(), EnumSTATDATA_Release(), OleAdviseHolderImpl_Destructor(), and OleAdviseHolderImpl_Unadvise().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ DataAdviseHolderImpl_VTable

const IDataAdviseHolderVtbl DataAdviseHolderImpl_VTable
static
Initial value:
=
{
}
static HRESULT WINAPI DataAdviseHolder_SendOnDataChange(IDataAdviseHolder *iface, IDataObject *data_obj, DWORD dwReserved, DWORD advf)
Definition: oleobj.c:752
static HRESULT WINAPI DataAdviseHolder_QueryInterface(IDataAdviseHolder *iface, REFIID riid, void **ppvObject)
Definition: oleobj.c:580
static HRESULT WINAPI DataAdviseHolder_EnumAdvise(IDataAdviseHolder *iface, IEnumSTATDATA **enum_advise)
Definition: oleobj.c:734
static ULONG WINAPI DataAdviseHolder_Release(IDataAdviseHolder *iface)
Definition: oleobj.c:619
static ULONG WINAPI DataAdviseHolder_AddRef(IDataAdviseHolder *iface)
Definition: oleobj.c:609
static HRESULT WINAPI DataAdviseHolder_Advise(IDataAdviseHolder *iface, IDataObject *pDataObject, FORMATETC *pFetc, DWORD advf, IAdviseSink *pAdvise, DWORD *pdwConnection)
Definition: oleobj.c:635
static HRESULT WINAPI DataAdviseHolder_Unadvise(IDataAdviseHolder *iface, DWORD dwConnection)
Definition: oleobj.c:707

Definition at line 795 of file oleobj.c.

Referenced by DataAdviseHolder_Constructor().

◆ EnumSTATDATA_VTable

const IEnumSTATDATAVtbl EnumSTATDATA_VTable
static
Initial value:
=
{
}
static HRESULT WINAPI EnumSTATDATA_Next(IEnumSTATDATA *iface, ULONG num, LPSTATDATA data, ULONG *fetched)
Definition: oleobj.c:124
static HRESULT WINAPI EnumSTATDATA_QueryInterface(IEnumSTATDATA *iface, REFIID riid, void **ppv)
Definition: oleobj.c:87
static HRESULT WINAPI EnumSTATDATA_Clone(IEnumSTATDATA *iface, IEnumSTATDATA **ppenum)
Definition: oleobj.c:178
static HRESULT WINAPI EnumSTATDATA_Reset(IEnumSTATDATA *iface)
Definition: oleobj.c:168
static ULONG WINAPI EnumSTATDATA_AddRef(IEnumSTATDATA *iface)
Definition: oleobj.c:100
static HRESULT WINAPI EnumSTATDATA_Skip(IEnumSTATDATA *iface, ULONG num)
Definition: oleobj.c:152
static ULONG WINAPI EnumSTATDATA_Release(IEnumSTATDATA *iface)
Definition: oleobj.c:107

Definition at line 186 of file oleobj.c.

Referenced by EnumSTATDATA_Construct().

◆ oahvt

const IOleAdviseHolderVtbl oahvt
static
Initial value:
=
{
}
static ULONG WINAPI OleAdviseHolderImpl_Release(IOleAdviseHolder *iface)
Definition: oleobj.c:320
static HRESULT WINAPI OleAdviseHolderImpl_Unadvise(IOleAdviseHolder *iface, DWORD dwConnection)
Definition: oleobj.c:379
static HRESULT WINAPI OleAdviseHolderImpl_SendOnSave(IOleAdviseHolder *iface)
Definition: oleobj.c:444
static HRESULT WINAPI OleAdviseHolderImpl_SendOnRename(IOleAdviseHolder *iface, IMoniker *pmk)
Definition: oleobj.c:418
static HRESULT WINAPI OleAdviseHolderImpl_EnumAdvise(IOleAdviseHolder *iface, IEnumSTATDATA **enum_advise)
Definition: oleobj.c:401
static HRESULT WINAPI OleAdviseHolderImpl_QueryInterface(IOleAdviseHolder *iface, REFIID iid, void **obj)
Definition: oleobj.c:279
static HRESULT WINAPI OleAdviseHolderImpl_SendOnClose(IOleAdviseHolder *iface)
Definition: oleobj.c:470
static HRESULT WINAPI OleAdviseHolderImpl_Advise(IOleAdviseHolder *iface, IAdviseSink *pAdvise, DWORD *pdwConnection)
Definition: oleobj.c:335
static ULONG WINAPI OleAdviseHolderImpl_AddRef(IOleAdviseHolder *iface)
Definition: oleobj.c:307

Definition at line 496 of file oleobj.c.

Referenced by OleAdviseHolderImpl_Constructor().