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(BindCtxImpl
* This
,REFIID riid
,void** ppvObject
);
28 ULONG WINAPI
BindCtxImpl_AddRef(BindCtxImpl
* This
);
29 ULONG WINAPI
BindCtxImpl_Release(BindCtxImpl
* This
);
30 HRESULT WINAPI
BindCtxImpl_Construct(BindCtxImpl
* This
);
31 HRESULT WINAPI
BindCtxImpl_destroy(BindCtxImpl
* This
);
32 HRESULT WINAPI
BindCtxImpl_RegisterObjectBound(BindCtxImpl
* This
,IUnknown
* punk
);
33 HRESULT WINAPI
BindCtxImpl_RevokeObjectBound(BindCtxImpl
* This
, IUnknown
* punk
);
34 HRESULT WINAPI
BindCtxImpl_ReleaseObjects(BindCtxImpl
* This
);
35 HRESULT WINAPI
BindCtxImpl_SetBindOptions(BindCtxImpl
* This
,LPBIND_OPTS2 pbindopts
);
36 HRESULT WINAPI
BindCtxImpl_GetBindOptions(BindCtxImpl
* This
,LPBIND_OPTS2 pbindopts
);
37 HRESULT WINAPI
BindCtxImpl_GetRunningObjectTable(BindCtxImpl
* This
,IRunningObjectTable
** pprot
);
38 HRESULT WINAPI
BindCtxImpl_RegisterObjectParam(BindCtxImpl
* This
,LPOLESTR32 pszkey
, IUnknown
* punk
);
39 HRESULT WINAPI
BindCtxImpl_GetObjectParam(BindCtxImpl
* This
,LPOLESTR32 pszkey
, IUnknown
* punk
);
40 HRESULT WINAPI
BindCtxImpl_EnumObjectParam(BindCtxImpl
* This
,IEnumString
** ppenum
);
41 HRESULT WINAPI
BindCtxImpl_RevokeObjectParam(BindCtxImpl
* This
,LPOLESTR32 pszkey
);
42 HRESULT WINAPI
CreateBindCtx16(DWORD reserved
, LPBC
* ppbc
);
43 HRESULT WINAPI
CreateBindCtx32(DWORD reserved
, LPBC
* ppbc
);
45 #define VTABLE_FUNC(a) (void*)(a)
46 // Virtual function table for the BindCtx class.
47 static ICOM_VTABLE(IBindCtx
) VT_BindCtxImpl
=
50 VTABLE_FUNC(BindCtxImpl_QueryInterface
),
51 VTABLE_FUNC(BindCtxImpl_AddRef
),
52 VTABLE_FUNC(BindCtxImpl_Release
)
54 VTABLE_FUNC(BindCtxImpl_RegisterObjectBound
),
55 VTABLE_FUNC(BindCtxImpl_RevokeObjectBound
),
56 VTABLE_FUNC(BindCtxImpl_ReleaseObjects
),
57 VTABLE_FUNC(BindCtxImpl_SetBindOptions
),
58 VTABLE_FUNC(BindCtxImpl_GetBindOptions
),
59 VTABLE_FUNC(BindCtxImpl_GetRunningObjectTable
),
60 VTABLE_FUNC(BindCtxImpl_RegisterObjectParam
),
61 VTABLE_FUNC(BindCtxImpl_GetObjectParam
),
62 VTABLE_FUNC(BindCtxImpl_EnumObjectParam
),
63 VTABLE_FUNC(BindCtxImpl_RevokeObjectParam
)
66 /*******************************************************************************
67 * BindCtx_QueryInterface
68 *******************************************************************************/
69 HRESULT WINAPI
BindCtxImpl_QueryInterface(BindCtxImpl
* This
,REFIID riid
,void** ppvObject
){
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(This
);
94 /******************************************************************************
96 ******************************************************************************/
97 ULONG WINAPI
BindCtxImpl_AddRef(BindCtxImpl
* This
){
99 TRACE(ole
,"(%p)\n",This
);
101 return ++(This
->ref
);
104 /******************************************************************************
106 ******************************************************************************/
107 ULONG WINAPI
BindCtxImpl_Release(BindCtxImpl
* This
){
109 TRACE(ole
,"(%p)\n",This
);
114 BindCtxImpl_destroy(This
);
121 /******************************************************************************
122 * BindCtx_Constructor
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(BindCtxImpl
* This
,IUnknown
* punk
){
154 FIXME(ole
,"(%p,%p),stub!\n",This
,punk
);
159 /******************************************************************************
160 * BindCtx_RevokeObjectBound
161 ******************************************************************************/
162 HRESULT WINAPI
BindCtxImpl_RevokeObjectBound(BindCtxImpl
* This
, IUnknown
* punk
){
164 FIXME(ole
,"(%p,%p),stub!\n",This
,punk
);
169 /******************************************************************************
170 * BindCtx_ReleaseObjects
171 ******************************************************************************/
172 HRESULT WINAPI
BindCtxImpl_ReleaseObjects(BindCtxImpl
* This
){
174 FIXME(ole
,"(%p),stub!\n",This
);
179 /******************************************************************************
180 * BindCtx_SetBindOptions
181 ******************************************************************************/
182 HRESULT WINAPI
BindCtxImpl_SetBindOptions(BindCtxImpl
* This
,LPBIND_OPTS2 pbindopts
){
184 FIXME(ole
,"(%p,%p),stub!\n",This
,pbindopts
);
189 /******************************************************************************
190 * BindCtx_GetBindOptions
191 ******************************************************************************/
192 HRESULT WINAPI
BindCtxImpl_GetBindOptions(BindCtxImpl
* This
,LPBIND_OPTS2 pbindopts
){
194 FIXME(ole
,"(%p,%p),stub!\n",This
,pbindopts
);
199 /******************************************************************************
200 * BindCtx_GetRunningObjectTable
201 ******************************************************************************/
202 HRESULT WINAPI
BindCtxImpl_GetRunningObjectTable(BindCtxImpl
* This
,IRunningObjectTable
** pprot
){
204 FIXME(ole
,"(%p,%p),stub!\n",This
,pprot
);
209 /******************************************************************************
210 * BindCtx_RegisterObjectParam
211 ******************************************************************************/
212 HRESULT WINAPI
BindCtxImpl_RegisterObjectParam(BindCtxImpl
* This
,LPOLESTR32 pszkey
, IUnknown
* punk
){
214 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pszkey
,punk
);
219 /******************************************************************************
220 * BindCtx_GetObjectParam
221 ******************************************************************************/
222 HRESULT WINAPI
BindCtxImpl_GetObjectParam(BindCtxImpl
* This
,LPOLESTR32 pszkey
, IUnknown
* punk
){
224 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pszkey
,punk
);
229 /******************************************************************************
230 * BindCtx_EnumObjectParam
231 ******************************************************************************/
232 HRESULT WINAPI
BindCtxImpl_EnumObjectParam(BindCtxImpl
* This
,IEnumString
** ppenum
){
234 FIXME(ole
,"(%p,%p),stub!\n",This
,ppenum
);
239 /******************************************************************************
240 * BindCtx_RevokeObjectParam
241 ******************************************************************************/
242 HRESULT WINAPI
BindCtxImpl_RevokeObjectParam(BindCtxImpl
* This
,LPOLESTR32 pszkey
){
244 FIXME(ole
,"(%p,%p),stub!\n",This
,pszkey
);
250 /******************************************************************************
252 ******************************************************************************/
253 HRESULT WINAPI
CreateBindCtx16(DWORD reserved
, LPBC
* ppbc
){
255 FIXME(ole
,"(%ld,%p),stub!\n",reserved
,ppbc
);
260 /******************************************************************************
262 ******************************************************************************/
263 HRESULT WINAPI
CreateBindCtx32(DWORD reserved
, LPBC
* ppbc
){
265 BindCtxImpl
* newBindCtx
= 0;
268 TRACE(ole
,"(%ld,%p)\n",reserved
,ppbc
);
270 newBindCtx
= HeapAlloc(GetProcessHeap(), 0, sizeof(BindCtxImpl
));
273 return STG_E_INSUFFICIENTMEMORY
;
275 hr
= BindCtxImpl_Construct(newBindCtx
);
280 hr
= BindCtxImpl_QueryInterface(newBindCtx
,&IID_IBindCtx
,(void**)ppbc
);