From 79b7c1108e3a0c8626799a20492e6c1daecfd928 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 26 Mar 2013 11:34:12 +0100 Subject: [PATCH] urlmon: Fixed handling URIs with implicit file scheme in CoInternetCombineUrlEx. --- dlls/urlmon/tests/uri.c | 80 +++++++++++++++++++++++++++++++++++++++++ dlls/urlmon/uri.c | 4 +-- 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index bc6d1be2728..e5faa815385 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -360,6 +360,31 @@ static const uri_properties uri_tests[] = { {URLZONE_INVALID,E_NOTIMPL,FALSE} } }, + { "file:///z:/test dir/README.txt", 0, S_OK, FALSE, + { + {"file:///z:/test%20dir/README.txt",S_OK}, + {"",S_FALSE}, + {"file:///z:/test%20dir/README.txt",S_OK}, + {"",S_FALSE}, + {".txt",S_OK}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"/z:/test%20dir/README.txt",S_OK}, + {"/z:/test%20dir/README.txt",S_OK}, + {"",S_FALSE}, + {"file:///z:/test dir/README.txt",S_OK}, + {"file",S_OK}, + {"",S_FALSE}, + {"",S_FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, { "urn:nothing:should:happen here", 0, S_OK, FALSE, { {"urn:nothing:should:happen here",S_OK,FALSE}, @@ -6926,7 +6951,62 @@ static const uri_combine_test uri_combine_tests[] = { {URL_SCHEME_HTTP,S_OK}, {URLZONE_INVALID,E_NOTIMPL} } + }, + { "http://google.com/test",0, + "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, + 0,S_OK,FALSE, + { + {"file:///c:/test/",S_OK}, + {"",S_FALSE}, + {"file:///c:/test/",S_OK}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"/c:/test/",S_OK}, + {"/c:/test/",S_OK}, + {"",S_FALSE}, + {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"}, + {"file",S_OK}, + {"",S_FALSE}, + {"",S_FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK}, + {0,S_FALSE}, + {URL_SCHEME_FILE,S_OK}, + {URLZONE_INVALID,E_NOTIMPL} + } + }, + { "http://google.com/test",0, + "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, + 0,S_OK,FALSE, + { + {"file:///c:/test/",S_OK}, + {"",S_FALSE}, + {"file:///c:/test/",S_OK}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"/c:/test/",S_OK}, + {"/c:/test/",S_OK}, + {"",S_FALSE}, + {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"}, + {"file",S_OK}, + {"",S_FALSE}, + {"",S_FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK}, + {0,S_FALSE}, + {URL_SCHEME_FILE,S_OK}, + {URLZONE_INVALID,E_NOTIMPL} + } } + }; typedef struct _uri_parse_test { diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index 42cfe714d36..0f6ee31fa0e 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -6461,7 +6461,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, return E_OUTOFMEMORY; } - parse_uri(&data, 0); + parse_uri(&data, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME); hr = Uri_Construct(NULL, (void**)&ret); if(FAILED(hr)) { @@ -6800,7 +6800,7 @@ HRESULT WINAPI CoInternetCombineUrlEx(IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DW } } - hr = CreateUri(pwzRelativeUrl, Uri_CREATE_ALLOW_RELATIVE, 0, &relative); + hr = CreateUri(pwzRelativeUrl, Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, &relative); if(FAILED(hr)) { *ppCombinedUri = NULL; return hr;