1999-05-02 11:27:08 +02:00
|
|
|
/*
|
|
|
|
* OLE 2 default object handler
|
|
|
|
*
|
|
|
|
* Copyright 1999 Francis Beaudet
|
2000-05-24 01:34:40 +02:00
|
|
|
* Copyright 2000 Abey George
|
1999-05-02 11:27:08 +02:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
1999-05-02 11:27:08 +02:00
|
|
|
* NOTES:
|
|
|
|
* The OLE2 default object handler supports a whole whack of
|
|
|
|
* interfaces including:
|
|
|
|
* IOleObject, IDataObject, IPersistStorage, IViewObject2,
|
|
|
|
* IRunnableObject, IOleCache2, IOleCacheControl and much more.
|
|
|
|
*
|
|
|
|
* All the implementation details are taken from: Inside OLE
|
|
|
|
* second edition by Kraig Brockschmidt,
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
* - This implementation of the default handler does not launch the
|
|
|
|
* server in the DoVerb, Update, GetData, GetDataHere and Run
|
|
|
|
* methods. When it is fixed to do so, all the methods will have
|
|
|
|
* to be revisited to allow delegating to the running object
|
|
|
|
*
|
|
|
|
* - All methods in the class that use the class ID should be
|
|
|
|
* aware that it is possible for a class to be treated as
|
|
|
|
* another one and go into emulation mode. Nothing has been
|
|
|
|
* done in this area.
|
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* - Some functions still return E_NOTIMPL they have to be
|
1999-05-08 12:55:32 +02:00
|
|
|
* implemented. Most of those are related to the running of the
|
1999-05-02 11:27:08 +02:00
|
|
|
* actual server.
|
|
|
|
*
|
1999-05-08 12:55:32 +02:00
|
|
|
* - All the methods related to notification and advise sinks are
|
1999-05-02 11:27:08 +02:00
|
|
|
* in place but no notifications are sent to the sinks yet.
|
|
|
|
*/
|
|
|
|
#include <assert.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-08-18 20:35:57 +02:00
|
|
|
#include "winbase.h"
|
2003-09-09 21:39:31 +02:00
|
|
|
#include "winuser.h"
|
1999-05-02 11:27:08 +02:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "ole2.h"
|
2005-11-28 11:16:58 +01:00
|
|
|
|
|
|
|
#include "compobj_private.h"
|
|
|
|
|
|
|
|
#include "wine/unicode.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* DefaultHandler
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct DefaultHandler
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
const IOleObjectVtbl* lpVtbl;
|
|
|
|
const IUnknownVtbl* lpvtblIUnknown;
|
|
|
|
const IDataObjectVtbl* lpvtblIDataObject;
|
|
|
|
const IRunnableObjectVtbl* lpvtblIRunnableObject;
|
2005-09-29 12:29:44 +02:00
|
|
|
const IAdviseSinkVtbl *lpvtblIAdviseSink;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Reference count of this object */
|
2005-07-05 13:02:54 +02:00
|
|
|
LONG ref;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* IUnknown implementation of the outer object. */
|
1999-05-02 11:27:08 +02:00
|
|
|
IUnknown* outerUnknown;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Class Id that this handler object represents. */
|
1999-05-02 11:27:08 +02:00
|
|
|
CLSID clsid;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* IUnknown implementation of the datacache. */
|
1999-05-02 11:27:08 +02:00
|
|
|
IUnknown* dataCache;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Client site for the embedded object. */
|
1999-05-02 11:27:08 +02:00
|
|
|
IOleClientSite* clientSite;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The IOleAdviseHolder maintains the connections
|
|
|
|
* on behalf of the default handler.
|
|
|
|
*/
|
|
|
|
IOleAdviseHolder* oleAdviseHolder;
|
|
|
|
|
|
|
|
/*
|
2002-06-01 01:06:46 +02:00
|
|
|
* The IDataAdviseHolder maintains the data
|
1999-05-02 11:27:08 +02:00
|
|
|
* connections on behalf of the default handler.
|
|
|
|
*/
|
|
|
|
IDataAdviseHolder* dataAdviseHolder;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Name of the container and object contained */
|
2002-06-01 01:06:46 +02:00
|
|
|
LPWSTR containerApp;
|
2000-01-31 06:02:49 +01:00
|
|
|
LPWSTR containerObj;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-23 12:08:35 +02:00
|
|
|
/* IOleObject delegate */
|
|
|
|
IOleObject *pOleDelegate;
|
|
|
|
/* IPersistStorage delegate */
|
|
|
|
IPersistStorage *pPSDelegate;
|
2005-11-28 11:16:58 +01:00
|
|
|
/* IDataObject delegate */
|
|
|
|
IDataObject *pDataDelegate;
|
2005-09-29 12:29:44 +02:00
|
|
|
|
|
|
|
/* connection cookie for the advise on the delegate OLE object */
|
|
|
|
DWORD dwAdvConn;
|
1999-05-02 11:27:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct DefaultHandler DefaultHandler;
|
|
|
|
|
|
|
|
/*
|
2005-07-27 13:10:52 +02:00
|
|
|
* Here, I define utility functions to help with the casting of the
|
2005-09-19 16:42:53 +02:00
|
|
|
* "This" parameter.
|
2004-10-05 20:15:29 +02:00
|
|
|
* There is a version to accommodate all of the VTables implemented
|
1999-05-02 11:27:08 +02:00
|
|
|
* by this object.
|
|
|
|
*/
|
2005-07-27 13:10:52 +02:00
|
|
|
static inline DefaultHandler *impl_from_IOleObject( IOleObject *iface )
|
|
|
|
{
|
|
|
|
return (DefaultHandler *)((char*)iface - FIELD_OFFSET(DefaultHandler, lpVtbl));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline DefaultHandler *impl_from_NDIUnknown( IUnknown *iface )
|
|
|
|
{
|
|
|
|
return (DefaultHandler *)((char*)iface - FIELD_OFFSET(DefaultHandler, lpvtblIUnknown));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline DefaultHandler *impl_from_IDataObject( IDataObject *iface )
|
|
|
|
{
|
|
|
|
return (DefaultHandler *)((char*)iface - FIELD_OFFSET(DefaultHandler, lpvtblIDataObject));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline DefaultHandler *impl_from_IRunnableObject( IRunnableObject *iface )
|
|
|
|
{
|
|
|
|
return (DefaultHandler *)((char*)iface - FIELD_OFFSET(DefaultHandler, lpvtblIRunnableObject));
|
|
|
|
}
|
|
|
|
|
2005-09-29 12:29:44 +02:00
|
|
|
static inline DefaultHandler *impl_from_IAdviseSink( IAdviseSink *iface )
|
|
|
|
{
|
|
|
|
return (DefaultHandler *)((char*)iface - FIELD_OFFSET(DefaultHandler, lpvtblIAdviseSink));
|
|
|
|
}
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
static void DefaultHandler_Destroy(DefaultHandler* This);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Method implementation for the non delegating IUnknown
|
|
|
|
* part of the DefaultHandler class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_NDIUnknown_QueryInterface (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*
|
|
|
|
* This version of QueryInterface will not delegate it's implementation
|
|
|
|
* to the outer unknown.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface(
|
|
|
|
IUnknown* iface,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_NDIUnknown(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Perform a sanity check on the parameters. */
|
|
|
|
if (!ppvObject)
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_INVALIDARG;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
*ppvObject = NULL;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
if (IsEqualIID(&IID_IUnknown, riid))
|
1999-05-02 11:27:08 +02:00
|
|
|
*ppvObject = iface;
|
2005-09-19 16:42:53 +02:00
|
|
|
else if (IsEqualIID(&IID_IOleObject, riid))
|
|
|
|
*ppvObject = (IOleObject*)&This->lpVtbl;
|
|
|
|
else if (IsEqualIID(&IID_IDataObject, riid))
|
|
|
|
*ppvObject = (IDataObject*)&This->lpvtblIDataObject;
|
|
|
|
else if (IsEqualIID(&IID_IRunnableObject, riid))
|
|
|
|
*ppvObject = (IRunnableObject*)&This->lpvtblIRunnableObject;
|
2005-09-28 20:29:38 +02:00
|
|
|
else if (IsEqualIID(&IID_IPersist, riid) ||
|
|
|
|
IsEqualIID(&IID_IPersistStorage, riid) ||
|
|
|
|
IsEqualIID(&IID_IViewObject, riid) ||
|
|
|
|
IsEqualIID(&IID_IViewObject2, riid) ||
|
|
|
|
IsEqualIID(&IID_IOleCache, riid) ||
|
|
|
|
IsEqualIID(&IID_IOleCache2, riid))
|
1999-05-02 11:27:08 +02:00
|
|
|
{
|
2005-09-28 20:29:38 +02:00
|
|
|
HRESULT hr = IUnknown_QueryInterface(This->dataCache, riid, ppvObject);
|
|
|
|
if (FAILED(hr)) FIXME("interface %s not implemented by data cache\n", debugstr_guid(riid));
|
|
|
|
return hr;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Check that we obtained an interface. */
|
|
|
|
if (*ppvObject == NULL)
|
1999-05-02 11:27:08 +02:00
|
|
|
{
|
2000-01-18 06:09:49 +01:00
|
|
|
WARN( "() : asking for un supported interface %s\n", debugstr_guid(riid));
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
/*
|
|
|
|
* Query Interface always increases the reference count by one when it is
|
2002-06-01 01:06:46 +02:00
|
|
|
* successful.
|
1999-05-02 11:27:08 +02:00
|
|
|
*/
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppvObject);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return S_OK;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_NDIUnknown_AddRef (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*
|
|
|
|
* This version of QueryInterface will not delegate it's implementation
|
|
|
|
* to the outer unknown.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
|
1999-05-02 11:27:08 +02:00
|
|
|
IUnknown* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_NDIUnknown(iface);
|
|
|
|
return InterlockedIncrement(&This->ref);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_NDIUnknown_Release (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*
|
|
|
|
* This version of QueryInterface will not delegate it's implementation
|
|
|
|
* to the outer unknown.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
|
1999-05-02 11:27:08 +02:00
|
|
|
IUnknown* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_NDIUnknown(iface);
|
2004-09-24 03:16:53 +02:00
|
|
|
ULONG ref;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Decrease the reference count on this object. */
|
|
|
|
ref = InterlockedDecrement(&This->ref);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
if (!ref) DefaultHandler_Destroy(This);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-09-24 03:16:53 +02:00
|
|
|
return ref;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Methods implementation for the IOleObject part of
|
|
|
|
* the DefaultHandler class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_QueryInterface (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_QueryInterface(
|
|
|
|
IOleObject* iface,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_AddRef (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_AddRef(
|
1999-05-02 11:27:08 +02:00
|
|
|
IOleObject* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_AddRef(This->outerUnknown);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_Release (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_Release(
|
1999-05-02 11:27:08 +02:00
|
|
|
IOleObject* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_Release(This->outerUnknown);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_SetClientSite (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method only keeps the
|
|
|
|
* client site pointer for future reference.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_SetClientSite(
|
|
|
|
IOleObject* iface,
|
|
|
|
IOleClientSite* pClientSite)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
2005-11-28 10:39:19 +01:00
|
|
|
HRESULT hr = S_OK;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, pClientSite);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
hr = IOleObject_SetClientSite(This->pOleDelegate, pClientSite);
|
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
/*
|
|
|
|
* Make sure we release the previous client site if there
|
|
|
|
* was one.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
if (This->clientSite)
|
|
|
|
IOleClientSite_Release(This->clientSite);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
This->clientSite = pClientSite;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
if (This->clientSite)
|
|
|
|
IOleClientSite_AddRef(This->clientSite);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetClientSite (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method returns the
|
|
|
|
* last pointer set in IOleObject_SetClientSite.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetClientSite(
|
|
|
|
IOleObject* iface,
|
|
|
|
IOleClientSite** ppClientSite)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Sanity check. */
|
|
|
|
if (!ppClientSite)
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_POINTER;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
*ppClientSite = This->clientSite;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
if (This->clientSite)
|
|
|
|
IOleClientSite_AddRef(This->clientSite);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_SetHostNames (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method just stores
|
|
|
|
* the strings and returns S_OK.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_SetHostNames(
|
|
|
|
IOleObject* iface,
|
2002-06-01 01:06:46 +02:00
|
|
|
LPCOLESTR szContainerApp,
|
1999-05-02 11:27:08 +02:00
|
|
|
LPCOLESTR szContainerObj)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %s, %s)\n",
|
1999-05-02 11:27:08 +02:00
|
|
|
iface,
|
2002-06-01 01:06:46 +02:00
|
|
|
debugstr_w(szContainerApp),
|
1999-05-02 11:27:08 +02:00
|
|
|
debugstr_w(szContainerObj));
|
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
IOleObject_SetHostNames(This->pOleDelegate, szContainerApp, szContainerObj);
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Be sure to cleanup before re-assinging the strings. */
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->containerApp );
|
|
|
|
This->containerApp = NULL;
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->containerObj );
|
|
|
|
This->containerObj = NULL;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Copy the string supplied. */
|
|
|
|
if (szContainerApp)
|
2000-01-31 06:02:49 +01:00
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
if ((This->containerApp = HeapAlloc( GetProcessHeap(), 0,
|
2000-01-31 06:02:49 +01:00
|
|
|
(lstrlenW(szContainerApp) + 1) * sizeof(WCHAR) )))
|
2005-09-19 16:42:53 +02:00
|
|
|
strcpyW( This->containerApp, szContainerApp );
|
2000-01-31 06:02:49 +01:00
|
|
|
}
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
if (szContainerObj)
|
2000-01-31 06:02:49 +01:00
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
if ((This->containerObj = HeapAlloc( GetProcessHeap(), 0,
|
2000-01-31 06:02:49 +01:00
|
|
|
(lstrlenW(szContainerObj) + 1) * sizeof(WCHAR) )))
|
2005-09-19 16:42:53 +02:00
|
|
|
strcpyW( This->containerObj, szContainerObj );
|
2000-01-31 06:02:49 +01:00
|
|
|
}
|
1999-05-02 11:27:08 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-10-26 12:12:49 +02:00
|
|
|
/* undos the work done by DefaultHandler_Run */
|
|
|
|
static void WINAPI DefaultHandler_Stop(DefaultHandler *This)
|
|
|
|
{
|
|
|
|
if (!This->pOleDelegate)
|
|
|
|
return;
|
|
|
|
|
|
|
|
IOleObject_Unadvise(This->pOleDelegate, This->dwAdvConn);
|
|
|
|
|
|
|
|
/* FIXME: call IOleCache_OnStop */
|
|
|
|
|
2005-11-28 11:16:58 +01:00
|
|
|
DataAdviseHolder_OnDisconnect(This->dataAdviseHolder);
|
|
|
|
if (This->pDataDelegate)
|
|
|
|
{
|
|
|
|
IDataObject_Release(This->pDataDelegate);
|
|
|
|
This->pDataDelegate = NULL;
|
|
|
|
}
|
2005-10-26 12:12:49 +02:00
|
|
|
if (This->pPSDelegate)
|
|
|
|
{
|
|
|
|
IPersistStorage_Release(This->pPSDelegate);
|
|
|
|
This->pPSDelegate = NULL;
|
|
|
|
}
|
|
|
|
IOleObject_Release(This->pOleDelegate);
|
|
|
|
This->pOleDelegate = NULL;
|
|
|
|
}
|
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_Close (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method is meaningless
|
|
|
|
* without a running server so it does nothing.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_Close(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
DWORD dwSaveOption)
|
|
|
|
{
|
2005-10-26 12:12:49 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%ld)\n", dwSaveOption);
|
|
|
|
|
|
|
|
if (!This->pOleDelegate)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
hr = IOleObject_Close(This->pOleDelegate, dwSaveOption);
|
|
|
|
|
|
|
|
DefaultHandler_Stop(This);
|
|
|
|
|
|
|
|
return hr;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_SetMoniker (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method does nothing.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_SetMoniker(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
DWORD dwWhichMoniker,
|
|
|
|
IMoniker* pmk)
|
|
|
|
{
|
2005-11-28 10:39:19 +01:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %ld, %p)\n",
|
2002-06-01 01:06:46 +02:00
|
|
|
iface,
|
|
|
|
dwWhichMoniker,
|
1999-05-02 11:27:08 +02:00
|
|
|
pmk);
|
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_SetMoniker(This->pOleDelegate, dwWhichMoniker, pmk);
|
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetMoniker (IOleObject)
|
|
|
|
*
|
|
|
|
* Delegate this request to the client site if we have one.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetMoniker(
|
|
|
|
IOleObject* iface,
|
|
|
|
DWORD dwAssign,
|
|
|
|
DWORD dwWhichMoniker,
|
|
|
|
IMoniker** ppmk)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %ld, %ld, %p)\n",
|
1999-05-02 11:27:08 +02:00
|
|
|
iface, dwAssign, dwWhichMoniker, ppmk);
|
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_GetMoniker(This->pOleDelegate, dwAssign, dwWhichMoniker,
|
|
|
|
ppmk);
|
|
|
|
|
|
|
|
/* FIXME: dwWhichMoniker == OLEWHICHMK_CONTAINER only? */
|
2005-09-19 16:42:53 +02:00
|
|
|
if (This->clientSite)
|
1999-05-02 11:27:08 +02:00
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
return IOleClientSite_GetMoniker(This->clientSite,
|
1999-05-02 11:27:08 +02:00
|
|
|
dwAssign,
|
|
|
|
dwWhichMoniker,
|
|
|
|
ppmk);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
2004-04-13 00:02:37 +02:00
|
|
|
return E_FAIL;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_InitFromData (IOleObject)
|
|
|
|
*
|
|
|
|
* This method is meaningless if the server is not running
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-05-02 11:27:08 +02:00
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_InitFromData(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
IDataObject* pDataObject,
|
1999-05-02 11:27:08 +02:00
|
|
|
BOOL fCreation,
|
|
|
|
DWORD dwReserved)
|
|
|
|
{
|
2005-11-28 10:39:19 +01:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p, %d, %ld)\n",
|
1999-05-02 11:27:08 +02:00
|
|
|
iface, pDataObject, fCreation, dwReserved);
|
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_InitFromData(This->pOleDelegate, pDataObject, fCreation,
|
|
|
|
dwReserved);
|
1999-05-02 11:27:08 +02:00
|
|
|
return OLE_E_NOTRUNNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetClipboardData (IOleObject)
|
|
|
|
*
|
|
|
|
* This method is meaningless if the server is not running
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-05-02 11:27:08 +02:00
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetClipboardData(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
DWORD dwReserved,
|
1999-05-02 11:27:08 +02:00
|
|
|
IDataObject** ppDataObject)
|
|
|
|
{
|
2005-11-28 10:39:19 +01:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %ld, %p)\n",
|
1999-05-02 11:27:08 +02:00
|
|
|
iface, dwReserved, ppDataObject);
|
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_GetClipboardData(This->pOleDelegate, dwReserved,
|
|
|
|
ppDataObject);
|
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
return OLE_E_NOTRUNNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DefaultHandler_DoVerb(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
LONG iVerb,
|
|
|
|
struct tagMSG* lpmsg,
|
|
|
|
IOleClientSite* pActiveSite,
|
|
|
|
LONG lindex,
|
|
|
|
HWND hwndParent,
|
1999-05-02 11:27:08 +02:00
|
|
|
LPCRECT lprcPosRect)
|
|
|
|
{
|
2005-11-28 11:24:31 +01:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
|
|
|
IRunnableObject *pRunnableObj = (IRunnableObject *)&This->lpvtblIRunnableObject;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%ld, %p, %p, %ld, %p, %s)\n", iVerb, lpmsg, pActiveSite, lindex, hwndParent, wine_dbgstr_rect(lprcPosRect));
|
|
|
|
|
|
|
|
hr = IRunnableObject_Run(pRunnableObj, NULL);
|
|
|
|
if (FAILED(hr)) return hr;
|
|
|
|
|
|
|
|
return IOleObject_DoVerb(This->pOleDelegate, iVerb, lpmsg, pActiveSite,
|
|
|
|
lindex, hwndParent, lprcPosRect);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_EnumVerbs (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler implementation of this method simply delegates
|
|
|
|
* to OleRegEnumVerbs
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-05-02 11:27:08 +02:00
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_EnumVerbs(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
IEnumOLEVERB** ppEnumOleVerb)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
2005-09-28 20:29:38 +02:00
|
|
|
HRESULT hr = OLE_S_USEREG;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, ppEnumOleVerb);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-28 20:29:38 +02:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
hr = IOleObject_EnumVerbs(This->pOleDelegate, ppEnumOleVerb);
|
|
|
|
|
|
|
|
if (hr == OLE_S_USEREG)
|
|
|
|
return OleRegEnumVerbs(&This->clsid, ppEnumOleVerb);
|
|
|
|
else
|
|
|
|
return hr;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DefaultHandler_Update(
|
|
|
|
IOleObject* iface)
|
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
FIXME(": Stub\n");
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IsUpToDate (IOleObject)
|
|
|
|
*
|
|
|
|
* This method is meaningless if the server is not running
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-05-02 11:27:08 +02:00
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_IsUpToDate(
|
|
|
|
IOleObject* iface)
|
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p)\n", iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
return OLE_E_NOTRUNNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetUserClassID (IOleObject)
|
|
|
|
*
|
|
|
|
* TODO: Map to a new class ID if emulation is active.
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-05-02 11:27:08 +02:00
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetUserClassID(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
CLSID* pClsid)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, pClsid);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-29 12:29:44 +02:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_GetUserClassID(This->pOleDelegate, pClsid);
|
|
|
|
|
2005-09-28 20:29:38 +02:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_GetUserClassID(This->pOleDelegate, pClsid);
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Sanity check. */
|
|
|
|
if (!pClsid)
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_POINTER;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
memcpy(pClsid, &This->clsid, sizeof(CLSID));
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetUserType (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler implementation of this method simply delegates
|
|
|
|
* to OleRegGetUserType
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-05-02 11:27:08 +02:00
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetUserType(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
DWORD dwFormOfType,
|
1999-05-02 11:27:08 +02:00
|
|
|
LPOLESTR* pszUserType)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %ld, %p)\n", iface, dwFormOfType, pszUserType);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return OleRegGetUserType(&This->clsid, dwFormOfType, pszUserType);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_SetExtent (IOleObject)
|
|
|
|
*
|
|
|
|
* This method is meaningless if the server is not running
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_SetExtent(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
DWORD dwDrawAspect,
|
1999-05-02 11:27:08 +02:00
|
|
|
SIZEL* psizel)
|
|
|
|
{
|
2005-11-28 10:39:19 +01:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
|
|
|
|
2000-09-24 05:05:11 +02:00
|
|
|
TRACE("(%p, %lx, (%ld x %ld))\n", iface,
|
|
|
|
dwDrawAspect, psizel->cx, psizel->cy);
|
2005-11-28 10:39:19 +01:00
|
|
|
|
|
|
|
if (This->pOleDelegate)
|
|
|
|
IOleObject_SetExtent(This->pOleDelegate, dwDrawAspect, psizel);
|
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
return OLE_E_NOTRUNNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetExtent (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method returns uses
|
|
|
|
* the cache to locate the aspect and extract the extent from it.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetExtent(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
DWORD dwDrawAspect,
|
1999-05-02 11:27:08 +02:00
|
|
|
SIZEL* psizel)
|
|
|
|
{
|
|
|
|
DVTARGETDEVICE* targetDevice;
|
|
|
|
IViewObject2* cacheView = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_GetExtent(This->pOleDelegate, dwDrawAspect, psizel);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-11-28 10:39:19 +01:00
|
|
|
hres = IUnknown_QueryInterface(This->dataCache, &IID_IViewObject2, (void**)&cacheView);
|
1999-05-02 11:27:08 +02:00
|
|
|
if (FAILED(hres))
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Prepare the call to the cache's GetExtent method.
|
|
|
|
*
|
|
|
|
* Here we would build a valid DVTARGETDEVICE structure
|
2002-06-01 01:06:46 +02:00
|
|
|
* but, since we are calling into the data cache, we
|
|
|
|
* know it's implementation and we'll skip this
|
1999-05-02 11:27:08 +02:00
|
|
|
* extra work until later.
|
|
|
|
*/
|
|
|
|
targetDevice = NULL;
|
|
|
|
|
|
|
|
hres = IViewObject2_GetExtent(cacheView,
|
|
|
|
dwDrawAspect,
|
|
|
|
-1,
|
|
|
|
targetDevice,
|
|
|
|
psizel);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Cleanup
|
|
|
|
*/
|
|
|
|
IViewObject2_Release(cacheView);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_Advise (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method simply
|
|
|
|
* delegates to the OleAdviseHolder.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_Advise(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
IAdviseSink* pAdvSink,
|
1999-05-02 11:27:08 +02:00
|
|
|
DWORD* pdwConnection)
|
|
|
|
{
|
|
|
|
HRESULT hres = S_OK;
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Make sure we have an advise holder before we start. */
|
|
|
|
if (!This->oleAdviseHolder)
|
|
|
|
hres = CreateOleAdviseHolder(&This->oleAdviseHolder);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
if (SUCCEEDED(hres))
|
2005-09-19 16:42:53 +02:00
|
|
|
hres = IOleAdviseHolder_Advise(This->oleAdviseHolder,
|
2002-06-01 01:06:46 +02:00
|
|
|
pAdvSink,
|
1999-05-02 11:27:08 +02:00
|
|
|
pdwConnection);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_Unadvise (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method simply
|
|
|
|
* delegates to the OleAdviseHolder.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_Unadvise(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
DWORD dwConnection)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %ld)\n", iface, dwConnection);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we don't have an advise holder yet, it means we don't have
|
|
|
|
* a connection.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
if (!This->oleAdviseHolder)
|
1999-05-02 11:27:08 +02:00
|
|
|
return OLE_E_NOCONNECTION;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IOleAdviseHolder_Unadvise(This->oleAdviseHolder,
|
1999-05-02 11:27:08 +02:00
|
|
|
dwConnection);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_EnumAdvise (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method simply
|
|
|
|
* delegates to the OleAdviseHolder.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_EnumAdvise(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
IEnumSTATDATA** ppenumAdvise)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, ppenumAdvise);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Sanity check */
|
|
|
|
if (!ppenumAdvise)
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*ppenumAdvise = NULL;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
if (!This->oleAdviseHolder)
|
|
|
|
return IOleAdviseHolder_EnumAdvise(This->oleAdviseHolder,
|
1999-05-02 11:27:08 +02:00
|
|
|
ppenumAdvise);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetMiscStatus (IOleObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method simply delegates
|
|
|
|
* to OleRegGetMiscStatus.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetMiscStatus(
|
2002-06-01 01:06:46 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
DWORD dwAspect,
|
1999-05-02 11:27:08 +02:00
|
|
|
DWORD* pdwStatus)
|
|
|
|
{
|
|
|
|
HRESULT hres;
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %lx, %p)\n", iface, dwAspect, pdwStatus);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-29 12:29:44 +02:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_GetMiscStatus(This->pOleDelegate, dwAspect, pdwStatus);
|
|
|
|
|
2005-09-28 20:29:38 +02:00
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_GetMiscStatus(This->pOleDelegate, dwAspect, pdwStatus);
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
hres = OleRegGetMiscStatus(&This->clsid, dwAspect, pdwStatus);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
if (FAILED(hres))
|
|
|
|
*pdwStatus = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-11-28 10:39:19 +01:00
|
|
|
* DefaultHandler_SetColorScheme (IOleObject)
|
1999-05-02 11:27:08 +02:00
|
|
|
*
|
|
|
|
* This method is meaningless if the server is not running
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IOleObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_SetColorScheme(
|
1999-08-18 20:35:57 +02:00
|
|
|
IOleObject* iface,
|
|
|
|
struct tagLOGPALETTE* pLogpal)
|
1999-05-02 11:27:08 +02:00
|
|
|
{
|
2005-11-28 10:39:19 +01:00
|
|
|
DefaultHandler *This = impl_from_IOleObject(iface);
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p))\n", iface, pLogpal);
|
2005-11-28 10:39:19 +01:00
|
|
|
|
|
|
|
if (This->pOleDelegate)
|
|
|
|
return IOleObject_SetColorScheme(This->pOleDelegate, pLogpal);
|
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
return OLE_E_NOTRUNNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Methods implementation for the IDataObject part of
|
|
|
|
* the DefaultHandler class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IDataObject_QueryInterface (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface(
|
2002-06-01 01:06:46 +02:00
|
|
|
IDataObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IDataObject_AddRef (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_IDataObject_AddRef(
|
1999-05-02 11:27:08 +02:00
|
|
|
IDataObject* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_AddRef(This->outerUnknown);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IDataObject_Release (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_IDataObject_Release(
|
1999-05-02 11:27:08 +02:00
|
|
|
IDataObject* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_Release(This->outerUnknown);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
2000-05-24 01:34:40 +02:00
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetData
|
|
|
|
*
|
|
|
|
* Get Data from a source dataobject using format pformatetcIn->cfFormat
|
|
|
|
* See Windows documentation for more details on GetData.
|
|
|
|
* Default handler's implementation of this method delegates to the cache.
|
|
|
|
*/
|
1999-05-02 11:27:08 +02:00
|
|
|
static HRESULT WINAPI DefaultHandler_GetData(
|
|
|
|
IDataObject* iface,
|
2002-06-01 01:06:46 +02:00
|
|
|
LPFORMATETC pformatetcIn,
|
1999-05-02 11:27:08 +02:00
|
|
|
STGMEDIUM* pmedium)
|
|
|
|
{
|
2000-05-24 01:34:40 +02:00
|
|
|
IDataObject* cacheDataObject = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
2000-05-24 01:34:40 +02:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", iface, pformatetcIn, pmedium);
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->dataCache,
|
2000-05-24 01:34:40 +02:00
|
|
|
&IID_IDataObject,
|
2004-05-21 22:52:57 +02:00
|
|
|
(void**)&cacheDataObject);
|
2000-05-24 01:34:40 +02:00
|
|
|
|
|
|
|
if (FAILED(hres))
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
|
|
|
|
hres = IDataObject_GetData(cacheDataObject,
|
|
|
|
pformatetcIn,
|
|
|
|
pmedium);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-24 01:34:40 +02:00
|
|
|
IDataObject_Release(cacheDataObject);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-24 01:34:40 +02:00
|
|
|
return hres;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetDataHere(
|
2002-06-01 01:06:46 +02:00
|
|
|
IDataObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
LPFORMATETC pformatetc,
|
|
|
|
STGMEDIUM* pmedium)
|
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
FIXME(": Stub\n");
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_QueryGetData (IDataObject)
|
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* The default handler's implementation of this method delegates to
|
1999-05-02 11:27:08 +02:00
|
|
|
* the cache.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IDataObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_QueryGetData(
|
|
|
|
IDataObject* iface,
|
|
|
|
LPFORMATETC pformatetc)
|
|
|
|
{
|
|
|
|
IDataObject* cacheDataObject = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, pformatetc);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->dataCache,
|
1999-05-02 11:27:08 +02:00
|
|
|
&IID_IDataObject,
|
2004-05-21 22:52:57 +02:00
|
|
|
(void**)&cacheDataObject);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
if (FAILED(hres))
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
|
|
|
|
hres = IDataObject_QueryGetData(cacheDataObject,
|
|
|
|
pformatetc);
|
|
|
|
|
|
|
|
IDataObject_Release(cacheDataObject);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetCanonicalFormatEtc (IDataObject)
|
|
|
|
*
|
|
|
|
* This method is meaningless if the server is not running
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IDataObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(
|
2002-06-01 01:06:46 +02:00
|
|
|
IDataObject* iface,
|
2005-09-28 20:29:38 +02:00
|
|
|
LPFORMATETC pformatetcIn,
|
1999-05-02 11:27:08 +02:00
|
|
|
LPFORMATETC pformatetcOut)
|
|
|
|
{
|
2005-09-28 20:29:38 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
|
|
|
IDataObject *pDataObject;
|
|
|
|
HRESULT hr;
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-28 20:29:38 +02:00
|
|
|
TRACE("(%p, %p, %p)\n", iface, pformatetcIn, pformatetcOut);
|
|
|
|
|
|
|
|
if (!This->pOleDelegate)
|
|
|
|
return OLE_E_NOTRUNNING;
|
|
|
|
|
|
|
|
hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IDataObject, (void **)&pDataObject);
|
|
|
|
return IDataObject_GetCanonicalFormatEtc(pDataObject, pformatetcIn, pformatetcOut);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_SetData (IDataObject)
|
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* The default handler's implementation of this method delegates to
|
1999-05-02 11:27:08 +02:00
|
|
|
* the cache.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IDataObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_SetData(
|
|
|
|
IDataObject* iface,
|
2002-06-01 01:06:46 +02:00
|
|
|
LPFORMATETC pformatetc,
|
|
|
|
STGMEDIUM* pmedium,
|
1999-05-02 11:27:08 +02:00
|
|
|
BOOL fRelease)
|
|
|
|
{
|
2005-09-28 20:29:38 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
IDataObject* cacheDataObject = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->dataCache,
|
1999-05-02 11:27:08 +02:00
|
|
|
&IID_IDataObject,
|
2004-05-21 22:52:57 +02:00
|
|
|
(void**)&cacheDataObject);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
if (FAILED(hres))
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
|
|
|
|
hres = IDataObject_SetData(cacheDataObject,
|
|
|
|
pformatetc,
|
|
|
|
pmedium,
|
|
|
|
fRelease);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
IDataObject_Release(cacheDataObject);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-02 11:27:08 +02:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_EnumFormatEtc (IDataObject)
|
|
|
|
*
|
2005-09-19 16:42:53 +02:00
|
|
|
* The default handler's implementation of This method simply delegates
|
1999-05-02 11:27:08 +02:00
|
|
|
* to OleRegEnumFormatEtc.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IDataObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
|
2002-06-01 01:06:46 +02:00
|
|
|
IDataObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
DWORD dwDirection,
|
|
|
|
IEnumFORMATETC** ppenumFormatEtc)
|
|
|
|
{
|
|
|
|
HRESULT hres;
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %lx, %p)\n", iface, dwDirection, ppenumFormatEtc);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
hres = OleRegEnumFormatEtc(&This->clsid, dwDirection, ppenumFormatEtc);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_DAdvise (IDataObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method simply
|
|
|
|
* delegates to the DataAdviseHolder.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IDataObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_DAdvise(
|
2002-06-01 01:06:46 +02:00
|
|
|
IDataObject* iface,
|
|
|
|
FORMATETC* pformatetc,
|
|
|
|
DWORD advf,
|
|
|
|
IAdviseSink* pAdvSink,
|
1999-05-02 11:27:08 +02:00
|
|
|
DWORD* pdwConnection)
|
|
|
|
{
|
|
|
|
HRESULT hres = S_OK;
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
TRACE("(%p, %p, %ld, %p, %p)\n",
|
1999-05-02 11:27:08 +02:00
|
|
|
iface, pformatetc, advf, pAdvSink, pdwConnection);
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Make sure we have a data advise holder before we start. */
|
|
|
|
if (!This->dataAdviseHolder)
|
|
|
|
hres = CreateDataAdviseHolder(&This->dataAdviseHolder);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
if (SUCCEEDED(hres))
|
2005-09-19 16:42:53 +02:00
|
|
|
hres = IDataAdviseHolder_Advise(This->dataAdviseHolder,
|
1999-05-02 11:27:08 +02:00
|
|
|
iface,
|
2002-06-01 01:06:46 +02:00
|
|
|
pformatetc,
|
|
|
|
advf,
|
|
|
|
pAdvSink,
|
1999-05-02 11:27:08 +02:00
|
|
|
pdwConnection);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_DUnadvise (IDataObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method simply
|
|
|
|
* delegates to the DataAdviseHolder.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IDataObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_DUnadvise(
|
|
|
|
IDataObject* iface,
|
|
|
|
DWORD dwConnection)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %ld)\n", iface, dwConnection);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we don't have a data advise holder yet, it means that
|
|
|
|
* we don't have any connections..
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
if (!This->dataAdviseHolder)
|
1999-05-02 11:27:08 +02:00
|
|
|
return OLE_E_NOCONNECTION;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IDataAdviseHolder_Unadvise(This->dataAdviseHolder,
|
1999-05-02 11:27:08 +02:00
|
|
|
dwConnection);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_EnumDAdvise (IDataObject)
|
|
|
|
*
|
|
|
|
* The default handler's implementation of this method simply
|
|
|
|
* delegates to the DataAdviseHolder.
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IDataObject methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_EnumDAdvise(
|
|
|
|
IDataObject* iface,
|
|
|
|
IEnumSTATDATA** ppenumAdvise)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IDataObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, ppenumAdvise);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Sanity check */
|
|
|
|
if (!ppenumAdvise)
|
1999-05-02 11:27:08 +02:00
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*ppenumAdvise = NULL;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* If we have a data advise holder object, delegate. */
|
|
|
|
if (This->dataAdviseHolder)
|
|
|
|
return IDataAdviseHolder_EnumAdvise(This->dataAdviseHolder,
|
1999-05-02 11:27:08 +02:00
|
|
|
ppenumAdvise);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* Methods implementation for the IRunnableObject part
|
1999-05-02 11:27:08 +02:00
|
|
|
* of the DefaultHandler class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface(
|
|
|
|
IRunnableObject* iface,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IRunnableObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(
|
1999-05-02 11:27:08 +02:00
|
|
|
IRunnableObject* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IRunnableObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_AddRef(This->outerUnknown);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
|
1999-05-02 11:27:08 +02:00
|
|
|
IRunnableObject* iface)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler *This = impl_from_IRunnableObject(iface);
|
1999-05-02 11:27:08 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return IUnknown_Release(This->outerUnknown);
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_GetRunningClass (IRunnableObject)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IRunnableObject methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static HRESULT WINAPI DefaultHandler_GetRunningClass(
|
|
|
|
IRunnableObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
LPCLSID lpClsid)
|
|
|
|
{
|
2005-09-23 12:08:35 +02:00
|
|
|
FIXME("()\n");
|
1999-05-02 11:27:08 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
static HRESULT WINAPI DefaultHandler_Run(
|
1999-05-02 11:27:08 +02:00
|
|
|
IRunnableObject* iface,
|
|
|
|
IBindCtx* pbc)
|
|
|
|
{
|
2005-09-23 12:08:35 +02:00
|
|
|
DefaultHandler *This = impl_from_IRunnableObject(iface);
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
FIXME("(%p): semi-stub\n", pbc);
|
|
|
|
|
|
|
|
/* already running? if so nothing to do */
|
|
|
|
if (This->pOleDelegate)
|
|
|
|
return S_OK;
|
|
|
|
|
2005-11-28 10:58:51 +01:00
|
|
|
hr = CoCreateInstance(&This->clsid, NULL, CLSCTX_LOCAL_SERVER,
|
|
|
|
&IID_IOleObject, (void **)&This->pOleDelegate);
|
2005-09-23 12:08:35 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2005-11-28 10:58:51 +01:00
|
|
|
hr = IOleObject_Advise(This->pOleDelegate,
|
|
|
|
(IAdviseSink *)&This->lpvtblIAdviseSink,
|
|
|
|
&This->dwAdvConn);
|
2005-09-29 12:29:44 +02:00
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && This->clientSite)
|
2005-09-23 12:08:35 +02:00
|
|
|
hr = IOleObject_SetClientSite(This->pOleDelegate, This->clientSite);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2005-11-28 10:58:51 +01:00
|
|
|
IOleObject_QueryInterface(This->pOleDelegate, &IID_IPersistStorage,
|
|
|
|
(void **)&This->pPSDelegate);
|
2005-09-23 12:08:35 +02:00
|
|
|
if (This->pPSDelegate)
|
|
|
|
hr = IPersistStorage_InitNew(This->pPSDelegate, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && This->containerApp)
|
2005-11-28 10:58:51 +01:00
|
|
|
hr = IOleObject_SetHostNames(This->pOleDelegate, This->containerApp,
|
|
|
|
This->containerObj);
|
2005-09-23 12:08:35 +02:00
|
|
|
|
|
|
|
/* FIXME: do more stuff here:
|
|
|
|
* - IOleObject_GetMiscStatus
|
|
|
|
* - IOleObject_GetMoniker
|
2005-10-26 12:12:49 +02:00
|
|
|
* - IOleCache_OnRun
|
2005-09-23 12:08:35 +02:00
|
|
|
*/
|
|
|
|
|
2005-11-28 11:16:58 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IDataObject,
|
|
|
|
(void **)&This->pDataDelegate);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && This->dataAdviseHolder)
|
|
|
|
hr = DataAdviseHolder_OnConnect(This->dataAdviseHolder, This->pDataDelegate);
|
|
|
|
|
2005-11-28 10:58:51 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
DefaultHandler_Stop(This);
|
2005-09-23 12:08:35 +02:00
|
|
|
|
|
|
|
return hr;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_IsRunning (IRunnableObject)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IRunnableObject methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static BOOL WINAPI DefaultHandler_IsRunning(
|
1999-05-02 11:27:08 +02:00
|
|
|
IRunnableObject* iface)
|
|
|
|
{
|
2005-09-23 12:08:35 +02:00
|
|
|
DefaultHandler *This = impl_from_IRunnableObject(iface);
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("()\n");
|
2005-09-23 12:08:35 +02:00
|
|
|
|
|
|
|
if (This->pOleDelegate)
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
1999-05-02 11:27:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_LockRunning (IRunnableObject)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IRunnableObject methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static HRESULT WINAPI DefaultHandler_LockRunning(
|
|
|
|
IRunnableObject* iface,
|
|
|
|
BOOL fLock,
|
1999-05-02 11:27:08 +02:00
|
|
|
BOOL fLastUnlockCloses)
|
|
|
|
{
|
2005-09-23 12:08:35 +02:00
|
|
|
FIXME("()\n");
|
1999-05-02 11:27:08 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DefaultHandler_SetContainedObject (IRunnableObject)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IRunnableObject methods.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static HRESULT WINAPI DefaultHandler_SetContainedObject(
|
|
|
|
IRunnableObject* iface,
|
1999-05-02 11:27:08 +02:00
|
|
|
BOOL fContained)
|
|
|
|
{
|
2005-09-23 12:08:35 +02:00
|
|
|
FIXME("()\n");
|
1999-05-02 11:27:08 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
2005-09-17 16:29:11 +02:00
|
|
|
|
2005-09-29 12:29:44 +02:00
|
|
|
static HRESULT WINAPI DefaultHandler_IAdviseSink_QueryInterface(
|
|
|
|
IAdviseSink *iface,
|
|
|
|
REFIID riid,
|
|
|
|
void **ppvObject)
|
|
|
|
{
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IAdviseSink))
|
|
|
|
{
|
|
|
|
*ppvObject = iface;
|
|
|
|
IAdviseSink_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DefaultHandler_IAdviseSink_AddRef(
|
|
|
|
IAdviseSink *iface)
|
|
|
|
{
|
|
|
|
DefaultHandler *This = impl_from_IAdviseSink(iface);
|
|
|
|
|
|
|
|
return IUnknown_AddRef((IUnknown *)&This->lpvtblIUnknown);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DefaultHandler_IAdviseSink_Release(
|
|
|
|
IAdviseSink *iface)
|
|
|
|
{
|
|
|
|
DefaultHandler *This = impl_from_IAdviseSink(iface);
|
|
|
|
|
|
|
|
return IUnknown_Release((IUnknown *)&This->lpvtblIUnknown);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WINAPI DefaultHandler_IAdviseSink_OnDataChange(
|
|
|
|
IAdviseSink *iface,
|
|
|
|
FORMATETC *pFormatetc,
|
|
|
|
STGMEDIUM *pStgmed)
|
|
|
|
{
|
|
|
|
FIXME(": stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WINAPI DefaultHandler_IAdviseSink_OnViewChange(
|
|
|
|
IAdviseSink *iface,
|
|
|
|
DWORD dwAspect,
|
|
|
|
LONG lindex)
|
|
|
|
{
|
|
|
|
FIXME(": stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WINAPI DefaultHandler_IAdviseSink_OnRename(
|
|
|
|
IAdviseSink *iface,
|
|
|
|
IMoniker *pmk)
|
|
|
|
{
|
2005-11-03 20:32:49 +01:00
|
|
|
DefaultHandler *This = impl_from_IAdviseSink(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pmk);
|
|
|
|
|
|
|
|
if (This->oleAdviseHolder)
|
|
|
|
IOleAdviseHolder_SendOnRename(This->oleAdviseHolder, pmk);
|
2005-09-29 12:29:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void WINAPI DefaultHandler_IAdviseSink_OnSave(
|
|
|
|
IAdviseSink *iface)
|
|
|
|
{
|
2005-11-03 20:32:49 +01:00
|
|
|
DefaultHandler *This = impl_from_IAdviseSink(iface);
|
|
|
|
|
|
|
|
TRACE("()\n");
|
|
|
|
|
|
|
|
if (This->oleAdviseHolder)
|
|
|
|
IOleAdviseHolder_SendOnSave(This->oleAdviseHolder);
|
2005-09-29 12:29:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void WINAPI DefaultHandler_IAdviseSink_OnClose(
|
|
|
|
IAdviseSink *iface)
|
|
|
|
{
|
2005-10-26 12:12:49 +02:00
|
|
|
DefaultHandler *This = impl_from_IAdviseSink(iface);
|
|
|
|
|
|
|
|
TRACE("()\n");
|
|
|
|
|
2005-11-03 20:32:49 +01:00
|
|
|
if (This->oleAdviseHolder)
|
|
|
|
IOleAdviseHolder_SendOnClose(This->oleAdviseHolder);
|
2005-10-26 12:12:49 +02:00
|
|
|
|
|
|
|
DefaultHandler_Stop(This);
|
2005-09-29 12:29:44 +02:00
|
|
|
}
|
|
|
|
|
2005-09-17 16:29:11 +02:00
|
|
|
/*
|
|
|
|
* Virtual function tables for the DefaultHandler class.
|
|
|
|
*/
|
|
|
|
static const IOleObjectVtbl DefaultHandler_IOleObject_VTable =
|
|
|
|
{
|
|
|
|
DefaultHandler_QueryInterface,
|
|
|
|
DefaultHandler_AddRef,
|
|
|
|
DefaultHandler_Release,
|
|
|
|
DefaultHandler_SetClientSite,
|
|
|
|
DefaultHandler_GetClientSite,
|
|
|
|
DefaultHandler_SetHostNames,
|
|
|
|
DefaultHandler_Close,
|
|
|
|
DefaultHandler_SetMoniker,
|
|
|
|
DefaultHandler_GetMoniker,
|
|
|
|
DefaultHandler_InitFromData,
|
|
|
|
DefaultHandler_GetClipboardData,
|
|
|
|
DefaultHandler_DoVerb,
|
|
|
|
DefaultHandler_EnumVerbs,
|
|
|
|
DefaultHandler_Update,
|
|
|
|
DefaultHandler_IsUpToDate,
|
|
|
|
DefaultHandler_GetUserClassID,
|
|
|
|
DefaultHandler_GetUserType,
|
|
|
|
DefaultHandler_SetExtent,
|
|
|
|
DefaultHandler_GetExtent,
|
|
|
|
DefaultHandler_Advise,
|
|
|
|
DefaultHandler_Unadvise,
|
|
|
|
DefaultHandler_EnumAdvise,
|
|
|
|
DefaultHandler_GetMiscStatus,
|
|
|
|
DefaultHandler_SetColorScheme
|
|
|
|
};
|
|
|
|
|
|
|
|
static const IUnknownVtbl DefaultHandler_NDIUnknown_VTable =
|
|
|
|
{
|
|
|
|
DefaultHandler_NDIUnknown_QueryInterface,
|
|
|
|
DefaultHandler_NDIUnknown_AddRef,
|
|
|
|
DefaultHandler_NDIUnknown_Release,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const IDataObjectVtbl DefaultHandler_IDataObject_VTable =
|
|
|
|
{
|
|
|
|
DefaultHandler_IDataObject_QueryInterface,
|
|
|
|
DefaultHandler_IDataObject_AddRef,
|
|
|
|
DefaultHandler_IDataObject_Release,
|
|
|
|
DefaultHandler_GetData,
|
|
|
|
DefaultHandler_GetDataHere,
|
|
|
|
DefaultHandler_QueryGetData,
|
|
|
|
DefaultHandler_GetCanonicalFormatEtc,
|
|
|
|
DefaultHandler_SetData,
|
|
|
|
DefaultHandler_EnumFormatEtc,
|
|
|
|
DefaultHandler_DAdvise,
|
|
|
|
DefaultHandler_DUnadvise,
|
|
|
|
DefaultHandler_EnumDAdvise
|
|
|
|
};
|
|
|
|
|
|
|
|
static const IRunnableObjectVtbl DefaultHandler_IRunnableObject_VTable =
|
|
|
|
{
|
|
|
|
DefaultHandler_IRunnableObject_QueryInterface,
|
|
|
|
DefaultHandler_IRunnableObject_AddRef,
|
|
|
|
DefaultHandler_IRunnableObject_Release,
|
|
|
|
DefaultHandler_GetRunningClass,
|
|
|
|
DefaultHandler_Run,
|
|
|
|
DefaultHandler_IsRunning,
|
|
|
|
DefaultHandler_LockRunning,
|
|
|
|
DefaultHandler_SetContainedObject
|
|
|
|
};
|
|
|
|
|
2005-09-29 12:29:44 +02:00
|
|
|
static const IAdviseSinkVtbl DefaultHandler_IAdviseSink_VTable =
|
|
|
|
{
|
|
|
|
DefaultHandler_IAdviseSink_QueryInterface,
|
|
|
|
DefaultHandler_IAdviseSink_AddRef,
|
|
|
|
DefaultHandler_IAdviseSink_Release,
|
|
|
|
DefaultHandler_IAdviseSink_OnDataChange,
|
|
|
|
DefaultHandler_IAdviseSink_OnViewChange,
|
|
|
|
DefaultHandler_IAdviseSink_OnRename,
|
|
|
|
DefaultHandler_IAdviseSink_OnSave,
|
|
|
|
DefaultHandler_IAdviseSink_OnClose
|
|
|
|
};
|
|
|
|
|
2005-09-17 16:29:11 +02:00
|
|
|
/*********************************************************
|
|
|
|
* Methods implementation for the DefaultHandler class.
|
|
|
|
*/
|
|
|
|
static DefaultHandler* DefaultHandler_Construct(
|
|
|
|
REFCLSID clsid,
|
|
|
|
LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler* This = NULL;
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate space for the object.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
This = HeapAlloc(GetProcessHeap(), 0, sizeof(DefaultHandler));
|
2005-09-17 16:29:11 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
if (!This)
|
|
|
|
return This;
|
2005-09-17 16:29:11 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
This->lpVtbl = &DefaultHandler_IOleObject_VTable;
|
|
|
|
This->lpvtblIUnknown = &DefaultHandler_NDIUnknown_VTable;
|
|
|
|
This->lpvtblIDataObject = &DefaultHandler_IDataObject_VTable;
|
|
|
|
This->lpvtblIRunnableObject = &DefaultHandler_IRunnableObject_VTable;
|
2005-09-29 12:29:44 +02:00
|
|
|
This->lpvtblIAdviseSink = &DefaultHandler_IAdviseSink_VTable;
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Start with one reference count. The caller of this function
|
|
|
|
* must release the interface pointer when it is done.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
This->ref = 1;
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the outer unknown
|
|
|
|
* We don't keep a reference on the outer unknown since, the way
|
|
|
|
* aggregation works, our lifetime is at least as large as it's
|
|
|
|
* lifetime.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
if (!pUnkOuter)
|
|
|
|
pUnkOuter = (IUnknown*)&This->lpvtblIUnknown;
|
2005-09-17 16:29:11 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
This->outerUnknown = pUnkOuter;
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a datacache object.
|
|
|
|
* We aggregate with the datacache. Make sure we pass our outer
|
|
|
|
* unknown as the datacache's outer unknown.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
CreateDataCache(This->outerUnknown,
|
2005-09-17 16:29:11 +02:00
|
|
|
clsid,
|
|
|
|
&IID_IUnknown,
|
2005-09-19 16:42:53 +02:00
|
|
|
(void**)&This->dataCache);
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the other data members of the class.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
memcpy(&This->clsid, clsid, sizeof(CLSID));
|
|
|
|
This->clientSite = NULL;
|
|
|
|
This->oleAdviseHolder = NULL;
|
|
|
|
This->dataAdviseHolder = NULL;
|
|
|
|
This->containerApp = NULL;
|
|
|
|
This->containerObj = NULL;
|
2005-09-23 12:08:35 +02:00
|
|
|
This->pOleDelegate = NULL;
|
|
|
|
This->pPSDelegate = NULL;
|
2005-11-28 11:16:58 +01:00
|
|
|
This->pDataDelegate = NULL;
|
2005-09-19 16:42:53 +02:00
|
|
|
|
2005-09-29 12:29:44 +02:00
|
|
|
This->dwAdvConn = 0;
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
return This;
|
2005-09-17 16:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void DefaultHandler_Destroy(
|
2005-09-19 16:42:53 +02:00
|
|
|
DefaultHandler* This)
|
2005-09-17 16:29:11 +02:00
|
|
|
{
|
2005-10-26 12:12:49 +02:00
|
|
|
/* release delegates */
|
|
|
|
DefaultHandler_Stop(This);
|
2005-09-23 12:08:35 +02:00
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Free the strings idenfitying the object */
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->containerApp );
|
|
|
|
This->containerApp = NULL;
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->containerObj );
|
|
|
|
This->containerObj = NULL;
|
|
|
|
|
|
|
|
/* Release our reference to the data cache. */
|
|
|
|
if (This->dataCache)
|
2005-09-17 16:29:11 +02:00
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
IUnknown_Release(This->dataCache);
|
|
|
|
This->dataCache = NULL;
|
2005-09-17 16:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Same thing for the client site. */
|
|
|
|
if (This->clientSite)
|
2005-09-17 16:29:11 +02:00
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
IOleClientSite_Release(This->clientSite);
|
|
|
|
This->clientSite = NULL;
|
2005-09-17 16:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* And the advise holder. */
|
|
|
|
if (This->oleAdviseHolder)
|
2005-09-17 16:29:11 +02:00
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
IOleAdviseHolder_Release(This->oleAdviseHolder);
|
|
|
|
This->oleAdviseHolder = NULL;
|
2005-09-17 16:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* And the data advise holder. */
|
|
|
|
if (This->dataAdviseHolder)
|
2005-09-17 16:29:11 +02:00
|
|
|
{
|
2005-09-19 16:42:53 +02:00
|
|
|
IDataAdviseHolder_Release(This->dataAdviseHolder);
|
|
|
|
This->dataAdviseHolder = NULL;
|
2005-09-17 16:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-09-19 16:42:53 +02:00
|
|
|
/* Free the actual default handler structure. */
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2005-09-17 16:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* OleCreateDefaultHandler [OLE32.@]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI OleCreateDefaultHandler(
|
|
|
|
REFCLSID clsid,
|
|
|
|
LPUNKNOWN pUnkOuter,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID* ppvObj)
|
|
|
|
{
|
|
|
|
DefaultHandler* newHandler = NULL;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
|
|
|
TRACE("(%s, %p, %s, %p)\n", debugstr_guid(clsid), pUnkOuter, debugstr_guid(riid), ppvObj);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sanity check
|
|
|
|
*/
|
|
|
|
if (!ppvObj)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*ppvObj = NULL;
|
|
|
|
|
|
|
|
/*
|
2005-09-19 16:42:53 +02:00
|
|
|
* If This handler is constructed for aggregation, make sure
|
2005-09-17 16:29:11 +02:00
|
|
|
* the caller is requesting the IUnknown interface.
|
|
|
|
* This is necessary because it's the only time the non-delegating
|
|
|
|
* IUnknown pointer can be returned to the outside.
|
|
|
|
*/
|
2005-09-28 20:12:45 +02:00
|
|
|
if (pUnkOuter && !IsEqualIID(&IID_IUnknown, riid))
|
2005-09-17 16:29:11 +02:00
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Try to construct a new instance of the class.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
newHandler = DefaultHandler_Construct(clsid, pUnkOuter);
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
if (!newHandler)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure it supports the interface required by the caller.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
hr = IUnknown_QueryInterface((IUnknown*)&newHandler->lpvtblIUnknown, riid, ppvObj);
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Release the reference obtained in the constructor. If
|
|
|
|
* the QueryInterface was unsuccessful, it will free the class.
|
|
|
|
*/
|
2005-09-19 16:42:53 +02:00
|
|
|
IUnknown_Release((IUnknown*)&newHandler->lpvtblIUnknown);
|
2005-09-17 16:29:11 +02:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|