mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 13:45:06 +00:00
[HLINK]
sync hlink to wine 1.1.39 svn path=/trunk/; revision=45790
This commit is contained in:
parent
b7458a6c94
commit
822bfb7915
|
@ -223,8 +223,19 @@ static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
|
||||||
static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
|
static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
|
||||||
ULONG uHLID, IHlink** ppihl)
|
ULONG uHLID, IHlink** ppihl)
|
||||||
{
|
{
|
||||||
FIXME("\n");
|
HlinkBCImpl *This = (HlinkBCImpl*)iface;
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("(%p)->(%x %p)\n", This, uHLID, ppihl);
|
||||||
|
|
||||||
|
if(uHLID != HLID_CURRENT) {
|
||||||
|
FIXME("Only HLID_CURRENT implemented, given: %x\n", uHLID);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppihl = This->CurrentPage;
|
||||||
|
IHlink_AddRef(*ppihl);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IHlinkBC_SetCurrentHlink( IHlinkBrowseContext* iface,
|
static HRESULT WINAPI IHlinkBC_SetCurrentHlink( IHlinkBrowseContext* iface,
|
||||||
|
|
|
@ -55,7 +55,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI DllCanUnloadNow( void )
|
HRESULT WINAPI DllCanUnloadNow( void )
|
||||||
{
|
{
|
||||||
FIXME("\n");
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,14 +76,12 @@ HRESULT WINAPI HlinkCreateFromMoniker( IMoniker *pimkTrgt, LPCWSTR pwzLocation,
|
||||||
if (FAILED(r))
|
if (FAILED(r))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (pwzLocation)
|
IHlink_SetMonikerReference(hl, HLINKSETF_LOCATION | HLINKSETF_TARGET, pimkTrgt, pwzLocation);
|
||||||
IHlink_SetStringReference(hl, HLINKSETF_LOCATION, NULL, pwzLocation);
|
|
||||||
if (pwzFriendlyName)
|
if (pwzFriendlyName)
|
||||||
IHlink_SetFriendlyName(hl, pwzFriendlyName);
|
IHlink_SetFriendlyName(hl, pwzFriendlyName);
|
||||||
if (pihlsite)
|
if (pihlsite)
|
||||||
IHlink_SetHlinkSite(hl, pihlsite, dwSiteData);
|
IHlink_SetHlinkSite(hl, pihlsite, dwSiteData);
|
||||||
if (pimkTrgt)
|
|
||||||
IHlink_SetMonikerReference(hl, 0, pimkTrgt, pwzLocation);
|
|
||||||
|
|
||||||
*ppvObj = hl;
|
*ppvObj = hl;
|
||||||
|
|
||||||
|
@ -111,43 +108,12 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
|
||||||
if (FAILED(r))
|
if (FAILED(r))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (pwzLocation)
|
IHlink_SetStringReference(hl, HLINKSETF_TARGET | HLINKSETF_LOCATION,
|
||||||
IHlink_SetStringReference(hl, HLINKSETF_LOCATION, NULL, pwzLocation);
|
pwzTarget, pwzLocation);
|
||||||
|
|
||||||
if (pwzTarget)
|
|
||||||
{
|
|
||||||
IMoniker *pTgtMk = NULL;
|
|
||||||
IBindCtx *pbc = NULL;
|
|
||||||
ULONG eaten;
|
|
||||||
|
|
||||||
CreateBindCtx(0, &pbc);
|
|
||||||
r = MkParseDisplayName(pbc, pwzTarget, &eaten, &pTgtMk);
|
|
||||||
IBindCtx_Release(pbc);
|
|
||||||
|
|
||||||
if (FAILED(r))
|
|
||||||
{
|
|
||||||
LPCWSTR p = strchrW(pwzTarget, ':');
|
|
||||||
if (p && (p - pwzTarget > 1))
|
|
||||||
r = CreateURLMoniker(NULL, pwzTarget, &pTgtMk);
|
|
||||||
else
|
|
||||||
r = CreateFileMoniker(pwzTarget,&pTgtMk);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(r))
|
|
||||||
{
|
|
||||||
ERR("couldn't create moniker for %s, failed with error 0x%08x\n",
|
|
||||||
debugstr_w(pwzTarget), r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
IHlink_SetMonikerReference(hl, 0, pTgtMk, pwzLocation);
|
|
||||||
IMoniker_Release(pTgtMk);
|
|
||||||
|
|
||||||
IHlink_SetStringReference(hl, HLINKSETF_TARGET, pwzTarget, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pwzFriendlyName)
|
if (pwzFriendlyName)
|
||||||
IHlink_SetFriendlyName(hl, pwzFriendlyName);
|
IHlink_SetFriendlyName(hl, pwzFriendlyName);
|
||||||
|
|
||||||
if (pihlsite)
|
if (pihlsite)
|
||||||
IHlink_SetHlinkSite(hl, pihlsite, dwSiteData);
|
IHlink_SetHlinkSite(hl, pihlsite, dwSiteData);
|
||||||
|
|
||||||
|
@ -159,7 +125,7 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* HlinkNavigate (HLINK.@)
|
* HlinkCreateBrowseContext (HLINK.@)
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI HlinkCreateBrowseContext( IUnknown* piunkOuter, REFIID riid, void** ppvObj)
|
HRESULT WINAPI HlinkCreateBrowseContext( IUnknown* piunkOuter, REFIID riid, void** ppvObj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,6 @@ typedef struct
|
||||||
|
|
||||||
LPWSTR FriendlyName;
|
LPWSTR FriendlyName;
|
||||||
LPWSTR Location;
|
LPWSTR Location;
|
||||||
LPWSTR Target;
|
|
||||||
LPWSTR TargetFrameName;
|
LPWSTR TargetFrameName;
|
||||||
IMoniker *Moniker;
|
IMoniker *Moniker;
|
||||||
IHlinkSite *Site;
|
IHlinkSite *Site;
|
||||||
|
@ -155,7 +154,6 @@ static ULONG WINAPI IHlink_fnRelease (IHlink* iface)
|
||||||
|
|
||||||
TRACE("-- destroying IHlink (%p)\n", This);
|
TRACE("-- destroying IHlink (%p)\n", This);
|
||||||
heap_free(This->FriendlyName);
|
heap_free(This->FriendlyName);
|
||||||
heap_free(This->Target);
|
|
||||||
heap_free(This->TargetFrameName);
|
heap_free(This->TargetFrameName);
|
||||||
heap_free(This->Location);
|
heap_free(This->Location);
|
||||||
if (This->Moniker)
|
if (This->Moniker)
|
||||||
|
@ -206,24 +204,33 @@ static HRESULT WINAPI IHlink_fnSetMonikerReference( IHlink* iface,
|
||||||
{
|
{
|
||||||
HlinkImpl *This = (HlinkImpl*)iface;
|
HlinkImpl *This = (HlinkImpl*)iface;
|
||||||
|
|
||||||
FIXME("(%p)->(%i %p %s)\n", This, rfHLSETF, pmkTarget,
|
TRACE("(%p)->(%i %p %s)\n", This, rfHLSETF, pmkTarget,
|
||||||
debugstr_w(pwzLocation));
|
debugstr_w(pwzLocation));
|
||||||
|
|
||||||
if (This->Moniker)
|
if(rfHLSETF == 0)
|
||||||
IMoniker_Release(This->Moniker);
|
return E_INVALIDARG;
|
||||||
|
if(!(rfHLSETF & (HLINKSETF_TARGET | HLINKSETF_LOCATION)))
|
||||||
|
return rfHLSETF;
|
||||||
|
|
||||||
This->Moniker = pmkTarget;
|
if(rfHLSETF & HLINKSETF_TARGET){
|
||||||
if (This->Moniker)
|
if (This->Moniker)
|
||||||
{
|
IMoniker_Release(This->Moniker);
|
||||||
LPOLESTR display_name;
|
|
||||||
IMoniker_AddRef(This->Moniker);
|
This->Moniker = pmkTarget;
|
||||||
IMoniker_GetDisplayName(This->Moniker, NULL, NULL, &display_name);
|
if (This->Moniker)
|
||||||
This->absolute = display_name && strchrW(display_name, ':');
|
{
|
||||||
CoTaskMemFree(display_name);
|
LPOLESTR display_name;
|
||||||
|
IMoniker_AddRef(This->Moniker);
|
||||||
|
IMoniker_GetDisplayName(This->Moniker, NULL, NULL, &display_name);
|
||||||
|
This->absolute = display_name && strchrW(display_name, ':');
|
||||||
|
CoTaskMemFree(display_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
heap_free(This->Location);
|
if(rfHLSETF & HLINKSETF_LOCATION){
|
||||||
This->Location = hlink_strdupW( pwzLocation );
|
heap_free(This->Location);
|
||||||
|
This->Location = hlink_strdupW( pwzLocation );
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -236,11 +243,51 @@ static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
|
||||||
TRACE("(%p)->(%i %s %s)\n", This, grfHLSETF, debugstr_w(pwzTarget),
|
TRACE("(%p)->(%i %s %s)\n", This, grfHLSETF, debugstr_w(pwzTarget),
|
||||||
debugstr_w(pwzLocation));
|
debugstr_w(pwzLocation));
|
||||||
|
|
||||||
|
if(grfHLSETF > (HLINKSETF_TARGET | HLINKSETF_LOCATION) &&
|
||||||
|
grfHLSETF < -(HLINKSETF_TARGET | HLINKSETF_LOCATION))
|
||||||
|
return grfHLSETF;
|
||||||
|
|
||||||
if (grfHLSETF & HLINKSETF_TARGET)
|
if (grfHLSETF & HLINKSETF_TARGET)
|
||||||
{
|
{
|
||||||
heap_free(This->Target);
|
if (This->Moniker)
|
||||||
This->Target = hlink_strdupW( pwzTarget );
|
{
|
||||||
|
IMoniker_Release(This->Moniker);
|
||||||
|
This->Moniker = NULL;
|
||||||
|
}
|
||||||
|
if (pwzTarget && *pwzTarget)
|
||||||
|
{
|
||||||
|
IMoniker *pMon;
|
||||||
|
IBindCtx *pbc = NULL;
|
||||||
|
ULONG eaten;
|
||||||
|
HRESULT r;
|
||||||
|
|
||||||
|
r = CreateBindCtx(0, &pbc);
|
||||||
|
if (FAILED(r))
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
r = MkParseDisplayName(pbc, pwzTarget, &eaten, &pMon);
|
||||||
|
IBindCtx_Release(pbc);
|
||||||
|
|
||||||
|
if (FAILED(r))
|
||||||
|
{
|
||||||
|
LPCWSTR p = strchrW(pwzTarget, ':');
|
||||||
|
if (p && (p - pwzTarget > 1))
|
||||||
|
r = CreateURLMoniker(NULL, pwzTarget, &pMon);
|
||||||
|
else
|
||||||
|
r = CreateFileMoniker(pwzTarget, &pMon);
|
||||||
|
if (FAILED(r))
|
||||||
|
{
|
||||||
|
ERR("couldn't create moniker for %s, failed with error 0x%08x\n",
|
||||||
|
debugstr_w(pwzTarget), r);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IHlink_SetMonikerReference(iface, HLINKSETF_TARGET, pMon, NULL);
|
||||||
|
IMoniker_Release(pMon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grfHLSETF & HLINKSETF_LOCATION)
|
if (grfHLSETF & HLINKSETF_LOCATION)
|
||||||
{
|
{
|
||||||
heap_free(This->Location);
|
heap_free(This->Location);
|
||||||
|
@ -272,28 +319,36 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
|
||||||
{
|
{
|
||||||
HlinkImpl *This = (HlinkImpl*)iface;
|
HlinkImpl *This = (HlinkImpl*)iface;
|
||||||
|
|
||||||
FIXME("(%p) -> (%i %p %p)\n", This, dwWhichRef, ppwzTarget, ppwzLocation);
|
TRACE("(%p) -> (%i %p %p)\n", This, dwWhichRef, ppwzTarget, ppwzLocation);
|
||||||
|
|
||||||
|
/* note: undocumented behavior with dwWhichRef == -1 */
|
||||||
|
if(dwWhichRef != -1 && dwWhichRef & ~(HLINKGETREF_DEFAULT | HLINKGETREF_ABSOLUTE | HLINKGETREF_RELATIVE))
|
||||||
|
{
|
||||||
|
if(ppwzTarget)
|
||||||
|
*ppwzTarget = NULL;
|
||||||
|
if(ppwzLocation)
|
||||||
|
*ppwzLocation = NULL;
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dwWhichRef != HLINKGETREF_DEFAULT)
|
||||||
|
FIXME("unhandled flags: 0x%x\n", dwWhichRef);
|
||||||
|
|
||||||
if (ppwzTarget)
|
if (ppwzTarget)
|
||||||
{
|
{
|
||||||
*ppwzTarget = hlink_co_strdupW( This->Target );
|
IMoniker* mon;
|
||||||
|
__GetMoniker(This, &mon);
|
||||||
if (!This->Target)
|
if (mon)
|
||||||
{
|
{
|
||||||
IMoniker* mon;
|
IBindCtx *pbc;
|
||||||
__GetMoniker(This, &mon);
|
|
||||||
if (mon)
|
|
||||||
{
|
|
||||||
IBindCtx *pbc;
|
|
||||||
|
|
||||||
CreateBindCtx( 0, &pbc);
|
CreateBindCtx( 0, &pbc);
|
||||||
IMoniker_GetDisplayName(mon, pbc, NULL, ppwzTarget);
|
IMoniker_GetDisplayName(mon, pbc, NULL, ppwzTarget);
|
||||||
IBindCtx_Release(pbc);
|
IBindCtx_Release(pbc);
|
||||||
IMoniker_Release(mon);
|
IMoniker_Release(mon);
|
||||||
}
|
|
||||||
else
|
|
||||||
FIXME("Unhandled case, no set Target and no moniker\n");
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
*ppwzTarget = NULL;
|
||||||
}
|
}
|
||||||
if (ppwzLocation)
|
if (ppwzLocation)
|
||||||
*ppwzLocation = hlink_co_strdupW( This->Location );
|
*ppwzLocation = hlink_co_strdupW( This->Location );
|
||||||
|
|
Loading…
Reference in a new issue