Author: cwittich
Date: Wed Mar 3 17:14:25 2010
New Revision: 45790
URL:
http://svn.reactos.org/svn/reactos?rev=45790&view=rev
Log:
[HLINK]
sync hlink to wine 1.1.39
Modified:
trunk/reactos/dll/win32/hlink/browse_ctx.c
trunk/reactos/dll/win32/hlink/hlink_main.c
trunk/reactos/dll/win32/hlink/link.c
Modified: trunk/reactos/dll/win32/hlink/browse_ctx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/hlink/browse_ctx…
==============================================================================
--- trunk/reactos/dll/win32/hlink/browse_ctx.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/hlink/browse_ctx.c [iso-8859-1] Wed Mar 3 17:14:25 2010
@@ -223,8 +223,19 @@
static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
ULONG uHLID, IHlink** ppihl)
{
- FIXME("\n");
- return E_NOTIMPL;
+ HlinkBCImpl *This = (HlinkBCImpl*)iface;
+
+ 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,
Modified: trunk/reactos/dll/win32/hlink/hlink_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/hlink/hlink_main…
==============================================================================
--- trunk/reactos/dll/win32/hlink/hlink_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/hlink/hlink_main.c [iso-8859-1] Wed Mar 3 17:14:25 2010
@@ -55,7 +55,6 @@
*/
HRESULT WINAPI DllCanUnloadNow( void )
{
- FIXME("\n");
return S_OK;
}
@@ -77,14 +76,12 @@
if (FAILED(r))
return r;
- if (pwzLocation)
- IHlink_SetStringReference(hl, HLINKSETF_LOCATION, NULL, pwzLocation);
+ IHlink_SetMonikerReference(hl, HLINKSETF_LOCATION | HLINKSETF_TARGET, pimkTrgt,
pwzLocation);
+
if (pwzFriendlyName)
IHlink_SetFriendlyName(hl, pwzFriendlyName);
if (pihlsite)
IHlink_SetHlinkSite(hl, pihlsite, dwSiteData);
- if (pimkTrgt)
- IHlink_SetMonikerReference(hl, 0, pimkTrgt, pwzLocation);
*ppvObj = hl;
@@ -111,43 +108,12 @@
if (FAILED(r))
return r;
- if (pwzLocation)
- IHlink_SetStringReference(hl, HLINKSETF_LOCATION, NULL, 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);
- }
+ IHlink_SetStringReference(hl, HLINKSETF_TARGET | HLINKSETF_LOCATION,
+ pwzTarget, pwzLocation);
if (pwzFriendlyName)
IHlink_SetFriendlyName(hl, pwzFriendlyName);
+
if (pihlsite)
IHlink_SetHlinkSite(hl, pihlsite, dwSiteData);
@@ -159,7 +125,7 @@
/***********************************************************************
- * HlinkNavigate (HLINK.@)
+ * HlinkCreateBrowseContext (HLINK.@)
*/
HRESULT WINAPI HlinkCreateBrowseContext( IUnknown* piunkOuter, REFIID riid, void**
ppvObj)
{
Modified: trunk/reactos/dll/win32/hlink/link.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/hlink/link.c?rev…
==============================================================================
--- trunk/reactos/dll/win32/hlink/link.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/hlink/link.c [iso-8859-1] Wed Mar 3 17:14:25 2010
@@ -51,7 +51,6 @@
LPWSTR FriendlyName;
LPWSTR Location;
- LPWSTR Target;
LPWSTR TargetFrameName;
IMoniker *Moniker;
IHlinkSite *Site;
@@ -155,7 +154,6 @@
TRACE("-- destroying IHlink (%p)\n", This);
heap_free(This->FriendlyName);
- heap_free(This->Target);
heap_free(This->TargetFrameName);
heap_free(This->Location);
if (This->Moniker)
@@ -206,24 +204,33 @@
{
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));
- if (This->Moniker)
- IMoniker_Release(This->Moniker);
-
- This->Moniker = pmkTarget;
- if (This->Moniker)
- {
- 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);
- This->Location = hlink_strdupW( pwzLocation );
+ if(rfHLSETF == 0)
+ return E_INVALIDARG;
+ if(!(rfHLSETF & (HLINKSETF_TARGET | HLINKSETF_LOCATION)))
+ return rfHLSETF;
+
+ if(rfHLSETF & HLINKSETF_TARGET){
+ if (This->Moniker)
+ IMoniker_Release(This->Moniker);
+
+ This->Moniker = pmkTarget;
+ if (This->Moniker)
+ {
+ 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);
+ }
+ }
+
+ if(rfHLSETF & HLINKSETF_LOCATION){
+ heap_free(This->Location);
+ This->Location = hlink_strdupW( pwzLocation );
+ }
return S_OK;
}
@@ -236,11 +243,51 @@
TRACE("(%p)->(%i %s %s)\n", This, grfHLSETF, debugstr_w(pwzTarget),
debugstr_w(pwzLocation));
+ if(grfHLSETF > (HLINKSETF_TARGET | HLINKSETF_LOCATION) &&
+ grfHLSETF < -(HLINKSETF_TARGET | HLINKSETF_LOCATION))
+ return grfHLSETF;
+
if (grfHLSETF & HLINKSETF_TARGET)
{
- heap_free(This->Target);
- This->Target = hlink_strdupW( pwzTarget );
- }
+ if (This->Moniker)
+ {
+ 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)
{
heap_free(This->Location);
@@ -272,28 +319,36 @@
{
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)
{
- *ppwzTarget = hlink_co_strdupW( This->Target );
-
- if (!This->Target)
+ IMoniker* mon;
+ __GetMoniker(This, &mon);
+ if (mon)
{
- IMoniker* mon;
- __GetMoniker(This, &mon);
- if (mon)
- {
- IBindCtx *pbc;
-
- CreateBindCtx( 0, &pbc);
- IMoniker_GetDisplayName(mon, pbc, NULL, ppwzTarget);
- IBindCtx_Release(pbc);
- IMoniker_Release(mon);
- }
- else
- FIXME("Unhandled case, no set Target and no moniker\n");
+ IBindCtx *pbc;
+
+ CreateBindCtx( 0, &pbc);
+ IMoniker_GetDisplayName(mon, pbc, NULL, ppwzTarget);
+ IBindCtx_Release(pbc);
+ IMoniker_Release(mon);
}
+ else
+ *ppwzTarget = NULL;
}
if (ppwzLocation)
*ppwzLocation = hlink_co_strdupW( This->Location );