Thomas Mullaly : urlmon: Implemented functionality for retrieving the scheme name of a IUri.

Alexandre Julliard julliard at winehq.org
Wed Jul 21 10:54:51 CDT 2010


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

Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date:   Mon Jun  7 21:33:42 2010 -0400

urlmon: Implemented functionality for retrieving the scheme name of a IUri.

---

 dlls/urlmon/tests/uri.c |   24 ++++++++++++------------
 dlls/urlmon/uri.c       |   29 ++++++++++++++++++++++-------
 2 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index ddd35d8..80a2593 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -105,7 +105,7 @@ static const uri_properties uri_tests[] = {
             {"/",S_OK,TRUE},                                            /* PATH_AND_QUERY */
             {"",S_FALSE,TRUE},                                          /* QUERY */
             {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE},  /* RAW_URI */
-            {"http",S_OK,TRUE},                                         /* SCHEME_NAME */
+            {"http",S_OK,FALSE},                                        /* SCHEME_NAME */
             {"",S_FALSE,TRUE},                                          /* USER_INFO */
             {"",S_FALSE,TRUE}                                           /* USER_NAME */
         },
@@ -134,7 +134,7 @@ static const uri_properties uri_tests[] = {
             {"/tests",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"http://winehq.org/tests/.././tests",S_OK,FALSE},
-            {"http",S_OK,TRUE},
+            {"http",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -163,7 +163,7 @@ static const uri_properties uri_tests[] = {
             {"/?query=x&return=y",S_OK,TRUE},
             {"?query=x&return=y",S_OK,TRUE},
             {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
-            {"http",S_OK,TRUE},
+            {"http",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -192,7 +192,7 @@ static const uri_properties uri_tests[] = {
             {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
-            {"http",S_OK,TRUE},
+            {"http",S_OK,FALSE},
             {"usEr%3Ainfo",S_OK,TRUE},
             {"usEr%3Ainfo",S_OK,TRUE}
         },
@@ -222,7 +222,7 @@ static const uri_properties uri_tests[] = {
             {"/dir/foo%20bar.txt",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"ftp://winepass:[email protected]:9999/dir/foo bar.txt",S_OK,FALSE},
-            {"ftp",S_OK,TRUE},
+            {"ftp",S_OK,FALSE},
             {"winepass:wine",S_OK,TRUE},
             {"winepass",S_OK,TRUE}
         },
@@ -250,7 +250,7 @@ static const uri_properties uri_tests[] = {
             {"/c:/tests/foo%2520bar.mp3",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
-            {"file",S_OK,TRUE},
+            {"file",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -278,7 +278,7 @@ static const uri_properties uri_tests[] = {
             {"/tests/test%20file.README.txt",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
-            {"file",S_OK,TRUE},
+            {"file",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -306,7 +306,7 @@ static const uri_properties uri_tests[] = {
             {"nothing:should:happen here",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"urn:nothing:should:happen here",S_OK,FALSE},
-            {"urn",S_OK,TRUE},
+            {"urn",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -335,7 +335,7 @@ static const uri_properties uri_tests[] = {
             {"/test%20dir/test.txt",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
-            {"http",S_OK,TRUE},
+            {"http",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -364,7 +364,7 @@ static const uri_properties uri_tests[] = {
             {"/",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
-            {"http",S_OK,TRUE},
+            {"http",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -393,7 +393,7 @@ static const uri_properties uri_tests[] = {
             {"/",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"ftp://[::13.1.68.3]",S_OK,FALSE},
-            {"ftp",S_OK,TRUE},
+            {"ftp",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE}
         },
@@ -422,7 +422,7 @@ static const uri_properties uri_tests[] = {
             {"/",S_OK,TRUE},
             {"",S_FALSE,TRUE},
             {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
-            {"http",S_OK,TRUE},
+            {"http",S_OK,FALSE},
             {"",S_FALSE,TRUE},
             {"",S_FALSE,TRUE},
         },
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index fc46def..f99061f 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -416,6 +416,8 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST
     if(uriProp > Uri_PROPERTY_STRING_LAST) {
         /* Windows allocates an empty BSTR for invalid Uri_PROPERTY's. */
         *pbstrProperty = SysAllocStringLen(NULL, 0);
+        if(!(*pbstrProperty))
+            return E_OUTOFMEMORY;
 
         /* It only returns S_FALSE for the ZONE property... */
         if(uriProp == Uri_PROPERTY_ZONE)
@@ -438,6 +440,19 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST
         else
             hres = S_OK;
         break;
+    case Uri_PROPERTY_SCHEME_NAME:
+        if(This->scheme_start > -1) {
+            *pbstrProperty = SysAllocStringLen(This->canon_uri + This->scheme_start, This->scheme_len);
+            hres = S_OK;
+        } else {
+            *pbstrProperty = SysAllocStringLen(NULL, 0);
+            hres = S_FALSE;
+        }
+
+        if(!(*pbstrProperty))
+            hres = E_OUTOFMEMORY;
+
+        break;
     default:
         FIXME("(%p)->(%d %p %x)\n", This, uriProp, pbstrProperty, dwFlags);
         hres = E_NOTIMPL;
@@ -470,6 +485,10 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D
         *pcchProperty = SysStringLen(This->raw_uri);
         hres = S_OK;
         break;
+    case Uri_PROPERTY_SCHEME_NAME:
+        *pcchProperty = This->scheme_len;
+        hres = (This->scheme_start > -1) ? S_OK : S_FALSE;
+        break;
     default:
         FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
         hres = E_NOTIMPL;
@@ -481,7 +500,7 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D
 static HRESULT WINAPI Uri_GetPropertyDWORD(IUri *iface, Uri_PROPERTY uriProp, DWORD *pcchProperty, DWORD dwFlags)
 {
     Uri *This = URI_THIS(iface);
-    FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
+    TRACE("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
 
     if(!pcchProperty)
         return E_INVALIDARG;
@@ -648,12 +667,8 @@ static HRESULT WINAPI Uri_GetRawUri(IUri *iface, BSTR *pstrRawUri)
 static HRESULT WINAPI Uri_GetSchemeName(IUri *iface, BSTR *pstrSchemeName)
 {
     Uri *This = URI_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pstrSchemeName);
-
-    if(!pstrSchemeName)
-        return E_POINTER;
-
-    return E_NOTIMPL;
+    TRACE("(%p)->(%p)\n", This, pstrSchemeName);
+    return Uri_GetPropertyBSTR(iface, Uri_PROPERTY_SCHEME_NAME, pstrSchemeName, 0);
 }
 
 static HRESULT WINAPI Uri_GetUserInfo(IUri *iface, BSTR *pstrUserInfo)




More information about the wine-cvs mailing list