6 * Copyright (C) 2002 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(comimpl);
42 * URL Moniker supports the following protocols(at least):
46 * CLSID_GopherProtocol
52 typedef struct CURLMonikerImpl
54 COMIMPL_IUnkImpl vfunk;
55 struct { ICOM_VFIELD(IMoniker); } moniker;
56 struct { ICOM_VFIELD(IROTData); } rotd;
61 #define CURLMonikerImpl_THIS(iface,member) CURLMonikerImpl* This = ((CURLMonikerImpl*)(((char*)iface)-offsetof(CURLMonikerImpl,member)))
65 IMoniker_fnQueryInterface(IMoniker* iface,REFIID riid,void** ppobj)
67 CURLMonikerImpl_THIS(iface,moniker);
69 TRACE("(%p)->()\n",This);
71 return IUnknown_QueryInterface(This->vfunk.punkControl,riid,ppobj);
75 IMoniker_fnAddRef(IMoniker* iface)
77 CURLMonikerImpl_THIS(iface,moniker);
79 TRACE("(%p)->()\n",This);
81 return IUnknown_AddRef(This->vfunk.punkControl);
85 IMoniker_fnRelease(IMoniker* iface)
87 CURLMonikerImpl_THIS(iface,moniker);
89 TRACE("(%p)->()\n",This);
91 return IUnknown_Release(This->vfunk.punkControl);
94 static HRESULT WINAPI IMoniker_fnGetClassID(IMoniker* iface, CLSID *pClassID)
96 CURLMonikerImpl_THIS(iface,moniker);
98 FIXME("(%p)->() stub\n",This);
102 TRACE("(%p)->()\n",This);
104 if ( pClassID == NULL )
106 memcpy( pClassID, &CLSID_StdURLMoniker, sizeof(CLSID) );
112 static HRESULT WINAPI IMoniker_fnIsDirty(IMoniker* iface)
114 CURLMonikerImpl_THIS(iface,moniker);
116 FIXME("(%p)->() stub!\n",This);
121 static HRESULT WINAPI IMoniker_fnLoad(IMoniker* iface, IStream* pStm)
123 CURLMonikerImpl_THIS(iface,moniker);
125 FIXME("(%p)->() stub!\n",This);
130 static HRESULT WINAPI IMoniker_fnSave(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
132 CURLMonikerImpl_THIS(iface,moniker);
134 FIXME("(%p)->() stub!\n",This);
139 static HRESULT WINAPI IMoniker_fnGetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
141 CURLMonikerImpl_THIS(iface,moniker);
143 FIXME("(%p)->() stub!\n",This);
148 static HRESULT WINAPI IMoniker_fnBindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult)
150 CURLMonikerImpl_THIS(iface,moniker);
152 FIXME("(%p)->(%p,%p,%s,%p)\n",This,
153 pbc,pmkToLeft,debugstr_guid(riid),ppvResult);
158 static HRESULT WINAPI IMoniker_fnBindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult)
160 CURLMonikerImpl_THIS(iface,moniker);
162 FIXME("(%p)->(%p,%p,%s,%p)\n",This,
163 pbc,pmkToLeft,debugstr_guid(riid),ppvResult);
168 static HRESULT WINAPI IMoniker_fnReduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced)
170 CURLMonikerImpl_THIS(iface,moniker);
172 FIXME("(%p)->() stub!\n",This);
177 static HRESULT WINAPI IMoniker_fnComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite)
179 CURLMonikerImpl_THIS(iface,moniker);
181 FIXME("(%p)->() stub!\n",This);
186 static HRESULT WINAPI IMoniker_fnEnum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
188 CURLMonikerImpl_THIS(iface,moniker);
190 FIXME("(%p)->() stub!\n",This);
195 static HRESULT WINAPI IMoniker_fnIsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
197 CURLMonikerImpl_THIS(iface,moniker);
199 FIXME("(%p)->() stub!\n",This);
204 static HRESULT WINAPI IMoniker_fnHash(IMoniker* iface,DWORD* pdwHash)
206 CURLMonikerImpl_THIS(iface,moniker);
208 FIXME("(%p)->() stub!\n",This);
213 static HRESULT WINAPI IMoniker_fnIsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning)
215 CURLMonikerImpl_THIS(iface,moniker);
217 FIXME("(%p)->() stub!\n",This);
222 static HRESULT WINAPI IMoniker_fnGetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pCompositeTime)
224 CURLMonikerImpl_THIS(iface,moniker);
226 FIXME("(%p)->() stub!\n",This);
231 static HRESULT WINAPI IMoniker_fnInverse(IMoniker* iface,IMoniker** ppmk)
233 CURLMonikerImpl_THIS(iface,moniker);
235 FIXME("(%p)->() stub!\n",This);
240 static HRESULT WINAPI IMoniker_fnCommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix)
242 CURLMonikerImpl_THIS(iface,moniker);
244 FIXME("(%p)->() stub!\n",This);
249 static HRESULT WINAPI IMoniker_fnRelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
251 CURLMonikerImpl_THIS(iface,moniker);
253 FIXME("(%p)->() stub!\n",This);
258 static HRESULT WINAPI IMoniker_fnGetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName)
260 CURLMonikerImpl_THIS(iface,moniker);
262 FIXME("(%p)->() stub!\n",This);
267 static HRESULT WINAPI IMoniker_fnParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut)
269 CURLMonikerImpl_THIS(iface,moniker);
271 FIXME("(%p)->() stub!\n",This);
276 static HRESULT WINAPI IMoniker_fnIsSystemMoniker(IMoniker* iface,DWORD* pdwMksys)
278 CURLMonikerImpl_THIS(iface,moniker);
280 FIXME("(%p)->() stub!\n",This);
286 static ICOM_VTABLE(IMoniker) imoniker =
288 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
289 /* IUnknown fields */
290 IMoniker_fnQueryInterface,
293 /* IPersist fields */
294 IMoniker_fnGetClassID,
295 /* IPersistStream fields */
299 IMoniker_fnGetSizeMax,
300 /* IMoniker fields */
301 IMoniker_fnBindToObject,
302 IMoniker_fnBindToStorage,
304 IMoniker_fnComposeWith,
308 IMoniker_fnIsRunning,
309 IMoniker_fnGetTimeOfLastChange,
311 IMoniker_fnCommonPrefixWith,
312 IMoniker_fnRelativePathTo,
313 IMoniker_fnGetDisplayName,
314 IMoniker_fnParseDisplayName,
315 IMoniker_fnIsSystemMoniker,
321 static HRESULT WINAPI
322 IROTData_fnQueryInterface(IROTData* iface,REFIID riid,void** ppobj)
324 CURLMonikerImpl_THIS(iface,rotd);
326 TRACE("(%p)->()\n",This);
328 return IUnknown_QueryInterface(This->vfunk.punkControl,riid,ppobj);
332 IROTData_fnAddRef(IROTData* iface)
334 CURLMonikerImpl_THIS(iface,rotd);
336 TRACE("(%p)->()\n",This);
338 return IUnknown_AddRef(This->vfunk.punkControl);
342 IROTData_fnRelease(IROTData* iface)
344 CURLMonikerImpl_THIS(iface,rotd);
346 TRACE("(%p)->()\n",This);
348 return IUnknown_Release(This->vfunk.punkControl);
351 static HRESULT WINAPI IROTData_fnGetComparisonData(IROTData* iface,BYTE* pbData,ULONG cbMax,ULONG* pcbData)
353 CURLMonikerImpl_THIS(iface,rotd);
355 FIXME("(%p)->() stub!\n",This);
362 static ICOM_VTABLE(IROTData) irotdata =
364 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
365 /* IUnknown fields */
366 IROTData_fnQueryInterface,
369 /* IROTData fields */
370 IROTData_fnGetComparisonData,
375 static COMIMPL_IFEntry IFEntries[] =
377 { &IID_IPersist, offsetof(CURLMonikerImpl,moniker)-offsetof(CURLMonikerImpl,vfunk) },
378 { &IID_IPersistStream, offsetof(CURLMonikerImpl,moniker)-offsetof(CURLMonikerImpl,vfunk) },
379 { &IID_IMoniker, offsetof(CURLMonikerImpl,moniker)-offsetof(CURLMonikerImpl,vfunk) },
380 { &IID_IROTData, offsetof(CURLMonikerImpl,rotd)-offsetof(CURLMonikerImpl,vfunk) },
383 static void CURLMonikerImpl_Destructor(IUnknown* iface)
385 CURLMonikerImpl_THIS(iface,vfunk);
387 TRACE("(%p)\n",This);
390 static HRESULT CURLMonikerImpl_AllocObj(
392 IMoniker* pmonContext,
395 CURLMonikerImpl* This;
397 This = (CURLMonikerImpl*)COMIMPL_AllocObj( sizeof(CURLMonikerImpl) );
398 if ( This == NULL ) return E_OUTOFMEMORY;
399 COMIMPL_IUnkInit( &This->vfunk, NULL );
400 This->vfunk.pEntries = IFEntries;
401 This->vfunk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
402 This->vfunk.pOnFinalRelease = CURLMonikerImpl_Destructor;
404 ICOM_VTBL(&This->moniker) = &imoniker;
405 ICOM_VTBL(&This->rotd) = &irotdata;
407 *ppobj = (void*)(&This->vfunk);
413 /***********************************************************************
415 * CreateURLMoniker (URLMON.@)
418 * E_OUTOFMEMORY out of memory
419 * MK_E_SYNTAX not a valid url
423 HRESULT WINAPI CreateURLMoniker(
424 IMoniker* pmonContext,
429 IUnknown* punk = NULL;
431 FIXME("(%p,%s,%p)\n",pmonContext,debugstr_w(lpwszURL),ppmon);
437 hr = CURLMonikerImpl_AllocObj( (void**)&punk, pmonContext, lpwszURL );
441 hr = IUnknown_QueryInterface( punk, &IID_IMoniker, (void**)ppmon );
442 IUnknown_Release( punk );