1998-11-22 19:06:33 +01:00
|
|
|
/*
|
|
|
|
* OLE2 COM objects
|
|
|
|
*
|
|
|
|
* Copyright 1998 Eric Kohl
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
1999-02-28 13:27:56 +01:00
|
|
|
#include <string.h>
|
1999-02-28 20:14:33 +01:00
|
|
|
#include "winbase.h"
|
1998-11-22 19:06:33 +01:00
|
|
|
#include "winerror.h"
|
1999-03-10 19:03:53 +01:00
|
|
|
#include "oleidl.h"
|
1998-11-22 19:06:33 +01:00
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IOleAdviseHolder Implementation
|
|
|
|
*/
|
1999-03-10 19:03:53 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
ICOM_VTABLE(IOleAdviseHolder)* lpvtbl;
|
|
|
|
DWORD ref;
|
|
|
|
} IOleAdviseHolderImpl;
|
|
|
|
|
|
|
|
static HRESULT WINAPI IOleAdviseHolder_fnQueryInterface(LPOLEADVISEHOLDER,REFIID,LPVOID*);
|
|
|
|
static ULONG WINAPI IOleAdviseHolder_fnAddRef(LPOLEADVISEHOLDER);
|
|
|
|
static ULONG WINAPI IOleAdviseHolder_fnRelease(LPOLEADVISEHOLDER);
|
|
|
|
static HRESULT WINAPI IOleAdviseHolder_fnAdvise(LPOLEADVISEHOLDER, IAdviseSink*, DWORD*);
|
|
|
|
static HRESULT WINAPI IOleAdviseHolder_fnUnadvise (LPOLEADVISEHOLDER, DWORD);
|
|
|
|
static HRESULT WINAPI IOleAdviseHolder_fnEnumAdvise (LPOLEADVISEHOLDER, IEnumSTATDATA **);
|
|
|
|
static HRESULT WINAPI IOleAdviseHolder_fnSendOnRename (LPOLEADVISEHOLDER, IMoniker *);
|
|
|
|
static HRESULT WINAPI IOleAdviseHolder_fnSendOnSave (LPOLEADVISEHOLDER);
|
|
|
|
static HRESULT WINAPI IOleAdviseHolder_fnSendOnClose (LPOLEADVISEHOLDER);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IOleAdviseHolder_VTable
|
|
|
|
*/
|
1999-03-10 19:03:53 +01:00
|
|
|
static struct ICOM_VTABLE(IOleAdviseHolder) oahvt =
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnQueryInterface,
|
|
|
|
IOleAdviseHolder_fnAddRef,
|
|
|
|
IOleAdviseHolder_fnRelease,
|
|
|
|
IOleAdviseHolder_fnAdvise,
|
|
|
|
IOleAdviseHolder_fnUnadvise,
|
|
|
|
IOleAdviseHolder_fnEnumAdvise,
|
|
|
|
IOleAdviseHolder_fnSendOnRename,
|
|
|
|
IOleAdviseHolder_fnSendOnSave,
|
|
|
|
IOleAdviseHolder_fnSendOnClose
|
1998-11-22 19:06:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IOleAdviseHolder_Constructor
|
|
|
|
*/
|
|
|
|
|
|
|
|
LPOLEADVISEHOLDER IOleAdviseHolder_Constructor()
|
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolderImpl* lpoah;
|
1998-11-22 19:06:33 +01:00
|
|
|
|
1999-03-10 19:03:53 +01:00
|
|
|
lpoah= (IOleAdviseHolderImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IOleAdviseHolderImpl));
|
1998-11-22 19:06:33 +01:00
|
|
|
lpoah->ref = 1;
|
|
|
|
lpoah->lpvtbl = &oahvt;
|
|
|
|
FIXME (ole, "(%p)->()\n", lpoah);
|
|
|
|
|
1999-03-10 19:03:53 +01:00
|
|
|
return (LPOLEADVISEHOLDER)lpoah;
|
1998-11-22 19:06:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IOleAdviseHolder_QueryInterface
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnQueryInterface (LPOLEADVISEHOLDER iface, REFIID riid, LPVOID *ppvObj)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
1998-11-22 19:06:33 +01:00
|
|
|
char xriid[50];
|
|
|
|
WINE_StringFromCLSID((LPCLSID)riid,xriid);
|
1999-03-10 19:03:53 +01:00
|
|
|
FIXME (ole, "(%p)->(\n\tIID:\t%s)\n", This, xriid);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
*ppvObj = NULL;
|
|
|
|
|
|
|
|
if(IsEqualIID(riid, &IID_IUnknown)) {
|
|
|
|
/* IUnknown */
|
1999-03-10 19:03:53 +01:00
|
|
|
*ppvObj = This;
|
1998-11-22 19:06:33 +01:00
|
|
|
}
|
|
|
|
else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) {
|
|
|
|
/* IOleAdviseHolder */
|
1999-03-10 19:03:53 +01:00
|
|
|
*ppvObj = (IOleAdviseHolder*) This;
|
1998-11-22 19:06:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppvObj) {
|
1999-03-10 19:03:53 +01:00
|
|
|
(*(LPOLEADVISEHOLDER*)ppvObj)->lpvtbl->fnAddRef(iface);
|
1998-11-22 19:06:33 +01:00
|
|
|
FIXME (ole, "-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME (ole, "-- Interface: E_NOINTERFACE\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_AddRef
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnAddRef (LPOLEADVISEHOLDER iface)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)->(count=%lu)\n", This, This->ref);
|
|
|
|
return ++(This->ref);
|
1998-11-22 19:06:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_Release
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnRelease (LPOLEADVISEHOLDER iface)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)->(count=%lu)\n", This, This->ref);
|
|
|
|
if (!--(This->ref)) {
|
|
|
|
FIXME (ole, "-- destroying IOleAdviseHolder(%p)\n", This);
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
1998-11-22 19:06:33 +01:00
|
|
|
return 0;
|
|
|
|
}
|
1999-03-10 19:03:53 +01:00
|
|
|
return This->ref;
|
1998-11-22 19:06:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_Advise
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnAdvise (LPOLEADVISEHOLDER iface,
|
1998-11-22 19:06:33 +01:00
|
|
|
IAdviseSink *pAdvise, DWORD *pdwConnection)
|
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)->(%p %p)\n", This, pAdvise, pdwConnection);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
*pdwConnection = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_Unadvise
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnUnadvise (LPOLEADVISEHOLDER iface, DWORD dwConnection)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)->(%lu)\n", This, dwConnection);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_EnumAdvise
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnEnumAdvise (LPOLEADVISEHOLDER iface, IEnumSTATDATA **ppenumAdvise)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)->(%p)\n", This, ppenumAdvise);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
*ppenumAdvise = NULL;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_SendOnRename
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnSendOnRename (LPOLEADVISEHOLDER iface, IMoniker *pmk)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)->(%p)\n", This, pmk);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_SendOnSave
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnSendOnSave (LPOLEADVISEHOLDER iface)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)\n", This);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IOleAdviseHolder_SendOnClose
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
1999-03-10 19:03:53 +01:00
|
|
|
IOleAdviseHolder_fnSendOnClose (LPOLEADVISEHOLDER iface)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
1999-03-10 19:03:53 +01:00
|
|
|
ICOM_THIS(IOleAdviseHolderImpl, iface);
|
|
|
|
FIXME (ole, "(%p)\n", This);
|
1998-11-22 19:06:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* API functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CreateOleAdviseHolder [OLE32.59]
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HRESULT WINAPI CreateOleAdviseHolder (LPOLEADVISEHOLDER *ppOAHolder)
|
1998-11-22 19:06:33 +01:00
|
|
|
{
|
|
|
|
FIXME(ole,"(%p): stub!\n", ppOAHolder);
|
|
|
|
|
|
|
|
*ppOAHolder = IOleAdviseHolder_Constructor ();
|
|
|
|
if (*ppOAHolder)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
*ppOAHolder = 0;
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|