Commit d4e69aec authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

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

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