2006-05-18 14:49:52 +02:00
|
|
|
/*
|
1999-03-23 14:48:56 +01:00
|
|
|
* AntiMonikers implementation
|
|
|
|
*
|
|
|
|
* Copyright 1999 Noomen Hamza
|
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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
#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>
|
2003-01-07 21:36:20 +01:00
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
2003-01-07 21:36:20 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2004-10-07 05:06:48 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-08-18 20:35:57 +02:00
|
|
|
#include "winbase.h"
|
1999-03-23 14:48:56 +01:00
|
|
|
#include "winerror.h"
|
2002-12-05 21:33:07 +01:00
|
|
|
#include "objbase.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2002-12-19 02:09:40 +01:00
|
|
|
#include "moniker.h"
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
/* AntiMoniker data structure */
|
|
|
|
typedef struct AntiMonikerImpl{
|
2011-08-23 10:14:42 +02:00
|
|
|
IMoniker IMoniker_iface;
|
|
|
|
IROTData IROTData_iface;
|
|
|
|
LONG ref;
|
2006-05-08 13:36:13 +02:00
|
|
|
IUnknown *pMarshal; /* custom marshaler */
|
1999-03-23 14:48:56 +01:00
|
|
|
} AntiMonikerImpl;
|
|
|
|
|
2011-08-23 10:14:42 +02:00
|
|
|
static inline AntiMonikerImpl *impl_from_IMoniker(IMoniker *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, AntiMonikerImpl, IMoniker_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline AntiMonikerImpl *impl_from_IROTData(IROTData *iface)
|
2005-07-27 13:10:52 +02:00
|
|
|
{
|
2011-08-23 10:14:42 +02:00
|
|
|
return CONTAINING_RECORD(iface, AntiMonikerImpl, IROTData_iface);
|
2005-07-27 13:10:52 +02:00
|
|
|
}
|
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* AntiMoniker_QueryInterface
|
|
|
|
*******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2011-08-23 10:14:42 +02:00
|
|
|
AntiMonikerImpl *This = impl_from_IMoniker(iface);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
/* Perform a sanity check on the parameters.*/
|
2010-07-21 12:15:10 +02:00
|
|
|
if ( ppvObject==0 )
|
1999-03-23 14:48:56 +01:00
|
|
|
return E_INVALIDARG;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
/* Initialize the return parameter */
|
|
|
|
*ppvObject = 0;
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
/* Compare the riid with the interface IDs implemented by this object.*/
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IPersist, riid) ||
|
|
|
|
IsEqualIID(&IID_IPersistStream, riid) ||
|
|
|
|
IsEqualIID(&IID_IMoniker, riid))
|
|
|
|
*ppvObject = iface;
|
1999-03-23 14:48:56 +01:00
|
|
|
else if (IsEqualIID(&IID_IROTData, riid))
|
2011-08-23 10:14:42 +02:00
|
|
|
*ppvObject = &This->IROTData_iface;
|
2006-05-08 13:36:13 +02:00
|
|
|
else if (IsEqualIID(&IID_IMarshal, riid))
|
|
|
|
{
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
if (!This->pMarshal)
|
|
|
|
hr = MonikerMarshal_Create(iface, &This->pMarshal);
|
|
|
|
if (hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
return IUnknown_QueryInterface(This->pMarshal, riid, ppvObject);
|
|
|
|
}
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
/* Check that we obtained an interface.*/
|
1999-03-23 14:48:56 +01:00
|
|
|
if ((*ppvObject)==0)
|
|
|
|
return E_NOINTERFACE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
/* always increase the reference count by one when it is successful */
|
|
|
|
IMoniker_AddRef(iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
return S_OK;
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_AddRef
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static ULONG WINAPI
|
|
|
|
AntiMonikerImpl_AddRef(IMoniker* iface)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2011-08-23 10:14:42 +02:00
|
|
|
AntiMonikerImpl *This = impl_from_IMoniker(iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p)\n",This);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2004-09-24 03:16:53 +02:00
|
|
|
return InterlockedIncrement(&This->ref);
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Release
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static ULONG WINAPI
|
|
|
|
AntiMonikerImpl_Release(IMoniker* iface)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2011-08-23 10:14:42 +02:00
|
|
|
AntiMonikerImpl *This = impl_from_IMoniker(iface);
|
2004-09-24 03:16:53 +02:00
|
|
|
ULONG ref;
|
1999-03-23 14:48:56 +01:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p)\n",This);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2004-09-24 03:16:53 +02:00
|
|
|
ref = InterlockedDecrement(&This->ref);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
/* destroy the object if there's no more reference on it */
|
2006-05-08 13:36:13 +02:00
|
|
|
if (ref == 0)
|
|
|
|
{
|
|
|
|
if (This->pMarshal) IUnknown_Release(This->pMarshal);
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
}
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2004-09-24 03:16:53 +02:00
|
|
|
return ref;
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_GetClassID
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2006-01-06 21:08:09 +01:00
|
|
|
TRACE("(%p,%p)\n",iface,pClassID);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (pClassID==NULL)
|
|
|
|
return E_POINTER;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
*pClassID = CLSID_AntiMoniker;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_IsDirty
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_IsDirty(IMoniker* iface)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
|
|
|
/* Note that the OLE-provided implementations of the IPersistStream::IsDirty
|
|
|
|
method in the OLE-provided moniker interfaces always return S_FALSE because
|
|
|
|
their internal state never changes. */
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p)\n",iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Load
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_Load(IMoniker* iface,IStream* pStm)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
|
|
|
DWORD constant=1,dwbuffer;
|
|
|
|
HRESULT res;
|
|
|
|
|
|
|
|
/* data read by this function is only a DWORD constant (must be 1) ! */
|
|
|
|
res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),NULL);
|
|
|
|
|
|
|
|
if (SUCCEEDED(res)&& dwbuffer!=constant)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Save
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2010-07-21 12:03:35 +02:00
|
|
|
static const DWORD constant = 1;
|
2003-06-18 05:30:39 +02:00
|
|
|
/* data written by this function is only a DWORD constant set to 1 ! */
|
2010-07-21 12:03:35 +02:00
|
|
|
return IStream_Write(pStm,&constant,sizeof(constant),NULL);
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_GetSizeMax
|
2005-03-27 20:16:25 +02:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pcbSize [out] Pointer to size of stream needed to save object
|
1999-03-23 14:48:56 +01:00
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p)\n",iface,pcbSize);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2006-04-07 12:19:04 +02:00
|
|
|
if (!pcbSize)
|
1999-03-23 14:48:56 +01:00
|
|
|
return E_POINTER;
|
|
|
|
|
2008-04-09 21:33:37 +02:00
|
|
|
/* for more details see AntiMonikerImpl_Save comments */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
/*
|
|
|
|
* Normally the sizemax must be sizeof DWORD, but
|
|
|
|
* I tested this function it usually return 16 bytes
|
|
|
|
* more than the number of bytes used by AntiMoniker::Save function
|
|
|
|
*/
|
2004-01-23 02:51:33 +01:00
|
|
|
pcbSize->u.LowPart = sizeof(DWORD)+16;
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2004-01-23 02:51:33 +01:00
|
|
|
pcbSize->u.HighPart=0;
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_BindToObject
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_BindToObject(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft,
|
|
|
|
REFIID riid, VOID** ppvResult)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
|
1999-03-23 14:48:56 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_BindToStorage
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_BindToStorage(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft,
|
|
|
|
REFIID riid, VOID** ppvResult)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
|
1999-03-23 14:48:56 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Reduce
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar,
|
|
|
|
IMoniker** ppmkToLeft, IMoniker** ppmkReduced)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2006-10-15 12:28:08 +02:00
|
|
|
TRACE("(%p,%p,%d,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (ppmkReduced==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
AntiMonikerImpl_AddRef(iface);
|
|
|
|
|
|
|
|
*ppmkReduced=iface;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
return MK_S_REDUCED_TO_SELF;
|
|
|
|
}
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_ComposeWith
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight,
|
|
|
|
BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if ((ppmkComposite==NULL)||(pmkRight==NULL))
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*ppmkComposite=0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
if (fOnlyIfNotGeneric)
|
|
|
|
return MK_E_NEEDGENERIC;
|
|
|
|
else
|
|
|
|
return CreateGenericComposite(iface,pmkRight,ppmkComposite);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Enum
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (ppenumMoniker == NULL)
|
|
|
|
return E_POINTER;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
*ppenumMoniker = NULL;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_IsEqual
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
|
|
|
DWORD mkSys;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (pmkOtherMoniker==NULL)
|
|
|
|
return S_FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
|
|
|
|
|
|
|
|
if (mkSys==MKSYS_ANTIMONIKER)
|
|
|
|
return S_OK;
|
|
|
|
else
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Hash
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
|
|
|
if (pdwHash==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2006-05-08 13:37:08 +02:00
|
|
|
*pdwHash = 0x80000001;
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_IsRunning
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_IsRunning(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft,
|
|
|
|
IMoniker* pmkNewlyRunning)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
|
|
|
IRunningObjectTable* rot;
|
|
|
|
HRESULT res;
|
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (pbc==NULL)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
res=IBindCtx_GetRunningObjectTable(pbc,&rot);
|
|
|
|
|
|
|
|
if (FAILED(res))
|
2005-03-27 20:16:25 +02:00
|
|
|
return res;
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
res = IRunningObjectTable_IsRunning(rot,iface);
|
|
|
|
|
|
|
|
IRunningObjectTable_Release(rot);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_GetTimeOfLastChange
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
|
1999-03-23 14:48:56 +01:00
|
|
|
IBindCtx* pbc,
|
|
|
|
IMoniker* pmkToLeft,
|
|
|
|
FILETIME* pAntiTime)
|
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime);
|
1999-03-23 14:48:56 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Inverse
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p)\n",iface,ppmk);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (ppmk==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*ppmk=0;
|
|
|
|
|
|
|
|
return MK_E_NOINVERSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_CommonPrefixWith
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
|
|
|
DWORD mkSys;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
IMoniker_IsSystemMoniker(pmkOther,&mkSys);
|
|
|
|
|
2006-05-08 16:55:52 +02:00
|
|
|
if(mkSys==MKSYS_ANTIMONIKER){
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
IMoniker_AddRef(iface);
|
|
|
|
|
|
|
|
*ppmkPrefix=iface;
|
|
|
|
|
|
|
|
IMoniker_AddRef(iface);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
return MK_S_US;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_RelativePathTo
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (ppmkRelPath==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
IMoniker_AddRef(pmOther);
|
|
|
|
|
|
|
|
*ppmkRelPath=pmOther;
|
|
|
|
|
|
|
|
return MK_S_HIM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_GetDisplayName
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_GetDisplayName(IMoniker* iface, IBindCtx* pbc,
|
|
|
|
IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2004-04-20 03:12:17 +02:00
|
|
|
static const WCHAR back[]={'\\','.','.',0};
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (ppszDisplayName==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
if (pmkToLeft!=NULL){
|
2005-11-10 13:14:56 +01:00
|
|
|
FIXME("() pmkToLeft!=NULL not implemented\n");
|
1999-03-23 14:48:56 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppszDisplayName=CoTaskMemAlloc(sizeof(back));
|
|
|
|
|
|
|
|
if (*ppszDisplayName==NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
lstrcpyW(*ppszDisplayName,back);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_ParseDisplayName
|
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_ParseDisplayName(IMoniker* iface, IBindCtx* pbc,
|
|
|
|
IMoniker* pmkToLeft, LPOLESTR pszDisplayName,
|
|
|
|
ULONG* pchEaten, IMoniker** ppmkOut)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
|
1999-03-23 14:48:56 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-04-20 20:36:05 +02:00
|
|
|
* AntiMoniker_IsSystemMoniker
|
1999-03-23 14:48:56 +01:00
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p)\n",iface,pwdMksys);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
if (!pwdMksys)
|
|
|
|
return E_POINTER;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
(*pwdMksys)=MKSYS_ANTIMONIKER;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* AntiMonikerIROTData_QueryInterface
|
|
|
|
*******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
|
|
|
AntiMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2011-08-23 10:14:42 +02:00
|
|
|
AntiMonikerImpl *This = impl_from_IROTData(iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p,%p,%p)\n",iface,riid,ppvObject);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2011-08-23 10:14:42 +02:00
|
|
|
return AntiMonikerImpl_QueryInterface(&This->IMoniker_iface, riid, ppvObject);
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* AntiMonikerIROTData_AddRef
|
|
|
|
*/
|
2005-03-27 20:16:25 +02:00
|
|
|
static ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2011-08-23 10:14:42 +02:00
|
|
|
AntiMonikerImpl *This = impl_from_IROTData(iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p)\n",iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2011-08-23 10:14:42 +02:00
|
|
|
return AntiMonikerImpl_AddRef(&This->IMoniker_iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* AntiMonikerIROTData_Release
|
|
|
|
*/
|
2005-03-27 20:16:25 +02:00
|
|
|
static ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2011-08-23 10:14:42 +02:00
|
|
|
AntiMonikerImpl *This = impl_from_IROTData(iface);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p)\n",iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
2011-08-23 10:14:42 +02:00
|
|
|
return AntiMonikerImpl_Release(&This->IMoniker_iface);
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2008-04-14 01:01:50 +02:00
|
|
|
* AntiMonikerIROTData_GetComparisonData
|
1999-03-23 14:48:56 +01:00
|
|
|
******************************************************************************/
|
2005-03-27 20:16:25 +02:00
|
|
|
static HRESULT WINAPI
|
2006-05-08 13:37:08 +02:00
|
|
|
AntiMonikerROTDataImpl_GetComparisonData(IROTData* iface, BYTE* pbData,
|
2005-03-27 20:16:25 +02:00
|
|
|
ULONG cbMax, ULONG* pcbData)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2006-05-08 13:37:08 +02:00
|
|
|
DWORD constant = 1;
|
|
|
|
|
2006-10-15 12:28:08 +02:00
|
|
|
TRACE("(%p, %u, %p)\n", pbData, cbMax, pcbData);
|
2006-05-08 13:37:08 +02:00
|
|
|
|
|
|
|
*pcbData = sizeof(CLSID) + sizeof(DWORD);
|
|
|
|
if (cbMax < *pcbData)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
memcpy(pbData, &CLSID_AntiMoniker, sizeof(CLSID));
|
|
|
|
memcpy(pbData+sizeof(CLSID), &constant, sizeof(DWORD));
|
|
|
|
|
|
|
|
return S_OK;
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
|
|
|
|
2005-03-27 20:16:25 +02:00
|
|
|
/********************************************************************************/
|
|
|
|
/* Virtual function table for the AntiMonikerImpl class which include IPersist,*/
|
|
|
|
/* IPersistStream and IMoniker functions. */
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IMonikerVtbl VT_AntiMonikerImpl =
|
2005-03-27 20:16:25 +02:00
|
|
|
{
|
|
|
|
AntiMonikerImpl_QueryInterface,
|
|
|
|
AntiMonikerImpl_AddRef,
|
|
|
|
AntiMonikerImpl_Release,
|
|
|
|
AntiMonikerImpl_GetClassID,
|
|
|
|
AntiMonikerImpl_IsDirty,
|
|
|
|
AntiMonikerImpl_Load,
|
|
|
|
AntiMonikerImpl_Save,
|
|
|
|
AntiMonikerImpl_GetSizeMax,
|
|
|
|
AntiMonikerImpl_BindToObject,
|
|
|
|
AntiMonikerImpl_BindToStorage,
|
|
|
|
AntiMonikerImpl_Reduce,
|
|
|
|
AntiMonikerImpl_ComposeWith,
|
|
|
|
AntiMonikerImpl_Enum,
|
|
|
|
AntiMonikerImpl_IsEqual,
|
|
|
|
AntiMonikerImpl_Hash,
|
|
|
|
AntiMonikerImpl_IsRunning,
|
|
|
|
AntiMonikerImpl_GetTimeOfLastChange,
|
|
|
|
AntiMonikerImpl_Inverse,
|
|
|
|
AntiMonikerImpl_CommonPrefixWith,
|
|
|
|
AntiMonikerImpl_RelativePathTo,
|
|
|
|
AntiMonikerImpl_GetDisplayName,
|
|
|
|
AntiMonikerImpl_ParseDisplayName,
|
|
|
|
AntiMonikerImpl_IsSystemMoniker
|
|
|
|
};
|
|
|
|
|
|
|
|
/********************************************************************************/
|
|
|
|
/* Virtual function table for the IROTData class. */
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IROTDataVtbl VT_ROTDataImpl =
|
2005-03-27 20:16:25 +02:00
|
|
|
{
|
|
|
|
AntiMonikerROTDataImpl_QueryInterface,
|
|
|
|
AntiMonikerROTDataImpl_AddRef,
|
|
|
|
AntiMonikerROTDataImpl_Release,
|
2006-05-08 13:37:08 +02:00
|
|
|
AntiMonikerROTDataImpl_GetComparisonData
|
2005-03-27 20:16:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AntiMoniker_Construct (local function)
|
|
|
|
*******************************************************************************/
|
|
|
|
static HRESULT AntiMonikerImpl_Construct(AntiMonikerImpl* This)
|
|
|
|
{
|
|
|
|
|
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
|
2008-04-09 21:33:37 +02:00
|
|
|
/* Initialize the virtual function table. */
|
2011-08-23 10:14:42 +02:00
|
|
|
This->IMoniker_iface.lpVtbl = &VT_AntiMonikerImpl;
|
|
|
|
This->IROTData_iface.lpVtbl = &VT_ROTDataImpl;
|
2005-03-27 20:16:25 +02:00
|
|
|
This->ref = 0;
|
2006-05-08 13:36:13 +02:00
|
|
|
This->pMarshal = NULL;
|
2005-03-27 20:16:25 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
1999-03-23 14:48:56 +01:00
|
|
|
/******************************************************************************
|
2003-09-11 05:06:25 +02:00
|
|
|
* CreateAntiMoniker [OLE32.@]
|
1999-03-23 14:48:56 +01:00
|
|
|
******************************************************************************/
|
2011-08-23 10:14:42 +02:00
|
|
|
HRESULT WINAPI CreateAntiMoniker(IMoniker **ppmk)
|
1999-03-23 14:48:56 +01:00
|
|
|
{
|
2010-07-21 12:03:35 +02:00
|
|
|
AntiMonikerImpl* newAntiMoniker;
|
|
|
|
HRESULT hr;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-07-04 18:02:24 +02:00
|
|
|
TRACE("(%p)\n",ppmk);
|
1999-03-23 14:48:56 +01:00
|
|
|
|
|
|
|
newAntiMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(AntiMonikerImpl));
|
|
|
|
|
|
|
|
if (newAntiMoniker == 0)
|
|
|
|
return STG_E_INSUFFICIENTMEMORY;
|
|
|
|
|
|
|
|
hr = AntiMonikerImpl_Construct(newAntiMoniker);
|
2005-03-27 20:16:25 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
1999-03-23 14:48:56 +01:00
|
|
|
HeapFree(GetProcessHeap(),0,newAntiMoniker);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2011-08-23 10:14:42 +02:00
|
|
|
return AntiMonikerImpl_QueryInterface(&newAntiMoniker->IMoniker_iface, &IID_IMoniker,
|
|
|
|
(void**)ppmk);
|
1999-03-23 14:48:56 +01:00
|
|
|
}
|
2006-05-08 13:36:13 +02:00
|
|
|
|
2012-08-13 11:40:33 +02:00
|
|
|
static HRESULT WINAPI AntiMonikerCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
2006-05-08 13:36:13 +02:00
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
|
|
|
|
{
|
|
|
|
*ppv = iface;
|
2012-08-13 11:40:33 +02:00
|
|
|
IClassFactory_AddRef(iface);
|
2006-05-08 13:36:13 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AntiMonikerCF_AddRef(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
return 2; /* non-heap based object */
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AntiMonikerCF_Release(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
return 1; /* non-heap based object */
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AntiMonikerCF_CreateInstance(LPCLASSFACTORY iface,
|
|
|
|
LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
IMoniker *pMoniker;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %p)\n", pUnk, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (pUnk)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
hr = CreateAntiMoniker(&pMoniker);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-07-21 12:03:35 +02:00
|
|
|
hr = IMoniker_QueryInterface(pMoniker, riid, ppv);
|
2006-05-08 13:36:13 +02:00
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
IMoniker_Release(pMoniker);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AntiMonikerCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
|
|
|
|
{
|
|
|
|
FIXME("(%d), stub!\n",fLock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IClassFactoryVtbl AntiMonikerCFVtbl =
|
|
|
|
{
|
|
|
|
AntiMonikerCF_QueryInterface,
|
|
|
|
AntiMonikerCF_AddRef,
|
|
|
|
AntiMonikerCF_Release,
|
|
|
|
AntiMonikerCF_CreateInstance,
|
|
|
|
AntiMonikerCF_LockServer
|
|
|
|
};
|
|
|
|
static const IClassFactoryVtbl *AntiMonikerCF = &AntiMonikerCFVtbl;
|
|
|
|
|
|
|
|
HRESULT AntiMonikerCF_Create(REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
return IClassFactory_QueryInterface((IClassFactory *)&AntiMonikerCF, riid, ppv);
|
|
|
|
}
|