Initialize the output buffer parameters to 0 in RegQueryValue*
[wine.git] / ole / oleobj.c
blob9157e2a262e4de664f791c62d5c8ed2964255798
1 /*
2 * OLE2 COM objects
4 * Copyright 1998 Eric Kohl
5 */
8 #include <string.h>
9 #include "winbase.h"
10 #include "winerror.h"
11 #include "oleidl.h"
12 #include "debug.h"
14 DEFAULT_DEBUG_CHANNEL(ole)
17 /**************************************************************************
18 * IOleAdviseHolder Implementation
20 typedef struct
22 ICOM_VTABLE(IOleAdviseHolder)* lpvtbl;
23 DWORD ref;
24 } IOleAdviseHolderImpl;
26 static HRESULT WINAPI IOleAdviseHolder_fnQueryInterface(LPOLEADVISEHOLDER,REFIID,LPVOID*);
27 static ULONG WINAPI IOleAdviseHolder_fnAddRef(LPOLEADVISEHOLDER);
28 static ULONG WINAPI IOleAdviseHolder_fnRelease(LPOLEADVISEHOLDER);
29 static HRESULT WINAPI IOleAdviseHolder_fnAdvise(LPOLEADVISEHOLDER, IAdviseSink*, DWORD*);
30 static HRESULT WINAPI IOleAdviseHolder_fnUnadvise (LPOLEADVISEHOLDER, DWORD);
31 static HRESULT WINAPI IOleAdviseHolder_fnEnumAdvise (LPOLEADVISEHOLDER, IEnumSTATDATA **);
32 static HRESULT WINAPI IOleAdviseHolder_fnSendOnRename (LPOLEADVISEHOLDER, IMoniker *);
33 static HRESULT WINAPI IOleAdviseHolder_fnSendOnSave (LPOLEADVISEHOLDER);
34 static HRESULT WINAPI IOleAdviseHolder_fnSendOnClose (LPOLEADVISEHOLDER);
37 /**************************************************************************
38 * IOleAdviseHolder_VTable
40 static struct ICOM_VTABLE(IOleAdviseHolder) oahvt =
42 IOleAdviseHolder_fnQueryInterface,
43 IOleAdviseHolder_fnAddRef,
44 IOleAdviseHolder_fnRelease,
45 IOleAdviseHolder_fnAdvise,
46 IOleAdviseHolder_fnUnadvise,
47 IOleAdviseHolder_fnEnumAdvise,
48 IOleAdviseHolder_fnSendOnRename,
49 IOleAdviseHolder_fnSendOnSave,
50 IOleAdviseHolder_fnSendOnClose
53 /**************************************************************************
54 * IOleAdviseHolder_Constructor
57 LPOLEADVISEHOLDER IOleAdviseHolder_Constructor()
59 IOleAdviseHolderImpl* lpoah;
61 lpoah= (IOleAdviseHolderImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IOleAdviseHolderImpl));
62 lpoah->ref = 1;
63 lpoah->lpvtbl = &oahvt;
64 FIXME (ole, "(%p)->()\n", lpoah);
66 return (LPOLEADVISEHOLDER)lpoah;
69 /**************************************************************************
70 * IOleAdviseHolder_QueryInterface
72 static HRESULT WINAPI
73 IOleAdviseHolder_fnQueryInterface (LPOLEADVISEHOLDER iface, REFIID riid, LPVOID *ppvObj)
75 ICOM_THIS(IOleAdviseHolderImpl, iface);
76 char xriid[50];
77 WINE_StringFromCLSID((LPCLSID)riid,xriid);
78 FIXME (ole, "(%p)->(\n\tIID:\t%s)\n", This, xriid);
80 *ppvObj = NULL;
82 if(IsEqualIID(riid, &IID_IUnknown)) {
83 /* IUnknown */
84 *ppvObj = This;
86 else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) {
87 /* IOleAdviseHolder */
88 *ppvObj = (IOleAdviseHolder*) This;
91 if(*ppvObj) {
92 (*(LPOLEADVISEHOLDER*)ppvObj)->lpvtbl->fnAddRef(iface);
93 FIXME (ole, "-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
94 return S_OK;
97 FIXME (ole, "-- Interface: E_NOINTERFACE\n");
98 return E_NOINTERFACE;
101 /******************************************************************************
102 * IOleAdviseHolder_AddRef
104 static ULONG WINAPI
105 IOleAdviseHolder_fnAddRef (LPOLEADVISEHOLDER iface)
107 ICOM_THIS(IOleAdviseHolderImpl, iface);
108 FIXME (ole, "(%p)->(count=%lu)\n", This, This->ref);
109 return ++(This->ref);
112 /******************************************************************************
113 * IOleAdviseHolder_Release
115 static ULONG WINAPI
116 IOleAdviseHolder_fnRelease (LPOLEADVISEHOLDER iface)
118 ICOM_THIS(IOleAdviseHolderImpl, iface);
119 FIXME (ole, "(%p)->(count=%lu)\n", This, This->ref);
120 if (!--(This->ref)) {
121 FIXME (ole, "-- destroying IOleAdviseHolder(%p)\n", This);
122 HeapFree(GetProcessHeap(),0,This);
123 return 0;
125 return This->ref;
128 /******************************************************************************
129 * IOleAdviseHolder_Advise
131 static HRESULT WINAPI
132 IOleAdviseHolder_fnAdvise (LPOLEADVISEHOLDER iface,
133 IAdviseSink *pAdvise, DWORD *pdwConnection)
135 ICOM_THIS(IOleAdviseHolderImpl, iface);
136 FIXME (ole, "(%p)->(%p %p)\n", This, pAdvise, pdwConnection);
138 *pdwConnection = 0;
140 return S_OK;
143 /******************************************************************************
144 * IOleAdviseHolder_Unadvise
146 static HRESULT WINAPI
147 IOleAdviseHolder_fnUnadvise (LPOLEADVISEHOLDER iface, DWORD dwConnection)
149 ICOM_THIS(IOleAdviseHolderImpl, iface);
150 FIXME (ole, "(%p)->(%lu)\n", This, dwConnection);
152 return S_OK;
155 /******************************************************************************
156 * IOleAdviseHolder_EnumAdvise
158 static HRESULT WINAPI
159 IOleAdviseHolder_fnEnumAdvise (LPOLEADVISEHOLDER iface, IEnumSTATDATA **ppenumAdvise)
161 ICOM_THIS(IOleAdviseHolderImpl, iface);
162 FIXME (ole, "(%p)->(%p)\n", This, ppenumAdvise);
164 *ppenumAdvise = NULL;
166 return S_OK;
169 /******************************************************************************
170 * IOleAdviseHolder_SendOnRename
172 static HRESULT WINAPI
173 IOleAdviseHolder_fnSendOnRename (LPOLEADVISEHOLDER iface, IMoniker *pmk)
175 ICOM_THIS(IOleAdviseHolderImpl, iface);
176 FIXME (ole, "(%p)->(%p)\n", This, pmk);
179 return S_OK;
182 /******************************************************************************
183 * IOleAdviseHolder_SendOnSave
185 static HRESULT WINAPI
186 IOleAdviseHolder_fnSendOnSave (LPOLEADVISEHOLDER iface)
188 ICOM_THIS(IOleAdviseHolderImpl, iface);
189 FIXME (ole, "(%p)\n", This);
192 return S_OK;
195 /******************************************************************************
196 * IOleAdviseHolder_SendOnClose
198 static HRESULT WINAPI
199 IOleAdviseHolder_fnSendOnClose (LPOLEADVISEHOLDER iface)
201 ICOM_THIS(IOleAdviseHolderImpl, iface);
202 FIXME (ole, "(%p)\n", This);
205 return S_OK;
208 /***********************************************************************
209 * API functions
212 /***********************************************************************
213 * CreateOleAdviseHolder [OLE32.59]
215 HRESULT WINAPI CreateOleAdviseHolder (LPOLEADVISEHOLDER *ppOAHolder)
217 FIXME(ole,"(%p): stub!\n", ppOAHolder);
219 *ppOAHolder = IOleAdviseHolder_Constructor ();
220 if (*ppOAHolder)
221 return S_OK;
223 *ppOAHolder = 0;
224 return E_OUTOFMEMORY;