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
October 2021
----- 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
1165 discussions
Start a n
N
ew thread
Huw Davies : nsiproxy: Use an ascii version of str(n)casecmp() instead of _strnicmp().
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 280999aee223d604d60bf9c8c845ab0557a6005e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=280999aee223d604d60bf9c8…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Oct 1 15:07:04 2021 +0100 nsiproxy: Use an ascii version of str(n)casecmp() instead of _strnicmp(). Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsiproxy.sys/ip.c | 22 +++++++++++----------- dlls/nsiproxy.sys/ndis.c | 2 +- dlls/nsiproxy.sys/nsiproxy_private.h | 21 +++++++++++++++++++++ dlls/nsiproxy.sys/tcp.c | 4 ++-- dlls/nsiproxy.sys/udp.c | 6 +++--- 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c index 12fae3f2f12..7308e4a687e 100644 --- a/dlls/nsiproxy.sys/ip.c +++ b/dlls/nsiproxy.sys/ip.c @@ -261,10 +261,10 @@ static NTSTATUS ipv4_icmpstats_get_all_parameters( const void *key, DWORD key_si while ((ptr = fgets( buf, sizeof(buf), fp ))) { - if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue; + if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue; /* last line was a header, get another */ if (!(ptr = fgets( buf, sizeof(buf), fp ))) break; - if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 )) + if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) { ptr += sizeof(hdr); sscanf( ptr, "%u %u %*u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u", @@ -427,13 +427,13 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si while (*value == ' ') value++; if ((ptr = strchr( value, '\n' ))) *ptr='\0'; - if (!_strnicmp( buf, "Icmp6InMsgs", -1 )) + if (!ascii_strcasecmp( buf, "Icmp6InMsgs" )) { if (sscanf( value, "%d", &res )) dyn.in_msgs = res; continue; } - if (!_strnicmp( buf, "Icmp6InErrors", -1 )) + if (!ascii_strcasecmp( buf, "Icmp6InErrors" )) { if (sscanf( value, "%d", &res )) dyn.in_errors = res; continue; @@ -441,7 +441,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si for (i = 0; i < ARRAY_SIZE(in_list); i++) { - if (!_strnicmp( buf, in_list[i].name, -1 )) + if (!ascii_strcasecmp( buf, in_list[i].name )) { if (sscanf( value, "%d", &res )) dyn.in_type_counts[in_list[i].pos] = res; @@ -449,13 +449,13 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si } } - if (!_strnicmp( buf, "Icmp6OutMsgs", -1 )) + if (!ascii_strcasecmp( buf, "Icmp6OutMsgs" )) { if (sscanf( value, "%d", &res )) dyn.out_msgs = res; continue; } - if (!_strnicmp( buf, "Icmp6OutErrors", -1 )) + if (!ascii_strcasecmp( buf, "Icmp6OutErrors" )) { if (sscanf( value, "%d", &res )) dyn.out_errors = res; continue; @@ -463,7 +463,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si for (i = 0; i < ARRAY_SIZE(out_list); i++) { - if (!_strnicmp( buf, out_list[i].name, -1 )) + if (!ascii_strcasecmp( buf, out_list[i].name )) { if (sscanf( value, "%d", &res )) dyn.out_type_counts[out_list[i].pos] = res; @@ -504,10 +504,10 @@ static NTSTATUS ipv4_ipstats_get_all_parameters( const void *key, DWORD key_size while ((ptr = fgets( buf, sizeof(buf), fp ))) { - if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue; + if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue; /* last line was a header, get another */ if (!(ptr = fgets( buf, sizeof(buf), fp ))) break; - if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 )) + if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) { DWORD in_recv, in_hdr_errs, fwd_dgrams, in_delivers, out_reqs; ptr += sizeof(hdr); @@ -643,7 +643,7 @@ static NTSTATUS ipv6_ipstats_get_all_parameters( const void *key, DWORD key_size if ((ptr = strchr( value, '\n' ))) *ptr = '\0'; for (i = 0; i < ARRAY_SIZE(ipstatlist); i++) - if (!_strnicmp( buf, ipstatlist[i].name, -1 )) + if (!ascii_strcasecmp( buf, ipstatlist[i].name )) { if (ipstatlist[i].size == sizeof(long)) *(long *)ipstatlist[i].elem = strtoul( value, NULL, 10 ); diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c index 1d0e69c593c..b46b53b536c 100644 --- a/dlls/nsiproxy.sys/ndis.c +++ b/dlls/nsiproxy.sys/ndis.c @@ -354,7 +354,7 @@ static void ifinfo_fill_dynamic( struct if_entry *entry, struct nsi_ndis_ifinfo_ while ((ptr = fgets( buf, sizeof(buf), fp ))) { while (*ptr && isspace( *ptr )) ptr++; - if (!_strnicmp( ptr, entry->if_unix_name, name_len ) && ptr[name_len] == ':') + if (!ascii_strncasecmp( ptr, entry->if_unix_name, name_len ) && ptr[name_len] == ':') { unsigned long long values[9]; ptr += name_len + 1; diff --git a/dlls/nsiproxy.sys/nsiproxy_private.h b/dlls/nsiproxy.sys/nsiproxy_private.h index 7dd8748e3f7..acc60ce4806 100644 --- a/dlls/nsiproxy.sys/nsiproxy_private.h +++ b/dlls/nsiproxy.sys/nsiproxy_private.h @@ -135,3 +135,24 @@ extern const struct module ipv4_module DECLSPEC_HIDDEN; extern const struct module ipv6_module DECLSPEC_HIDDEN; extern const struct module tcp_module DECLSPEC_HIDDEN; extern const struct module udp_module DECLSPEC_HIDDEN; + +static inline int ascii_strncasecmp( const char *s1, const char *s2, size_t n ) +{ + int l1, l2; + + while (n--) + { + l1 = (unsigned char)((*s1 >= 'A' && *s1 <= 'Z') ? *s1 + ('a' - 'A') : *s1); + l2 = (unsigned char)((*s2 >= 'A' && *s2 <= 'Z') ? *s2 + ('a' - 'A') : *s2); + if (l1 != l2) return l1 - l2; + if (!l1) return 0; + s1++; + s2++; + } + return 0; +} + +static inline int ascii_strcasecmp( const char *s1, const char *s2 ) +{ + return ascii_strncasecmp( s1, s2, -1 ); +} diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c index f9ddf1a2b23..6b431e93c8e 100644 --- a/dlls/nsiproxy.sys/tcp.c +++ b/dlls/nsiproxy.sys/tcp.c @@ -147,10 +147,10 @@ static NTSTATUS tcp_stats_get_all_parameters( const void *key, DWORD key_size, v while ((ptr = fgets( buf, sizeof(buf), fp ))) { - if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue; + if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue; /* last line was a header, get another */ if (!(ptr = fgets( buf, sizeof(buf), fp ))) break; - if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 )) + if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) { DWORD in_segs, out_segs; ptr += sizeof(hdr); diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c index a0ace071753..c2dcc2c38e8 100644 --- a/dlls/nsiproxy.sys/udp.c +++ b/dlls/nsiproxy.sys/udp.c @@ -123,10 +123,10 @@ static NTSTATUS udp_stats_get_all_parameters( const void *key, DWORD key_size, v while ((ptr = fgets( buf, sizeof(buf), fp ))) { - if (_strnicmp( buf, hdr, sizeof(hdr) - 1) ) continue; + if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue; /* last line was a header, get another */ if (!(ptr = fgets( buf, sizeof(buf), fp ))) break; - if (!_strnicmp(buf, hdr, sizeof(hdr) - 1)) + if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) { unsigned int in_dgrams, out_dgrams; ptr += sizeof(hdr); @@ -176,7 +176,7 @@ static NTSTATUS udp_stats_get_all_parameters( const void *key, DWORD key_size, v if ((ptr = strchr( value, '\n' ))) *ptr='\0'; for (i = 0; i < ARRAY_SIZE(udp_stat_list); i++) - if (!_strnicmp( buf, udp_stat_list[i].name, -1 ) && sscanf( value, "%d", &res )) + if (!ascii_strcasecmp( buf, udp_stat_list[i].name ) && sscanf( value, "%d", &res )) *udp_stat_list[i].elem = res; } dyn.in_dgrams = in_dgrams;
1
0
0
0
Huw Davies : nsiproxy: Use a pthread_mutex to guard the interface list.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 7199f32c0b4014785f048bc318ea59dd695d2ca4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7199f32c0b4014785f048bc3…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Oct 1 15:07:03 2021 +0100 nsiproxy: Use a pthread_mutex to guard the interface list. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsiproxy.sys/ndis.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c index bf237ea16db..1d0e69c593c 100644 --- a/dlls/nsiproxy.sys/ndis.c +++ b/dlls/nsiproxy.sys/ndis.c @@ -66,6 +66,8 @@ #include <net/if_types.h> #endif +#include <pthread.h> + #define NONAMELESSUNION #include "ntstatus.h" #define WIN32_NO_STATUS @@ -102,15 +104,7 @@ struct if_entry }; static struct list if_list = LIST_INIT( if_list ); - -static CRITICAL_SECTION if_list_cs; -static CRITICAL_SECTION_DEBUG if_list_cs_debug = -{ - 0, 0, &if_list_cs, - { &if_list_cs_debug.ProcessLocksList, &if_list_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": if_list_cs") } -}; -static CRITICAL_SECTION if_list_cs = { &if_list_cs_debug, -1, 0, 0, 0, 0 }; +static pthread_mutex_t if_list_lock = PTHREAD_MUTEX_INITIALIZER; static struct if_entry *find_entry_from_index( DWORD index ) { @@ -468,7 +462,7 @@ static NTSTATUS ifinfo_enumerate_all( void *key_data, DWORD key_size, void *rw_d TRACE( "%p %d %p %d %p %d %p %d %p\n", key_data, key_size, rw_data, rw_size, dynamic_data, dynamic_size, static_data, static_size, count ); - EnterCriticalSection( &if_list_cs ); + pthread_mutex_lock( &if_list_lock ); update_if_table(); @@ -485,7 +479,7 @@ static NTSTATUS ifinfo_enumerate_all( void *key_data, DWORD key_size, void *rw_d num++; } - LeaveCriticalSection( &if_list_cs ); + pthread_mutex_unlock( &if_list_lock ); if (!want_data || num <= *count) *count = num; else status = STATUS_BUFFER_OVERFLOW; @@ -503,7 +497,7 @@ static NTSTATUS ifinfo_get_all_parameters( const void *key, DWORD key_size, void TRACE( "%p %d %p %d %p %d %p %d\n", key, key_size, rw_data, rw_size, dynamic_data, dynamic_size, static_data, static_size ); - EnterCriticalSection( &if_list_cs ); + pthread_mutex_lock( &if_list_lock ); update_if_table(); @@ -514,7 +508,7 @@ static NTSTATUS ifinfo_get_all_parameters( const void *key, DWORD key_size, void status = STATUS_SUCCESS; } - LeaveCriticalSection( &if_list_cs ); + pthread_mutex_unlock( &if_list_lock ); return status; } @@ -565,7 +559,7 @@ static NTSTATUS ifinfo_get_parameter( const void *key, DWORD key_size, DWORD par TRACE( "%p %d %d %p %d %d\n", key, key_size, param_type, data, data_size, data_offset ); - EnterCriticalSection( &if_list_cs ); + pthread_mutex_lock( &if_list_lock ); update_if_table(); @@ -583,7 +577,7 @@ static NTSTATUS ifinfo_get_parameter( const void *key, DWORD key_size, DWORD par } } - LeaveCriticalSection( &if_list_cs ); + pthread_mutex_unlock( &if_list_lock ); return status; } @@ -599,7 +593,7 @@ static NTSTATUS index_luid_get_parameter( const void *key, DWORD key_size, DWORD if (param_type != NSI_PARAM_TYPE_STATIC || data_size != sizeof(NET_LUID) || data_offset != 0) return STATUS_INVALID_PARAMETER; - EnterCriticalSection( &if_list_cs ); + pthread_mutex_lock( &if_list_lock ); update_if_table(); @@ -609,7 +603,7 @@ static NTSTATUS index_luid_get_parameter( const void *key, DWORD key_size, DWORD *(NET_LUID *)data = entry->if_luid; status = STATUS_SUCCESS; } - LeaveCriticalSection( &if_list_cs ); + pthread_mutex_unlock( &if_list_lock ); return status; } @@ -618,7 +612,7 @@ BOOL convert_unix_name_to_luid( const char *unix_name, NET_LUID *luid ) struct if_entry *entry; BOOL ret = FALSE; - EnterCriticalSection( &if_list_cs ); + pthread_mutex_lock( &if_list_lock ); update_if_table(); @@ -629,7 +623,7 @@ BOOL convert_unix_name_to_luid( const char *unix_name, NET_LUID *luid ) ret = TRUE; break; } - LeaveCriticalSection( &if_list_cs ); + pthread_mutex_unlock( &if_list_lock ); return ret; } @@ -639,7 +633,7 @@ BOOL convert_luid_to_unix_name( const NET_LUID *luid, const char **unix_name ) struct if_entry *entry; BOOL ret = FALSE; - EnterCriticalSection( &if_list_cs ); + pthread_mutex_lock( &if_list_lock ); update_if_table(); @@ -650,7 +644,7 @@ BOOL convert_luid_to_unix_name( const NET_LUID *luid, const char **unix_name ) ret = TRUE; } - LeaveCriticalSection( &if_list_cs ); + pthread_mutex_unlock( &if_list_lock ); return ret; }
1
0
0
0
Lauri Kenttä : po: Update Finnish translation.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 6ea113fa980e488b2e17722ce73f7668f48fc0a1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6ea113fa980e488b2e17722c…
Author: Lauri Kenttä <lauri.kentta(a)gmail.com> Date: Fri Oct 1 15:38:03 2021 +0300 po: Update Finnish translation. Signed-off-by: Lauri Kenttä <lauri.kentta(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- po/fi.po | 222 +++++++++++++++++++-------------------------------------------- 1 file changed, 66 insertions(+), 156 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=6ea113fa980e488b2e17…
1
0
0
0
Ivo Ivanov : hidparse.sys: Preserve the original report_count in parse_new_value_caps.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: d97426be026e16f8dddcc2a003bf19c477668183 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d97426be026e16f8dddcc2a0…
Author: Ivo Ivanov <logos128(a)gmail.com> Date: Fri Oct 1 09:51:04 2021 +0200 hidparse.sys: Preserve the original report_count in parse_new_value_caps. We force state->items.report_count to 1 while building the alternate value array, but the item is global and should be preserved across caps. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51822
Signed-off-by: Ivo Ivanov <logos128(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput8/tests/hid.c | 9 ++++----- dlls/hidparse.sys/main.c | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index e83cc8a3f7b..aac0da88908 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -1771,8 +1771,8 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, report, caps.InputReportByteLength ); ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsages returned %#x\n", status ); - buffer[6] = 2; - buffer[7] = 4; + buffer[13] = 2; + buffer[14] = 4; ok( !memcmp( buffer, report, caps.InputReportByteLength ), "unexpected report data\n" ); status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_LED, 0, 6, 1, preparsed_data, report, @@ -2460,8 +2460,7 @@ static void test_hid_driver( DWORD report_id, DWORD polled ) REPORT_COUNT(1, 8), REPORT_SIZE(1, 1), INPUT(1, Cnst|Var|Abs), - REPORT_COUNT(1, 8), - REPORT_SIZE(1, 1), + REPORT_SIZE(1, 8), INPUT(1, Cnst|Var|Abs), /* needs to be 8 bit aligned as next has Buff */ @@ -2682,7 +2681,7 @@ static void test_hid_driver( DWORD report_id, DWORD polled ) { .Usage = HID_USAGE_GENERIC_JOYSTICK, .UsagePage = HID_USAGE_PAGE_GENERIC, - .InputReportByteLength = report_id ? 25 : 26, + .InputReportByteLength = report_id ? 32 : 33, .OutputReportByteLength = report_id ? 2 : 3, .FeatureReportByteLength = report_id ? 21 : 22, .NumberLinkCollectionNodes = 10, diff --git a/dlls/hidparse.sys/main.c b/dlls/hidparse.sys/main.c index ca15a91c75a..18ee23974f0 100644 --- a/dlls/hidparse.sys/main.c +++ b/dlls/hidparse.sys/main.c @@ -360,6 +360,7 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY { struct hid_value_caps *values; USAGE usage_page = state->items.usage_page; + USHORT report_count = state->items.report_count; DWORD i, usages_size = max( 1, state->usages_size ); USHORT *byte_length = &state->byte_length[type]; ULONG start_bit, *bit_size = &state->bit_size[type][state->items.report_id]; @@ -408,6 +409,7 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY state->data_count[type] = state->items.data_index_max + 1; state->items.usage_page = usage_page; + state->items.report_count = report_count; reset_local_items( state ); return TRUE; }
1
0
0
0
Rémi Bernon : winebus.sys: Implement PID device control for UDEV lnxev devices.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 11fe73ed8f2d78f72502a05a93e20f84d81fa7b6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=11fe73ed8f2d78f72502a05a…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 1 09:31:08 2021 +0200 winebus.sys: Implement PID device control for UDEV lnxev devices. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_udev.c | 60 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index e4c0103b270..454ab3ea870 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -70,9 +70,9 @@ #include "ddk/wdm.h" #include "ddk/hidtypes.h" #include "ddk/hidsdi.h" + #include "wine/debug.h" -#include "wine/heap.h" -#include "wine/unicode.h" +#include "wine/hid.h" #ifdef HAS_PROPER_INPUT_HEADER # include "hidusage.h" @@ -140,6 +140,7 @@ struct lnxev_device BYTE button_map[KEY_MAX]; int haptic_effect_id; + int effect_ids[256]; }; static inline struct lnxev_device *lnxev_impl_from_unix_device(struct unix_device *iface) @@ -642,6 +643,8 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d return STATUS_NO_MEMORY; impl->haptic_effect_id = -1; + for (i = 0; i < ARRAY_SIZE(impl->effect_ids); ++i) impl->effect_ids[i] = -1; + if (test_bit(ffbits, FF_RUMBLE)) { effect.id = -1; @@ -811,9 +814,58 @@ static NTSTATUS lnxev_device_haptics_start(struct unix_device *iface, DWORD dura static NTSTATUS lnxev_device_physical_device_control(struct unix_device *iface, USAGE control) { - FIXME("iface %p, control %#04x stub!\n", iface, control); + struct lnxev_device *impl = lnxev_impl_from_unix_device(iface); + unsigned int i; - return STATUS_NOT_IMPLEMENTED; + TRACE("iface %p, control %#04x.\n", iface, control); + + switch (control) + { + case PID_USAGE_DC_ENABLE_ACTUATORS: + { + struct input_event ie = + { + .type = EV_FF, + .code = FF_GAIN, + .value = 0xffff, + }; + if (write(impl->base.device_fd, &ie, sizeof(ie)) == -1) + WARN("write failed %d %s\n", errno, strerror(errno)); + return STATUS_SUCCESS; + } + case PID_USAGE_DC_DISABLE_ACTUATORS: + { + struct input_event ie = + { + .type = EV_FF, + .code = FF_GAIN, + .value = 0, + }; + if (write(impl->base.device_fd, &ie, sizeof(ie)) == -1) + WARN("write failed %d %s\n", errno, strerror(errno)); + return STATUS_SUCCESS; + } + case PID_USAGE_DC_STOP_ALL_EFFECTS: + FIXME("stop all not implemented!\n"); + return STATUS_NOT_IMPLEMENTED; + case PID_USAGE_DC_DEVICE_RESET: + for (i = 0; i < ARRAY_SIZE(impl->effect_ids); ++i) + { + if (impl->effect_ids[i] < 0) continue; + if (ioctl(impl->base.device_fd, EVIOCRMFF, impl->effect_ids[i]) == -1) + WARN("couldn't free effect, EVIOCRMFF ioctl failed: %d %s\n", errno, strerror(errno)); + impl->effect_ids[i] = -1; + } + return STATUS_SUCCESS; + case PID_USAGE_DC_DEVICE_PAUSE: + WARN("device pause not supported\n"); + return STATUS_NOT_SUPPORTED; + case PID_USAGE_DC_DEVICE_CONTINUE: + WARN("device continue not supported\n"); + return STATUS_NOT_SUPPORTED; + } + + return STATUS_NOT_SUPPORTED; } static const struct hid_device_vtbl lnxev_device_vtbl =
1
0
0
0
Rémi Bernon : winebus.sys: Implement PID device control for SDL devices.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: eeb97fa605ab94b58d88625a5af4179d39d58f5f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=eeb97fa605ab94b58d88625a…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 1 09:31:07 2021 +0200 winebus.sys: Implement PID device control for SDL devices. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_sdl.c | 48 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index bd06717165d..772ee092c83 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -47,10 +47,11 @@ #include "ddk/wdm.h" #include "ddk/hidtypes.h" #include "ddk/hidsdi.h" -#include "wine/debug.h" -#include "wine/unicode.h" #include "hidusage.h" +#include "wine/debug.h" +#include "wine/hid.h" + #include "unix_private.h" WINE_DEFAULT_DEBUG_CHANNEL(plugplay); @@ -95,12 +96,15 @@ MAKE_FUNCPTR(SDL_HapticClose); MAKE_FUNCPTR(SDL_HapticDestroyEffect); MAKE_FUNCPTR(SDL_HapticNewEffect); MAKE_FUNCPTR(SDL_HapticOpenFromJoystick); +MAKE_FUNCPTR(SDL_HapticPause); MAKE_FUNCPTR(SDL_HapticQuery); MAKE_FUNCPTR(SDL_HapticRumbleInit); MAKE_FUNCPTR(SDL_HapticRumblePlay); MAKE_FUNCPTR(SDL_HapticRumbleSupported); MAKE_FUNCPTR(SDL_HapticRunEffect); +MAKE_FUNCPTR(SDL_HapticSetGain); MAKE_FUNCPTR(SDL_HapticStopAll); +MAKE_FUNCPTR(SDL_HapticUnpause); MAKE_FUNCPTR(SDL_JoystickIsHaptic); MAKE_FUNCPTR(SDL_GameControllerAddMapping); MAKE_FUNCPTR(SDL_RegisterEvents); @@ -130,6 +134,7 @@ struct sdl_device DWORD effect_support; SDL_Haptic *sdl_haptic; int haptic_effect_id; + int effect_ids[256]; }; static inline struct sdl_device *impl_from_unix_device(struct unix_device *iface) @@ -168,6 +173,8 @@ static void set_hat_value(struct unix_device *iface, int index, int value) static BOOL descriptor_add_haptic(struct sdl_device *impl) { + USHORT i; + if (!pSDL_JoystickIsHaptic(impl->sdl_joystick) || !(impl->sdl_haptic = pSDL_HapticOpenFromJoystick(impl->sdl_joystick))) impl->effect_support = 0; @@ -197,6 +204,7 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl) } impl->haptic_effect_id = -1; + for (i = 0; i < ARRAY_SIZE(impl->effect_ids); ++i) impl->effect_ids[i] = -1; return TRUE; } @@ -400,7 +408,38 @@ NTSTATUS sdl_device_haptics_start(struct unix_device *iface, DWORD duration_ms, static NTSTATUS sdl_device_physical_device_control(struct unix_device *iface, USAGE control) { - FIXME("iface %p, control %#04x stub\n", iface, control); + struct sdl_device *impl = impl_from_unix_device(iface); + unsigned int i; + + TRACE("iface %p, control %#04x.\n", iface, control); + + switch (control) + { + case PID_USAGE_DC_ENABLE_ACTUATORS: + pSDL_HapticSetGain(impl->sdl_haptic, 100); + return STATUS_SUCCESS; + case PID_USAGE_DC_DISABLE_ACTUATORS: + pSDL_HapticSetGain(impl->sdl_haptic, 0); + return STATUS_SUCCESS; + case PID_USAGE_DC_STOP_ALL_EFFECTS: + pSDL_HapticStopAll(impl->sdl_haptic); + return STATUS_SUCCESS; + case PID_USAGE_DC_DEVICE_RESET: + pSDL_HapticStopAll(impl->sdl_haptic); + for (i = 0; i < ARRAY_SIZE(impl->effect_ids); ++i) + { + if (impl->effect_ids[i] < 0) continue; + pSDL_HapticDestroyEffect(impl->sdl_haptic, impl->effect_ids[i]); + impl->effect_ids[i] = -1; + } + return STATUS_SUCCESS; + case PID_USAGE_DC_DEVICE_PAUSE: + pSDL_HapticPause(impl->sdl_haptic); + return STATUS_SUCCESS; + case PID_USAGE_DC_DEVICE_CONTINUE: + pSDL_HapticUnpause(impl->sdl_haptic); + return STATUS_SUCCESS; + } return STATUS_NOT_SUPPORTED; } @@ -665,12 +704,15 @@ NTSTATUS sdl_bus_init(void *args) LOAD_FUNCPTR(SDL_HapticDestroyEffect); LOAD_FUNCPTR(SDL_HapticNewEffect); LOAD_FUNCPTR(SDL_HapticOpenFromJoystick); + LOAD_FUNCPTR(SDL_HapticPause); LOAD_FUNCPTR(SDL_HapticQuery); LOAD_FUNCPTR(SDL_HapticRumbleInit); LOAD_FUNCPTR(SDL_HapticRumblePlay); LOAD_FUNCPTR(SDL_HapticRumbleSupported); LOAD_FUNCPTR(SDL_HapticRunEffect); + LOAD_FUNCPTR(SDL_HapticSetGain); LOAD_FUNCPTR(SDL_HapticStopAll); + LOAD_FUNCPTR(SDL_HapticUnpause); LOAD_FUNCPTR(SDL_JoystickIsHaptic); LOAD_FUNCPTR(SDL_GameControllerAddMapping); LOAD_FUNCPTR(SDL_RegisterEvents);
1
0
0
0
Rémi Bernon : dinput: Implement HID joystick IDirectInputDevice8_CreateEffect stub.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 4961876804d69f8dd6d8524bbaa77b4caf7a8175 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4961876804d69f8dd6d8524b…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 1 09:31:06 2021 +0200 dinput: Implement HID joystick IDirectInputDevice8_CreateEffect stub. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 169 ++++++++++++++++++++++++++++++++++++++++++++- dlls/dinput8/tests/hid.c | 3 +- 2 files changed, 169 insertions(+), 3 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index a43ecde0e9c..8f5dbee9dc3 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -120,6 +120,17 @@ static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputD struct hid_joystick, base ); } +struct hid_joystick_effect +{ + IDirectInputEffect IDirectInputEffect_iface; + LONG ref; +}; + +static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectInputEffect *iface ) +{ + return CONTAINING_RECORD( iface, struct hid_joystick_effect, IDirectInputEffect_iface ); +} + static const GUID *object_usage_to_guid( USAGE usage_page, USAGE usage ) { switch (usage_page) @@ -803,16 +814,39 @@ static HRESULT WINAPI hid_joystick_GetDeviceInfo( IDirectInputDevice8W *iface, D return S_OK; } +static HRESULT hid_joystick_effect_create( IDirectInputEffect **out ); + static HRESULT WINAPI hid_joystick_CreateEffect( IDirectInputDevice8W *iface, const GUID *guid, const DIEFFECT *params, IDirectInputEffect **out, IUnknown *outer ) { - FIXME( "iface %p, guid %s, params %p, out %p, outer %p stub!\n", iface, debugstr_guid( guid ), + struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); + DWORD flags = DIEP_ALLPARAMS; + HRESULT hr; + + TRACE( "iface %p, guid %s, params %p, out %p, outer %p\n", iface, debugstr_guid( guid ), params, out, outer ); if (!out) return E_POINTER; + *out = NULL; - return DIERR_UNSUPPORTED; + if (!(impl->dev_caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; + if (FAILED(hr = hid_joystick_effect_create( out ))) return hr; + + hr = IDirectInputEffect_Initialize( *out, DINPUT_instance, impl->base.dinput->dwVersion, guid ); + if (FAILED(hr)) goto failed; + + if (!params) return DI_OK; + if (!impl->base.acquired || !(impl->base.dwCoopLevel & DISCL_EXCLUSIVE)) + flags |= DIEP_NODOWNLOAD; + hr = IDirectInputEffect_SetParameters( *out, params, flags ); + if (FAILED(hr)) goto failed; + return hr; + +failed: + IDirectInputEffect_Release( *out ); + *out = NULL; + return hr; } static HRESULT WINAPI hid_joystick_EnumEffects( IDirectInputDevice8W *iface, LPDIENUMEFFECTSCALLBACKW callback, @@ -1721,3 +1755,134 @@ const struct dinput_device joystick_hid_device = hid_joystick_enum_device, hid_joystick_create_device, }; + +static HRESULT WINAPI hid_joystick_effect_QueryInterface( IDirectInputEffect *iface, REFIID iid, void **out ) +{ + TRACE( "iface %p, iid %s, out %p\n", iface, debugstr_guid( iid ), out ); + + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IDirectInputEffect )) + { + IDirectInputEffect_AddRef( iface ); + *out = iface; + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI hid_joystick_effect_AddRef( IDirectInputEffect *iface ) +{ + struct hid_joystick_effect *impl = impl_from_IDirectInputEffect( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p, ref %u.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI hid_joystick_effect_Release( IDirectInputEffect *iface ) +{ + struct hid_joystick_effect *impl = impl_from_IDirectInputEffect( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p, ref %u.\n", iface, ref ); + if (!ref) HeapFree( GetProcessHeap(), 0, impl ); + return ref; +} + +static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface, HINSTANCE inst, + DWORD version, REFGUID guid ) +{ + FIXME( "iface %p, inst %p, version %u, guid %s stub!\n", iface, inst, version, debugstr_guid( guid ) ); + return DI_OK; +} + +static HRESULT WINAPI hid_joystick_effect_GetEffectGuid( IDirectInputEffect *iface, GUID *guid ) +{ + FIXME( "iface %p, guid %p stub!\n", iface, guid ); + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_GetParameters( IDirectInputEffect *iface, DIEFFECT *params, DWORD flags ) +{ + FIXME( "iface %p, params %p, flags %#x stub!\n", iface, params, flags ); + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *iface, + const DIEFFECT *params, DWORD flags ) +{ + FIXME( "iface %p, params %p, flags %#x stub!\n", iface, params, flags ); + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_Start( IDirectInputEffect *iface, DWORD iterations, DWORD flags ) +{ + FIXME( "iface %p, iterations %u, flags %#x stub!\n", iface, iterations, flags ); + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_Stop( IDirectInputEffect *iface ) +{ + FIXME( "iface %p stub!\n", iface ); + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_GetEffectStatus( IDirectInputEffect *iface, DWORD *status ) +{ + FIXME( "iface %p, status %p stub!\n", iface, status ); + + if (!status) return E_POINTER; + + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) +{ + FIXME( "iface %p stub!\n", iface ); + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_Unload( IDirectInputEffect *iface ) +{ + FIXME( "iface %p stub!\n", iface ); + return DIERR_UNSUPPORTED; +} + +static HRESULT WINAPI hid_joystick_effect_Escape( IDirectInputEffect *iface, DIEFFESCAPE *escape ) +{ + FIXME( "iface %p, escape %p stub!\n", iface, escape ); + return DIERR_UNSUPPORTED; +} + +static IDirectInputEffectVtbl hid_joystick_effect_vtbl = +{ + /*** IUnknown methods ***/ + hid_joystick_effect_QueryInterface, + hid_joystick_effect_AddRef, + hid_joystick_effect_Release, + /*** IDirectInputEffect methods ***/ + hid_joystick_effect_Initialize, + hid_joystick_effect_GetEffectGuid, + hid_joystick_effect_GetParameters, + hid_joystick_effect_SetParameters, + hid_joystick_effect_Start, + hid_joystick_effect_Stop, + hid_joystick_effect_GetEffectStatus, + hid_joystick_effect_Download, + hid_joystick_effect_Unload, + hid_joystick_effect_Escape, +}; + +static HRESULT hid_joystick_effect_create( IDirectInputEffect **out ) +{ + struct hid_joystick_effect *impl; + + if (!(impl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*impl) ))) + return DIERR_OUTOFMEMORY; + impl->IDirectInputEffect_iface.lpVtbl = &hid_joystick_effect_vtbl; + impl->ref = 1; + + *out = &impl->IDirectInputEffect_iface; + return DI_OK; +} diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 7c46f19cc40..e83cc8a3f7b 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5066,12 +5066,13 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL ); todo_wine ok( hr == E_POINTER, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + if (hr == DI_OK) IDirectInputEffect_Release( effect ); hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL ); todo_wine ok( hr == DIERR_DEVICENOTREG, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + if (hr == DI_OK) IDirectInputEffect_Release( effect ); hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL ); - todo_wine ok( hr == DI_OK, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); if (hr != DI_OK) return;
1
0
0
0
Rémi Bernon : dinput: Implement HID joystick IDirectInputDevice8_EnumEffects.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 5b8daecabff01447e65db2df42fa165fbbe660b5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5b8daecabff01447e65db2df…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 1 09:31:05 2021 +0200 dinput: Implement HID joystick IDirectInputDevice8_EnumEffects. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 63 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index ac67625cddc..a43ecde0e9c 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -818,10 +818,71 @@ static HRESULT WINAPI hid_joystick_CreateEffect( IDirectInputDevice8W *iface, co static HRESULT WINAPI hid_joystick_EnumEffects( IDirectInputDevice8W *iface, LPDIENUMEFFECTSCALLBACKW callback, void *context, DWORD type ) { - FIXME( "iface %p, callback %p, context %p, type %#x stub!\n", iface, callback, context, type ); + DIEFFECTINFOW info = {.dwSize = sizeof(info)}; + HRESULT hr; + + TRACE( "iface %p, callback %p, context %p, type %#x.\n", iface, callback, context, type ); if (!callback) return DIERR_INVALIDPARAM; + type = DIEFT_GETTYPE( type ); + + if (type == DIEFT_ALL || type == DIEFT_CONSTANTFORCE) + { + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_ConstantForce ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + } + + if (type == DIEFT_ALL || type == DIEFT_RAMPFORCE) + { + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_RampForce ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + } + + if (type == DIEFT_ALL || type == DIEFT_PERIODIC) + { + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Square ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Sine ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Triangle ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_SawtoothUp ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_SawtoothDown ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + } + + if (type == DIEFT_ALL || type == DIEFT_CONDITION) + { + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Spring ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Damper ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Inertia ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + + hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Friction ); + if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr; + if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK; + } + return DI_OK; }
1
0
0
0
Rémi Bernon : dinput: Send DISFFC_RESET command on HID joystick (Un)Acquire.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 84e586124c92d00335433e75b9c95ca89a6b9150 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=84e586124c92d00335433e75…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 1 09:31:04 2021 +0200 dinput: Send DISFFC_RESET command on HID joystick (Un)Acquire. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 4 ++++ dlls/dinput8/tests/hid.c | 12 ++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index b6c4c960521..ac67625cddc 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -707,6 +707,8 @@ static HRESULT WINAPI hid_joystick_Acquire( IDirectInputDevice8W *iface ) impl->read_ovl.hEvent = impl->base.read_event; if (ReadFile( impl->device, impl->input_report_buf, report_len, NULL, &impl->read_ovl )) impl->base.read_callback( iface ); + + IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET ); } LeaveCriticalSection( &impl->base.crit ); @@ -726,6 +728,8 @@ static HRESULT WINAPI hid_joystick_Unacquire( IDirectInputDevice8W *iface ) { ret = CancelIoEx( impl->device, &impl->read_ovl ); if (!ret) WARN( "CancelIoEx failed, last error %u\n", GetLastError() ); + + IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET ); } hr = IDirectInputDevice2WImpl_Unacquire( iface ); LeaveCriticalSection( &impl->base.crit ); diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 618fb4e4c7c..7c46f19cc40 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5259,14 +5259,6 @@ static void test_force_feedback_joystick( void ) .report_len = 2, .report_buf = {1, 0x01}, }; - struct hid_expect expect_dc_reset_todo = - { - .code = IOCTL_HID_WRITE_REPORT, - .todo = TRUE, - .report_id = 1, - .report_len = 2, - .report_buf = {1, 0x01}, - }; const DIDEVICEINSTANCEW expect_devinst = { @@ -5775,7 +5767,7 @@ static void test_force_feedback_joystick( void ) hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE ); ok( hr == DI_OK, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr ); - set_hid_expect( file, &expect_dc_reset_todo, sizeof(expect_dc_reset_todo) ); + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); @@ -5821,7 +5813,7 @@ static void test_force_feedback_joystick( void ) test_periodic_effect( device, file ); - set_hid_expect( file, &expect_dc_reset_todo, sizeof(expect_dc_reset_todo) ); + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 );
1
0
0
0
Rémi Bernon : dinput: Start and cancel reading HID reports while holding the CS.
by Alexandre Julliard
01 Oct '21
01 Oct '21
Module: wine Branch: master Commit: 9a9a1656c1a154425b920168bbdd5aaaa3b27d22 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9a9a1656c1a154425b920168…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 1 09:31:03 2021 +0200 dinput: Start and cancel reading HID reports while holding the CS. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index aee8118191f..b6c4c960521 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -699,14 +699,18 @@ static HRESULT WINAPI hid_joystick_Acquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface ); - if ((hr = IDirectInputDevice2WImpl_Acquire( iface )) != DI_OK) return hr; - - memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) ); - impl->read_ovl.hEvent = impl->base.read_event; - if (ReadFile( impl->device, impl->input_report_buf, report_len, NULL, &impl->read_ovl )) - impl->base.read_callback( iface ); + EnterCriticalSection( &impl->base.crit ); + hr = IDirectInputDevice2WImpl_Acquire( iface ); + if (hr == DI_OK) + { + memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) ); + impl->read_ovl.hEvent = impl->base.read_event; + if (ReadFile( impl->device, impl->input_report_buf, report_len, NULL, &impl->read_ovl )) + impl->base.read_callback( iface ); + } + LeaveCriticalSection( &impl->base.crit ); - return DI_OK; + return hr; } static HRESULT WINAPI hid_joystick_Unacquire( IDirectInputDevice8W *iface ) @@ -717,12 +721,16 @@ static HRESULT WINAPI hid_joystick_Unacquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface ); - if ((hr = IDirectInputDevice2WImpl_Unacquire( iface )) != DI_OK) return hr; - - ret = CancelIoEx( impl->device, &impl->read_ovl ); - if (!ret) WARN( "CancelIoEx failed, last error %u\n", GetLastError() ); + EnterCriticalSection( &impl->base.crit ); + if (impl->base.acquired) + { + ret = CancelIoEx( impl->device, &impl->read_ovl ); + if (!ret) WARN( "CancelIoEx failed, last error %u\n", GetLastError() ); + } + hr = IDirectInputDevice2WImpl_Unacquire( iface ); + LeaveCriticalSection( &impl->base.crit ); - return DI_OK; + return hr; } static HRESULT WINAPI hid_joystick_GetDeviceState( IDirectInputDevice8W *iface, DWORD len, void *ptr )
1
0
0
0
← Newer
1
...
110
111
112
113
114
115
116
117
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Results per page:
10
25
50
100
200