1999-01-28 18:56:14 +01:00
|
|
|
/***************************************************************************************
|
|
|
|
* BindCtx implementation
|
|
|
|
*
|
|
|
|
* Copyright 1999 Noomen Hamza
|
|
|
|
***************************************************************************************/
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "wine/obj_base.h"
|
|
|
|
#include "wine/obj_storage.h"
|
|
|
|
#include "wine/obj_moniker.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "heap.h"
|
|
|
|
|
|
|
|
typedef struct BindCtxImpl{
|
|
|
|
|
|
|
|
ICOM_VTABLE(IBindCtx)* lpvtbl;
|
|
|
|
|
|
|
|
ULONG ref;
|
|
|
|
|
|
|
|
} BindCtxImpl;
|
|
|
|
|
|
|
|
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_QueryInterface(IBindCtx* iface,REFIID riid,void** ppvObject);
|
|
|
|
ULONG WINAPI BindCtxImpl_AddRef(IBindCtx* iface);
|
|
|
|
ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface);
|
|
|
|
HRESULT WINAPI BindCtxImpl_RegisterObjectBound(IBindCtx* iface,IUnknown* punk);
|
|
|
|
HRESULT WINAPI BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk);
|
|
|
|
HRESULT WINAPI BindCtxImpl_ReleaseObjects(IBindCtx* iface);
|
|
|
|
HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts);
|
|
|
|
HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts);
|
|
|
|
HRESULT WINAPI BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot);
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk);
|
|
|
|
HRESULT WINAPI BindCtxImpl_GetObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk);
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_EnumObjectParam(IBindCtx* iface,IEnumString** ppenum);
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR pszkey);
|
1999-02-18 14:26:22 +01:00
|
|
|
|
1999-01-28 18:56:14 +01:00
|
|
|
HRESULT WINAPI CreateBindCtx16(DWORD reserved, LPBC * ppbc);
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc);
|
1999-01-28 18:56:14 +01:00
|
|
|
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_Construct(BindCtxImpl* This);
|
|
|
|
HRESULT WINAPI BindCtxImpl_Destroy(BindCtxImpl* This);
|
|
|
|
|
1999-01-28 18:56:14 +01:00
|
|
|
// Virtual function table for the BindCtx class.
|
|
|
|
static ICOM_VTABLE(IBindCtx) VT_BindCtxImpl =
|
|
|
|
{
|
1999-02-18 14:26:22 +01:00
|
|
|
BindCtxImpl_QueryInterface,
|
|
|
|
BindCtxImpl_AddRef,
|
|
|
|
BindCtxImpl_Release,
|
|
|
|
BindCtxImpl_RegisterObjectBound,
|
|
|
|
BindCtxImpl_RevokeObjectBound,
|
|
|
|
BindCtxImpl_ReleaseObjects,
|
|
|
|
BindCtxImpl_SetBindOptions,
|
|
|
|
BindCtxImpl_GetBindOptions,
|
|
|
|
BindCtxImpl_GetRunningObjectTable,
|
|
|
|
BindCtxImpl_RegisterObjectParam,
|
|
|
|
BindCtxImpl_GetObjectParam,
|
|
|
|
BindCtxImpl_EnumObjectParam,
|
|
|
|
BindCtxImpl_RevokeObjectParam
|
1999-01-28 18:56:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* BindCtx_QueryInterface
|
|
|
|
*******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_QueryInterface(IBindCtx* iface,REFIID riid,void** ppvObject)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
TRACE(ole,"(%p,%p,%p)\n",This,riid,ppvObject);
|
|
|
|
// Perform a sanity check on the parameters.
|
|
|
|
if ( (This==0) || (ppvObject==0) ) return E_INVALIDARG;
|
|
|
|
|
|
|
|
// Initialize the return parameter.
|
|
|
|
*ppvObject = 0;
|
|
|
|
|
|
|
|
// Compare the riid with the interface IDs implemented by this object.
|
|
|
|
if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
|
|
|
|
*ppvObject = (IBindCtx*)This;
|
|
|
|
else
|
|
|
|
if (memcmp(&IID_IBindCtx, riid, sizeof(IID_IBindCtx)) == 0)
|
|
|
|
*ppvObject = (IBindCtx*)This;
|
|
|
|
|
|
|
|
// Check that we obtained an interface.
|
|
|
|
if ((*ppvObject)==0) return E_NOINTERFACE;
|
|
|
|
|
|
|
|
// Query Interface always increases the reference count by one when it is successful
|
1999-02-18 14:26:22 +01:00
|
|
|
BindCtxImpl_AddRef(iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_ _AddRef
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
ULONG WINAPI BindCtxImpl_AddRef(IBindCtx* iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
TRACE(ole,"(%p)\n",This);
|
|
|
|
|
|
|
|
return ++(This->ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_Release
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
TRACE(ole,"(%p)\n",This);
|
|
|
|
|
|
|
|
This->ref--;
|
|
|
|
|
|
|
|
if (This->ref==0){
|
1999-02-18 14:26:22 +01:00
|
|
|
BindCtxImpl_Destroy(This);
|
1999-01-28 18:56:14 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return This->ref;;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
1999-02-18 14:26:22 +01:00
|
|
|
* BindCtx_Construct
|
1999-01-28 18:56:14 +01:00
|
|
|
*******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_Construct(BindCtxImpl* This)
|
|
|
|
{
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p),stub!\n",This);
|
|
|
|
|
|
|
|
memset(This, 0, sizeof(BindCtxImpl));
|
|
|
|
|
|
|
|
//Initialize the virtual fgunction table.
|
|
|
|
This->lpvtbl = &VT_BindCtxImpl;
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
1999-02-18 14:26:22 +01:00
|
|
|
* BindCtx_Destroy
|
1999-01-28 18:56:14 +01:00
|
|
|
*******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_Destroy(BindCtxImpl* This)
|
|
|
|
{
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p),stub!\n",This);
|
|
|
|
|
|
|
|
SEGPTR_FREE(This);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_RegisterObjectBound
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_RegisterObjectBound(IBindCtx* iface,IUnknown* punk)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p),stub!\n",This,punk);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_RevokeObjectBound
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p),stub!\n",This,punk);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_ReleaseObjects
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_ReleaseObjects(IBindCtx* iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p),stub!\n",This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_SetBindOptions
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p),stub!\n",This,pbindopts);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_GetBindOptions
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p),stub!\n",This,pbindopts);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_GetRunningObjectTable
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p),stub!\n",This,pprot);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_RegisterObjectParam
|
|
|
|
******************************************************************************/
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk)
|
1999-02-18 14:26:22 +01:00
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p,%p),stub!\n",This,pszkey,punk);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_GetObjectParam
|
|
|
|
******************************************************************************/
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_GetObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk)
|
1999-02-18 14:26:22 +01:00
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p,%p),stub!\n",This,pszkey,punk);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_EnumObjectParam
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_EnumObjectParam(IBindCtx* iface,IEnumString** ppenum)
|
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p),stub!\n",This,ppenum);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* BindCtx_RevokeObjectParam
|
|
|
|
******************************************************************************/
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR pszkey)
|
1999-02-18 14:26:22 +01:00
|
|
|
{
|
|
|
|
ICOM_THIS(BindCtxImpl,iface);
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%p,%p),stub!\n",This,pszkey);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* CreateBindCtx16
|
|
|
|
******************************************************************************/
|
1999-02-18 14:26:22 +01:00
|
|
|
HRESULT WINAPI CreateBindCtx16(DWORD reserved, LPBC * ppbc)
|
|
|
|
{
|
1999-01-28 18:56:14 +01:00
|
|
|
FIXME(ole,"(%ld,%p),stub!\n",reserved,ppbc);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* CreateBindCtx32
|
|
|
|
******************************************************************************/
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc)
|
1999-02-18 14:26:22 +01:00
|
|
|
{
|
1999-01-28 18:56:14 +01:00
|
|
|
BindCtxImpl* newBindCtx = 0;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
|
|
|
TRACE(ole,"(%ld,%p)\n",reserved,ppbc);
|
|
|
|
|
|
|
|
newBindCtx = HeapAlloc(GetProcessHeap(), 0, sizeof(BindCtxImpl));
|
|
|
|
|
|
|
|
if (newBindCtx == 0)
|
|
|
|
return STG_E_INSUFFICIENTMEMORY;
|
|
|
|
|
|
|
|
hr = BindCtxImpl_Construct(newBindCtx);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
1999-02-18 14:26:22 +01:00
|
|
|
hr = BindCtxImpl_QueryInterface((IBindCtx*)newBindCtx,&IID_IBindCtx,(void**)ppbc);
|
1999-01-28 18:56:14 +01:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|