Thomas Mullaly : urlmon: Implementation for PARSE_FRIENDLY in CoInternetParseIUri.

Alexandre Julliard julliard at winehq.org
Mon Nov 29 13:38:35 CST 2010


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

Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date:   Sat Nov 27 17:49:25 2010 -0500

urlmon: Implementation for PARSE_FRIENDLY in CoInternetParseIUri.

---

 dlls/urlmon/tests/uri.c |    6 +++++-
 dlls/urlmon/uri.c       |   31 +++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index 83a335b..dfeed9b 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -5921,7 +5921,11 @@ static const uri_parse_test uri_parse_tests[] = {
     {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
     {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
     {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
-    {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE}
+    {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
+
+    /* PARSE_FRIENDLY tests. */
+    {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
+    {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE}
 };
 
 static inline LPWSTR a2w(LPCSTR str) {
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index a0a1a54..64eaba2 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -6186,6 +6186,34 @@ static HRESULT parse_canonicalize(const Uri *uri, DWORD flags, LPWSTR output,
     return S_OK;
 }
 
+static HRESULT parse_friendly(IUri *uri, LPWSTR output, DWORD output_len,
+                              DWORD *result_len)
+{
+    HRESULT hr;
+    DWORD display_len;
+    BSTR display;
+
+    hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DISPLAY_URI, &display_len, 0);
+    if(FAILED(hr)) {
+        *result_len = 0;
+        return hr;
+    }
+
+    *result_len = display_len;
+    if(display_len+1 > output_len)
+        return STRSAFE_E_INSUFFICIENT_BUFFER;
+
+    hr = IUri_GetDisplayUri(uri, &display);
+    if(FAILED(hr)) {
+        *result_len = 0;
+        return hr;
+    }
+
+    memcpy(output, display, (display_len+1)*sizeof(WCHAR));
+    SysFreeString(display);
+    return S_OK;
+}
+
 /***********************************************************************
  *           CoInternetParseIUri (urlmon.@)
  */
@@ -6217,6 +6245,9 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d
         }
         hr = parse_canonicalize(uri, dwFlags, pwzResult, cchResult, pcchResult);
         break;
+    case PARSE_FRIENDLY:
+        hr = parse_friendly(pIUri, pwzResult, cchResult, pcchResult);
+        break;
     case PARSE_SECURITY_URL:
     case PARSE_MIME:
     case PARSE_SERVER:




More information about the wine-cvs mailing list