Alistair Leslie-Hughes : urlmon: Strip forward and back slashes when using the file: protocol.

Alexandre Julliard julliard at winehq.org
Tue Apr 20 11:32:23 CDT 2010


Module: wine
Branch: master
Commit: c79c84947955deb56b6b73f2c54002364a9b6ed7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c79c84947955deb56b6b73f2c54002364a9b6ed7

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Tue Apr 20 21:31:29 2010 +1000

urlmon: Strip forward and back slashes when using the file: protocol.

---

 dlls/urlmon/file.c           |    5 ++++-
 dlls/urlmon/tests/protocol.c |   15 +++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/dlls/urlmon/file.c b/dlls/urlmon/file.c
index ed4802b..a517d94 100644
--- a/dlls/urlmon/file.c
+++ b/dlls/urlmon/file.c
@@ -141,7 +141,10 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
         IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
 
         file_name = url+sizeof(wszFile)/sizeof(WCHAR);
-        if(file_name[0] == '/' && file_name[1] == '/')
+
+        /* Strip both forward and back slashes */
+        if( (file_name[0] == '/' && file_name[1] == '/') ||
+            (file_name[0] == '\\' && file_name[1] == '\\'))
             file_name += 2;
         if(*file_name == '/')
             file_name++;
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index d54d00d..ba0c32c 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -2241,6 +2241,7 @@ static void test_file_protocol(void) {
     static const WCHAR wszFile[] = {'f','i','l','e',':',0};
     static const WCHAR wszFile2[] = {'f','i','l','e',':','/','/',0};
     static const WCHAR wszFile3[] = {'f','i','l','e',':','/','/','/',0};
+    static const WCHAR wszFile4[] = {'f','i','l','e',':','\\','\\',0};
     static const char html_doc[] = "<HTML></HTML>";
 
     trace("Testing file protocol...\n");
@@ -2306,6 +2307,20 @@ static void test_file_protocol(void) {
     bindf = BINDF_FROMURLMON;
     test_file_protocol_url(buf);
 
+    memcpy(buf, wszFile4, sizeof(wszFile4));
+    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(wszFile4)/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(wszFile4)/sizeof(WCHAR)] = '|';
+    test_file_protocol_url(buf);
+
     DeleteFileW(wszIndexHtml);
 
     bindf = 0;




More information about the wine-cvs mailing list