Commit 5ca32152 authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Implemented PARSE_ANCHOR and PARSE_LOCATION for CoInternetParseIUri.

parent 08b95706
......@@ -5972,7 +5972,13 @@ static const uri_parse_test uri_parse_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}
{"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
/* PARSE_LOCATION and PARSE_ANCHOR tests. */
{"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
{"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
{"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
{"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
};
static inline LPWSTR a2w(LPCSTR str) {
......
......@@ -6468,6 +6468,34 @@ static HRESULT parse_domain(IUri *uri, LPWSTR output, DWORD output_len, DWORD *r
return S_OK;
}
static HRESULT parse_anchor(IUri *uri, LPWSTR output, DWORD output_len, DWORD *result_len)
{
HRESULT hr;
DWORD len;
BSTR received;
hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_FRAGMENT, &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_GetFragment(uri, &received);
if(FAILED(hr)) {
*result_len = 0;
return hr;
}
memcpy(output, received, (len+1)*sizeof(WCHAR));
SysFreeString(received);
return S_OK;
}
/***********************************************************************
* CoInternetParseIUri (urlmon.@)
*/
......@@ -6541,6 +6569,10 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d
case PARSE_DOMAIN:
hr = parse_domain(pIUri, pwzResult, cchResult, pcchResult);
break;
case PARSE_LOCATION:
case PARSE_ANCHOR:
hr = parse_anchor(pIUri, pwzResult, cchResult, pcchResult);
break;
case PARSE_SECURITY_URL:
case PARSE_MIME:
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