From 814e07d8e83f97ef5c8b4a9ffc95986c5ea8599d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 1 Feb 2008 15:31:19 +0100 Subject: [PATCH] mshtml: Update wine_url in nsIURI::SetPath. --- dlls/mshtml/Makefile.in | 2 +- dlls/mshtml/mshtml_private.h | 14 ++++++++++++++ dlls/mshtml/nsio.c | 27 ++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 3b51849d875..07a32ed5d5e 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = mshtml.dll IMPORTLIB = libmshtml.$(IMPLIBEXT) -IMPORTS = urlmon ole32 oleaut32 user32 gdi32 advapi32 kernel32 +IMPORTS = urlmon shlwapi ole32 oleaut32 user32 gdi32 advapi32 kernel32 EXTRALIBS = -lstrmiids -luuid EXTRADEFS = -DCOM_NO_WINDOWS_H diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index e2abfa400d8..6eb7f30a425 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -579,6 +579,20 @@ static inline LPWSTR heap_strdupW(LPCWSTR str) return ret; } +static inline WCHAR *heap_strdupAtoW(const char *str) +{ + LPWSTR ret = NULL; + + if(str) { + DWORD len; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = heap_alloc(len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, -1); + } + + return ret; +} HINSTANCE get_shdoclc(void); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index c900bd93486..2e62a44bf5b 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -1465,14 +1465,31 @@ static nsresult NSAPI nsURI_GetPath(nsIWineURI *iface, nsACString *aPath) static nsresult NSAPI nsURI_SetPath(nsIWineURI *iface, const nsACString *aPath) { nsURI *This = NSURI_THIS(iface); + const char *path; - TRACE("(%p)->(%p)\n", This, aPath); + nsACString_GetData(aPath, &path); + TRACE("(%p)->(%p(%s))\n", This, aPath, debugstr_a(path)); - if(This->uri) - return nsIURI_SetPath(This->uri, aPath); - FIXME("default action not implemented\n"); - return NS_ERROR_NOT_IMPLEMENTED; + if(This->wine_url) { + WCHAR new_url[INTERNET_MAX_URL_LENGTH]; + DWORD size = sizeof(new_url)/sizeof(WCHAR); + LPWSTR pathw; + HRESULT hres; + + pathw = heap_strdupAtoW(path); + hres = UrlCombineW(This->wine_url, pathw, new_url, &size, 0); + heap_free(pathw); + if(SUCCEEDED(hres)) + nsIWineURI_SetWineURL(NSWINEURI(This), new_url); + else + WARN("UrlCombine failed: %08x\n", hres); + } + + if(!This->uri) + return NS_OK; + + return nsIURI_SetPath(This->uri, aPath); } static nsresult NSAPI nsURI_Equals(nsIWineURI *iface, nsIURI *other, PRBool *_retval) -- 2.11.4.GIT