4 * Copyright 1999 Corel Corporation
8 * Copyright 2002 Huw D M Davies for CodeWeavers
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #define COM_NO_WINDOWS_H
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
38 #include "urlmon_main.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
42 /* native urlmon.dll uses this key, too */
43 static WCHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
45 /*static BOOL registered_wndclass = FALSE;*/
47 /* filemoniker data structure */
48 typedef struct URLMonikerImpl{
50 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/
51 ICOM_VTABLE(IBinding)* lpvtbl2; /* VTable to IBinding interface */
53 ULONG ref; /* reference counter for this object */
55 LPOLESTR URLName; /* URL string identified by this URLmoniker */
59 HINTERNET hinternet, hconnect, hrequest;
62 /********************************************************************************/
63 /* URLMoniker prototype functions : */
65 /* IUnknown prototype functions */
66 static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject);
67 static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface);
68 static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface);
70 /* IPersist prototype functions */
71 static HRESULT WINAPI URLMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID);
73 /* IPersistStream prototype functions */
74 static HRESULT WINAPI URLMonikerImpl_IsDirty(IMoniker* iface);
75 static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface, IStream* pStm);
76 static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty);
77 static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize);
79 /* IMoniker prototype functions */
80 static HRESULT WINAPI URLMonikerImpl_BindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
81 static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
82 static HRESULT WINAPI URLMonikerImpl_Reduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced);
83 static HRESULT WINAPI URLMonikerImpl_ComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite);
84 static HRESULT WINAPI URLMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker);
85 static HRESULT WINAPI URLMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker);
86 static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash);
87 static HRESULT WINAPI URLMonikerImpl_IsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning);
88 static HRESULT WINAPI URLMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pFileTime);
89 static HRESULT WINAPI URLMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk);
90 static HRESULT WINAPI URLMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix);
91 static HRESULT WINAPI URLMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath);
92 static HRESULT WINAPI URLMonikerImpl_GetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName);
93 static HRESULT WINAPI URLMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut);
94 static HRESULT WINAPI URLMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
96 /* IBinding interface to moniker */
97 static HRESULT WINAPI URLMonikerImpl_IBinding_QueryInterface(IBinding* iface,REFIID riid,void** ppvObject);
98 static ULONG WINAPI URLMonikerImpl_IBinding_AddRef(IBinding* iface);
99 static ULONG WINAPI URLMonikerImpl_IBinding_Release(IBinding* iface);
100 static HRESULT WINAPI URLMonikerImpl_IBinding_Abort(IBinding* iface);
101 static HRESULT WINAPI URLMonikerImpl_IBinding_Suspend(IBinding* iface);
102 static HRESULT WINAPI URLMonikerImpl_IBinding_Resume(IBinding* iface);
103 static HRESULT WINAPI URLMonikerImpl_IBinding_SetPriority(IBinding* iface, LONG nPriority);
104 static HRESULT WINAPI URLMonikerImpl_IBinding_GetPriority(IBinding* iface, LONG* pnPriority);
105 static HRESULT WINAPI URLMonikerImpl_IBinding_GetBindResult(IBinding* iface, CLSID* pclsidProtocol, DWORD* pdwResult, LPOLESTR* pszResult, DWORD* pdwReserved);
107 /* Local function used by urlmoniker implementation */
108 static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* iface, LPCOLESTR lpszURL);
109 static HRESULT URLMonikerImpl_Destroy(URLMonikerImpl* iface);
111 /********************************************************************************/
112 /* Virtual function table for the URLMonikerImpl class which include IPersist,*/
113 /* IPersistStream and IMoniker functions. */
114 static ICOM_VTABLE(IMoniker) VT_URLMonikerImpl =
116 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
117 URLMonikerImpl_QueryInterface,
118 URLMonikerImpl_AddRef,
119 URLMonikerImpl_Release,
120 URLMonikerImpl_GetClassID,
121 URLMonikerImpl_IsDirty,
124 URLMonikerImpl_GetSizeMax,
125 URLMonikerImpl_BindToObject,
126 URLMonikerImpl_BindToStorage,
127 URLMonikerImpl_Reduce,
128 URLMonikerImpl_ComposeWith,
130 URLMonikerImpl_IsEqual,
132 URLMonikerImpl_IsRunning,
133 URLMonikerImpl_GetTimeOfLastChange,
134 URLMonikerImpl_Inverse,
135 URLMonikerImpl_CommonPrefixWith,
136 URLMonikerImpl_RelativePathTo,
137 URLMonikerImpl_GetDisplayName,
138 URLMonikerImpl_ParseDisplayName,
139 URLMonikerImpl_IsSystemMoniker
142 static ICOM_VTABLE(IBinding) VTBinding_URLMonikerImpl =
144 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
145 URLMonikerImpl_IBinding_QueryInterface,
146 URLMonikerImpl_IBinding_AddRef,
147 URLMonikerImpl_IBinding_Release,
148 URLMonikerImpl_IBinding_Abort,
149 URLMonikerImpl_IBinding_Suspend,
150 URLMonikerImpl_IBinding_Resume,
151 URLMonikerImpl_IBinding_SetPriority,
152 URLMonikerImpl_IBinding_GetPriority,
153 URLMonikerImpl_IBinding_GetBindResult
157 /*******************************************************************************
158 * URLMoniker_QueryInterface
159 *******************************************************************************/
160 static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
162 ICOM_THIS(URLMonikerImpl,iface);
164 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
166 /* Perform a sanity check on the parameters.*/
167 if ( (This==0) || (ppvObject==0) )
170 /* Initialize the return parameter */
173 /* Compare the riid with the interface IDs implemented by this object.*/
174 if (IsEqualIID(&IID_IUnknown, riid) ||
175 IsEqualIID(&IID_IPersist, riid) ||
176 IsEqualIID(&IID_IPersistStream,riid) ||
177 IsEqualIID(&IID_IMoniker, riid)
181 /* Check that we obtained an interface.*/
183 return E_NOINTERFACE;
185 /* Query Interface always increases the reference count by one when it is successful */
186 URLMonikerImpl_AddRef(iface);
191 /******************************************************************************
193 ******************************************************************************/
194 static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
196 ICOM_THIS(URLMonikerImpl,iface);
198 TRACE("(%p)\n",This);
200 return ++(This->ref);
203 /******************************************************************************
205 ******************************************************************************/
206 static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
208 ICOM_THIS(URLMonikerImpl,iface);
210 TRACE("(%p)\n",This);
214 /* destroy the object if there's no more reference on it */
217 URLMonikerImpl_Destroy(This);
224 /******************************************************************************
225 * URLMoniker_GetClassID
226 ******************************************************************************/
227 static HRESULT WINAPI URLMonikerImpl_GetClassID(IMoniker* iface,
228 CLSID *pClassID)/* Pointer to CLSID of object */
230 ICOM_THIS(URLMonikerImpl,iface);
232 FIXME("(%p)->(%p): stub\n",This,pClassID);
240 /******************************************************************************
242 ******************************************************************************/
243 static HRESULT WINAPI URLMonikerImpl_IsDirty(IMoniker* iface)
245 ICOM_THIS(URLMonikerImpl,iface);
246 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
247 method in the OLE-provided moniker interfaces always return S_FALSE because
248 their internal state never changes. */
250 TRACE("(%p)\n",This);
255 /******************************************************************************
257 ******************************************************************************/
258 static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface,IStream* pStm)
260 ICOM_THIS(URLMonikerImpl,iface);
262 FIXME("(%p)->(%p): stub\n",This,pStm);
267 /******************************************************************************
269 ******************************************************************************/
270 static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface,
271 IStream* pStm,/* pointer to the stream where the object is to be saved */
272 BOOL fClearDirty)/* Specifies whether to clear the dirty flag */
274 ICOM_THIS(URLMonikerImpl,iface);
276 FIXME("(%p)->(%p,%d): stub\n",This,pStm,fClearDirty);
282 /******************************************************************************
283 * URLMoniker_GetSizeMax
284 ******************************************************************************/
285 static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface,
286 ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
288 ICOM_THIS(URLMonikerImpl,iface);
290 FIXME("(%p)->(%p): stub\n",This,pcbSize);
295 /******************************************************************************
296 * URLMoniker_Construct (local function)
297 *******************************************************************************/
298 static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszURLName)
300 int sizeStr = strlenW(lpszURLName);
302 TRACE("(%p,%s)\n",This,debugstr_w(lpszURLName));
303 memset(This, 0, sizeof(*This));
305 /* Initialize the virtual fgunction table. */
306 This->lpvtbl1 = &VT_URLMonikerImpl;
307 This->lpvtbl2 = &VTBinding_URLMonikerImpl;
310 This->URLName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr+1));
312 if (This->URLName==NULL)
313 return E_OUTOFMEMORY;
315 strcpyW(This->URLName,lpszURLName);
322 /******************************************************************************
323 * URLMoniker_Destroy (local function)
324 *******************************************************************************/
325 static HRESULT URLMonikerImpl_Destroy(URLMonikerImpl* This)
327 TRACE("(%p)\n",This);
329 if (This->URLName!=NULL)
330 HeapFree(GetProcessHeap(),0,This->URLName);
332 HeapFree(GetProcessHeap(),0,This);
337 /******************************************************************************
338 * URLMoniker_BindToObject
339 ******************************************************************************/
340 static HRESULT WINAPI URLMonikerImpl_BindToObject(IMoniker* iface,
346 ICOM_THIS(URLMonikerImpl,iface);
350 FIXME("(%p)->(%p,%p,%s,%p): stub\n",This,pbc,pmkToLeft,debugstr_guid(riid),
357 enum {OnProgress, OnDataAvailable} callback;
358 } URLMON_CallbackData;
362 static LRESULT CALLBACK URLMON_WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
364 return DefWindowProcA(hwnd, msg, wparam, lparam);
367 static void PostOnProgress(URLMonikerImpl *This, UINT progress, UINT maxprogress, DWORD status, LPCWSTR *str)
371 static void CALLBACK URLMON_InternetCallback(HINTERNET hinet, /*DWORD_PTR*/ DWORD context, DWORD status,
372 void *status_info, DWORD status_info_len)
374 URLMonikerImpl *This = (URLMonikerImpl *)context;
375 TRACE("handle %p this %p status %08lx\n", hinet, This, status);
377 if(This->filesize == -1) {
379 case INTERNET_STATUS_RESOLVING_NAME:
380 PostOnProgess(This, 0, 0, BINDSTATUS_FINDINGRESOURCE, status_info);
382 case INTERNET_STATUS_CONNECTING_TO_SERVER:
383 PostOnProgress(This, 0, 0, BINDSTATUS_CONNECTING, NULL);
385 case INTERNET_STATUS_SENDING_REQUEST:
386 PostOnProgress(This, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
388 case INTERNET_REQUEST_COMPLETE:
390 DWORD len, lensz = sizeof(len);
392 HttpQueryInfoW(hrequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &len, &lensz, NULL);
393 TRACE("res = %ld gle = %08lx url len = %ld\n", hres, GetLastError(), len);
394 This->filesize = len;
403 /******************************************************************************
404 * URLMoniker_BindToStorage
405 ******************************************************************************/
406 static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
412 ICOM_THIS(URLMonikerImpl,iface);
414 IBindStatusCallback *pbscb;
418 FIXME("(%p)->(%p,%p,%s,%p): stub\n",This,pbc,pmkToLeft,debugstr_guid(riid),ppvObject);
420 FIXME("pmkToLeft != NULL\n");
423 if(!IsEqualIID(&IID_IStream, riid)) {
424 FIXME("unsupported iid\n");
428 /* FIXME This is a bad hack (tm). We should clearly download to a temporary file.
429 We also need to implement IStream ourselves so that IStream_Read can return
432 hres = CreateStreamOnHGlobal(0, TRUE, (IStream**)ppvObject);
435 if(SUCCEEDED(hres)) {
436 TRACE("Created dummy stream...\n");
438 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&pbscb);
439 if(SUCCEEDED(hres)) {
440 TRACE("Got IBindStatusCallback...\n");
442 memset(&bi, 0, sizeof(bi));
443 bi.cbSize = sizeof(bi);
445 hres = IBindStatusCallback_GetBindInfo(pbscb, &bindf, &bi);
446 if(SUCCEEDED(hres)) {
449 DWORD len, lensz = sizeof(len), total_read = 0;
450 LARGE_INTEGER last_read_pos;
454 TRACE("got bindinfo. bindf = %08lx extrainfo = %s bindinfof = %08lx bindverb = %08lx iid %s\n",
455 bindf, debugstr_w(bi.szExtraInfo), bi.grfBindInfoF, bi.dwBindVerb, debugstr_guid(&bi.iid));
456 hres = IBindStatusCallback_OnStartBinding(pbscb, 0, (IBinding*)&This->lpvtbl2);
457 TRACE("OnStartBinding rets %08lx\n", hres);
460 if(!registered_wndclass) {
461 WNDCLASSA urlmon_wndclass = {0, URLMON_WndProc,0, 0, URLMON_hInstance, 0, 0, 0, NULL, "URLMON_Callback_Window_Class"};
462 RegisterClassA(&urlmon_wndclass);
463 registered_wndclass = TRUE;
466 This->hwndCallback = CreateWindowA("URLMON_Callback_Window_Class", NULL, 0, 0, 0, 0, 0, 0, 0,
467 URLMON_hInstance, NULL);
470 memset(&url, 0, sizeof(url));
471 url.dwStructSize = sizeof(url);
472 url.dwSchemeLength = url.dwHostNameLength = url.dwUrlPathLength = 1;
473 InternetCrackUrlW(This->URLName, 0, 0, &url);
474 host = HeapAlloc(GetProcessHeap(), 0, (url.dwHostNameLength + 1) * sizeof(WCHAR));
475 memcpy(host, url.lpszHostName, url.dwHostNameLength * sizeof(WCHAR));
476 host[url.dwHostNameLength] = '\0';
477 path = HeapAlloc(GetProcessHeap(), 0, (url.dwUrlPathLength + 1) * sizeof(WCHAR));
478 memcpy(path, url.lpszUrlPath, url.dwUrlPathLength * sizeof(WCHAR));
479 path[url.dwUrlPathLength] = '\0';
481 This->hinternet = InternetOpenA("User Agent", 0, NULL, NULL, 0 /*INTERNET_FLAG_ASYNC*/);
482 /* InternetSetStatusCallback(This->hinternet, URLMON_InternetCallback);*/
484 This->hconnect = InternetConnectW(This->hinternet, host, INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
485 INTERNET_SERVICE_HTTP, 0, (DWORD)This);
486 This->hrequest = HttpOpenRequestW(This->hconnect, NULL, path, NULL, NULL, NULL, 0, (DWORD)This);
488 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, 0x22, NULL);
489 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, BINDSTATUS_FINDINGRESOURCE, NULL);
490 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL);
491 hres = IBindStatusCallback_OnProgress(pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
492 hres = E_OUTOFMEMORY; /* FIXME */
493 if(HttpSendRequestW(This->hrequest, NULL, 0, NULL, 0)) {
496 HttpQueryInfoW(This->hrequest, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &len, &lensz, NULL);
498 TRACE("res = %ld gle = %08lx url len = %ld\n", hres, GetLastError(), len);
500 last_read_pos.s.LowPart = last_read_pos.s.HighPart = 0;
505 fmt.tymed = TYMED_ISTREAM;
506 stg.tymed = TYMED_ISTREAM;
507 stg.u.pstm = *(IStream**)ppvObject;
508 stg.pUnkForRelease = NULL;
514 if(InternetReadFile(This->hrequest, buf, sizeof(buf), &bufread)) {
515 TRACE("read %ld bytes %s...\n", bufread, debugstr_an(buf, 10));
516 if(bufread == 0) break;
517 IStream_Write(*(IStream**)ppvObject, buf, bufread, &written);
518 total_read += bufread;
519 IStream_Seek(*(IStream**)ppvObject, last_read_pos, STREAM_SEEK_SET, NULL);
520 hres = IBindStatusCallback_OnProgress(pbscb, total_read, len, (total_read == bufread) ?
521 BINDSTATUS_BEGINDOWNLOADDATA :
522 BINDSTATUS_DOWNLOADINGDATA, NULL);
523 hres = IBindStatusCallback_OnDataAvailable(pbscb,
524 (total_read == bufread) ? BSCF_FIRSTDATANOTIFICATION :
525 BSCF_INTERMEDIATEDATANOTIFICATION,
526 total_read, &fmt, &stg);
527 last_read_pos.s.LowPart += bufread; /* FIXME */
531 hres = IBindStatusCallback_OnProgress(pbscb, total_read, len, BINDSTATUS_ENDDOWNLOADDATA, NULL);
532 hres = IBindStatusCallback_OnDataAvailable(pbscb, BSCF_LASTDATANOTIFICATION, total_read, &fmt, &stg);
533 TRACE("OnDataAvail rets %08lx\n", hres);
534 hres = IBindStatusCallback_OnStopBinding(pbscb, S_OK, NULL);
535 TRACE("OnStop rets %08lx\n", hres);
538 InternetCloseHandle(This->hrequest);
539 InternetCloseHandle(This->hconnect);
540 InternetCloseHandle(This->hinternet);
547 /******************************************************************************
549 ******************************************************************************/
550 static HRESULT WINAPI URLMonikerImpl_Reduce(IMoniker* iface,
552 DWORD dwReduceHowFar,
553 IMoniker** ppmkToLeft,
554 IMoniker** ppmkReduced)
556 ICOM_THIS(URLMonikerImpl,iface);
557 FIXME("(%p)->(%p,%ld,%p,%p): stub\n",This,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
562 /******************************************************************************
563 * URLMoniker_ComposeWith
564 ******************************************************************************/
565 static HRESULT WINAPI URLMonikerImpl_ComposeWith(IMoniker* iface,
567 BOOL fOnlyIfNotGeneric,
568 IMoniker** ppmkComposite)
570 ICOM_THIS(URLMonikerImpl,iface);
571 FIXME("(%p)->(%p,%d,%p): stub\n",This,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
576 /******************************************************************************
578 ******************************************************************************/
579 static HRESULT WINAPI URLMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
581 ICOM_THIS(URLMonikerImpl,iface);
582 FIXME("(%p)->(%d,%p): stub\n",This,fForward,ppenumMoniker);
587 /******************************************************************************
589 ******************************************************************************/
590 static HRESULT WINAPI URLMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
592 ICOM_THIS(URLMonikerImpl,iface);
593 FIXME("(%p)->(%p): stub\n",This,pmkOtherMoniker);
599 /******************************************************************************
601 ******************************************************************************/
602 static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
604 ICOM_THIS(URLMonikerImpl,iface);
605 FIXME("(%p)->(%p): stub\n",This,pdwHash);
610 /******************************************************************************
611 * URLMoniker_IsRunning
612 ******************************************************************************/
613 static HRESULT WINAPI URLMonikerImpl_IsRunning(IMoniker* iface,
616 IMoniker* pmkNewlyRunning)
618 ICOM_THIS(URLMonikerImpl,iface);
619 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pmkNewlyRunning);
624 /******************************************************************************
625 * URLMoniker_GetTimeOfLastChange
626 ******************************************************************************/
627 static HRESULT WINAPI URLMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
632 ICOM_THIS(URLMonikerImpl,iface);
633 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pFileTime);
638 /******************************************************************************
640 ******************************************************************************/
641 static HRESULT WINAPI URLMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
643 ICOM_THIS(URLMonikerImpl,iface);
644 FIXME("(%p)->(%p): stub\n",This,ppmk);
649 /******************************************************************************
650 * URLMoniker_CommonPrefixWith
651 ******************************************************************************/
652 static HRESULT WINAPI URLMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
654 ICOM_THIS(URLMonikerImpl,iface);
655 FIXME("(%p)->(%p,%p): stub\n",This,pmkOther,ppmkPrefix);
660 /******************************************************************************
661 * URLMoniker_RelativePathTo
662 ******************************************************************************/
663 static HRESULT WINAPI URLMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
665 ICOM_THIS(URLMonikerImpl,iface);
666 FIXME("(%p)->(%p,%p): stub\n",This,pmOther,ppmkRelPath);
671 /******************************************************************************
672 * URLMoniker_GetDisplayName
673 ******************************************************************************/
674 static HRESULT WINAPI URLMonikerImpl_GetDisplayName(IMoniker* iface,
677 LPOLESTR *ppszDisplayName)
679 ICOM_THIS(URLMonikerImpl,iface);
680 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,ppszDisplayName);
685 /******************************************************************************
686 * URLMoniker_ParseDisplayName
687 ******************************************************************************/
688 static HRESULT WINAPI URLMonikerImpl_ParseDisplayName(IMoniker* iface,
691 LPOLESTR pszDisplayName,
695 ICOM_THIS(URLMonikerImpl,iface);
696 FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
701 /******************************************************************************
702 * URLMoniker_IsSystemMoniker
703 ******************************************************************************/
704 static HRESULT WINAPI URLMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
706 ICOM_THIS(URLMonikerImpl,iface);
707 FIXME("(%p)->(%p)\n",This,pwdMksys);
712 static HRESULT WINAPI URLMonikerImpl_IBinding_QueryInterface(IBinding* iface,REFIID riid,void** ppvObject)
714 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
716 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
718 /* Perform a sanity check on the parameters.*/
719 if ( (This==0) || (ppvObject==0) )
722 /* Initialize the return parameter */
725 /* Compare the riid with the interface IDs implemented by this object.*/
726 if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IBinding, riid))
729 /* Check that we obtained an interface.*/
731 return E_NOINTERFACE;
733 /* Query Interface always increases the reference count by one when it is successful */
734 URLMonikerImpl_IBinding_AddRef(iface);
740 static ULONG WINAPI URLMonikerImpl_IBinding_AddRef(IBinding* iface)
742 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
743 TRACE("(%p)\n",This);
745 return URLMonikerImpl_AddRef((IMoniker*)This);
748 static ULONG WINAPI URLMonikerImpl_IBinding_Release(IBinding* iface)
750 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
751 TRACE("(%p)\n",This);
753 return URLMonikerImpl_Release((IMoniker*)This);
756 static HRESULT WINAPI URLMonikerImpl_IBinding_Abort(IBinding* iface)
758 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
759 FIXME("(%p): stub\n", This);
764 static HRESULT WINAPI URLMonikerImpl_IBinding_GetBindResult(IBinding* iface, CLSID* pclsidProtocol, DWORD* pdwResult, LPOLESTR* pszResult, DWORD* pdwReserved)
766 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
767 FIXME("(%p)->(%s, %p, %p, %p): stub\n", This, debugstr_guid(pclsidProtocol), pdwResult, pszResult, pdwReserved);
772 static HRESULT WINAPI URLMonikerImpl_IBinding_GetPriority(IBinding* iface, LONG* pnPriority)
774 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
775 FIXME("(%p)->(%p): stub\n", This, pnPriority);
780 static HRESULT WINAPI URLMonikerImpl_IBinding_Resume(IBinding* iface)
782 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
783 FIXME("(%p): stub\n", This);
788 static HRESULT WINAPI URLMonikerImpl_IBinding_SetPriority(IBinding* iface, LONG nPriority)
790 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
791 FIXME("(%p)->(%ld): stub\n", This, nPriority);
796 static HRESULT WINAPI URLMonikerImpl_IBinding_Suspend(IBinding* iface)
798 ICOM_THIS_MULTI(URLMonikerImpl, lpvtbl2, iface);
799 FIXME("(%p): stub\n", This);
804 /***********************************************************************
805 * CreateAsyncBindCtxEx (URLMON.@)
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
826 * E_OUTOFMEMORY out of memory
827 * MK_E_SYNTAX not a valid url
830 HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
834 IID iid = IID_IMoniker;
836 TRACE("(%p, %s, %p)\n", pmkContext, debugstr_w(szURL), ppmk);
838 if (NULL != pmkContext)
839 FIXME("Non-null pmkContext not implemented\n");
841 if(!(obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj))))
842 return E_OUTOFMEMORY;
844 hres = URLMonikerImpl_Construct(obj, szURL);
846 hres = URLMonikerImpl_QueryInterface((IMoniker*)obj, &iid, (void**)ppmk);
848 HeapFree(GetProcessHeap(), 0, obj);
853 /***********************************************************************
854 * CoInternetGetSession (URLMON.@)
856 * Creates a session and returns a pointer to an InternetSession interface.
860 * E_OUTOFMEMORY out of memory
861 * E_INVALIDARG invalid argument
864 HRESULT WINAPI CoInternetGetSession(DWORD dwSessionMode, /*IInternetSession*/void **ppIInternetSession, DWORD dwReserved)
866 FIXME("(%ld, %p, %ld): stub\n", dwSessionMode, ppIInternetSession, dwReserved);
869 ERR("dwSessionMode: %ld, must be zero\n", dwSessionMode);
873 ERR("dwReserved: %ld, must be zero\n", dwReserved);
876 *ppIInternetSession=NULL;
877 return E_OUTOFMEMORY;
880 /***********************************************************************
881 * FindMimeFromData (URLMON.@)
883 * Determines the Multipurpose Internet Mail Extensions (MIME) type from the data provided.
886 HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer,
887 DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags,
888 LPWSTR* ppwzMimeOut, DWORD dwReserved)
891 return E_OUTOFMEMORY;
894 /***********************************************************************
895 * RegisterBindStatusCallback (URLMON.@)
897 * Register a bind status callback
901 * E_INVALIDARG invalid argument(s)
902 * E_OUTOFMEMORY out of memory
905 HRESULT WINAPI RegisterBindStatusCallback(
907 IBindStatusCallback *pbsc,
908 IBindStatusCallback **ppbscPrevious,
911 IBindStatusCallback *prev;
913 TRACE("(%p,%p,%p,%lu)\n", pbc, pbsc, ppbscPrevious, dwReserved);
915 if (pbc == NULL || pbsc == NULL)
918 if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown **)&prev)))
920 IBindCtx_RevokeObjectParam(pbc, BSCBHolder);
922 *ppbscPrevious = prev;
924 IBindStatusCallback_Release(prev);
927 return IBindCtx_RegisterObjectParam(pbc, BSCBHolder, (IUnknown *)pbsc);
930 /***********************************************************************
931 * RevokeBindStatusCallback (URLMON.@)
933 * Unregister a bind status callback
937 * E_INVALIDARG invalid argument(s)
938 * E_FAIL pbsc wasn't registered with pbc
941 HRESULT WINAPI RevokeBindStatusCallback(
943 IBindStatusCallback *pbsc)
945 IBindStatusCallback *callback;
948 TRACE("(%p,%p)\n", pbc, pbsc);
950 if (pbc == NULL || pbsc == NULL)
953 if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown **)&callback)))
955 if (callback == pbsc)
957 IBindCtx_RevokeObjectParam(pbc, BSCBHolder);
960 IBindStatusCallback_Release(pbsc);
966 /***********************************************************************
967 * ReleaseBindInfo (URLMON.@)
969 * Releases the resources used by the specified BINDINFO structure
972 void WINAPI ReleaseBindInfo(BINDINFO* pbindinfo)