From 9cbcbe8da69698b01b4e276715f8f8f317cb07f6 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 9 Feb 2012 15:16:38 +0100 Subject: [PATCH] urlmon: Properly handle combining relative mk: URIs containing full internal path. --- dlls/urlmon/uri.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index 2710c7c064f..3d6bf8b3f3d 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -6389,13 +6389,25 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len, WCHAR *ptr; if(base_len) { - /* Find the characters that will be copied over from - * the base path. - */ - end = memrchrW(base, '/', base_len); - if(!end && data->scheme_type == URL_SCHEME_FILE) - /* Try looking for a '\\'. */ - end = memrchrW(base, '\\', base_len); + if(data->scheme_type == URL_SCHEME_MK && *relative == '/') { + /* Find '::' segment */ + for(end = base; end < base+base_len-1; end++) { + if(end[0] == ':' && end[1] == ':') { + end++; + break; + } + } + + /* If not found, try finding the end of @xxx: */ + if(end == base+base_len-1) + end = *base == '@' ? memchr(base, ':', base_len) : NULL; + }else { + /* Find the characters that will be copied over from the base path. */ + end = memrchrW(base, '/', base_len); + if(!end && data->scheme_type == URL_SCHEME_FILE) + /* Try looking for a '\\'. */ + end = memrchrW(base, '\\', base_len); + } } if(end) { @@ -6420,6 +6432,7 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len, *ptr = '\0'; *result_len = (ptr-*result); + TRACE("ret %s\n", debugstr_wn(*result, *result_len)); return S_OK; } @@ -6541,7 +6554,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, * relative path doesn't begin with a '/' then the base path and relative * path are merged together. */ - if(relative->path_len && *(relative->canon_uri+relative->path_start) == '/') { + if(relative->path_len && *(relative->canon_uri+relative->path_start) == '/' && data.scheme_type != URL_SCHEME_MK) { WCHAR *tmp = NULL; BOOL copy_drive_path = FALSE;