1 /***************************************************************************************
2 * BindCtx implementation
4 * Copyright 1999 Noomen Hamza
5 ***************************************************************************************/
12 #include "wine/obj_moniker.h"
16 typedef struct BindCtxImpl
{
18 ICOM_VTABLE(IBindCtx
)* lpvtbl
;
25 HRESULT WINAPI
BindCtxImpl_QueryInterface(IBindCtx
* iface
,REFIID riid
,void** ppvObject
);
26 ULONG WINAPI
BindCtxImpl_AddRef(IBindCtx
* iface
);
27 ULONG WINAPI
BindCtxImpl_Release(IBindCtx
* iface
);
28 HRESULT WINAPI
BindCtxImpl_RegisterObjectBound(IBindCtx
* iface
,IUnknown
* punk
);
29 HRESULT WINAPI
BindCtxImpl_RevokeObjectBound(IBindCtx
* iface
, IUnknown
* punk
);
30 HRESULT WINAPI
BindCtxImpl_ReleaseObjects(IBindCtx
* iface
);
31 HRESULT WINAPI
BindCtxImpl_SetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
);
32 HRESULT WINAPI
BindCtxImpl_GetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
);
33 HRESULT WINAPI
BindCtxImpl_GetRunningObjectTable(IBindCtx
* iface
,IRunningObjectTable
** pprot
);
34 HRESULT WINAPI
BindCtxImpl_RegisterObjectParam(IBindCtx
* iface
,LPOLESTR pszkey
, IUnknown
* punk
);
35 HRESULT WINAPI
BindCtxImpl_GetObjectParam(IBindCtx
* iface
,LPOLESTR pszkey
, IUnknown
* punk
);
36 HRESULT WINAPI
BindCtxImpl_EnumObjectParam(IBindCtx
* iface
,IEnumString
** ppenum
);
37 HRESULT WINAPI
BindCtxImpl_RevokeObjectParam(IBindCtx
* iface
,LPOLESTR pszkey
);
39 HRESULT WINAPI
CreateBindCtx16(DWORD reserved
, LPBC
* ppbc
);
40 HRESULT WINAPI
CreateBindCtx(DWORD reserved
, LPBC
* ppbc
);
42 HRESULT WINAPI
BindCtxImpl_Construct(BindCtxImpl
* This
);
43 HRESULT WINAPI
BindCtxImpl_Destroy(BindCtxImpl
* This
);
45 // Virtual function table for the BindCtx class.
46 static ICOM_VTABLE(IBindCtx
) VT_BindCtxImpl
=
48 BindCtxImpl_QueryInterface
,
51 BindCtxImpl_RegisterObjectBound
,
52 BindCtxImpl_RevokeObjectBound
,
53 BindCtxImpl_ReleaseObjects
,
54 BindCtxImpl_SetBindOptions
,
55 BindCtxImpl_GetBindOptions
,
56 BindCtxImpl_GetRunningObjectTable
,
57 BindCtxImpl_RegisterObjectParam
,
58 BindCtxImpl_GetObjectParam
,
59 BindCtxImpl_EnumObjectParam
,
60 BindCtxImpl_RevokeObjectParam
63 /*******************************************************************************
64 * BindCtx_QueryInterface
65 *******************************************************************************/
66 HRESULT WINAPI
BindCtxImpl_QueryInterface(IBindCtx
* iface
,REFIID riid
,void** ppvObject
)
68 ICOM_THIS(BindCtxImpl
,iface
);
69 TRACE(ole
,"(%p,%p,%p)\n",This
,riid
,ppvObject
);
70 // Perform a sanity check on the parameters.
71 if ( (This
==0) || (ppvObject
==0) ) return E_INVALIDARG
;
73 // Initialize the return parameter.
76 // Compare the riid with the interface IDs implemented by this object.
77 if (memcmp(&IID_IUnknown
, riid
, sizeof(IID_IUnknown
)) == 0)
78 *ppvObject
= (IBindCtx
*)This
;
80 if (memcmp(&IID_IBindCtx
, riid
, sizeof(IID_IBindCtx
)) == 0)
81 *ppvObject
= (IBindCtx
*)This
;
83 // Check that we obtained an interface.
84 if ((*ppvObject
)==0) return E_NOINTERFACE
;
86 // Query Interface always increases the reference count by one when it is successful
87 BindCtxImpl_AddRef(iface
);
92 /******************************************************************************
94 ******************************************************************************/
95 ULONG WINAPI
BindCtxImpl_AddRef(IBindCtx
* iface
)
97 ICOM_THIS(BindCtxImpl
,iface
);
98 TRACE(ole
,"(%p)\n",This
);
100 return ++(This
->ref
);
103 /******************************************************************************
105 ******************************************************************************/
106 ULONG WINAPI
BindCtxImpl_Release(IBindCtx
* iface
)
108 ICOM_THIS(BindCtxImpl
,iface
);
109 TRACE(ole
,"(%p)\n",This
);
114 BindCtxImpl_Destroy(This
);
121 /******************************************************************************
123 *******************************************************************************/
124 HRESULT WINAPI
BindCtxImpl_Construct(BindCtxImpl
* This
)
126 FIXME(ole
,"(%p),stub!\n",This
);
128 memset(This
, 0, sizeof(BindCtxImpl
));
130 //Initialize the virtual fgunction table.
131 This
->lpvtbl
= &VT_BindCtxImpl
;
136 /******************************************************************************
138 *******************************************************************************/
139 HRESULT WINAPI
BindCtxImpl_Destroy(BindCtxImpl
* This
)
141 FIXME(ole
,"(%p),stub!\n",This
);
149 /******************************************************************************
150 * BindCtx_RegisterObjectBound
151 ******************************************************************************/
152 HRESULT WINAPI
BindCtxImpl_RegisterObjectBound(IBindCtx
* iface
,IUnknown
* punk
)
154 ICOM_THIS(BindCtxImpl
,iface
);
155 FIXME(ole
,"(%p,%p),stub!\n",This
,punk
);
160 /******************************************************************************
161 * BindCtx_RevokeObjectBound
162 ******************************************************************************/
163 HRESULT WINAPI
BindCtxImpl_RevokeObjectBound(IBindCtx
* iface
, IUnknown
* punk
)
165 ICOM_THIS(BindCtxImpl
,iface
);
166 FIXME(ole
,"(%p,%p),stub!\n",This
,punk
);
171 /******************************************************************************
172 * BindCtx_ReleaseObjects
173 ******************************************************************************/
174 HRESULT WINAPI
BindCtxImpl_ReleaseObjects(IBindCtx
* iface
)
176 ICOM_THIS(BindCtxImpl
,iface
);
177 FIXME(ole
,"(%p),stub!\n",This
);
182 /******************************************************************************
183 * BindCtx_SetBindOptions
184 ******************************************************************************/
185 HRESULT WINAPI
BindCtxImpl_SetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
)
187 ICOM_THIS(BindCtxImpl
,iface
);
188 FIXME(ole
,"(%p,%p),stub!\n",This
,pbindopts
);
193 /******************************************************************************
194 * BindCtx_GetBindOptions
195 ******************************************************************************/
196 HRESULT WINAPI
BindCtxImpl_GetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
)
198 ICOM_THIS(BindCtxImpl
,iface
);
199 FIXME(ole
,"(%p,%p),stub!\n",This
,pbindopts
);
204 /******************************************************************************
205 * BindCtx_GetRunningObjectTable
206 ******************************************************************************/
207 HRESULT WINAPI
BindCtxImpl_GetRunningObjectTable(IBindCtx
* iface
,IRunningObjectTable
** pprot
)
209 ICOM_THIS(BindCtxImpl
,iface
);
210 FIXME(ole
,"(%p,%p),stub!\n",This
,pprot
);
215 /******************************************************************************
216 * BindCtx_RegisterObjectParam
217 ******************************************************************************/
218 HRESULT WINAPI
BindCtxImpl_RegisterObjectParam(IBindCtx
* iface
,LPOLESTR pszkey
, IUnknown
* punk
)
220 ICOM_THIS(BindCtxImpl
,iface
);
221 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pszkey
,punk
);
226 /******************************************************************************
227 * BindCtx_GetObjectParam
228 ******************************************************************************/
229 HRESULT WINAPI
BindCtxImpl_GetObjectParam(IBindCtx
* iface
,LPOLESTR pszkey
, IUnknown
* punk
)
231 ICOM_THIS(BindCtxImpl
,iface
);
232 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pszkey
,punk
);
237 /******************************************************************************
238 * BindCtx_EnumObjectParam
239 ******************************************************************************/
240 HRESULT WINAPI
BindCtxImpl_EnumObjectParam(IBindCtx
* iface
,IEnumString
** ppenum
)
242 ICOM_THIS(BindCtxImpl
,iface
);
243 FIXME(ole
,"(%p,%p),stub!\n",This
,ppenum
);
248 /******************************************************************************
249 * BindCtx_RevokeObjectParam
250 ******************************************************************************/
251 HRESULT WINAPI
BindCtxImpl_RevokeObjectParam(IBindCtx
* iface
,LPOLESTR pszkey
)
253 ICOM_THIS(BindCtxImpl
,iface
);
254 FIXME(ole
,"(%p,%p),stub!\n",This
,pszkey
);
260 /******************************************************************************
262 ******************************************************************************/
263 HRESULT WINAPI
CreateBindCtx16(DWORD reserved
, LPBC
* ppbc
)
265 FIXME(ole
,"(%ld,%p),stub!\n",reserved
,ppbc
);
270 /******************************************************************************
272 ******************************************************************************/
273 HRESULT WINAPI
CreateBindCtx(DWORD reserved
, LPBC
* ppbc
)
275 BindCtxImpl
* newBindCtx
= 0;
278 TRACE(ole
,"(%ld,%p)\n",reserved
,ppbc
);
280 newBindCtx
= HeapAlloc(GetProcessHeap(), 0, sizeof(BindCtxImpl
));
283 return STG_E_INSUFFICIENTMEMORY
;
285 hr
= BindCtxImpl_Construct(newBindCtx
);
290 hr
= BindCtxImpl_QueryInterface((IBindCtx
*)newBindCtx
,&IID_IBindCtx
,(void**)ppbc
);