1 /***************************************************************************************
2 * BindCtx implementation
4 * Copyright 1999 Noomen Hamza
5 ***************************************************************************************/
12 #include "wine/obj_base.h"
13 #include "wine/obj_storage.h"
14 #include "wine/obj_moniker.h"
18 typedef struct BindCtxImpl
{
20 ICOM_VTABLE(IBindCtx
)* lpvtbl
;
27 HRESULT WINAPI
BindCtxImpl_QueryInterface(IBindCtx
* iface
,REFIID riid
,void** ppvObject
);
28 ULONG WINAPI
BindCtxImpl_AddRef(IBindCtx
* iface
);
29 ULONG WINAPI
BindCtxImpl_Release(IBindCtx
* iface
);
30 HRESULT WINAPI
BindCtxImpl_RegisterObjectBound(IBindCtx
* iface
,IUnknown
* punk
);
31 HRESULT WINAPI
BindCtxImpl_RevokeObjectBound(IBindCtx
* iface
, IUnknown
* punk
);
32 HRESULT WINAPI
BindCtxImpl_ReleaseObjects(IBindCtx
* iface
);
33 HRESULT WINAPI
BindCtxImpl_SetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
);
34 HRESULT WINAPI
BindCtxImpl_GetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
);
35 HRESULT WINAPI
BindCtxImpl_GetRunningObjectTable(IBindCtx
* iface
,IRunningObjectTable
** pprot
);
36 HRESULT WINAPI
BindCtxImpl_RegisterObjectParam(IBindCtx
* iface
,LPOLESTR32 pszkey
, IUnknown
* punk
);
37 HRESULT WINAPI
BindCtxImpl_GetObjectParam(IBindCtx
* iface
,LPOLESTR32 pszkey
, IUnknown
* punk
);
38 HRESULT WINAPI
BindCtxImpl_EnumObjectParam(IBindCtx
* iface
,IEnumString
** ppenum
);
39 HRESULT WINAPI
BindCtxImpl_RevokeObjectParam(IBindCtx
* iface
,LPOLESTR32 pszkey
);
41 HRESULT WINAPI
CreateBindCtx16(DWORD reserved
, LPBC
* ppbc
);
42 HRESULT WINAPI
CreateBindCtx32(DWORD reserved
, LPBC
* ppbc
);
44 HRESULT WINAPI
BindCtxImpl_Construct(BindCtxImpl
* This
);
45 HRESULT WINAPI
BindCtxImpl_Destroy(BindCtxImpl
* This
);
47 // Virtual function table for the BindCtx class.
48 static ICOM_VTABLE(IBindCtx
) VT_BindCtxImpl
=
50 BindCtxImpl_QueryInterface
,
53 BindCtxImpl_RegisterObjectBound
,
54 BindCtxImpl_RevokeObjectBound
,
55 BindCtxImpl_ReleaseObjects
,
56 BindCtxImpl_SetBindOptions
,
57 BindCtxImpl_GetBindOptions
,
58 BindCtxImpl_GetRunningObjectTable
,
59 BindCtxImpl_RegisterObjectParam
,
60 BindCtxImpl_GetObjectParam
,
61 BindCtxImpl_EnumObjectParam
,
62 BindCtxImpl_RevokeObjectParam
65 /*******************************************************************************
66 * BindCtx_QueryInterface
67 *******************************************************************************/
68 HRESULT WINAPI
BindCtxImpl_QueryInterface(IBindCtx
* iface
,REFIID riid
,void** ppvObject
)
70 ICOM_THIS(BindCtxImpl
,iface
);
71 TRACE(ole
,"(%p,%p,%p)\n",This
,riid
,ppvObject
);
72 // Perform a sanity check on the parameters.
73 if ( (This
==0) || (ppvObject
==0) ) return E_INVALIDARG
;
75 // Initialize the return parameter.
78 // Compare the riid with the interface IDs implemented by this object.
79 if (memcmp(&IID_IUnknown
, riid
, sizeof(IID_IUnknown
)) == 0)
80 *ppvObject
= (IBindCtx
*)This
;
82 if (memcmp(&IID_IBindCtx
, riid
, sizeof(IID_IBindCtx
)) == 0)
83 *ppvObject
= (IBindCtx
*)This
;
85 // Check that we obtained an interface.
86 if ((*ppvObject
)==0) return E_NOINTERFACE
;
88 // Query Interface always increases the reference count by one when it is successful
89 BindCtxImpl_AddRef(iface
);
94 /******************************************************************************
96 ******************************************************************************/
97 ULONG WINAPI
BindCtxImpl_AddRef(IBindCtx
* iface
)
99 ICOM_THIS(BindCtxImpl
,iface
);
100 TRACE(ole
,"(%p)\n",This
);
102 return ++(This
->ref
);
105 /******************************************************************************
107 ******************************************************************************/
108 ULONG WINAPI
BindCtxImpl_Release(IBindCtx
* iface
)
110 ICOM_THIS(BindCtxImpl
,iface
);
111 TRACE(ole
,"(%p)\n",This
);
116 BindCtxImpl_Destroy(This
);
123 /******************************************************************************
125 *******************************************************************************/
126 HRESULT WINAPI
BindCtxImpl_Construct(BindCtxImpl
* This
)
128 FIXME(ole
,"(%p),stub!\n",This
);
130 memset(This
, 0, sizeof(BindCtxImpl
));
132 //Initialize the virtual fgunction table.
133 This
->lpvtbl
= &VT_BindCtxImpl
;
138 /******************************************************************************
140 *******************************************************************************/
141 HRESULT WINAPI
BindCtxImpl_Destroy(BindCtxImpl
* This
)
143 FIXME(ole
,"(%p),stub!\n",This
);
151 /******************************************************************************
152 * BindCtx_RegisterObjectBound
153 ******************************************************************************/
154 HRESULT WINAPI
BindCtxImpl_RegisterObjectBound(IBindCtx
* iface
,IUnknown
* punk
)
156 ICOM_THIS(BindCtxImpl
,iface
);
157 FIXME(ole
,"(%p,%p),stub!\n",This
,punk
);
162 /******************************************************************************
163 * BindCtx_RevokeObjectBound
164 ******************************************************************************/
165 HRESULT WINAPI
BindCtxImpl_RevokeObjectBound(IBindCtx
* iface
, IUnknown
* punk
)
167 ICOM_THIS(BindCtxImpl
,iface
);
168 FIXME(ole
,"(%p,%p),stub!\n",This
,punk
);
173 /******************************************************************************
174 * BindCtx_ReleaseObjects
175 ******************************************************************************/
176 HRESULT WINAPI
BindCtxImpl_ReleaseObjects(IBindCtx
* iface
)
178 ICOM_THIS(BindCtxImpl
,iface
);
179 FIXME(ole
,"(%p),stub!\n",This
);
184 /******************************************************************************
185 * BindCtx_SetBindOptions
186 ******************************************************************************/
187 HRESULT WINAPI
BindCtxImpl_SetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
)
189 ICOM_THIS(BindCtxImpl
,iface
);
190 FIXME(ole
,"(%p,%p),stub!\n",This
,pbindopts
);
195 /******************************************************************************
196 * BindCtx_GetBindOptions
197 ******************************************************************************/
198 HRESULT WINAPI
BindCtxImpl_GetBindOptions(IBindCtx
* iface
,LPBIND_OPTS2 pbindopts
)
200 ICOM_THIS(BindCtxImpl
,iface
);
201 FIXME(ole
,"(%p,%p),stub!\n",This
,pbindopts
);
206 /******************************************************************************
207 * BindCtx_GetRunningObjectTable
208 ******************************************************************************/
209 HRESULT WINAPI
BindCtxImpl_GetRunningObjectTable(IBindCtx
* iface
,IRunningObjectTable
** pprot
)
211 ICOM_THIS(BindCtxImpl
,iface
);
212 FIXME(ole
,"(%p,%p),stub!\n",This
,pprot
);
217 /******************************************************************************
218 * BindCtx_RegisterObjectParam
219 ******************************************************************************/
220 HRESULT WINAPI
BindCtxImpl_RegisterObjectParam(IBindCtx
* iface
,LPOLESTR32 pszkey
, IUnknown
* punk
)
222 ICOM_THIS(BindCtxImpl
,iface
);
223 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pszkey
,punk
);
228 /******************************************************************************
229 * BindCtx_GetObjectParam
230 ******************************************************************************/
231 HRESULT WINAPI
BindCtxImpl_GetObjectParam(IBindCtx
* iface
,LPOLESTR32 pszkey
, IUnknown
* punk
)
233 ICOM_THIS(BindCtxImpl
,iface
);
234 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pszkey
,punk
);
239 /******************************************************************************
240 * BindCtx_EnumObjectParam
241 ******************************************************************************/
242 HRESULT WINAPI
BindCtxImpl_EnumObjectParam(IBindCtx
* iface
,IEnumString
** ppenum
)
244 ICOM_THIS(BindCtxImpl
,iface
);
245 FIXME(ole
,"(%p,%p),stub!\n",This
,ppenum
);
250 /******************************************************************************
251 * BindCtx_RevokeObjectParam
252 ******************************************************************************/
253 HRESULT WINAPI
BindCtxImpl_RevokeObjectParam(IBindCtx
* iface
,LPOLESTR32 pszkey
)
255 ICOM_THIS(BindCtxImpl
,iface
);
256 FIXME(ole
,"(%p,%p),stub!\n",This
,pszkey
);
262 /******************************************************************************
264 ******************************************************************************/
265 HRESULT WINAPI
CreateBindCtx16(DWORD reserved
, LPBC
* ppbc
)
267 FIXME(ole
,"(%ld,%p),stub!\n",reserved
,ppbc
);
272 /******************************************************************************
274 ******************************************************************************/
275 HRESULT WINAPI
CreateBindCtx32(DWORD reserved
, LPBC
* ppbc
)
277 BindCtxImpl
* newBindCtx
= 0;
280 TRACE(ole
,"(%ld,%p)\n",reserved
,ppbc
);
282 newBindCtx
= HeapAlloc(GetProcessHeap(), 0, sizeof(BindCtxImpl
));
285 return STG_E_INSUFFICIENTMEMORY
;
287 hr
= BindCtxImpl_Construct(newBindCtx
);
292 hr
= BindCtxImpl_QueryInterface((IBindCtx
*)newBindCtx
,&IID_IBindCtx
,(void**)ppbc
);