Playing a non-existent CD should fail instead of crash.
[wine/multimedia.git] / ole / oleobj.c
blobb7802c7a9404bac4faff13bcc86daea82132be80
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"
14 #include "windows.h"
17 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
18 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
19 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
22 /**************************************************************************
23 * IOleAdviseHolder Implementation
25 static HRESULT WINAPI IOleAdviseHolder_QueryInterface(LPOLEADVISEHOLDER,REFIID,LPVOID*);
26 static ULONG WINAPI IOleAdviseHolder_AddRef(LPOLEADVISEHOLDER);
27 static ULONG WINAPI IOleAdviseHolder_Release(LPOLEADVISEHOLDER);
28 static HRESULT WINAPI IOleAdviseHolder_Advise(LPOLEADVISEHOLDER, IAdviseSink*, DWORD*);
29 static HRESULT WINAPI IOleAdviseHolder_Unadvise (LPOLEADVISEHOLDER, DWORD);
30 static HRESULT WINAPI IOleAdviseHolder_EnumAdvise (LPOLEADVISEHOLDER, IEnumSTATDATA **);
31 static HRESULT WINAPI IOleAdviseHolder_SendOnRename (LPOLEADVISEHOLDER, IMoniker *);
32 static HRESULT WINAPI IOleAdviseHolder_SendOnSave (LPOLEADVISEHOLDER this);
33 static HRESULT WINAPI IOleAdviseHolder_SendOnClose (LPOLEADVISEHOLDER this);
36 /**************************************************************************
37 * IOleAdviseHolder_VTable
39 static IOleAdviseHolder_VTable oahvt =
41 IOleAdviseHolder_QueryInterface,
42 IOleAdviseHolder_AddRef,
43 IOleAdviseHolder_Release,
44 IOleAdviseHolder_Advise,
45 IOleAdviseHolder_Unadvise,
46 IOleAdviseHolder_EnumAdvise,
47 IOleAdviseHolder_SendOnRename,
48 IOleAdviseHolder_SendOnSave,
49 IOleAdviseHolder_SendOnClose
52 /**************************************************************************
53 * IOleAdviseHolder_Constructor
56 LPOLEADVISEHOLDER IOleAdviseHolder_Constructor()
58 LPOLEADVISEHOLDER lpoah;
60 lpoah= (LPOLEADVISEHOLDER)HeapAlloc(GetProcessHeap(),0,sizeof(IOleAdviseHolder));
61 lpoah->ref = 1;
62 lpoah->lpvtbl = &oahvt;
63 FIXME (ole, "(%p)->()\n", lpoah);
65 return lpoah;
68 /**************************************************************************
69 * IOleAdviseHolder_QueryInterface
71 static HRESULT WINAPI
72 IOleAdviseHolder_QueryInterface (LPOLEADVISEHOLDER this, REFIID riid, LPVOID *ppvObj)
74 char xriid[50];
75 WINE_StringFromCLSID((LPCLSID)riid,xriid);
76 FIXME (ole, "(%p)->(\n\tIID:\t%s)\n", this, xriid);
78 *ppvObj = NULL;
80 if(IsEqualIID(riid, &IID_IUnknown)) {
81 /* IUnknown */
82 *ppvObj = this;
84 else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) {
85 /* IOleAdviseHolder */
86 *ppvObj = (IOleAdviseHolder*) this;
89 if(*ppvObj) {
90 (*(LPOLEADVISEHOLDER*)ppvObj)->lpvtbl->fnAddRef(this);
91 FIXME (ole, "-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
92 return S_OK;
95 FIXME (ole, "-- Interface: E_NOINTERFACE\n");
96 return E_NOINTERFACE;
99 /******************************************************************************
100 * IOleAdviseHolder_AddRef
102 static ULONG WINAPI
103 IOleAdviseHolder_AddRef (LPOLEADVISEHOLDER this)
105 FIXME (ole, "(%p)->(count=%lu)\n", this, this->ref);
106 return ++(this->ref);
109 /******************************************************************************
110 * IOleAdviseHolder_Release
112 static ULONG WINAPI
113 IOleAdviseHolder_Release (LPOLEADVISEHOLDER this)
115 FIXME (ole, "(%p)->(count=%lu)\n", this, this->ref);
116 if (!--(this->ref)) {
117 FIXME (ole, "-- destroying IOleAdviseHolder(%p)\n", this);
118 HeapFree(GetProcessHeap(),0,this);
119 return 0;
121 return this->ref;
124 /******************************************************************************
125 * IOleAdviseHolder_Advise
127 static HRESULT WINAPI
128 IOleAdviseHolder_Advise (LPOLEADVISEHOLDER this,
129 IAdviseSink *pAdvise, DWORD *pdwConnection)
131 FIXME (ole, "(%p)->(%p %p)\n", this, pAdvise, pdwConnection);
133 *pdwConnection = 0;
135 return S_OK;
138 /******************************************************************************
139 * IOleAdviseHolder_Unadvise
141 static HRESULT WINAPI
142 IOleAdviseHolder_Unadvise (LPOLEADVISEHOLDER this, DWORD dwConnection)
144 FIXME (ole, "(%p)->(%lu)\n", this, dwConnection);
146 return S_OK;
149 /******************************************************************************
150 * IOleAdviseHolder_EnumAdvise
152 static HRESULT WINAPI
153 IOleAdviseHolder_EnumAdvise (LPOLEADVISEHOLDER this, IEnumSTATDATA **ppenumAdvise)
155 FIXME (ole, "(%p)->(%p)\n", this, ppenumAdvise);
157 *ppenumAdvise = NULL;
159 return S_OK;
162 /******************************************************************************
163 * IOleAdviseHolder_SendOnRename
165 static HRESULT WINAPI
166 IOleAdviseHolder_SendOnRename (LPOLEADVISEHOLDER this, IMoniker *pmk)
168 FIXME (ole, "(%p)->(%p)\n", this, pmk);
171 return S_OK;
174 /******************************************************************************
175 * IOleAdviseHolder_SendOnSave
177 static HRESULT WINAPI
178 IOleAdviseHolder_SendOnSave (LPOLEADVISEHOLDER this)
180 FIXME (ole, "(%p)\n", this);
183 return S_OK;
186 /******************************************************************************
187 * IOleAdviseHolder_SendOnClose
189 static HRESULT WINAPI
190 IOleAdviseHolder_SendOnClose (LPOLEADVISEHOLDER this)
192 FIXME (ole, "(%p)\n", this);
195 return S_OK;
198 /***********************************************************************
199 * API functions
202 /***********************************************************************
203 * CreateOleAdviseHolder [OLE32.59]
205 HRESULT WINAPI CreateOleAdviseHolder32 (LPOLEADVISEHOLDER *ppOAHolder)
207 FIXME(ole,"(%p): stub!\n", ppOAHolder);
209 *ppOAHolder = IOleAdviseHolder_Constructor ();
210 if (*ppOAHolder)
211 return S_OK;
213 *ppOAHolder = 0;
214 return E_OUTOFMEMORY;