From 152a1efdae7ca0d58f85a875e7038b66025d982c Mon Sep 17 00:00:00 2001 From: Thomas Mullaly Date: Thu, 17 Jun 2010 19:38:23 -0400 Subject: [PATCH] urlmon: Implemented IUri_GetUserInfo. --- dlls/urlmon/tests/uri.c | 64 ++++++++++++++++++++--------------------- dlls/urlmon/uri.c | 26 ++++++++++++----- 2 files changed, 51 insertions(+), 39 deletions(-) diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index 7ca6caee92f..ba2e0b4e335 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -106,7 +106,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, /* QUERY */ {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */ {"http",S_OK,FALSE}, /* SCHEME_NAME */ - {"",S_FALSE,TRUE}, /* USER_INFO */ + {"",S_FALSE,FALSE}, /* USER_INFO */ {"",S_FALSE,TRUE} /* USER_NAME */ }, { @@ -135,7 +135,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"http://winehq.org/tests/.././tests",S_OK,FALSE}, {"http",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -164,7 +164,7 @@ static const uri_properties uri_tests[] = { {"?query=x&return=y",S_OK,TRUE}, {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE}, {"http",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -193,7 +193,7 @@ static const uri_properties uri_tests[] = { {"",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,FALSE}, - {"usEr%3Ainfo",S_OK,TRUE}, + {"usEr%3Ainfo",S_OK,FALSE}, {"usEr%3Ainfo",S_OK,TRUE} }, { @@ -223,7 +223,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"winepass:wine",S_OK,TRUE}, + {"winepass:wine",S_OK,FALSE}, {"winepass",S_OK,TRUE} }, { @@ -251,7 +251,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE}, {"file",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -279,7 +279,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE}, {"file",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -307,7 +307,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"urn:nothing:should:happen here",S_OK,FALSE}, {"urn",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -336,7 +336,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE}, {"http",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -365,7 +365,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE}, {"http",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -394,7 +394,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://[::13.1.68.3]",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -423,7 +423,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE}, {"http",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, }, { @@ -452,7 +452,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"1234://www.winehq.org",S_OK,FALSE}, {"1234",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -615,7 +615,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"C:/test/test.mp3",S_OK,FALSE}, {"file",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -645,7 +645,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"\\\\Server/test.mp3",S_OK,FALSE}, {"file",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -674,7 +674,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"www.winehq.org/test",S_OK,FALSE}, {"*",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -704,7 +704,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"*:www.winehq.org/test",S_OK,FALSE}, {"*",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -786,7 +786,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"/../some dir/test.ext",S_OK,FALSE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -814,7 +814,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"//implicit/wildcard/uri scheme",S_OK,FALSE}, {"*",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, }, { @@ -844,7 +844,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"zip://google.com",S_OK,FALSE}, {"zip",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -875,7 +875,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://user:pass:word@winehq.org/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"user:pass:word",S_OK,TRUE}, + {"user:pass:word",S_OK,FALSE}, {"user",S_OK,TRUE} }, { @@ -906,7 +906,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"wINe:PASS",S_OK,TRUE}, + {"wINe:PASS",S_OK,FALSE}, {"wINe",S_OK,TRUE} }, { @@ -937,7 +937,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"w%5D%5Be:PA%7B%7D",S_OK,TRUE}, + {"w%5D%5Be:PA%7B%7D",S_OK,FALSE}, {"w%5D%5Be",S_OK,TRUE} }, { @@ -968,7 +968,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://empty:@ftp.google.com/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"empty:",S_OK,TRUE}, + {"empty:",S_OK,FALSE}, {"empty",S_OK,TRUE} }, { @@ -999,7 +999,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"%22%20%22weird",S_OK,TRUE}, + {"%22%20%22weird",S_OK,FALSE}, {"%22%20%22weird",S_OK,TRUE} }, { @@ -1030,7 +1030,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"\" \"weird",S_OK,TRUE}, + {"\" \"weird",S_OK,FALSE}, {"\" \"weird",S_OK,TRUE} }, { @@ -1060,7 +1060,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"zip://%xy:word@winehq.org/",S_OK,FALSE}, {"zip",S_OK,FALSE}, - {"%xy:word",S_OK,TRUE}, + {"%xy:word",S_OK,FALSE}, {"%xy",S_OK,TRUE} }, { @@ -1092,7 +1092,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE}, {"zip",S_OK,FALSE}, - {"%2E:%52%53ord",S_OK,TRUE}, + {"%2E:%52%53ord",S_OK,FALSE}, {"%2E",S_OK,TRUE} }, { @@ -1122,7 +1122,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"[](),'test':word",S_OK,TRUE}, + {"[](),'test':word",S_OK,FALSE}, {"[](),'test'",S_OK,TRUE} }, { @@ -1151,7 +1151,7 @@ static const uri_properties uri_tests[] = { {"?:word@winehq.org/",S_OK,TRUE}, {"ftp://test?:word@winehq.org/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -1180,7 +1180,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"ftp://test#:word@winehq.org/",S_OK,FALSE}, {"ftp",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE} }, { @@ -1210,7 +1210,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"zip://test\\:word@winehq.org/",S_OK,FALSE}, {"zip",S_OK,FALSE}, - {"test\\:word",S_OK,TRUE}, + {"test\\:word",S_OK,FALSE}, {"test\\",S_OK,TRUE} }, { diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index f8d99a821d4..19988e41155 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -876,6 +876,19 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST hres = S_FALSE; } + if(!(*pbstrProperty)) + hres = E_OUTOFMEMORY; + + break; + case Uri_PROPERTY_USER_INFO: + if(This->userinfo_start > -1) { + *pbstrProperty = SysAllocStringLen(This->canon_uri+This->userinfo_start, This->userinfo_len); + hres = S_OK; + } else { + *pbstrProperty = SysAllocStringLen(NULL, 0); + hres = S_FALSE; + } + if(!(*pbstrProperty)) hres = E_OUTOFMEMORY; @@ -916,6 +929,10 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D *pcchProperty = This->scheme_len; hres = (This->scheme_start > -1) ? S_OK : S_FALSE; break; + case Uri_PROPERTY_USER_INFO: + *pcchProperty = This->userinfo_len; + hres = (This->userinfo_start > -1) ? S_OK : S_FALSE; + break; default: FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags); hres = E_NOTIMPL; @@ -1112,13 +1129,8 @@ static HRESULT WINAPI Uri_GetSchemeName(IUri *iface, BSTR *pstrSchemeName) static HRESULT WINAPI Uri_GetUserInfo(IUri *iface, BSTR *pstrUserInfo) { - Uri *This = URI_THIS(iface); - FIXME("(%p)->(%p)\n", This, pstrUserInfo); - - if(!pstrUserInfo) - return E_POINTER; - - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", iface, pstrUserInfo); + return Uri_GetPropertyBSTR(iface, Uri_PROPERTY_USER_INFO, pstrUserInfo, 0); } static HRESULT WINAPI Uri_GetUserName(IUri *iface, BSTR *pstrUserName)