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
Paul Gofman : winhttp: Count queued websocket send operations.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: ad5d011f587aa25a62f56894f655e8d83dfb063c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ad5d011f587aa25a62f56894…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Jan 24 12:43:13 2022 +0300 winhttp: Count queued websocket send operations. 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 | 61 +++++++++++++++++++++++++----------------- dlls/winhttp/winhttp_private.h | 1 + 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 1a93c13081c..c12816b1ad4 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3227,6 +3227,12 @@ static DWORD send_frame( struct socket *socket, enum socket_opcode opcode, USHOR return ERROR_SUCCESS; } +static void send_io_complete( struct object_header *hdr ) +{ + LONG count = InterlockedDecrement( &hdr->pending_sends ); + assert( count >= 0 ); +} + static enum socket_opcode map_buffer_type( WINHTTP_WEB_SOCKET_BUFFER_TYPE type ) { switch (type) @@ -3259,23 +3265,22 @@ static void socket_send_complete( struct socket *socket, DWORD ret, WINHTTP_WEB_ } } -static DWORD socket_send( struct socket *socket, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, const void *buf, DWORD len, - BOOL async ) +static DWORD socket_send( struct socket *socket, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, const void *buf, DWORD len ) { enum socket_opcode opcode = map_buffer_type( type ); - DWORD ret; - ret = send_frame( socket, opcode, 0, buf, len, TRUE ); - if (async) socket_send_complete( socket, ret, type, len ); - return ret; + return send_frame( socket, opcode, 0, buf, len, TRUE ); } static void CALLBACK task_socket_send( TP_CALLBACK_INSTANCE *instance, void *ctx, TP_WORK *work ) { struct socket_send *s = ctx; + DWORD ret; TRACE("running %p\n", work); - socket_send( s->socket, s->type, s->buf, s->len, TRUE ); + ret = socket_send( s->socket, s->type, s->buf, s->len ); + send_io_complete( &s->socket->hdr ); + socket_send_complete( s->socket, ret, s->type, s->len ); release_object( &s->socket->hdr ); free( s ); @@ -3318,13 +3323,15 @@ DWORD WINAPI WinHttpWebSocketSend( HINTERNET hsocket, WINHTTP_WEB_SOCKET_BUFFER_ s->len = len; addref_object( &socket->hdr ); + InterlockedIncrement( &socket->hdr.pending_sends ); if ((ret = queue_task( &socket->send_q, task_socket_send, s ))) { + InterlockedDecrement( &socket->hdr.pending_sends ); release_object( &socket->hdr ); free( s ); } } - else ret = socket_send( socket, type, buf, len, FALSE ); + else ret = socket_send( socket, type, buf, len ); release_object( &socket->hdr ); return ret; @@ -3412,6 +3419,7 @@ static void CALLBACK task_socket_send_pong( TP_CALLBACK_INSTANCE *instance, void TRACE("running %p\n", work); send_frame( s->socket, SOCKET_OPCODE_PONG, 0, NULL, 0, TRUE ); + send_io_complete( &s->socket->hdr ); release_object( &s->socket->hdr ); free( s ); @@ -3428,8 +3436,10 @@ static DWORD socket_send_pong( struct socket *socket ) s->socket = socket; addref_object( &socket->hdr ); + InterlockedIncrement( &socket->hdr.pending_sends ); if ((ret = queue_task( &socket->send_q, task_socket_send_pong, s ))) { + InterlockedDecrement( &socket->hdr.pending_sends ); release_object( &socket->hdr ); free( s ); } @@ -3596,7 +3606,7 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D return ret; } -static DWORD socket_shutdown( struct socket *socket, USHORT status, const void *reason, DWORD len, BOOL async ) +static DWORD socket_shutdown( struct socket *socket, USHORT status, const void *reason, DWORD len ) { DWORD ret; @@ -3605,28 +3615,29 @@ static DWORD socket_shutdown( struct socket *socket, USHORT status, const void * { socket->state = SOCKET_STATE_SHUTDOWN; } - if (async) - { - 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) ); - } - } return ret; } static void CALLBACK task_socket_shutdown( TP_CALLBACK_INSTANCE *instance, void *ctx, TP_WORK *work ) { struct socket_shutdown *s = ctx; - - socket_shutdown( s->socket, s->status, s->reason, s->len, TRUE ); + DWORD ret; TRACE("running %p\n", work); + + ret = socket_shutdown( s->socket, s->status, s->reason, s->len ); + send_io_complete( &s->socket->hdr ); + + 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) ); + } + release_object( &s->socket->hdr ); free( s ); } @@ -3663,13 +3674,15 @@ DWORD WINAPI WinHttpWebSocketShutdown( HINTERNET hsocket, USHORT status, void *r s->len = len; addref_object( &socket->hdr ); + InterlockedIncrement( &socket->hdr.pending_sends ); if ((ret = queue_task( &socket->send_q, task_socket_shutdown, s ))) { + InterlockedDecrement( &socket->hdr.pending_sends ); release_object( &socket->hdr ); free( s ); } } - else ret = socket_shutdown( socket, status, reason, len, FALSE ); + else ret = socket_shutdown( socket, status, reason, len ); release_object( &socket->hdr ); return ret; diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 557ee766735..db235fbf622 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -51,6 +51,7 @@ struct object_header DWORD notify_mask; LONG recursion_count; struct list entry; + volatile LONG pending_sends; }; struct hostdata
1
0
0
0
Paul Gofman : winhttp: Factor out socket_send_complete() function.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: 7dd66e8450ab63a41aee7543812a3cbc063cade6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7dd66e8450ab63a41aee7543…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Jan 24 12:43:12 2022 +0300 winhttp: Factor out socket_send_complete() function. 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 | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index f4f81af42da..1a93c13081c 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3240,6 +3240,25 @@ static enum socket_opcode map_buffer_type( WINHTTP_WEB_SOCKET_BUFFER_TYPE type ) } } +static void socket_send_complete( struct socket *socket, DWORD ret, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, DWORD len ) +{ + if (!ret) + { + WINHTTP_WEB_SOCKET_STATUS status; + status.dwBytesTransferred = len; + status.eBufferType = type; + send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, &status, sizeof(status) ); + } + else + { + WINHTTP_WEB_SOCKET_ASYNC_RESULT result; + result.AsyncResult.dwResult = API_WRITE_DATA; + result.AsyncResult.dwError = ret; + result.Operation = WINHTTP_WEB_SOCKET_SEND_OPERATION; + send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); + } +} + static DWORD socket_send( struct socket *socket, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, const void *buf, DWORD len, BOOL async ) { @@ -3247,24 +3266,7 @@ static DWORD socket_send( struct socket *socket, WINHTTP_WEB_SOCKET_BUFFER_TYPE DWORD ret; ret = send_frame( socket, opcode, 0, buf, len, TRUE ); - if (async) - { - if (!ret) - { - WINHTTP_WEB_SOCKET_STATUS status; - status.dwBytesTransferred = len; - status.eBufferType = type; - send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, &status, sizeof(status) ); - } - else - { - WINHTTP_WEB_SOCKET_ASYNC_RESULT result; - result.AsyncResult.dwResult = API_WRITE_DATA; - result.AsyncResult.dwError = ret; - result.Operation = WINHTTP_WEB_SOCKET_SEND_OPERATION; - send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); - } - } + if (async) socket_send_complete( socket, ret, type, len ); return ret; }
1
0
0
0
Paul Gofman : winhttp: Drain frames until close frame in socket_close().
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: c8926342445036478048a2057786396fffa0b8ad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c8926342445036478048a205…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Jan 24 12:43:11 2022 +0300 winhttp: Drain frames until close frame in socket_close(). 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 | 13 ++++++++++--- dlls/winhttp/tests/notification.c | 14 ++++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index af04292ea06..f4f81af42da 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3686,9 +3686,16 @@ static DWORD socket_close( struct socket *socket, USHORT status, const void *rea socket->state = SOCKET_STATE_SHUTDOWN; } - if ((ret = receive_frame( socket, &count, &socket->opcode ))) goto done; - if (socket->opcode != SOCKET_OPCODE_CLOSE || - (count && (count < sizeof(socket->status) || count > sizeof(socket->status) + sizeof(socket->reason)))) + while (1) + { + if ((ret = receive_frame( socket, &count, &socket->opcode ))) goto done; + if (socket->opcode == SOCKET_OPCODE_CLOSE) break; + + socket->read_size = count; + if ((ret = socket_drain( socket ))) goto done; + } + + if ((count && (count < sizeof(socket->status) || count > sizeof(socket->status) + sizeof(socket->reason)))) { ret = ERROR_WINHTTP_INVALID_SERVER_RESPONSE; goto done; diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 6b0e11023da..1573dd37faa 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -659,6 +659,7 @@ static const struct notification websocket_test[] = { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, NF_SIGNAL }, { winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, NF_SIGNAL }, { winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_SIGNAL }, + { winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_SIGNAL }, { winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NF_SIGNAL }, { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }, { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }, @@ -681,6 +682,7 @@ static void test_websocket(BOOL secure) char buffer[1024]; USHORT close_status; DWORD protocols, flags; + unsigned int i; if (!pWinHttpWebSocketCompleteUpgrade) { @@ -788,10 +790,14 @@ static void test_websocket(BOOL secure) ok( err == ERROR_SUCCESS, "got %u\n", err ); WaitForSingleObject( info.wait, INFINITE ); - setup_test( &info, winhttp_websocket_send, __LINE__ ); - err = pWinHttpWebSocketSend( socket, 0, (void *)"hello", sizeof("hello") ); - ok( err == ERROR_SUCCESS, "got %u\n", err ); - WaitForSingleObject( info.wait, INFINITE ); + for (i = 0; i < 2; ++i) + { + setup_test( &info, winhttp_websocket_send, __LINE__ ); + err = pWinHttpWebSocketSend( socket, WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE, + (void*)"hello", sizeof("hello") ); + ok( err == ERROR_SUCCESS, "got %u\n", err ); + WaitForSingleObject( info.wait, INFINITE ); + } setup_test( &info, winhttp_websocket_shutdown, __LINE__ ); err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") );
1
0
0
0
Rémi Bernon : dinput: Return DIERR_INPUTLOST when device is removed.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: ea60e4678c7b8f39cc4245e42b8de74718dd146c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ea60e4678c7b8f39cc4245e4…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Jan 24 12:02:47 2022 +0100 dinput: Return DIERR_INPUTLOST when device is removed. This fixes hotplug with DS4 and other DInput-compatible controllers in Tekken 7. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 8 ++++++-- dlls/dinput/device_private.h | 1 + dlls/dinput/dinput_main.c | 8 +++++--- dlls/dinput/joystick_hid.c | 4 ++-- dlls/dinput/tests/hotplug.c | 5 ----- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 47cf4d72dc3..ff8e2252a40 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1553,7 +1553,9 @@ static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface, IDirectInputDevice2_Poll( iface ); EnterCriticalSection( &impl->crit ); - if (impl->status != STATUS_ACQUIRED) + if (impl->status == STATUS_UNPLUGGED) + hr = DIERR_INPUTLOST; + else if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; else if (!(user_format = impl->user_format)) hr = DIERR_INVALIDPARAM; @@ -1605,6 +1607,7 @@ static HRESULT WINAPI dinput_device_GetDeviceData( IDirectInputDevice8W *iface, if (This->dinput->dwVersion == 0x0800 || size == sizeof(DIDEVICEOBJECTDATA_DX3)) { if (!This->queue_len) return DIERR_NOTBUFFERED; + if (This->status == STATUS_UNPLUGGED) return DIERR_INPUTLOST; if (This->status != STATUS_ACQUIRED) return DIERR_NOTACQUIRED; } @@ -1857,7 +1860,8 @@ static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface ) HRESULT hr = DI_NOEFFECT; EnterCriticalSection( &impl->crit ); - if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; + if (impl->status == STATUS_UNPLUGGED) hr = DIERR_INPUTLOST; + else if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; LeaveCriticalSection( &impl->crit ); if (FAILED(hr)) return hr; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 7865c3a15a9..15a8a6f83b5 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -73,6 +73,7 @@ enum device_status { STATUS_UNACQUIRED, STATUS_ACQUIRED, + STATUS_UNPLUGGED, }; /* Device implementation */ diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 664311b7a31..dbb727c3c43 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1261,7 +1261,6 @@ static DWORD WINAPI dinput_thread_proc( void *params ) struct dinput_device *impl, *next; SIZE_T events_count = 0; HANDLE finished_event; - HRESULT hr; DWORD ret; MSG msg; @@ -1282,8 +1281,11 @@ static DWORD WINAPI dinput_thread_proc( void *params ) { if (impl->read_event == events[ret]) { - hr = impl->vtbl->read( &impl->IDirectInputDevice8W_iface ); - if (FAILED( hr )) dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + if (FAILED( impl->vtbl->read( &impl->IDirectInputDevice8W_iface ) )) + { + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + impl->status = STATUS_UNPLUGGED; + } break; } } diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 4caaf01affe..597a3da4ef8 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -872,7 +872,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { impl->device = CreateFileW( impl->device_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, 0 ); - if (impl->device == INVALID_HANDLE_VALUE) return DIERR_INVALIDPARAM; + if (impl->device == INVALID_HANDLE_VALUE) return DIERR_UNPLUGGED; } memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) ); @@ -882,7 +882,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { CloseHandle( impl->device ); impl->device = INVALID_HANDLE_VALUE; - return DIERR_INVALIDPARAM; + return DIERR_UNPLUGGED; } IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET ); diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c index e42af12e810..afe51cf0e97 100644 --- a/dlls/dinput/tests/hotplug.c +++ b/dlls/dinput/tests/hotplug.c @@ -116,20 +116,15 @@ static BOOL test_input_lost( DWORD version ) pnp_driver_stop(); hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); - todo_wine ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); - todo_wine ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); - todo_wine ok( hr == DIERR_INPUTLOST, "GetDeviceData returned %#x\n", hr ); hr = IDirectInputDevice8_Poll( device ); - todo_wine ok( hr == DIERR_INPUTLOST, "Poll returned: %#x\n", hr ); hr = IDirectInputDevice8_Acquire( device ); - todo_wine ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr ); hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr );
1
0
0
0
Rémi Bernon : dinput: Use an enumeration instead of BOOL for acquired status.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: 3039fd6d5cad7255733b7816281bbd635b289c89 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3039fd6d5cad7255733b7816…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Jan 24 12:02:46 2022 +0100 dinput: Use an enumeration instead of BOOL for acquired status. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 26 +++++++++++++------------- dlls/dinput/device_private.h | 8 +++++++- dlls/dinput/dinput_main.c | 4 ++-- dlls/dinput/joystick_hid.c | 2 +- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 5f8227acd0c..47cf4d72dc3 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -84,7 +84,7 @@ static inline const char *debugstr_diobjectdataformat( const DIOBJECTDATAFORMAT static inline BOOL is_exclusively_acquired( struct dinput_device *device ) { - return device->acquired && (device->dwCoopLevel & DISCL_EXCLUSIVE); + return device->status == STATUS_ACQUIRED && (device->dwCoopLevel & DISCL_EXCLUSIVE); } /****************************************************************************** @@ -582,7 +582,7 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface ); EnterCriticalSection( &impl->crit ); - if (impl->acquired) + if (impl->status == STATUS_ACQUIRED) hr = DI_NOEFFECT; else if (!impl->user_format) hr = DIERR_INVALIDPARAM; @@ -590,8 +590,8 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) hr = DIERR_OTHERAPPHASPRIO; else { - impl->acquired = TRUE; - if (FAILED(hr = impl->vtbl->acquire( iface ))) impl->acquired = FALSE; + impl->status = STATUS_ACQUIRED; + if (FAILED(hr = impl->vtbl->acquire( iface ))) impl->status = STATUS_UNACQUIRED; } LeaveCriticalSection( &impl->crit ); if (hr != DI_OK) return hr; @@ -614,9 +614,9 @@ static HRESULT WINAPI dinput_device_Unacquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface ); EnterCriticalSection( &impl->crit ); - if (!impl->acquired) hr = DI_NOEFFECT; + if (impl->status != STATUS_ACQUIRED) hr = DI_NOEFFECT; else hr = impl->vtbl->unacquire( iface ); - impl->acquired = FALSE; + impl->status = STATUS_UNACQUIRED; LeaveCriticalSection( &impl->crit ); if (hr != DI_OK) return hr; @@ -647,7 +647,7 @@ static HRESULT WINAPI dinput_device_SetDataFormat( IDirectInputDevice8W *iface, if (format->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM; if (format->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) return DIERR_INVALIDPARAM; - if (This->acquired) return DIERR_ACQUIRED; + if (This->status == STATUS_ACQUIRED) return DIERR_ACQUIRED; EnterCriticalSection(&This->crit); @@ -696,7 +696,7 @@ static HRESULT WINAPI dinput_device_SetCooperativeLevel( IDirectInputDevice8W *i /* Store the window which asks for the mouse */ EnterCriticalSection(&This->crit); - if (This->acquired) hr = DIERR_ACQUIRED; + if (This->status == STATUS_ACQUIRED) hr = DIERR_ACQUIRED; else { This->win = hwnd; @@ -1014,7 +1014,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con case (DWORD_PTR)DIPROP_BUFFERSIZE: case (DWORD_PTR)DIPROP_PHYSICALRANGE: case (DWORD_PTR)DIPROP_LOGICALRANGE: - if (impl->acquired) return DIERR_ACQUIRED; + if (impl->status == STATUS_ACQUIRED) return DIERR_ACQUIRED; break; case (DWORD_PTR)DIPROP_FFLOAD: case (DWORD_PTR)DIPROP_GRANULARITY: @@ -1553,7 +1553,7 @@ static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface, IDirectInputDevice2_Poll( iface ); EnterCriticalSection( &impl->crit ); - if (!impl->acquired) + if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; else if (!(user_format = impl->user_format)) hr = DIERR_INVALIDPARAM; @@ -1605,7 +1605,7 @@ static HRESULT WINAPI dinput_device_GetDeviceData( IDirectInputDevice8W *iface, if (This->dinput->dwVersion == 0x0800 || size == sizeof(DIDEVICEOBJECTDATA_DX3)) { if (!This->queue_len) return DIERR_NOTBUFFERED; - if (!This->acquired) return DIERR_NOTACQUIRED; + if (This->status != STATUS_ACQUIRED) return DIERR_NOTACQUIRED; } if (!This->queue_len) @@ -1857,7 +1857,7 @@ static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface ) HRESULT hr = DI_NOEFFECT; EnterCriticalSection( &impl->crit ); - if (!impl->acquired) hr = DIERR_NOTACQUIRED; + if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; LeaveCriticalSection( &impl->crit ); if (FAILED(hr)) return hr; @@ -2012,7 +2012,7 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D break; } - if (impl->acquired) return DIERR_ACQUIRED; + if (impl->status == STATUS_ACQUIRED) return DIERR_ACQUIRED; data_format.dwSize = sizeof(data_format); data_format.dwObjSize = sizeof(DIOBJECTDATAFORMAT); diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 00a80b16590..7865c3a15a9 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -69,6 +69,12 @@ struct object_properties DWORD calibration_mode; }; +enum device_status +{ + STATUS_UNACQUIRED, + STATUS_ACQUIRED, +}; + /* Device implementation */ struct dinput_device { @@ -84,7 +90,7 @@ struct dinput_device DIDEVCAPS caps; DWORD dwCoopLevel; HWND win; - int acquired; + enum device_status status; BOOL use_raw_input; /* use raw input instead of low-level messages */ RAWINPUTDEVICE raw_device; /* raw device to (un)register */ diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 8347e3aa586..664311b7a31 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -128,10 +128,10 @@ static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface ); EnterCriticalSection( &impl->crit ); - if (impl->acquired) + if (impl->status == STATUS_ACQUIRED) { impl->vtbl->unacquire( iface ); - impl->acquired = FALSE; + impl->status = STATUS_UNACQUIRED; list_remove( &impl->entry ); } LeaveCriticalSection( &impl->crit ); diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 7a365137271..4caaf01affe 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -243,7 +243,7 @@ static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectI static inline BOOL is_exclusively_acquired( struct hid_joystick *joystick ) { - return joystick->base.acquired && (joystick->base.dwCoopLevel & DISCL_EXCLUSIVE); + return joystick->base.status == STATUS_ACQUIRED && (joystick->base.dwCoopLevel & DISCL_EXCLUSIVE); } static const GUID *object_usage_to_guid( USAGE usage_page, USAGE usage )
1
0
0
0
Rémi Bernon : dinput: Introduce new is_exclusively_acquired helper.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: fd46a5aac3b5f83dfa4df8084a25ef98432c2892 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fd46a5aac3b5f83dfa4df808…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Jan 24 12:02:45 2022 +0100 dinput: Introduce new is_exclusively_acquired helper. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 19 +++++++++++-------- dlls/dinput/joystick_hid.c | 17 +++++++++++------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index a4c85351648..5f8227acd0c 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -82,6 +82,11 @@ static inline const char *debugstr_diobjectdataformat( const DIOBJECTDATAFORMAT debugstr_guid( data->pguid ), data->dwOfs, data->dwType, data->dwFlags ); } +static inline BOOL is_exclusively_acquired( struct dinput_device *device ) +{ + return device->acquired && (device->dwCoopLevel & DISCL_EXCLUSIVE); +} + /****************************************************************************** * Various debugging tools */ @@ -1073,7 +1078,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con case (DWORD_PTR)DIPROP_FFLOAD: if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) return DIERR_NOTEXCLUSIVEACQUIRED; + if (!is_exclusively_acquired( impl )) return DIERR_NOTEXCLUSIVEACQUIRED; /* fallthrough */ case (DWORD_PTR)DIPROP_PRODUCTNAME: case (DWORD_PTR)DIPROP_INSTANCENAME: @@ -1399,7 +1404,7 @@ static HRESULT WINAPI dinput_device_set_property( IDirectInputDevice8W *iface, c const DIPROPDWORD *value = (const DIPROPDWORD *)header; if (!impl->vtbl->send_device_gain) return DIERR_UNSUPPORTED; impl->device_gain = value->dwData; - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) return DI_OK; + if (!is_exclusively_acquired( impl )) return DI_OK; return impl->vtbl->send_device_gain( iface, impl->device_gain ); } case (DWORD_PTR)DIPROP_AXISMODE: @@ -1679,7 +1684,7 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c if (!params) return DI_OK; flags = params->dwSize == sizeof(DIEFFECT_DX6) ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5; - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) flags |= DIEP_NODOWNLOAD; + if (!is_exclusively_acquired( impl )) flags |= DIEP_NODOWNLOAD; hr = IDirectInputEffect_SetParameters( *out, params, flags ); if (FAILED(hr)) goto failed; return DI_OK; @@ -1788,10 +1793,8 @@ static HRESULT WINAPI dinput_device_GetForceFeedbackState( IDirectInputDevice8W if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; EnterCriticalSection( &impl->crit ); - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) - hr = DIERR_NOTEXCLUSIVEACQUIRED; - else - *out = impl->force_feedback_state; + if (!is_exclusively_acquired( impl )) hr = DIERR_NOTEXCLUSIVEACQUIRED; + else *out = impl->force_feedback_state; LeaveCriticalSection( &impl->crit ); return hr; @@ -1819,7 +1822,7 @@ static HRESULT WINAPI dinput_device_SendForceFeedbackCommand( IDirectInputDevice if (!impl->vtbl->send_force_feedback_command) return DIERR_UNSUPPORTED; EnterCriticalSection( &impl->crit ); - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) hr = DIERR_NOTEXCLUSIVEACQUIRED; + if (!is_exclusively_acquired( impl )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else hr = impl->vtbl->send_force_feedback_command( iface, command, FALSE ); LeaveCriticalSection( &impl->crit ); diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index ccf205e275b..7a365137271 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -241,6 +241,11 @@ static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectI return CONTAINING_RECORD( iface, struct hid_joystick_effect, IDirectInputEffect_iface ); } +static inline BOOL is_exclusively_acquired( struct hid_joystick *joystick ) +{ + return joystick->base.acquired && (joystick->base.dwCoopLevel & DISCL_EXCLUSIVE); +} + static const GUID *object_usage_to_guid( USAGE usage_page, USAGE usage ) { switch (usage_page) @@ -827,7 +832,7 @@ static HRESULT hid_joystick_get_property( IDirectInputDevice8W *iface, DWORD pro { DIPROPDWORD *value = (DIPROPDWORD *)header; if (!(impl->base.caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; - if (!impl->base.acquired || !(impl->base.dwCoopLevel & DISCL_EXCLUSIVE)) return DIERR_NOTEXCLUSIVEACQUIRED; + if (!is_exclusively_acquired( impl )) return DIERR_NOTEXCLUSIVEACQUIRED; value->dwData = 0; return DI_OK; } @@ -898,7 +903,7 @@ static HRESULT hid_joystick_unacquire( IDirectInputDevice8W *iface ) else WaitForSingleObject( impl->base.read_event, INFINITE ); if (!(impl->base.caps.dwFlags & DIDC_FORCEFEEDBACK)) return DI_OK; - if (!impl->base.acquired || !(impl->base.dwCoopLevel & DISCL_EXCLUSIVE)) return DI_OK; + if (!is_exclusively_acquired( impl )) return DI_OK; hid_joystick_send_force_feedback_command( iface, DISFFC_RESET, TRUE ); return DI_OK; } @@ -2682,7 +2687,7 @@ static HRESULT WINAPI hid_joystick_effect_Start( IDirectInputEffect *iface, DWOR else control = PID_USAGE_OP_EFFECT_START; EnterCriticalSection( &impl->joystick->base.crit ); - if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if ((flags & DIES_NODOWNLOAD) && !impl->index) hr = DIERR_NOTDOWNLOADED; @@ -2730,7 +2735,7 @@ static HRESULT WINAPI hid_joystick_effect_Stop( IDirectInputEffect *iface ) TRACE( "iface %p.\n", iface ); EnterCriticalSection( &impl->joystick->base.crit ); - if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if (!impl->index) hr = DIERR_NOTDOWNLOADED; @@ -2775,7 +2780,7 @@ static HRESULT WINAPI hid_joystick_effect_GetEffectStatus( IDirectInputEffect *i *status = 0; EnterCriticalSection( &impl->joystick->base.crit ); - if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if (!impl->index) hr = DIERR_NOTDOWNLOADED; @@ -2850,7 +2855,7 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) if (impl->modified) hr = DI_OK; else hr = DI_NOEFFECT; - if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if ((impl->flags & complete_mask) != complete_mask) hr = DIERR_INCOMPLETEEFFECT;
1
0
0
0
Rémi Bernon : dinput/tests: Add some tests for DIERR_INPUTLOST conditions.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: c232fce6ea730b6b8f5f0006c467948996e108e7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c232fce6ea730b6b8f5f0006…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Jan 24 12:02:44 2022 +0100 dinput/tests: Add some tests for DIERR_INPUTLOST conditions. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/tests/Makefile.in | 1 + dlls/dinput/tests/hotplug.c | 175 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) diff --git a/dlls/dinput/tests/Makefile.in b/dlls/dinput/tests/Makefile.in index b6648008115..44ea9d340bb 100644 --- a/dlls/dinput/tests/Makefile.in +++ b/dlls/dinput/tests/Makefile.in @@ -13,6 +13,7 @@ SOURCES = \ driver_hid.spec \ force_feedback.c \ hid.c \ + hotplug.c \ joystick.c \ joystick8.c \ keyboard.c \ diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c new file mode 100644 index 00000000000..e42af12e810 --- /dev/null +++ b/dlls/dinput/tests/hotplug.c @@ -0,0 +1,175 @@ +/* + * Copyright 2022 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define DIRECTINPUT_VERSION 0x0800 + +#include <stdarg.h> +#include <stddef.h> +#include <limits.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" + +#define COBJMACROS +#include "dinput.h" +#include "dinputd.h" +#include "devguid.h" +#include "mmsystem.h" + +#include "wine/hid.h" + +#include "dinput_test.h" + +static BOOL test_input_lost( DWORD version ) +{ +#include "psh_hid_macros.h" + static const unsigned char report_desc[] = + { + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Application), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Physical), + USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), + USAGE_MINIMUM(1, 1), + USAGE_MAXIMUM(1, 6), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 1), + REPORT_SIZE(1, 1), + REPORT_COUNT(1, 8), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + END_COLLECTION, + }; +#include "pop_hid_macros.h" + + static const HIDP_CAPS hid_caps = + { + .InputReportByteLength = 1, + }; + static const DIPROPDWORD buffer_size = + { + .diph = + { + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwSize = sizeof(DIPROPDWORD), + .dwHow = DIPH_DEVICE, + .dwObj = 0, + }, + .dwData = UINT_MAX, + }; + + DIDEVICEINSTANCEW devinst = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + DIDEVICEOBJECTDATA objdata[32] = {{0}}; + WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; + IDirectInputDevice8W *device = NULL; + ULONG ref, count, size; + DIJOYSTATE2 state; + HRESULT hr; + + winetest_push_context( "%#x", version ); + + GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd ); + GetTempPathW( ARRAY_SIZE(tempdir), tempdir ); + SetCurrentDirectoryW( tempdir ); + + cleanup_registry_keys(); + if (!dinput_driver_start( report_desc, sizeof(report_desc), &hid_caps, NULL, 0 )) goto done; + if (FAILED(hr = dinput_test_create_device( version, &devinst, &device ))) goto done; + + hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 ); + ok( hr == DI_OK, "SetDataFormat returned %#x\n", hr ); + hr = IDirectInputDevice8_SetCooperativeLevel( device, 0, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND ); + ok( hr == DI_OK, "SetCooperativeLevel returned %#x\n", hr ); + hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &buffer_size.diph ); + ok( hr == DI_OK, "SetProperty returned %#x\n", hr ); + + hr = IDirectInputDevice8_Acquire( device ); + ok( hr == DI_OK, "Acquire returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + ok( hr == DI_OK, "GetDeviceState returned %#x\n", hr ); + size = version < 0x0800 ? sizeof(DIDEVICEOBJECTDATA_DX3) : sizeof(DIDEVICEOBJECTDATA); + count = 1; + hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); + ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr ); + ok( count == 0, "got %u expected %u\n", count, 0 ); + + pnp_driver_stop(); + + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + todo_wine + ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + todo_wine + ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); + todo_wine + ok( hr == DIERR_INPUTLOST, "GetDeviceData returned %#x\n", hr ); + hr = IDirectInputDevice8_Poll( device ); + todo_wine + ok( hr == DIERR_INPUTLOST, "Poll returned: %#x\n", hr ); + + hr = IDirectInputDevice8_Acquire( device ); + todo_wine + ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); + ok( hr == DIERR_NOTACQUIRED, "GetDeviceData returned %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_NOEFFECT, "Unacquire returned: %#x\n", hr ); + + dinput_driver_start( report_desc, sizeof(report_desc), &hid_caps, NULL, 0 ); + + hr = IDirectInputDevice8_Acquire( device ); + todo_wine + ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + todo_wine + ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr ); + + ref = IDirectInputDevice8_Release( device ); + ok( ref == 0, "Release returned %d\n", ref ); + +done: + pnp_driver_stop(); + cleanup_registry_keys(); + SetCurrentDirectoryW( cwd ); + + winetest_pop_context(); + return device != NULL; +} + +START_TEST( hotplug ) +{ + if (!dinput_test_init()) return; + + CoInitialize( NULL ); + if (test_input_lost( 0x500 )) + { + test_input_lost( 0x700 ); + test_input_lost( 0x800 ); + } + CoUninitialize(); + + dinput_test_exit(); +}
1
0
0
0
Fabian Maurer : adsldp/tests: Fix misleading indentation warnings.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: f1094172950d75c03a12892ae5c6ef18327b226e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f1094172950d75c03a12892a…
Author: Fabian Maurer <dark.shadow4(a)web.de> Date: Sun Jan 23 20:09:11 2022 +0100 adsldp/tests: Fix misleading indentation warnings. Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/adsldp/tests/ldap.c | 10 +++++----- dlls/adsldp/tests/sysinfo.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/adsldp/tests/ldap.c b/dlls/adsldp/tests/ldap.c index fe9801a3972..161fc5d0bbc 100644 --- a/dlls/adsldp/tests/ldap.c +++ b/dlls/adsldp/tests/ldap.c @@ -190,7 +190,7 @@ static void test_ParseDisplayName(void) count = 0xdeadbeef; hr = MkParseDisplayName(bc, test[i].path, &count, &mk); -todo_wine_if(i == 0 || i == 1 || i == 11 || i == 12) + todo_wine_if(i == 0 || i == 1 || i == 11 || i == 12) ok(hr == test[i].hr, "%d: got %#x, expected %#x\n", i, hr, test[i].hr); if (hr == S_OK) { @@ -394,7 +394,7 @@ static void test_DirectorySearch(void) ok(hr == E_ADS_BAD_PARAMETER, "got %#x\n", hr); hr = IDirectorySearch_GetPreviousRow(ds, sh); -todo_wine + todo_wine ok(hr == E_ADS_BAD_PARAMETER, "got %#x\n", hr); while (IDirectorySearch_GetNextRow(ds, sh) != S_ADS_NOMORE_ROWS) @@ -430,9 +430,9 @@ todo_wine name = NULL; hr = IDirectorySearch_GetNextColumnName(ds, sh, &name); -todo_wine + todo_wine ok(hr == S_OK || broken(hr == S_ADS_NOMORE_COLUMNS) /* XP */, "got %#x\n", hr); -todo_wine + todo_wine ok((name && !wcscmp(name, L"ADsPath")) || broken(!name) /* XP */, "got %s\n", wine_dbgstr_w(name)); FreeADsMem(name); @@ -488,7 +488,7 @@ static void test_DirectoryObject(void) ok(hr == S_OK, "got %#x\n", hr); hr = IDirectoryObject_QueryInterface(dirobj, &IID_IADsOpenDSObject, (void **)&unk); -todo_wine + todo_wine ok(hr == E_NOINTERFACE, "got %#x\n", hr); if (hr == S_OK) IUnknown_Release(unk); hr = IDirectoryObject_QueryInterface(dirobj, &IID_IDispatch, (void **)&unk); diff --git a/dlls/adsldp/tests/sysinfo.c b/dlls/adsldp/tests/sysinfo.c index c7495dcb88b..4e7b0b405a9 100644 --- a/dlls/adsldp/tests/sysinfo.c +++ b/dlls/adsldp/tests/sysinfo.c @@ -123,7 +123,7 @@ static void test_UserName(void) ok(hr == S_OK, "got %#x\n", hr); hr = IADsADSystemInfo_get_UserName(sysinfo, &bstr); -todo_wine + todo_wine ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NONE_MAPPED), "got %#x\n", hr); if (hr == S_OK) { @@ -164,7 +164,7 @@ static void test_sysinfo(void) SysFreeString(bstr); hr = IADsADSystemInfo_get_UserName(sysinfo, &bstr); -todo_wine + todo_wine ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NONE_MAPPED), "got %#x\n", hr); if (hr != S_OK) goto done; SysFreeString(bstr);
1
0
0
0
Alexandre Julliard : include: Fix prototype mismatch for server functions.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: 2aae3489be5de3bc51ca1e5ccff32908e66e9fa0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2aae3489be5de3bc51ca1e5c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jan 24 21:44:36 2022 +0100 include: Fix prototype mismatch for server functions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/server.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wine/server.h b/include/wine/server.h index 57bcdbbb00d..b05271b7522 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -50,8 +50,8 @@ struct __server_request_info }; extern unsigned int CDECL wine_server_call( void *req_ptr ); -extern int CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ); -extern int CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, unsigned int *options ); +extern NTSTATUS CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ); +extern NTSTATUS CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, unsigned int *options ); /* do a server call and set the last error code */ static inline unsigned int wine_server_call_err( void *req_ptr )
1
0
0
0
Alexandre Julliard : include: Define a few more intrinsic functions.
by Alexandre Julliard
24 Jan '22
24 Jan '22
Module: wine Branch: master Commit: 4c2b6af10f779860830cc4b9f8a92d1ff6c55a80 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4c2b6af10f779860830cc4b9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jan 24 21:43:57 2022 +0100 include: Define a few more intrinsic functions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/winnt.h | 90 ++++++++++++++++++++++++--------------------------------- 1 file changed, 38 insertions(+), 52 deletions(-) diff --git a/include/winnt.h b/include/winnt.h index c80efee077d..9296a3dc555 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6262,60 +6262,12 @@ typedef enum _PROCESS_MITIGATION_POLICY MaxProcessMitigationPolicy } PROCESS_MITIGATION_POLICY, *PPROCESS_MITIGATION_POLICY; -#ifdef _MSC_VER - -BOOLEAN _BitScanForward(unsigned long*,unsigned long); -BOOLEAN _BitScanReverse(unsigned long*,unsigned long); - -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) - -static inline BOOLEAN BitScanForward(DWORD *index, DWORD mask) -{ - return _BitScanForward((unsigned long*)index, mask); -} - -static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask) -{ - return _BitScanReverse((unsigned long*)index, mask); -} - -#elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) - -static inline BOOLEAN BitScanForward(DWORD *index, DWORD mask) -{ - *index = __builtin_ctz(mask); - return mask != 0; -} -static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask) -{ - *index = 31 - __builtin_clz(mask); - return mask != 0; -} - -#else - -static inline BOOLEAN BitScanForward(DWORD *index, DWORD mask) -{ - unsigned int r = 0; - while (r < 31 && !(mask & (1 << r))) r++; - *index = r; - return mask != 0; -} - -static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask) -{ - unsigned int r = 31; - while (r > 0 && !(mask & (1 << r))) r--; - *index = r; - return mask != 0; -} - -#endif - -/* Interlocked functions */ +/* Intrinsic functions */ +#define BitScanForward _BitScanForward +#define BitScanReverse _BitScanReverse +#define InterlockedAdd _InlineInterlockedAdd #define InterlockedAnd _InterlockedAnd #define InterlockedCompareExchange _InterlockedCompareExchange #define InterlockedCompareExchange64 _InterlockedCompareExchange64 @@ -6328,9 +6280,12 @@ static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask) #define InterlockedIncrement _InterlockedIncrement #define InterlockedIncrement16 _InterlockedIncrement16 #define InterlockedOr _InterlockedOr +#define InterlockedXor _InterlockedXor #ifdef _MSC_VER +#pragma intrinsic(_BitScanForward) +#pragma intrinsic(_BitScanReverse) #pragma intrinsic(_InterlockedAnd) #pragma intrinsic(_InterlockedCompareExchange) #pragma intrinsic(_InterlockedCompareExchange64) @@ -6341,7 +6296,10 @@ static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask) #pragma intrinsic(_InterlockedDecrement) #pragma intrinsic(_InterlockedDecrement16) #pragma intrinsic(_InterlockedOr) +#pragma intrinsic(_InterlockedXor) +BOOLEAN _BitScanForward(unsigned long*,unsigned long); +BOOLEAN _BitScanReverse(unsigned long*,unsigned long); long _InterlockedAnd(long volatile *,long); long _InterlockedCompareExchange(long volatile*,long,long); long long _InterlockedCompareExchange64(long long volatile*,long long,long long); @@ -6352,6 +6310,12 @@ long _InterlockedExchangeAdd(long volatile*,long); long _InterlockedIncrement(long volatile*); short _InterlockedIncrement16(short volatile*); long _InterlockedOr(long volatile *,long); +long _InterlockedXor(long volatile *,long); + +static FORCEINLINE long InterlockedAdd( long volatile *dest, long val ) +{ + return InterlockedExchangeAdd( dest, val ) + val; +} #if !defined(__i386__) || _MSC_VER >= 1600 @@ -6412,6 +6376,23 @@ static FORCEINLINE void MemoryBarrier(void) #elif defined(__GNUC__) +static FORCEINLINE BOOLEAN WINAPI BitScanForward(DWORD *index, DWORD mask) +{ + *index = __builtin_ctz( mask ); + return mask != 0; +} + +static FORCEINLINE BOOLEAN WINAPI BitScanReverse(DWORD *index, DWORD mask) +{ + *index = 31 - __builtin_clz( mask ); + return mask != 0; +} + +static FORCEINLINE LONG WINAPI InterlockedAdd( LONG volatile *dest, LONG val ) +{ + return __sync_add_and_fetch( dest, val ); +} + static FORCEINLINE LONG WINAPI InterlockedAnd( LONG volatile *dest, LONG val ) { return __sync_fetch_and_and( dest, val ); @@ -6491,6 +6472,11 @@ static FORCEINLINE LONG WINAPI InterlockedOr( LONG volatile *dest, LONG val ) return __sync_fetch_and_or( dest, val ); } +static FORCEINLINE LONG WINAPI InterlockedXor( LONG volatile *dest, LONG val ) +{ + return __sync_fetch_and_xor( dest, val ); +} + static FORCEINLINE void MemoryBarrier(void) { __sync_synchronize();
1
0
0
0
← Newer
1
...
36
37
38
39
40
41
42
...
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