Hans Leidekker : winhttp: Convert the async parameter to VT_BOOL if necessary in IWinHttpRequest:: Open.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 9 15:35:50 CST 2014


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Dec  9 12:47:00 2014 +0100

winhttp: Convert the async parameter to VT_BOOL if necessary in IWinHttpRequest::Open.

---

 dlls/winhttp/request.c       |  2 +-
 dlls/winhttp/tests/winhttp.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 75a229d..04e71d9 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -2993,7 +2993,7 @@ static HRESULT WINAPI winhttp_request_Open(
     path[uc.dwUrlPathLength + uc.dwExtraInfoLength] = 0;
 
     if (!(verb = strdupW( method ))) goto error;
-    if (V_VT( &async ) == VT_BOOL && V_BOOL( &async )) flags |= WINHTTP_FLAG_ASYNC;
+    if (SUCCEEDED( VariantChangeType( &async, &async, 0, VT_BOOL )) && V_BOOL( &async )) flags |= WINHTTP_FLAG_ASYNC;
     if (!(hsession = WinHttpOpen( user_agentW, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, NULL, NULL, flags )))
     {
         err = get_last_error();
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index eda83e4..8a863cb 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -2870,6 +2870,23 @@ static void test_IWinHttpRequest(void)
     hr = IWinHttpRequest_Release( req );
     ok( hr == S_OK, "got %08x\n", hr );
 
+    hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER, &IID_IWinHttpRequest, (void **)&req );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    V_VT( &async ) = VT_I4;
+    V_I4( &async ) = 1;
+    hr = IWinHttpRequest_Open( req, method, url, async );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    hr = IWinHttpRequest_Send( req, empty );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    hr = IWinHttpRequest_WaitForResponse( req, timeout, &succeeded );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    hr = IWinHttpRequest_Release( req );
+    ok( hr == S_OK, "got %08x\n", hr );
+
     SysFreeString( method );
     SysFreeString( url );
     SysFreeString( username );




More information about the wine-cvs mailing list