diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index b135c109db7..9ec7288af27 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -5956,7 +5956,11 @@ static const uri_parse_test uri_parse_tests[] = { {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE}, {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE}, {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE}, - {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE} + {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE}, + + /* PARSE_SCHEMA tests. */ + {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE}, + {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE} }; static inline LPWSTR a2w(LPCSTR str) { diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index e409ebcd129..04cffb1b678 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -6385,6 +6385,35 @@ static HRESULT parse_url_from_path(IUri *uri, LPWSTR output, DWORD output_len, return S_OK; } +static HRESULT parse_schema(IUri *uri, LPWSTR output, DWORD output_len, + DWORD *result_len) +{ + HRESULT hr; + DWORD len; + BSTR received; + + hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_SCHEME_NAME, &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_GetSchemeName(uri, &received); + if(FAILED(hr)) { + *result_len = 0; + return hr; + } + + memcpy(output, received, (len+1)*sizeof(WCHAR)); + SysFreeString(received); + + return S_OK; +} + /*********************************************************************** * CoInternetParseIUri (urlmon.@) */ @@ -6449,6 +6478,9 @@ HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD d case PARSE_URL_FROM_PATH: hr = parse_url_from_path(pIUri, pwzResult, cchResult, pcchResult); break; + case PARSE_SCHEMA: + hr = parse_schema(pIUri, pwzResult, cchResult, pcchResult); + break; case PARSE_SECURITY_URL: case PARSE_MIME: case PARSE_SERVER: