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
Rémi Bernon : winebus.sys: Implement PID effect update for SDL devices.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: 2dd369044db4c30004c3ac090d6de3b9c6a076c8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2dd369044db4c30004c3ac09…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Oct 5 08:43:24 2021 +0200 winebus.sys: Implement PID effect update 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 | 93 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 2 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 9c2112f8e56..de1aa2363fd 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -106,6 +106,7 @@ MAKE_FUNCPTR(SDL_HapticSetGain); MAKE_FUNCPTR(SDL_HapticStopAll); MAKE_FUNCPTR(SDL_HapticStopEffect); MAKE_FUNCPTR(SDL_HapticUnpause); +MAKE_FUNCPTR(SDL_HapticUpdateEffect); MAKE_FUNCPTR(SDL_JoystickIsHaptic); MAKE_FUNCPTR(SDL_GameControllerAddMapping); MAKE_FUNCPTR(SDL_RegisterEvents); @@ -478,12 +479,99 @@ static NTSTATUS sdl_device_physical_effect_control(struct unix_device *iface, BY return STATUS_SUCCESS; } +static NTSTATUS set_effect_type_from_usage(SDL_HapticEffect *effect, USAGE type) +{ + switch (type) + { + case PID_USAGE_ET_SINE: + effect->type = SDL_HAPTIC_SINE; + return STATUS_SUCCESS; + case PID_USAGE_ET_TRIANGLE: + effect->type = SDL_HAPTIC_TRIANGLE; + return STATUS_SUCCESS; + case PID_USAGE_ET_SAWTOOTH_UP: + effect->type = SDL_HAPTIC_SAWTOOTHUP; + return STATUS_SUCCESS; + case PID_USAGE_ET_SAWTOOTH_DOWN: + effect->type = SDL_HAPTIC_SAWTOOTHDOWN; + return STATUS_SUCCESS; + case PID_USAGE_ET_SPRING: + effect->type = SDL_HAPTIC_SPRING; + return STATUS_SUCCESS; + case PID_USAGE_ET_DAMPER: + effect->type = SDL_HAPTIC_DAMPER; + return STATUS_SUCCESS; + case PID_USAGE_ET_INERTIA: + effect->type = SDL_HAPTIC_INERTIA; + return STATUS_SUCCESS; + case PID_USAGE_ET_FRICTION: + effect->type = SDL_HAPTIC_FRICTION; + return STATUS_SUCCESS; + case PID_USAGE_ET_CONSTANT_FORCE: + effect->type = SDL_HAPTIC_CONSTANT; + return STATUS_SUCCESS; + case PID_USAGE_ET_RAMP: + effect->type = SDL_HAPTIC_RAMP; + return STATUS_SUCCESS; + case PID_USAGE_ET_CUSTOM_FORCE_DATA: + effect->type = SDL_HAPTIC_CUSTOM; + return STATUS_SUCCESS; + default: + return STATUS_NOT_SUPPORTED; + } +} + static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYTE index, struct effect_params *params) { - FIXME("iface %p, index %u, params %p stub!\n", iface, index, params); + struct sdl_device *impl = impl_from_unix_device(iface); + int id = impl->effect_ids[index]; + SDL_HapticEffect effect = {0}; + NTSTATUS status; - return STATUS_NOT_IMPLEMENTED; + TRACE("iface %p, index %u, params %p.\n", iface, index, params); + + if ((status = set_effect_type_from_usage(&effect, params->effect_type))) return status; + + switch (params->effect_type) + { + case PID_USAGE_ET_SINE: + case PID_USAGE_ET_SQUARE: + case PID_USAGE_ET_TRIANGLE: + case PID_USAGE_ET_SAWTOOTH_UP: + case PID_USAGE_ET_SAWTOOTH_DOWN: + FIXME("periodic effect semi-stub!"); + effect.periodic.length = params->duration; + effect.periodic.delay = params->start_delay; + effect.periodic.button = params->trigger_button; + effect.periodic.interval = params->trigger_repeat_interval; + effect.periodic.direction.type = SDL_HAPTIC_SPHERICAL; + effect.periodic.direction.dir[0] = params->direction[0] * 36000 / 256; + effect.periodic.direction.dir[1] = params->direction[1] * 36000 / 256; + break; + + case PID_USAGE_ET_SPRING: + case PID_USAGE_ET_DAMPER: + case PID_USAGE_ET_INERTIA: + case PID_USAGE_ET_FRICTION: + FIXME("not implemented!"); + break; + + case PID_USAGE_ET_CONSTANT_FORCE: + FIXME("not implemented!"); + break; + case PID_USAGE_ET_RAMP: + FIXME("not implemented!"); + break; + case PID_USAGE_ET_CUSTOM_FORCE_DATA: + FIXME("not implemented!"); + break; + } + + if (id < 0) impl->effect_ids[index] = pSDL_HapticNewEffect(impl->sdl_haptic, &effect); + else pSDL_HapticUpdateEffect(impl->sdl_haptic, id, &effect); + + return STATUS_SUCCESS; } static const struct hid_device_vtbl sdl_device_vtbl = @@ -758,6 +846,7 @@ NTSTATUS sdl_bus_init(void *args) LOAD_FUNCPTR(SDL_HapticStopAll); LOAD_FUNCPTR(SDL_HapticStopEffect); LOAD_FUNCPTR(SDL_HapticUnpause); + LOAD_FUNCPTR(SDL_HapticUpdateEffect); LOAD_FUNCPTR(SDL_JoystickIsHaptic); LOAD_FUNCPTR(SDL_GameControllerAddMapping); LOAD_FUNCPTR(SDL_RegisterEvents);
1
0
0
0
Rémi Bernon : dinput: Look for the PID effect update output report.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: c436b54673b338d8c7e3850a6e612f83c29cf501 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c436b54673b338d8c7e3850a…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Oct 5 08:43:23 2021 +0200 dinput: Look for the PID effect update output report. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 95ee04d9e82..ba968ec516d 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -85,6 +85,19 @@ struct pid_control_report ULONG control_coll; }; +struct pid_effect_update +{ + BYTE id; + ULONG collection; + ULONG type_coll; + struct hid_value_caps *duration_caps; + struct hid_value_caps *gain_caps; + struct hid_value_caps *sample_period_caps; + struct hid_value_caps *start_delay_caps; + struct hid_value_caps *trigger_button_caps; + struct hid_value_caps *trigger_repeat_interval_caps; +}; + #define DEVICE_STATE_MAX_SIZE 1024 struct hid_joystick @@ -115,6 +128,7 @@ struct hid_joystick struct list effect_list; struct pid_control_report pid_device_control; struct pid_control_report pid_effect_control; + struct pid_effect_update pid_effect_update; }; static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) @@ -1589,6 +1603,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * { struct pid_control_report *device_control = &impl->pid_device_control; struct pid_control_report *effect_control = &impl->pid_effect_control; + struct pid_effect_update *effect_update = &impl->pid_effect_update; #define SET_COLLECTION( rep ) \ do \ @@ -1613,9 +1628,14 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * { case PID_USAGE_DEVICE_CONTROL_REPORT: SET_COLLECTION( device_control ); break; case PID_USAGE_EFFECT_OPERATION_REPORT: SET_COLLECTION( effect_control ); break; + case PID_USAGE_SET_EFFECT_REPORT: SET_COLLECTION( effect_update ); break; case PID_USAGE_DEVICE_CONTROL: SET_SUB_COLLECTION( device_control, control_coll ); break; case PID_USAGE_EFFECT_OPERATION: SET_SUB_COLLECTION( effect_control, control_coll ); break; + case PID_USAGE_EFFECT_TYPE: + if (instance->wCollectionNumber == effect_update->collection) + SET_SUB_COLLECTION( effect_update, type_coll ); + break; } } @@ -1630,6 +1650,7 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap { struct pid_control_report *device_control = &impl->pid_device_control; struct pid_control_report *effect_control = &impl->pid_effect_control; + struct pid_effect_update *effect_update = &impl->pid_effect_update; if (!(instance->dwType & DIDFT_OUTPUT)) return DIENUM_CONTINUE; @@ -1646,6 +1667,24 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap SET_REPORT_ID( device_control ); if (instance->wCollectionNumber == effect_control->control_coll) SET_REPORT_ID( effect_control ); + if (instance->wCollectionNumber == effect_update->type_coll) + SET_REPORT_ID( effect_update ); + if (instance->wCollectionNumber == effect_update->collection) + { + SET_REPORT_ID( effect_update ); + if (instance->wUsage == PID_USAGE_DURATION) + effect_update->duration_caps = caps; + if (instance->wUsage == PID_USAGE_GAIN) + effect_update->gain_caps = caps; + if (instance->wUsage == PID_USAGE_SAMPLE_PERIOD) + effect_update->sample_period_caps = caps; + if (instance->wUsage == PID_USAGE_START_DELAY) + effect_update->start_delay_caps = caps; + if (instance->wUsage == PID_USAGE_TRIGGER_BUTTON) + effect_update->trigger_button_caps = caps; + if (instance->wUsage == PID_USAGE_TRIGGER_REPEAT_INTERVAL) + effect_update->trigger_repeat_interval_caps = caps; + } #undef SET_REPORT_ID @@ -1750,10 +1789,14 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID TRACE( "device control id %u, coll %u, control coll %u\n", impl->pid_device_control.id, impl->pid_device_control.collection, impl->pid_device_control.control_coll ); TRACE( "effect control id %u, coll %u\n", impl->pid_effect_control.id, impl->pid_effect_control.collection ); + TRACE( "effect update id %u, coll %u, type_coll %u\n", impl->pid_effect_update.id, + impl->pid_effect_update.collection, impl->pid_effect_update.type_coll ); if (impl->pid_device_control.id) { impl->dev_caps.dwFlags |= DIDC_FORCEFEEDBACK; + if (impl->pid_effect_update.start_delay_caps) + impl->dev_caps.dwFlags |= DIDC_STARTDELAY; impl->dev_caps.dwFFSamplePeriod = 1000000; impl->dev_caps.dwFFMinTimeResolution = 1000000; impl->dev_caps.dwHardwareRevision = 1;
1
0
0
0
Rémi Bernon : winebus.sys: Add a PID effect update output report.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: 12d91995fd054ce9de0879cb8d03597da452c8ce URL:
https://source.winehq.org/git/wine.git/?a=commit;h=12d91995fd054ce9de0879cb…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Oct 5 08:43:22 2021 +0200 winebus.sys: Add a PID effect update output report. Advertising support of the periodic effect types only for now. 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 | 20 +++++- dlls/winebus.sys/bus_udev.c | 19 ++++- dlls/winebus.sys/hid.c | 151 +++++++++++++++++++++++++++++++++++++++- dlls/winebus.sys/unix_private.h | 21 +++++- dlls/winebus.sys/unixlib.c | 14 ++++ 5 files changed, 220 insertions(+), 5 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=12d91995fd054ce9de08…
1
0
0
0
Huw Davies : nsiproxy: Implement the ability to cancel the listener.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: 19a6d409c04c5a9361cc753183224b3286a58181 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=19a6d409c04c5a9361cc7531…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 5 07:37:53 2021 +0100 nsiproxy: Implement the ability to cancel the listener. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsiproxy.sys/device.c | 16 ++++++++++++++-- dlls/nsiproxy.sys/icmp_echo.c | 31 +++++++++++++++++++++++++++++-- dlls/nsiproxy.sys/nsi.c | 1 + dlls/nsiproxy.sys/unix_private.h | 1 + 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/dlls/nsiproxy.sys/device.c b/dlls/nsiproxy.sys/device.c index 6461071c395..90a7a3ded7c 100644 --- a/dlls/nsiproxy.sys/device.c +++ b/dlls/nsiproxy.sys/device.c @@ -58,6 +58,7 @@ static NTSTATUS nsiproxy_call( unsigned int code, void *args ) enum unix_calls { + icmp_cancel_listen, icmp_close, icmp_listen, icmp_send_echo, @@ -191,12 +192,23 @@ static inline HANDLE irp_set_icmp_handle( IRP *irp, HANDLE handle ) static void WINAPI icmp_echo_cancel( DEVICE_OBJECT *device, IRP *irp ) { + HANDLE handle; + TRACE( "device %p, irp %p.\n", device, irp ); IoReleaseCancelSpinLock( irp->CancelIrql ); - /* FIXME: at the moment just let the request thread bail */ - return; + EnterCriticalSection( &nsiproxy_cs ); + + /* If the handle is not set, either the irp is still + in the request queue, in which case the request thread will + cancel it, or the irp has already finished. If the handle + does exist then notify the listen thread. In all cases the irp + will be completed elsewhere. */ + handle = irp_get_icmp_handle( irp ); + if (handle) nsiproxy_call( icmp_cancel_listen, handle ); + + LeaveCriticalSection( &nsiproxy_cs ); } static NTSTATUS nsiproxy_icmp_echo( IRP *irp ) diff --git a/dlls/nsiproxy.sys/icmp_echo.c b/dlls/nsiproxy.sys/icmp_echo.c index cef5c04a6c7..999b53186c2 100644 --- a/dlls/nsiproxy.sys/icmp_echo.c +++ b/dlls/nsiproxy.sys/icmp_echo.c @@ -100,6 +100,7 @@ struct icmp_data { LARGE_INTEGER send_time; int socket; + int cancel_pipe[2]; unsigned short id; unsigned short seq; const struct family_ops *ops; @@ -522,8 +523,14 @@ static NTSTATUS icmp_data_create( ADDRESS_FAMILY win_family, struct icmp_data ** if (ops->family == AF_INET) ops = &ipv4_linux_ping; #endif } - data->ops = ops; + if (pipe( data->cancel_pipe )) + { + close( data->socket ); + free( data ); + return STATUS_ACCESS_DENIED; + } + data->ops = ops; *icmp_data = data; return STATUS_SUCCESS; } @@ -531,6 +538,8 @@ static NTSTATUS icmp_data_create( ADDRESS_FAMILY win_family, struct icmp_data ** static void icmp_data_free( struct icmp_data *data ) { close( data->socket ); + close( data->cancel_pipe[0] ); + close( data->cancel_pipe[1] ); free( data ); } @@ -668,7 +677,7 @@ NTSTATUS icmp_listen( void *args ) { struct icmp_listen_params *params = args; struct icmp_data *data; - struct pollfd fds[1]; + struct pollfd fds[2]; NTSTATUS status; int ret; @@ -677,9 +686,17 @@ NTSTATUS icmp_listen( void *args ) fds[0].fd = data->socket; fds[0].events = POLLIN; + fds[1].fd = data->cancel_pipe[0]; + fds[1].events = POLLIN; while ((ret = poll( fds, ARRAY_SIZE(fds), get_timeout( data->send_time, params->timeout ) )) > 0) { + if (fds[1].revents & POLLIN) + { + TRACE( "cancelled\n" ); + return STATUS_CANCELLED; + } + status = recv_msg( data, params ); if (status == STATUS_RETRY) continue; return status; @@ -694,6 +711,16 @@ NTSTATUS icmp_listen( void *args ) return set_reply_ip_status( params, errno_to_ip_status( errno ) ); } +NTSTATUS icmp_cancel_listen( void *args ) +{ + HANDLE handle = args; + struct icmp_data *data = handle_data( handle ); + + if (!data) return STATUS_INVALID_PARAMETER; + write( data->cancel_pipe[1], "x", 1 ); + return STATUS_SUCCESS; +} + NTSTATUS icmp_close( void *args ) { HANDLE handle = args; diff --git a/dlls/nsiproxy.sys/nsi.c b/dlls/nsiproxy.sys/nsi.c index b92de7a9a11..fa997d2fe36 100644 --- a/dlls/nsiproxy.sys/nsi.c +++ b/dlls/nsiproxy.sys/nsi.c @@ -147,6 +147,7 @@ static NTSTATUS unix_nsi_get_parameter_ex( void *args ) const unixlib_entry_t __wine_unix_call_funcs[] = { + icmp_cancel_listen, icmp_close, icmp_listen, icmp_send_echo, diff --git a/dlls/nsiproxy.sys/unix_private.h b/dlls/nsiproxy.sys/unix_private.h index 855c06011f9..ffb48cc7380 100644 --- a/dlls/nsiproxy.sys/unix_private.h +++ b/dlls/nsiproxy.sys/unix_private.h @@ -157,6 +157,7 @@ static inline int ascii_strcasecmp( const char *s1, const char *s2 ) return ascii_strncasecmp( s1, s2, -1 ); } +NTSTATUS icmp_cancel_listen( void *args ) DECLSPEC_HIDDEN; NTSTATUS icmp_close( void *args ) DECLSPEC_HIDDEN; NTSTATUS icmp_listen( void *args ) DECLSPEC_HIDDEN; NTSTATUS icmp_send_echo( void *args ) DECLSPEC_HIDDEN;
1
0
0
0
Huw Davies : nsiproxy: Add support for parsing other icmp packets.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: 881577deaf508f48cbcedc64739073c9a245f472 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=881577deaf508f48cbcedc64…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 5 07:37:52 2021 +0100 nsiproxy: Add support for parsing other icmp packets. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsiproxy.sys/icmp_echo.c | 63 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/nsiproxy.sys/icmp_echo.c b/dlls/nsiproxy.sys/icmp_echo.c index abcccdb4c73..cef5c04a6c7 100644 --- a/dlls/nsiproxy.sys/icmp_echo.c +++ b/dlls/nsiproxy.sys/icmp_echo.c @@ -297,6 +297,30 @@ static BOOL ipv4_linux_ping_parse_ip_hdr( struct msghdr *msg, int recvd, static int ipv4_parse_icmp_hdr_( struct icmp_data *data, struct icmp_hdr *icmp, int icmp_size, struct nsiproxy_icmp_echo_reply *reply, int ping_socket ) { + static const IP_STATUS unreach_codes[] = + { + IP_DEST_NET_UNREACHABLE, /* ICMP_UNREACH_NET */ + IP_DEST_HOST_UNREACHABLE, /* ICMP_UNREACH_HOST */ + IP_DEST_PROT_UNREACHABLE, /* ICMP_UNREACH_PROTOCOL */ + IP_DEST_PORT_UNREACHABLE, /* ICMP_UNREACH_PORT */ + IP_PACKET_TOO_BIG, /* ICMP_UNREACH_NEEDFRAG */ + IP_BAD_ROUTE, /* ICMP_UNREACH_SRCFAIL */ + IP_DEST_NET_UNREACHABLE, /* ICMP_UNREACH_NET_UNKNOWN */ + IP_DEST_HOST_UNREACHABLE, /* ICMP_UNREACH_HOST_UNKNOWN */ + IP_DEST_HOST_UNREACHABLE, /* ICMP_UNREACH_ISOLATED */ + IP_DEST_NET_UNREACHABLE, /* ICMP_UNREACH_NET_PROHIB */ + IP_DEST_HOST_UNREACHABLE, /* ICMP_UNREACH_HOST_PROHIB */ + IP_DEST_NET_UNREACHABLE, /* ICMP_UNREACH_TOSNET */ + IP_DEST_HOST_UNREACHABLE, /* ICMP_UNREACH_TOSHOST */ + IP_DEST_HOST_UNREACHABLE, /* ICMP_UNREACH_FILTER_PROHIB */ + IP_DEST_HOST_UNREACHABLE, /* ICMP_UNREACH_HOST_PRECEDENCE */ + IP_DEST_HOST_UNREACHABLE /* ICMP_UNREACH_PRECEDENCE_CUTOFF */ + }; + const struct ip_hdr *orig_ip_hdr; + const struct icmp_hdr *orig_icmp_hdr; + int orig_ip_hdr_len; + IP_STATUS status; + switch (icmp->type) { case ICMP4_ECHO_REPLY: @@ -306,11 +330,48 @@ static int ipv4_parse_icmp_hdr_( struct icmp_data *data, struct icmp_hdr *icmp, reply->status = IP_SUCCESS; return icmp_size - sizeof(*icmp); - /* FIXME: handle other icmp messages */ + case ICMP4_DST_UNREACH: + if (icmp->code < ARRAY_SIZE(unreach_codes)) + status = unreach_codes[icmp->code]; + else + status = IP_DEST_HOST_UNREACHABLE; + break; + + case ICMP4_TIME_EXCEEDED: + if (icmp->code == 1) /* ICMP_TIMXCEED_REASS */ + status = IP_TTL_EXPIRED_REASSEM; + else + status = IP_TTL_EXPIRED_TRANSIT; + break; + + case ICMP4_PARAM_PROB: + status = IP_PARAM_PROBLEM; + break; + + case ICMP4_SOURCE_QUENCH: + status = IP_SOURCE_QUENCH; + break; default: return -1; } + + /* Check that the appended packet is really ours - + * all handled icmp replies have an 8-byte header + * followed by the original ip hdr. */ + if (icmp_size < sizeof(*icmp) + sizeof(*orig_ip_hdr)) return -1; + orig_ip_hdr = (struct ip_hdr *)(icmp + 1); + if (orig_ip_hdr->v_hl >> 4 != 4 || orig_ip_hdr->protocol != IPPROTO_ICMP) return -1; + orig_ip_hdr_len = (orig_ip_hdr->v_hl & 0xf) << 2; + if (icmp_size < sizeof(*icmp) + orig_ip_hdr_len + sizeof(*orig_icmp_hdr)) return -1; + orig_icmp_hdr = (const struct icmp_hdr *)((const BYTE *)orig_ip_hdr + orig_ip_hdr_len); + if (orig_icmp_hdr->type != ICMP4_ECHO_REQUEST || + orig_icmp_hdr->code != 0 || + (!ping_socket && orig_icmp_hdr->un.echo.id != data->id) || + orig_icmp_hdr->un.echo.sequence != data->seq) return -1; + + reply->status = status; + return 0; } static int ipv4_parse_icmp_hdr( struct icmp_data *data, struct icmp_hdr *icmp, int icmp_size,
1
0
0
0
Huw Davies : nsiproxy: Parse any received ICMP_ECHO_REPLY.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: fffd222b3d1f3e526867df876398f8c31a31613b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fffd222b3d1f3e526867df87…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 5 07:37:51 2021 +0100 nsiproxy: Parse any received ICMP_ECHO_REPLY. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsiproxy.sys/icmp_echo.c | 205 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 203 insertions(+), 2 deletions(-) diff --git a/dlls/nsiproxy.sys/icmp_echo.c b/dlls/nsiproxy.sys/icmp_echo.c index afb48fc72e3..abcccdb4c73 100644 --- a/dlls/nsiproxy.sys/icmp_echo.c +++ b/dlls/nsiproxy.sys/icmp_echo.c @@ -233,6 +233,100 @@ static void ipv4_linux_ping_set_socket_opts( struct icmp_data *data, struct icmp } #endif +static int ipv4_reply_buffer_len( int reply_len ) +{ + return sizeof(struct ip_hdr) + sizeof(struct icmp_hdr) + reply_len - sizeof(struct nsiproxy_icmp_echo_reply); +} + +#ifdef __linux__ +static int ipv4_linux_ping_reply_buffer_len( int reply_len ) +{ + return sizeof(struct icmp_hdr) + reply_len - sizeof(struct nsiproxy_icmp_echo_reply); +} +#endif + +static BOOL ipv4_parse_ip_hdr( struct msghdr *msg, int recvd, + int *ip_hdr_len, struct nsiproxy_icmp_echo_reply *reply, void **opts ) +{ + struct ip_hdr *ip_hdr; + + if (recvd < sizeof(*ip_hdr)) return FALSE; + ip_hdr = msg->msg_iov[0].iov_base; + if (ip_hdr->v_hl >> 4 != 4 || ip_hdr->protocol != IPPROTO_ICMP) return FALSE; + *ip_hdr_len = (ip_hdr->v_hl & 0xf) << 2; + if (*ip_hdr_len < sizeof(*ip_hdr)) return FALSE; + *opts = ip_hdr + 1; + reply->opts.ttl = ip_hdr->ttl; + reply->opts.tos = ip_hdr->tos; + reply->opts.flags = ip_hdr->frag_off >> 13; + reply->opts.options_size = *ip_hdr_len - sizeof(*ip_hdr); + + return TRUE; +} + +#ifdef __linux__ +static BOOL ipv4_linux_ping_parse_ip_hdr( struct msghdr *msg, int recvd, + int *ip_hdr_len, struct nsiproxy_icmp_echo_reply *reply, void **opts ) +{ + struct cmsghdr *cmsg; + + *ip_hdr_len = 0; + *opts = NULL; + reply->opts.ttl = 0; + reply->opts.tos = 0; + reply->opts.flags = 0; + reply->opts.options_size = 0; /* FIXME from IP_OPTIONS but will require checking for space in the reply */ + + for (cmsg = CMSG_FIRSTHDR( msg ); cmsg; cmsg = CMSG_NXTHDR( msg, cmsg )) + { + if (cmsg->cmsg_level != IPPROTO_IP) continue; + switch (cmsg->cmsg_type) + { + case IP_TTL: + reply->opts.ttl = *(BYTE *)CMSG_DATA( cmsg ); + break; + case IP_TOS: + reply->opts.tos = *(BYTE *)CMSG_DATA( cmsg ); + break; + } + } + return TRUE; +} +#endif + +static int ipv4_parse_icmp_hdr_( struct icmp_data *data, struct icmp_hdr *icmp, int icmp_size, + struct nsiproxy_icmp_echo_reply *reply, int ping_socket ) +{ + switch (icmp->type) + { + case ICMP4_ECHO_REPLY: + if ((!ping_socket && icmp->un.echo.id != data->id) || + icmp->un.echo.sequence != data->seq) return -1; + + reply->status = IP_SUCCESS; + return icmp_size - sizeof(*icmp); + + /* FIXME: handle other icmp messages */ + + default: + return -1; + } +} + +static int ipv4_parse_icmp_hdr( struct icmp_data *data, struct icmp_hdr *icmp, int icmp_size, + struct nsiproxy_icmp_echo_reply *reply ) +{ + return ipv4_parse_icmp_hdr_( data, icmp, icmp_size, reply, 0 ); +} + +#ifdef __linux__ +static int ipv4_linux_ping_parse_icmp_hdr( struct icmp_data *data, struct icmp_hdr *icmp, int icmp_size, + struct nsiproxy_icmp_echo_reply *reply ) +{ + return ipv4_parse_icmp_hdr_( data, icmp, icmp_size, reply, 1 ); +} +#endif + struct family_ops { int family; @@ -240,6 +334,11 @@ struct family_ops void (*init_icmp_hdr)( struct icmp_data *data, struct icmp_hdr *icmp_hdr ); unsigned short (*chksum)( BYTE *data, unsigned int count ); void (*set_socket_opts)( struct icmp_data *data, struct icmp_send_echo_params *params ); + int (*reply_buffer_len)( int reply_len ); + BOOL (*parse_ip_hdr)( struct msghdr *msg, int recvd, + int *ip_hdr_len, struct nsiproxy_icmp_echo_reply *reply, void **opts ); + int (*parse_icmp_hdr)( struct icmp_data *data, struct icmp_hdr *icmp, int icmp_len, + struct nsiproxy_icmp_echo_reply *reply ); }; static const struct family_ops ipv4 = @@ -249,6 +348,9 @@ static const struct family_ops ipv4 = ipv4_init_icmp_hdr, chksum, ipv4_set_socket_opts, + ipv4_reply_buffer_len, + ipv4_parse_ip_hdr, + ipv4_parse_icmp_hdr, }; #ifdef __linux__ @@ -260,6 +362,9 @@ static const struct family_ops ipv4_linux_ping = ipv4_init_icmp_hdr, null_chksum, ipv4_linux_ping_set_socket_opts, + ipv4_linux_ping_reply_buffer_len, + ipv4_linux_ping_parse_ip_hdr, + ipv4_linux_ping_parse_icmp_hdr, }; #endif @@ -302,6 +407,34 @@ static int SOCKADDR_INET_to_sockaddr( const SOCKADDR_INET *in, struct sockaddr * return 0; } +static BOOL sockaddr_to_SOCKADDR_INET( const struct sockaddr *in, SOCKADDR_INET *out ) +{ + switch (in->sa_family) + { + case AF_INET: + { + struct sockaddr_in *sa = (struct sockaddr_in *)in; + + out->Ipv4.sin_family = WS_AF_INET; + out->Ipv4.sin_port = sa->sin_port; + out->Ipv4.sin_addr.WS_s_addr = sa->sin_addr.s_addr; + return TRUE; + } + case AF_INET6: + { + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)in; + + out->Ipv6.sin6_family = WS_AF_INET6; + out->Ipv6.sin6_port = sa->sin6_port; + out->Ipv6.sin6_flowinfo = sa->sin6_flowinfo; + memcpy( out->Ipv6.sin6_addr.WS_s6_addr, sa->sin6_addr.s6_addr, sizeof(sa->sin6_addr.s6_addr) ); + out->Ipv6.sin6_scope_id = sa->sin6_scope_id; + return TRUE; + } + } + return FALSE; +} + static NTSTATUS icmp_data_create( ADDRESS_FAMILY win_family, struct icmp_data **icmp_data ) { struct icmp_data *data; @@ -404,11 +537,78 @@ static int get_timeout( LARGE_INTEGER start, DWORD timeout ) return min( (end.QuadPart - now.QuadPart) / 10000, INT_MAX ); } +static ULONG get_rtt( LARGE_INTEGER start ) +{ + LARGE_INTEGER now; + + NtQueryPerformanceCounter( &now, NULL ); + return (now.QuadPart - start.QuadPart) / 10000; +} + +static NTSTATUS recv_msg( struct icmp_data *data, struct icmp_listen_params *params ) +{ + struct nsiproxy_icmp_echo_reply *reply = (struct nsiproxy_icmp_echo_reply *)params->reply; + struct sockaddr_storage addr; + struct iovec iov[1]; + BYTE cmsg_buf[1024]; + struct msghdr msg = { .msg_name = &addr, .msg_namelen = sizeof(addr), + .msg_iov = iov, .msg_iovlen = ARRAY_SIZE(iov), + .msg_control = cmsg_buf, .msg_controllen = sizeof(cmsg_buf) }; + int ip_hdr_len, recvd, reply_buf_len, data_size; + char *reply_buf; + void *opts; + struct icmp_hdr *icmp_hdr; + + reply_buf_len = data->ops->reply_buffer_len( params->reply_len ); + reply_buf = malloc( reply_buf_len ); + if (!reply_buf) return STATUS_NO_MEMORY; + + iov[0].iov_base = reply_buf; + iov[0].iov_len = reply_buf_len; + + recvd = recvmsg( data->socket, &msg, 0 ); + TRACE( "recvmsg() rets %d errno %d addr_len %d iovlen %d msg_flags %x\n", + recvd, errno, msg.msg_namelen, (int)iov[0].iov_len, msg.msg_flags ); + + if (!data->ops->parse_ip_hdr( &msg, recvd, &ip_hdr_len, reply, &opts )) goto skip; + if (recvd < ip_hdr_len + sizeof(*icmp_hdr)) goto skip; + + icmp_hdr = (struct icmp_hdr *)(reply_buf + ip_hdr_len); + if ((data_size = data->ops->parse_icmp_hdr( data, icmp_hdr, recvd - ip_hdr_len, reply )) < 0) goto skip; + reply->data_size = data_size; + if (reply->data_size && msg.msg_flags & MSG_TRUNC) + { + free( reply_buf ); + return set_reply_ip_status( params, IP_GENERAL_FAILURE ); + } + + sockaddr_to_SOCKADDR_INET( (struct sockaddr *)&addr, &reply->addr ); + reply->round_trip_time = get_rtt( data->send_time ); + reply->num_of_pkts = 1; + reply->opts.options_offset = sizeof(*reply); + reply->data_offset = sizeof(*reply) + ((reply->opts.options_size + 3) & ~3); + if (reply->opts.options_size) + memcpy( (char *)reply + reply->opts.options_offset, opts, reply->opts.options_size ); + if (reply->opts.options_size & 3) + memset( (char *)reply + reply->opts.options_offset + reply->opts.options_size, 0, 4 - (reply->opts.options_size & 3) ); + if (reply->data_size) + memcpy( (char *)reply + reply->data_offset, icmp_hdr + 1, reply->data_size ); + + params->reply_len = reply->data_offset + reply->data_size; + free( reply_buf ); + return STATUS_SUCCESS; + +skip: + free( reply_buf ); + return STATUS_RETRY; +} + NTSTATUS icmp_listen( void *args ) { struct icmp_listen_params *params = args; struct icmp_data *data; struct pollfd fds[1]; + NTSTATUS status; int ret; data = handle_data( params->handle ); @@ -419,8 +619,9 @@ NTSTATUS icmp_listen( void *args ) while ((ret = poll( fds, ARRAY_SIZE(fds), get_timeout( data->send_time, params->timeout ) )) > 0) { - /* FIXME */ - return STATUS_NOT_SUPPORTED; + status = recv_msg( data, params ); + if (status == STATUS_RETRY) continue; + return status; } if (!ret) /* timeout */
1
0
0
0
Huw Davies : nsiproxy: Wait for an icmp reply.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: aa73a91125b985d8bac17567282e6a55ec3d051d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=aa73a91125b985d8bac17567…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 5 07:37:50 2021 +0100 nsiproxy: Wait for an icmp reply. This patch doesn't yet recv() that reply. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsiproxy.sys/device.c | 19 ++++++++++++-- dlls/nsiproxy.sys/icmp_echo.c | 50 ++++++++++++++++++++++++++++++++++++ dlls/nsiproxy.sys/nsi.c | 1 + dlls/nsiproxy.sys/nsiproxy_private.h | 7 +++++ dlls/nsiproxy.sys/unix_private.h | 1 + 5 files changed, 76 insertions(+), 2 deletions(-) diff --git a/dlls/nsiproxy.sys/device.c b/dlls/nsiproxy.sys/device.c index 0cd168946cb..6461071c395 100644 --- a/dlls/nsiproxy.sys/device.c +++ b/dlls/nsiproxy.sys/device.c @@ -59,6 +59,7 @@ static NTSTATUS nsiproxy_call( unsigned int code, void *args ) enum unix_calls { icmp_close, + icmp_listen, icmp_send_echo, nsi_enumerate_all_ex, nsi_get_all_parameters_ex, @@ -306,16 +307,30 @@ static int add_device( DRIVER_OBJECT *driver ) static DWORD WINAPI listen_thread_proc( void *arg ) { IRP *irp = arg; + IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp ); + struct nsiproxy_icmp_echo *in = irp->AssociatedIrp.SystemBuffer; + struct icmp_listen_params params; + NTSTATUS status; TRACE( "\n" ); - /* FIXME */ + params.handle = irp_get_icmp_handle( irp ); + params.timeout = in->timeout; + params.reply = irp->AssociatedIrp.SystemBuffer; + params.reply_len = irpsp->Parameters.DeviceIoControl.OutputBufferLength; + + status = nsiproxy_call( icmp_listen, ¶ms ); + TRACE( "icmp_listen rets %08x\n", status ); EnterCriticalSection( &nsiproxy_cs ); nsiproxy_call( icmp_close, irp_set_icmp_handle( irp, NULL ) ); - irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + irp->IoStatus.Status = status; + if (status == STATUS_SUCCESS) + irp->IoStatus.Information = params.reply_len; + else + irp->IoStatus.Information = 0; IoCompleteRequest( irp, IO_NO_INCREMENT ); LeaveCriticalSection( &nsiproxy_cs ); diff --git a/dlls/nsiproxy.sys/icmp_echo.c b/dlls/nsiproxy.sys/icmp_echo.c index 90a779fb67e..afb48fc72e3 100644 --- a/dlls/nsiproxy.sys/icmp_echo.c +++ b/dlls/nsiproxy.sys/icmp_echo.c @@ -31,6 +31,7 @@ #include <errno.h> #include <limits.h> #include <pthread.h> +#include <poll.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> @@ -382,6 +383,55 @@ NTSTATUS icmp_send_echo( void *args ) return params->handle ? STATUS_PENDING : STATUS_NO_MEMORY; } +static NTSTATUS set_reply_ip_status( struct icmp_listen_params *params, IP_STATUS ip_status ) +{ + struct nsiproxy_icmp_echo_reply *reply = params->reply; + + memset( reply, 0, sizeof(*reply) ); + reply->status = ip_status; + params->reply_len = sizeof(*reply); + return STATUS_SUCCESS; +} + +static int get_timeout( LARGE_INTEGER start, DWORD timeout ) +{ + LARGE_INTEGER now, end; + + end.QuadPart = start.QuadPart + (ULONGLONG)timeout * 10000; + NtQueryPerformanceCounter( &now, NULL ); + if (now.QuadPart >= end.QuadPart) return 0; + + return min( (end.QuadPart - now.QuadPart) / 10000, INT_MAX ); +} + +NTSTATUS icmp_listen( void *args ) +{ + struct icmp_listen_params *params = args; + struct icmp_data *data; + struct pollfd fds[1]; + int ret; + + data = handle_data( params->handle ); + if (!data) return STATUS_INVALID_PARAMETER; + + fds[0].fd = data->socket; + fds[0].events = POLLIN; + + while ((ret = poll( fds, ARRAY_SIZE(fds), get_timeout( data->send_time, params->timeout ) )) > 0) + { + /* FIXME */ + return STATUS_NOT_SUPPORTED; + } + + if (!ret) /* timeout */ + { + TRACE( "timeout\n" ); + return set_reply_ip_status( params, IP_REQ_TIMED_OUT ); + } + /* ret < 0 */ + return set_reply_ip_status( params, errno_to_ip_status( errno ) ); +} + NTSTATUS icmp_close( void *args ) { HANDLE handle = args; diff --git a/dlls/nsiproxy.sys/nsi.c b/dlls/nsiproxy.sys/nsi.c index dec66ad6a33..b92de7a9a11 100644 --- a/dlls/nsiproxy.sys/nsi.c +++ b/dlls/nsiproxy.sys/nsi.c @@ -148,6 +148,7 @@ static NTSTATUS unix_nsi_get_parameter_ex( void *args ) const unixlib_entry_t __wine_unix_call_funcs[] = { icmp_close, + icmp_listen, icmp_send_echo, unix_nsi_enumerate_all_ex, unix_nsi_get_all_parameters_ex, diff --git a/dlls/nsiproxy.sys/nsiproxy_private.h b/dlls/nsiproxy.sys/nsiproxy_private.h index b40a6198c7c..91dd393e41e 100644 --- a/dlls/nsiproxy.sys/nsiproxy_private.h +++ b/dlls/nsiproxy.sys/nsiproxy_private.h @@ -17,6 +17,13 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +struct icmp_listen_params +{ + HANDLE handle; + void *reply; + unsigned int reply_len; + int timeout; +}; struct icmp_send_echo_params { diff --git a/dlls/nsiproxy.sys/unix_private.h b/dlls/nsiproxy.sys/unix_private.h index 7f81336e3f1..855c06011f9 100644 --- a/dlls/nsiproxy.sys/unix_private.h +++ b/dlls/nsiproxy.sys/unix_private.h @@ -158,4 +158,5 @@ static inline int ascii_strcasecmp( const char *s1, const char *s2 ) } NTSTATUS icmp_close( void *args ) DECLSPEC_HIDDEN; +NTSTATUS icmp_listen( void *args ) DECLSPEC_HIDDEN; NTSTATUS icmp_send_echo( void *args ) DECLSPEC_HIDDEN;
1
0
0
0
Huw Davies : nsiproxy: Pass the listen request off to a separate thread.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: be0765ac2633202a7d267aebf0a7b62ca7f21507 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=be0765ac2633202a7d267aeb…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 5 07:37:49 2021 +0100 nsiproxy: Pass the listen request off to a separate thread. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsiproxy.sys/device.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/dlls/nsiproxy.sys/device.c b/dlls/nsiproxy.sys/device.c index cd0bc0e4db2..0cd168946cb 100644 --- a/dlls/nsiproxy.sys/device.c +++ b/dlls/nsiproxy.sys/device.c @@ -178,6 +178,16 @@ static NTSTATUS nsiproxy_get_parameter( IRP *irp ) return status; } +static inline HANDLE irp_get_icmp_handle( IRP *irp ) +{ + return irp->Tail.Overlay.DriverContext[0]; +} + +static inline HANDLE irp_set_icmp_handle( IRP *irp, HANDLE handle ) +{ + return InterlockedExchangePointer( irp->Tail.Overlay.DriverContext, handle ); +} + static void WINAPI icmp_echo_cancel( DEVICE_OBJECT *device, IRP *irp ) { TRACE( "device %p, irp %p.\n", device, irp ); @@ -293,6 +303,26 @@ static int add_device( DRIVER_OBJECT *driver ) return 1; } +static DWORD WINAPI listen_thread_proc( void *arg ) +{ + IRP *irp = arg; + + TRACE( "\n" ); + + /* FIXME */ + + EnterCriticalSection( &nsiproxy_cs ); + + nsiproxy_call( icmp_close, irp_set_icmp_handle( irp, NULL ) ); + + irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + IoCompleteRequest( irp, IO_NO_INCREMENT ); + + LeaveCriticalSection( &nsiproxy_cs ); + + return 0; +} + static void handle_queued_send_echo( IRP *irp ) { struct nsiproxy_icmp_echo *in = (struct nsiproxy_icmp_echo *)irp->AssociatedIrp.SystemBuffer; @@ -323,10 +353,8 @@ static void handle_queued_send_echo( IRP *irp ) } else { - /* FIXME */ - nsiproxy_call( icmp_close, params.handle ); - irp->IoStatus.Status = STATUS_NOT_SUPPORTED; - IoCompleteRequest( irp, IO_NO_INCREMENT ); + irp_set_icmp_handle( irp, params.handle ); + RtlQueueWorkItem( listen_thread_proc, irp, WT_EXECUTELONGFUNCTION ); } }
1
0
0
0
Zebediah Figura : winegstreamer: Convert the Unix library to the __wine_unix_call interface.
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: 4ba31162c37ea237763e650f6242535d86ffb170 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4ba31162c37ea237763e650f…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Mon Oct 4 19:20:51 2021 -0500 winegstreamer: Convert the Unix library to the __wine_unix_call interface. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/Makefile.in | 1 + dlls/winegstreamer/gst_private.h | 32 +++++- dlls/winegstreamer/main.c | 197 +++++++++++++++++++++++++++++++++- dlls/winegstreamer/media_source.c | 44 ++++---- dlls/winegstreamer/quartz_parser.c | 72 ++++++------- dlls/winegstreamer/unixlib.h | 139 +++++++++++++++++++----- dlls/winegstreamer/wg_parser.c | 210 +++++++++++++++++++++++-------------- 7 files changed, 528 insertions(+), 167 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=4ba31162c37ea237763e…
1
0
0
0
Zebediah Figura : winegstreamer: Return void from wg_parser_stream_seek().
by Alexandre Julliard
05 Oct '21
05 Oct '21
Module: wine Branch: master Commit: 494039d0d0df8fd5b2b3442caac7bd6c0c7433c0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=494039d0d0df8fd5b2b3442c…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Mon Oct 4 19:20:50 2021 -0500 winegstreamer: Return void from wg_parser_stream_seek(). We do not expect this to fail. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/quartz_parser.c | 12 +++--------- dlls/winegstreamer/unixlib.h | 2 +- dlls/winegstreamer/wg_parser.c | 7 ++++--- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index a1fa7daec6f..5dd232ea0da 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -1233,7 +1233,6 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface, { struct parser_source *pin = impl_from_IMediaSeeking(iface); struct parser *filter = impl_from_strmbase_filter(pin->pin.pin.filter); - HRESULT hr = S_OK; int i; TRACE("pin %p, current %s, current_flags %#x, stop %s, stop_flags %#x.\n", @@ -1270,13 +1269,8 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface, SourceSeekingImpl_SetPositions(iface, current, current_flags, stop, stop_flags); - if (!unix_funcs->wg_parser_stream_seek(pin->wg_stream, pin->seek.dRate, - pin->seek.llCurrent, pin->seek.llStop, current_flags, stop_flags)) - { - ERR("Failed to seek (current %s, stop %s).\n", - debugstr_time(pin->seek.llCurrent), debugstr_time(pin->seek.llStop)); - hr = E_FAIL; - } + unix_funcs->wg_parser_stream_seek(pin->wg_stream, pin->seek.dRate, + pin->seek.llCurrent, pin->seek.llStop, current_flags, stop_flags); if (!(current_flags & AM_SEEKING_NoFlush)) { @@ -1299,7 +1293,7 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface, LeaveCriticalSection(&pin->flushing_cs); } - return hr; + return S_OK; } static const IMediaSeekingVtbl GST_Seeking_Vtbl = diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index e917f7b5557..dade020916a 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -158,7 +158,7 @@ struct unix_funcs /* Returns the duration in 100-nanosecond units. */ uint64_t (CDECL *wg_parser_stream_get_duration)(struct wg_parser_stream *stream); /* start_pos and stop_pos are in 100-nanosecond units. */ - bool (CDECL *wg_parser_stream_seek)(struct wg_parser_stream *stream, double rate, + void (CDECL *wg_parser_stream_seek)(struct wg_parser_stream *stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); }; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index b89a50b5d8f..694f8b57ed1 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -686,7 +686,7 @@ static uint64_t CDECL wg_parser_stream_get_duration(struct wg_parser_stream *str return stream->duration; } -static bool CDECL wg_parser_stream_seek(struct wg_parser_stream *stream, double rate, +static void CDECL wg_parser_stream_seek(struct wg_parser_stream *stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags) { GstSeekType start_type = GST_SEEK_TYPE_SET, stop_type = GST_SEEK_TYPE_SET; @@ -704,8 +704,9 @@ static bool CDECL wg_parser_stream_seek(struct wg_parser_stream *stream, double if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning) stop_type = GST_SEEK_TYPE_NONE; - return gst_pad_push_event(stream->my_sink, gst_event_new_seek(rate, - GST_FORMAT_TIME, flags, start_type, start_pos * 100, stop_type, stop_pos * 100)); + if (!gst_pad_push_event(stream->my_sink, gst_event_new_seek(rate, GST_FORMAT_TIME, + flags, start_type, start_pos * 100, stop_type, stop_pos * 100))) + GST_ERROR("Failed to seek.\n"); } static void CDECL wg_parser_stream_notify_qos(struct wg_parser_stream *stream,
1
0
0
0
← Newer
1
...
101
102
103
104
105
106
107
...
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