Thomas Mullaly : urlmon: Implemented PARSE_DOCUMENT for CoInternetParseIUri .

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


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

Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date:   Sun Nov 28 16:21:00 2010 -0500

urlmon: Implemented PARSE_DOCUMENT for CoInternetParseIUri.

---

 dlls/urlmon/tests/uri.c |   10 +++++++++-
 dlls/urlmon/uri.c       |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index c03e516..706e8b5 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -5933,7 +5933,15 @@ static const uri_parse_test uri_parse_tests[] = {
     {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
     {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
     {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
-    {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE}
+    {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
+
+    /* PARSE_DOCUMENT tests. */
+    {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
+    {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
+    {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
+    {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
+    {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
+    {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE}
 };
 
 static inline LPWSTR a2w(LPCSTR str) {
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 475db7f..4247c71 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -6265,6 +6265,39 @@ static HRESULT parse_rootdocument(const Uri *uri, LPWSTR output, DWORD output_le
     return S_OK;
 }
 
+static HRESULT parse_document(const Uri *uri, LPWSTR output, DWORD output_len,
+                              DWORD *result_len)
+{
+    DWORD len = 0;
+
+    /* It has to be a known scheme type, but, it can't be a file
+     * scheme. It also has to hierarchical.
+     */
+    if(uri->scheme_type == URL_SCHEME_UNKNOWN ||
+       uri->scheme_type == URL_SCHEME_FILE ||
+       uri->authority_start == -1) {
+        *result_len = 0;
+        if(output_len < 1)
+            return STRSAFE_E_INSUFFICIENT_BUFFER;
+
+        output[0] = 0;
+        return S_OK;
+    }
+
+    if(uri->fragment_start > -1)
+        len = uri->fragment_start;
+    else
+        len = uri->canon_len;
+
+    *result_len = len;
+    if(len+1 > output_len)
+        return STRSAFE_E_INSUFFICIENT_BUFFER;
+
+    memcpy(output, uri->canon_uri, len*sizeof(WCHAR));
+    output[len] = 0;
+    return S_OK;
+}
+
 /***********************************************************************
  *           CoInternetParseIUri (urlmon.@)
  */
@@ -6308,6 +6341,15 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d
         }
         hr = parse_rootdocument(uri, pwzResult, cchResult, pcchResult);
         break;
+    case PARSE_DOCUMENT:
+        if(!(uri = get_uri_obj(pIUri))) {
+            *pcchResult = 0;
+            FIXME("(%p %d %x %p %d %p %x) Unknown IUri's not supported for this action.\n",
+                pIUri, ParseAction, dwFlags, pwzResult, cchResult, pcchResult, (DWORD)dwReserved);
+            return E_NOTIMPL;
+        }
+        hr = parse_document(uri, pwzResult, cchResult, pcchResult);
+        break;
     case PARSE_SECURITY_URL:
     case PARSE_MIME:
     case PARSE_SERVER:




More information about the wine-cvs mailing list