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
Ivo Ivanov : hidclass.sys: Use the report length when copying report data.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: 62d89cee7cbdcdb3cc1c5e133a2334bffda1d042 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=62d89cee7cbdcdb3cc1c5e13…
Author: Ivo Ivanov <logos128(a)gmail.com> Date: Mon Oct 4 10:18:12 2021 +0200 hidclass.sys: Use the report length when copying report data. Instead of the HID descriptor input report length. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51828
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hidclass.sys/device.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 026ec1efeb1..632e98ab740 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -216,7 +216,6 @@ static struct hid_report *hid_queue_pop_report( struct hid_queue *queue ) static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *packet ) { BASE_DEVICE_EXTENSION *ext = device->DeviceExtension; - HIDP_COLLECTION_DESC *desc = ext->u.pdo.device_desc.CollectionDesc; const BOOL polled = ext->u.pdo.information.Polled; struct hid_report *last_report, *report; struct hid_queue *queue; @@ -270,7 +269,7 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack if (!(irp = hid_queue_pop_irp( queue ))) break; if (!(report = hid_queue_pop_report( queue ))) hid_report_incref( (report = last_report) ); - memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, desc->InputLength ); + memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, report->length ); irp->IoStatus.Information = report->length; irp->IoStatus.Status = STATUS_SUCCESS; hid_report_decref( report ); @@ -652,7 +651,7 @@ NTSTATUS WINAPI pdo_read(DEVICE_OBJECT *device, IRP *irp) irp->IoStatus.Information = 0; if ((report = hid_queue_pop_report( queue ))) { - memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, desc->InputLength ); + memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, report->length ); irp->IoStatus.Information = report->length; irp->IoStatus.Status = STATUS_SUCCESS; hid_report_decref( report );
1
0
0
0
Rémi Bernon : winebus.sys: Implement PID effect control for UDEV lnxev devices.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: a41c5e057cd12f3ab218e0ee3526850c1815b117 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a41c5e057cd12f3ab218e0ee…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Oct 4 09:51:34 2021 +0200 winebus.sys: Implement PID effect 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 | 48 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 5eca64e8317..3db261b2404 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -812,6 +812,27 @@ static NTSTATUS lnxev_device_haptics_start(struct unix_device *iface, DWORD dura return STATUS_SUCCESS; } +static NTSTATUS lnxev_device_physical_effect_run(struct lnxev_device *impl, BYTE index, + int iterations) +{ + struct input_event ie = + { + .type = EV_FF, + .value = iterations, + }; + + if (impl->effect_ids[index] < 0) return STATUS_UNSUCCESSFUL; + ie.code = impl->effect_ids[index]; + + if (write(impl->base.device_fd, &ie, sizeof(ie)) == -1) + { + WARN("couldn't stop effect, write failed %d %s\n", errno, strerror(errno)); + return STATUS_UNSUCCESSFUL; + } + + return STATUS_SUCCESS; +} + static NTSTATUS lnxev_device_physical_device_control(struct unix_device *iface, USAGE control) { struct lnxev_device *impl = lnxev_impl_from_unix_device(iface); @@ -846,8 +867,12 @@ static NTSTATUS lnxev_device_physical_device_control(struct unix_device *iface, return STATUS_SUCCESS; } case PID_USAGE_DC_STOP_ALL_EFFECTS: - FIXME("stop all not implemented!\n"); - return STATUS_NOT_IMPLEMENTED; + for (i = 0; i < ARRAY_SIZE(impl->effect_ids); ++i) + { + if (impl->effect_ids[i] < 0) continue; + lnxev_device_physical_effect_run(impl, i, 0); + } + return STATUS_SUCCESS; case PID_USAGE_DC_DEVICE_RESET: for (i = 0; i < ARRAY_SIZE(impl->effect_ids); ++i) { @@ -871,9 +896,24 @@ static NTSTATUS lnxev_device_physical_device_control(struct unix_device *iface, static NTSTATUS lnxev_device_physical_effect_control(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations) { - FIXME("iface %p, index %u, control %04x, iterations %u stub!\n", iface, index, control, iterations); + struct lnxev_device *impl = lnxev_impl_from_unix_device(iface); + NTSTATUS status; - return STATUS_NOT_IMPLEMENTED; + TRACE("iface %p, index %u, control %04x, iterations %u.\n", iface, index, control, iterations); + + switch (control) + { + case PID_USAGE_OP_EFFECT_START_SOLO: + if ((status = lnxev_device_physical_device_control(iface, PID_USAGE_DC_STOP_ALL_EFFECTS))) + return status; + /* fallthrough */ + case PID_USAGE_OP_EFFECT_START: + return lnxev_device_physical_effect_run(impl, index, iterations); + case PID_USAGE_OP_EFFECT_STOP: + return lnxev_device_physical_effect_run(impl, index, 0); + } + + return STATUS_SUCCESS; } static const struct hid_device_vtbl lnxev_device_vtbl =
1
0
0
0
Rémi Bernon : winebus.sys: Implement PID effect control for SDL devices.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: 8f0f2fab725a90664f9a3c59e5c4eaf89b7a3b2c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8f0f2fab725a90664f9a3c59…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Oct 4 09:51:33 2021 +0200 winebus.sys: Implement PID effect 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 | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index bcdfd7a9c15..33386a80a34 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -104,6 +104,7 @@ MAKE_FUNCPTR(SDL_HapticRumbleSupported); MAKE_FUNCPTR(SDL_HapticRunEffect); MAKE_FUNCPTR(SDL_HapticSetGain); MAKE_FUNCPTR(SDL_HapticStopAll); +MAKE_FUNCPTR(SDL_HapticStopEffect); MAKE_FUNCPTR(SDL_HapticUnpause); MAKE_FUNCPTR(SDL_JoystickIsHaptic); MAKE_FUNCPTR(SDL_GameControllerAddMapping); @@ -447,9 +448,27 @@ static NTSTATUS sdl_device_physical_device_control(struct unix_device *iface, US static NTSTATUS sdl_device_physical_effect_control(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations) { - FIXME("iface %p, index %u, control %04x, iterations %u stub!\n", iface, index, control, iterations); + struct sdl_device *impl = impl_from_unix_device(iface); + int id = impl->effect_ids[index]; - return STATUS_NOT_IMPLEMENTED; + TRACE("iface %p, index %u, control %04x, iterations %u.\n", iface, index, control, iterations); + + if (impl->effect_ids[index] < 0) return STATUS_UNSUCCESSFUL; + + switch (control) + { + case PID_USAGE_OP_EFFECT_START_SOLO: + pSDL_HapticStopAll(impl->sdl_haptic); + /* fallthrough */ + case PID_USAGE_OP_EFFECT_START: + pSDL_HapticRunEffect(impl->sdl_haptic, id, iterations); + break; + case PID_USAGE_OP_EFFECT_STOP: + pSDL_HapticStopEffect(impl->sdl_haptic, id); + break; + } + + return STATUS_SUCCESS; } static const struct hid_device_vtbl sdl_device_vtbl = @@ -721,6 +740,7 @@ NTSTATUS sdl_bus_init(void *args) LOAD_FUNCPTR(SDL_HapticRunEffect); LOAD_FUNCPTR(SDL_HapticSetGain); LOAD_FUNCPTR(SDL_HapticStopAll); + LOAD_FUNCPTR(SDL_HapticStopEffect); LOAD_FUNCPTR(SDL_HapticUnpause); LOAD_FUNCPTR(SDL_JoystickIsHaptic); LOAD_FUNCPTR(SDL_GameControllerAddMapping);
1
0
0
0
Rémi Bernon : dinput: Look for the PID effect control output report.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: ac0353653d9d00c7fed99824bd673b7ce45f25b8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ac0353653d9d00c7fed99824…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Oct 4 09:51:32 2021 +0200 dinput: Look for the PID effect control 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index a4f16168dfb..95ee04d9e82 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -114,6 +114,7 @@ struct hid_joystick struct list effect_list; struct pid_control_report pid_device_control; + struct pid_control_report pid_effect_control; }; static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) @@ -1587,6 +1588,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * DIDEVICEOBJECTINSTANCEW *instance, void *data ) { struct pid_control_report *device_control = &impl->pid_device_control; + struct pid_control_report *effect_control = &impl->pid_effect_control; #define SET_COLLECTION( rep ) \ do \ @@ -1610,7 +1612,10 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * switch (instance->wUsage) { 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_DEVICE_CONTROL: SET_SUB_COLLECTION( device_control, control_coll ); break; + case PID_USAGE_EFFECT_OPERATION: SET_SUB_COLLECTION( effect_control, control_coll ); break; } } @@ -1624,6 +1629,7 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap DIDEVICEOBJECTINSTANCEW *instance, void *data ) { struct pid_control_report *device_control = &impl->pid_device_control; + struct pid_control_report *effect_control = &impl->pid_effect_control; if (!(instance->dwType & DIDFT_OUTPUT)) return DIENUM_CONTINUE; @@ -1638,6 +1644,8 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap if (instance->wCollectionNumber == device_control->control_coll) SET_REPORT_ID( device_control ); + if (instance->wCollectionNumber == effect_control->control_coll) + SET_REPORT_ID( effect_control ); #undef SET_REPORT_ID @@ -1741,6 +1749,7 @@ 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 ); if (impl->pid_device_control.id) {
1
0
0
0
Rémi Bernon : winebus.sys: Add a PID effect control output report.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: 3b3228e9c7fd2f618fe570795750629fdb563a71 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3b3228e9c7fd2f618fe57079…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Oct 4 09:51:31 2021 +0200 winebus.sys: Add a PID effect control output report. 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 | 9 +++++ dlls/winebus.sys/bus_udev.c | 9 +++++ dlls/winebus.sys/hid.c | 77 +++++++++++++++++++++++++++++++++++++++++ dlls/winebus.sys/unix_private.h | 2 ++ dlls/winebus.sys/unixlib.c | 14 ++++++++ 5 files changed, 111 insertions(+) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 772ee092c83..bcdfd7a9c15 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -444,6 +444,14 @@ static NTSTATUS sdl_device_physical_device_control(struct unix_device *iface, US return STATUS_NOT_SUPPORTED; } +static NTSTATUS sdl_device_physical_effect_control(struct unix_device *iface, BYTE index, + USAGE control, BYTE iterations) +{ + FIXME("iface %p, index %u, control %04x, iterations %u stub!\n", iface, index, control, iterations); + + return STATUS_NOT_IMPLEMENTED; +} + static const struct hid_device_vtbl sdl_device_vtbl = { sdl_device_destroy, @@ -451,6 +459,7 @@ static const struct hid_device_vtbl sdl_device_vtbl = sdl_device_stop, sdl_device_haptics_start, sdl_device_physical_device_control, + sdl_device_physical_effect_control, }; static BOOL set_report_from_joystick_event(struct sdl_device *impl, SDL_Event *event) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 454ab3ea870..5eca64e8317 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -868,6 +868,14 @@ static NTSTATUS lnxev_device_physical_device_control(struct unix_device *iface, return STATUS_NOT_SUPPORTED; } +static NTSTATUS lnxev_device_physical_effect_control(struct unix_device *iface, BYTE index, + USAGE control, BYTE iterations) +{ + FIXME("iface %p, index %u, control %04x, iterations %u stub!\n", iface, index, control, iterations); + + return STATUS_NOT_IMPLEMENTED; +} + static const struct hid_device_vtbl lnxev_device_vtbl = { lnxev_device_destroy, @@ -875,6 +883,7 @@ static const struct hid_device_vtbl lnxev_device_vtbl = lnxev_device_stop, lnxev_device_haptics_start, lnxev_device_physical_device_control, + lnxev_device_physical_effect_control, }; #endif /* HAS_PROPER_INPUT_HEADER */ diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index 12db1706ede..4ddee27cff9 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -411,6 +411,21 @@ static const USAGE pid_device_control_usages[] = PID_USAGE_DC_DEVICE_PAUSE, PID_USAGE_DC_DEVICE_CONTINUE, }; + +struct pid_effect_control +{ + BYTE index; + BYTE control_index; + BYTE iterations; +}; + +static const USAGE pid_effect_control_usages[] = +{ + 0, /* HID nary collection indexes start at 1 */ + PID_USAGE_OP_EFFECT_START, + PID_USAGE_OP_EFFECT_START_SOLO, + PID_USAGE_OP_EFFECT_STOP, +}; #include "poppack.h" BOOL hid_device_add_physical(struct unix_device *iface) @@ -437,6 +452,42 @@ BOOL hid_device_add_physical(struct unix_device *iface) END_COLLECTION, END_COLLECTION, }; + + const BYTE effect_control_report = ++desc->next_report_id[HidP_Output]; + const BYTE effect_control_header[] = + { + /* Control effect state */ + USAGE(1, PID_USAGE_EFFECT_OPERATION_REPORT), + COLLECTION(1, Logical), + REPORT_ID(1, effect_control_report), + + USAGE(1, PID_USAGE_EFFECT_BLOCK_INDEX), + LOGICAL_MAXIMUM(1, 0x7f), + LOGICAL_MINIMUM(1, 0x00), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + + USAGE(1, PID_USAGE_EFFECT_OPERATION), + COLLECTION(1, Logical), + }; + const BYTE effect_control_footer[] = + { + LOGICAL_MINIMUM(1, 1), + LOGICAL_MAXIMUM(1, 3), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Ary|Abs), + END_COLLECTION, + + USAGE(1, PID_USAGE_LOOP_COUNT), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(2, 0x00ff), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + OUTPUT(1, Data|Var|Abs), + END_COLLECTION, + }; ULONG i; if (!hid_report_descriptor_append(desc, device_control_header, sizeof(device_control_header))) @@ -449,7 +500,18 @@ BOOL hid_device_add_physical(struct unix_device *iface) if (!hid_report_descriptor_append(desc, device_control_footer, sizeof(device_control_footer))) return FALSE; + if (!hid_report_descriptor_append(desc, effect_control_header, sizeof(effect_control_header))) + return FALSE; + for (i = 1; i < ARRAY_SIZE(pid_effect_control_usages); ++i) + { + if (!hid_report_descriptor_append_usage(desc, pid_effect_control_usages[i])) + return FALSE; + } + if (!hid_report_descriptor_append(desc, effect_control_footer, sizeof(effect_control_footer))) + return FALSE; + iface->hid_physical.device_control_report = device_control_report; + iface->hid_physical.effect_control_report = effect_control_report; return TRUE; } @@ -525,6 +587,21 @@ static void hid_device_set_output_report(struct unix_device *iface, HID_XFER_PAC else io->Status = iface->hid_vtbl->physical_device_control(iface, control); } + else if (packet->reportId == physical->effect_control_report) + { + struct pid_effect_control *report = (struct pid_effect_control *)(packet->reportBuffer + 1); + USAGE control; + + io->Information = sizeof(*report) + 1; + if (packet->reportBufferLen < io->Information) + io->Status = STATUS_BUFFER_TOO_SMALL; + else if (report->control_index >= ARRAY_SIZE(pid_effect_control_usages)) + io->Status = STATUS_INVALID_PARAMETER; + else if (!(control = pid_effect_control_usages[report->control_index])) + io->Status = STATUS_INVALID_PARAMETER; + else + io->Status = iface->hid_vtbl->physical_effect_control(iface, report->index, control, report->iterations); + } else { io->Information = 0; diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index c62e4c9d0ab..2446b8de4a7 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -48,6 +48,7 @@ struct hid_device_vtbl NTSTATUS (*haptics_start)(struct unix_device *iface, DWORD duration_ms, USHORT rumble_intensity, USHORT buzz_intensity); NTSTATUS (*physical_device_control)(struct unix_device *iface, USAGE control); + NTSTATUS (*physical_effect_control)(struct unix_device *iface, BYTE index, USAGE control, BYTE iterations); }; struct hid_report_descriptor @@ -91,6 +92,7 @@ struct hid_haptics struct hid_physical { BYTE device_control_report; + BYTE effect_control_report; }; struct hid_device_state diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 49a42ea04ad..177b8f5ba70 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -93,6 +93,12 @@ static NTSTATUS mouse_physical_device_control(struct unix_device *iface, USAGE c return STATUS_NOT_SUPPORTED; } +static NTSTATUS mouse_physical_effect_control(struct unix_device *iface, BYTE index, + USAGE control, BYTE iterations) +{ + return STATUS_NOT_SUPPORTED; +} + static const struct hid_device_vtbl mouse_vtbl = { mouse_destroy, @@ -100,6 +106,7 @@ static const struct hid_device_vtbl mouse_vtbl = mouse_stop, mouse_haptics_start, mouse_physical_device_control, + mouse_physical_effect_control, }; static const struct device_desc mouse_device_desc = @@ -156,6 +163,12 @@ static NTSTATUS keyboard_physical_device_control(struct unix_device *iface, USAG return STATUS_NOT_SUPPORTED; } +static NTSTATUS keyboard_physical_effect_control(struct unix_device *iface, BYTE index, + USAGE control, BYTE iterations) +{ + return STATUS_NOT_SUPPORTED; +} + static const struct hid_device_vtbl keyboard_vtbl = { keyboard_destroy, @@ -163,6 +176,7 @@ static const struct hid_device_vtbl keyboard_vtbl = keyboard_stop, keyboard_haptics_start, keyboard_physical_device_control, + keyboard_physical_effect_control, }; static const struct device_desc keyboard_device_desc =
1
0
0
0
Rémi Bernon : dinput: Implement HID joystick IDirectInputDevice8_EnumCreatedEffectObjects.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: 4310b5accf8470dc70bf8688b49a8441acaf2cac URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4310b5accf8470dc70bf8688…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Oct 4 09:51:30 2021 +0200 dinput: Implement HID joystick IDirectInputDevice8_EnumCreatedEffectObjects. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 19 ++++++++++++++++++- dlls/dinput8/tests/hid.c | 5 ----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index b71f9f5f56b..a4f16168dfb 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -112,6 +112,7 @@ struct hid_joystick BYTE device_state_report_id; BYTE device_state[DEVICE_STATE_MAX_SIZE]; + struct list effect_list; struct pid_control_report pid_device_control; }; @@ -126,6 +127,7 @@ struct hid_joystick_effect IDirectInputEffect IDirectInputEffect_iface; LONG ref; + struct list entry; struct hid_joystick *joystick; }; @@ -1014,11 +1016,18 @@ static HRESULT WINAPI hid_joystick_EnumCreatedEffectObjects( IDirectInputDevice8 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, void *context, DWORD flags ) { + struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); + struct hid_joystick_effect *effect, *next; + FIXME( "iface %p, callback %p, context %p, flags %#x stub!\n", iface, callback, context, flags ); if (!callback) return DIERR_INVALIDPARAM; + if (flags) return DIERR_INVALIDPARAM; - return DIERR_UNSUPPORTED; + LIST_FOR_EACH_ENTRY_SAFE(effect, next, &impl->effect_list, struct hid_joystick_effect, entry) + if (callback( &effect->IDirectInputEffect_iface, context ) != DIENUM_CONTINUE) break; + + return DI_OK; } static HRESULT WINAPI hid_joystick_Poll( IDirectInputDevice8W *iface ) @@ -1707,6 +1716,7 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID impl->dev_caps.dwSize = sizeof(impl->dev_caps); impl->dev_caps.dwFlags = DIDC_ATTACHED | DIDC_EMULATED; impl->dev_caps.dwDevType = instance.dwDevType; + list_init( &impl->effect_list ); preparsed = (struct hid_preparsed_data *)impl->preparsed; @@ -1813,6 +1823,9 @@ static ULONG WINAPI hid_joystick_effect_Release( IDirectInputEffect *iface ) TRACE( "iface %p, ref %u.\n", iface, ref ); if (!ref) { + EnterCriticalSection( &impl->joystick->base.crit ); + list_remove( &impl->entry ); + LeaveCriticalSection( &impl->joystick->base.crit ); hid_joystick_private_decref( impl->joystick ); HeapFree( GetProcessHeap(), 0, impl ); } @@ -1914,6 +1927,10 @@ static HRESULT hid_joystick_effect_create( struct hid_joystick *joystick, IDirec impl->joystick = joystick; hid_joystick_private_incref( joystick ); + EnterCriticalSection( &joystick->base.crit ); + list_add_tail( &joystick->effect_list, &impl->entry ); + LeaveCriticalSection( &joystick->base.crit ); + *out = &impl->IDirectInputEffect_iface; return DI_OK; } diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 8e21639610a..ab70a7c7b76 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4708,10 +4708,8 @@ static void test_simple_joystick(void) hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, NULL, effect, 0 ); ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef ); - todo_wine ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, (void *)0xdeadbeef, 0 ); - todo_wine ok( hr == DI_OK, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); hr = IDirectInputDevice8_Escape( device, NULL ); @@ -5112,13 +5110,10 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) if (hr != DI_OK) return; hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef ); - todo_wine ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); check_params.expect_effect = effect; hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_created_effect_objects, &check_params, 0 ); - todo_wine ok( hr == DI_OK, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); - todo_wine ok( check_params.count == 1, "got count %u, expected 1\n", check_params.count ); ref = IDirectInputEffect_Release( effect );
1
0
0
0
Rémi Bernon : dinput: Keep a private ref to the device on created effects.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: f0c93375ef86d017b724cfa43f4bea7e7aa2e779 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f0c93375ef86d017b724cfa4…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Oct 4 09:51:29 2021 +0200 dinput: Keep a private ref to the device on created effects. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 47 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 8f5dbee9dc3..b71f9f5f56b 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -90,6 +90,7 @@ struct pid_control_report struct hid_joystick { IDirectInputDeviceImpl base; + LONG ref; HANDLE device; OVERLAPPED read_ovl; @@ -124,6 +125,8 @@ struct hid_joystick_effect { IDirectInputEffect IDirectInputEffect_iface; LONG ref; + + struct hid_joystick *joystick; }; static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectInputEffect *iface ) @@ -372,13 +375,17 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header, return DIENUM_CONTINUE; } -static ULONG WINAPI hid_joystick_Release( IDirectInputDevice8W *iface ) +static ULONG hid_joystick_private_incref( struct hid_joystick *impl ) +{ + return IDirectInputDevice2WImpl_AddRef( &impl->base.IDirectInputDevice8W_iface ); +} + +static ULONG hid_joystick_private_decref( struct hid_joystick *impl ) { - struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); struct hid_joystick tmp = *impl; ULONG ref; - if (!(ref = IDirectInputDevice2WImpl_Release( iface ))) + if (!(ref = IDirectInputDevice2WImpl_Release( &impl->base.IDirectInputDevice8W_iface ))) { HeapFree( GetProcessHeap(), 0, tmp.usages_buf ); HeapFree( GetProcessHeap(), 0, tmp.output_report_buf ); @@ -393,6 +400,23 @@ static ULONG WINAPI hid_joystick_Release( IDirectInputDevice8W *iface ) return ref; } +static ULONG WINAPI hid_joystick_AddRef( IDirectInputDevice8W *iface ) +{ + struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p, ref %u.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI hid_joystick_Release( IDirectInputDevice8W *iface ) +{ + struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p, ref %u.\n", iface, ref ); + if (!ref) hid_joystick_private_decref( impl ); + return ref; +} + static HRESULT WINAPI hid_joystick_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); @@ -814,7 +838,7 @@ static HRESULT WINAPI hid_joystick_GetDeviceInfo( IDirectInputDevice8W *iface, D return S_OK; } -static HRESULT hid_joystick_effect_create( IDirectInputEffect **out ); +static HRESULT hid_joystick_effect_create( struct hid_joystick *joystick, IDirectInputEffect **out ); static HRESULT WINAPI hid_joystick_CreateEffect( IDirectInputDevice8W *iface, const GUID *guid, const DIEFFECT *params, IDirectInputEffect **out, @@ -831,7 +855,7 @@ static HRESULT WINAPI hid_joystick_CreateEffect( IDirectInputDevice8W *iface, co *out = NULL; if (!(impl->dev_caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; - if (FAILED(hr = hid_joystick_effect_create( out ))) return hr; + if (FAILED(hr = hid_joystick_effect_create( impl, out ))) return hr; hr = IDirectInputEffect_Initialize( *out, DINPUT_instance, impl->base.dinput->dwVersion, guid ); if (FAILED(hr)) goto failed; @@ -1035,7 +1059,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl = { /*** IUnknown methods ***/ IDirectInputDevice2WImpl_QueryInterface, - IDirectInputDevice2WImpl_AddRef, + hid_joystick_AddRef, hid_joystick_Release, /*** IDirectInputDevice methods ***/ hid_joystick_GetCapabilities, @@ -1677,6 +1701,7 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID &attrs, &impl->caps, dinput->dwVersion ); if (hr != DI_OK) goto failed; + impl->ref = 1; impl->instance = instance; impl->attrs = attrs; impl->dev_caps.dwSize = sizeof(impl->dev_caps); @@ -1786,7 +1811,11 @@ 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 ); + if (!ref) + { + hid_joystick_private_decref( impl->joystick ); + HeapFree( GetProcessHeap(), 0, impl ); + } return ref; } @@ -1874,7 +1903,7 @@ static IDirectInputEffectVtbl hid_joystick_effect_vtbl = hid_joystick_effect_Escape, }; -static HRESULT hid_joystick_effect_create( IDirectInputEffect **out ) +static HRESULT hid_joystick_effect_create( struct hid_joystick *joystick, IDirectInputEffect **out ) { struct hid_joystick_effect *impl; @@ -1882,6 +1911,8 @@ static HRESULT hid_joystick_effect_create( IDirectInputEffect **out ) return DIERR_OUTOFMEMORY; impl->IDirectInputEffect_iface.lpVtbl = &hid_joystick_effect_vtbl; impl->ref = 1; + impl->joystick = joystick; + hid_joystick_private_incref( joystick ); *out = &impl->IDirectInputEffect_iface; return DI_OK;
1
0
0
0
Rémi Bernon : dinput8/tests: Add some HID joystick IDirectInputDevice8_EnumCreatedEffectObjects tests.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: b8d7d23893b681820224e5b30dda94f7e3d31619 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b8d7d23893b681820224e5b3…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Oct 4 09:51:28 2021 +0200 dinput8/tests: Add some HID joystick IDirectInputDevice8_EnumCreatedEffectObjects tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput8/tests/hid.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index aac0da88908..8e21639610a 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3380,6 +3380,32 @@ static BOOL CALLBACK check_effect_count( const DIEFFECTINFOW *effect, void *args return DIENUM_CONTINUE; } +static BOOL CALLBACK check_no_created_effect_objects( IDirectInputEffect *effect, void *context ) +{ + ok( 0, "unexpected effect %p\n", effect ); + return DIENUM_CONTINUE; +} + +struct check_created_effect_params +{ + IDirectInputEffect *expect_effect; + DWORD count; +}; + +static BOOL CALLBACK check_created_effect_objects( IDirectInputEffect *effect, void *context ) +{ + struct check_created_effect_params *params = context; + ULONG ref; + + ok( effect == params->expect_effect, "got effect %p, expected %p\n", effect, params->expect_effect ); + params->count++; + + IDirectInputEffect_AddRef( effect ); + ref = IDirectInputEffect_Release( effect ); + ok( ref == 1, "got ref %u, expected 1\n", ref ); + return DIENUM_CONTINUE; +} + static void test_simple_joystick(void) { #include "psh_hid_macros.h" @@ -4679,6 +4705,15 @@ static void test_simple_joystick(void) hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL ); ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, NULL, effect, 0 ); + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, (void *)0xdeadbeef, 0 ); + todo_wine + ok( hr == DI_OK, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + hr = IDirectInputDevice8_Escape( device, NULL ); todo_wine ok( hr == E_POINTER, "IDirectInputDevice8_Escape returned: %#x\n", hr ); @@ -5056,6 +5091,7 @@ static BOOL test_device_types(void) static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) { + struct check_created_effect_params check_params = {0}; IDirectInputEffect *effect; HRESULT hr; ULONG ref; @@ -5075,6 +5111,16 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) ok( hr == DI_OK, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); if (hr != DI_OK) return; + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + check_params.expect_effect = effect; + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_created_effect_objects, &check_params, 0 ); + todo_wine + ok( hr == DI_OK, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + todo_wine + ok( check_params.count == 1, "got count %u, expected 1\n", check_params.count ); + ref = IDirectInputEffect_Release( effect ); ok( ref == 0, "IDirectInputDeviceW_Release returned %d\n", ref ); }
1
0
0
0
Zebediah Figura : winebuild: Move the CALL32_CBClient[Ex]_RetAddr implementation to krnl386.
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: ea66623c3cd1ff5e5d066adc8ab3a66bf6bb7b34 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ea66623c3cd1ff5e5d066adc…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Sun Oct 3 19:00:49 2021 -0500 winebuild: Move the CALL32_CBClient[Ex]_RetAddr implementation to krnl386. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/krnl386.exe16/kernel16_private.h | 5 +++-- dlls/krnl386.exe16/thunk.c | 12 ++++++------ dlls/krnl386.exe16/wowthunk.c | 33 ++++++++++++++++++++++++++------- tools/winebuild/relay.c | 28 ---------------------------- 4 files changed, 35 insertions(+), 43 deletions(-) diff --git a/dlls/krnl386.exe16/kernel16_private.h b/dlls/krnl386.exe16/kernel16_private.h index 279058ac68f..7ce1921e40b 100644 --- a/dlls/krnl386.exe16/kernel16_private.h +++ b/dlls/krnl386.exe16/kernel16_private.h @@ -291,8 +291,9 @@ extern WORD DOSMEM_BiosDataSeg DECLSPEC_HIDDEN; extern WORD DOSMEM_BiosSysSeg DECLSPEC_HIDDEN; extern DWORD CallTo16_DataSelector DECLSPEC_HIDDEN; extern DWORD CallTo16_TebSelector DECLSPEC_HIDDEN; -extern SEGPTR CALL32_CBClient_RetAddr DECLSPEC_HIDDEN; -extern SEGPTR CALL32_CBClientEx_RetAddr DECLSPEC_HIDDEN; + +extern WORD cbclient_selector DECLSPEC_HIDDEN; +extern WORD cbclientex_selector DECLSPEC_HIDDEN; struct tagSYSLEVEL; diff --git a/dlls/krnl386.exe16/thunk.c b/dlls/krnl386.exe16/thunk.c index 21c2ce5c524..c8a247299b4 100644 --- a/dlls/krnl386.exe16/thunk.c +++ b/dlls/krnl386.exe16/thunk.c @@ -137,8 +137,8 @@ struct SLApiDB DWORD errorReturnValue; }; -SEGPTR CALL32_CBClient_RetAddr = 0; -SEGPTR CALL32_CBClientEx_RetAddr = 0; +WORD cbclient_selector = 0; +WORD cbclientex_selector = 0; extern int call_entry_point( void *func, int nb_args, const DWORD *args ); extern void __wine_call_from_16_thunk(void); @@ -2094,8 +2094,8 @@ void WINAPI CBClientThunkSL( CONTEXT *context ) stackLin[3] = 0; stackLin[4] = OFFSETOF(stack) + 12; stackLin[5] = SELECTOROF(stack); - stackLin[6] = OFFSETOF(CALL32_CBClient_RetAddr); /* overwrite return address */ - stackLin[7] = SELECTOROF(CALL32_CBClient_RetAddr); + stackLin[6] = 0; /* overwrite return address */ + stackLin[7] = cbclient_selector; context->Eax = CALL32_CBClient( proc, args, stackLin + 4, &context->Esi ); stack16_pop( 12 ); } @@ -2159,8 +2159,8 @@ void WINAPI CBClientThunkSLEx( CONTEXT *context ) /* stackLin[6] and stackLin[7] reserved for the 32-bit stack ptr */ stackLin[8] = get_ds(); stackLin[9] = 0; - stackLin[10] = OFFSETOF(CALL32_CBClientEx_RetAddr); - stackLin[11] = SELECTOROF(CALL32_CBClientEx_RetAddr); + stackLin[10] = 0; + stackLin[11] = cbclientex_selector; context->Eax = CALL32_CBClientEx( proc, args, stackLin, &context->Esi, &nArgs ); stack16_pop( 24 ); diff --git a/dlls/krnl386.exe16/wowthunk.c b/dlls/krnl386.exe16/wowthunk.c index 800f3c275a5..ca3c57f8e0b 100644 --- a/dlls/krnl386.exe16/wowthunk.c +++ b/dlls/krnl386.exe16/wowthunk.c @@ -30,6 +30,7 @@ #include "winternl.h" #include "ntgdi.h" #include "kernel16_private.h" +#include "wine/asm.h" #include "wine/exception.h" #include "wine/debug.h" @@ -41,13 +42,29 @@ WINE_DECLARE_DEBUG_CHANNEL(snoop); extern DWORD WINAPI wine_call_to_16( FARPROC16 target, DWORD cbArgs, PEXCEPTION_HANDLER handler ); extern void WINAPI wine_call_to_16_regs( CONTEXT *context, DWORD cbArgs, PEXCEPTION_HANDLER handler ); extern void __wine_call_to_16_ret(void); -extern void CALL32_CBClient_Ret(void); -extern void CALL32_CBClientEx_Ret(void); extern BYTE __wine_call16_start[]; extern BYTE __wine_call16_end[]; static SEGPTR call16_ret_addr; /* segptr to __wine_call_to_16_ret routine */ +extern const BYTE cbclient_ret[], cbclient_ret_end[]; +__ASM_GLOBAL_FUNC( cbclient_ret, + "movzwl %sp,%ebx\n\t" + "lssl %ss:-16(%ebx),%esp\n\t" + "lretl\n\t" + ".globl " __ASM_NAME("cbclient_ret_end") "\n" + __ASM_NAME("cbclient_ret_end") ":" ) + +extern const BYTE cbclientex_ret[], cbclientex_ret_end[]; +__ASM_GLOBAL_FUNC( cbclientex_ret, + "movzwl %bp,%ebx\n\t" + "subw %bp,%sp\n\t" + "movzwl %sp,%ebp\n\t" + "lssl %ss:-12(%ebx),%esp\n\t" + "lretl\n\t" + ".globl " __ASM_NAME("cbclientex_ret_end") "\n" + __ASM_NAME("cbclientex_ret_end") ":" ) + /*********************************************************************** * WOWTHUNK_Init */ @@ -57,16 +74,18 @@ BOOL WOWTHUNK_Init(void) WORD codesel = SELECTOR_AllocBlock( __wine_call16_start, (BYTE *)(&CallTo16_TebSelector + 1) - __wine_call16_start, LDT_FLAGS_CODE | LDT_FLAGS_32BIT ); - if (!codesel) return FALSE; + + cbclient_selector = SELECTOR_AllocBlock( cbclient_ret, cbclient_ret_end - cbclient_ret, + LDT_FLAGS_CODE | LDT_FLAGS_32BIT ); + cbclientex_selector = SELECTOR_AllocBlock( cbclientex_ret, cbclientex_ret_end - cbclientex_ret, + LDT_FLAGS_CODE | LDT_FLAGS_32BIT ); + if (!codesel || cbclient_selector || !cbclientex_selector) + return FALSE; /* Patch the return addresses for CallTo16 routines */ CallTo16_DataSelector = get_ds(); call16_ret_addr = MAKESEGPTR( codesel, (BYTE *)__wine_call_to_16_ret - __wine_call16_start ); - CALL32_CBClient_RetAddr = - MAKESEGPTR( codesel, (BYTE *)CALL32_CBClient_Ret - __wine_call16_start ); - CALL32_CBClientEx_RetAddr = - MAKESEGPTR( codesel, (BYTE *)CALL32_CBClientEx_Ret - __wine_call16_start ); if (TRACE_ON(relay) || TRACE_ON(snoop)) RELAY16_InitDebugLists(); diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index eaa70888986..43a35af211c 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -564,28 +564,6 @@ static void BuildRet16Func(void) } -static void BuildCallTo32CBClient( int isEx ) -{ - /* '16-bit' return stub */ - - function_header( isEx ? "CALL32_CBClientEx_Ret" : "CALL32_CBClient_Ret" ); - if ( !isEx ) - { - output( "\tmovzwl %%sp, %%ebx\n" ); - output( "\tlssl %%ss:-16(%%ebx), %%esp\n" ); - } - else - { - output( "\tmovzwl %%bp, %%ebx\n" ); - output( "\tsubw %%bp, %%sp\n" ); - output( "\tmovzwl %%sp, %%ebp\n" ); - output( "\tlssl %%ss:-12(%%ebx), %%esp\n" ); - } - output( "\tlret\n" ); - output_function_size( isEx ? "CALL32_CBClientEx_Ret" : "CALL32_CBClient_Ret" ); -} - - /******************************************************************* * output_asm_relays16 * @@ -618,12 +596,6 @@ void output_asm_relays16(void) /* Standard CallTo16 return stub */ BuildRet16Func(); - /* CBClientThunkSL routine */ - BuildCallTo32CBClient( 0 ); - - /* CBClientThunkSLEx routine */ - BuildCallTo32CBClient( 1 ); - output( "%s\n", asm_globl("__wine_call16_end") ); output_function_size( "__wine_spec_thunk_text_16" );
1
0
0
0
Zebediah Figura : krnl386: Return to CALL32_CBClient_RetAddr from CBClientThunkSL().
by Alexandre Julliard
04 Oct '21
04 Oct '21
Module: wine Branch: master Commit: 0a01ad0c365f15ecb94edade038052bf69a4eb2a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0a01ad0c365f15ecb94edade…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Sun Oct 3 19:00:48 2021 -0500 krnl386: Return to CALL32_CBClient_RetAddr from CBClientThunkSL(). Fixes a copy-paste error which was introduced by 71914125ceb1f9bfda8a90f26019c043112580b6. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/krnl386.exe16/thunk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/krnl386.exe16/thunk.c b/dlls/krnl386.exe16/thunk.c index 4a373b6c7cb..21c2ce5c524 100644 --- a/dlls/krnl386.exe16/thunk.c +++ b/dlls/krnl386.exe16/thunk.c @@ -2094,8 +2094,8 @@ void WINAPI CBClientThunkSL( CONTEXT *context ) stackLin[3] = 0; stackLin[4] = OFFSETOF(stack) + 12; stackLin[5] = SELECTOROF(stack); - stackLin[6] = OFFSETOF(CALL32_CBClientEx_RetAddr); /* overwrite return address */ - stackLin[7] = SELECTOROF(CALL32_CBClientEx_RetAddr); + stackLin[6] = OFFSETOF(CALL32_CBClient_RetAddr); /* overwrite return address */ + stackLin[7] = SELECTOROF(CALL32_CBClient_RetAddr); context->Eax = CALL32_CBClient( proc, args, stackLin + 4, &context->Esi ); stack16_pop( 12 ); }
1
0
0
0
← Newer
1
...
107
108
109
110
111
112
113
...
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