Jacek Caban : mshtml: Update wine_url in nsIURI::SetPath.

Alexandre Julliard julliard at winehq.org
Mon Feb 4 08:43:13 CST 2008


Module: wine
Branch: master
Commit: 814e07d8e83f97ef5c8b4a9ffc95986c5ea8599d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=814e07d8e83f97ef5c8b4a9ffc95986c5ea8599d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Feb  1 15:31:19 2008 +0100

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 3b51849..07a32ed 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 e2abfa4..6eb7f30 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 c900bd9..2e62a44 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)




More information about the wine-cvs mailing list