Added Makefile.
[wine/multimedia.git] / ole / oleobj.c
blobccb478d06a6d8fea1fe70bb37119fb5d2b3e0a13
1 /*
2 * OLE2 COM objects
4 * Copyright 1998 Eric Kohl
5 */
8 #include "ole.h"
9 #include "ole2.h"
10 #include "winerror.h"
11 #include "interfaces.h"
12 #include "oleobj.h"
13 #include "debug.h"
16 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
17 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
18 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
21 /**************************************************************************
22 * IOleAdviseHolder Implementation
24 static HRESULT WINAPI IOleAdviseHolder_QueryInterface(LPOLEADVISEHOLDER,REFIID,LPVOID*);
25 static ULONG WINAPI IOleAdviseHolder_AddRef(LPOLEADVISEHOLDER);
26 static ULONG WINAPI IOleAdviseHolder_Release(LPOLEADVISEHOLDER);
27 static HRESULT WINAPI IOleAdviseHolder_Advise(LPOLEADVISEHOLDER, IAdviseSink*, DWORD*);
28 static HRESULT WINAPI IOleAdviseHolder_Unadvise (LPOLEADVISEHOLDER, DWORD);
29 static HRESULT WINAPI IOleAdviseHolder_EnumAdvise (LPOLEADVISEHOLDER, IEnumSTATDATA **);
30 static HRESULT WINAPI IOleAdviseHolder_SendOnRename (LPOLEADVISEHOLDER, IMoniker *);
31 static HRESULT WINAPI IOleAdviseHolder_SendOnSave (LPOLEADVISEHOLDER this);
32 static HRESULT WINAPI IOleAdviseHolder_SendOnClose (LPOLEADVISEHOLDER this);
35 /**************************************************************************
36 * IOleAdviseHolder_VTable
38 static IOleAdviseHolder_VTable oahvt =
40 IOleAdviseHolder_QueryInterface,
41 IOleAdviseHolder_AddRef,
42 IOleAdviseHolder_Release,
43 IOleAdviseHolder_Advise,
44 IOleAdviseHolder_Unadvise,
45 IOleAdviseHolder_EnumAdvise,
46 IOleAdviseHolder_SendOnRename,
47 IOleAdviseHolder_SendOnSave,
48 IOleAdviseHolder_SendOnClose
51 /**************************************************************************
52 * IOleAdviseHolder_Constructor
55 LPOLEADVISEHOLDER IOleAdviseHolder_Constructor()
57 LPOLEADVISEHOLDER lpoah;
59 lpoah= (LPOLEADVISEHOLDER)HeapAlloc(GetProcessHeap(),0,sizeof(IOleAdviseHolder));
60 lpoah->ref = 1;
61 lpoah->lpvtbl = &oahvt;
62 FIXME (ole, "(%p)->()\n", lpoah);
64 return lpoah;
67 /**************************************************************************
68 * IOleAdviseHolder_QueryInterface
70 static HRESULT WINAPI
71 IOleAdviseHolder_QueryInterface (LPOLEADVISEHOLDER this, REFIID riid, LPVOID *ppvObj)
73 char xriid[50];
74 WINE_StringFromCLSID((LPCLSID)riid,xriid);
75 FIXME (ole, "(%p)->(\n\tIID:\t%s)\n", this, xriid);
77 *ppvObj = NULL;
79 if(IsEqualIID(riid, &IID_IUnknown)) {
80 /* IUnknown */
81 *ppvObj = this;
83 else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) {
84 /* IOleAdviseHolder */
85 *ppvObj = (IOleAdviseHolder*) this;
88 if(*ppvObj) {
89 (*(LPOLEADVISEHOLDER*)ppvObj)->lpvtbl->fnAddRef(this);
90 FIXME (ole, "-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
91 return S_OK;
94 FIXME (ole, "-- Interface: E_NOINTERFACE\n");
95 return E_NOINTERFACE;
98 /******************************************************************************
99 * IOleAdviseHolder_AddRef
101 static ULONG WINAPI
102 IOleAdviseHolder_AddRef (LPOLEADVISEHOLDER this)
104 FIXME (ole, "(%p)->(count=%lu)\n", this, this->ref);
105 return ++(this->ref);
108 /******************************************************************************
109 * IOleAdviseHolder_Release
111 static ULONG WINAPI
112 IOleAdviseHolder_Release (LPOLEADVISEHOLDER this)
114 FIXME (ole, "(%p)->(count=%lu)\n", this, this->ref);
115 if (!--(this->ref)) {
116 FIXME (ole, "-- destroying IOleAdviseHolder(%p)\n", this);
117 HeapFree(GetProcessHeap(),0,this);
118 return 0;
120 return this->ref;
123 /******************************************************************************
124 * IOleAdviseHolder_Advise
126 static HRESULT WINAPI
127 IOleAdviseHolder_Advise (LPOLEADVISEHOLDER this,
128 IAdviseSink *pAdvise, DWORD *pdwConnection)
130 FIXME (ole, "(%p)->(%p %p)\n", this, pAdvise, pdwConnection);
132 *pdwConnection = 0;
134 return S_OK;
137 /******************************************************************************
138 * IOleAdviseHolder_Unadvise
140 static HRESULT WINAPI
141 IOleAdviseHolder_Unadvise (LPOLEADVISEHOLDER this, DWORD dwConnection)
143 FIXME (ole, "(%p)->(%lu)\n", this, dwConnection);
145 return S_OK;
148 /******************************************************************************
149 * IOleAdviseHolder_EnumAdvise
151 static HRESULT WINAPI
152 IOleAdviseHolder_EnumAdvise (LPOLEADVISEHOLDER this, IEnumSTATDATA **ppenumAdvise)
154 FIXME (ole, "(%p)->(%p)\n", this, ppenumAdvise);
156 *ppenumAdvise = NULL;
158 return S_OK;
161 /******************************************************************************
162 * IOleAdviseHolder_SendOnRename
164 static HRESULT WINAPI
165 IOleAdviseHolder_SendOnRename (LPOLEADVISEHOLDER this, IMoniker *pmk)
167 FIXME (ole, "(%p)->(%p)\n", this, pmk);
170 return S_OK;
173 /******************************************************************************
174 * IOleAdviseHolder_SendOnSave
176 static HRESULT WINAPI
177 IOleAdviseHolder_SendOnSave (LPOLEADVISEHOLDER this)
179 FIXME (ole, "(%p)\n", this);
182 return S_OK;
185 /******************************************************************************
186 * IOleAdviseHolder_SendOnClose
188 static HRESULT WINAPI
189 IOleAdviseHolder_SendOnClose (LPOLEADVISEHOLDER this)
191 FIXME (ole, "(%p)\n", this);
194 return S_OK;
197 /***********************************************************************
198 * API functions
201 /***********************************************************************
202 * CreateOleAdviseHolder [OLE32.59]
204 HRESULT WINAPI CreateOleAdviseHolder32 (LPOLEADVISEHOLDER *ppOAHolder)
206 FIXME(ole,"(%p): stub!\n", ppOAHolder);
208 *ppOAHolder = IOleAdviseHolder_Constructor ();
209 if (*ppOAHolder)
210 return S_OK;
212 *ppOAHolder = 0;
213 return E_OUTOFMEMORY;