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
25 #include "urlmon_main.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(urlmon
);
38 const IMonikerVtbl
* lpvtbl
; /* VTable relative to the IMoniker interface.*/
40 LONG ref
; /* reference counter for this object */
42 LPOLESTR URLName
; /* URL string identified by this URLmoniker */
45 /*******************************************************************************
46 * URLMoniker_QueryInterface
47 *******************************************************************************/
48 static HRESULT WINAPI
URLMonikerImpl_QueryInterface(IMoniker
* iface
,REFIID riid
,void** ppvObject
)
50 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
52 TRACE("(%p)->(%s,%p)\n",This
,debugstr_guid(riid
),ppvObject
);
54 /* Perform a sanity check on the parameters.*/
55 if ( (This
==0) || (ppvObject
==0) )
58 /* Initialize the return parameter */
61 /* Compare the riid with the interface IDs implemented by this object.*/
62 if (IsEqualIID(&IID_IUnknown
, riid
) ||
63 IsEqualIID(&IID_IPersist
, riid
) ||
64 IsEqualIID(&IID_IPersistStream
,riid
) ||
65 IsEqualIID(&IID_IMoniker
, riid
)
69 /* Check that we obtained an interface.*/
73 /* Query Interface always increases the reference count by one when it is successful */
74 IMoniker_AddRef(iface
);
79 /******************************************************************************
81 ******************************************************************************/
82 static ULONG WINAPI
URLMonikerImpl_AddRef(IMoniker
* iface
)
84 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
85 ULONG refCount
= InterlockedIncrement(&This
->ref
);
87 TRACE("(%p) ref=%u\n",This
, refCount
);
92 /******************************************************************************
94 ******************************************************************************/
95 static ULONG WINAPI
URLMonikerImpl_Release(IMoniker
* iface
)
97 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
98 ULONG refCount
= InterlockedDecrement(&This
->ref
);
100 TRACE("(%p) ref=%u\n",This
, refCount
);
102 /* destroy the object if there's no more reference on it */
104 heap_free(This
->URLName
);
107 URLMON_UnlockModule();
114 /******************************************************************************
115 * URLMoniker_GetClassID
116 ******************************************************************************/
117 static HRESULT WINAPI
URLMonikerImpl_GetClassID(IMoniker
* iface
,
118 CLSID
*pClassID
)/* Pointer to CLSID of object */
120 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
122 TRACE("(%p,%p)\n",This
,pClassID
);
126 /* Windows always returns CLSID_StdURLMoniker */
127 *pClassID
= CLSID_StdURLMoniker
;
131 /******************************************************************************
133 ******************************************************************************/
134 static HRESULT WINAPI
URLMonikerImpl_IsDirty(IMoniker
* iface
)
136 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
137 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
138 method in the OLE-provided moniker interfaces always return S_FALSE because
139 their internal state never changes. */
141 TRACE("(%p)\n",This
);
146 /******************************************************************************
150 * Writes a ULONG containing length of unicode string, followed
151 * by that many unicode characters
152 ******************************************************************************/
153 static HRESULT WINAPI
URLMonikerImpl_Load(IMoniker
* iface
,IStream
* pStm
)
155 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
160 TRACE("(%p,%p)\n",This
,pStm
);
165 res
= IStream_Read(pStm
, &size
, sizeof(ULONG
), &got
);
167 if(got
== sizeof(ULONG
)) {
168 heap_free(This
->URLName
);
169 This
->URLName
= heap_alloc(size
);
173 res
= IStream_Read(pStm
, This
->URLName
, size
, NULL
);
174 This
->URLName
[size
/sizeof(WCHAR
) - 1] = 0;
183 /******************************************************************************
185 ******************************************************************************/
186 static HRESULT WINAPI
URLMonikerImpl_Save(IMoniker
* iface
,
187 IStream
* pStm
,/* pointer to the stream where the object is to be saved */
188 BOOL fClearDirty
)/* Specifies whether to clear the dirty flag */
190 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
194 TRACE("(%p,%p,%d)\n",This
,pStm
,fClearDirty
);
199 size
= (strlenW(This
->URLName
) + 1)*sizeof(WCHAR
);
200 res
=IStream_Write(pStm
,&size
,sizeof(ULONG
),NULL
);
202 res
=IStream_Write(pStm
,This
->URLName
,size
,NULL
);
207 /******************************************************************************
208 * URLMoniker_GetSizeMax
209 ******************************************************************************/
210 static HRESULT WINAPI
URLMonikerImpl_GetSizeMax(IMoniker
* iface
,
211 ULARGE_INTEGER
* pcbSize
)/* Pointer to size of stream needed to save object */
213 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
215 TRACE("(%p,%p)\n",This
,pcbSize
);
220 pcbSize
->QuadPart
= sizeof(ULONG
) + ((strlenW(This
->URLName
)+1) * sizeof(WCHAR
));
224 /******************************************************************************
225 * URLMoniker_BindToObject
226 ******************************************************************************/
227 static HRESULT WINAPI
URLMonikerImpl_BindToObject(IMoniker
* iface
,
233 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
234 IRunningObjectTable
*obj_tbl
;
237 TRACE("(%p)->(%p,%p,%s,%p): stub\n", This
, pbc
, pmkToLeft
, debugstr_guid(riid
), ppv
);
239 hres
= IBindCtx_GetRunningObjectTable(pbc
, &obj_tbl
);
240 if(SUCCEEDED(hres
)) {
241 FIXME("use running object table\n");
242 IRunningObjectTable_Release(obj_tbl
);
245 return bind_to_object(iface
, This
->URLName
, pbc
, riid
, ppv
);
248 /******************************************************************************
249 * URLMoniker_BindToStorage
250 ******************************************************************************/
251 static HRESULT WINAPI
URLMonikerImpl_BindToStorage(IMoniker
* iface
,
257 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
259 TRACE("(%p)->(%p %p %s %p)\n", This
, pbc
, pmkToLeft
, debugstr_guid(riid
), ppvObject
);
262 FIXME("Unsupported pmkToLeft\n");
264 return bind_to_storage(This
->URLName
, pbc
, riid
, ppvObject
);
267 /******************************************************************************
269 ******************************************************************************/
270 static HRESULT WINAPI
URLMonikerImpl_Reduce(IMoniker
* iface
,
272 DWORD dwReduceHowFar
,
273 IMoniker
** ppmkToLeft
,
274 IMoniker
** ppmkReduced
)
276 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
278 TRACE("(%p,%p,%d,%p,%p)\n",This
,pbc
,dwReduceHowFar
,ppmkToLeft
,ppmkReduced
);
283 URLMonikerImpl_AddRef(iface
);
284 *ppmkReduced
= iface
;
285 return MK_S_REDUCED_TO_SELF
;
288 /******************************************************************************
289 * URLMoniker_ComposeWith
290 ******************************************************************************/
291 static HRESULT WINAPI
URLMonikerImpl_ComposeWith(IMoniker
* iface
,
293 BOOL fOnlyIfNotGeneric
,
294 IMoniker
** ppmkComposite
)
296 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
297 FIXME("(%p)->(%p,%d,%p): stub\n",This
,pmkRight
,fOnlyIfNotGeneric
,ppmkComposite
);
302 /******************************************************************************
304 ******************************************************************************/
305 static HRESULT WINAPI
URLMonikerImpl_Enum(IMoniker
* iface
,BOOL fForward
, IEnumMoniker
** ppenumMoniker
)
307 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
308 TRACE("(%p,%d,%p)\n",This
,fForward
,ppenumMoniker
);
313 /* Does not support sub-monikers */
314 *ppenumMoniker
= NULL
;
318 /******************************************************************************
320 ******************************************************************************/
321 static HRESULT WINAPI
URLMonikerImpl_IsEqual(IMoniker
* iface
,IMoniker
* pmkOtherMoniker
)
323 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
329 TRACE("(%p,%p)\n",This
,pmkOtherMoniker
);
331 if(pmkOtherMoniker
==NULL
)
334 IMoniker_GetClassID(pmkOtherMoniker
,&clsid
);
336 if(!IsEqualCLSID(&clsid
,&CLSID_StdURLMoniker
))
339 res
= CreateBindCtx(0,&bind
);
344 if(SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker
,bind
,NULL
,&urlPath
))) {
345 int result
= lstrcmpiW(urlPath
, This
->URLName
);
346 CoTaskMemFree(urlPath
);
350 IUnknown_Release(bind
);
355 /******************************************************************************
357 ******************************************************************************/
358 static HRESULT WINAPI
URLMonikerImpl_Hash(IMoniker
* iface
,DWORD
* pdwHash
)
360 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
362 int h
= 0,i
,skip
,len
;
366 TRACE("(%p,%p)\n",This
,pdwHash
);
375 for(i
= len
; i
> 0; i
--) {
376 h
= (h
* 37) + val
[off
++];
380 /* only sample some characters */
382 for(i
= len
; i
> 0; i
-= skip
, off
+= skip
) {
383 h
= (h
* 39) + val
[off
];
390 /******************************************************************************
391 * URLMoniker_IsRunning
392 ******************************************************************************/
393 static HRESULT WINAPI
URLMonikerImpl_IsRunning(IMoniker
* iface
,
396 IMoniker
* pmkNewlyRunning
)
398 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
399 FIXME("(%p)->(%p,%p,%p): stub\n",This
,pbc
,pmkToLeft
,pmkNewlyRunning
);
404 /******************************************************************************
405 * URLMoniker_GetTimeOfLastChange
406 ******************************************************************************/
407 static HRESULT WINAPI
URLMonikerImpl_GetTimeOfLastChange(IMoniker
* iface
,
412 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
413 FIXME("(%p)->(%p,%p,%p): stub\n",This
,pbc
,pmkToLeft
,pFileTime
);
418 /******************************************************************************
420 ******************************************************************************/
421 static HRESULT WINAPI
URLMonikerImpl_Inverse(IMoniker
* iface
,IMoniker
** ppmk
)
423 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
424 TRACE("(%p,%p)\n",This
,ppmk
);
426 return MK_E_NOINVERSE
;
429 /******************************************************************************
430 * URLMoniker_CommonPrefixWith
431 ******************************************************************************/
432 static HRESULT WINAPI
URLMonikerImpl_CommonPrefixWith(IMoniker
* iface
,IMoniker
* pmkOther
,IMoniker
** ppmkPrefix
)
434 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
435 FIXME("(%p)->(%p,%p): stub\n",This
,pmkOther
,ppmkPrefix
);
440 /******************************************************************************
441 * URLMoniker_RelativePathTo
442 ******************************************************************************/
443 static HRESULT WINAPI
URLMonikerImpl_RelativePathTo(IMoniker
* iface
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
)
445 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
446 FIXME("(%p)->(%p,%p): stub\n",This
,pmOther
,ppmkRelPath
);
451 /******************************************************************************
452 * URLMoniker_GetDisplayName
453 ******************************************************************************/
454 static HRESULT WINAPI
URLMonikerImpl_GetDisplayName(IMoniker
* iface
,
457 LPOLESTR
*ppszDisplayName
)
459 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
463 TRACE("(%p,%p,%p,%p)\n",This
,pbc
,pmkToLeft
,ppszDisplayName
);
468 /* FIXME: If this is a partial URL, try and get a URL moniker from SZ_URLCONTEXT in the bind context,
469 then look at pmkToLeft to try and complete the URL
471 len
= lstrlenW(This
->URLName
)+1;
472 *ppszDisplayName
= CoTaskMemAlloc(len
*sizeof(WCHAR
));
473 if(!*ppszDisplayName
)
474 return E_OUTOFMEMORY
;
475 lstrcpyW(*ppszDisplayName
, This
->URLName
);
479 /******************************************************************************
480 * URLMoniker_ParseDisplayName
481 ******************************************************************************/
482 static HRESULT WINAPI
URLMonikerImpl_ParseDisplayName(IMoniker
* iface
,
485 LPOLESTR pszDisplayName
,
489 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
490 FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This
,pbc
,pmkToLeft
,pszDisplayName
,pchEaten
,ppmkOut
);
495 /******************************************************************************
496 * URLMoniker_IsSystemMoniker
497 ******************************************************************************/
498 static HRESULT WINAPI
URLMonikerImpl_IsSystemMoniker(IMoniker
* iface
,DWORD
* pwdMksys
)
500 URLMonikerImpl
*This
= (URLMonikerImpl
*)iface
;
501 TRACE("(%p,%p)\n",This
,pwdMksys
);
506 *pwdMksys
= MKSYS_URLMONIKER
;
510 /********************************************************************************/
511 /* Virtual function table for the URLMonikerImpl class which include IPersist,*/
512 /* IPersistStream and IMoniker functions. */
513 static const IMonikerVtbl VT_URLMonikerImpl
=
515 URLMonikerImpl_QueryInterface
,
516 URLMonikerImpl_AddRef
,
517 URLMonikerImpl_Release
,
518 URLMonikerImpl_GetClassID
,
519 URLMonikerImpl_IsDirty
,
522 URLMonikerImpl_GetSizeMax
,
523 URLMonikerImpl_BindToObject
,
524 URLMonikerImpl_BindToStorage
,
525 URLMonikerImpl_Reduce
,
526 URLMonikerImpl_ComposeWith
,
528 URLMonikerImpl_IsEqual
,
530 URLMonikerImpl_IsRunning
,
531 URLMonikerImpl_GetTimeOfLastChange
,
532 URLMonikerImpl_Inverse
,
533 URLMonikerImpl_CommonPrefixWith
,
534 URLMonikerImpl_RelativePathTo
,
535 URLMonikerImpl_GetDisplayName
,
536 URLMonikerImpl_ParseDisplayName
,
537 URLMonikerImpl_IsSystemMoniker
540 /******************************************************************************
541 * URLMoniker_Construct (local function)
542 *******************************************************************************/
543 static HRESULT
URLMonikerImpl_Construct(URLMonikerImpl
* This
, LPCOLESTR lpszLeftURLName
, LPCOLESTR lpszURLName
)
548 TRACE("(%p,%s,%s)\n",This
,debugstr_w(lpszLeftURLName
),debugstr_w(lpszURLName
));
550 This
->lpvtbl
= &VT_URLMonikerImpl
;
553 This
->URLName
= heap_alloc(INTERNET_MAX_URL_LENGTH
*sizeof(WCHAR
));
556 hres
= CoInternetCombineUrl(lpszLeftURLName
, lpszURLName
, URL_FILE_USE_PATHURL
,
557 This
->URLName
, INTERNET_MAX_URL_LENGTH
, &sizeStr
, 0);
559 hres
= CoInternetParseUrl(lpszURLName
, PARSE_CANONICALIZE
, URL_FILE_USE_PATHURL
,
560 This
->URLName
, INTERNET_MAX_URL_LENGTH
, &sizeStr
, 0);
563 heap_free(This
->URLName
);
569 if(sizeStr
!= INTERNET_MAX_URL_LENGTH
)
570 This
->URLName
= heap_realloc(This
->URLName
, (sizeStr
+1)*sizeof(WCHAR
));
572 TRACE("URLName = %s\n", debugstr_w(This
->URLName
));
577 /***********************************************************************
578 * CreateURLMonikerEx (URLMON.@)
580 * Create a url moniker.
583 * pmkContext [I] Context
584 * szURL [I] Url to create the moniker for
585 * ppmk [O] Destination for created moniker.
589 * Success: S_OK. ppmk contains the created IMoniker object.
590 * Failure: MK_E_SYNTAX if szURL is not a valid url, or
591 * E_OUTOFMEMORY if memory allocation fails.
593 HRESULT WINAPI
CreateURLMonikerEx(IMoniker
*pmkContext
, LPCWSTR szURL
, IMoniker
**ppmk
, DWORD dwFlags
)
597 LPOLESTR lefturl
= NULL
;
599 TRACE("(%p, %s, %p, %08x)\n", pmkContext
, debugstr_w(szURL
), ppmk
, dwFlags
);
601 if (dwFlags
& URL_MK_UNIFORM
) FIXME("ignoring flag URL_MK_UNIFORM\n");
603 if(!(obj
= heap_alloc(sizeof(*obj
))))
604 return E_OUTOFMEMORY
;
609 IMoniker_IsSystemMoniker(pmkContext
, &dwMksys
);
610 if(dwMksys
== MKSYS_URLMONIKER
&& SUCCEEDED(CreateBindCtx(0, &bind
))) {
611 IMoniker_GetDisplayName(pmkContext
, bind
, NULL
, &lefturl
);
612 TRACE("lefturl = %s\n", debugstr_w(lefturl
));
613 IBindCtx_Release(bind
);
617 hres
= URLMonikerImpl_Construct(obj
, lefturl
, szURL
);
618 CoTaskMemFree(lefturl
);
620 hres
= URLMonikerImpl_QueryInterface((IMoniker
*)obj
, &IID_IMoniker
, (void**)ppmk
);
626 /**********************************************************************
627 * CreateURLMoniker (URLMON.@)
629 * Create a url moniker.
632 * pmkContext [I] Context
633 * szURL [I] Url to create the moniker for
634 * ppmk [O] Destination for created moniker.
637 * Success: S_OK. ppmk contains the created IMoniker object.
638 * Failure: MK_E_SYNTAX if szURL is not a valid url, or
639 * E_OUTOFMEMORY if memory allocation fails.
641 HRESULT WINAPI
CreateURLMoniker(IMoniker
*pmkContext
, LPCWSTR szURL
, IMoniker
**ppmk
)
643 return CreateURLMonikerEx(pmkContext
, szURL
, ppmk
, URL_MK_LEGACY
);
646 /***********************************************************************
647 * IsAsyncMoniker (URLMON.@)
649 HRESULT WINAPI
IsAsyncMoniker(IMoniker
*pmk
)
653 TRACE("(%p)\n", pmk
);
656 if(SUCCEEDED(IMoniker_QueryInterface(pmk
, &IID_IAsyncMoniker
, (void**)&am
))) {
657 IUnknown_Release(am
);
663 /***********************************************************************
664 * BindAsyncMoniker (URLMON.@)
666 * Bind a bind status callback to an asynchronous URL Moniker.
669 * pmk [I] Moniker object to bind status callback to
670 * grfOpt [I] Options, seems not used
671 * pbsc [I] Status callback to bind
672 * iidResult [I] Interface to return
673 * ppvResult [O] Resulting asynchronous moniker object
677 * Failure: E_INVALIDARG, if any argument is invalid, or
678 * E_OUTOFMEMORY if memory allocation fails.
680 HRESULT WINAPI
BindAsyncMoniker(IMoniker
*pmk
, DWORD grfOpt
, IBindStatusCallback
*pbsc
, REFIID iidResult
, LPVOID
*ppvResult
)
683 HRESULT hr
= E_INVALIDARG
;
685 TRACE("(%p %08x %p %s %p)\n", pmk
, grfOpt
, pbsc
, debugstr_guid(iidResult
), ppvResult
);
687 if (pmk
&& ppvResult
)
691 hr
= CreateAsyncBindCtx(0, pbsc
, NULL
, &pbc
);
694 hr
= IMoniker_BindToObject(pmk
, pbc
, NULL
, iidResult
, ppvResult
);
695 IBindCtx_Release(pbc
);
701 /***********************************************************************
702 * MkParseDisplayNameEx (URLMON.@)
704 HRESULT WINAPI
MkParseDisplayNameEx(IBindCtx
*pbc
, LPCWSTR szDisplayName
, ULONG
*pchEaten
, LPMONIKER
*ppmk
)
706 TRACE("(%p %s %p %p)\n", pbc
, debugstr_w(szDisplayName
), pchEaten
, ppmk
);
708 if(is_registered_protocol(szDisplayName
)) {
711 hres
= CreateURLMoniker(NULL
, szDisplayName
, ppmk
);
712 if(SUCCEEDED(hres
)) {
713 *pchEaten
= strlenW(szDisplayName
);
718 return MkParseDisplayName(pbc
, szDisplayName
, pchEaten
, ppmk
);
722 /***********************************************************************
723 * URLDownloadToCacheFileA (URLMON.@)
725 HRESULT WINAPI
URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller
, LPCSTR szURL
, LPSTR szFileName
,
726 DWORD dwBufLength
, DWORD dwReserved
, LPBINDSTATUSCALLBACK pBSC
)
728 LPWSTR url
= NULL
, file_name
= NULL
;
732 TRACE("(%p %s %p %d %d %p)\n", lpUnkCaller
, debugstr_a(szURL
), szFileName
,
733 dwBufLength
, dwReserved
, pBSC
);
736 len
= MultiByteToWideChar(CP_ACP
, 0, szURL
, -1, NULL
, 0);
737 url
= heap_alloc(len
*sizeof(WCHAR
));
738 MultiByteToWideChar(CP_ACP
, 0, szURL
, -1, url
, len
);
742 file_name
= heap_alloc(dwBufLength
*sizeof(WCHAR
));
744 hres
= URLDownloadToCacheFileW(lpUnkCaller
, url
, file_name
, dwBufLength
*sizeof(WCHAR
),
747 if(SUCCEEDED(hres
) && file_name
)
748 WideCharToMultiByte(CP_ACP
, 0, file_name
, -1, szFileName
, dwBufLength
, NULL
, NULL
);
751 heap_free(file_name
);
756 /***********************************************************************
757 * URLDownloadToCacheFileW (URLMON.@)
759 HRESULT WINAPI
URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller
, LPCWSTR szURL
, LPWSTR szFileName
,
760 DWORD dwBufLength
, DWORD dwReserved
, LPBINDSTATUSCALLBACK pBSC
)
762 WCHAR cache_path
[MAX_PATH
+ 1];
763 FILETIME expire
, modified
;
767 static WCHAR header
[] = {
768 'H','T','T','P','/','1','.','0',' ','2','0','0',' ',
769 'O','K','\\','r','\\','n','\\','r','\\','n',0
772 TRACE("(%p, %s, %p, %d, %d, %p)\n", lpUnkCaller
, debugstr_w(szURL
),
773 szFileName
, dwBufLength
, dwReserved
, pBSC
);
775 if (!szURL
|| !szFileName
)
778 ext
= PathFindExtensionW(szURL
);
780 if (!CreateUrlCacheEntryW(szURL
, 0, ext
, cache_path
, 0))
783 hr
= URLDownloadToFileW(lpUnkCaller
, szURL
, cache_path
, 0, pBSC
);
787 expire
.dwHighDateTime
= 0;
788 expire
.dwLowDateTime
= 0;
789 modified
.dwHighDateTime
= 0;
790 modified
.dwLowDateTime
= 0;
792 if (!CommitUrlCacheEntryW(szURL
, cache_path
, expire
, modified
, NORMAL_CACHE_ENTRY
,
793 header
, sizeof(header
), NULL
, NULL
))
796 if (strlenW(cache_path
) > dwBufLength
)
797 return E_OUTOFMEMORY
;
799 lstrcpyW(szFileName
, cache_path
);
804 /***********************************************************************
805 * HlinkSimpleNavigateToMoniker (URLMON.@)
807 HRESULT WINAPI
HlinkSimpleNavigateToMoniker(IMoniker
*pmkTarget
,
808 LPCWSTR szLocation
, LPCWSTR szTargetFrameName
, IUnknown
*pUnk
,
809 IBindCtx
*pbc
, IBindStatusCallback
*pbsc
, DWORD grfHLNF
, DWORD dwReserved
)
815 /***********************************************************************
816 * HlinkSimpleNavigateToString (URLMON.@)
818 HRESULT WINAPI
HlinkSimpleNavigateToString( LPCWSTR szTarget
,
819 LPCWSTR szLocation
, LPCWSTR szTargetFrameName
, IUnknown
*pUnk
,
820 IBindCtx
*pbc
, IBindStatusCallback
*pbsc
, DWORD grfHLNF
, DWORD dwReserved
)
822 FIXME("%s\n", debugstr_w( szTarget
) );
826 /***********************************************************************
827 * HlinkNavigateString (URLMON.@)
829 HRESULT WINAPI
HlinkNavigateString( IUnknown
*pUnk
, LPCWSTR szTarget
)
831 TRACE("%p %s\n", pUnk
, debugstr_w( szTarget
) );
832 return HlinkSimpleNavigateToString(
833 szTarget
, NULL
, NULL
, pUnk
, NULL
, NULL
, 0, 0 );
836 /***********************************************************************
837 * GetSoftwareUpdateInfo (URLMON.@)
839 HRESULT WINAPI
GetSoftwareUpdateInfo( LPCWSTR szDistUnit
, LPSOFTDISTINFO psdi
)
841 FIXME("%s %p\n", debugstr_w(szDistUnit
), psdi
);