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;
40 LPOLESTR URLName; /* URL string identified by this URLmoniker */
43 static inline URLMoniker *impl_from_IMoniker(IMoniker *iface)
45 return CONTAINING_RECORD(iface, URLMoniker, IMoniker_iface);
48 static HRESULT WINAPI URLMoniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
50 URLMoniker *This = impl_from_IMoniker(iface);
55 if(IsEqualIID(&IID_IUnknown, riid)) {
56 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
58 }else if(IsEqualIID(&IID_IPersist, riid)) {
59 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
61 }else if(IsEqualIID(&IID_IPersistStream,riid)) {
62 TRACE("(%p)->(IID_IPersistStream %p)\n", This, ppv);
64 }else if(IsEqualIID(&IID_IMoniker, riid)) {
65 TRACE("(%p)->(IID_IMoniker %p)\n", This, ppv);
67 }else if(IsEqualIID(&IID_IAsyncMoniker, riid)) {
68 TRACE("(%p)->(IID_IAsyncMoniker %p)\n", This, ppv);
70 }else if(IsEqualIID(&IID_IUriContainer, riid)) {
71 TRACE("(%p)->(IID_IUriContainer %p)\n", This, ppv);
72 *ppv = &This->IUriContainer_iface;
74 WARN("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
79 IMoniker_AddRef((IUnknown*)*ppv);
83 static ULONG WINAPI URLMoniker_AddRef(IMoniker *iface)
85 URLMoniker *This = impl_from_IMoniker(iface);
86 ULONG refCount = InterlockedIncrement(&This->ref);
88 TRACE("(%p) ref=%u\n",This, refCount);
93 static ULONG WINAPI URLMoniker_Release(IMoniker *iface)
95 URLMoniker *This = impl_from_IMoniker(iface);
96 ULONG refCount = InterlockedDecrement(&This->ref);
98 TRACE("(%p) ref=%u\n",This, refCount);
101 heap_free(This->URLName);
104 URLMON_UnlockModule();
110 static HRESULT WINAPI URLMoniker_GetClassID(IMoniker *iface, CLSID *pClassID)
112 URLMoniker *This = impl_from_IMoniker(iface);
114 TRACE("(%p,%p)\n", This, pClassID);
119 /* Windows always returns CLSID_StdURLMoniker */
120 *pClassID = CLSID_StdURLMoniker;
124 static HRESULT WINAPI URLMoniker_IsDirty(IMoniker *iface)
126 URLMoniker *This = impl_from_IMoniker(iface);
128 TRACE("(%p)\n",This);
130 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
131 method in the OLE-provided moniker interfaces always return S_FALSE because
132 their internal state never changes. */
136 static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
138 URLMoniker *This = impl_from_IMoniker(iface);
143 TRACE("(%p,%p)\n",This,pStm);
150 * Writes a ULONG containing length of unicode string, followed
151 * by that many unicode characters
153 res = IStream_Read(pStm, &size, sizeof(ULONG), &got);
155 if(got == sizeof(ULONG)) {
156 heap_free(This->URLName);
157 This->URLName = heap_alloc(size);
161 res = IStream_Read(pStm, This->URLName, size, NULL);
162 This->URLName[size/sizeof(WCHAR) - 1] = 0;
172 static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClearDirty)
174 URLMoniker *This = impl_from_IMoniker(iface);
178 TRACE("(%p,%p,%d)\n", This, pStm, fClearDirty);
183 size = (strlenW(This->URLName) + 1)*sizeof(WCHAR);
184 res=IStream_Write(pStm,&size,sizeof(ULONG),NULL);
186 res=IStream_Write(pStm,This->URLName,size,NULL);
192 static HRESULT WINAPI URLMoniker_GetSizeMax(IMoniker* iface, ULARGE_INTEGER *pcbSize)
194 URLMoniker *This = impl_from_IMoniker(iface);
196 TRACE("(%p,%p)\n",This,pcbSize);
201 pcbSize->QuadPart = sizeof(ULONG) + ((strlenW(This->URLName)+1) * sizeof(WCHAR));
205 static HRESULT WINAPI URLMoniker_BindToObject(IMoniker *iface, IBindCtx* pbc, IMoniker *pmkToLeft,
206 REFIID riid, void **ppv)
208 URLMoniker *This = impl_from_IMoniker(iface);
209 IRunningObjectTable *obj_tbl;
213 TRACE("(%p)->(%p,%p,%s,%p): stub\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppv);
215 hres = IBindCtx_GetRunningObjectTable(pbc, &obj_tbl);
216 if(SUCCEEDED(hres)) {
217 FIXME("use running object table\n");
218 IRunningObjectTable_Release(obj_tbl);
221 hres = CreateUri(This->URLName, Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
225 hres = bind_to_object(iface, uri, pbc, riid, ppv);
231 static HRESULT WINAPI URLMoniker_BindToStorage(IMoniker* iface, IBindCtx* pbc,
232 IMoniker* pmkToLeft, REFIID riid, void **ppvObject)
234 URLMoniker *This = impl_from_IMoniker(iface);
238 TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject);
240 if(ppvObject) *ppvObject = NULL;
242 if(!pbc || !ppvObject) return E_INVALIDARG;
245 FIXME("Unsupported pmkToLeft\n");
247 hres = CreateUri(This->URLName, Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
251 hres = bind_to_storage(uri, pbc, riid, ppvObject);
257 static HRESULT WINAPI URLMoniker_Reduce(IMoniker *iface, IBindCtx *pbc,
258 DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
260 URLMoniker *This = impl_from_IMoniker(iface);
262 TRACE("(%p,%p,%d,%p,%p)\n", This, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
267 IMoniker_AddRef(iface);
268 *ppmkReduced = iface;
269 return MK_S_REDUCED_TO_SELF;
272 static HRESULT WINAPI URLMoniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
273 BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
275 URLMoniker *This = impl_from_IMoniker(iface);
276 FIXME("(%p)->(%p,%d,%p): stub\n",This,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
280 static HRESULT WINAPI URLMoniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
282 URLMoniker *This = impl_from_IMoniker(iface);
284 TRACE("(%p,%d,%p)\n", This, fForward, ppenumMoniker);
289 /* Does not support sub-monikers */
290 *ppenumMoniker = NULL;
294 static HRESULT WINAPI URLMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
296 URLMoniker *This = impl_from_IMoniker(iface);
302 TRACE("(%p,%p)\n",This, pmkOtherMoniker);
304 if(pmkOtherMoniker==NULL)
307 IMoniker_GetClassID(pmkOtherMoniker,&clsid);
309 if(!IsEqualCLSID(&clsid,&CLSID_StdURLMoniker))
312 res = CreateBindCtx(0,&bind);
317 if(SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&urlPath))) {
318 int result = lstrcmpiW(urlPath, This->URLName);
319 CoTaskMemFree(urlPath);
323 IUnknown_Release(bind);
328 static HRESULT WINAPI URLMoniker_Hash(IMoniker *iface, DWORD *pdwHash)
330 URLMoniker *This = impl_from_IMoniker(iface);
331 int h = 0,i,skip,len;
335 TRACE("(%p,%p)\n",This,pdwHash);
344 for(i = len ; i > 0; i--) {
345 h = (h * 37) + val[off++];
348 /* only sample some characters */
350 for(i = len; i > 0; i -= skip, off += skip) {
351 h = (h * 39) + val[off];
358 static HRESULT WINAPI URLMoniker_IsRunning(IMoniker* iface, IBindCtx* pbc,
359 IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
361 URLMoniker *This = impl_from_IMoniker(iface);
362 FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pmkNewlyRunning);
366 static HRESULT WINAPI URLMoniker_GetTimeOfLastChange(IMoniker *iface,
367 IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
369 URLMoniker *This = impl_from_IMoniker(iface);
370 FIXME("(%p)->(%p,%p,%p): stub\n", This, pbc, pmkToLeft, pFileTime);
374 static HRESULT WINAPI URLMoniker_Inverse(IMoniker *iface, IMoniker **ppmk)
376 URLMoniker *This = impl_from_IMoniker(iface);
377 TRACE("(%p,%p)\n",This,ppmk);
378 return MK_E_NOINVERSE;
381 static HRESULT WINAPI URLMoniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkPrefix)
383 URLMoniker *This = impl_from_IMoniker(iface);
384 FIXME("(%p)->(%p,%p): stub\n",This,pmkOther,ppmkPrefix);
388 static HRESULT WINAPI URLMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath)
390 URLMoniker *This = impl_from_IMoniker(iface);
391 FIXME("(%p)->(%p,%p): stub\n",This,pmOther,ppmkRelPath);
395 static HRESULT WINAPI URLMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
396 LPOLESTR *ppszDisplayName)
398 URLMoniker *This = impl_from_IMoniker(iface);
401 TRACE("(%p,%p,%p,%p)\n", This, pbc, pmkToLeft, ppszDisplayName);
407 return E_OUTOFMEMORY;
409 /* FIXME: If this is a partial URL, try and get a URL moniker from SZ_URLCONTEXT in the bind context,
410 then look at pmkToLeft to try and complete the URL
412 len = lstrlenW(This->URLName)+1;
413 *ppszDisplayName = CoTaskMemAlloc(len*sizeof(WCHAR));
414 if(!*ppszDisplayName)
415 return E_OUTOFMEMORY;
416 lstrcpyW(*ppszDisplayName, This->URLName);
420 static HRESULT WINAPI URLMoniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
421 LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
423 URLMoniker *This = impl_from_IMoniker(iface);
424 FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
428 static HRESULT WINAPI URLMoniker_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys)
430 URLMoniker *This = impl_from_IMoniker(iface);
432 TRACE("(%p,%p)\n",This,pwdMksys);
437 *pwdMksys = MKSYS_URLMONIKER;
441 static const IMonikerVtbl URLMonikerVtbl =
443 URLMoniker_QueryInterface,
446 URLMoniker_GetClassID,
450 URLMoniker_GetSizeMax,
451 URLMoniker_BindToObject,
452 URLMoniker_BindToStorage,
454 URLMoniker_ComposeWith,
458 URLMoniker_IsRunning,
459 URLMoniker_GetTimeOfLastChange,
461 URLMoniker_CommonPrefixWith,
462 URLMoniker_RelativePathTo,
463 URLMoniker_GetDisplayName,
464 URLMoniker_ParseDisplayName,
465 URLMoniker_IsSystemMoniker
468 static inline URLMoniker *impl_from_IUriContainer(IUriContainer *iface)
470 return CONTAINING_RECORD(iface, URLMoniker, IUriContainer_iface);
473 static HRESULT WINAPI UriContainer_QueryInterface(IUriContainer *iface, REFIID riid, void **ppv)
475 URLMoniker *This = impl_from_IUriContainer(iface);
476 return IMoniker_QueryInterface(&This->IMoniker_iface, riid, ppv);
479 static ULONG WINAPI UriContainer_AddRef(IUriContainer *iface)
481 URLMoniker *This = impl_from_IUriContainer(iface);
482 return IMoniker_AddRef(&This->IMoniker_iface);
485 static ULONG WINAPI UriContainer_Release(IUriContainer *iface)
487 URLMoniker *This = impl_from_IUriContainer(iface);
488 return IMoniker_Release(&This->IMoniker_iface);
491 static HRESULT WINAPI UriContainer_GetIUri(IUriContainer *iface, IUri **ppIUri)
493 URLMoniker *This = impl_from_IUriContainer(iface);
495 FIXME("(%p)->(%p)\n", This, ppIUri);
501 static const IUriContainerVtbl UriContainerVtbl = {
502 UriContainer_QueryInterface,
504 UriContainer_Release,
508 static URLMoniker *alloc_moniker(void)
512 ret = heap_alloc(sizeof(URLMoniker));
516 ret->IMoniker_iface.lpVtbl = &URLMonikerVtbl;
517 ret->IUriContainer_iface.lpVtbl = &UriContainerVtbl;
524 static HRESULT URLMoniker_Init(URLMoniker *This, LPCOLESTR lpszLeftURLName, LPCOLESTR lpszURLName)
529 TRACE("(%p,%s,%s)\n",This,debugstr_w(lpszLeftURLName),debugstr_w(lpszURLName));
531 This->URLName = heap_alloc(INTERNET_MAX_URL_LENGTH*sizeof(WCHAR));
534 hres = CoInternetCombineUrl(lpszLeftURLName, lpszURLName, URL_FILE_USE_PATHURL,
535 This->URLName, INTERNET_MAX_URL_LENGTH, &sizeStr, 0);
537 hres = CoInternetParseUrl(lpszURLName, PARSE_CANONICALIZE, URL_FILE_USE_PATHURL,
538 This->URLName, INTERNET_MAX_URL_LENGTH, &sizeStr, 0);
541 heap_free(This->URLName);
547 if(sizeStr != INTERNET_MAX_URL_LENGTH)
548 This->URLName = heap_realloc(This->URLName, (sizeStr+1)*sizeof(WCHAR));
550 TRACE("URLName = %s\n", debugstr_w(This->URLName));
555 HRESULT StdURLMoniker_Construct(IUnknown *outer, void **ppv)
557 TRACE("(%p %p)\n", outer, ppv);
559 *ppv = alloc_moniker();
560 return *ppv ? S_OK : E_OUTOFMEMORY;
563 /***********************************************************************
564 * CreateURLMonikerEx (URLMON.@)
566 * Create a url moniker.
569 * pmkContext [I] Context
570 * szURL [I] Url to create the moniker for
571 * ppmk [O] Destination for created moniker.
575 * Success: S_OK. ppmk contains the created IMoniker object.
576 * Failure: MK_E_SYNTAX if szURL is not a valid url, or
577 * E_OUTOFMEMORY if memory allocation fails.
579 HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk, DWORD dwFlags)
583 LPOLESTR lefturl = NULL;
585 TRACE("(%p, %s, %p, %08x)\n", pmkContext, debugstr_w(szURL), ppmk, dwFlags);
593 if (dwFlags & URL_MK_UNIFORM) FIXME("ignoring flag URL_MK_UNIFORM\n");
595 if(!(obj = alloc_moniker()))
596 return E_OUTOFMEMORY;
601 IMoniker_IsSystemMoniker(pmkContext, &dwMksys);
602 if(dwMksys == MKSYS_URLMONIKER && SUCCEEDED(CreateBindCtx(0, &bind))) {
603 IMoniker_GetDisplayName(pmkContext, bind, NULL, &lefturl);
604 TRACE("lefturl = %s\n", debugstr_w(lefturl));
605 IBindCtx_Release(bind);
609 hres = URLMoniker_Init(obj, lefturl, szURL);
610 CoTaskMemFree(lefturl);
612 hres = URLMoniker_QueryInterface(&obj->IMoniker_iface, &IID_IMoniker, (void**)ppmk);
613 IMoniker_Release(&obj->IMoniker_iface);
617 /**********************************************************************
618 * CreateURLMoniker (URLMON.@)
620 * Create a url moniker.
623 * pmkContext [I] Context
624 * szURL [I] Url to create the moniker for
625 * ppmk [O] Destination for created moniker.
628 * Success: S_OK. ppmk contains the created IMoniker object.
629 * Failure: MK_E_SYNTAX if szURL is not a valid url, or
630 * E_OUTOFMEMORY if memory allocation fails.
632 HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
634 return CreateURLMonikerEx(pmkContext, szURL, ppmk, URL_MK_LEGACY);
637 /***********************************************************************
638 * IsAsyncMoniker (URLMON.@)
640 HRESULT WINAPI IsAsyncMoniker(IMoniker *pmk)
644 TRACE("(%p)\n", pmk);
647 if(SUCCEEDED(IMoniker_QueryInterface(pmk, &IID_IAsyncMoniker, (void**)&am))) {
648 IUnknown_Release(am);
654 /***********************************************************************
655 * BindAsyncMoniker (URLMON.@)
657 * Bind a bind status callback to an asynchronous URL Moniker.
660 * pmk [I] Moniker object to bind status callback to
661 * grfOpt [I] Options, seems not used
662 * pbsc [I] Status callback to bind
663 * iidResult [I] Interface to return
664 * ppvResult [O] Resulting asynchronous moniker object
668 * Failure: E_INVALIDARG, if any argument is invalid, or
669 * E_OUTOFMEMORY if memory allocation fails.
671 HRESULT WINAPI BindAsyncMoniker(IMoniker *pmk, DWORD grfOpt, IBindStatusCallback *pbsc, REFIID iidResult, LPVOID *ppvResult)
674 HRESULT hr = E_INVALIDARG;
676 TRACE("(%p %08x %p %s %p)\n", pmk, grfOpt, pbsc, debugstr_guid(iidResult), ppvResult);
678 if (pmk && ppvResult)
682 hr = CreateAsyncBindCtx(0, pbsc, NULL, &pbc);
685 hr = IMoniker_BindToObject(pmk, pbc, NULL, iidResult, ppvResult);
686 IBindCtx_Release(pbc);
692 /***********************************************************************
693 * MkParseDisplayNameEx (URLMON.@)
695 HRESULT WINAPI MkParseDisplayNameEx(IBindCtx *pbc, LPCWSTR szDisplayName, ULONG *pchEaten, LPMONIKER *ppmk)
697 TRACE("(%p %s %p %p)\n", pbc, debugstr_w(szDisplayName), pchEaten, ppmk);
699 if (!pbc || !szDisplayName || !*szDisplayName || !pchEaten || !ppmk)
702 if(is_registered_protocol(szDisplayName)) {
705 hres = CreateURLMoniker(NULL, szDisplayName, ppmk);
706 if(SUCCEEDED(hres)) {
707 *pchEaten = strlenW(szDisplayName);
712 return MkParseDisplayName(pbc, szDisplayName, pchEaten, ppmk);
716 /***********************************************************************
717 * URLDownloadToCacheFileA (URLMON.@)
719 HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPSTR szFileName,
720 DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
722 LPWSTR url = NULL, file_name = NULL;
726 TRACE("(%p %s %p %d %d %p)\n", lpUnkCaller, debugstr_a(szURL), szFileName,
727 dwBufLength, dwReserved, pBSC);
730 len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
731 url = heap_alloc(len*sizeof(WCHAR));
732 MultiByteToWideChar(CP_ACP, 0, szURL, -1, url, len);
736 file_name = heap_alloc(dwBufLength*sizeof(WCHAR));
738 hres = URLDownloadToCacheFileW(lpUnkCaller, url, file_name, dwBufLength*sizeof(WCHAR),
741 if(SUCCEEDED(hres) && file_name)
742 WideCharToMultiByte(CP_ACP, 0, file_name, -1, szFileName, dwBufLength, NULL, NULL);
745 heap_free(file_name);
750 /***********************************************************************
751 * URLDownloadToCacheFileW (URLMON.@)
753 HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPWSTR szFileName,
754 DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
756 WCHAR cache_path[MAX_PATH + 1];
757 FILETIME expire, modified;
761 static WCHAR header[] = {
762 'H','T','T','P','/','1','.','0',' ','2','0','0',' ',
763 'O','K','\\','r','\\','n','\\','r','\\','n',0
766 TRACE("(%p, %s, %p, %d, %d, %p)\n", lpUnkCaller, debugstr_w(szURL),
767 szFileName, dwBufLength, dwReserved, pBSC);
769 if (!szURL || !szFileName)
772 ext = PathFindExtensionW(szURL);
774 if (!CreateUrlCacheEntryW(szURL, 0, ext, cache_path, 0))
777 hr = URLDownloadToFileW(lpUnkCaller, szURL, cache_path, 0, pBSC);
781 expire.dwHighDateTime = 0;
782 expire.dwLowDateTime = 0;
783 modified.dwHighDateTime = 0;
784 modified.dwLowDateTime = 0;
786 if (!CommitUrlCacheEntryW(szURL, cache_path, expire, modified, NORMAL_CACHE_ENTRY,
787 header, sizeof(header), NULL, NULL))
790 if (strlenW(cache_path) > dwBufLength)
791 return E_OUTOFMEMORY;
793 lstrcpyW(szFileName, cache_path);
798 /***********************************************************************
799 * HlinkSimpleNavigateToMoniker (URLMON.@)
801 HRESULT WINAPI HlinkSimpleNavigateToMoniker(IMoniker *pmkTarget,
802 LPCWSTR szLocation, LPCWSTR szTargetFrameName, IUnknown *pUnk,
803 IBindCtx *pbc, IBindStatusCallback *pbsc, DWORD grfHLNF, DWORD dwReserved)
810 hres = IMoniker_GetDisplayName(pmkTarget, pbc, 0, &target);
812 hres = HlinkSimpleNavigateToString( target, szLocation, szTargetFrameName,
813 pUnk, pbc, pbsc, grfHLNF, dwReserved );
814 CoTaskMemFree(target);
819 /***********************************************************************
820 * HlinkSimpleNavigateToString (URLMON.@)
822 HRESULT WINAPI HlinkSimpleNavigateToString( LPCWSTR szTarget,
823 LPCWSTR szLocation, LPCWSTR szTargetFrameName, IUnknown *pUnk,
824 IBindCtx *pbc, IBindStatusCallback *pbsc, DWORD grfHLNF, DWORD dwReserved)
826 FIXME("%s %s %s %p %p %p %u %u partial stub\n", debugstr_w( szTarget ), debugstr_w( szLocation ),
827 debugstr_w( szTargetFrameName ), pUnk, pbc, pbsc, grfHLNF, dwReserved);
829 /* undocumented: 0 means HLNF_OPENINNEWWINDOW*/
830 if (!grfHLNF) grfHLNF = HLNF_OPENINNEWWINDOW;
832 if (grfHLNF == HLNF_OPENINNEWWINDOW)
834 SHELLEXECUTEINFOW sei;
835 static const WCHAR openW[] = { 'o', 'p', 'e', 'n', 0 };
837 memset(&sei, 0, sizeof(sei));
838 sei.cbSize = sizeof(sei);
840 sei.nShow = SW_SHOWNORMAL;
841 sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NO_CONSOLE;
842 sei.lpFile = szTarget;
844 if (ShellExecuteExW(&sei)) return S_OK;
850 /***********************************************************************
851 * HlinkNavigateString (URLMON.@)
853 HRESULT WINAPI HlinkNavigateString( IUnknown *pUnk, LPCWSTR szTarget )
855 TRACE("%p %s\n", pUnk, debugstr_w( szTarget ) );
856 return HlinkSimpleNavigateToString(
857 szTarget, NULL, NULL, pUnk, NULL, NULL, 0, 0 );
860 /***********************************************************************
861 * GetSoftwareUpdateInfo (URLMON.@)
863 HRESULT WINAPI GetSoftwareUpdateInfo( LPCWSTR szDistUnit, LPSOFTDISTINFO psdi )
865 FIXME("%s %p\n", debugstr_w(szDistUnit), psdi );
869 /***********************************************************************
870 * AsyncInstallDistributionUnit (URLMON.@)
872 HRESULT WINAPI AsyncInstallDistributionUnit( LPCWSTR szDistUnit, LPCWSTR szTYPE,
873 LPCWSTR szExt, DWORD dwFileVersionMS, DWORD dwFileVersionLS,
874 LPCWSTR szURL, IBindCtx *pbc, LPVOID pvReserved, DWORD flags )