Added hack to call CreateFileW through a pointer so that we don't need
[wine/multimedia.git] / dlls / ole32 / antimoniker.c
blobcfa66b637595ce7baddf851bf9866fe555a6c52d
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 ICOM_VTABLE(IMoniker)* 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 ICOM_VTABLE(IROTData)* 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 ICOM_VTABLE(IMoniker) VT_AntiMonikerImpl =
109 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
110 AntiMonikerImpl_QueryInterface,
111 AntiMonikerImpl_AddRef,
112 AntiMonikerImpl_Release,
113 AntiMonikerImpl_GetClassID,
114 AntiMonikerImpl_IsDirty,
115 AntiMonikerImpl_Load,
116 AntiMonikerImpl_Save,
117 AntiMonikerImpl_GetSizeMax,
118 AntiMonikerImpl_BindToObject,
119 AntiMonikerImpl_BindToStorage,
120 AntiMonikerImpl_Reduce,
121 AntiMonikerImpl_ComposeWith,
122 AntiMonikerImpl_Enum,
123 AntiMonikerImpl_IsEqual,
124 AntiMonikerImpl_Hash,
125 AntiMonikerImpl_IsRunning,
126 AntiMonikerImpl_GetTimeOfLastChange,
127 AntiMonikerImpl_Inverse,
128 AntiMonikerImpl_CommonPrefixWith,
129 AntiMonikerImpl_RelativePathTo,
130 AntiMonikerImpl_GetDisplayName,
131 AntiMonikerImpl_ParseDisplayName,
132 AntiMonikerImpl_IsSystemMoniker
135 /********************************************************************************/
136 /* Virtual function table for the IROTData class. */
137 static ICOM_VTABLE(IROTData) VT_ROTDataImpl =
139 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
140 AntiMonikerROTDataImpl_QueryInterface,
141 AntiMonikerROTDataImpl_AddRef,
142 AntiMonikerROTDataImpl_Release,
143 AntiMonikerROTDataImpl_GetComparaisonData
146 /*******************************************************************************
147 * AntiMoniker_QueryInterface
148 *******************************************************************************/
149 HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
151 ICOM_THIS(AntiMonikerImpl,iface);
153 TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
155 /* Perform a sanity check on the parameters.*/
156 if ( (This==0) || (ppvObject==0) )
157 return E_INVALIDARG;
159 /* Initialize the return parameter */
160 *ppvObject = 0;
162 /* Compare the riid with the interface IDs implemented by this object.*/
163 if (IsEqualIID(&IID_IUnknown, riid) ||
164 IsEqualIID(&IID_IPersist, riid) ||
165 IsEqualIID(&IID_IPersistStream, riid) ||
166 IsEqualIID(&IID_IMoniker, riid)
168 *ppvObject = iface;
169 else if (IsEqualIID(&IID_IROTData, riid))
170 *ppvObject = (IROTData*)&(This->lpvtbl2);
172 /* Check that we obtained an interface.*/
173 if ((*ppvObject)==0)
174 return E_NOINTERFACE;
176 /* Query Interface always increases the reference count by one when it is successful */
177 AntiMonikerImpl_AddRef(iface);
179 return S_OK;
182 /******************************************************************************
183 * AntiMoniker_AddRef
184 ******************************************************************************/
185 ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface)
187 ICOM_THIS(AntiMonikerImpl,iface);
189 TRACE("(%p)\n",This);
191 return ++(This->ref);
194 /******************************************************************************
195 * AntiMoniker_Release
196 ******************************************************************************/
197 ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface)
199 ICOM_THIS(AntiMonikerImpl,iface);
201 TRACE("(%p)\n",This);
203 This->ref--;
205 /* destroy the object if there's no more reference on it */
206 if (This->ref==0){
208 AntiMonikerImpl_Destroy(This);
210 return 0;
212 return This->ref;
215 /******************************************************************************
216 * AntiMoniker_GetClassID
217 ******************************************************************************/
218 HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID)
220 TRACE("(%p,%p),stub!\n",iface,pClassID);
222 if (pClassID==NULL)
223 return E_POINTER;
225 *pClassID = CLSID_AntiMoniker;
227 return S_OK;
230 /******************************************************************************
231 * AntiMoniker_IsDirty
232 ******************************************************************************/
233 HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface)
235 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
236 method in the OLE-provided moniker interfaces always return S_FALSE because
237 their internal state never changes. */
239 TRACE("(%p)\n",iface);
241 return S_FALSE;
244 /******************************************************************************
245 * AntiMoniker_Load
246 ******************************************************************************/
247 HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface,IStream* pStm)
249 DWORD constant=1,dwbuffer;
250 HRESULT res;
252 /* data read by this function is only a DWORD constant (must be 1) ! */
253 res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),NULL);
255 if (SUCCEEDED(res)&& dwbuffer!=constant)
256 return E_FAIL;
258 return res;
261 /******************************************************************************
262 * AntiMoniker_Save
263 ******************************************************************************/
264 HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
266 DWORD constant=1;
267 HRESULT res;
269 /* data written by this function is only a DWORD constant set to 1 ! */
270 res=IStream_Write(pStm,&constant,sizeof(constant),NULL);
272 return res;
275 /******************************************************************************
276 * AntiMoniker_GetSizeMax
277 ******************************************************************************/
278 HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface,
279 ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
281 TRACE("(%p,%p)\n",iface,pcbSize);
283 if (pcbSize!=NULL)
284 return E_POINTER;
286 /* for more details see AntiMonikerImpl_Save coments */
288 /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */
289 /* more than the number of bytes used by AntiMoniker::Save function */
290 pcbSize->s.LowPart = sizeof(DWORD)+16;
292 pcbSize->s.HighPart=0;
294 return S_OK;
297 /******************************************************************************
298 * AntiMoniker_Construct (local function)
299 *******************************************************************************/
300 HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* This)
303 TRACE("(%p)\n",This);
305 /* Initialize the virtual fgunction table. */
306 This->lpvtbl1 = &VT_AntiMonikerImpl;
307 This->lpvtbl2 = &VT_ROTDataImpl;
308 This->ref = 0;
310 return S_OK;
313 /******************************************************************************
314 * AntiMoniker_Destroy (local function)
315 *******************************************************************************/
316 HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* This)
318 TRACE("(%p)\n",This);
320 return HeapFree(GetProcessHeap(),0,This);
323 /******************************************************************************
324 * AntiMoniker_BindToObject
325 ******************************************************************************/
326 HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,
327 IBindCtx* pbc,
328 IMoniker* pmkToLeft,
329 REFIID riid,
330 VOID** ppvResult)
332 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
333 return E_NOTIMPL;
336 /******************************************************************************
337 * AntiMoniker_BindToStorage
338 ******************************************************************************/
339 HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,
340 IBindCtx* pbc,
341 IMoniker* pmkToLeft,
342 REFIID riid,
343 VOID** ppvResult)
345 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
346 return E_NOTIMPL;
349 /******************************************************************************
350 * AntiMoniker_Reduce
351 ******************************************************************************/
352 HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,
353 IBindCtx* pbc,
354 DWORD dwReduceHowFar,
355 IMoniker** ppmkToLeft,
356 IMoniker** ppmkReduced)
358 TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
360 if (ppmkReduced==NULL)
361 return E_POINTER;
363 AntiMonikerImpl_AddRef(iface);
365 *ppmkReduced=iface;
367 return MK_S_REDUCED_TO_SELF;
369 /******************************************************************************
370 * AntiMoniker_ComposeWith
371 ******************************************************************************/
372 HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,
373 IMoniker* pmkRight,
374 BOOL fOnlyIfNotGeneric,
375 IMoniker** ppmkComposite)
378 TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
380 if ((ppmkComposite==NULL)||(pmkRight==NULL))
381 return E_POINTER;
383 *ppmkComposite=0;
385 if (fOnlyIfNotGeneric)
386 return MK_E_NEEDGENERIC;
387 else
388 return CreateGenericComposite(iface,pmkRight,ppmkComposite);
391 /******************************************************************************
392 * AntiMoniker_Enum
393 ******************************************************************************/
394 HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
396 TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
398 if (ppenumMoniker == NULL)
399 return E_POINTER;
401 *ppenumMoniker = NULL;
403 return S_OK;
406 /******************************************************************************
407 * AntiMoniker_IsEqual
408 ******************************************************************************/
409 HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
411 DWORD mkSys;
413 TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
415 if (pmkOtherMoniker==NULL)
416 return S_FALSE;
418 IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
420 if (mkSys==MKSYS_ANTIMONIKER)
421 return S_OK;
422 else
423 return S_FALSE;
426 /******************************************************************************
427 * AntiMoniker_Hash
428 ******************************************************************************/
429 HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
431 if (pdwHash==NULL)
432 return E_POINTER;
434 *pdwHash=0;
436 return S_OK;
439 /******************************************************************************
440 * AntiMoniker_IsRunning
441 ******************************************************************************/
442 HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,
443 IBindCtx* pbc,
444 IMoniker* pmkToLeft,
445 IMoniker* pmkNewlyRunning)
447 IRunningObjectTable* rot;
448 HRESULT res;
450 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning);
452 if (pbc==NULL)
453 return E_INVALIDARG;
455 res=IBindCtx_GetRunningObjectTable(pbc,&rot);
457 if (FAILED(res))
458 return res;
460 res = IRunningObjectTable_IsRunning(rot,iface);
462 IRunningObjectTable_Release(rot);
464 return res;
467 /******************************************************************************
468 * AntiMoniker_GetTimeOfLastChange
469 ******************************************************************************/
470 HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
471 IBindCtx* pbc,
472 IMoniker* pmkToLeft,
473 FILETIME* pAntiTime)
475 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime);
476 return E_NOTIMPL;
479 /******************************************************************************
480 * AntiMoniker_Inverse
481 ******************************************************************************/
482 HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
484 TRACE("(%p,%p)\n",iface,ppmk);
486 if (ppmk==NULL)
487 return E_POINTER;
489 *ppmk=0;
491 return MK_E_NOINVERSE;
494 /******************************************************************************
495 * AntiMoniker_CommonPrefixWith
496 ******************************************************************************/
497 HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
499 DWORD mkSys;
501 IMoniker_IsSystemMoniker(pmkOther,&mkSys);
503 if(mkSys==MKSYS_ITEMMONIKER){
505 IMoniker_AddRef(iface);
507 *ppmkPrefix=iface;
509 IMoniker_AddRef(iface);
511 return MK_S_US;
513 else
514 return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
517 /******************************************************************************
518 * AntiMoniker_RelativePathTo
519 ******************************************************************************/
520 HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
522 TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
524 if (ppmkRelPath==NULL)
525 return E_POINTER;
527 IMoniker_AddRef(pmOther);
529 *ppmkRelPath=pmOther;
531 return MK_S_HIM;
534 /******************************************************************************
535 * AntiMoniker_GetDisplayName
536 ******************************************************************************/
537 HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,
538 IBindCtx* pbc,
539 IMoniker* pmkToLeft,
540 LPOLESTR *ppszDisplayName)
542 WCHAR back[]={'\\','.','.',0};
544 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
546 if (ppszDisplayName==NULL)
547 return E_POINTER;
549 if (pmkToLeft!=NULL){
550 FIXME("() pmkToLeft!=NULL not implemented \n");
551 return E_NOTIMPL;
554 *ppszDisplayName=CoTaskMemAlloc(sizeof(back));
556 if (*ppszDisplayName==NULL)
557 return E_OUTOFMEMORY;
559 strcpyW(*ppszDisplayName,back);
561 return S_OK;
564 /******************************************************************************
565 * AntiMoniker_ParseDisplayName
566 ******************************************************************************/
567 HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,
568 IBindCtx* pbc,
569 IMoniker* pmkToLeft,
570 LPOLESTR pszDisplayName,
571 ULONG* pchEaten,
572 IMoniker** ppmkOut)
574 TRACE("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
575 return E_NOTIMPL;
578 /******************************************************************************
579 * AntiMoniker_IsSystemMoniker
580 ******************************************************************************/
581 HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
583 TRACE("(%p,%p)\n",iface,pwdMksys);
585 if (!pwdMksys)
586 return E_POINTER;
588 (*pwdMksys)=MKSYS_ANTIMONIKER;
590 return S_OK;
593 /*******************************************************************************
594 * AntiMonikerIROTData_QueryInterface
595 *******************************************************************************/
596 HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject)
599 ICOM_THIS_From_IROTData(IMoniker, iface);
601 TRACE("(%p,%p,%p)\n",iface,riid,ppvObject);
603 return AntiMonikerImpl_QueryInterface(This, riid, ppvObject);
606 /***********************************************************************
607 * AntiMonikerIROTData_AddRef
609 ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface)
611 ICOM_THIS_From_IROTData(IMoniker, iface);
613 TRACE("(%p)\n",iface);
615 return AntiMonikerImpl_AddRef(This);
618 /***********************************************************************
619 * AntiMonikerIROTData_Release
621 ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface)
623 ICOM_THIS_From_IROTData(IMoniker, iface);
625 TRACE("(%p)\n",iface);
627 return AntiMonikerImpl_Release(This);
630 /******************************************************************************
631 * AntiMonikerIROTData_GetComparaisonData
632 ******************************************************************************/
633 HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,
634 BYTE* pbData,
635 ULONG cbMax,
636 ULONG* pcbData)
638 FIXME("(),stub!\n");
639 return E_NOTIMPL;
642 /******************************************************************************
643 * CreateAntiMoniker [OLE32.@]
644 ******************************************************************************/
645 HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
647 AntiMonikerImpl* newAntiMoniker = 0;
648 HRESULT hr = S_OK;
649 IID riid=IID_IMoniker;
651 TRACE("(%p)\n",ppmk);
653 newAntiMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(AntiMonikerImpl));
655 if (newAntiMoniker == 0)
656 return STG_E_INSUFFICIENTMEMORY;
658 hr = AntiMonikerImpl_Construct(newAntiMoniker);
660 if (FAILED(hr)){
662 HeapFree(GetProcessHeap(),0,newAntiMoniker);
663 return hr;
666 hr = AntiMonikerImpl_QueryInterface((IMoniker*)newAntiMoniker,&riid,(void**)ppmk);
668 return hr;