winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
January 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
726 discussions
Start a n
N
ew thread
Alexandre Julliard : include: Add casts to avoid printf format warnings with 'long' types.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: c8c96e89704829828e05667366b5f446b874e788 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c8c96e89704829828e056673…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jan 27 17:53:39 2022 +0100 include: Add casts to avoid printf format warnings with 'long' types. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/test.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/wine/test.h b/include/wine/test.h index 8073071d262..599234b3519 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -545,7 +545,7 @@ void winetest_wait_child_process( HANDLE process ) winetest_ok( 0, "Timed out waiting for the child process\n" ); else if (ret != WAIT_OBJECT_0) winetest_ok( 0, "Could not wait for the child process: %d le=%u\n", - ret, GetLastError() ); + (UINT)ret, (UINT)GetLastError() ); else { DWORD exit_code; @@ -553,12 +553,12 @@ void winetest_wait_child_process( HANDLE process ) if (exit_code > 255) { DWORD pid = GetProcessId( process ); - winetest_printf( "unhandled exception %08x in child process %04x\n", exit_code, pid ); + winetest_printf( "unhandled exception %08x in child process %04x\n", (UINT)exit_code, (UINT)pid ); InterlockedIncrement( &failures ); } else if (exit_code) { - winetest_printf( "%u failures in child process\n", exit_code ); + winetest_printf( "%u failures in child process\n", (UINT)exit_code ); while (exit_code-- > 0) InterlockedIncrement(&failures); } @@ -615,14 +615,14 @@ static int run_test( const char *name ) { if (muted_todo_successes || muted_skipped || muted_traces) printf( "%04x:%s:%s Silenced %d todos, %d skips and %d traces.\n", - GetCurrentProcessId(), test->name, winetest_elapsed(), - muted_todo_successes, muted_skipped, muted_traces); + (UINT)GetCurrentProcessId(), test->name, winetest_elapsed(), + (UINT)muted_todo_successes, (UINT)muted_skipped, (UINT)muted_traces); printf( "%04x:%s:%s %d tests executed (%d marked as todo, %d %s), %d skipped.\n", - GetCurrentProcessId(), test->name, winetest_elapsed(), - successes + failures + todo_successes + todo_failures, - todo_successes, failures + todo_failures, + (UINT)GetCurrentProcessId(), test->name, winetest_elapsed(), + (UINT)(successes + failures + todo_successes + todo_failures), + (UINT)todo_successes, (UINT)(failures + todo_failures), (failures + todo_failures != 1) ? "failures" : "failure", - skipped ); + (UINT)skipped ); } status = (failures + todo_failures < 255) ? failures + todo_failures : 255; return status; @@ -646,8 +646,8 @@ static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs ) printf( "%s:%d: this is the last test seen before the exception\n", data->current_file, data->current_line ); printf( "%04x:%s:%s unhandled exception %08x at %p\n", - GetCurrentProcessId(), current_test->name, winetest_elapsed(), - ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress ); + (UINT)GetCurrentProcessId(), current_test->name, winetest_elapsed(), + (UINT)ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress ); fflush( stdout ); return EXCEPTION_EXECUTE_HANDLER; }
1
0
0
0
Alexandre Julliard : include: Use long type by default in GUID definition.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: ae2693e2c4079edcc719c08abed5ad58ba7aace7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ae2693e2c4079edcc719c08a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jan 27 11:15:55 2022 +0100 include: Use long type by default in GUID definition. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dxof/parsing.c | 2 +- dlls/dispex/tests/marshal.c | 2 +- dlls/iphlpapi/tests/iphlpapi.c | 2 +- dlls/mountmgr.sys/dbus.c | 2 +- dlls/ole32/storage32.c | 2 +- dlls/ole32/tests/compobj.c | 18 +++++++++--------- dlls/oleaut32/tests/typelib.c | 14 +++++++------- dlls/urlmon/tests/misc.c | 8 ++++---- dlls/win32u/sysparams.c | 2 +- include/guiddef.h | 2 +- programs/winedbg/memory.c | 2 +- tools/winedump/dump.c | 2 +- tools/winedump/tlb.c | 2 +- 13 files changed, 30 insertions(+), 30 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=ae2693e2c4079edcc719…
1
0
0
0
Michael Stefaniuc : dmusic/tests: Add some initial synth port tests.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: b89eaba0036582d61f7863d4a5ba0d6ff45be900 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b89eaba0036582d61f7863d4…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Thu Jan 27 08:51:26 2022 +0100 dmusic/tests: Add some initial synth port tests. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dmusic/tests/dmusic.c | 96 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 15 deletions(-) diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index cf648228a43..f6b817cca60 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -498,31 +498,40 @@ static BOOL missing_dmusic(void) return TRUE; } -static void test_COM_synthport(void) +static IDirectMusicPort *create_synth_port(IDirectMusic **dmusic) { - IDirectMusic *dmusic = NULL; IDirectMusicPort *port = NULL; + DMUS_PORTPARAMS params; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic, (void **)dmusic); + ok(hr == S_OK, "Cannot create DirectMusic object: %#x\n", hr); + + params.dwSize = sizeof(params); + params.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS | DMUS_PORTPARAMS_AUDIOCHANNELS; + params.dwChannelGroups = 1; + params.dwAudioChannels = 2; + hr = IDirectMusic_SetDirectSound(*dmusic, NULL, NULL); + ok(hr == S_OK, "IDirectMusic_SetDirectSound failed: %#x\n", hr); + hr = IDirectMusic_CreatePort(*dmusic, &GUID_NULL, ¶ms, &port, NULL); + ok(hr == S_OK, "IDirectMusic_CreatePort failed: %#x\n", hr); + + return port; +} + +static void test_COM_synthport(void) +{ + IDirectMusic *dmusic; + IDirectMusicPort *port; IDirectMusicPortDownload *dmpd; IDirectMusicThru *dmt; IKsControl *iksc; IReferenceClock *clock; IUnknown *unk; - DMUS_PORTPARAMS port_params; ULONG refcount; HRESULT hr; - /* Create a IDirectMusicPort */ - hr = CoCreateInstance(&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic, - (void**)&dmusic); - ok(hr == S_OK, "Cannot create DirectMusic object (%x)\n", hr); - port_params.dwSize = sizeof(port_params); - port_params.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS | DMUS_PORTPARAMS_AUDIOCHANNELS; - port_params.dwChannelGroups = 1; - port_params.dwAudioChannels = 2; - hr = IDirectMusic_SetDirectSound(dmusic, NULL, NULL); - ok(hr == S_OK, "IDirectMusic_SetDirectSound returned: %x\n", hr); - hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, &port, NULL); - ok(hr == S_OK, "IDirectMusic_CreatePort returned: %x\n", hr); + port = create_synth_port(&dmusic); /* Same refcount for all DirectMusicPort interfaces */ refcount = IDirectMusicPort_AddRef(port); @@ -861,6 +870,62 @@ static void test_master_clock(void) ok(!ref, "Got outstanding refcount %d.\n", ref); } +static void test_synthport(void) +{ + IDirectMusic *dmusic; + IDirectMusicBuffer *buf; + IDirectMusicPort *port; + DMUS_BUFFERDESC desc; + DMUS_PORTCAPS caps; + HRESULT hr; + + port = create_synth_port(&dmusic); + + /* Create a IDirectMusicPortBuffer */ + desc.dwSize = sizeof(DMUS_BUFFERDESC); + desc.dwFlags = 0; + desc.cbBuffer = 1023; + memcpy(&desc.guidBufferFormat, &GUID_NULL, sizeof(GUID)); + hr = IDirectMusic_CreateMusicBuffer(dmusic, &desc, &buf, NULL); + ok(hr == S_OK, "IDirectMusic_CreateMusicBuffer failed: %#x\n", hr); + + /* Unsupported methods */ + hr = IDirectMusicPort_Read(port, NULL); + todo_wine ok(hr == E_POINTER, "Read returned: %#x\n", hr); + hr = IDirectMusicPort_Read(port, buf); + ok(hr == E_NOTIMPL, "Read returned: %#x\n", hr); + hr = IDirectMusicPort_SetReadNotificationHandle(port, NULL); + ok(hr == E_NOTIMPL, "SetReadNotificationHandle returned: %#x\n", hr); + hr = IDirectMusicPort_Compact(port); + ok(hr == E_NOTIMPL, "Compact returned: %#x\n", hr); + + /* GetCaps */ + hr = IDirectMusicPort_GetCaps(port, NULL); + ok(hr == E_INVALIDARG, "GetCaps failed: %#x\n", hr); + memset(&caps, 0, sizeof(caps)); + hr = IDirectMusicPort_GetCaps(port, &caps); + ok(hr == E_INVALIDARG, "GetCaps failed: %#x\n", hr); + caps.dwSize = sizeof(caps); + hr = IDirectMusicPort_GetCaps(port, &caps); + ok(hr == S_OK, "GetCaps failed: %#x\n", hr); + ok(caps.dwSize == sizeof(caps), "dwSize was modified to %d\n", caps.dwSize); + ok(IsEqualGUID(&caps.guidPort, &CLSID_DirectMusicSynth), "Expected port guid CLSID_DirectMusicSynth, got %s\n", + wine_dbgstr_guid(&caps.guidPort)); + ok(caps.dwClass == DMUS_PC_OUTPUTCLASS, "Got wrong dwClass: %#x\n", caps.dwClass); + ok(caps.dwType == DMUS_PORT_USER_MODE_SYNTH, "Got wrong dwType: %#x\n", caps.dwType); + ok(caps.dwFlags == (DMUS_PC_AUDIOPATH|DMUS_PC_DIRECTSOUND|DMUS_PC_DLS|DMUS_PC_DLS2|DMUS_PC_SOFTWARESYNTH| + DMUS_PC_WAVE), "Unexpected dwFlags returned: %#x\n", caps.dwFlags); + ok(caps.dwMemorySize == DMUS_PC_SYSTEMMEMORY, "Got dwMemorySize: %#x\n", caps.dwMemorySize); + ok(caps.dwMaxChannelGroups == 1000, "Got dwMaxChannelGroups: %d\n", caps.dwMaxChannelGroups); + ok(caps.dwMaxVoices == 1000, "Got dwMaxVoices: %d\n", caps.dwMaxVoices); + ok(caps.dwMaxAudioChannels == 2, "Got dwMaxAudioChannels: %#x\n", caps.dwMaxAudioChannels); + ok(caps.dwEffectFlags == DMUS_EFFECT_REVERB, "Unexpected dwEffectFlags returned: %#x\n", caps.dwEffectFlags); + trace("Port wszDescription: %s\n", wine_dbgstr_w(caps.wszDescription)); + + IDirectMusicPort_Release(port); + IDirectMusic_Release(dmusic); +} + START_TEST(dmusic) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -880,6 +945,7 @@ START_TEST(dmusic) test_dmcoll(); test_parsedescriptor(); test_master_clock(); + test_synthport(); CoUninitialize(); }
1
0
0
0
Connor McAdams : secur32/tests: Add tests for DTLS handshake retransmission.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: 26f81bb883194d47747f71154d07aaad09a99d56 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=26f81bb883194d47747f7115…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Thu Jan 27 11:11:30 2022 +0100 secur32/tests: Add tests for DTLS handshake retransmission. Successive calls to InitializeSecurityContext without a new pInput buffer will result in retransmission, creating a handshake packet with an incremented sequence number value, but otherwise identical to the last call to InitializeSecurityContext. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/secur32/tests/schannel.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index 902a490a296..abddfa138ab 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -1623,6 +1623,7 @@ static void test_dtls(void) CtxtHandle ctx_handle, ctx_handle2; SecBufferDesc buffers[3]; ULONG flags_req, flags_ret, attr, prev_buf_len; + char *buf, *buf2; init_cred( &cred ); cred.grbitEnabledProtocols = SP_PROT_DTLS_CLIENT | SP_PROT_DTLS1_2_CLIENT; @@ -1663,6 +1664,9 @@ static void test_dtls(void) ok( buffers[1].pBuffers[1].BufferType == SECBUFFER_ALERT, "Expected buffertype SECBUFFER_ALERT, got %#x\n", buffers[1].pBuffers[1].BufferType); ok( !buffers[1].pBuffers[1].cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty, got %#x\n", buffers[1].pBuffers[1].cbBuffer); prev_buf_len = buffers[1].pBuffers[0].cbBuffer; + buf = HeapAlloc( GetProcessHeap(), 0, prev_buf_len ); + memcpy( buf, buffers[1].pBuffers[0].pvBuffer, prev_buf_len ); + ok( buf[10] == 0, "Expected initial packet to have sequence number value of 0, got %d\n", buf[10]); /* * If we don't set the SECBUFFER_ALERT cbBuffer value, we will get @@ -1709,7 +1713,17 @@ static void test_dtls(void) ok(buffers[1].pBuffers[0].cbBuffer == prev_buf_len, "Output buffer size mismatch, expected %#x, got %#x\n", prev_buf_len, buffers[1].pBuffers[0].cbBuffer); + /* + * The retransmission packet and the original packet should only differ in + * their sequence number value. + */ + buf2 = (char *)buffers[1].pBuffers[0].pvBuffer; + ok( buf2[10] == 1, "Expected retransmitted packet to have sequence number value of 1, got %d\n", buf2[10]); + ok( !memcmp(buf2, buf, 9), "Lower portion mismatch between retransmitted packet and original packet\n"); + ok( !memcmp(buf2 + 11, buf + 11, prev_buf_len - 11), "Upper portion mismatch between retransmitted packet and original packet\n"); + free_buffers( &buffers[0] ); + HeapFree(GetProcessHeap(), 0, buf); HeapFree(GetProcessHeap(), 0, buffers[1].pBuffers[1].pvBuffer); free_buffers( &buffers[1] ); DeleteSecurityContext( &ctx_handle );
1
0
0
0
Connor McAdams : secur32: Switch back to non-blocking mode for DTLS sessions.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: 387a30a8ce86d782d194ea1ec63dc0b41db9cf8b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=387a30a8ce86d782d194ea1e…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Thu Jan 27 11:11:29 2022 +0100 secur32: Switch back to non-blocking mode for DTLS sessions. In order for DTLS retransmission to occur properly, we need to be in non-blocking mode. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/secur32/schannel_gnutls.c | 7 +++---- dlls/secur32/tests/schannel.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c index ac51cbb5d9f..3f947870a73 100644 --- a/dlls/secur32/schannel_gnutls.c +++ b/dlls/secur32/schannel_gnutls.c @@ -461,14 +461,13 @@ static NTSTATUS schan_get_enabled_protocols( void *args ) static int pull_timeout(gnutls_transport_ptr_t transport, unsigned int timeout) { struct schan_transport *t = (struct schan_transport*)transport; - gnutls_session_t s = (gnutls_session_t)t->session; SIZE_T count = 0; TRACE("\n"); if (get_buffer(t, &t->in, &count)) return 1; - pgnutls_transport_set_errno(s, EAGAIN); - return -1; + + return 0; } static NTSTATUS schan_create_session( void *args ) @@ -483,7 +482,7 @@ static NTSTATUS schan_create_session( void *args ) if (cred->enabled_protocols & (SP_PROT_DTLS1_0_CLIENT | SP_PROT_DTLS1_2_CLIENT)) { - flags |= GNUTLS_DATAGRAM; + flags |= GNUTLS_DATAGRAM | GNUTLS_NONBLOCK; } err = pgnutls_init(s, flags); diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index afcc382927a..902a490a296 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -1706,7 +1706,7 @@ static void test_dtls(void) ok( ctx_handle.dwUpper == ctx_handle2.dwUpper, "dwUpper mismatch, expected %#lx, got %#lx\n", ctx_handle.dwUpper, ctx_handle2.dwUpper); /* With no new input buffer, output buffer length should match prior call. */ - todo_wine ok(buffers[1].pBuffers[0].cbBuffer == prev_buf_len, "Output buffer size mismatch, expected %#x, got %#x\n", + ok(buffers[1].pBuffers[0].cbBuffer == prev_buf_len, "Output buffer size mismatch, expected %#x, got %#x\n", prev_buf_len, buffers[1].pBuffers[0].cbBuffer); free_buffers( &buffers[0] );
1
0
0
0
Connor McAdams : secur32: Properly handle NULL pInput argument for DTLS contexts in schan_InitializeSecurityContextW.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: 290cd6769fc637d68129f7286f76cad7ef5bc622 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=290cd6769fc637d68129f728…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Thu Jan 27 11:11:28 2022 +0100 secur32: Properly handle NULL pInput argument for DTLS contexts in schan_InitializeSecurityContextW. When a NULL pInput argument is passed into InitializeSecurityContextW for an existing DTLS context, we need to retransmit the last handshake packet. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/secur32/schannel.c | 43 +++++++++++++++++++++++-------------------- dlls/secur32/tests/schannel.c | 10 +++++----- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index 71993e1d2d6..c4e01c1e2a7 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -704,7 +704,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( struct schan_context *ctx; struct schan_buffers *out_buffers; struct schan_credentials *cred; - SIZE_T expected_size = ~0UL; + SIZE_T expected_size = 0; SECURITY_STATUS ret; SecBuffer *buffer; SecBuffer alloc_buffer = { 0 }; @@ -823,30 +823,33 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( unsigned char *ptr; if (!(ctx = schan_get_object(phContext->dwLower, SCHAN_HANDLE_CTX))) return SEC_E_INVALID_HANDLE; - if (!pInput) return is_dtls_context(ctx) ? SEC_E_INSUFFICIENT_MEMORY : SEC_E_INCOMPLETE_MESSAGE; - if ((idx = schan_find_sec_buffer_idx(pInput, 0, SECBUFFER_TOKEN)) == -1) return SEC_E_INCOMPLETE_MESSAGE; + if (!pInput && !is_dtls_context(ctx)) return SEC_E_INCOMPLETE_MESSAGE; - buffer = &pInput->pBuffers[idx]; - ptr = buffer->pvBuffer; - expected_size = 0; - - while (buffer->cbBuffer > expected_size + ctx->header_size) + if (pInput) { - record_size = ctx->header_size + read_record_size(ptr, ctx->header_size); + if ((idx = schan_find_sec_buffer_idx(pInput, 0, SECBUFFER_TOKEN)) == -1) return SEC_E_INCOMPLETE_MESSAGE; - if (buffer->cbBuffer < expected_size + record_size) break; - expected_size += record_size; - ptr += record_size; - } + buffer = &pInput->pBuffers[idx]; + ptr = buffer->pvBuffer; - if (!expected_size) - { - TRACE("Expected at least %lu bytes, but buffer only contains %u bytes.\n", - max(ctx->header_size + 1, record_size), buffer->cbBuffer); - return SEC_E_INCOMPLETE_MESSAGE; - } + while (buffer->cbBuffer > expected_size + ctx->header_size) + { + record_size = ctx->header_size + read_record_size(ptr, ctx->header_size); - TRACE("Using expected_size %lu.\n", expected_size); + if (buffer->cbBuffer < expected_size + record_size) break; + expected_size += record_size; + ptr += record_size; + } + + if (!expected_size) + { + TRACE("Expected at least %lu bytes, but buffer only contains %u bytes.\n", + max(ctx->header_size + 1, record_size), buffer->cbBuffer); + return SEC_E_INCOMPLETE_MESSAGE; + } + + TRACE("Using expected_size %lu.\n", expected_size); + } if (phNewContext) *phNewContext = *phContext; } diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index 6fbe0c34bd1..afcc382927a 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -1693,17 +1693,17 @@ static void test_dtls(void) ctx_handle2.dwLower = ctx_handle2.dwUpper = 0xdeadbeef; status = InitializeSecurityContextA( &cred_handle, &ctx_handle, (SEC_CHAR *)"winetest", flags_req, 0, 16, NULL, 0, &ctx_handle2, &buffers[1], &attr, &exp ); - todo_wine ok( status == SEC_I_CONTINUE_NEEDED, "got %08x\n", status ); + ok( status == SEC_I_CONTINUE_NEEDED, "got %08x\n", status ); flags_ret = ISC_RET_MANUAL_CRED_VALIDATION | ISC_RET_STREAM | ISC_RET_EXTENDED_ERROR | ISC_RET_DATAGRAM | ISC_RET_USED_SUPPLIED_CREDS | ISC_RET_CONFIDENTIALITY | ISC_RET_SEQUENCE_DETECT | ISC_RET_REPLAY_DETECT; - todo_wine ok( attr == flags_ret, "got %08x\n", attr ); + ok( attr == flags_ret, "got %08x\n", attr ); todo_wine ok( exp.LowPart, "got %08x\n", exp.LowPart ); todo_wine ok( exp.HighPart, "got %08x\n", exp.HighPart ); ok( buffers[1].pBuffers[1].BufferType == SECBUFFER_ALERT, "Expected buffertype SECBUFFER_ALERT, got %#x\n", buffers[1].pBuffers[1].BufferType); - todo_wine ok( !buffers[1].pBuffers[1].cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty, got %#x\n", buffers[1].pBuffers[1].cbBuffer); - todo_wine ok( ctx_handle.dwLower == ctx_handle2.dwLower, "dwLower mismatch, expected %#lx, got %#lx\n", ctx_handle.dwLower, ctx_handle2.dwLower); - todo_wine ok( ctx_handle.dwUpper == ctx_handle2.dwUpper, "dwUpper mismatch, expected %#lx, got %#lx\n", ctx_handle.dwUpper, ctx_handle2.dwUpper); + ok( !buffers[1].pBuffers[1].cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty, got %#x\n", buffers[1].pBuffers[1].cbBuffer); + ok( ctx_handle.dwLower == ctx_handle2.dwLower, "dwLower mismatch, expected %#lx, got %#lx\n", ctx_handle.dwLower, ctx_handle2.dwLower); + ok( ctx_handle.dwUpper == ctx_handle2.dwUpper, "dwUpper mismatch, expected %#lx, got %#lx\n", ctx_handle.dwUpper, ctx_handle2.dwUpper); /* With no new input buffer, output buffer length should match prior call. */ todo_wine ok(buffers[1].pBuffers[0].cbBuffer == prev_buf_len, "Output buffer size mismatch, expected %#x, got %#x\n",
1
0
0
0
Connor McAdams : secur32: Clear SECBUFFER_ALERT output buffer count in schan_InitializeSecurityContextW.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: 795d3e2cb5ae320fdcb4dd1c23023a2d744ebbda URL:
https://source.winehq.org/git/wine.git/?a=commit;h=795d3e2cb5ae320fdcb4dd1c…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Thu Jan 27 11:11:27 2022 +0100 secur32: Clear SECBUFFER_ALERT output buffer count in schan_InitializeSecurityContextW. Since we write no data into this buffer, set the count to 0. Otherwise, some applications assume there has been alert data written into the buffer. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/secur32/schannel.c | 6 ++++++ dlls/secur32/tests/schannel.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index f1b47a78d21..71993e1d2d6 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -894,6 +894,12 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( pInput->pBuffers[1].cbBuffer = pInput->pBuffers[0].cbBuffer-ctx->transport.in.offset; } + for (i = 0; i < pOutput->cBuffers; i++) + { + SecBuffer *buffer = &pOutput->pBuffers[i]; + if (buffer->BufferType == SECBUFFER_ALERT) buffer->cbBuffer = 0; + } + *pfContextAttr = ISC_RET_REPLAY_DETECT | ISC_RET_SEQUENCE_DETECT | ISC_RET_CONFIDENTIALITY | ISC_RET_STREAM; if (ctx->req_ctx_attr & ISC_REQ_EXTENDED_ERROR) *pfContextAttr |= ISC_RET_EXTENDED_ERROR; if (ctx->req_ctx_attr & ISC_REQ_DATAGRAM) *pfContextAttr |= ISC_RET_DATAGRAM; diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index 6c15addf2fc..6fbe0c34bd1 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -700,7 +700,7 @@ static void test_context_output_buffer_size(DWORD protocol, DWORD flags, ULONG c status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", ctxt_flags_req, 0, 0, &in_buffers, 0, &context, &out_buffers, &attrs, NULL); ok(status == SEC_I_CONTINUE_NEEDED, "%d: Expected SEC_I_CONTINUE_NEEDED, got %08x\n", i, status); - if (i) todo_wine ok(!buffer->cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty\n"); + if (i) ok(!buffer->cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty\n"); DeleteSecurityContext(&context); } @@ -1661,7 +1661,7 @@ static void test_dtls(void) ok( !exp.LowPart, "got %08x\n", exp.LowPart ); ok( !exp.HighPart, "got %08x\n", exp.HighPart ); ok( buffers[1].pBuffers[1].BufferType == SECBUFFER_ALERT, "Expected buffertype SECBUFFER_ALERT, got %#x\n", buffers[1].pBuffers[1].BufferType); - todo_wine ok( !buffers[1].pBuffers[1].cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty, got %#x\n", buffers[1].pBuffers[1].cbBuffer); + ok( !buffers[1].pBuffers[1].cbBuffer, "Expected SECBUFFER_ALERT buffer to be empty, got %#x\n", buffers[1].pBuffers[1].cbBuffer); prev_buf_len = buffers[1].pBuffers[0].cbBuffer; /*
1
0
0
0
Connor McAdams : secur32: Add support for setting DTLS timeouts.
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: 117f79aa199642522c24d72cf9706f34293a10d4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=117f79aa199642522c24d72c…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Thu Jan 27 11:11:26 2022 +0100 secur32: Add support for setting DTLS timeouts. Add support for setting the DTLS timeout values, and set the retransmission timeout value to 0 to allow for retransmission on each call to schan_InitializeSecurityContext. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/secur32/schannel.c | 6 ++++++ dlls/secur32/schannel_gnutls.c | 22 ++++++++++++++++++++++ dlls/secur32/secur32_priv.h | 8 ++++++++ 3 files changed, 36 insertions(+) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index 141a191c7c6..f1b47a78d21 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -808,6 +808,12 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( else WARN("invalid buffer size %u\n", buffer->cbBuffer); } + if (is_dtls_context(ctx)) + { + struct set_dtls_timeouts_params params = { ctx->transport.session, 0, 60000 }; + GNUTLS_CALL( set_dtls_timeouts, ¶ms ); + } + phNewContext->dwLower = handle; phNewContext->dwUpper = 0; } diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c index 31fdb769677..ac51cbb5d9f 100644 --- a/dlls/secur32/schannel_gnutls.c +++ b/dlls/secur32/schannel_gnutls.c @@ -60,6 +60,7 @@ static int (*pgnutls_cipher_get_block_size)(gnutls_cipher_algorithm_t); static void (*pgnutls_transport_set_pull_timeout_function)(gnutls_session_t, int (*)(gnutls_transport_ptr_t, unsigned int)); static void (*pgnutls_dtls_set_mtu)(gnutls_session_t, unsigned int); +static void (*pgnutls_dtls_set_timeouts)(gnutls_session_t, unsigned int, unsigned int); /* Not present in gnutls version < 3.2.0. */ static int (*pgnutls_alpn_get_selected_protocol)(gnutls_session_t, gnutls_datum_t *); @@ -198,6 +199,12 @@ static void compat_gnutls_dtls_set_mtu(gnutls_session_t session, unsigned int mt FIXME("\n"); } +static void compat_gnutls_dtls_set_timeouts(gnutls_session_t session, unsigned int retrans_timeout, + unsigned int total_timeout) +{ + FIXME("\n"); +} + static void init_schan_buffers(struct schan_buffers *s, const PSecBufferDesc desc, int (*get_next_buffer)(const struct schan_transport *, struct schan_buffers *)) { @@ -989,6 +996,15 @@ static NTSTATUS schan_set_dtls_mtu( void *args ) return SEC_E_OK; } +static NTSTATUS schan_set_dtls_timeouts( void *args ) +{ + const struct set_dtls_timeouts_params *params = args; + gnutls_session_t s = (gnutls_session_t)params->session; + + pgnutls_dtls_set_timeouts(s, params->retrans_timeout, params->total_timeout); + return SEC_E_OK; +} + static inline void reverse_bytes(BYTE *buf, ULONG len) { BYTE tmp; @@ -1245,6 +1261,11 @@ static NTSTATUS process_attach( void *args ) WARN("gnutls_dtls_set_mtu not found\n"); pgnutls_dtls_set_mtu = compat_gnutls_dtls_set_mtu; } + if (!(pgnutls_dtls_set_timeouts = dlsym(libgnutls_handle, "gnutls_dtls_set_timeouts"))) + { + WARN("gnutls_dtls_set_timeouts not found\n"); + pgnutls_dtls_set_timeouts = compat_gnutls_dtls_set_timeouts; + } if (!(pgnutls_privkey_export_x509 = dlsym(libgnutls_handle, "gnutls_privkey_export_x509"))) { WARN("gnutls_privkey_export_x509 not found\n"); @@ -1308,6 +1329,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = schan_set_application_protocols, schan_set_dtls_mtu, schan_set_session_target, + schan_set_dtls_timeouts, }; #endif /* SONAME_LIBGNUTLS */ diff --git a/dlls/secur32/secur32_priv.h b/dlls/secur32/secur32_priv.h index c17adc96dc6..64edc0581d6 100644 --- a/dlls/secur32/secur32_priv.h +++ b/dlls/secur32/secur32_priv.h @@ -203,6 +203,13 @@ struct set_session_target_params const char *target; }; +struct set_dtls_timeouts_params +{ + schan_session session; + unsigned int retrans_timeout; + unsigned int total_timeout; +}; + enum schan_funcs { unix_process_attach, @@ -225,6 +232,7 @@ enum schan_funcs unix_set_application_protocols, unix_set_dtls_mtu, unix_set_session_target, + unix_set_dtls_timeouts, }; #endif /* __SECUR32_PRIV_H__ */
1
0
0
0
Paul Gofman : winhttp: Allow synchronous nonblocking send in socket_send_pong().
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: bb36da429f2c241af24b411db76530de87432df1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bb36da429f2c241af24b411d…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Jan 27 02:03:09 2022 +0300 winhttp: Allow synchronous nonblocking send in socket_send_pong(). Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winhttp/request.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 62f53995258..ff2c18c469b 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3505,7 +3505,10 @@ static void CALLBACK task_socket_send_pong( TP_CALLBACK_INSTANCE *instance, void struct socket_send *s = ctx; TRACE("running %p\n", work); - send_frame( s->socket, SOCKET_OPCODE_PONG, 0, NULL, 0, TRUE, NULL ); + + if (s->complete_async) complete_send_frame( s->socket, &s->ovr, NULL ); + else send_frame( s->socket, SOCKET_OPCODE_PONG, 0, NULL, 0, TRUE, NULL ); + send_io_complete( &s->socket->hdr ); release_object( &s->socket->hdr ); @@ -3516,18 +3519,38 @@ static DWORD socket_send_pong( struct socket *socket ) { if (socket->request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) { + BOOL async_send, complete_async = FALSE; struct socket_send *s; - DWORD ret; + DWORD ret = 0; if (!(s = malloc( sizeof(*s) ))) return ERROR_OUTOFMEMORY; - s->socket = socket; - addref_object( &socket->hdr ); - InterlockedIncrement( &socket->hdr.pending_sends ); - if ((ret = queue_task( &socket->send_q, task_socket_send_pong, s ))) + async_send = InterlockedIncrement( &socket->hdr.pending_sends ) > 1; + if (!async_send) + { + memset( &s->ovr, 0, sizeof(s->ovr) ); + if ((ret = send_frame( socket, SOCKET_OPCODE_PONG, 0, NULL, 0, TRUE, &s->ovr )) == WSA_IO_PENDING) + { + async_send = TRUE; + complete_async = TRUE; + } + } + + if (async_send) + { + s->complete_async = complete_async; + s->socket = socket; + addref_object( &socket->hdr ); + if ((ret = queue_task( &socket->send_q, task_socket_send_pong, s ))) + { + InterlockedDecrement( &socket->hdr.pending_sends ); + release_object( &socket->hdr ); + free( s ); + } + } + else { InterlockedDecrement( &socket->hdr.pending_sends ); - release_object( &socket->hdr ); free( s ); } return ret;
1
0
0
0
Paul Gofman : winhttp: Allow synchronous nonblocking send in send_socket_shutdown().
by Alexandre Julliard
27 Jan '22
27 Jan '22
Module: wine Branch: master Commit: 71ee671b65bd3895d015b54b534e3e0b64b95754 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=71ee671b65bd3895d015b54b…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Jan 27 02:03:08 2022 +0300 winhttp: Allow synchronous nonblocking send in send_socket_shutdown(). Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winhttp/request.c | 75 +++++++++++++++++++++++++++------------ dlls/winhttp/tests/notification.c | 2 +- dlls/winhttp/winhttp_private.h | 2 ++ 3 files changed, 55 insertions(+), 24 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index a5bd828c9b7..62f53995258 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3727,6 +3727,19 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D return ret; } +static void socket_shutdown_complete( struct socket *socket, DWORD ret ) +{ + if (!ret) send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NULL, 0 ); + else + { + WINHTTP_WEB_SOCKET_ASYNC_RESULT result; + result.AsyncResult.dwResult = API_WRITE_DATA; + result.AsyncResult.dwError = ret; + result.Operation = WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION; + send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); + } +} + static void CALLBACK task_socket_shutdown( TP_CALLBACK_INSTANCE *instance, void *ctx, TP_WORK *work ) { struct socket_shutdown *s = ctx; @@ -3734,21 +3747,11 @@ static void CALLBACK task_socket_shutdown( TP_CALLBACK_INSTANCE *instance, void TRACE("running %p\n", work); - ret = send_frame( s->socket, SOCKET_OPCODE_CLOSE, s->status, s->reason, s->len, TRUE, NULL ); - send_io_complete( &s->socket->hdr ); + if (s->complete_async) ret = complete_send_frame( s->socket, &s->ovr, s->reason ); + else ret = send_frame( s->socket, SOCKET_OPCODE_CLOSE, s->status, s->reason, s->len, TRUE, NULL ); - if (s->send_callback) - { - if (!ret) send_callback( &s->socket->hdr, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NULL, 0 ); - else - { - WINHTTP_WEB_SOCKET_ASYNC_RESULT result; - result.AsyncResult.dwResult = API_WRITE_DATA; - result.AsyncResult.dwError = ret; - result.Operation = WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION; - send_callback( &s->socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); - } - } + send_io_complete( &s->socket->hdr ); + if (s->send_callback) socket_shutdown_complete( s->socket, ret ); release_object( &s->socket->hdr ); free( s ); } @@ -3762,22 +3765,48 @@ static DWORD send_socket_shutdown( struct socket *socket, USHORT status, const v if (socket->request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) { + BOOL async_send, complete_async = FALSE; struct socket_shutdown *s; if (!(s = malloc( sizeof(*s) ))) return FALSE; - s->socket = socket; - s->status = status; - memcpy( s->reason, reason, len ); - s->len = len; - s->send_callback = send_callback; - addref_object( &socket->hdr ); - InterlockedIncrement( &socket->hdr.pending_sends ); - if ((ret = queue_task( &socket->send_q, task_socket_shutdown, s ))) + async_send = InterlockedIncrement( &socket->hdr.pending_sends ) > 1 || socket->hdr.recursion_count >= 3; + if (!async_send) + { + memset( &s->ovr, 0, sizeof(s->ovr) ); + if ((ret = send_frame( socket, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE, &s->ovr )) == WSA_IO_PENDING) + { + async_send = TRUE; + complete_async = TRUE; + } + } + + if (async_send) + { + s->complete_async = complete_async; + s->socket = socket; + s->status = status; + memcpy( s->reason, reason, len ); + s->len = len; + s->send_callback = send_callback; + + addref_object( &socket->hdr ); + if ((ret = queue_task( &socket->send_q, task_socket_shutdown, s ))) + { + InterlockedDecrement( &socket->hdr.pending_sends ); + release_object( &socket->hdr ); + free( s ); + } + } + else { InterlockedDecrement( &socket->hdr.pending_sends ); - release_object( &socket->hdr ); free( s ); + if (send_callback) + { + socket_shutdown_complete( socket, ret ); + ret = ERROR_SUCCESS; + } } } else ret = send_frame( socket, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE, NULL ); diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 5ec8740f66e..1ae7e1af2e7 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -677,7 +677,7 @@ static const struct notification websocket_test[] = { winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, NF_SIGNAL }, { winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_MAIN_THREAD | NF_SIGNAL }, { winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_MAIN_THREAD | NF_SIGNAL }, - { winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NF_SIGNAL }, + { winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NF_MAIN_THREAD | NF_SIGNAL }, { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SAVE_BUFFER | NF_SIGNAL }, { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SAVE_BUFFER | NF_SIGNAL }, { winhttp_websocket_close, WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE, NF_SIGNAL }, diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index b41eb0ee676..3e4e1eb298d 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -323,6 +323,8 @@ struct socket_shutdown char reason[123]; DWORD len; BOOL send_callback; + WSAOVERLAPPED ovr; + BOOL complete_async; }; struct object_header *addref_object( struct object_header * ) DECLSPEC_HIDDEN;
1
0
0
0
← Newer
1
...
16
17
18
19
20
21
22
...
73
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Results per page:
10
25
50
100
200