4 * Copyright 1999 Ulrich Czekalla for Corel Corporation
5 * Copyright 2002 Huw D M Davies for CodeWeavers
6 * Copyright 2005 Jacek Caban for CodeWeavers
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "urlmon_main.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
35 IMoniker IMoniker_iface;
36 IUriContainer IUriContainer_iface;
44 static inline URLMoniker *impl_from_IMoniker(IMoniker *iface)
46 return CONTAINING_RECORD(iface, URLMoniker, IMoniker_iface);
49 static HRESULT WINAPI URLMoniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
51 URLMoniker *This = impl_from_IMoniker(iface);
56 if(IsEqualIID(&IID_IUnknown, riid)) {
57 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
59 }else if(IsEqualIID(&IID_IPersist, riid)) {
60 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
62 }else if(IsEqualIID(&IID_IPersistStream,riid)) {
63 TRACE("(%p)->(IID_IPersistStream %p)\n", This, ppv);
65 }else if(IsEqualIID(&IID_IMoniker, riid)) {
66 TRACE("(%p)->(IID_IMoniker %p)\n", This, ppv);
68 }else if(IsEqualIID(&IID_IAsyncMoniker, riid)) {
69 TRACE("(%p)->(IID_IAsyncMoniker %p)\n", This, ppv);
71 }else if(IsEqualIID(&IID_IUriContainer, riid)) {
72 TRACE("(%p)->(IID_IUriContainer %p)\n", This, ppv);
73 *ppv = &This->IUriContainer_iface;
75 WARN("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
80 IMoniker_AddRef((IUnknown*)*ppv);
84 static ULONG WINAPI URLMoniker_AddRef(IMoniker *iface)
86 URLMoniker *This = impl_from_IMoniker(iface);
87 ULONG refCount = InterlockedIncrement(&This->ref);
89 TRACE("(%p) ref=%u\n",This, refCount);
94 static ULONG WINAPI URLMoniker_Release(IMoniker *iface)
96 URLMoniker *This = impl_from_IMoniker(iface);
97 ULONG refCount = InterlockedDecrement(&This->ref);
99 TRACE("(%p) ref=%u\n",This, refCount);
103 IUri_Release(This->uri);
104 SysFreeString(This->URLName);
107 URLMON_UnlockModule();
113 static HRESULT WINAPI URLMoniker_GetClassID(IMoniker *iface, CLSID *pClassID)
115 URLMoniker *This = impl_from_IMoniker(iface);
117 TRACE("(%p,%p)\n", This, pClassID);
122 /* Windows always returns CLSID_StdURLMoniker */
123 *pClassID = CLSID_StdURLMoniker;
127 static HRESULT WINAPI URLMoniker_IsDirty(IMoniker *iface)
129 URLMoniker *This = impl_from_IMoniker(iface);
131 TRACE("(%p)\n",This);
133 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
134 method in the OLE-provided moniker interfaces always return S_FALSE because
135 their internal state never changes. */
139 static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
141 URLMoniker *This = impl_from_IMoniker(iface);
149 TRACE("(%p,%p)\n",This,pStm);
156 * Writes a ULONG containing length of unicode string, followed
157 * by that many unicode characters
159 hres = IStream_Read(pStm, &size, sizeof(ULONG), &got);
162 if(got != sizeof(ULONG))
165 new_uri_str = heap_alloc(size+sizeof(WCHAR));
167 return E_OUTOFMEMORY;
169 hres = IStream_Read(pStm, new_uri_str, size, NULL);
170 new_uri_str[size/sizeof(WCHAR)] = 0;
172 hres = CreateUri(new_uri_str, 0, 0, &new_uri);
173 heap_free(new_uri_str);
177 hres = IUri_GetDisplayUri(new_uri, &new_url);
179 IUri_Release(new_uri);
183 SysFreeString(This->URLName);
185 IUri_Release(This->uri);
188 This->URLName = new_url;
192 static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClearDirty)
194 URLMoniker *This = impl_from_IMoniker(iface);
198 TRACE("(%p,%p,%d)\n", This, pStm, fClearDirty);
203 size = (SysStringLen(This->URLName) + 1)*sizeof(WCHAR);
204 res=IStream_Write(pStm,&size,sizeof(ULONG),NULL);
206 res=IStream_Write(pStm,This->URLName,size,NULL);
212 static HRESULT WINAPI URLMoniker_GetSizeMax(IMoniker* iface, ULARGE_INTEGER *pcbSize)
214 URLMoniker *This = impl_from_IMoniker(iface);
216 TRACE("(%p,%p)\n",This,pcbSize);
221 pcbSize->QuadPart = sizeof(ULONG) + ((SysStringLen(This->URLName)+1) * sizeof(WCHAR));
225 static HRESULT WINAPI URLMoniker_BindToObject(IMoniker *iface, IBindCtx* pbc, IMoniker *pmkToLeft,
226 REFIID riid, void **ppv)
228 URLMoniker *This = impl_from_IMoniker(iface);
229 IRunningObjectTable *obj_tbl;
232 TRACE("(%p)->(%p,%p,%s,%p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppv);
234 hres = IBindCtx_GetRunningObjectTable(pbc, &obj_tbl);
235 if(SUCCEEDED(hres)) {
236 FIXME("use running object table\n");
237 IRunningObjectTable_Release(obj_tbl);
245 return bind_to_object(&This->IMoniker_iface, This->uri, pbc, riid, ppv);
248 static HRESULT WINAPI URLMoniker_BindToStorage(IMoniker* iface, IBindCtx* pbc,
249 IMoniker* pmkToLeft, REFIID riid, void **ppvObject)
251 URLMoniker *This = impl_from_IMoniker(iface);
253 TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject);
255 if(ppvObject) *ppvObject = NULL;
257 if(!pbc || !ppvObject) return E_INVALIDARG;
260 FIXME("Unsupported pmkToLeft\n");
265 return bind_to_storage(This->uri, pbc, riid, ppvObject);
268 static HRESULT WINAPI URLMoniker_Reduce(IMoniker *iface, IBindCtx *pbc,
269 DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
271 URLMoniker *This = impl_from_IMoniker(iface);
273 TRACE("(%p,%p,%d,%p,%p)\n", This, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
278 IMoniker_AddRef(iface);
279 *ppmkReduced = iface;
280 return MK_S_REDUCED_TO_SELF;
283 static HRESULT WINAPI URLMoniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
284 BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
286 URLMoniker *This = impl_from_IMoniker(iface);
287 FIXME("(%p)->(%p,%d,%p): stub\n",This,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
291 static HRESULT WINAPI URLMoniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
293 URLMoniker *This = impl_from_IMoniker(iface);
295 TRACE("(%p,%d,%p)\n", This, fForward, ppenumMoniker);
300 /* Does not support sub-monikers */
301 *ppenumMoniker = NULL;
305 static HRESULT WINAPI URLMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
307 URLMoniker *This = impl_from_IMoniker(iface);
313 TRACE("(%p,%p)\n",This, pmkOtherMoniker);
315 if(pmkOtherMoniker==NULL)
318 IMoniker_GetClassID(pmkOtherMoniker,&clsid);
320 if(!IsEqualCLSID(&clsid,&CLSID_StdURLMoniker))
323 res = CreateBindCtx(0,&bind);
328 if(SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&urlPath))) {
329 int result = lstrcmpiW(urlPath, This->URLName);
330 CoTaskMemFree(urlPath);
334 IUnknown_Release(bind);
339 static HRESULT WINAPI URLMoniker_Hash(IMoniker *iface, DWORD *pdwHash)
341 URLMoniker *This = impl_from_IMoniker(iface);
342 int h = 0,i,skip,len;
346 TRACE("(%p,%p)\n",This,pdwHash);
355 for(i = len ; i > 0; i--) {
356 h = (h * 37) + val[off++];
359 /* only sample some characters */
361 for(i = len; i > 0; i -= skip, off += skip) {
362 h = (h * 39) + val[off];
369 static HRESULT WINAPI URLMoniker_IsRunning(IMoniker* iface, IBindCtx* pbc,
370 IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
372 URLMoniker *This = impl_from_IMoniker(iface);
373 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pmkNewlyRunning);
377 static HRESULT WINAPI URLMoniker_GetTimeOfLastChange(IMoniker *iface,
378 IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
380 URLMoniker *This = impl_from_IMoniker(iface);
381 FIXME("(%p)->(%p,%p,%p): stub\n", This, pbc, pmkToLeft, pFileTime);
385 static HRESULT WINAPI URLMoniker_Inverse(IMoniker *iface, IMoniker **ppmk)
387 URLMoniker *This = impl_from_IMoniker(iface);
388 TRACE("(%p,%p)\n",This,ppmk);
389 return MK_E_NOINVERSE;
392 static HRESULT WINAPI URLMoniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkPrefix)
394 URLMoniker *This = impl_from_IMoniker(iface);
395 FIXME("(%p)->(%p,%p): stub\n",This,pmkOther,ppmkPrefix);
399 static HRESULT WINAPI URLMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath)
401 URLMoniker *This = impl_from_IMoniker(iface);
402 FIXME("(%p)->(%p,%p): stub\n",This,pmOther,ppmkRelPath);
406 static HRESULT WINAPI URLMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
407 LPOLESTR *ppszDisplayName)
409 URLMoniker *This = impl_from_IMoniker(iface);
412 TRACE("(%p,%p,%p,%p)\n", This, pbc, pmkToLeft, ppszDisplayName);
418 return E_OUTOFMEMORY;
420 /* FIXME: If this is a partial URL, try and get a URL moniker from SZ_URLCONTEXT in the bind context,
421 then look at pmkToLeft to try and complete the URL
423 len = SysStringLen(This->URLName)+1;
424 *ppszDisplayName = CoTaskMemAlloc(len*sizeof(WCHAR));
425 if(!*ppszDisplayName)
426 return E_OUTOFMEMORY;
427 lstrcpyW(*ppszDisplayName, This->URLName);
431 static HRESULT WINAPI URLMoniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
432 LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
434 URLMoniker *This = impl_from_IMoniker(iface);
435 FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
439 static HRESULT WINAPI URLMoniker_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys)
441 URLMoniker *This = impl_from_IMoniker(iface);
443 TRACE("(%p,%p)\n",This,pwdMksys);
448 *pwdMksys = MKSYS_URLMONIKER;
452 static const IMonikerVtbl URLMonikerVtbl =
454 URLMoniker_QueryInterface,
457 URLMoniker_GetClassID,
461 URLMoniker_GetSizeMax,
462 URLMoniker_BindToObject,
463 URLMoniker_BindToStorage,
465 URLMoniker_ComposeWith,
469 URLMoniker_IsRunning,
470 URLMoniker_GetTimeOfLastChange,
472 URLMoniker_CommonPrefixWith,
473 URLMoniker_RelativePathTo,
474 URLMoniker_GetDisplayName,
475 URLMoniker_ParseDisplayName,
476 URLMoniker_IsSystemMoniker
479 static inline URLMoniker *impl_from_IUriContainer(IUriContainer *iface)
481 return CONTAINING_RECORD(iface, URLMoniker, IUriContainer_iface);
484 static HRESULT WINAPI UriContainer_QueryInterface(IUriContainer *iface, REFIID riid, void **ppv)
486 URLMoniker *This = impl_from_IUriContainer(iface);
487 return IMoniker_QueryInterface(&This->IMoniker_iface, riid, ppv);
490 static ULONG WINAPI UriContainer_AddRef(IUriContainer *iface)
492 URLMoniker *This = impl_from_IUriContainer(iface);
493 return IMoniker_AddRef(&This->IMoniker_iface);
496 static ULONG WINAPI UriContainer_Release(IUriContainer *iface)
498 URLMoniker *This = impl_from_IUriContainer(iface);
499 return IMoniker_Release(&This->IMoniker_iface);
502 static HRESULT WINAPI UriContainer_GetIUri(IUriContainer *iface, IUri **ppIUri)
504 URLMoniker *This = impl_from_IUriContainer(iface);
506 TRACE("(%p)->(%p)\n", This, ppIUri);
513 IUri_AddRef(This->uri);
518 static const IUriContainerVtbl UriContainerVtbl = {
519 UriContainer_QueryInterface,
521 UriContainer_Release,
525 static HRESULT create_moniker(IUri *uri, URLMoniker **ret)
530 mon = heap_alloc(sizeof(*mon));
532 return E_OUTOFMEMORY;
534 mon->IMoniker_iface.lpVtbl = &URLMonikerVtbl;
535 mon->IUriContainer_iface.lpVtbl = &UriContainerVtbl;
539 /* FIXME: try to avoid it */
540 hres = IUri_GetDisplayUri(uri, &mon->URLName);
558 HRESULT StdURLMoniker_Construct(IUnknown *outer, void **ppv)
563 TRACE("(%p %p)\n", outer, ppv);
565 hres = create_moniker(NULL, &mon);
569 *ppv = &mon->IMoniker_iface;
573 static const DWORD create_flags_map[3] = {
574 Uri_CREATE_FILE_USE_DOS_PATH, /* URL_MK_LEGACY */
575 0, /* URL_MK_UNIFORM */
576 Uri_CREATE_NO_CANONICALIZE /* URL_MK_NO_CANONICALIZE */
579 static const DWORD combine_flags_map[3] = {
580 URL_FILE_USE_PATHURL, /* URL_MK_LEGACY */
581 0, /* URL_MK_UNIFORM */
582 URL_DONT_SIMPLIFY /* URL_MK_NO_CANONICALIZE */
585 /***********************************************************************
586 * CreateURLMonikerEx (URLMON.@)
588 * Create a url moniker.
591 * pmkContext [I] Context
592 * szURL [I] Url to create the moniker for
593 * ppmk [O] Destination for created moniker.
597 * Success: S_OK. ppmk contains the created IMoniker object.
598 * Failure: MK_E_SYNTAX if szURL is not a valid url, or
599 * E_OUTOFMEMORY if memory allocation fails.
601 HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk, DWORD dwFlags)
603 IUri *uri, *base_uri = NULL;
607 TRACE("(%p, %s, %p, %08x)\n", pmkContext, debugstr_w(szURL), ppmk, dwFlags);
615 if(dwFlags >= sizeof(create_flags_map)/sizeof(*create_flags_map)) {
616 FIXME("Unsupported flags %x\n", dwFlags);
621 IUriContainer *uri_container;
623 hres = IMoniker_QueryInterface(pmkContext, &IID_IUriContainer, (void**)&uri_container);
624 if(SUCCEEDED(hres)) {
625 hres = IUriContainer_GetIUri(uri_container, &base_uri);
626 IUriContainer_Release(uri_container);
633 hres = CoInternetCombineUrlEx(base_uri, szURL, combine_flags_map[dwFlags], &uri, 0);
634 IUri_Release(base_uri);
636 hres = CreateUri(szURL, Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|create_flags_map[dwFlags], 0, &uri);
641 hres = create_moniker(uri, &obj);
646 *ppmk = &obj->IMoniker_iface;
650 /***********************************************************************
651 * CreateURLMonikerEx2 (URLMON.@)
653 HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **ppmk, DWORD dwFlags)
655 IUri *context_uri = NULL, *uri;
656 IUriContainer *uri_container;
660 TRACE("(%p %p %p %x)\n", pmkContext, pUri, ppmk, dwFlags);
668 if(dwFlags >= sizeof(create_flags_map)/sizeof(*create_flags_map)) {
669 FIXME("Unsupported flags %x\n", dwFlags);
674 hres = IMoniker_QueryInterface(pmkContext, &IID_IUriContainer, (void**)&uri_container);
675 if(SUCCEEDED(hres)) {
676 hres = IUriContainer_GetIUri(uri_container, &context_uri);
679 IUriContainer_Release(uri_container);
684 hres = CoInternetCombineIUri(context_uri, pUri, combine_flags_map[dwFlags], &uri, 0);
685 IUri_Release(context_uri);
693 hres = create_moniker(uri, &ret);
698 *ppmk = &ret->IMoniker_iface;
702 /**********************************************************************
703 * CreateURLMoniker (URLMON.@)
705 * Create a url moniker.
708 * pmkContext [I] Context
709 * szURL [I] Url to create the moniker for
710 * ppmk [O] Destination for created moniker.
713 * Success: S_OK. ppmk contains the created IMoniker object.
714 * Failure: MK_E_SYNTAX if szURL is not a valid url, or
715 * E_OUTOFMEMORY if memory allocation fails.
717 HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
719 return CreateURLMonikerEx(pmkContext, szURL, ppmk, URL_MK_LEGACY);
722 /***********************************************************************
723 * IsAsyncMoniker (URLMON.@)
725 HRESULT WINAPI IsAsyncMoniker(IMoniker *pmk)
729 TRACE("(%p)\n", pmk);
732 if(SUCCEEDED(IMoniker_QueryInterface(pmk, &IID_IAsyncMoniker, (void**)&am))) {
733 IUnknown_Release(am);
739 /***********************************************************************
740 * BindAsyncMoniker (URLMON.@)
742 * Bind a bind status callback to an asynchronous URL Moniker.
745 * pmk [I] Moniker object to bind status callback to
746 * grfOpt [I] Options, seems not used
747 * pbsc [I] Status callback to bind
748 * iidResult [I] Interface to return
749 * ppvResult [O] Resulting asynchronous moniker object
753 * Failure: E_INVALIDARG, if any argument is invalid, or
754 * E_OUTOFMEMORY if memory allocation fails.
756 HRESULT WINAPI BindAsyncMoniker(IMoniker *pmk, DWORD grfOpt, IBindStatusCallback *pbsc, REFIID iidResult, LPVOID *ppvResult)
759 HRESULT hr = E_INVALIDARG;
761 TRACE("(%p %08x %p %s %p)\n", pmk, grfOpt, pbsc, debugstr_guid(iidResult), ppvResult);
763 if (pmk && ppvResult)
767 hr = CreateAsyncBindCtx(0, pbsc, NULL, &pbc);
770 hr = IMoniker_BindToObject(pmk, pbc, NULL, iidResult, ppvResult);
771 IBindCtx_Release(pbc);
777 /***********************************************************************
778 * MkParseDisplayNameEx (URLMON.@)
780 HRESULT WINAPI MkParseDisplayNameEx(IBindCtx *pbc, LPCWSTR szDisplayName, ULONG *pchEaten, LPMONIKER *ppmk)
782 TRACE("(%p %s %p %p)\n", pbc, debugstr_w(szDisplayName), pchEaten, ppmk);
784 if (!pbc || !szDisplayName || !*szDisplayName || !pchEaten || !ppmk)
787 if(is_registered_protocol(szDisplayName)) {
790 hres = CreateURLMoniker(NULL, szDisplayName, ppmk);
791 if(SUCCEEDED(hres)) {
792 *pchEaten = strlenW(szDisplayName);
797 return MkParseDisplayName(pbc, szDisplayName, pchEaten, ppmk);
801 /***********************************************************************
802 * URLDownloadToCacheFileA (URLMON.@)
804 HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPSTR szFileName,
805 DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
807 LPWSTR url = NULL, file_name = NULL;
811 TRACE("(%p %s %p %d %d %p)\n", lpUnkCaller, debugstr_a(szURL), szFileName,
812 dwBufLength, dwReserved, pBSC);
815 len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
816 url = heap_alloc(len*sizeof(WCHAR));
817 MultiByteToWideChar(CP_ACP, 0, szURL, -1, url, len);
821 file_name = heap_alloc(dwBufLength*sizeof(WCHAR));
823 hres = URLDownloadToCacheFileW(lpUnkCaller, url, file_name, dwBufLength*sizeof(WCHAR),
826 if(SUCCEEDED(hres) && file_name)
827 WideCharToMultiByte(CP_ACP, 0, file_name, -1, szFileName, dwBufLength, NULL, NULL);
830 heap_free(file_name);
835 /***********************************************************************
836 * URLDownloadToCacheFileW (URLMON.@)
838 HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPWSTR szFileName,
839 DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
841 WCHAR cache_path[MAX_PATH + 1];
842 FILETIME expire, modified;
846 static WCHAR header[] = {
847 'H','T','T','P','/','1','.','0',' ','2','0','0',' ',
848 'O','K','\\','r','\\','n','\\','r','\\','n',0
851 TRACE("(%p, %s, %p, %d, %d, %p)\n", lpUnkCaller, debugstr_w(szURL),
852 szFileName, dwBufLength, dwReserved, pBSC);
854 if (!szURL || !szFileName)
857 ext = PathFindExtensionW(szURL);
859 if (!CreateUrlCacheEntryW(szURL, 0, ext, cache_path, 0))
862 hr = URLDownloadToFileW(lpUnkCaller, szURL, cache_path, 0, pBSC);
866 expire.dwHighDateTime = 0;
867 expire.dwLowDateTime = 0;
868 modified.dwHighDateTime = 0;
869 modified.dwLowDateTime = 0;
871 if (!CommitUrlCacheEntryW(szURL, cache_path, expire, modified, NORMAL_CACHE_ENTRY,
872 header, sizeof(header), NULL, NULL))
875 if (strlenW(cache_path) > dwBufLength)
876 return E_OUTOFMEMORY;
878 lstrcpyW(szFileName, cache_path);
883 /***********************************************************************
884 * HlinkSimpleNavigateToMoniker (URLMON.@)
886 HRESULT WINAPI HlinkSimpleNavigateToMoniker(IMoniker *pmkTarget,
887 LPCWSTR szLocation, LPCWSTR szTargetFrameName, IUnknown *pUnk,
888 IBindCtx *pbc, IBindStatusCallback *pbsc, DWORD grfHLNF, DWORD dwReserved)
895 hres = IMoniker_GetDisplayName(pmkTarget, pbc, 0, &target);
897 hres = HlinkSimpleNavigateToString( target, szLocation, szTargetFrameName,
898 pUnk, pbc, pbsc, grfHLNF, dwReserved );
899 CoTaskMemFree(target);
904 /***********************************************************************
905 * HlinkSimpleNavigateToString (URLMON.@)
907 HRESULT WINAPI HlinkSimpleNavigateToString( LPCWSTR szTarget,
908 LPCWSTR szLocation, LPCWSTR szTargetFrameName, IUnknown *pUnk,
909 IBindCtx *pbc, IBindStatusCallback *pbsc, DWORD grfHLNF, DWORD dwReserved)
911 FIXME("%s %s %s %p %p %p %u %u partial stub\n", debugstr_w( szTarget ), debugstr_w( szLocation ),
912 debugstr_w( szTargetFrameName ), pUnk, pbc, pbsc, grfHLNF, dwReserved);
914 /* undocumented: 0 means HLNF_OPENINNEWWINDOW*/
915 if (!grfHLNF) grfHLNF = HLNF_OPENINNEWWINDOW;
917 if (grfHLNF == HLNF_OPENINNEWWINDOW)
919 SHELLEXECUTEINFOW sei;
920 static const WCHAR openW[] = { 'o', 'p', 'e', 'n', 0 };
922 memset(&sei, 0, sizeof(sei));
923 sei.cbSize = sizeof(sei);
925 sei.nShow = SW_SHOWNORMAL;
926 sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NO_CONSOLE;
927 sei.lpFile = szTarget;
929 if (ShellExecuteExW(&sei)) return S_OK;
935 /***********************************************************************
936 * HlinkNavigateString (URLMON.@)
938 HRESULT WINAPI HlinkNavigateString( IUnknown *pUnk, LPCWSTR szTarget )
940 TRACE("%p %s\n", pUnk, debugstr_w( szTarget ) );
941 return HlinkSimpleNavigateToString(
942 szTarget, NULL, NULL, pUnk, NULL, NULL, 0, 0 );
945 /***********************************************************************
946 * GetSoftwareUpdateInfo (URLMON.@)
948 HRESULT WINAPI GetSoftwareUpdateInfo( LPCWSTR szDistUnit, LPSOFTDISTINFO psdi )
950 FIXME("%s %p\n", debugstr_w(szDistUnit), psdi );
954 /***********************************************************************
955 * AsyncInstallDistributionUnit (URLMON.@)
957 HRESULT WINAPI AsyncInstallDistributionUnit( LPCWSTR szDistUnit, LPCWSTR szTYPE,
958 LPCWSTR szExt, DWORD dwFileVersionMS, DWORD dwFileVersionLS,
959 LPCWSTR szURL, IBindCtx *pbc, LPVOID pvReserved, DWORD flags )