| 1 | /* $Id: antimoniker.cpp,v 1.1 2001-04-26 19:26:08 sandervl Exp $ */
 | 
|---|
| 2 | /* 
 | 
|---|
| 3 |  * AntiMonikers functions.
 | 
|---|
| 4 |  * 
 | 
|---|
| 5 |  * Copyright 1999, 2000 David J. Raison
 | 
|---|
| 6 |  * 
 | 
|---|
| 7 |  * Direct port of Wine Implementation
 | 
|---|
| 8 |  *   Copyright 1999  Noomen Hamza
 | 
|---|
| 9 |  *
 | 
|---|
| 10 |  * Updates.
 | 
|---|
| 11 |  *   14/09/2000 Updated from CorelWine
 | 
|---|
| 12 |  * 
 | 
|---|
| 13 |  */
 | 
|---|
| 14 | 
 | 
|---|
| 15 | #include "ole32.h"
 | 
|---|
| 16 | #include "debugtools.h"
 | 
|---|
| 17 | 
 | 
|---|
| 18 | DEFAULT_DEBUG_CHANNEL(moniker)
 | 
|---|
| 19 | 
 | 
|---|
| 20 | /* AntiMoniker data structure */
 | 
|---|
| 21 | typedef struct AntiMonikerImpl
 | 
|---|
| 22 | {
 | 
|---|
| 23 | 
 | 
|---|
| 24 |     ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
 | 
|---|
| 25 | 
 | 
|---|
| 26 |     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
 | 
|---|
| 27 |      * two monikers are equal. That's whay IROTData interface is implemented by monikers.
 | 
|---|
| 28 |      */
 | 
|---|
| 29 |     ICOM_VTABLE(IROTData)*  lpvtbl2;  /* VTable relative to the IROTData interface.*/
 | 
|---|
| 30 | 
 | 
|---|
| 31 |     ULONG ref; /* reference counter for this object */
 | 
|---|
| 32 | 
 | 
|---|
| 33 | } AntiMonikerImpl;
 | 
|---|
| 34 | 
 | 
|---|
| 35 | /********************************************************************************/
 | 
|---|
| 36 | /* AntiMoniker prototype functions :                                            */
 | 
|---|
| 37 | 
 | 
|---|
| 38 | /* IUnknown prototype functions */
 | 
|---|
| 39 | static HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject);
 | 
|---|
| 40 | static ULONG   WINAPI AntiMonikerImpl_AddRef(IMoniker* iface);
 | 
|---|
| 41 | static ULONG   WINAPI AntiMonikerImpl_Release(IMoniker* iface);
 | 
|---|
| 42 | 
 | 
|---|
| 43 | /* IPersist prototype functions */
 | 
|---|
| 44 | static HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID);
 | 
|---|
| 45 | 
 | 
|---|
| 46 | /* IPersistStream prototype functions */
 | 
|---|
| 47 | static HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface);
 | 
|---|
| 48 | static HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface, IStream* pStm);
 | 
|---|
| 49 | static HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty);
 | 
|---|
| 50 | static HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize);
 | 
|---|
| 51 | 
 | 
|---|
| 52 | /* IMoniker prototype functions */
 | 
|---|
| 53 | static HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
 | 
|---|
| 54 | static HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
 | 
|---|
| 55 | static HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced);
 | 
|---|
| 56 | static HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite);
 | 
|---|
| 57 | static HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker);
 | 
|---|
| 58 | static HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker);
 | 
|---|
| 59 | static HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash);
 | 
|---|
| 60 | static HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning);
 | 
|---|
| 61 | static HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pAntiTime);
 | 
|---|
| 62 | static HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk);
 | 
|---|
| 63 | static HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix);
 | 
|---|
| 64 | static HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath);
 | 
|---|
| 65 | static HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName);
 | 
|---|
| 66 | static HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut);
 | 
|---|
| 67 | static HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
 | 
|---|
| 68 | 
 | 
|---|
| 69 | /********************************************************************************/
 | 
|---|
| 70 | /* IROTData prototype functions                                                 */
 | 
|---|
| 71 | 
 | 
|---|
| 72 | /* IUnknown prototype functions */
 | 
|---|
| 73 | static HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData* iface,REFIID riid,VOID** ppvObject);
 | 
|---|
| 74 | static ULONG   WINAPI AntiMonikerROTDataImpl_AddRef(IROTData* iface);
 | 
|---|
| 75 | static ULONG   WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface);
 | 
|---|
| 76 | 
 | 
|---|
| 77 | /* IROTData prototype function */
 | 
|---|
| 78 | static HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,BYTE* pbData,ULONG cbMax,ULONG* pcbData);
 | 
|---|
| 79 | 
 | 
|---|
| 80 | /* Local function used by AntiMoniker implementation */
 | 
|---|
| 81 | HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* iface);
 | 
|---|
| 82 | HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* iface);
 | 
|---|
| 83 | 
 | 
|---|
| 84 | /********************************************************************************/
 | 
|---|
| 85 | /* Virtual function table for the AntiMonikerImpl class witch  include Ipersist,*/
 | 
|---|
| 86 | /* IPersistStream and IMoniker functions.                                       */
 | 
|---|
| 87 | static ICOM_VTABLE(IMoniker) VT_AntiMonikerImpl =
 | 
|---|
| 88 | {
 | 
|---|
| 89 |     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
 | 
|---|
| 90 |     AntiMonikerImpl_QueryInterface,
 | 
|---|
| 91 |     AntiMonikerImpl_AddRef,
 | 
|---|
| 92 |     AntiMonikerImpl_Release,
 | 
|---|
| 93 |     AntiMonikerImpl_GetClassID,
 | 
|---|
| 94 |     AntiMonikerImpl_IsDirty,
 | 
|---|
| 95 |     AntiMonikerImpl_Load,
 | 
|---|
| 96 |     AntiMonikerImpl_Save,
 | 
|---|
| 97 |     AntiMonikerImpl_GetSizeMax,
 | 
|---|
| 98 |     AntiMonikerImpl_BindToObject,
 | 
|---|
| 99 |     AntiMonikerImpl_BindToStorage,
 | 
|---|
| 100 |     AntiMonikerImpl_Reduce,
 | 
|---|
| 101 |     AntiMonikerImpl_ComposeWith,
 | 
|---|
| 102 |     AntiMonikerImpl_Enum,
 | 
|---|
| 103 |     AntiMonikerImpl_IsEqual,
 | 
|---|
| 104 |     AntiMonikerImpl_Hash,
 | 
|---|
| 105 |     AntiMonikerImpl_IsRunning,
 | 
|---|
| 106 |     AntiMonikerImpl_GetTimeOfLastChange,
 | 
|---|
| 107 |     AntiMonikerImpl_Inverse,
 | 
|---|
| 108 |     AntiMonikerImpl_CommonPrefixWith,
 | 
|---|
| 109 |     AntiMonikerImpl_RelativePathTo,
 | 
|---|
| 110 |     AntiMonikerImpl_GetDisplayName,
 | 
|---|
| 111 |     AntiMonikerImpl_ParseDisplayName,
 | 
|---|
| 112 |     AntiMonikerImpl_IsSystemMoniker
 | 
|---|
| 113 | };
 | 
|---|
| 114 | 
 | 
|---|
| 115 | /********************************************************************************/
 | 
|---|
| 116 | /* Virtual function table for the IROTData class.                               */
 | 
|---|
| 117 | static ICOM_VTABLE(IROTData) VT_ROTDataImpl =
 | 
|---|
| 118 | {
 | 
|---|
| 119 |     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
 | 
|---|
| 120 |     AntiMonikerROTDataImpl_QueryInterface,
 | 
|---|
| 121 |     AntiMonikerROTDataImpl_AddRef,
 | 
|---|
| 122 |     AntiMonikerROTDataImpl_Release,
 | 
|---|
| 123 |     AntiMonikerROTDataImpl_GetComparaisonData
 | 
|---|
| 124 | };
 | 
|---|
| 125 | 
 | 
|---|
| 126 | /*******************************************************************************
 | 
|---|
| 127 |  *        AntiMoniker_QueryInterface
 | 
|---|
| 128 |  *******************************************************************************/
 | 
|---|
| 129 | HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
 | 
|---|
| 130 | {
 | 
|---|
| 131 |     ICOM_THIS(AntiMonikerImpl,iface);
 | 
|---|
| 132 |   
 | 
|---|
| 133 |   TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
 | 
|---|
| 134 | 
 | 
|---|
| 135 |   /* Perform a sanity check on the parameters.*/
 | 
|---|
| 136 |     if ( (This==0) || (ppvObject==0) )
 | 
|---|
| 137 |         return E_INVALIDARG;
 | 
|---|
| 138 |   
 | 
|---|
| 139 |   /* Initialize the return parameter */
 | 
|---|
| 140 |   *ppvObject = 0;
 | 
|---|
| 141 | 
 | 
|---|
| 142 |   /* Compare the riid with the interface IDs implemented by this object.*/
 | 
|---|
| 143 |   if (IsEqualIID(&IID_IUnknown, riid) ||
 | 
|---|
| 144 |       IsEqualIID(&IID_IPersist, riid) ||
 | 
|---|
| 145 |       IsEqualIID(&IID_IPersistStream, riid) ||
 | 
|---|
| 146 |       IsEqualIID(&IID_IMoniker, riid)
 | 
|---|
| 147 |      )
 | 
|---|
| 148 |       *ppvObject = iface;
 | 
|---|
| 149 |     else if (IsEqualIID(&IID_IROTData, riid))
 | 
|---|
| 150 |         *ppvObject = (IROTData*)&(This->lpvtbl2);
 | 
|---|
| 151 | 
 | 
|---|
| 152 |   /* Check that we obtained an interface.*/
 | 
|---|
| 153 |     if ((*ppvObject)==0)
 | 
|---|
| 154 |         return E_NOINTERFACE;
 | 
|---|
| 155 |   
 | 
|---|
| 156 |    /* Query Interface always increases the reference count by one when it is successful */
 | 
|---|
| 157 |   AntiMonikerImpl_AddRef(iface);
 | 
|---|
| 158 | 
 | 
|---|
| 159 |   return S_OK;
 | 
|---|
| 160 | }
 | 
|---|
| 161 | 
 | 
|---|
| 162 | /******************************************************************************
 | 
|---|
| 163 |  *        AntiMoniker_AddRef
 | 
|---|
| 164 |  ******************************************************************************/
 | 
|---|
| 165 | ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface)
 | 
|---|
| 166 | {
 | 
|---|
| 167 |     ICOM_THIS(AntiMonikerImpl,iface);
 | 
|---|
| 168 | 
 | 
|---|
| 169 |     TRACE("(%p)\n",This);
 | 
|---|
| 170 | 
 | 
|---|
| 171 |     return ++(This->ref);
 | 
|---|
| 172 | }
 | 
|---|
| 173 | 
 | 
|---|
| 174 | /******************************************************************************
 | 
|---|
| 175 |  *        AntiMoniker_Release
 | 
|---|
| 176 |  ******************************************************************************/
 | 
|---|
| 177 | ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface)
 | 
|---|
| 178 | {
 | 
|---|
| 179 |     ICOM_THIS(AntiMonikerImpl,iface);
 | 
|---|
| 180 | 
 | 
|---|
| 181 |     TRACE("(%p)\n",This);
 | 
|---|
| 182 | 
 | 
|---|
| 183 |     This->ref--;
 | 
|---|
| 184 | 
 | 
|---|
| 185 |     /* destroy the object if there's no more reference on it */
 | 
|---|
| 186 |     if (This->ref==0){
 | 
|---|
| 187 | 
 | 
|---|
| 188 |         AntiMonikerImpl_Destroy(This);
 | 
|---|
| 189 | 
 | 
|---|
| 190 |         return 0;
 | 
|---|
| 191 |     }
 | 
|---|
| 192 |     return This->ref;;
 | 
|---|
| 193 | }
 | 
|---|
| 194 | 
 | 
|---|
| 195 | /******************************************************************************
 | 
|---|
| 196 |  *        AntiMoniker_GetClassID
 | 
|---|
| 197 |  ******************************************************************************/
 | 
|---|
| 198 | HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID)
 | 
|---|
| 199 | {
 | 
|---|
| 200 |     TRACE("(iface:%p ClassID:%p [CLSID_AntiMoniker])\n",iface,pClassID);
 | 
|---|
| 201 | 
 | 
|---|
| 202 |     if (pClassID==NULL)
 | 
|---|
| 203 |         return E_POINTER;
 | 
|---|
| 204 |             
 | 
|---|
| 205 |     *pClassID = CLSID_AntiMoniker;
 | 
|---|
| 206 |         
 | 
|---|
| 207 |     return S_OK;
 | 
|---|
| 208 | }
 | 
|---|
| 209 | 
 | 
|---|
| 210 | /******************************************************************************
 | 
|---|
| 211 |  *        AntiMoniker_IsDirty
 | 
|---|
| 212 |  ******************************************************************************/
 | 
|---|
| 213 | HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface)
 | 
|---|
| 214 | {
 | 
|---|
| 215 |     /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
 | 
|---|
| 216 |        method in the OLE-provided moniker interfaces always return S_FALSE because
 | 
|---|
| 217 |        their internal state never changes. */
 | 
|---|
| 218 | 
 | 
|---|
| 219 |     TRACE("(%p)\n",iface);
 | 
|---|
| 220 | 
 | 
|---|
| 221 |     return S_FALSE;
 | 
|---|
| 222 | }
 | 
|---|
| 223 | 
 | 
|---|
| 224 | /******************************************************************************
 | 
|---|
| 225 |  *        AntiMoniker_Load
 | 
|---|
| 226 |  ******************************************************************************/
 | 
|---|
| 227 | HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface,IStream* pStm)
 | 
|---|
| 228 | {
 | 
|---|
| 229 |     DWORD constant=1,dwbuffer;
 | 
|---|
| 230 |     HRESULT res;
 | 
|---|
| 231 | 
 | 
|---|
| 232 |     /* data read by this function is only a DWORD constant (must be 1) ! */
 | 
|---|
| 233 |     res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),NULL);
 | 
|---|
| 234 | 
 | 
|---|
| 235 |     if (SUCCEEDED(res)&& dwbuffer!=constant)
 | 
|---|
| 236 |         return E_FAIL;
 | 
|---|
| 237 | 
 | 
|---|
| 238 |     return res;
 | 
|---|
| 239 | }
 | 
|---|
| 240 | 
 | 
|---|
| 241 | /******************************************************************************
 | 
|---|
| 242 |  *        AntiMoniker_Save
 | 
|---|
| 243 |  ******************************************************************************/
 | 
|---|
| 244 | HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
 | 
|---|
| 245 | {
 | 
|---|
| 246 |     DWORD constant=1;
 | 
|---|
| 247 |     HRESULT res;
 | 
|---|
| 248 |     
 | 
|---|
| 249 |     /* data writen by this function is only a DWORD constant seted to 1 ! */
 | 
|---|
| 250 |     res=IStream_Write(pStm,&constant,sizeof(constant),NULL);
 | 
|---|
| 251 | 
 | 
|---|
| 252 |     return res;
 | 
|---|
| 253 | }
 | 
|---|
| 254 | 
 | 
|---|
| 255 | /******************************************************************************
 | 
|---|
| 256 |  *        AntiMonikerImpl_GetSizeToSave
 | 
|---|
| 257 |  ******************************************************************************/
 | 
|---|
| 258 | HRESULT AntiMonikerImpl_GetSizeToSave(IMoniker* iface,ULARGE_INTEGER* pcbSize)
 | 
|---|
| 259 | {
 | 
|---|
| 260 |     if (pcbSize==NULL)
 | 
|---|
| 261 |         return E_POINTER;
 | 
|---|
| 262 | 
 | 
|---|
| 263 |     pcbSize->LowPart =  sizeof(DWORD);
 | 
|---|
| 264 |     pcbSize->HighPart = 0;
 | 
|---|
| 265 | 
 | 
|---|
| 266 |     return S_OK;
 | 
|---|
| 267 | }
 | 
|---|
| 268 | 
 | 
|---|
| 269 | /******************************************************************************
 | 
|---|
| 270 |  *        AntiMoniker_GetSizeMax
 | 
|---|
| 271 |  ******************************************************************************/
 | 
|---|
| 272 | HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface,
 | 
|---|
| 273 |                                           ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
 | 
|---|
| 274 | {
 | 
|---|
| 275 |     TRACE("(%p,%p)\n",iface,pcbSize);
 | 
|---|
| 276 | 
 | 
|---|
| 277 |     if (pcbSize == NULL)
 | 
|---|
| 278 |         return E_POINTER;
 | 
|---|
| 279 | 
 | 
|---|
| 280 |     /* GetSizeMax = SizeToSave + 16 */
 | 
|---|
| 281 |     AntiMonikerImpl_GetSizeToSave(iface,pcbSize);
 | 
|---|
| 282 |     pcbSize->LowPart += 16;     //FIXME - 64bit math
 | 
|---|
| 283 | //    pcbSize->HighPart = 0;
 | 
|---|
| 284 | 
 | 
|---|
| 285 |     return S_OK;
 | 
|---|
| 286 | }
 | 
|---|
| 287 | 
 | 
|---|
| 288 | 
 | 
|---|
| 289 | /******************************************************************************
 | 
|---|
| 290 |  *         AntiMoniker_Construct (local function)
 | 
|---|
| 291 |  *******************************************************************************/
 | 
|---|
| 292 | HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* This)
 | 
|---|
| 293 | {
 | 
|---|
| 294 | 
 | 
|---|
| 295 |     TRACE("(%p)\n",This);
 | 
|---|
| 296 | 
 | 
|---|
| 297 |     /* Initialize the virtual fgunction table. */
 | 
|---|
| 298 |     This->lpvtbl1      = &VT_AntiMonikerImpl;
 | 
|---|
| 299 |     This->lpvtbl2      = &VT_ROTDataImpl;
 | 
|---|
| 300 |     This->ref          = 0;
 | 
|---|
| 301 | 
 | 
|---|
| 302 |     return S_OK;
 | 
|---|
| 303 | }
 | 
|---|
| 304 | 
 | 
|---|
| 305 | /******************************************************************************
 | 
|---|
| 306 |  *        AntiMoniker_Destroy (local function)
 | 
|---|
| 307 |  *******************************************************************************/
 | 
|---|
| 308 | HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* This)
 | 
|---|
| 309 | {
 | 
|---|
| 310 |     TRACE("(%p)\n",This);
 | 
|---|
| 311 | 
 | 
|---|
| 312 |     return HeapFree(GetProcessHeap(),0,This);
 | 
|---|
| 313 | }
 | 
|---|
| 314 | 
 | 
|---|
| 315 | /******************************************************************************
 | 
|---|
| 316 |  *                  AntiMoniker_BindToObject
 | 
|---|
| 317 |  ******************************************************************************/
 | 
|---|
| 318 | HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,
 | 
|---|
| 319 |                                             IBindCtx* pbc,
 | 
|---|
| 320 |                                             IMoniker* pmkToLeft,
 | 
|---|
| 321 |                                             REFIID riid,
 | 
|---|
| 322 |                                             VOID** ppvResult)
 | 
|---|
| 323 | {
 | 
|---|
| 324 |     TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
 | 
|---|
| 325 |     return E_NOTIMPL;
 | 
|---|
| 326 | }
 | 
|---|
| 327 | 
 | 
|---|
| 328 | /******************************************************************************
 | 
|---|
| 329 |  *        AntiMoniker_BindToStorage
 | 
|---|
| 330 |  ******************************************************************************/
 | 
|---|
| 331 | HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,
 | 
|---|
| 332 |                                              IBindCtx* pbc,
 | 
|---|
| 333 |                                              IMoniker* pmkToLeft,
 | 
|---|
| 334 |                                              REFIID riid,
 | 
|---|
| 335 |                                              VOID** ppvResult)
 | 
|---|
| 336 | {
 | 
|---|
| 337 |     TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
 | 
|---|
| 338 |     return E_NOTIMPL;
 | 
|---|
| 339 | }
 | 
|---|
| 340 | 
 | 
|---|
| 341 | /******************************************************************************
 | 
|---|
| 342 |  *        AntiMoniker_Reduce
 | 
|---|
| 343 |  ******************************************************************************/
 | 
|---|
| 344 | HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,
 | 
|---|
| 345 |                                       IBindCtx* pbc,
 | 
|---|
| 346 |                                       DWORD dwReduceHowFar,
 | 
|---|
| 347 |                                       IMoniker** ppmkToLeft,
 | 
|---|
| 348 |                                       IMoniker** ppmkReduced)
 | 
|---|
| 349 | {
 | 
|---|
| 350 |     TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
 | 
|---|
| 351 | 
 | 
|---|
| 352 |     if (ppmkReduced==NULL)
 | 
|---|
| 353 |         return E_POINTER;
 | 
|---|
| 354 | 
 | 
|---|
| 355 |     AntiMonikerImpl_AddRef(iface);
 | 
|---|
| 356 | 
 | 
|---|
| 357 |     *ppmkReduced=iface;
 | 
|---|
| 358 |     
 | 
|---|
| 359 |     return MK_S_REDUCED_TO_SELF;
 | 
|---|
| 360 | }
 | 
|---|
| 361 | /******************************************************************************
 | 
|---|
| 362 |  *        AntiMoniker_ComposeWith
 | 
|---|
| 363 |  ******************************************************************************/
 | 
|---|
| 364 | HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,
 | 
|---|
| 365 |                                            IMoniker* pmkRight,
 | 
|---|
| 366 |                                            BOOL fOnlyIfNotGeneric,
 | 
|---|
| 367 |                                            IMoniker** ppmkComposite)
 | 
|---|
| 368 | {
 | 
|---|
| 369 | 
 | 
|---|
| 370 |     TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
 | 
|---|
| 371 | 
 | 
|---|
| 372 |     if ((ppmkComposite==NULL)||(pmkRight==NULL))
 | 
|---|
| 373 |         return E_POINTER;
 | 
|---|
| 374 | 
 | 
|---|
| 375 |     *ppmkComposite=0;
 | 
|---|
| 376 |     
 | 
|---|
| 377 |     if (fOnlyIfNotGeneric)
 | 
|---|
| 378 |         return MK_E_NEEDGENERIC;
 | 
|---|
| 379 |     else
 | 
|---|
| 380 |         return CreateGenericComposite(iface,pmkRight,ppmkComposite);
 | 
|---|
| 381 | }
 | 
|---|
| 382 | 
 | 
|---|
| 383 | /******************************************************************************
 | 
|---|
| 384 |  *        AntiMoniker_Enum
 | 
|---|
| 385 |  ******************************************************************************/
 | 
|---|
| 386 | HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
 | 
|---|
| 387 | {
 | 
|---|
| 388 |     TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
 | 
|---|
| 389 | 
 | 
|---|
| 390 |     if (ppenumMoniker == NULL)
 | 
|---|
| 391 |         return E_POINTER;
 | 
|---|
| 392 |     
 | 
|---|
| 393 |     *ppenumMoniker = NULL;
 | 
|---|
| 394 | 
 | 
|---|
| 395 |     return S_OK;
 | 
|---|
| 396 | }
 | 
|---|
| 397 | 
 | 
|---|
| 398 | /******************************************************************************
 | 
|---|
| 399 |  *        AntiMoniker_IsEqual
 | 
|---|
| 400 |  ******************************************************************************/
 | 
|---|
| 401 | HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
 | 
|---|
| 402 | {
 | 
|---|
| 403 |     DWORD mkSys;
 | 
|---|
| 404 |     
 | 
|---|
| 405 |     TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
 | 
|---|
| 406 | 
 | 
|---|
| 407 |     if (pmkOtherMoniker==NULL)
 | 
|---|
| 408 |         return S_FALSE;
 | 
|---|
| 409 |     
 | 
|---|
| 410 |     IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
 | 
|---|
| 411 | 
 | 
|---|
| 412 |     if (mkSys==MKSYS_ANTIMONIKER)
 | 
|---|
| 413 |         return S_OK;
 | 
|---|
| 414 |     else
 | 
|---|
| 415 |         return S_FALSE;
 | 
|---|
| 416 | }
 | 
|---|
| 417 | 
 | 
|---|
| 418 | /******************************************************************************
 | 
|---|
| 419 |  *        AntiMoniker_Hash
 | 
|---|
| 420 |  ******************************************************************************/
 | 
|---|
| 421 | HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
 | 
|---|
| 422 | {
 | 
|---|
| 423 |     if (pdwHash==NULL)
 | 
|---|
| 424 |         return E_POINTER;
 | 
|---|
| 425 | 
 | 
|---|
| 426 |     *pdwHash=0;
 | 
|---|
| 427 | 
 | 
|---|
| 428 |     return S_OK;
 | 
|---|
| 429 | }
 | 
|---|
| 430 | 
 | 
|---|
| 431 | /******************************************************************************
 | 
|---|
| 432 |  *        AntiMoniker_IsRunning
 | 
|---|
| 433 |  ******************************************************************************/
 | 
|---|
| 434 | HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,
 | 
|---|
| 435 |                                          IBindCtx* pbc,
 | 
|---|
| 436 |                                          IMoniker* pmkToLeft,
 | 
|---|
| 437 |                                          IMoniker* pmkNewlyRunning)
 | 
|---|
| 438 | {
 | 
|---|
| 439 |     IRunningObjectTable* rot;
 | 
|---|
| 440 |     HRESULT res;
 | 
|---|
| 441 | 
 | 
|---|
| 442 |     TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning);
 | 
|---|
| 443 | 
 | 
|---|
| 444 |     if (pbc==NULL)
 | 
|---|
| 445 |         return E_INVALIDARG;
 | 
|---|
| 446 | 
 | 
|---|
| 447 |     res=IBindCtx_GetRunningObjectTable(pbc,&rot);
 | 
|---|
| 448 | 
 | 
|---|
| 449 |     if (FAILED(res))
 | 
|---|
| 450 |         return res;
 | 
|---|
| 451 | 
 | 
|---|
| 452 |     res = IRunningObjectTable_IsRunning(rot,iface);
 | 
|---|
| 453 | 
 | 
|---|
| 454 |     IRunningObjectTable_Release(rot);
 | 
|---|
| 455 | 
 | 
|---|
| 456 |     return res;
 | 
|---|
| 457 | }
 | 
|---|
| 458 | 
 | 
|---|
| 459 | /******************************************************************************
 | 
|---|
| 460 |  *        AntiMoniker_GetTimeOfLastChange
 | 
|---|
| 461 |  ******************************************************************************/
 | 
|---|
| 462 | HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
 | 
|---|
| 463 |                                                    IBindCtx* pbc,
 | 
|---|
| 464 |                                                    IMoniker* pmkToLeft,
 | 
|---|
| 465 |                                                    FILETIME* pAntiTime)
 | 
|---|
| 466 | {
 | 
|---|
| 467 |     TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime);
 | 
|---|
| 468 |     return E_NOTIMPL;
 | 
|---|
| 469 | }
 | 
|---|
| 470 | 
 | 
|---|
| 471 | /******************************************************************************
 | 
|---|
| 472 |  *        AntiMoniker_Inverse
 | 
|---|
| 473 |  ******************************************************************************/
 | 
|---|
| 474 | HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
 | 
|---|
| 475 | {
 | 
|---|
| 476 |     TRACE("(%p,%p)\n",iface,ppmk);
 | 
|---|
| 477 | 
 | 
|---|
| 478 |     if (ppmk==NULL)
 | 
|---|
| 479 |         return E_POINTER;
 | 
|---|
| 480 | 
 | 
|---|
| 481 |     *ppmk=0;
 | 
|---|
| 482 | 
 | 
|---|
| 483 |     return MK_E_NOINVERSE;
 | 
|---|
| 484 | }
 | 
|---|
| 485 | 
 | 
|---|
| 486 | /******************************************************************************
 | 
|---|
| 487 |  *        AntiMoniker_CommonPrefixWith
 | 
|---|
| 488 |  ******************************************************************************/
 | 
|---|
| 489 | HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
 | 
|---|
| 490 | {
 | 
|---|
| 491 |     DWORD mkSys;
 | 
|---|
| 492 |     
 | 
|---|
| 493 |     IMoniker_IsSystemMoniker(pmkOther,&mkSys);
 | 
|---|
| 494 | 
 | 
|---|
| 495 |     if(mkSys==MKSYS_ITEMMONIKER){
 | 
|---|
| 496 | 
 | 
|---|
| 497 |         IMoniker_AddRef(iface);
 | 
|---|
| 498 | 
 | 
|---|
| 499 |         *ppmkPrefix=iface;
 | 
|---|
| 500 | 
 | 
|---|
| 501 |         IMoniker_AddRef(iface);
 | 
|---|
| 502 |         
 | 
|---|
| 503 |         return MK_S_US;
 | 
|---|
| 504 |     }
 | 
|---|
| 505 |     else
 | 
|---|
| 506 |         return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
 | 
|---|
| 507 | }
 | 
|---|
| 508 | 
 | 
|---|
| 509 | /******************************************************************************
 | 
|---|
| 510 |  *        AntiMoniker_RelativePathTo
 | 
|---|
| 511 |  ******************************************************************************/
 | 
|---|
| 512 | HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
 | 
|---|
| 513 | {
 | 
|---|
| 514 |     TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
 | 
|---|
| 515 | 
 | 
|---|
| 516 |     if (ppmkRelPath==NULL)
 | 
|---|
| 517 |         return E_POINTER;
 | 
|---|
| 518 | 
 | 
|---|
| 519 |     IMoniker_AddRef(pmOther);
 | 
|---|
| 520 | 
 | 
|---|
| 521 |     *ppmkRelPath=pmOther;
 | 
|---|
| 522 | 
 | 
|---|
| 523 |     return MK_S_HIM;
 | 
|---|
| 524 | }
 | 
|---|
| 525 | 
 | 
|---|
| 526 | /******************************************************************************
 | 
|---|
| 527 |  *        AntiMoniker_GetDisplayName
 | 
|---|
| 528 |  ******************************************************************************/
 | 
|---|
| 529 | HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,
 | 
|---|
| 530 |                                               IBindCtx* pbc,
 | 
|---|
| 531 |                                               IMoniker* pmkToLeft,
 | 
|---|
| 532 |                                               LPOLESTR *ppszDisplayName)
 | 
|---|
| 533 | {
 | 
|---|
| 534 |     WCHAR back[]={'\\','.','.',0};
 | 
|---|
| 535 |     
 | 
|---|
| 536 |     TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
 | 
|---|
| 537 | 
 | 
|---|
| 538 |     if (ppszDisplayName==NULL)
 | 
|---|
| 539 |         return E_POINTER;
 | 
|---|
| 540 | 
 | 
|---|
| 541 |     if (pmkToLeft!=NULL){
 | 
|---|
| 542 |         FIXME("() pmkToLeft!=NULL not implemented \n");
 | 
|---|
| 543 |         return E_NOTIMPL;
 | 
|---|
| 544 |     }
 | 
|---|
| 545 | 
 | 
|---|
| 546 |     *ppszDisplayName=(LPOLESTR)CoTaskMemAlloc(sizeof(back));
 | 
|---|
| 547 | 
 | 
|---|
| 548 |     if (*ppszDisplayName==NULL)
 | 
|---|
| 549 |         return E_OUTOFMEMORY;
 | 
|---|
| 550 | 
 | 
|---|
| 551 |     lstrcpyW(*ppszDisplayName,back);
 | 
|---|
| 552 |     
 | 
|---|
| 553 |     return S_OK;
 | 
|---|
| 554 | }
 | 
|---|
| 555 | 
 | 
|---|
| 556 | /******************************************************************************
 | 
|---|
| 557 |  *        AntiMoniker_ParseDisplayName
 | 
|---|
| 558 |  ******************************************************************************/
 | 
|---|
| 559 | HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,
 | 
|---|
| 560 |                                                 IBindCtx* pbc,
 | 
|---|
| 561 |                                                 IMoniker* pmkToLeft,
 | 
|---|
| 562 |                                                 LPOLESTR pszDisplayName,
 | 
|---|
| 563 |                                                 ULONG* pchEaten,
 | 
|---|
| 564 |                                                 IMoniker** ppmkOut)
 | 
|---|
| 565 | {
 | 
|---|
| 566 |     TRACE("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
 | 
|---|
| 567 |     return E_NOTIMPL;
 | 
|---|
| 568 | }
 | 
|---|
| 569 | 
 | 
|---|
| 570 | /******************************************************************************
 | 
|---|
| 571 |  *        AntiMoniker_IsSystemMonker
 | 
|---|
| 572 |  ******************************************************************************/
 | 
|---|
| 573 | HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
 | 
|---|
| 574 | {
 | 
|---|
| 575 |     TRACE("(%p,%p)\n",iface,pwdMksys);
 | 
|---|
| 576 | 
 | 
|---|
| 577 |     if (!pwdMksys)
 | 
|---|
| 578 |         return E_POINTER;
 | 
|---|
| 579 |     
 | 
|---|
| 580 |     (*pwdMksys)=MKSYS_ANTIMONIKER;
 | 
|---|
| 581 | 
 | 
|---|
| 582 |     return S_OK;
 | 
|---|
| 583 | }
 | 
|---|
| 584 | 
 | 
|---|
| 585 | /*******************************************************************************
 | 
|---|
| 586 |  *        AntiMonikerIROTData_QueryInterface
 | 
|---|
| 587 |  *******************************************************************************/
 | 
|---|
| 588 | HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject)
 | 
|---|
| 589 | {
 | 
|---|
| 590 | 
 | 
|---|
| 591 |     ICOM_THIS_From_IROTData(IMoniker, iface);
 | 
|---|
| 592 | 
 | 
|---|
| 593 |     TRACE("(%p,%p,%p)\n",iface,riid,ppvObject);
 | 
|---|
| 594 | 
 | 
|---|
| 595 |     return AntiMonikerImpl_QueryInterface(This, riid, ppvObject);
 | 
|---|
| 596 | }
 | 
|---|
| 597 | 
 | 
|---|
| 598 | /***********************************************************************
 | 
|---|
| 599 |  *        AntiMonikerIROTData_AddRef
 | 
|---|
| 600 |  */
 | 
|---|
| 601 | ULONG   WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface)
 | 
|---|
| 602 | {
 | 
|---|
| 603 |     ICOM_THIS_From_IROTData(IMoniker, iface);
 | 
|---|
| 604 | 
 | 
|---|
| 605 |     TRACE("(%p)\n",iface);
 | 
|---|
| 606 | 
 | 
|---|
| 607 |     return AntiMonikerImpl_AddRef(This);
 | 
|---|
| 608 | }
 | 
|---|
| 609 | 
 | 
|---|
| 610 | /***********************************************************************
 | 
|---|
| 611 |  *        AntiMonikerIROTData_Release
 | 
|---|
| 612 |  */
 | 
|---|
| 613 | ULONG   WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface)
 | 
|---|
| 614 | {
 | 
|---|
| 615 |     ICOM_THIS_From_IROTData(IMoniker, iface);
 | 
|---|
| 616 |     
 | 
|---|
| 617 |     TRACE("(%p)\n",iface);
 | 
|---|
| 618 | 
 | 
|---|
| 619 |     return AntiMonikerImpl_Release(This);
 | 
|---|
| 620 | }
 | 
|---|
| 621 | 
 | 
|---|
| 622 | /******************************************************************************
 | 
|---|
| 623 |  *        AntiMonikerIROTData_GetComparaisonData
 | 
|---|
| 624 |  ******************************************************************************/
 | 
|---|
| 625 | HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,
 | 
|---|
| 626 |                                                          BYTE* pbData,
 | 
|---|
| 627 |                                                          ULONG cbMax,
 | 
|---|
| 628 |                                                          ULONG* pcbData)
 | 
|---|
| 629 | {
 | 
|---|
| 630 |     FIXME("(),stub!\n");
 | 
|---|
| 631 |     return E_NOTIMPL;
 | 
|---|
| 632 | }
 | 
|---|
| 633 | 
 | 
|---|
| 634 | /******************************************************************************
 | 
|---|
| 635 |  *        CreateAntiMoniker     [OLE.55]
 | 
|---|
| 636 |  ******************************************************************************/
 | 
|---|
| 637 | HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
 | 
|---|
| 638 | {
 | 
|---|
| 639 |     AntiMonikerImpl* newAntiMoniker = 0;
 | 
|---|
| 640 |     HRESULT        hr = S_OK;
 | 
|---|
| 641 |     IID riid=IID_IMoniker;
 | 
|---|
| 642 |     
 | 
|---|
| 643 |     TRACE("(%p)\n",ppmk);
 | 
|---|
| 644 | 
 | 
|---|
| 645 |     newAntiMoniker = (AntiMonikerImpl*)HeapAlloc(GetProcessHeap(), 0, sizeof(AntiMonikerImpl));
 | 
|---|
| 646 | 
 | 
|---|
| 647 |     if (newAntiMoniker == 0)
 | 
|---|
| 648 |         return STG_E_INSUFFICIENTMEMORY;
 | 
|---|
| 649 | 
 | 
|---|
| 650 |     hr = AntiMonikerImpl_Construct(newAntiMoniker);
 | 
|---|
| 651 | 
 | 
|---|
| 652 |     if (FAILED(hr)){
 | 
|---|
| 653 | 
 | 
|---|
| 654 |         HeapFree(GetProcessHeap(),0,newAntiMoniker);
 | 
|---|
| 655 |         return hr;
 | 
|---|
| 656 |     }
 | 
|---|
| 657 | 
 | 
|---|
| 658 |     hr = AntiMonikerImpl_QueryInterface((IMoniker*)newAntiMoniker,&riid,(void**)ppmk);
 | 
|---|
| 659 | 
 | 
|---|
| 660 |     return hr;
 | 
|---|
| 661 | }
 | 
|---|