Author: akhaldi Date: Thu Sep 19 16:12:20 2013 New Revision: 60209
URL: http://svn.reactos.org/svn/reactos?rev=60209&view=rev Log: [HLINK] * Sync with Wine 1.7.1. CORE-7469
Modified: trunk/reactos/dll/win32/hlink/CMakeLists.txt trunk/reactos/dll/win32/hlink/browse_ctx.c trunk/reactos/dll/win32/hlink/extserv.c trunk/reactos/dll/win32/hlink/hlink_main.c trunk/reactos/dll/win32/hlink/link.c trunk/reactos/include/psdk/hlink.idl trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/hlink/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/hlink/CMakeLists.... ============================================================================== --- trunk/reactos/dll/win32/hlink/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/hlink/CMakeLists.txt [iso-8859-1] Thu Sep 19 16:12:20 2013 @@ -9,11 +9,10 @@ extserv.c hlink_main.c link.c - hlink.rc ${CMAKE_CURRENT_BINARY_DIR}/hlink_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/hlink.def)
-add_library(hlink SHARED ${SOURCE}) +add_library(hlink SHARED ${SOURCE} hlink.rc) set_module_type(hlink win32dll) target_link_libraries(hlink uuid wine) add_delay_importlibs(hlink urlmon)
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] Thu Sep 19 16:12:20 2013 @@ -21,15 +21,23 @@ #include "hlink_private.h"
#include <wine/debug.h> +#include <wine/list.h>
WINE_DEFAULT_DEBUG_CHANNEL(hlink); + +struct link_entry +{ + struct list entry; + IHlink *link; +};
typedef struct { IHlinkBrowseContext IHlinkBrowseContext_iface; LONG ref; HLBWINFO* BrowseWindowInfo; - IHlink* CurrentPage; + struct link_entry *current; + struct list links; } HlinkBCImpl;
static inline HlinkBCImpl *impl_from_IHlinkBrowseContext(IHlinkBrowseContext *iface) @@ -68,18 +76,26 @@ static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface) { HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface); - ULONG refCount = InterlockedDecrement(&This->ref); - - TRACE("(%p)->(count=%u)\n", This, refCount + 1); - if (refCount) - return refCount; - - TRACE("-- destroying IHlinkBrowseContext (%p)\n", This); - heap_free(This->BrowseWindowInfo); - if (This->CurrentPage) - IHlink_Release(This->CurrentPage); - heap_free(This); - return 0; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(count=%u)\n", This, ref + 1); + + if (!ref) + { + struct link_entry *link, *link2; + + LIST_FOR_EACH_ENTRY_SAFE(link, link2, &This->links, struct link_entry, entry) + { + list_remove(&link->entry); + IHlink_Release(link->link); + heap_free(link); + } + + heap_free(This->BrowseWindowInfo); + heap_free(This); + } + + return ref; }
static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface, @@ -116,7 +132,7 @@ static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface, DWORD dwRegister) { - HRESULT r = S_OK; + HRESULT r; IRunningObjectTable *ROT; HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
@@ -165,17 +181,22 @@ static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface, IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName) { - HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface); - - FIXME("(%p)->(%p %s %s)\n", This, pimkTarget, - debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName)); - - if (This->CurrentPage) - IHlink_Release(This->CurrentPage); + HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface); + struct link_entry *link; + + TRACE("(%p)->(%p %s %s)\n", This, pimkTarget, debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName)); + + if (!list_empty(&This->links)) + return CO_E_ALREADYINITIALIZED; + + link = heap_alloc(sizeof(struct link_entry)); + if (!link) return E_OUTOFMEMORY;
HlinkCreateFromMoniker(pimkTarget, pwzLocation, pwzFriendlyName, NULL, - 0, NULL, &IID_IHlink, (LPVOID*) &This->CurrentPage); - + 0, NULL, &IID_IHlink, (void**)&link->link); + + list_add_head(&This->links, &link->entry); + This->current = LIST_ENTRY(list_head(&This->links), struct link_entry, entry); return S_OK; }
@@ -191,12 +212,56 @@ return S_OK; }
+static struct link_entry *context_get_entry(HlinkBCImpl *ctxt, ULONG hlid) +{ + struct list *entry; + + switch (hlid) + { + case HLID_PREVIOUS: + entry = list_prev(&ctxt->links, &ctxt->current->entry); + break; + case HLID_NEXT: + entry = list_next(&ctxt->links, &ctxt->current->entry); + break; + case HLID_CURRENT: + entry = &ctxt->current->entry; + break; + case HLID_STACKBOTTOM: + entry = list_tail(&ctxt->links); + break; + case HLID_STACKTOP: + entry = list_head(&ctxt->links); + break; + default: + WARN("unknown id 0x%x\n", hlid); + entry = NULL; + } + + return entry ? LIST_ENTRY(entry, struct link_entry, entry) : NULL; +} + static HRESULT WINAPI IHlinkBC_UpdateHlink(IHlinkBrowseContext* iface, - ULONG uHLID, IMoniker* pimkTarget, LPCWSTR pwzLocation, - LPCWSTR pwzFriendlyName) -{ - FIXME("\n"); - return E_NOTIMPL; + ULONG hlid, IMoniker *target, LPCWSTR location, LPCWSTR friendly_name) +{ + HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface); + struct link_entry *entry = context_get_entry(This, hlid); + IHlink *link; + HRESULT hr; + + TRACE("(%p)->(0x%x %p %s %s)\n", This, hlid, target, debugstr_w(location), debugstr_w(friendly_name)); + + if (!entry) + return E_INVALIDARG; + + hr = HlinkCreateFromMoniker(target, location, friendly_name, NULL, 0, NULL, &IID_IHlink, (void**)&link); + if (FAILED(hr)) + return hr; + + IHlink_Release(entry->link); + entry->link = link; + + return S_OK; }
static HRESULT WINAPI IHlinkBC_EnumNavigationStack( IHlinkBrowseContext *iface, @@ -213,29 +278,36 @@ return E_NOTIMPL; }
-static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface, - ULONG uHLID, IHlink** ppihl) -{ - HlinkBCImpl *This = impl_from_IHlinkBrowseContext(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, - ULONG uHLID) -{ - FIXME("\n"); - return E_NOTIMPL; +static HRESULT WINAPI IHlinkBC_GetHlink(IHlinkBrowseContext* iface, ULONG hlid, IHlink **ret) +{ + HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface); + struct link_entry *link; + + TRACE("(%p)->(0x%x %p)\n", This, hlid, ret); + + link = context_get_entry(This, hlid); + if (!link) + return E_FAIL; + + *ret = link->link; + IHlink_AddRef(*ret); + + return S_OK; +} + +static HRESULT WINAPI IHlinkBC_SetCurrentHlink(IHlinkBrowseContext* iface, ULONG hlid) +{ + HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface); + struct link_entry *link; + + TRACE("(%p)->(0x%08x)\n", This, hlid); + + link = context_get_entry(This, hlid); + if (!link) + return E_FAIL; + + This->current = link; + return S_OK; }
static HRESULT WINAPI IHlinkBC_Clone( IHlinkBrowseContext* iface, @@ -289,6 +361,8 @@
hl->ref = 1; hl->IHlinkBrowseContext_iface.lpVtbl = &hlvt; + list_init(&hl->links); + hl->current = NULL;
*ppv = hl; return S_OK;
Modified: trunk/reactos/dll/win32/hlink/extserv.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/hlink/extserv.c?r... ============================================================================== --- trunk/reactos/dll/win32/hlink/extserv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/hlink/extserv.c [iso-8859-1] Thu Sep 19 16:12:20 2013 @@ -235,7 +235,7 @@
static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR pwzAdditionalHeaders) { - int len = 0; + int len;
heap_free(This->headers); This->headers = NULL;
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] Thu Sep 19 16:12:20 2013 @@ -53,8 +53,6 @@ instance = hinstDLL; DisableThreadLibraryCalls(hinstDLL); break; - case DLL_PROCESS_DETACH: - break; } return TRUE; } @@ -64,7 +62,7 @@ */ HRESULT WINAPI DllCanUnloadNow( void ) { - return S_OK; + return S_FALSE; }
/*********************************************************************** @@ -75,7 +73,7 @@ IUnknown* piunkOuter, REFIID riid, void** ppvObj) { IHlink *hl = NULL; - HRESULT r = S_OK; + HRESULT r;
TRACE("%p %s %s %p %i %p %s %p\n", pimkTrgt, debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), pihlsite, dwSiteData, piunkOuter, @@ -107,7 +105,7 @@ IUnknown* piunkOuter, REFIID riid, void** ppvObj) { IHlink *hl = NULL; - HRESULT r = S_OK; + HRESULT r; WCHAR *hash, *tgt; const WCHAR *loc;
@@ -176,15 +174,8 @@ */ HRESULT WINAPI HlinkCreateBrowseContext( IUnknown* piunkOuter, REFIID riid, void** ppvObj) { - HRESULT r = S_OK; - TRACE("%p %s %p\n", piunkOuter, debugstr_guid(riid), ppvObj); - - r = CoCreateInstance(&CLSID_StdHlinkBrowseContext, piunkOuter, CLSCTX_INPROC_SERVER, riid, ppvObj); - - TRACE("returning %i\n",r); - - return r; + return CoCreateInstance(&CLSID_StdHlinkBrowseContext, piunkOuter, CLSCTX_INPROC_SERVER, riid, ppvObj); }
/*********************************************************************** @@ -213,7 +204,7 @@ IHlinkBrowseContext* phlbc, DWORD grfHLNF, IMoniker *pmkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, ULONG* puHLID) { - HRESULT r = S_OK; + HRESULT r;
TRACE("%p %p %i %p %s %s %p\n",phlFrame, phlbc, grfHLNF, pmkTarget, debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), puHLID); @@ -366,12 +357,21 @@ /*********************************************************************** * HlinkUpdateStackItem (HLINK.@) */ -HRESULT WINAPI HlinkUpdateStackItem(IHlinkFrame *pihlframe, IHlinkBrowseContext *pihlbc, - ULONG uHLID, IMoniker *pimkTrgt, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName) -{ - FIXME("(%p %p %u %p %s %s)\n", pihlframe, pihlbc, uHLID, pimkTrgt, debugstr_w(pwzLocation), - debugstr_w(pwzFriendlyName)); - return E_NOTIMPL; +HRESULT WINAPI HlinkUpdateStackItem(IHlinkFrame *frame, IHlinkBrowseContext *bc, + ULONG hlid, IMoniker *target, LPCWSTR location, LPCWSTR friendly_name) +{ + HRESULT hr; + + TRACE("(%p %p 0x%x %p %s %s)\n", frame, bc, hlid, target, debugstr_w(location), debugstr_w(friendly_name)); + + if (!frame && !bc) return E_INVALIDARG; + + if (frame) + hr = IHlinkFrame_UpdateHlink(frame, hlid, target, location, friendly_name); + else + hr = IHlinkBrowseContext_UpdateHlink(bc, hlid, target, location, friendly_name); + + return hr; }
/***********************************************************************
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] Thu Sep 19 16:12:20 2013 @@ -487,19 +487,23 @@ if (SUCCEEDED(r)) { IBindCtx *bcxt; - IHlinkTarget *target = NULL; + IUnknown *unk = NULL; + IHlinkTarget *target;
CreateBindCtx(0, &bcxt);
RegisterBindStatusCallback(bcxt, pbsc, NULL, 0);
- r = IMoniker_BindToObject(mon, bcxt, NULL, &IID_IHlinkTarget, - (LPVOID*)&target); - TRACE("IHlinkTarget returned 0x%x\n", r); + r = IMoniker_BindToObject(mon, bcxt, NULL, &IID_IUnknown, (void**)&unk); if (r == S_OK) { + r = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&target); + IUnknown_Release(unk); + } + if (r == S_OK) + { IHlinkTarget_SetBrowseContext(target, phbc); - IHlinkTarget_Navigate(target, grfHLNF, This->Location); + r = IHlinkTarget_Navigate(target, grfHLNF, This->Location); IHlinkTarget_Release(target); } else @@ -528,7 +532,7 @@ return r; }
-static HRESULT WINAPI IHlink_fnSetAdditonalParams(IHlink* iface, +static HRESULT WINAPI IHlink_fnSetAdditionalParams(IHlink* iface, LPCWSTR pwzAdditionalParams) { TRACE("Not implemented in native IHlink\n"); @@ -559,7 +563,7 @@ IHlink_fnGetTargetFrameName, IHlink_fnGetMiscStatus, IHlink_fnNavigate, - IHlink_fnSetAdditonalParams, + IHlink_fnSetAdditionalParams, IHlink_fnGetAdditionalParams };
@@ -797,7 +801,7 @@ r = OleLoadFromStream(pStm, &IID_IMoniker, (LPVOID*)&(This->Moniker)); if (FAILED(r)) goto end; - This->absolute = hdr[1] & HLINK_SAVE_MONIKER_IS_ABSOLUTE ? TRUE : FALSE; + This->absolute = (hdr[1] & HLINK_SAVE_MONIKER_IS_ABSOLUTE) != 0; }
if (hdr[1] & HLINK_SAVE_LOCATION_PRESENT)
Modified: trunk/reactos/include/psdk/hlink.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/hlink.idl?rev=... ============================================================================== --- trunk/reactos/include/psdk/hlink.idl [iso-8859-1] (original) +++ trunk/reactos/include/psdk/hlink.idl [iso-8859-1] Thu Sep 19 16:12:20 2013 @@ -37,6 +37,7 @@ cpp_quote("HRESULT WINAPI HlinkTranslateURL(LPCWSTR,DWORD,LPWSTR*);") cpp_quote("HRESULT WINAPI HlinkParseDisplayName(LPBC,LPCWSTR,BOOL,ULONG*,IMoniker**);") cpp_quote("HRESULT WINAPI HlinkResolveMonikerForData(LPMONIKER,DWORD,LPBC,ULONG,FORMATETC*,IBindStatusCallback*,LPMONIKER);") +cpp_quote("HRESULT WINAPI HlinkUpdateStackItem(IHlinkFrame*, IHlinkBrowseContext*, ULONG, IMoniker*, LPCWSTR, LPCWSTR);")
typedef enum _HLSR_NOREDEF10 { HLSR_HOME,
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=6... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Thu Sep 19 16:12:20 2013 @@ -75,7 +75,7 @@ reactos/dll/win32/fusion # Synced to Wine-1.7.1 reactos/dll/win32/gdiplus # Synced to Wine-1.7.1 reactos/dll/win32/hhctrl.ocx # Synced to Wine-1.7.1 -reactos/dll/win32/hlink # Synced to Wine-1.5.4 +reactos/dll/win32/hlink # Synced to Wine-1.7.1 reactos/dll/win32/hnetcfg # Synced to Wine-1.5.4 reactos/dll/win32/httpapi # Synced to Wine-1.5.4 reactos/dll/win32/iccvid # Synced to Wine-1.5.19