30#define HLINK_SAVE_MAGIC 0x00000002
31#define HLINK_SAVE_MONIKER_PRESENT 0x01
32#define HLINK_SAVE_MONIKER_IS_ABSOLUTE 0x02
33#define HLINK_SAVE_LOCATION_PRESENT 0x08
34#define HLINK_SAVE_FRIENDLY_PRESENT 0x10
36#define HLINK_SAVE_TARGET_FRAME_PRESENT 0x80
38#define HLINK_SAVE_ALL (HLINK_SAVE_TARGET_FRAME_PRESENT|HLINK_SAVE_FRIENDLY_PRESENT|HLINK_SAVE_LOCATION_PRESENT|0x04|HLINK_SAVE_MONIKER_IS_ABSOLUTE|HLINK_SAVE_MONIKER_PRESENT)
84 if (ref_type == HLINKGETREF_DEFAULT)
85 ref_type = HLINKGETREF_RELATIVE;
89 DWORD mktype = MKSYS_NONE;
91 hres = IMoniker_IsSystemMoniker(
This->Moniker, &mktype);
92 if (
hres ==
S_OK && mktype != MKSYS_NONE)
100 if (ref_type == HLINKGETREF_ABSOLUTE &&
This->Site)
104 hres = IHlinkSite_GetMoniker(
This->Site,
This->SiteData,
105 OLEGETMONIKER_FORCEASSIGN, OLEWHICHMK_CONTAINER, &hls_moniker);
111 hres = IMoniker_ComposeWith(hls_moniker,
This->Moniker,
FALSE,
113 IMoniker_Release(hls_moniker);
138 *ppvObj = &
This->IHlink_iface;
140 *ppvObj = &
This->IPersistStream_iface;
142 *ppvObj = &
This->IDataObject_iface;
146 IUnknown_AddRef((
IUnknown*)(*ppvObj));
157 TRACE(
"(%p)->(count=%u)\n",
This, refCount - 1);
167 TRACE(
"(%p)->(count=%u)\n",
This, refCount + 1);
171 TRACE(
"-- destroying IHlink (%p)\n",
This);
176 IMoniker_Release(
This->Moniker);
178 IHlinkSite_Release(
This->Site);
188 TRACE(
"(%p)->(%p %i)\n",
This, pihlSite, dwSiteData);
191 IHlinkSite_Release(
This->Site);
193 This->Site = pihlSite;
195 IHlinkSite_AddRef(
This->Site);
197 This->SiteData = dwSiteData;
207 TRACE(
"(%p)->(%p %p)\n",
This, ppihlSite, pdwSiteData);
209 *ppihlSite =
This->Site;
212 IHlinkSite_AddRef(
This->Site);
213 *pdwSiteData =
This->SiteData;
224 TRACE(
"(%p)->(%i %p %s)\n",
This, rfHLSETF, pmkTarget,
229 if(!(rfHLSETF & (HLINKSETF_TARGET | HLINKSETF_LOCATION)))
232 if(rfHLSETF & HLINKSETF_TARGET){
234 IMoniker_Release(
This->Moniker);
236 This->Moniker = pmkTarget;
241 IMoniker_AddRef(
This->Moniker);
243 IMoniker_GetDisplayName(
This->Moniker, pbc,
NULL, &display_name);
244 IBindCtx_Release(pbc);
245 This->absolute = display_name &&
wcschr(display_name,
':');
250 if(rfHLSETF & HLINKSETF_LOCATION){
266 if(grfHLSETF > (HLINKSETF_TARGET | HLINKSETF_LOCATION) &&
267 grfHLSETF < -(HLINKSETF_TARGET | HLINKSETF_LOCATION))
270 if (grfHLSETF & HLINKSETF_TARGET)
274 IMoniker_Release(
This->Moniker);
277 if (pwzTarget && *pwzTarget)
289 IBindCtx_Release(pbc);
294 if (
p && (
p - pwzTarget > 1))
300 ERR(
"couldn't create moniker for %s, failed with error 0x%08x\n",
306 IHlink_SetMonikerReference(iface, HLINKSETF_TARGET, pMon,
NULL);
307 IMoniker_Release(pMon);
311 if (grfHLSETF & HLINKSETF_LOCATION)
315 if (pwzLocation && *pwzLocation)
327 TRACE(
"(%p) -> (%i %p %p)\n",
This, dwWhichRef, ppimkTarget,
336 *ppwzLocation =
NULL;
342 IHlink_GetStringReference(iface, dwWhichRef,
NULL, ppwzLocation);
352 TRACE(
"(%p) -> (%i %p %p)\n",
This, dwWhichRef, ppwzTarget, ppwzLocation);
354 if(dwWhichRef != -1 && dwWhichRef & ~(HLINKGETREF_DEFAULT | HLINKGETREF_ABSOLUTE | HLINKGETREF_RELATIVE))
359 *ppwzLocation =
NULL;
370 *ppwzLocation =
NULL;
378 IMoniker_GetDisplayName(mon, pbc,
NULL, ppwzTarget);
379 IBindCtx_Release(pbc);
380 IMoniker_Release(mon);
388 TRACE(
"(Target: %s Location: %s)\n",
389 (ppwzTarget)?
debugstr_w(*ppwzTarget):
"<NULL>",
390 (ppwzLocation)?
debugstr_w(*ppwzLocation):
"<NULL>");
413 TRACE(
"(%p) -> (%i %p)\n",
This, grfHLFNAMEF, ppwzFriendlyName);
417 if (
This->FriendlyName)
425 *ppwzFriendlyName =
NULL;
433 IMoniker_GetDisplayName(
moniker, bcxt,
NULL, ppwzFriendlyName);
434 IBindCtx_Release(bcxt);
438 *ppwzFriendlyName =
NULL;
457 LPWSTR *ppwzTargetFrameName)
461 TRACE(
"(%p)->(%p)\n",
This, ppwzTargetFrameName);
463 if(!
This->TargetFrameName) {
464 *ppwzTargetFrameName =
NULL;
469 if(!*ppwzTargetFrameName)
488 TRACE(
"hlink %p, flags %#x, user_bind_ctx %p, bind_callback %p, browse_ctx %p.\n",
489 This,
flags, user_bind_ctx, bind_callback, browse_ctx);
491 if (
This->async_bind_ctx)
495 TRACE(
"Moniker %p\n", mon);
505 r = IHlinkBrowseContext_GetObject(browse_ctx, mon,
TRUE, &unk);
510 This->bind_callback = bind_callback;
512 if (
r == MK_S_ASYNCHRONOUS)
514 This->async_bind_ctx = bind_ctx;
517 IBindStatusCallback_AddRef(bind_callback);
518 IHlinkBrowseContext_AddRef(
This->async_browse_ctx = browse_ctx);
519 IMoniker_Release(mon);
525 r = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (
void **)&
target);
526 IUnknown_Release(unk);
530 if (bind_ctx) IHlinkTarget_SetBrowseContext(
target, browse_ctx);
532 IHlinkTarget_Release(
target);
536 if (bind_ctx) IBindCtx_Release(bind_ctx);
543 r = IHlink_GetStringReference(iface, HLINKGETREF_DEFAULT, &
target,
NULL);
551 IMoniker_Release(mon);
555 IHlinkSite_OnNavigationComplete(
This->Site,
This->SiteData, 0,
r,
NULL);
557 TRACE(
"Finished Navigation\n");
564 TRACE(
"Not implemented in native IHlink\n");
569 LPWSTR* ppwzAdditionalParams)
571 TRACE(
"Not implemented in native IHlink\n");
601 return IHlink_QueryInterface(&
This->IHlink_iface,
riid, ppvObj);
608 return IHlink_AddRef(&
This->IHlink_iface);
615 return IHlink_Release(&
This->IHlink_iface);
619 FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
626 FORMATETC* pformatetc, STGMEDIUM* pmedium)
633 FORMATETC* pformatetc)
640 FORMATETC* pformatetcIn, FORMATETC* pformatetcOut)
647 FORMATETC* pformatetc, STGMEDIUM* pmedium,
BOOL fRelease)
662 DWORD* pdwConnection)
682static const IDataObjectVtbl
dovt =
703 return IHlink_QueryInterface(&
This->IHlink_iface,
riid, ppvObj);
710 return IHlink_AddRef(&
This->IHlink_iface);
717 return IHlink_Release(&
This->IHlink_iface);
725 *pClassID = CLSID_StdHlink;
810 TRACE(
"loading target frame name\n");
817 TRACE(
"loading target friendly name\n");
819 FIXME(
"0x4 flag not present with friendly name flag - not sure what this means\n");
826 TRACE(
"loading moniker\n");
835 TRACE(
"loading location\n");
841 TRACE(
"Load Result 0x%x (%p)\n",
r,
This->Moniker);
870 if (
This->FriendlyName)
872 if (
This->TargetFrameName)
877 if (
This->TargetFrameName)
883 if (
This->FriendlyName)
899 IPersistStream_Release(monstream);
912 TRACE(
"Save Result 0x%x\n",
r);
928 if (
This->TargetFrameName)
931 if (
This->FriendlyName)
947 r = IPersistStream_GetSizeMax(monstream, &mon_size);
949 IPersistStream_Release(monstream);
960static const IPersistStreamVtbl
psvt =
981 IBindStatusCallback_AddRef(*
out = iface);
1006 TRACE(
"hlink %p, reserved %#x, binding %p.\n", hlink,
reserved, binding);
1035 TRACE(
"hlink %p, progress %u, max %u, status %u, text %s.\n",
1070 TRACE(
"hlink %p, bind_flags %p, bind_info %p.\n", hlink, bind_flags,
bind_info);
1080 FIXME(
"iface %p, flags %#x, size %d, formatetc %p, stgmed %p, stub!\n",
1095 IBindStatusCallback_OnObjectAvailable(hlink->
bind_callback, iid, unk);
1099 hr = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (
void **)&
target);
1105 IHlinkTarget_Release(
target);
1141 hl = heap_alloc_zero(
sizeof(
HlinkImpl));
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
HRESULT WINAPI OleLoadFromStream(IStream *pStm, REFIID iidInterface, void **ppvObj)
HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm, IStream *pStm)
HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, IMoniker **ppmk)
GLdouble GLdouble GLdouble r
static LPWSTR hlink_strdupW(LPCWSTR str)
static LPWSTR hlink_co_strdupW(LPCWSTR str)
VOID WINAPI CoTaskMemFree(LPVOID ptr)
static ULONG WINAPI IHlink_fnAddRef(IHlink *iface)
static HRESULT WINAPI IPersistStream_fnLoad(IPersistStream *iface, IStream *pStm)
static HRESULT WINAPI bind_callback_GetPriority(IBindStatusCallback *iface, LONG *priority)
static ULONG WINAPI IDataObject_fnAddRef(IDataObject *iface)
static HRESULT WINAPI IHlink_fnGetHlinkSite(IHlink *iface, IHlinkSite **ppihlSite, DWORD *pdwSiteData)
static HRESULT WINAPI IHlink_fnSetStringReference(IHlink *iface, DWORD grfHLSETF, LPCWSTR pwzTarget, LPCWSTR pwzLocation)
#define HLINK_SAVE_MONIKER_PRESENT
static HRESULT WINAPI bind_callback_OnStartBinding(IBindStatusCallback *iface, DWORD reserved, IBinding *binding)
static HRESULT read_hlink_string(IStream *pStm, LPWSTR *out_str)
static HRESULT WINAPI bind_callback_OnProgress(IBindStatusCallback *iface, ULONG progress, ULONG max, ULONG status, const WCHAR *text)
static HRESULT WINAPI bind_callback_OnDataAvailable(IBindStatusCallback *iface, DWORD flags, DWORD size, FORMATETC *formatetc, STGMEDIUM *stgmed)
static HRESULT WINAPI IPersistStream_fnGetClassID(IPersistStream *iface, CLSID *pClassID)
static HRESULT WINAPI IHlink_fnGetFriendlyName(IHlink *iface, DWORD grfHLFNAMEF, LPWSTR *ppwzFriendlyName)
static ULONG size_hlink_string(LPCWSTR str)
static HRESULT WINAPI IHlink_fnGetMonikerReference(IHlink *iface, DWORD dwWhichRef, IMoniker **ppimkTarget, LPWSTR *ppwzLocation)
static const IDataObjectVtbl dovt
static HRESULT WINAPI IPersistStream_fnQueryInterface(IPersistStream *iface, REFIID riid, LPVOID *ppvObj)
static HRESULT WINAPI bind_callback_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
static ULONG WINAPI bind_callback_AddRef(IBindStatusCallback *iface)
static HRESULT WINAPI IHlink_fnGetMiscStatus(IHlink *iface, DWORD *pdwStatus)
static ULONG WINAPI IDataObject_fnRelease(IDataObject *iface)
static ULONG WINAPI bind_callback_Release(IBindStatusCallback *iface)
static const IBindStatusCallbackVtbl bind_callback_vtbl
#define HLINK_SAVE_MONIKER_IS_ABSOLUTE
static HRESULT WINAPI IHlink_fnQueryInterface(IHlink *iface, REFIID riid, LPVOID *ppvObj)
static HRESULT WINAPI IDataObject_fnGetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
static HRESULT WINAPI IDataObject_fnGetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
#define HLINK_SAVE_TARGET_FRAME_PRESENT
static HRESULT WINAPI IHlink_fnGetTargetFrameName(IHlink *iface, LPWSTR *ppwzTargetFrameName)
static HRESULT WINAPI IPersistStream_fnIsDirty(IPersistStream *iface)
static ULONG WINAPI IPersistStream_fnRelease(IPersistStream *iface)
static HlinkImpl * impl_from_IDataObject(IDataObject *iface)
static const IHlinkVtbl hlvt
static HRESULT WINAPI bind_callback_OnStopBinding(IBindStatusCallback *iface, HRESULT hr, const WCHAR *error)
static HRESULT write_hlink_string(IStream *pStm, LPCWSTR str)
static HRESULT WINAPI IDataObject_fnQueryInterface(IDataObject *iface, REFIID riid, LPVOID *ppvObj)
static HRESULT WINAPI IDataObject_fnDUnadvise(IDataObject *iface, DWORD dwConnection)
static HRESULT WINAPI IHlink_fnSetTargetFrameName(IHlink *iface, LPCWSTR pwzTargetFramename)
static HRESULT WINAPI IHlink_fnSetFriendlyName(IHlink *iface, LPCWSTR pwzFriendlyName)
static HRESULT WINAPI IHlink_fnNavigate(IHlink *iface, DWORD flags, IBindCtx *user_bind_ctx, IBindStatusCallback *bind_callback, IHlinkBrowseContext *browse_ctx)
static HRESULT WINAPI IHlink_fnSetHlinkSite(IHlink *iface, IHlinkSite *pihlSite, DWORD dwSiteData)
static HlinkImpl * impl_from_IHlink(IHlink *iface)
HRESULT HLink_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
static HRESULT WINAPI IDataObject_fnQueryGetData(IDataObject *iface, FORMATETC *pformatetc)
static HlinkImpl * impl_from_IPersistStream(IPersistStream *iface)
static HRESULT WINAPI IHlink_fnSetMonikerReference(IHlink *iface, DWORD rfHLSETF, IMoniker *pmkTarget, LPCWSTR pwzLocation)
static HRESULT WINAPI IDataObject_fnEnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
static HRESULT __GetMoniker(HlinkImpl *This, IMoniker **moniker, DWORD ref_type)
static HRESULT WINAPI bind_callback_GetBindInfo(IBindStatusCallback *iface, DWORD *bind_flags, BINDINFO *bind_info)
static HRESULT WINAPI IHlink_fnSetAdditionalParams(IHlink *iface, LPCWSTR pwzAdditionalParams)
static const IPersistStreamVtbl psvt
static HRESULT WINAPI IDataObject_fnEnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
static HRESULT WINAPI bind_callback_OnObjectAvailable(IBindStatusCallback *iface, REFIID iid, IUnknown *unk)
static ULONG WINAPI IPersistStream_fnAddRef(IPersistStream *iface)
static HlinkImpl * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
static ULONG WINAPI IHlink_fnRelease(IHlink *iface)
static HRESULT WINAPI IPersistStream_fnSave(IPersistStream *iface, IStream *pStm, BOOL fClearDirty)
#define HLINK_SAVE_LOCATION_PRESENT
static HRESULT WINAPI IDataObject_fnGetConicalFormatEtc(IDataObject *iface, FORMATETC *pformatetcIn, FORMATETC *pformatetcOut)
static HRESULT WINAPI bind_callback_QueryInterface(IBindStatusCallback *iface, REFIID iid, void **out)
static HRESULT WINAPI IDataObject_fnSetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
static HRESULT WINAPI IDataObject_fnDAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
static HRESULT WINAPI IPersistStream_fnGetSizeMax(IPersistStream *iface, ULARGE_INTEGER *pcbSize)
static HRESULT WINAPI IHlink_fnGetAdditionalParams(IHlink *iface, LPWSTR *ppwzAdditionalParams)
#define HLINK_SAVE_FRIENDLY_PRESENT
static HRESULT WINAPI IHlink_fnGetStringReference(IHlink *iface, DWORD dwWhichRef, LPWSTR *ppwzTarget, LPWSTR *ppwzLocation)
static IInternetBindInfo bind_info
static const WCHAR szOpen[]
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
const GUID IID_IDataObject
const GUID IID_IPersistStream
#define IsEqualGUID(rguid1, rguid2)
#define IsEqualIID(riid1, riid2)
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
IDataObject IDataObject_iface
IBindStatusCallback IBindStatusCallback_iface
IPersistStream IPersistStream_iface
IBindStatusCallback * bind_callback
IHlinkBrowseContext * async_browse_ctx
IBindCtx * async_bind_ctx
#define CONTAINING_RECORD(address, type, field)
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
HRESULT WINAPI RevokeBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pbsc)
HRESULT WINAPI RegisterBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pbsc, IBindStatusCallback **ppbscPrevious, DWORD dwReserved)
#define CLASS_E_NOAGGREGATION