Commit 4a9d2d43 authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Implemented PARSE_DOMAIN for CoInternetParseIUri.

parent 500e4fae
...@@ -5966,7 +5966,13 @@ static const uri_parse_test uri_parse_tests[] = { ...@@ -5966,7 +5966,13 @@ static const uri_parse_test uri_parse_tests[] = {
{"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE}, {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
{"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE}, {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
{"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE}, {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
{"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE} {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
/* PARSE_DOMAIN tests. */
{"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
{"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
{"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
{"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE}
}; };
static inline LPWSTR a2w(LPCSTR str) { static inline LPWSTR a2w(LPCSTR str) {
......
...@@ -6442,6 +6442,34 @@ static HRESULT parse_site(IUri *uri, LPWSTR output, DWORD output_len, DWORD *res ...@@ -6442,6 +6442,34 @@ static HRESULT parse_site(IUri *uri, LPWSTR output, DWORD output_len, DWORD *res
return S_OK; return S_OK;
} }
static HRESULT parse_domain(IUri *uri, LPWSTR output, DWORD output_len, DWORD *result_len)
{
HRESULT hr;
DWORD len;
BSTR received;
hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DOMAIN, &len, 0);
if(FAILED(hr)) {
*result_len = 0;
return hr;
}
*result_len = len;
if(len+1 > output_len)
return STRSAFE_E_INSUFFICIENT_BUFFER;
hr = IUri_GetDomain(uri, &received);
if(FAILED(hr)) {
*result_len = 0;
return hr;
}
memcpy(output, received, (len+1)*sizeof(WCHAR));
SysFreeString(received);
return S_OK;
}
/*********************************************************************** /***********************************************************************
* CoInternetParseIUri (urlmon.@) * CoInternetParseIUri (urlmon.@)
*/ */
...@@ -6512,6 +6540,9 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d ...@@ -6512,6 +6540,9 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d
case PARSE_SITE: case PARSE_SITE:
hr = parse_site(pIUri, pwzResult, cchResult, pcchResult); hr = parse_site(pIUri, pwzResult, cchResult, pcchResult);
break; break;
case PARSE_DOMAIN:
hr = parse_domain(pIUri, pwzResult, cchResult, pcchResult);
break;
case PARSE_SECURITY_URL: case PARSE_SECURITY_URL:
case PARSE_MIME: case PARSE_MIME:
case PARSE_SERVER: case PARSE_SERVER:
......
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