Module: wine Branch: master Commit: 3efe4e68379c29714fd40340db3c9bec00ab4568 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3efe4e68379c29714fd40340db...
Author: Jacek Caban jacek@codeweavers.com Date: Sat May 10 14:20:43 2008 +0200
urlmon: Correctly handle file URLs with '|' instead of ':' after drive letter.
---
dlls/urlmon/file.c | 3 +++ dlls/urlmon/tests/protocol.c | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/urlmon/file.c b/dlls/urlmon/file.c index b3691b0..5c059d1 100644 --- a/dlls/urlmon/file.c +++ b/dlls/urlmon/file.c @@ -154,6 +154,9 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl } }
+ if(file_name[1] == '|') + file_name[1] = ':'; + This->file = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index c21134b..60d0ae8 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -27,6 +27,7 @@ #include "winbase.h" #include "ole2.h" #include "urlmon.h" +#include "wininet.h"
#include "initguid.h"
@@ -1387,7 +1388,7 @@ static void test_file_protocol_fail(void) }
static void test_file_protocol(void) { - WCHAR buf[MAX_PATH]; + WCHAR buf[INTERNET_MAX_URL_LENGTH], file_name_buf[MAX_PATH]; DWORD size; ULONG len; HANDLE file; @@ -1429,17 +1430,19 @@ static void test_file_protocol(void) { test_file_protocol_url(buf);
memcpy(buf, wszFile2, sizeof(wszFile2)); - len = sizeof(wszFile2)/sizeof(WCHAR)-1; - len += GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR)-len, buf+len); - buf[len++] = '\'; - memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - - file_name = buf + sizeof(wszFile2)/sizeof(WCHAR)-1; + len = GetCurrentDirectoryW(sizeof(file_name_buf)/sizeof(WCHAR), file_name_buf); + file_name_buf[len++] = '\'; + memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml)); + lstrcpyW(buf+sizeof(wszFile2)/sizeof(WCHAR)-1, file_name_buf); + file_name = file_name_buf; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf);
+ buf[sizeof(wszFile2)/sizeof(WCHAR)] = '|'; + test_file_protocol_url(buf); + memcpy(buf, wszFile3, sizeof(wszFile3)); len = sizeof(wszFile3)/sizeof(WCHAR)-1; len += GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR)-len, buf+len);