Commit 40bf7410 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Implement IWinHttpRequest::SetAutoLogonPolicy.

parent e5b8c497
......@@ -2174,6 +2174,7 @@ struct winhttp_request
DWORD bytes_available;
DWORD bytes_read;
DWORD error;
DWORD logon_policy;
LONG resolve_timeout;
LONG connect_timeout;
LONG send_timeout;
......@@ -2845,6 +2846,11 @@ static HRESULT request_send( struct winhttp_request *request )
{
return HRESULT_FROM_WIN32( get_last_error() );
}
if (!WinHttpSetOption( request->hrequest, WINHTTP_OPTION_AUTOLOGON_POLICY, &request->logon_policy,
sizeof(request->logon_policy) ))
{
return HRESULT_FROM_WIN32( get_last_error() );
}
if (!WinHttpSetTimeouts( request->hrequest,
request->resolve_timeout,
request->connect_timeout,
......@@ -3241,8 +3247,28 @@ static HRESULT WINAPI winhttp_request_SetAutoLogonPolicy(
IWinHttpRequest *iface,
WinHttpRequestAutoLogonPolicy policy )
{
FIXME("\n");
return E_NOTIMPL;
struct winhttp_request *request = impl_from_IWinHttpRequest( iface );
HRESULT hr = S_OK;
TRACE("%p, %u\n", request, policy );
EnterCriticalSection( &request->cs );
switch (policy)
{
case AutoLogonPolicy_Always:
request->logon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW;
break;
case AutoLogonPolicy_OnlyIfBypassProxy:
request->logon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM;
break;
case AutoLogonPolicy_Never:
request->logon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH;
break;
default: hr = E_INVALIDARG;
break;
}
LeaveCriticalSection( &request->cs );
return hr;
}
static const struct IWinHttpRequestVtbl winhttp_request_vtbl =
......
......@@ -2265,6 +2265,12 @@ static void test_IWinHttpRequest(void)
hr = IWinHttpRequest_SetRequestHeader( req, date, today );
ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN ), "got %08x\n", hr );
hr = IWinHttpRequest_SetAutoLogonPolicy( req, 0xdeadbeef );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = IWinHttpRequest_SetAutoLogonPolicy( req, AutoLogonPolicy_OnlyIfBypassProxy );
ok( hr == S_OK, "got %08x\n", hr );
SysFreeString( method );
method = SysAllocString( method1W );
SysFreeString( url );
......@@ -2335,6 +2341,9 @@ static void test_IWinHttpRequest(void)
hr = IWinHttpRequest_SetRequestHeader( req, date, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = IWinHttpRequest_SetAutoLogonPolicy( req, AutoLogonPolicy_OnlyIfBypassProxy );
ok( hr == S_OK, "got %08x\n", hr );
hr = IWinHttpRequest_Send( req, empty );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -2396,6 +2405,9 @@ static void test_IWinHttpRequest(void)
hr = IWinHttpRequest_SetRequestHeader( req, date, today );
ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND ), "got %08x\n", hr );
hr = IWinHttpRequest_SetAutoLogonPolicy( req, AutoLogonPolicy_OnlyIfBypassProxy );
ok( hr == S_OK, "got %08x\n", hr );
VariantInit( &timeout );
V_VT( &timeout ) = VT_I4;
V_I4( &timeout ) = 10;
......@@ -2457,6 +2469,9 @@ static void test_IWinHttpRequest(void)
hr = IWinHttpRequest_SetRequestHeader( req, date, today );
ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND ), "got %08x\n", hr );
hr = IWinHttpRequest_SetAutoLogonPolicy( req, AutoLogonPolicy_OnlyIfBypassProxy );
ok( hr == S_OK, "got %08x\n", hr );
hr = IWinHttpRequest_Send( req, empty );
ok( hr == S_OK, "got %08x\n", hr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment