Jacek Caban : mshtml: Return size in about protocols handler's ParseUrl( PARSE_SECURITY_URL) call.

Alexandre Julliard julliard at winehq.org
Tue Feb 8 17:23:48 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Feb  8 15:09:24 2011 +0100

mshtml: Return size in about protocols handler's ParseUrl(PARSE_SECURITY_URL) call.

---

 dlls/mshtml/protocol.c       |    9 +++++----
 dlls/mshtml/tests/protocol.c |    3 +++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c
index f0325bf..79bcf2d 100644
--- a/dlls/mshtml/protocol.c
+++ b/dlls/mshtml/protocol.c
@@ -404,16 +404,17 @@ static HRESULT WINAPI AboutProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, L
         PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
         DWORD* pcchResult, DWORD dwReserved)
 {
-    TRACE("%p)->(%s %08x %08x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), ParseAction,
+    TRACE("%p)->(%s %d %08x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), ParseAction,
             dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
 
     if(ParseAction == PARSE_SECURITY_URL) {
-        unsigned int len = strlenW(pwzUrl);
+        unsigned int len = strlenW(pwzUrl)+1;
 
-        if(len >= cchResult)
+        *pcchResult = len;
+        if(len > cchResult)
             return S_FALSE;
 
-        memcpy(pwzResult, pwzUrl, (len+1)*sizeof(WCHAR));
+        memcpy(pwzResult, pwzUrl, len*sizeof(WCHAR));
         return S_OK;
     }
 
diff --git a/dlls/mshtml/tests/protocol.c b/dlls/mshtml/tests/protocol.c
index 1369ff7..9e6fe1a 100644
--- a/dlls/mshtml/tests/protocol.c
+++ b/dlls/mshtml/tests/protocol.c
@@ -656,14 +656,17 @@ static void test_about_protocol(void)
         ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
         ok(!lstrcmpW(about_blank_url, buf), "buf != blank_url\n");
 
+        size = 0xdeadbeef;
         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_SECURITY_URL, 0, buf,
                 3, &size, 0);
         ok(hres == S_FALSE, "ParseUrl failed: %08x, expected S_FALSE\n", hres);
+        ok(size == 12, "size = %d\n", size);
 
         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_test_url, PARSE_SECURITY_URL, 0, buf,
                 sizeof(buf)/sizeof(buf[0]), &size, 0);
         ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
         ok(!lstrcmpW(about_test_url, buf), "buf != test_url\n");
+        ok(size == 11, "size = %d\n", size);
 
         size = 0xdeadbeef;
         buf[0] = '?';




More information about the wine-cvs mailing list