Hans Leidekker : winhttp: Option WINHTTP_OPTION_SERVER_CERT_CONTEXT must return a pointer.

Alexandre Julliard julliard at winehq.org
Tue Sep 9 05:50:23 CDT 2008


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Sep  8 22:01:39 2008 +0200

winhttp: Option WINHTTP_OPTION_SERVER_CERT_CONTEXT must return a pointer.

---

 dlls/winhttp/session.c       |    2 +-
 dlls/winhttp/tests/winhttp.c |   12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 4e22896..927c347 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -271,7 +271,7 @@ static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buf
         request_t *request = (request_t *)hdr;
 
         if (!(cert = netconn_get_certificate( &request->netconn ))) return FALSE;
-        memcpy( buffer, cert, sizeof(CERT_CONTEXT) );
+        *(CERT_CONTEXT **)buffer = (CERT_CONTEXT *)cert;
         *buflen = sizeof(cert);
         return TRUE;
     }
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 71e4efa..7914805 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -23,6 +23,7 @@
 #include <windef.h>
 #include <winbase.h>
 #include <winhttp.h>
+#include <wincrypt.h>
 
 #include "wine/test.h"
 
@@ -556,8 +557,9 @@ static void test_secure_connection(void)
     static const WCHAR google[] = {'w','w','w','.','g','o','o','g','l','e','.','c','o','m',0};
 
     HANDLE ses, con, req;
-    DWORD size, status, policy;
+    DWORD size, status, policy, bitness;
     BOOL ret;
+    CERT_CONTEXT *cert;
 
     ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
     ok(ses != NULL, "failed to open session %u\n", GetLastError());
@@ -591,6 +593,14 @@ static void test_secure_connection(void)
     ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
     ok(ret, "failed to send request %u\n", GetLastError());
 
+    size = sizeof(cert);
+    ret = WinHttpQueryOption(req, WINHTTP_OPTION_SERVER_CERT_CONTEXT, &cert, &size );
+    ok(ret, "failed to retrieve certificate context %u\n", GetLastError());
+
+    size = sizeof(bitness);
+    ret = WinHttpQueryOption(req, WINHTTP_OPTION_SECURITY_KEY_BITNESS, &bitness, &size );
+    ok(ret, "failed to retrieve key bitness %u\n", GetLastError());
+
     ret = WinHttpReceiveResponse(req, NULL);
     ok(ret, "failed to receive response %u\n", GetLastError());
 




More information about the wine-cvs mailing list