Get rid of the no longer used ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
[wine/multimedia.git] / dlls / ole32 / antimoniker.c
blob278bef55aaf7c5aad1cc29997307fdbbc51b5cb6
1 /***************************************************************************************
2 * AntiMonikers implementation
4 * Copyright 1999 Noomen Hamza
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ***************************************************************************************/
21 #include <assert.h>
22 #include <stdarg.h>
23 #include <string.h>
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winerror.h"
30 #include "wine/unicode.h"
31 #include "objbase.h"
32 #include "wine/debug.h"
33 #include "moniker.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(ole);
37 const CLSID CLSID_AntiMoniker = {
38 0x305, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46}
41 /* AntiMoniker data structure */
42 typedef struct AntiMonikerImpl{
44 IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
46 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
47 * two monikers are equal. That's whay IROTData interface is implemented by monikers.
49 IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
51 ULONG ref; /* reference counter for this object */
53 } AntiMonikerImpl;
55 /********************************************************************************/
56 /* AntiMoniker prototype functions : */
58 /* IUnknown prototype functions */
59 static HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject);
60 static ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface);
61 static ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface);
63 /* IPersist prototype functions */
64 static HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID);
66 /* IPersistStream prototype functions */
67 static HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface);
68 static HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface, IStream* pStm);
69 static HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty);
70 static HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize);
72 /* IMoniker prototype functions */
73 static HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
74 static HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
75 static HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced);
76 static HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite);
77 static HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker);
78 static HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker);
79 static HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash);
80 static HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning);
81 static HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pAntiTime);
82 static HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk);
83 static HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix);
84 static HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath);
85 static HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName);
86 static HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut);
87 static HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
89 /********************************************************************************/
90 /* IROTData prototype functions */
92 /* IUnknown prototype functions */
93 static HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData* iface,REFIID riid,VOID** ppvObject);
94 static ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData* iface);
95 static ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface);
97 /* IROTData prototype function */
98 static HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,BYTE* pbData,ULONG cbMax,ULONG* pcbData);
100 /* Local function used by AntiMoniker implementation */
101 HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* iface);
102 HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* iface);
104 /********************************************************************************/
105 /* Virtual function table for the AntiMonikerImpl class which include IPersist,*/
106 /* IPersistStream and IMoniker functions. */
107 static IMonikerVtbl VT_AntiMonikerImpl =
109 AntiMonikerImpl_QueryInterface,
110 AntiMonikerImpl_AddRef,
111 AntiMonikerImpl_Release,
112 AntiMonikerImpl_GetClassID,
113 AntiMonikerImpl_IsDirty,
114 AntiMonikerImpl_Load,
115 AntiMonikerImpl_Save,
116 AntiMonikerImpl_GetSizeMax,
117 AntiMonikerImpl_BindToObject,
118 AntiMonikerImpl_BindToStorage,
119 AntiMonikerImpl_Reduce,
120 AntiMonikerImpl_ComposeWith,
121 AntiMonikerImpl_Enum,
122 AntiMonikerImpl_IsEqual,
123 AntiMonikerImpl_Hash,
124 AntiMonikerImpl_IsRunning,
125 AntiMonikerImpl_GetTimeOfLastChange,
126 AntiMonikerImpl_Inverse,
127 AntiMonikerImpl_CommonPrefixWith,
128 AntiMonikerImpl_RelativePathTo,
129 AntiMonikerImpl_GetDisplayName,
130 AntiMonikerImpl_ParseDisplayName,
131 AntiMonikerImpl_IsSystemMoniker
134 /********************************************************************************/
135 /* Virtual function table for the IROTData class. */
136 static IROTDataVtbl VT_ROTDataImpl =
138 AntiMonikerROTDataImpl_QueryInterface,
139 AntiMonikerROTDataImpl_AddRef,
140 AntiMonikerROTDataImpl_Release,
141 AntiMonikerROTDataImpl_GetComparaisonData
144 /*******************************************************************************
145 * AntiMoniker_QueryInterface
146 *******************************************************************************/
147 HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
149 ICOM_THIS(AntiMonikerImpl,iface);
151 TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
153 /* Perform a sanity check on the parameters.*/
154 if ( (This==0) || (ppvObject==0) )
155 return E_INVALIDARG;
157 /* Initialize the return parameter */
158 *ppvObject = 0;
160 /* Compare the riid with the interface IDs implemented by this object.*/
161 if (IsEqualIID(&IID_IUnknown, riid) ||
162 IsEqualIID(&IID_IPersist, riid) ||
163 IsEqualIID(&IID_IPersistStream, riid) ||
164 IsEqualIID(&IID_IMoniker, riid)
166 *ppvObject = iface;
167 else if (IsEqualIID(&IID_IROTData, riid))
168 *ppvObject = (IROTData*)&(This->lpvtbl2);
170 /* Check that we obtained an interface.*/
171 if ((*ppvObject)==0)
172 return E_NOINTERFACE;
174 /* Query Interface always increases the reference count by one when it is successful */
175 AntiMonikerImpl_AddRef(iface);
177 return S_OK;
180 /******************************************************************************
181 * AntiMoniker_AddRef
182 ******************************************************************************/
183 ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface)
185 ICOM_THIS(AntiMonikerImpl,iface);
187 TRACE("(%p)\n",This);
189 return ++(This->ref);
192 /******************************************************************************
193 * AntiMoniker_Release
194 ******************************************************************************/
195 ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface)
197 ICOM_THIS(AntiMonikerImpl,iface);
199 TRACE("(%p)\n",This);
201 This->ref--;
203 /* destroy the object if there's no more reference on it */
204 if (This->ref==0){
206 AntiMonikerImpl_Destroy(This);
208 return 0;
210 return This->ref;
213 /******************************************************************************
214 * AntiMoniker_GetClassID
215 ******************************************************************************/
216 HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID)
218 TRACE("(%p,%p),stub!\n",iface,pClassID);
220 if (pClassID==NULL)
221 return E_POINTER;
223 *pClassID = CLSID_AntiMoniker;
225 return S_OK;
228 /******************************************************************************
229 * AntiMoniker_IsDirty
230 ******************************************************************************/
231 HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface)
233 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
234 method in the OLE-provided moniker interfaces always return S_FALSE because
235 their internal state never changes. */
237 TRACE("(%p)\n",iface);
239 return S_FALSE;
242 /******************************************************************************
243 * AntiMoniker_Load
244 ******************************************************************************/
245 HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface,IStream* pStm)
247 DWORD constant=1,dwbuffer;
248 HRESULT res;
250 /* data read by this function is only a DWORD constant (must be 1) ! */
251 res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),NULL);
253 if (SUCCEEDED(res)&& dwbuffer!=constant)
254 return E_FAIL;
256 return res;
259 /******************************************************************************
260 * AntiMoniker_Save
261 ******************************************************************************/
262 HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
264 DWORD constant=1;
265 HRESULT res;
267 /* data written by this function is only a DWORD constant set to 1 ! */
268 res=IStream_Write(pStm,&constant,sizeof(constant),NULL);
270 return res;
273 /******************************************************************************
274 * AntiMoniker_GetSizeMax
275 ******************************************************************************/
276 HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface,
277 ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
279 TRACE("(%p,%p)\n",iface,pcbSize);
281 if (pcbSize!=NULL)
282 return E_POINTER;
284 /* for more details see AntiMonikerImpl_Save coments */
286 /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */
287 /* more than the number of bytes used by AntiMoniker::Save function */
288 pcbSize->u.LowPart = sizeof(DWORD)+16;
290 pcbSize->u.HighPart=0;
292 return S_OK;
295 /******************************************************************************
296 * AntiMoniker_Construct (local function)
297 *******************************************************************************/
298 HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* This)
301 TRACE("(%p)\n",This);
303 /* Initialize the virtual fgunction table. */
304 This->lpvtbl1 = &VT_AntiMonikerImpl;
305 This->lpvtbl2 = &VT_ROTDataImpl;
306 This->ref = 0;
308 return S_OK;
311 /******************************************************************************
312 * AntiMoniker_Destroy (local function)
313 *******************************************************************************/
314 HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* This)
316 TRACE("(%p)\n",This);
318 return HeapFree(GetProcessHeap(),0,This);
321 /******************************************************************************
322 * AntiMoniker_BindToObject
323 ******************************************************************************/
324 HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,
325 IBindCtx* pbc,
326 IMoniker* pmkToLeft,
327 REFIID riid,
328 VOID** ppvResult)
330 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
331 return E_NOTIMPL;
334 /******************************************************************************
335 * AntiMoniker_BindToStorage
336 ******************************************************************************/
337 HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,
338 IBindCtx* pbc,
339 IMoniker* pmkToLeft,
340 REFIID riid,
341 VOID** ppvResult)
343 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
344 return E_NOTIMPL;
347 /******************************************************************************
348 * AntiMoniker_Reduce
349 ******************************************************************************/
350 HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,
351 IBindCtx* pbc,
352 DWORD dwReduceHowFar,
353 IMoniker** ppmkToLeft,
354 IMoniker** ppmkReduced)
356 TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
358 if (ppmkReduced==NULL)
359 return E_POINTER;
361 AntiMonikerImpl_AddRef(iface);
363 *ppmkReduced=iface;
365 return MK_S_REDUCED_TO_SELF;
367 /******************************************************************************
368 * AntiMoniker_ComposeWith
369 ******************************************************************************/
370 HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,
371 IMoniker* pmkRight,
372 BOOL fOnlyIfNotGeneric,
373 IMoniker** ppmkComposite)
376 TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
378 if ((ppmkComposite==NULL)||(pmkRight==NULL))
379 return E_POINTER;
381 *ppmkComposite=0;
383 if (fOnlyIfNotGeneric)
384 return MK_E_NEEDGENERIC;
385 else
386 return CreateGenericComposite(iface,pmkRight,ppmkComposite);
389 /******************************************************************************
390 * AntiMoniker_Enum
391 ******************************************************************************/
392 HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
394 TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
396 if (ppenumMoniker == NULL)
397 return E_POINTER;
399 *ppenumMoniker = NULL;
401 return S_OK;
404 /******************************************************************************
405 * AntiMoniker_IsEqual
406 ******************************************************************************/
407 HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
409 DWORD mkSys;
411 TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
413 if (pmkOtherMoniker==NULL)
414 return S_FALSE;
416 IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
418 if (mkSys==MKSYS_ANTIMONIKER)
419 return S_OK;
420 else
421 return S_FALSE;
424 /******************************************************************************
425 * AntiMoniker_Hash
426 ******************************************************************************/
427 HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
429 if (pdwHash==NULL)
430 return E_POINTER;
432 *pdwHash=0;
434 return S_OK;
437 /******************************************************************************
438 * AntiMoniker_IsRunning
439 ******************************************************************************/
440 HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,
441 IBindCtx* pbc,
442 IMoniker* pmkToLeft,
443 IMoniker* pmkNewlyRunning)
445 IRunningObjectTable* rot;
446 HRESULT res;
448 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning);
450 if (pbc==NULL)
451 return E_INVALIDARG;
453 res=IBindCtx_GetRunningObjectTable(pbc,&rot);
455 if (FAILED(res))
456 return res;
458 res = IRunningObjectTable_IsRunning(rot,iface);
460 IRunningObjectTable_Release(rot);
462 return res;
465 /******************************************************************************
466 * AntiMoniker_GetTimeOfLastChange
467 ******************************************************************************/
468 HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
469 IBindCtx* pbc,
470 IMoniker* pmkToLeft,
471 FILETIME* pAntiTime)
473 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime);
474 return E_NOTIMPL;
477 /******************************************************************************
478 * AntiMoniker_Inverse
479 ******************************************************************************/
480 HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
482 TRACE("(%p,%p)\n",iface,ppmk);
484 if (ppmk==NULL)
485 return E_POINTER;
487 *ppmk=0;
489 return MK_E_NOINVERSE;
492 /******************************************************************************
493 * AntiMoniker_CommonPrefixWith
494 ******************************************************************************/
495 HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
497 DWORD mkSys;
499 IMoniker_IsSystemMoniker(pmkOther,&mkSys);
501 if(mkSys==MKSYS_ITEMMONIKER){
503 IMoniker_AddRef(iface);
505 *ppmkPrefix=iface;
507 IMoniker_AddRef(iface);
509 return MK_S_US;
511 else
512 return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
515 /******************************************************************************
516 * AntiMoniker_RelativePathTo
517 ******************************************************************************/
518 HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
520 TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
522 if (ppmkRelPath==NULL)
523 return E_POINTER;
525 IMoniker_AddRef(pmOther);
527 *ppmkRelPath=pmOther;
529 return MK_S_HIM;
532 /******************************************************************************
533 * AntiMoniker_GetDisplayName
534 ******************************************************************************/
535 HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,
536 IBindCtx* pbc,
537 IMoniker* pmkToLeft,
538 LPOLESTR *ppszDisplayName)
540 static const WCHAR back[]={'\\','.','.',0};
542 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
544 if (ppszDisplayName==NULL)
545 return E_POINTER;
547 if (pmkToLeft!=NULL){
548 FIXME("() pmkToLeft!=NULL not implemented \n");
549 return E_NOTIMPL;
552 *ppszDisplayName=CoTaskMemAlloc(sizeof(back));
554 if (*ppszDisplayName==NULL)
555 return E_OUTOFMEMORY;
557 strcpyW(*ppszDisplayName,back);
559 return S_OK;
562 /******************************************************************************
563 * AntiMoniker_ParseDisplayName
564 ******************************************************************************/
565 HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,
566 IBindCtx* pbc,
567 IMoniker* pmkToLeft,
568 LPOLESTR pszDisplayName,
569 ULONG* pchEaten,
570 IMoniker** ppmkOut)
572 TRACE("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
573 return E_NOTIMPL;
576 /******************************************************************************
577 * AntiMoniker_IsSystemMoniker
578 ******************************************************************************/
579 HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
581 TRACE("(%p,%p)\n",iface,pwdMksys);
583 if (!pwdMksys)
584 return E_POINTER;
586 (*pwdMksys)=MKSYS_ANTIMONIKER;
588 return S_OK;
591 /*******************************************************************************
592 * AntiMonikerIROTData_QueryInterface
593 *******************************************************************************/
594 HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject)
597 ICOM_THIS_From_IROTData(IMoniker, iface);
599 TRACE("(%p,%p,%p)\n",iface,riid,ppvObject);
601 return AntiMonikerImpl_QueryInterface(This, riid, ppvObject);
604 /***********************************************************************
605 * AntiMonikerIROTData_AddRef
607 ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface)
609 ICOM_THIS_From_IROTData(IMoniker, iface);
611 TRACE("(%p)\n",iface);
613 return AntiMonikerImpl_AddRef(This);
616 /***********************************************************************
617 * AntiMonikerIROTData_Release
619 ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface)
621 ICOM_THIS_From_IROTData(IMoniker, iface);
623 TRACE("(%p)\n",iface);
625 return AntiMonikerImpl_Release(This);
628 /******************************************************************************
629 * AntiMonikerIROTData_GetComparaisonData
630 ******************************************************************************/
631 HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,
632 BYTE* pbData,
633 ULONG cbMax,
634 ULONG* pcbData)
636 FIXME("(),stub!\n");
637 return E_NOTIMPL;
640 /******************************************************************************
641 * CreateAntiMoniker [OLE32.@]
642 ******************************************************************************/
643 HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
645 AntiMonikerImpl* newAntiMoniker = 0;
646 HRESULT hr = S_OK;
647 IID riid=IID_IMoniker;
649 TRACE("(%p)\n",ppmk);
651 newAntiMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(AntiMonikerImpl));
653 if (newAntiMoniker == 0)
654 return STG_E_INSUFFICIENTMEMORY;
656 hr = AntiMonikerImpl_Construct(newAntiMoniker);
658 if (FAILED(hr)){
660 HeapFree(GetProcessHeap(),0,newAntiMoniker);
661 return hr;
664 hr = AntiMonikerImpl_QueryInterface((IMoniker*)newAntiMoniker,&riid,(void**)ppmk);
666 return hr;