Moved some definitions from include/wine/obj_moniker.h to
[wine/multimedia.git] / dlls / ole32 / antimoniker.c
blobcb56a7523cfb358c14be044b429fbb4bc1466dd3
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 <string.h>
23 #include "winbase.h"
24 #include "winerror.h"
25 #include "wine/unicode.h"
26 #include "objbase.h"
27 #include "wine/debug.h"
28 #include "moniker.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(ole);
32 const CLSID CLSID_AntiMoniker = {
33 0x305, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46}
36 /* AntiMoniker data structure */
37 typedef struct AntiMonikerImpl{
39 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/
41 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
42 * two monikers are equal. That's whay IROTData interface is implemented by monikers.
44 ICOM_VTABLE(IROTData)* lpvtbl2; /* VTable relative to the IROTData interface.*/
46 ULONG ref; /* reference counter for this object */
48 } AntiMonikerImpl;
50 /********************************************************************************/
51 /* AntiMoniker prototype functions : */
53 /* IUnknown prototype functions */
54 static HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject);
55 static ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface);
56 static ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface);
58 /* IPersist prototype functions */
59 static HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID);
61 /* IPersistStream prototype functions */
62 static HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface);
63 static HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface, IStream* pStm);
64 static HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty);
65 static HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize);
67 /* IMoniker prototype functions */
68 static HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
69 static HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
70 static HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced);
71 static HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite);
72 static HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker);
73 static HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker);
74 static HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash);
75 static HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning);
76 static HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pAntiTime);
77 static HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk);
78 static HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix);
79 static HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath);
80 static HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName);
81 static HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut);
82 static HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
84 /********************************************************************************/
85 /* IROTData prototype functions */
87 /* IUnknown prototype functions */
88 static HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData* iface,REFIID riid,VOID** ppvObject);
89 static ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData* iface);
90 static ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface);
92 /* IROTData prototype function */
93 static HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,BYTE* pbData,ULONG cbMax,ULONG* pcbData);
95 /* Local function used by AntiMoniker implementation */
96 HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* iface);
97 HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* iface);
99 /********************************************************************************/
100 /* Virtual function table for the AntiMonikerImpl class which include IPersist,*/
101 /* IPersistStream and IMoniker functions. */
102 static ICOM_VTABLE(IMoniker) VT_AntiMonikerImpl =
104 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
105 AntiMonikerImpl_QueryInterface,
106 AntiMonikerImpl_AddRef,
107 AntiMonikerImpl_Release,
108 AntiMonikerImpl_GetClassID,
109 AntiMonikerImpl_IsDirty,
110 AntiMonikerImpl_Load,
111 AntiMonikerImpl_Save,
112 AntiMonikerImpl_GetSizeMax,
113 AntiMonikerImpl_BindToObject,
114 AntiMonikerImpl_BindToStorage,
115 AntiMonikerImpl_Reduce,
116 AntiMonikerImpl_ComposeWith,
117 AntiMonikerImpl_Enum,
118 AntiMonikerImpl_IsEqual,
119 AntiMonikerImpl_Hash,
120 AntiMonikerImpl_IsRunning,
121 AntiMonikerImpl_GetTimeOfLastChange,
122 AntiMonikerImpl_Inverse,
123 AntiMonikerImpl_CommonPrefixWith,
124 AntiMonikerImpl_RelativePathTo,
125 AntiMonikerImpl_GetDisplayName,
126 AntiMonikerImpl_ParseDisplayName,
127 AntiMonikerImpl_IsSystemMoniker
130 /********************************************************************************/
131 /* Virtual function table for the IROTData class. */
132 static ICOM_VTABLE(IROTData) VT_ROTDataImpl =
134 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
135 AntiMonikerROTDataImpl_QueryInterface,
136 AntiMonikerROTDataImpl_AddRef,
137 AntiMonikerROTDataImpl_Release,
138 AntiMonikerROTDataImpl_GetComparaisonData
141 /*******************************************************************************
142 * AntiMoniker_QueryInterface
143 *******************************************************************************/
144 HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
146 ICOM_THIS(AntiMonikerImpl,iface);
148 TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
150 /* Perform a sanity check on the parameters.*/
151 if ( (This==0) || (ppvObject==0) )
152 return E_INVALIDARG;
154 /* Initialize the return parameter */
155 *ppvObject = 0;
157 /* Compare the riid with the interface IDs implemented by this object.*/
158 if (IsEqualIID(&IID_IUnknown, riid) ||
159 IsEqualIID(&IID_IPersist, riid) ||
160 IsEqualIID(&IID_IPersistStream, riid) ||
161 IsEqualIID(&IID_IMoniker, riid)
163 *ppvObject = iface;
164 else if (IsEqualIID(&IID_IROTData, riid))
165 *ppvObject = (IROTData*)&(This->lpvtbl2);
167 /* Check that we obtained an interface.*/
168 if ((*ppvObject)==0)
169 return E_NOINTERFACE;
171 /* Query Interface always increases the reference count by one when it is successful */
172 AntiMonikerImpl_AddRef(iface);
174 return S_OK;
177 /******************************************************************************
178 * AntiMoniker_AddRef
179 ******************************************************************************/
180 ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface)
182 ICOM_THIS(AntiMonikerImpl,iface);
184 TRACE("(%p)\n",This);
186 return ++(This->ref);
189 /******************************************************************************
190 * AntiMoniker_Release
191 ******************************************************************************/
192 ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface)
194 ICOM_THIS(AntiMonikerImpl,iface);
196 TRACE("(%p)\n",This);
198 This->ref--;
200 /* destroy the object if there's no more reference on it */
201 if (This->ref==0){
203 AntiMonikerImpl_Destroy(This);
205 return 0;
207 return This->ref;
210 /******************************************************************************
211 * AntiMoniker_GetClassID
212 ******************************************************************************/
213 HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID)
215 TRACE("(%p,%p),stub!\n",iface,pClassID);
217 if (pClassID==NULL)
218 return E_POINTER;
220 *pClassID = CLSID_AntiMoniker;
222 return S_OK;
225 /******************************************************************************
226 * AntiMoniker_IsDirty
227 ******************************************************************************/
228 HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface)
230 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
231 method in the OLE-provided moniker interfaces always return S_FALSE because
232 their internal state never changes. */
234 TRACE("(%p)\n",iface);
236 return S_FALSE;
239 /******************************************************************************
240 * AntiMoniker_Load
241 ******************************************************************************/
242 HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface,IStream* pStm)
244 DWORD constant=1,dwbuffer;
245 HRESULT res;
247 /* data read by this function is only a DWORD constant (must be 1) ! */
248 res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),NULL);
250 if (SUCCEEDED(res)&& dwbuffer!=constant)
251 return E_FAIL;
253 return res;
256 /******************************************************************************
257 * AntiMoniker_Save
258 ******************************************************************************/
259 HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
261 DWORD constant=1;
262 HRESULT res;
264 /* data writen by this function is only a DWORD constant seted to 1 ! */
265 res=IStream_Write(pStm,&constant,sizeof(constant),NULL);
267 return res;
270 /******************************************************************************
271 * AntiMoniker_GetSizeMax
272 ******************************************************************************/
273 HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface,
274 ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
276 TRACE("(%p,%p)\n",iface,pcbSize);
278 if (pcbSize!=NULL)
279 return E_POINTER;
281 /* for more details see AntiMonikerImpl_Save coments */
283 /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */
284 /* more than the number of bytes used by AntiMoniker::Save function */
285 pcbSize->s.LowPart = sizeof(DWORD)+16;
287 pcbSize->s.HighPart=0;
289 return S_OK;
292 /******************************************************************************
293 * AntiMoniker_Construct (local function)
294 *******************************************************************************/
295 HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* This)
298 TRACE("(%p)\n",This);
300 /* Initialize the virtual fgunction table. */
301 This->lpvtbl1 = &VT_AntiMonikerImpl;
302 This->lpvtbl2 = &VT_ROTDataImpl;
303 This->ref = 0;
305 return S_OK;
308 /******************************************************************************
309 * AntiMoniker_Destroy (local function)
310 *******************************************************************************/
311 HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* This)
313 TRACE("(%p)\n",This);
315 return HeapFree(GetProcessHeap(),0,This);
318 /******************************************************************************
319 * AntiMoniker_BindToObject
320 ******************************************************************************/
321 HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,
322 IBindCtx* pbc,
323 IMoniker* pmkToLeft,
324 REFIID riid,
325 VOID** ppvResult)
327 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
328 return E_NOTIMPL;
331 /******************************************************************************
332 * AntiMoniker_BindToStorage
333 ******************************************************************************/
334 HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,
335 IBindCtx* pbc,
336 IMoniker* pmkToLeft,
337 REFIID riid,
338 VOID** ppvResult)
340 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
341 return E_NOTIMPL;
344 /******************************************************************************
345 * AntiMoniker_Reduce
346 ******************************************************************************/
347 HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,
348 IBindCtx* pbc,
349 DWORD dwReduceHowFar,
350 IMoniker** ppmkToLeft,
351 IMoniker** ppmkReduced)
353 TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
355 if (ppmkReduced==NULL)
356 return E_POINTER;
358 AntiMonikerImpl_AddRef(iface);
360 *ppmkReduced=iface;
362 return MK_S_REDUCED_TO_SELF;
364 /******************************************************************************
365 * AntiMoniker_ComposeWith
366 ******************************************************************************/
367 HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,
368 IMoniker* pmkRight,
369 BOOL fOnlyIfNotGeneric,
370 IMoniker** ppmkComposite)
373 TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
375 if ((ppmkComposite==NULL)||(pmkRight==NULL))
376 return E_POINTER;
378 *ppmkComposite=0;
380 if (fOnlyIfNotGeneric)
381 return MK_E_NEEDGENERIC;
382 else
383 return CreateGenericComposite(iface,pmkRight,ppmkComposite);
386 /******************************************************************************
387 * AntiMoniker_Enum
388 ******************************************************************************/
389 HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
391 TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
393 if (ppenumMoniker == NULL)
394 return E_POINTER;
396 *ppenumMoniker = NULL;
398 return S_OK;
401 /******************************************************************************
402 * AntiMoniker_IsEqual
403 ******************************************************************************/
404 HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
406 DWORD mkSys;
408 TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
410 if (pmkOtherMoniker==NULL)
411 return S_FALSE;
413 IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
415 if (mkSys==MKSYS_ANTIMONIKER)
416 return S_OK;
417 else
418 return S_FALSE;
421 /******************************************************************************
422 * AntiMoniker_Hash
423 ******************************************************************************/
424 HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
426 if (pdwHash==NULL)
427 return E_POINTER;
429 *pdwHash=0;
431 return S_OK;
434 /******************************************************************************
435 * AntiMoniker_IsRunning
436 ******************************************************************************/
437 HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,
438 IBindCtx* pbc,
439 IMoniker* pmkToLeft,
440 IMoniker* pmkNewlyRunning)
442 IRunningObjectTable* rot;
443 HRESULT res;
445 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning);
447 if (pbc==NULL)
448 return E_INVALIDARG;
450 res=IBindCtx_GetRunningObjectTable(pbc,&rot);
452 if (FAILED(res))
453 return res;
455 res = IRunningObjectTable_IsRunning(rot,iface);
457 IRunningObjectTable_Release(rot);
459 return res;
462 /******************************************************************************
463 * AntiMoniker_GetTimeOfLastChange
464 ******************************************************************************/
465 HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
466 IBindCtx* pbc,
467 IMoniker* pmkToLeft,
468 FILETIME* pAntiTime)
470 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime);
471 return E_NOTIMPL;
474 /******************************************************************************
475 * AntiMoniker_Inverse
476 ******************************************************************************/
477 HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
479 TRACE("(%p,%p)\n",iface,ppmk);
481 if (ppmk==NULL)
482 return E_POINTER;
484 *ppmk=0;
486 return MK_E_NOINVERSE;
489 /******************************************************************************
490 * AntiMoniker_CommonPrefixWith
491 ******************************************************************************/
492 HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
494 DWORD mkSys;
496 IMoniker_IsSystemMoniker(pmkOther,&mkSys);
498 if(mkSys==MKSYS_ITEMMONIKER){
500 IMoniker_AddRef(iface);
502 *ppmkPrefix=iface;
504 IMoniker_AddRef(iface);
506 return MK_S_US;
508 else
509 return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
512 /******************************************************************************
513 * AntiMoniker_RelativePathTo
514 ******************************************************************************/
515 HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
517 TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
519 if (ppmkRelPath==NULL)
520 return E_POINTER;
522 IMoniker_AddRef(pmOther);
524 *ppmkRelPath=pmOther;
526 return MK_S_HIM;
529 /******************************************************************************
530 * AntiMoniker_GetDisplayName
531 ******************************************************************************/
532 HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,
533 IBindCtx* pbc,
534 IMoniker* pmkToLeft,
535 LPOLESTR *ppszDisplayName)
537 WCHAR back[]={'\\','.','.',0};
539 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
541 if (ppszDisplayName==NULL)
542 return E_POINTER;
544 if (pmkToLeft!=NULL){
545 FIXME("() pmkToLeft!=NULL not implemented \n");
546 return E_NOTIMPL;
549 *ppszDisplayName=CoTaskMemAlloc(sizeof(back));
551 if (*ppszDisplayName==NULL)
552 return E_OUTOFMEMORY;
554 strcpyW(*ppszDisplayName,back);
556 return S_OK;
559 /******************************************************************************
560 * AntiMoniker_ParseDisplayName
561 ******************************************************************************/
562 HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,
563 IBindCtx* pbc,
564 IMoniker* pmkToLeft,
565 LPOLESTR pszDisplayName,
566 ULONG* pchEaten,
567 IMoniker** ppmkOut)
569 TRACE("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
570 return E_NOTIMPL;
573 /******************************************************************************
574 * AntiMoniker_IsSystemMoniker
575 ******************************************************************************/
576 HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
578 TRACE("(%p,%p)\n",iface,pwdMksys);
580 if (!pwdMksys)
581 return E_POINTER;
583 (*pwdMksys)=MKSYS_ANTIMONIKER;
585 return S_OK;
588 /*******************************************************************************
589 * AntiMonikerIROTData_QueryInterface
590 *******************************************************************************/
591 HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject)
594 ICOM_THIS_From_IROTData(IMoniker, iface);
596 TRACE("(%p,%p,%p)\n",iface,riid,ppvObject);
598 return AntiMonikerImpl_QueryInterface(This, riid, ppvObject);
601 /***********************************************************************
602 * AntiMonikerIROTData_AddRef
604 ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface)
606 ICOM_THIS_From_IROTData(IMoniker, iface);
608 TRACE("(%p)\n",iface);
610 return AntiMonikerImpl_AddRef(This);
613 /***********************************************************************
614 * AntiMonikerIROTData_Release
616 ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface)
618 ICOM_THIS_From_IROTData(IMoniker, iface);
620 TRACE("(%p)\n",iface);
622 return AntiMonikerImpl_Release(This);
625 /******************************************************************************
626 * AntiMonikerIROTData_GetComparaisonData
627 ******************************************************************************/
628 HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,
629 BYTE* pbData,
630 ULONG cbMax,
631 ULONG* pcbData)
633 FIXME("(),stub!\n");
634 return E_NOTIMPL;
637 /******************************************************************************
638 * CreateAntiMoniker [OLE32.51]
639 ******************************************************************************/
640 HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
642 AntiMonikerImpl* newAntiMoniker = 0;
643 HRESULT hr = S_OK;
644 IID riid=IID_IMoniker;
646 TRACE("(%p)\n",ppmk);
648 newAntiMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(AntiMonikerImpl));
650 if (newAntiMoniker == 0)
651 return STG_E_INSUFFICIENTMEMORY;
653 hr = AntiMonikerImpl_Construct(newAntiMoniker);
655 if (FAILED(hr)){
657 HeapFree(GetProcessHeap(),0,newAntiMoniker);
658 return hr;
661 hr = AntiMonikerImpl_QueryInterface((IMoniker*)newAntiMoniker,&riid,(void**)ppmk);
663 return hr;