Commit 6a459d11 authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Implemented PARSE_DOCUMENT for CoInternetParseIUri.

parent 81c274a5
...@@ -5933,7 +5933,15 @@ static const uri_parse_test uri_parse_tests[] = { ...@@ -5933,7 +5933,15 @@ static const uri_parse_test uri_parse_tests[] = {
{"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE}, {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
{"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE}, {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
{"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE}, {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
{"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE} {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
/* PARSE_DOCUMENT tests. */
{"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
{"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
{"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
{"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
{"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
{"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE}
}; };
static inline LPWSTR a2w(LPCSTR str) { static inline LPWSTR a2w(LPCSTR str) {
......
...@@ -6265,6 +6265,39 @@ static HRESULT parse_rootdocument(const Uri *uri, LPWSTR output, DWORD output_le ...@@ -6265,6 +6265,39 @@ static HRESULT parse_rootdocument(const Uri *uri, LPWSTR output, DWORD output_le
return S_OK; return S_OK;
} }
static HRESULT parse_document(const Uri *uri, LPWSTR output, DWORD output_len,
DWORD *result_len)
{
DWORD len = 0;
/* It has to be a known scheme type, but, it can't be a file
* scheme. It also has to hierarchical.
*/
if(uri->scheme_type == URL_SCHEME_UNKNOWN ||
uri->scheme_type == URL_SCHEME_FILE ||
uri->authority_start == -1) {
*result_len = 0;
if(output_len < 1)
return STRSAFE_E_INSUFFICIENT_BUFFER;
output[0] = 0;
return S_OK;
}
if(uri->fragment_start > -1)
len = uri->fragment_start;
else
len = uri->canon_len;
*result_len = len;
if(len+1 > output_len)
return STRSAFE_E_INSUFFICIENT_BUFFER;
memcpy(output, uri->canon_uri, len*sizeof(WCHAR));
output[len] = 0;
return S_OK;
}
/*********************************************************************** /***********************************************************************
* CoInternetParseIUri (urlmon.@) * CoInternetParseIUri (urlmon.@)
*/ */
...@@ -6308,6 +6341,15 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d ...@@ -6308,6 +6341,15 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d
} }
hr = parse_rootdocument(uri, pwzResult, cchResult, pcchResult); hr = parse_rootdocument(uri, pwzResult, cchResult, pcchResult);
break; break;
case PARSE_DOCUMENT:
if(!(uri = get_uri_obj(pIUri))) {
*pcchResult = 0;
FIXME("(%p %d %x %p %d %p %x) Unknown IUri's not supported for this action.\n",
pIUri, ParseAction, dwFlags, pwzResult, cchResult, pcchResult, (DWORD)dwReserved);
return E_NOTIMPL;
}
hr = parse_document(uri, 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