4 * Copyright 1999 Ulrich Czekalla for Corel Corporation
5 * Copyright 2002 Huw D M Davies for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define COM_NO_WINDOWS_H
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
36 #include "urlmon_main.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
40 /* native urlmon.dll uses this key, too */
41 static WCHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
43 /*static BOOL registered_wndclass = FALSE;*/
45 /* filemoniker data structure */
46 typedef struct URLMonikerImpl{
48 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/
49 ICOM_VTABLE(IBinding)* lpvtbl2; /* VTable to IBinding interface */
51 ULONG ref; /* reference counter for this object */
53 LPOLESTR URLName; /* URL string identified by this URLmoniker */
57 HINTERNET hinternet, hconnect, hrequest;
60 /********************************************************************************/
61 /* URLMoniker prototype functions : */
63 /* IUnknown prototype functions */
64 static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject);
65 static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface);
66 static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface);
68 /* IPersist prototype functions */
69 static HRESULT WINAPI URLMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID);
71 /* IPersistStream prototype functions */
72 static HRESULT WINAPI URLMonikerImpl_IsDirty(IMoniker* iface);
73 static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface, IStream* pStm);
74 static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty);
75 static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize);
77 /* IMoniker prototype functions */
78 static HRESULT WINAPI URLMonikerImpl_BindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
79 static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
80 static HRESULT WINAPI URLMonikerImpl_Reduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced);
81 static HRESULT WINAPI URLMonikerImpl_ComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite);
82 static HRESULT WINAPI URLMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker);
83 static HRESULT WINAPI URLMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker);
84 static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash);
85 static HRESULT WINAPI URLMonikerImpl_IsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning);
86 static HRESULT WINAPI URLMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pFileTime);
87 static HRESULT WINAPI URLMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk);
88 static HRESULT WINAPI URLMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix);
89 static HRESULT WINAPI URLMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath);
90 static HRESULT WINAPI URLMonikerImpl_GetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName);
91 static HRESULT WINAPI URLMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut);
92 static HRESULT WINAPI URLMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
94 /* IBinding interface to moniker */
95 static HRESULT WINAPI URLMonikerImpl_IBinding_QueryInterface(IBinding* iface,REFIID riid,void** ppvObject);
96 static ULONG WINAPI URLMonikerImpl_IBinding_AddRef(IBinding* iface);
97 static ULONG WINAPI URLMonikerImpl_IBinding_Release(IBinding* iface);
98 static HRESULT WINAPI URLMonikerImpl_IBinding_Abort(IBinding* iface);
99 static HRESULT WINAPI URLMonikerImpl_IBinding_Suspend(IBinding* iface);
100 static HRESULT WINAPI URLMonikerImpl_IBinding_Resume(IBinding* iface);
101 static HRESULT WINAPI URLMonikerImpl_IBinding_SetPriority(IBinding* iface, LONG nPriority);
102 static HRESULT WINAPI URLMonikerImpl_IBinding_GetPriority(IBinding* iface, LONG* pnPriority);
103 static HRESULT WINAPI URLMonikerImpl_IBinding_GetBindResult(IBinding* iface, CLSID* pclsidProtocol, DWORD* pdwResult, LPOLESTR* pszResult, DWORD* pdwReserved);
105 /* Local function used by urlmoniker implementation */
106 static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* iface, LPCOLESTR lpszURL);
107 static HRESULT URLMonikerImpl_Destroy(URLMonikerImpl* iface);
109 /********************************************************************************/
110 /* Virtual function table for the URLMonikerImpl class which include IPersist,*/
111 /* IPersistStream and IMoniker functions. */
112 static ICOM_VTABLE(IMoniker) VT_URLMonikerImpl =
114 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
115 URLMonikerImpl_QueryInterface,
116 URLMonikerImpl_AddRef,
117 URLMonikerImpl_Release,
118 URLMonikerImpl_GetClassID,
119 URLMonikerImpl_IsDirty,
122 URLMonikerImpl_GetSizeMax,
123 URLMonikerImpl_BindToObject,
124 URLMonikerImpl_BindToStorage,
125 URLMonikerImpl_Reduce,
126 URLMonikerImpl_ComposeWith,
128 URLMonikerImpl_IsEqual,
130 URLMonikerImpl_IsRunning,
131 URLMonikerImpl_GetTimeOfLastChange,
132 URLMonikerImpl_Inverse,
133 URLMonikerImpl_CommonPrefixWith,
134 URLMonikerImpl_RelativePathTo,
135 URLMonikerImpl_GetDisplayName,
136 URLMonikerImpl_ParseDisplayName,
137 URLMonikerImpl_IsSystemMoniker
140 static ICOM_VTABLE(IBinding) VTBinding_URLMonikerImpl =
142 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
143 URLMonikerImpl_IBinding_QueryInterface,
144 URLMonikerImpl_IBinding_AddRef,
145 URLMonikerImpl_IBinding_Release,
146 URLMonikerImpl_IBinding_Abort,
147 URLMonikerImpl_IBinding_Suspend,
148 URLMonikerImpl_IBinding_Resume,
149 URLMonikerImpl_IBinding_SetPriority,
150 URLMonikerImpl_IBinding_GetPriority,
151 URLMonikerImpl_IBinding_GetBindResult
155 /*******************************************************************************
156 * URLMoniker_QueryInterface
157 *******************************************************************************/
158 static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
160 ICOM_THIS(URLMonikerImpl,iface);
162 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
164 /* Perform a sanity check on the parameters.*/
165 if ( (This==0) || (ppvObject==0) )
168 /* Initialize the return parameter */
171 /* Compare the riid with the interface IDs implemented by this object.*/
172 if (IsEqualIID(&IID_IUnknown, riid) ||
173 IsEqualIID(&IID_IPersist, riid) ||
174 IsEqualIID(&IID_IPersistStream,riid) ||
175 IsEqualIID(&IID_IMoniker, riid)
179 /* Check that we obtained an interface.*/
181 return E_NOINTERFACE;
183 /* Query Interface always increases the reference count by one when it is successful */
184 URLMonikerImpl_AddRef(iface);
189 /******************************************************************************
191 ******************************************************************************/
192 static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
194 ICOM_THIS(URLMonikerImpl,iface);
196 TRACE("(%p)\n",This);
198 return ++(This->ref);
201 /******************************************************************************
203 ******************************************************************************/
204 static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
206 ICOM_THIS(URLMonikerImpl,iface);
208 TRACE("(%p)\n",This);
212 /* destroy the object if there's no more reference on it */
215 URLMonikerImpl_Destroy(This);
222 /******************************************************************************
223 * URLMoniker_GetClassID
224 ******************************************************************************/
225 static HRESULT WINAPI URLMonikerImpl_GetClassID(IMoniker* iface,
226 CLSID *pClassID)/* Pointer to CLSID of object */
228 ICOM_THIS(URLMonikerImpl,iface);
230 FIXME("(%p)->(%p): stub\n",This,pClassID);
238 /******************************************************************************
240 ******************************************************************************/
241 static HRESULT WINAPI URLMonikerImpl_IsDirty(IMoniker* iface)
243 ICOM_THIS(URLMonikerImpl,iface);
244 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
245 method in the OLE-provided moniker interfaces always return S_FALSE because
246 their internal state never changes. */
248 TRACE("(%p)\n",This);
253 /******************************************************************************
255 ******************************************************************************/
256 static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface,IStream* pStm)
258 ICOM_THIS(URLMonikerImpl,iface);
260 FIXME("(%p)->(%p): stub\n",This,pStm);
265 /******************************************************************************
267 ******************************************************************************/
268 static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface,
269 IStream* pStm,/* pointer to the stream where the object is to be saved */
270 BOOL fClearDirty)/* Specifies whether to clear the dirty flag */
272 ICOM_THIS(URLMonikerImpl,iface);
274 FIXME("(%p)->(%p,%d): stub\n",This,pStm,fClearDirty);
280 /******************************************************************************
281 * URLMoniker_GetSizeMax
282 ******************************************************************************/
283 static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface,
284 ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
286 ICOM_THIS(URLMonikerImpl,iface);
288 FIXME("(%p)->(%p): stub\n",This,pcbSize);
293 /******************************************************************************
294 * URLMoniker_Construct (local function)
295 *******************************************************************************/
296 static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszURLName)
298 int sizeStr = strlenW(lpszURLName);
300 TRACE("(%p,%s)\n",This,debugstr_w(lpszURLName));
301 memset(This, 0, sizeof(*This));
303 /* Initialize the virtual fgunction table. */
304 This->lpvtbl1 = &VT_URLMonikerImpl;
305 This->lpvtbl2 = &VTBinding_URLMonikerImpl;
308 This->URLName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr+1));
310 if (This->URLName==NULL)
311 return E_OUTOFMEMORY;
313 strcpyW(This->URLName,lpszURLName);
320 /******************************************************************************
321 * URLMoniker_Destroy (local function)
322 *******************************************************************************/
323 static HRESULT URLMonikerImpl_Destroy(URLMonikerImpl* This)
325 TRACE("(%p)\n",This);
327 if (This->URLName!=NULL)
328 HeapFree(GetProcessHeap(),0,This->URLName);
330 HeapFree(GetProcessHeap(),0,This);
335 /******************************************************************************
336 * URLMoniker_BindToObject
337 ******************************************************************************/
338 static HRESULT WINAPI URLMonikerImpl_BindToObject(IMoniker* iface,
344 ICOM_THIS(URLMonikerImpl,iface);
348 FIXME("(%p)->(%p,%p,%s,%p): stub\n",This,pbc,pmkToLeft,debugstr_guid(riid),
355 enum {OnProgress, OnDataAvailable} callback;
356 } URLMON_CallbackData;
360 static LRESULT CALLBACK URLMON_WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
362 return DefWindowProcA(hwnd, msg, wparam, lparam);
365 static void PostOnProgress(URLMonikerImpl *This, UINT progress, UINT maxprogress, DWORD status, LPCWSTR *str)
369 static void CALLBACK URLMON_InternetCallback(HINTERNET hinet, /*DWORD_PTR*/ DWORD context, DWORD status,
370 void *status_info, DWORD status_info_len)
372 URLMonikerImpl *This = (URLMonikerImpl *)context;
373 TRACE("handle %p this %p status %08lx\n", hinet, This, status);
375 if(This->filesize == -1) {
377 case INTERNET_STATUS_RESOLVING_NAME:
378 PostOnProgess(This, 0, 0, BINDSTATUS_FINDINGRESOURCE, status_info);
380 case INTERNET_STATUS_CONNECTING_TO_SERVER:
381 PostOnProgress(This, 0, 0, BINDSTATUS_CONNECTING, NULL);
383 case INTERNET_STATUS_SENDING_REQUEST:
384 PostOnProgress(This, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
386 case INTERNET_REQUEST_COMPLETE:
388 DWORD len, lensz = sizeof(len);
390 HttpQueryInfoW(hrequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &len, &lensz, NULL);
391 TRACE("res = %ld gle = %08lx url len = %ld\n", hres, GetLastError(), len);
392 This->filesize = len;
401 /******************************************************************************
402 * URLMoniker_BindToStorage
403 ******************************************************************************/
404 static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
410 ICOM_THIS(URLMonikerImpl,iface);
412 IBindStatusCallback *pbscb;
416 FIXME("(%p)->(%p,%p,%s,%p): stub\n",This,pbc,pmkToLeft,debugstr_guid(riid),ppvObject);
418 FIXME("pmkToLeft != NULL\n");
421 if(!IsEqualIID(&IID_IStream, riid)) {
422 FIXME("unsupported iid\n");
426 /* FIXME This is a bad hack (tm). We should clearly download to a temporary file.
427 We also need to implement IStream ourselves so that IStream_Read can return
430 hres = CreateStreamOnHGlobal(0, TRUE, (IStream**)ppvObject);
433 if(SUCCEEDED(hres)) {
434 TRACE("Created dummy stream...\n");
436 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&pbscb);
437 if(SUCCEEDED(hres)) {
438 TRACE("Got IBindStatusCallback...\n");
440 memset(&bi, 0, sizeof(bi));
441 bi.cbSize = sizeof(bi);
443 hres = IBindStatusCallback_GetBindInfo(pbscb, &bindf, &bi);
444 if(SUCCEEDED(hres)) {
447 DWORD len, lensz = sizeof(len), total_read = 0;
448 LARGE_INTEGER last_read_pos;
452 TRACE("got bindinfo. bindf = %08lx extrainfo = %s bindinfof = %08lx bindverb = %08lx iid %s\n",
453 bindf, debugstr_w(bi.szExtraInfo), bi.grfBindInfoF, bi.dwBindVerb, debugstr_guid(&bi.iid));
454 hres = IBindStatusCallback_OnStartBinding(pbscb, 0, (IBinding*)&This->lpvtbl2);
455 TRACE("OnStartBinding rets %08lx\n", hres);
458 if(!registered_wndclass) {
459 WNDCLASSA urlmon_wndclass = {0, URLMON_WndProc,0, 0, URLMON_hInstance, 0, 0, 0, NULL, "URLMON_Callback_Window_Class"};
460 RegisterClassA(&urlmon_wndclass);
461 registered_wndclass = TRUE;
464 This->hwndCallback = CreateWindowA("URLMON_Callback_Window_Class", NULL, 0, 0, 0, 0, 0, 0, 0,
465 URLMON_hInstance, NULL);
468 memset(&url, 0, sizeof(url));
469 url.dwStructSize = sizeof(url);
470 url.dwSchemeLength = url.dwHostNameLength = url.dwUrlPathLength = 1;
471 InternetCrackUrlW(This->URLName, 0, 0, &url);
472 host = HeapAlloc(GetProcessHeap(), 0, (url.dwHostNameLength + 1) * sizeof(WCHAR));
473 memcpy(host, url.lpszHostName, url.dwHostNameLength * sizeof(WCHAR));
474 host[url.dwHostNameLength] = '\0';
475 path = HeapAlloc(GetProcessHeap(), 0, (url.dwUrlPathLength + 1) * sizeof(WCHAR));
476 memcpy(path, url.lpszUrlPath, url.dwUrlPathLength * sizeof(WCHAR));
477 path[url.dwUrlPathLength] = '\0';
479 This->hinternet = InternetOpenA("User Agent", 0, NULL, NULL, 0 /*INTERNET_FLAG_ASYNC*/);
480 /* InternetSetStatusCallback(This->hinternet, URLMON_InternetCallback);*/
482 This->hconnect = InternetConnectW(This->hinternet, host, INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
483 INTERNET_SERVICE_HTTP, 0, (DWORD)This);
484 This->hrequest = HttpOpenRequestW(This->hconnect, NULL, path, NULL, NULL, NULL, 0, (DWORD)This);
486 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, 0x22, NULL);
487 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, BINDSTATUS_FINDINGRESOURCE, NULL);
488 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL);
489 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
490 hres = E_OUTOFMEMORY; /* FIXME */
491 if(HttpSendRequestW(This->hrequest, NULL, 0, NULL, 0)) {
494 HttpQueryInfoW(This->hrequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &len, &lensz, NULL);
496 TRACE("res = %ld gle = %08lx url len = %ld\n", hres, GetLastError(), len);
498 last_read_pos.s.LowPart = last_read_pos.s.HighPart = 0;
503 fmt.tymed = TYMED_ISTREAM;
504 stg.tymed = TYMED_ISTREAM;
505 stg.u.pstm = *(IStream**)ppvObject;
506 stg.pUnkForRelease = NULL;
512 if(InternetReadFile(This->hrequest, buf, sizeof(buf), &bufread)) {
513 TRACE("read %ld bytes %s...\n", bufread, debugstr_an(buf, 10));
514 if(bufread == 0) break;
515 IStream_Write(*(IStream**)ppvObject, buf, bufread, &written);
516 total_read += bufread;
517 IStream_Seek(*(IStream**)ppvObject, last_read_pos, STREAM_SEEK_SET, NULL);
518 hres = IBindStatusCallback_OnProgress(pbscb, total_read, len, (total_read == bufread) ?
519 BINDSTATUS_BEGINDOWNLOADDATA :
520 BINDSTATUS_DOWNLOADINGDATA, NULL);
521 hres = IBindStatusCallback_OnDataAvailable(pbscb,
522 (total_read == bufread) ? BSCF_FIRSTDATANOTIFICATION :
523 BSCF_INTERMEDIATEDATANOTIFICATION,
524 total_read, &fmt, &stg);
525 last_read_pos.s.LowPart += bufread; /* FIXME */
529 hres = IBindStatusCallback_OnProgress(pbscb, total_read, len, BINDSTATUS_ENDDOWNLOADDATA, NULL);
530 hres = IBindStatusCallback_OnDataAvailable(pbscb, BSCF_LASTDATANOTIFICATION, total_read, &fmt, &stg);
531 TRACE("OnDataAvail rets %08lx\n", hres);
532 hres = IBindStatusCallback_OnStopBinding(pbscb, S_OK, NULL);
533 TRACE("OnStop rets %08lx\n", hres);
536 InternetCloseHandle(This->hrequest);
537 InternetCloseHandle(This->hconnect);
538 InternetCloseHandle(This->hinternet);
545 /******************************************************************************
547 ******************************************************************************/
548 static HRESULT WINAPI URLMonikerImpl_Reduce(IMoniker* iface,
550 DWORD dwReduceHowFar,
551 IMoniker** ppmkToLeft,
552 IMoniker** ppmkReduced)
554 ICOM_THIS(URLMonikerImpl,iface);
555 FIXME("(%p)->(%p,%ld,%p,%p): stub\n",This,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
560 /******************************************************************************
561 * URLMoniker_ComposeWith
562 ******************************************************************************/
563 static HRESULT WINAPI URLMonikerImpl_ComposeWith(IMoniker* iface,
565 BOOL fOnlyIfNotGeneric,
566 IMoniker** ppmkComposite)
568 ICOM_THIS(URLMonikerImpl,iface);
569 FIXME("(%p)->(%p,%d,%p): stub\n",This,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
574 /******************************************************************************
576 ******************************************************************************/
577 static HRESULT WINAPI URLMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
579 ICOM_THIS(URLMonikerImpl,iface);
580 FIXME("(%p)->(%d,%p): stub\n",This,fForward,ppenumMoniker);
585 /******************************************************************************
587 ******************************************************************************/
588 static HRESULT WINAPI URLMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
590 ICOM_THIS(URLMonikerImpl,iface);
591 FIXME("(%p)->(%p): stub\n",This,pmkOtherMoniker);
597 /******************************************************************************
599 ******************************************************************************/
600 static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
602 ICOM_THIS(URLMonikerImpl,iface);
603 FIXME("(%p)->(%p): stub\n",This,pdwHash);
608 /******************************************************************************
609 * URLMoniker_IsRunning
610 ******************************************************************************/
611 static HRESULT WINAPI URLMonikerImpl_IsRunning(IMoniker* iface,
614 IMoniker* pmkNewlyRunning)
616 ICOM_THIS(URLMonikerImpl,iface);
617 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pmkNewlyRunning);
622 /******************************************************************************
623 * URLMoniker_GetTimeOfLastChange
624 ******************************************************************************/
625 static HRESULT WINAPI URLMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
630 ICOM_THIS(URLMonikerImpl,iface);
631 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pFileTime);
636 /******************************************************************************
638 ******************************************************************************/
639 static HRESULT WINAPI URLMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
641 ICOM_THIS(URLMonikerImpl,iface);
642 FIXME("(%p)->(%p): stub\n",This,ppmk);
647 /******************************************************************************
648 * URLMoniker_CommonPrefixWith
649 ******************************************************************************/
650 static HRESULT WINAPI URLMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
652 ICOM_THIS(URLMonikerImpl,iface);
653 FIXME("(%p)->(%p,%p): stub\n",This,pmkOther,ppmkPrefix);
658 /******************************************************************************
659 * URLMoniker_RelativePathTo
660 ******************************************************************************/
661 static HRESULT WINAPI URLMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
663 ICOM_THIS(URLMonikerImpl,iface);
664 FIXME("(%p)->(%p,%p): stub\n",This,pmOther,ppmkRelPath);
669 /******************************************************************************
670 * URLMoniker_GetDisplayName
671 ******************************************************************************/
672 static HRESULT WINAPI URLMonikerImpl_GetDisplayName(IMoniker* iface,
675 LPOLESTR *ppszDisplayName)
677 ICOM_THIS(URLMonikerImpl,iface);
678 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,ppszDisplayName);
683 /******************************************************************************
684 * URLMoniker_ParseDisplayName
685 ******************************************************************************/
686 static HRESULT WINAPI URLMonikerImpl_ParseDisplayName(IMoniker* iface,
689 LPOLESTR pszDisplayName,
693 ICOM_THIS(URLMonikerImpl,iface);
694 FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
699 /******************************************************************************
700 * URLMoniker_IsSystemMoniker
701 ******************************************************************************/
702 static HRESULT WINAPI URLMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
704 ICOM_THIS(URLMonikerImpl,iface);
705 FIXME("(%p)->(%p)\n",This,pwdMksys);
710 static HRESULT WINAPI URLMonikerImpl_IBinding_QueryInterface(IBinding* iface,REFIID riid,void** ppvObject)
712 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
714 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
716 /* Perform a sanity check on the parameters.*/
717 if ( (This==0) || (ppvObject==0) )
720 /* Initialize the return parameter */
723 /* Compare the riid with the interface IDs implemented by this object.*/
724 if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IBinding, riid))
727 /* Check that we obtained an interface.*/
729 return E_NOINTERFACE;
731 /* Query Interface always increases the reference count by one when it is successful */
732 URLMonikerImpl_IBinding_AddRef(iface);
738 static ULONG WINAPI URLMonikerImpl_IBinding_AddRef(IBinding* iface)
740 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
741 TRACE("(%p)\n",This);
743 return URLMonikerImpl_AddRef((IMoniker*)This);
746 static ULONG WINAPI URLMonikerImpl_IBinding_Release(IBinding* iface)
748 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
749 TRACE("(%p)\n",This);
751 return URLMonikerImpl_Release((IMoniker*)This);
754 static HRESULT WINAPI URLMonikerImpl_IBinding_Abort(IBinding* iface)
756 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
757 FIXME("(%p): stub\n", This);
762 static HRESULT WINAPI URLMonikerImpl_IBinding_GetBindResult(IBinding* iface, CLSID* pclsidProtocol, DWORD* pdwResult, LPOLESTR* pszResult, DWORD* pdwReserved)
764 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
765 FIXME("(%p)->(%s, %p, %p, %p): stub\n", This, debugstr_guid(pclsidProtocol), pdwResult, pszResult, pdwReserved);
770 static HRESULT WINAPI URLMonikerImpl_IBinding_GetPriority(IBinding* iface, LONG* pnPriority)
772 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
773 FIXME("(%p)->(%p): stub\n", This, pnPriority);
778 static HRESULT WINAPI URLMonikerImpl_IBinding_Resume(IBinding* iface)
780 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
781 FIXME("(%p): stub\n", This);
786 static HRESULT WINAPI URLMonikerImpl_IBinding_SetPriority(IBinding* iface, LONG nPriority)
788 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
789 FIXME("(%p)->(%ld): stub\n", This, nPriority);
794 static HRESULT WINAPI URLMonikerImpl_IBinding_Suspend(IBinding* iface)
796 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
797 FIXME("(%p): stub\n", This);
802 /***********************************************************************
803 * CreateAsyncBindCtxEx (URLMON.@)
805 * Create an asynchronous bind context.
810 HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options,
811 IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx** pbind,
814 FIXME("stub, returns failure\n");
819 /***********************************************************************
820 * CreateURLMoniker (URLMON.@)
822 * Create a url moniker.
825 * pmkContext [I] Context
826 * szURL [I] Url to create the moniker for
827 * ppmk [O] Destination for created moniker.
830 * Success: S_OK. ppmk contains the created IMoniker object.
831 * Failure: MK_E_SYNTAX if szURL is not a valid url, or
832 * E_OUTOFMEMORY if memory allocation fails.
834 HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
838 IID iid = IID_IMoniker;
840 TRACE("(%p, %s, %p)\n", pmkContext, debugstr_w(szURL), ppmk);
842 if (NULL != pmkContext)
843 FIXME("Non-null pmkContext not implemented\n");
845 if(!(obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj))))
846 return E_OUTOFMEMORY;
848 hres = URLMonikerImpl_Construct(obj, szURL);
850 hres = URLMonikerImpl_QueryInterface((IMoniker*)obj, &iid, (void**)ppmk);
852 HeapFree(GetProcessHeap(), 0, obj);
857 /***********************************************************************
858 * CoInternetGetSession (URLMON.@)
860 * Create a new internet session and return an IInternetSession interface
864 * dwSessionMode [I] Mode for the internet session
865 * ppIInternetSession [O] Destination for creates IInternetSession object
866 * dwReserved [I] Reserved, must be 0.
869 * Success: S_OK. ppIInternetSession contains the IInternetSession interface.
870 * Failure: E_INVALIDARG, if any argument is invalid, or
871 * E_OUTOFMEMORY if memory allocation fails.
873 HRESULT WINAPI CoInternetGetSession(DWORD dwSessionMode, /*IInternetSession*/void **ppIInternetSession, DWORD dwReserved)
875 FIXME("(%ld, %p, %ld): stub\n", dwSessionMode, ppIInternetSession, dwReserved);
878 ERR("dwSessionMode: %ld, must be zero\n", dwSessionMode);
882 ERR("dwReserved: %ld, must be zero\n", dwReserved);
885 *ppIInternetSession=NULL;
886 return E_OUTOFMEMORY;
889 /***********************************************************************
890 * CoInternetQueryInfo (URLMON.@)
892 * Retrieves information relevant to a specified URL
896 * S_FALSE buffer too small
897 * INET_E_QUERYOPTIONUNKNOWN invalid option
900 HRESULT WINAPI CoInternetQueryInfo(LPCWSTR pwzUrl, QUERYOPTION QueryOption,
901 DWORD dwQueryFlags, LPVOID pvBuffer, DWORD cbBuffer, DWORD * pcbBuffer,
904 FIXME("(%s, %x, %lx, %p, %lx, %p, %lx): stub\n", debugstr_w(pwzUrl),
905 QueryOption, dwQueryFlags, pvBuffer, cbBuffer, pcbBuffer, dwReserved);
909 /***********************************************************************
910 * FindMimeFromData (URLMON.@)
912 * Determines the Multipurpose Internet Mail Extensions (MIME) type from the data provided.
915 HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer,
916 DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags,
917 LPWSTR* ppwzMimeOut, DWORD dwReserved)
920 return E_OUTOFMEMORY;
923 /***********************************************************************
924 * RegisterBindStatusCallback (URLMON.@)
926 * Register a bind status callback.
929 * pbc [I] Binding context
930 * pbsc [I] Callback to register
931 * ppbscPrevious [O] Destination for previous callback
932 * dwReserved [I] Reserved, must be 0.
936 * Failure: E_INVALIDARG, if any argument is invalid, or
937 * E_OUTOFMEMORY if memory allocation fails.
939 HRESULT WINAPI RegisterBindStatusCallback(
941 IBindStatusCallback *pbsc,
942 IBindStatusCallback **ppbscPrevious,
945 IBindStatusCallback *prev;
947 TRACE("(%p,%p,%p,%lu)\n", pbc, pbsc, ppbscPrevious, dwReserved);
949 if (pbc == NULL || pbsc == NULL)
952 if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown **)&prev)))
954 IBindCtx_RevokeObjectParam(pbc, BSCBHolder);
956 *ppbscPrevious = prev;
958 IBindStatusCallback_Release(prev);
961 return IBindCtx_RegisterObjectParam(pbc, BSCBHolder, (IUnknown *)pbsc);
964 /***********************************************************************
965 * RevokeBindStatusCallback (URLMON.@)
967 * Unregister a bind status callback.
969 * pbc [I] Binding context
970 * pbsc [I] Callback to unregister
974 * Failure: E_INVALIDARG, if any argument is invalid, or
975 * E_FAIL if pbsc wasn't registered with pbc.
977 HRESULT WINAPI RevokeBindStatusCallback(
979 IBindStatusCallback *pbsc)
981 IBindStatusCallback *callback;
984 TRACE("(%p,%p)\n", pbc, pbsc);
986 if (pbc == NULL || pbsc == NULL)
989 if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown **)&callback)))
991 if (callback == pbsc)
993 IBindCtx_RevokeObjectParam(pbc, BSCBHolder);
996 IBindStatusCallback_Release(pbsc);
1002 /***********************************************************************
1003 * ReleaseBindInfo (URLMON.@)
1005 * Release the resources used by the specified BINDINFO structure.
1008 * pbindinfo [I] BINDINFO to release.
1013 void WINAPI ReleaseBindInfo(BINDINFO* pbindinfo)
1015 FIXME("(%p)stub!\n", pbindinfo);