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
Jacek Caban : gdi32: Don't export Wine extensions.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: c166e9694eac3aa5124e1c2039248ac6d063dccc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c166e9694eac3aa5124e1c20…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Oct 8 13:34:42 2021 +0200 gdi32: Don't export Wine extensions. Link directly to win32u instead. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d12/Makefile.in | 2 +- dlls/dxgi/Makefile.in | 2 +- dlls/gdi.exe16/Makefile.in | 2 +- dlls/gdi32/gdi32.spec | 20 -------------------- dlls/opengl32/Makefile.in | 2 +- dlls/user.exe16/Makefile.in | 2 +- dlls/wined3d/Makefile.in | 2 +- dlls/winevulkan/Makefile.in | 2 +- 8 files changed, 7 insertions(+), 27 deletions(-) diff --git a/dlls/d3d12/Makefile.in b/dlls/d3d12/Makefile.in index 71c2c879f4b..64930ac442e 100644 --- a/dlls/d3d12/Makefile.in +++ b/dlls/d3d12/Makefile.in @@ -1,6 +1,6 @@ MODULE = d3d12.dll IMPORTLIB = d3d12 -IMPORTS = dxgi dxguid gdi32 user32 uuid +IMPORTS = dxgi dxguid gdi32 user32 uuid win32u EXTRALIBS = $(VKD3D_LIBS) EXTRAINCL = $(VKD3D_CFLAGS) diff --git a/dlls/dxgi/Makefile.in b/dlls/dxgi/Makefile.in index 7460d5098b6..3a28d0462de 100644 --- a/dlls/dxgi/Makefile.in +++ b/dlls/dxgi/Makefile.in @@ -1,6 +1,6 @@ MODULE = dxgi.dll IMPORTLIB = dxgi -IMPORTS = gdi32 dxguid uuid wined3d user32 +IMPORTS = gdi32 dxguid uuid wined3d user32 win32u EXTRAINCL = $(VKD3D_CFLAGS) EXTRADLLFLAGS = -mcygwin diff --git a/dlls/gdi.exe16/Makefile.in b/dlls/gdi.exe16/Makefile.in index 312641cd513..21850e2e660 100644 --- a/dlls/gdi.exe16/Makefile.in +++ b/dlls/gdi.exe16/Makefile.in @@ -1,5 +1,5 @@ MODULE = gdi.exe16 -IMPORTS = user32 advapi32 gdi32 +IMPORTS = user32 advapi32 gdi32 win32u EXTRADLLFLAGS = -m16 -Wb,--main-module,gdi32.dll,--heap,65520 diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 74e452c9b67..c6fe436b7c9 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -543,23 +543,3 @@ @ extern pfnRealizePalette @ extern pfnSelectPalette @ stub pstackConnect - -################################################################ -# Wine extensions: Win16 functions that are needed by other dlls -# -@ stdcall SetHookFlags(long long) - -################################################################ -# Wine internal extensions -# -# All functions must be prefixed with '__wine_' (for internal functions) -# or 'wine_' (for user-visible functions) to avoid namespace conflicts. - -# GDI objects -@ cdecl __wine_set_visible_region(long long ptr ptr ptr) - -# OpenGL -@ cdecl __wine_get_wgl_driver(long long) - -# Vulkan -@ cdecl __wine_get_vulkan_driver(long long) diff --git a/dlls/opengl32/Makefile.in b/dlls/opengl32/Makefile.in index 2e8fe657f40..fc27b481df3 100644 --- a/dlls/opengl32/Makefile.in +++ b/dlls/opengl32/Makefile.in @@ -1,7 +1,7 @@ MODULE = opengl32.dll EXTRADEFS = -D_OPENGL32_ IMPORTLIB = opengl32 -IMPORTS = user32 gdi32 advapi32 +IMPORTS = user32 gdi32 advapi32 win32u DELAYIMPORTS = glu32 EXTRADLLFLAGS = -Wl,--image-base,0x7a800000 -mcygwin diff --git a/dlls/user.exe16/Makefile.in b/dlls/user.exe16/Makefile.in index 5a82b7590cd..7e2438d033f 100644 --- a/dlls/user.exe16/Makefile.in +++ b/dlls/user.exe16/Makefile.in @@ -1,5 +1,5 @@ MODULE = user.exe16 -IMPORTS = mpr user32 gdi32 +IMPORTS = mpr user32 gdi32 win32u EXTRADLLFLAGS = -m16 -Wb,--main-module,user32.dll,--heap,65520 C_SRCS = \ diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in index 1d1782855de..41e129b24f6 100644 --- a/dlls/wined3d/Makefile.in +++ b/dlls/wined3d/Makefile.in @@ -1,6 +1,6 @@ MODULE = wined3d.dll IMPORTLIB = wined3d -IMPORTS = opengl32 user32 gdi32 advapi32 +IMPORTS = opengl32 user32 gdi32 advapi32 win32u EXTRAINCL = $(VKD3D_SHADER_CFLAGS) EXTRADLLFLAGS = -mcygwin diff --git a/dlls/winevulkan/Makefile.in b/dlls/winevulkan/Makefile.in index bb5248c8f73..52b397e4242 100644 --- a/dlls/winevulkan/Makefile.in +++ b/dlls/winevulkan/Makefile.in @@ -1,6 +1,6 @@ MODULE = winevulkan.dll IMPORTLIB = winevulkan -IMPORTS = user32 gdi32 advapi32 setupapi +IMPORTS = user32 gdi32 advapi32 setupapi win32u EXTRALIBS = $(PTHREAD_LIBS) C_SRCS = \
1
0
0
0
Jacek Caban : user32: Link directly to win32u.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: 80df54a407680859ea777ae0b60aef6f8f378719 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=80df54a407680859ea777ae0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Oct 8 13:34:21 2021 +0200 user32: Link directly to win32u. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/gdi32.spec | 6 ------ dlls/user32/Makefile.in | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 94a5cefdfa4..74e452c9b67 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -547,8 +547,6 @@ ################################################################ # Wine extensions: Win16 functions that are needed by other dlls # -@ stdcall GetDCHook(long ptr) -@ stdcall SetDCHook(long ptr long) @ stdcall SetHookFlags(long long) ################################################################ @@ -558,12 +556,8 @@ # or 'wine_' (for user-visible functions) to avoid namespace conflicts. # GDI objects -@ cdecl __wine_make_gdi_object_system(long long) @ cdecl __wine_set_visible_region(long long ptr ptr ptr) -# Graphics drivers -@ cdecl __wine_set_display_driver(long) - # OpenGL @ cdecl __wine_get_wgl_driver(long long) diff --git a/dlls/user32/Makefile.in b/dlls/user32/Makefile.in index 50bba8c1786..38ce2aad997 100644 --- a/dlls/user32/Makefile.in +++ b/dlls/user32/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -D_USER32_ -D_WINABLE_ MODULE = user32.dll IMPORTLIB = user32 -IMPORTS = setupapi gdi32 version sechost advapi32 kernelbase +IMPORTS = setupapi gdi32 version sechost advapi32 kernelbase win32u EXTRAINCL = $(PNG_CFLAGS) DELAYIMPORTS = hid imm32
1
0
0
0
Jacek Caban : gdi32: Rename gdidc.c to dc.c.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: 5a66203ba5f1e34c9ac700f626024a0b976a0475 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5a66203ba5f1e34c9ac700f6…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Oct 8 13:34:02 2021 +0200 gdi32: Rename gdidc.c to dc.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/Makefile.in | 2 +- dlls/gdi32/{gdidc.c => dc.c} | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in index c2f1648a172..3e0495f877b 100644 --- a/dlls/gdi32/Makefile.in +++ b/dlls/gdi32/Makefile.in @@ -5,9 +5,9 @@ IMPORTS = advapi32 win32u DELAYIMPORTS = setupapi C_SRCS = \ + dc.c \ emfdc.c \ enhmetafile.c \ - gdidc.c \ icm.c \ metadc.c \ metafile.c \ diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/dc.c similarity index 99% rename from dlls/gdi32/gdidc.c rename to dlls/gdi32/dc.c index 5ea18e58b18..1511c565194 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/dc.c @@ -4,6 +4,7 @@ * Copyright 1993, 1994 Alexandre Julliard * Copyright 1997 Bertho A. Stultiens * 1999 Huw D M Davies + * Copyright 2021 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public
1
0
0
0
Daniel Lehman : ntoskrnl.exe: Fix use-after-free when freeing IRP.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: de0e9ad9654f7ba568e2b7f81727bdfcc7327d23 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=de0e9ad9654f7ba568e2b7f8…
Author: Daniel Lehman <dlehman(a)esri.com> Date: Thu Oct 7 10:02:33 2021 -0700 ntoskrnl.exe: Fix use-after-free when freeing IRP. Signed-off-by: Daniel Lehman <dlehman(a)esri.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/ntoskrnl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index f2fb0a6d66e..ec297e7d64a 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -1011,8 +1011,9 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ) { if (context.irp_data->complete) { - IoCompleteRequest( context.irp_data->irp, IO_NO_INCREMENT ); + IRP *irp = context.irp_data->irp; free_dispatch_irp( context.irp_data ); + IoCompleteRequest( irp, IO_NO_INCREMENT ); } else {
1
0
0
0
Rémi Bernon : winebus.sys: Queue HID reports instead of overwritting the last one.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: c9003fab66dbe5311c81ab9198612d746f28f013 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c9003fab66dbe5311c81ab91…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 8 10:01:25 2021 +0200 winebus.sys: Queue HID reports instead of overwritting the last one. If the hidclass.sys read requests aren't done fast enough. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/main.c | 100 ++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 62 deletions(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 57a751655cc..16192977bef 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -54,6 +54,13 @@ static DEVICE_OBJECT *bus_fdo; static HANDLE driver_key; +struct hid_report +{ + struct list entry; + ULONG length; + BYTE buffer[1]; +}; + enum device_state { DEVICE_STATE_STOPPED, @@ -77,10 +84,7 @@ struct device_extension HIDP_DEVICE_DESC collection_desc; BYTE *last_reports[256]; - BYTE *last_report; - DWORD last_report_size; - BOOL last_report_read; - DWORD buffer_size; + struct list reports; IRP *pending_read; struct unix_device *unix_device; @@ -307,11 +311,8 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni ext->device = device; ext->desc = *desc; ext->index = get_device_index(desc); - ext->last_report = NULL; - ext->last_report_size = 0; - ext->last_report_read = TRUE; - ext->buffer_size = 0; ext->unix_device = unix_device; + list_init(&ext->reports); InitializeCriticalSection(&ext->cs); ext->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs"); @@ -397,63 +398,43 @@ static DWORD check_bus_option(const WCHAR *option, DWORD default_value) return default_value; } -static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_length, BYTE* buffer, ULONG_PTR *out_length) +static BOOL deliver_next_report(struct device_extension *ext, IRP *irp) { - if (buffer_length < ext->last_report_size) - { - *out_length = 0; - return STATUS_BUFFER_TOO_SMALL; - } - else - { - if (ext->last_report) - memcpy(buffer, ext->last_report, ext->last_report_size); - *out_length = ext->last_report_size; - return STATUS_SUCCESS; - } + struct hid_report *report; + struct list *entry; + + if (!(entry = list_head(&ext->reports))) return FALSE; + report = LIST_ENTRY(entry, struct hid_report, entry); + list_remove(&report->entry); + + memcpy(irp->UserBuffer, report->buffer, report->length); + irp->IoStatus.Information = report->length; + irp->IoStatus.Status = STATUS_SUCCESS; + + RtlFreeHeap(GetProcessHeap(), 0, report); + return TRUE; } -static void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) +static void process_hid_report(DEVICE_OBJECT *device, BYTE *report_buf, DWORD report_len) { struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - IO_STACK_LOCATION *stack; - ULONG buffer_len; + ULONG size = offsetof(struct hid_report, buffer[report_len]); + struct hid_report *report; IRP *irp; - if (!length || !report) - return; + if (!(report = RtlAllocateHeap(GetProcessHeap(), 0, size))) return; + memcpy(report->buffer, report_buf, report_len); + report->length = report_len; RtlEnterCriticalSection(&ext->cs); - if (length > ext->buffer_size) - { - RtlFreeHeap(GetProcessHeap(), 0, ext->last_report); - ext->last_report = RtlAllocateHeap(GetProcessHeap(), 0, length); - if (!ext->last_report) - { - ERR_(hid_report)("Failed to alloc last report\n"); - ext->buffer_size = 0; - ext->last_report_size = 0; - ext->last_report_read = TRUE; - RtlLeaveCriticalSection(&ext->cs); - return; - } - else - ext->buffer_size = length; - } - - memcpy(ext->last_report, report, length); - ext->last_report_size = length; - ext->last_report_read = FALSE; + list_add_tail(&ext->reports, &report->entry); - if (!ext->collection_desc.ReportIDs[0].ReportID) memcpy(ext->last_reports[0], report, length); - else memcpy(ext->last_reports[report[0]], report, length); + if (!ext->collection_desc.ReportIDs[0].ReportID) memcpy(ext->last_reports[0], report_buf, report_len); + else memcpy(ext->last_reports[report_buf[0]], report_buf, report_len); if ((irp = pop_pending_read(ext))) { - stack = IoGetCurrentIrpStackLocation(irp); - buffer_len = stack->Parameters.DeviceIoControl.OutputBufferLength; - irp->IoStatus.Status = deliver_last_report(ext, buffer_len, irp->UserBuffer, &irp->IoStatus.Information); - ext->last_report_read = TRUE; + deliver_next_report(ext, irp); IoCompleteRequest(irp, IO_NO_INCREMENT); } RtlLeaveCriticalSection(&ext->cs); @@ -819,6 +800,7 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) struct device_extension *ext = device->DeviceExtension; NTSTATUS status = irp->IoStatus.Status; IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp); + struct hid_report *report, *next; HIDP_REPORT_IDS *reports; ULONG i, size; @@ -885,11 +867,12 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) ext->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&ext->cs); - RtlFreeHeap(GetProcessHeap(), 0, ext->last_report); - irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest(irp, IO_NO_INCREMENT); + LIST_FOR_EACH_ENTRY_SAFE(report, next, &ext->reports, struct hid_report, entry) + RtlFreeHeap(GetProcessHeap(), 0, report); + reports = ext->collection_desc.ReportIDs; for (i = 0; i < ext->collection_desc.ReportIDsLength; ++i) { @@ -1046,14 +1029,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) } case IOCTL_HID_READ_REPORT: { - TRACE_(hid_report)("IOCTL_HID_READ_REPORT\n"); - if (!ext->last_report_read) - { - irp->IoStatus.Status = deliver_last_report(ext, - buffer_len, irp->UserBuffer, &irp->IoStatus.Information); - ext->last_report_read = TRUE; - } - else + if (!deliver_next_report(ext, irp)) { /* hidclass.sys should guarantee this */ assert(!ext->pending_read);
1
0
0
0
Rémi Bernon : winebus.sys: Keep a separate report buffer for each input report id.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: 068511f8cb8620514928ae639d190ea60f007b6e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=068511f8cb8620514928ae63…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 8 10:01:24 2021 +0200 winebus.sys: Keep a separate report buffer for each input report id. And use them for IOCTL_HID_GET_INPUT_REPORT ioctls. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/main.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 541f9052ed3..57a751655cc 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -76,6 +76,7 @@ struct device_extension ULONG report_desc_length; HIDP_DEVICE_DESC collection_desc; + BYTE *last_reports[256]; BYTE *last_report; DWORD last_report_size; BOOL last_report_read; @@ -444,6 +445,9 @@ static void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length ext->last_report_size = length; ext->last_report_read = FALSE; + if (!ext->collection_desc.ReportIDs[0].ReportID) memcpy(ext->last_reports[0], report, length); + else memcpy(ext->last_reports[report[0]], report, length); + if ((irp = pop_pending_read(ext))) { stack = IoGetCurrentIrpStackLocation(irp); @@ -815,6 +819,8 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) struct device_extension *ext = device->DeviceExtension; NTSTATUS status = irp->IoStatus.Status; IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp); + HIDP_REPORT_IDS *reports; + ULONG i, size; TRACE("device %p, irp %p, minor function %#x.\n", device, irp, irpsp->MinorFunction); @@ -849,8 +855,14 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) ERR("Failed to parse device %p report descriptor, status %#x\n", device, status); else { - ext->state = DEVICE_STATE_STARTED; status = STATUS_SUCCESS; + reports = ext->collection_desc.ReportIDs; + for (i = 0; i < ext->collection_desc.ReportIDsLength; ++i) + { + if (!(size = reports[i].InputLength)) continue; + if (!(ext->last_reports[reports[i].ReportID] = RtlAllocateHeap(GetProcessHeap(), 0, size))) status = STATUS_NO_MEMORY; + } + if (!status) ext->state = DEVICE_STATE_STARTED; } } RtlLeaveCriticalSection(&ext->cs); @@ -878,6 +890,12 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest(irp, IO_NO_INCREMENT); + reports = ext->collection_desc.ReportIDs; + for (i = 0; i < ext->collection_desc.ReportIDsLength; ++i) + { + if (!reports[i].InputLength) continue; + RtlFreeHeap(GetProcessHeap(), 0, ext->last_reports[reports[i].ReportID]); + } HidP_FreeCollectionDescription(&ext->collection_desc); RtlFreeHeap(GetProcessHeap(), 0, ext->report_desc); @@ -1020,14 +1038,10 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) } case IOCTL_HID_GET_INPUT_REPORT: { - HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer); - TRACE_(hid_report)("IOCTL_HID_GET_INPUT_REPORT\n"); - irp->IoStatus.Status = deliver_last_report(ext, - packet->reportBufferLen, packet->reportBuffer, - &irp->IoStatus.Information); - - if (irp->IoStatus.Status == STATUS_SUCCESS) - packet->reportBufferLen = irp->IoStatus.Information; + HID_XFER_PACKET *packet = (HID_XFER_PACKET *)irp->UserBuffer; + memcpy(packet->reportBuffer, ext->last_reports[packet->reportId], packet->reportBufferLen); + irp->IoStatus.Information = packet->reportBufferLen; + irp->IoStatus.Status = STATUS_SUCCESS; break; } case IOCTL_HID_READ_REPORT:
1
0
0
0
Rémi Bernon : winebus.sys: Query and parse device report descriptor on device start.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: 9132979000c90880ab6fbc477bcb7754355f9350 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9132979000c90880ab6fbc47…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 8 10:01:23 2021 +0200 winebus.sys: Query and parse device report descriptor on device start. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/Makefile.in | 2 +- dlls/winebus.sys/main.c | 80 +++++++++++++++++++++++++++----------------- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/dlls/winebus.sys/Makefile.in b/dlls/winebus.sys/Makefile.in index 4091c925797..6fc6fc5a632 100644 --- a/dlls/winebus.sys/Makefile.in +++ b/dlls/winebus.sys/Makefile.in @@ -1,6 +1,6 @@ MODULE = winebus.sys UNIXLIB = winebus.so -IMPORTS = ntoskrnl advapi32 +IMPORTS = ntoskrnl hidparse EXTRALIBS = $(IOKIT_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) EXTRAINCL = $(UDEV_CFLAGS) $(SDL2_CFLAGS) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 33b2a609077..541f9052ed3 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -32,6 +32,7 @@ #include "ddk/wdm.h" #include "ddk/hidport.h" #include "ddk/hidtypes.h" +#include "ddk/hidpddi.h" #include "wine/asm.h" #include "wine/debug.h" #include "wine/list.h" @@ -71,6 +72,10 @@ struct device_extension struct device_desc desc; DWORD index; + BYTE *report_desc; + ULONG report_desc_length; + HIDP_DEVICE_DESC collection_desc; + BYTE *last_report; DWORD last_report_size; BOOL last_report_read; @@ -827,8 +832,27 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) RtlEnterCriticalSection(&ext->cs); if (ext->state != DEVICE_STATE_STOPPED) status = STATUS_SUCCESS; else if (ext->state == DEVICE_STATE_REMOVED) status = STATUS_DELETE_PENDING; - else if (!(status = unix_device_start(device))) ext->state = DEVICE_STATE_STARTED; - else ERR("failed to start device %p, status %#x\n", device, status); + else if ((status = unix_device_start(device))) + ERR("Failed to start device %p, status %#x\n", device, status); + else + { + status = unix_device_get_report_descriptor(device, NULL, 0, &ext->report_desc_length); + if (status != STATUS_SUCCESS && status != STATUS_BUFFER_TOO_SMALL) + ERR("Failed to get device %p report descriptor, status %#x\n", device, status); + else if (!(ext->report_desc = RtlAllocateHeap(GetProcessHeap(), 0, ext->report_desc_length))) + status = STATUS_NO_MEMORY; + else if ((status = unix_device_get_report_descriptor(device, ext->report_desc, ext->report_desc_length, + &ext->report_desc_length))) + ERR("Failed to get device %p report descriptor, status %#x\n", device, status); + else if ((status = HidP_GetCollectionDescription(ext->report_desc, ext->report_desc_length, + PagedPool, &ext->collection_desc)) != HIDP_STATUS_SUCCESS) + ERR("Failed to parse device %p report descriptor, status %#x\n", device, status); + else + { + ext->state = DEVICE_STATE_STARTED; + status = STATUS_SUCCESS; + } + } RtlLeaveCriticalSection(&ext->cs); break; @@ -854,6 +878,9 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest(irp, IO_NO_INCREMENT); + HidP_FreeCollectionDescription(&ext->collection_desc); + RtlFreeHeap(GetProcessHeap(), 0, ext->report_desc); + IoDeleteDevice(device); return STATUS_SUCCESS; @@ -955,40 +982,31 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_GET_DEVICE_DESCRIPTOR: { HID_DESCRIPTOR *descriptor = (HID_DESCRIPTOR *)irp->UserBuffer; - DWORD length; - TRACE("IOCTL_HID_GET_DEVICE_DESCRIPTOR\n"); - - if (buffer_len < sizeof(*descriptor)) - { - irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - break; - } - - irp->IoStatus.Status = unix_device_get_report_descriptor(device, NULL, 0, &length); - if (irp->IoStatus.Status != STATUS_SUCCESS && - irp->IoStatus.Status != STATUS_BUFFER_TOO_SMALL) + irp->IoStatus.Information = sizeof(*descriptor); + if (buffer_len < sizeof(*descriptor)) irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + else { - WARN("Failed to get platform report descriptor length\n"); - break; + memset(descriptor, 0, sizeof(*descriptor)); + descriptor->bLength = sizeof(*descriptor); + descriptor->bDescriptorType = HID_HID_DESCRIPTOR_TYPE; + descriptor->bcdHID = HID_REVISION; + descriptor->bCountry = 0; + descriptor->bNumDescriptors = 1; + descriptor->DescriptorList[0].bReportType = HID_REPORT_DESCRIPTOR_TYPE; + descriptor->DescriptorList[0].wReportLength = ext->report_desc_length; + irp->IoStatus.Status = STATUS_SUCCESS; } - - memset(descriptor, 0, sizeof(*descriptor)); - descriptor->bLength = sizeof(*descriptor); - descriptor->bDescriptorType = HID_HID_DESCRIPTOR_TYPE; - descriptor->bcdHID = HID_REVISION; - descriptor->bCountry = 0; - descriptor->bNumDescriptors = 1; - descriptor->DescriptorList[0].bReportType = HID_REPORT_DESCRIPTOR_TYPE; - descriptor->DescriptorList[0].wReportLength = length; - - irp->IoStatus.Status = STATUS_SUCCESS; - irp->IoStatus.Information = sizeof(*descriptor); break; } case IOCTL_HID_GET_REPORT_DESCRIPTOR: - TRACE("IOCTL_HID_GET_REPORT_DESCRIPTOR\n"); - irp->IoStatus.Status = unix_device_get_report_descriptor(device, irp->UserBuffer, buffer_len, &buffer_len); - irp->IoStatus.Information = buffer_len; + irp->IoStatus.Information = ext->report_desc_length; + if (buffer_len < irp->IoStatus.Information) + irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + else + { + memcpy(irp->UserBuffer, ext->report_desc, ext->report_desc_length); + irp->IoStatus.Status = STATUS_SUCCESS; + } break; case IOCTL_HID_GET_STRING: {
1
0
0
0
Rémi Bernon : winebus.sys: Only keep a single read pending.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: bd780ba618f92825752aab65b8048666f6ce946e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bd780ba618f92825752aab65…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 8 10:01:22 2021 +0200 winebus.sys: Only keep a single read pending. The design of hidclass.sys prevents any concurrent irps, there's no need to queue more. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/main.c | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index c9e930632e2..33b2a609077 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -19,6 +19,7 @@ */ #include <stdarg.h> +#include <assert.h> #include "ntstatus.h" #define WIN32_NO_STATUS @@ -74,7 +75,7 @@ struct device_extension DWORD last_report_size; BOOL last_report_read; DWORD buffer_size; - LIST_ENTRY irp_queue; + IRP *pending_read; struct unix_device *unix_device; }; @@ -249,17 +250,28 @@ static WCHAR *get_compatible_ids(DEVICE_OBJECT *device) return dst; } +static IRP *pop_pending_read(struct device_extension *ext) +{ + IRP *pending; + + RtlEnterCriticalSection(&ext->cs); + pending = ext->pending_read; + ext->pending_read = NULL; + RtlLeaveCriticalSection(&ext->cs); + + return pending; +} + static void remove_pending_irps(DEVICE_OBJECT *device) { struct device_extension *ext = device->DeviceExtension; - LIST_ENTRY *entry; + IRP *pending; - while ((entry = RemoveHeadList(&ext->irp_queue)) != &ext->irp_queue) + if ((pending = pop_pending_read(ext))) { - IRP *queued_irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.ListEntry); - queued_irp->IoStatus.Status = STATUS_DELETE_PENDING; - queued_irp->IoStatus.Information = 0; - IoCompleteRequest(queued_irp, IO_NO_INCREMENT); + pending->IoStatus.Status = STATUS_DELETE_PENDING; + pending->IoStatus.Information = 0; + IoCompleteRequest(pending, IO_NO_INCREMENT); } } @@ -295,7 +307,6 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni ext->buffer_size = 0; ext->unix_device = unix_device; - InitializeListHead(&ext->irp_queue); InitializeCriticalSection(&ext->cs); ext->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs"); @@ -398,9 +409,10 @@ static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_l static void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) { - struct device_extension *ext = (struct device_extension*)device->DeviceExtension; + struct device_extension *ext = (struct device_extension *)device->DeviceExtension; + IO_STACK_LOCATION *stack; + ULONG buffer_len; IRP *irp; - LIST_ENTRY *entry; if (!length || !report) return; @@ -427,15 +439,11 @@ static void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length ext->last_report_size = length; ext->last_report_read = FALSE; - while ((entry = RemoveHeadList(&ext->irp_queue)) != &ext->irp_queue) + if ((irp = pop_pending_read(ext))) { - IO_STACK_LOCATION *irpsp; - TRACE_(hid_report)("Processing Request\n"); - irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.ListEntry); - irpsp = IoGetCurrentIrpStackLocation(irp); - irp->IoStatus.Status = deliver_last_report(ext, - irpsp->Parameters.DeviceIoControl.OutputBufferLength, - irp->UserBuffer, &irp->IoStatus.Information); + stack = IoGetCurrentIrpStackLocation(irp); + buffer_len = stack->Parameters.DeviceIoControl.OutputBufferLength; + irp->IoStatus.Status = deliver_last_report(ext, buffer_len, irp->UserBuffer, &irp->IoStatus.Information); ext->last_report_read = TRUE; IoCompleteRequest(irp, IO_NO_INCREMENT); } @@ -1015,7 +1023,10 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) } else { - InsertTailList(&ext->irp_queue, &irp->Tail.Overlay.ListEntry); + /* hidclass.sys should guarantee this */ + assert(!ext->pending_read); + ext->pending_read = irp; + IoMarkIrpPending(irp); irp->IoStatus.Status = STATUS_PENDING; } break;
1
0
0
0
Rémi Bernon : dinput: Look for the PID set ramp force output report.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: bbcee5c23d35f64e9fd86f19a4176c2021fcc881 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bbcee5c23d35f64e9fd86f19…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 8 09:50:29 2021 +0200 dinput: Look for the PID set ramp force 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 | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 9369f3d8873..b2aac264bb7 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -143,6 +143,14 @@ struct pid_set_constant_force struct hid_value_caps *magnitude_caps; }; +struct pid_set_ramp_force +{ + BYTE id; + ULONG collection; + struct hid_value_caps *start_caps; + struct hid_value_caps *end_caps; +}; + #define DEVICE_STATE_MAX_SIZE 1024 struct hid_joystick @@ -179,6 +187,7 @@ struct hid_joystick struct pid_set_envelope pid_set_envelope; struct pid_set_condition pid_set_condition; struct pid_set_constant_force pid_set_constant_force; + struct pid_set_ramp_force pid_set_ramp_force; }; static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) @@ -200,6 +209,7 @@ struct hid_joystick_effect DWORD axes[6]; LONG directions[6]; DICONSTANTFORCE constant_force; + DIRAMPFORCE ramp_force; DICONDITION condition[2]; DIENVELOPE envelope; DIPERIODIC periodic; @@ -1920,6 +1930,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * DIDEVICEOBJECTINSTANCEW *instance, void *data ) { struct pid_set_constant_force *set_constant_force = &impl->pid_set_constant_force; + struct pid_set_ramp_force *set_ramp_force = &impl->pid_set_ramp_force; 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; @@ -1955,6 +1966,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps * case PID_USAGE_SET_ENVELOPE_REPORT: SET_COLLECTION( set_envelope ); break; case PID_USAGE_SET_CONDITION_REPORT: SET_COLLECTION( set_condition ); break; case PID_USAGE_SET_CONSTANT_FORCE_REPORT: SET_COLLECTION( set_constant_force ); break; + case PID_USAGE_SET_RAMP_FORCE_REPORT: SET_COLLECTION( set_ramp_force ); 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; @@ -1977,6 +1989,7 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap DIDEVICEOBJECTINSTANCEW *instance, void *data ) { struct pid_set_constant_force *set_constant_force = &impl->pid_set_constant_force; + struct pid_set_ramp_force *set_ramp_force = &impl->pid_set_ramp_force; 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; @@ -2133,6 +2146,22 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap set_constant_force->magnitude_caps = caps; } } + if (instance->wCollectionNumber == set_ramp_force->collection) + { + SET_REPORT_ID( set_ramp_force ); + if (instance->wUsage == PID_USAGE_RAMP_START) + { + caps->physical_min = -10000; + caps->physical_max = 10000; + set_ramp_force->start_caps = caps; + } + if (instance->wUsage == PID_USAGE_RAMP_END) + { + caps->physical_min = -10000; + caps->physical_max = 10000; + set_ramp_force->start_caps = caps; + } + } #undef SET_REPORT_ID @@ -2244,6 +2273,7 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID TRACE( "set condition id %u, coll %u\n", impl->pid_set_condition.id, impl->pid_set_condition.collection ); TRACE( "set constant force id %u, coll %u\n", impl->pid_set_constant_force.id, impl->pid_set_constant_force.collection ); + TRACE( "set ramp force id %u, coll %u\n", impl->pid_set_ramp_force.id, impl->pid_set_ramp_force.collection ); if (impl->pid_device_control.id) { @@ -2409,6 +2439,13 @@ static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface, if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG; break; case PID_USAGE_ET_RAMP: + status = HidP_InitializeReportForID( HidP_Output, joystick->pid_set_ramp_force.id, joystick->preparsed, + impl->type_specific_buf[0], report_len ); + if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG; + status = HidP_InitializeReportForID( HidP_Output, joystick->pid_set_envelope.id, joystick->preparsed, + impl->type_specific_buf[1], report_len ); + if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG; + break; case PID_USAGE_ET_CUSTOM_FORCE_DATA: FIXME( "effect type %#x not implemented!\n", type ); impl->type_specific_buf[0][0] = 0; @@ -2562,6 +2599,10 @@ static HRESULT WINAPI hid_joystick_effect_GetParameters( IDirectInputEffect *ifa memcpy( params->lpvTypeSpecificParams, &impl->constant_force, sizeof(DICONSTANTFORCE) ); break; case PID_USAGE_ET_RAMP: + if (!params->lpvTypeSpecificParams) return E_POINTER; + if (params->cbTypeSpecificParams != sizeof(DIRAMPFORCE)) return DIERR_INVALIDPARAM; + memcpy( params->lpvTypeSpecificParams, &impl->constant_force, sizeof(DIRAMPFORCE) ); + break; case PID_USAGE_ET_CUSTOM_FORCE_DATA: FIXME( "DIEP_TYPESPECIFICPARAMS not implemented!\n" ); return DIERR_UNSUPPORTED; @@ -2727,6 +2768,13 @@ static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *ifa impl->params.cbTypeSpecificParams = sizeof(DICONSTANTFORCE); break; case PID_USAGE_ET_RAMP: + if (!params->lpvTypeSpecificParams) return E_POINTER; + if (params->cbTypeSpecificParams != sizeof(DIRAMPFORCE)) return DIERR_INVALIDPARAM; + if (memcmp( &impl->constant_force, params->lpvTypeSpecificParams, sizeof(DIRAMPFORCE) )) + impl->modified = TRUE; + memcpy( &impl->constant_force, params->lpvTypeSpecificParams, sizeof(DIRAMPFORCE) ); + impl->params.cbTypeSpecificParams = sizeof(DIRAMPFORCE); + break; case PID_USAGE_ET_CUSTOM_FORCE_DATA: FIXME( "DIEP_TYPESPECIFICPARAMS not implemented!\n" ); return DIERR_UNSUPPORTED; @@ -2933,6 +2981,7 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) static const DWORD complete_mask = DIEP_AXES | DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS; struct hid_joystick_effect *impl = impl_from_IDirectInputEffect( iface ); struct pid_set_constant_force *set_constant_force = &impl->joystick->pid_set_constant_force; + struct pid_set_ramp_force *set_ramp_force = &impl->joystick->pid_set_ramp_force; struct pid_effect_update *effect_update = &impl->joystick->pid_effect_update; struct pid_set_condition *set_condition = &impl->joystick->pid_set_condition; struct pid_set_periodic *set_periodic = &impl->joystick->pid_set_periodic; @@ -3031,6 +3080,27 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) if (WriteFile( device, impl->type_specific_buf[0], report_len, NULL, NULL )) hr = DI_OK; else hr = DIERR_INPUTLOST; + set_parameter_value( impl, impl->type_specific_buf[1], set_envelope->attack_level_caps, + impl->envelope.dwAttackLevel ); + set_parameter_value_us( impl, impl->type_specific_buf[1], set_envelope->attack_time_caps, + impl->envelope.dwAttackTime ); + set_parameter_value( impl, impl->type_specific_buf[1], set_envelope->fade_level_caps, + impl->envelope.dwFadeLevel ); + set_parameter_value_us( impl, impl->type_specific_buf[1], set_envelope->fade_time_caps, + impl->envelope.dwFadeTime ); + + if (WriteFile( device, impl->type_specific_buf[1], report_len, NULL, NULL )) hr = DI_OK; + else hr = DIERR_INPUTLOST; + break; + case PID_USAGE_ET_RAMP: + set_parameter_value( impl, impl->type_specific_buf[0], set_ramp_force->start_caps, + impl->ramp_force.lStart ); + set_parameter_value( impl, impl->type_specific_buf[0], set_ramp_force->end_caps, + impl->ramp_force.lEnd ); + + if (WriteFile( device, impl->type_specific_buf[0], report_len, NULL, NULL )) hr = DI_OK; + else hr = DIERR_INPUTLOST; + set_parameter_value( impl, impl->type_specific_buf[1], set_envelope->attack_level_caps, impl->envelope.dwAttackLevel ); set_parameter_value_us( impl, impl->type_specific_buf[1], set_envelope->attack_time_caps,
1
0
0
0
Rémi Bernon : winebus.sys: Add a PID set ramp force output report.
by Alexandre Julliard
08 Oct '21
08 Oct '21
Module: wine Branch: master Commit: 1c4523a9d48f91cb47d6b1850339e8a0c46dbf51 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1c4523a9d48f91cb47d6b185…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Oct 8 09:50:28 2021 +0200 winebus.sys: Add a PID set ramp force 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 | 16 ++++++++++- dlls/winebus.sys/bus_udev.c | 9 ++++++- dlls/winebus.sys/hid.c | 59 +++++++++++++++++++++++++++++++++++++++++ dlls/winebus.sys/unix_private.h | 8 ++++++ 4 files changed, 90 insertions(+), 2 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 14546467863..4fb91e4dc6d 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -213,6 +213,7 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl) if (impl->effect_support & SDL_HAPTIC_INERTIA) usages[count++] = PID_USAGE_ET_INERTIA; if (impl->effect_support & SDL_HAPTIC_FRICTION) usages[count++] = PID_USAGE_ET_FRICTION; if (impl->effect_support & SDL_HAPTIC_CONSTANT) usages[count++] = PID_USAGE_ET_CONSTANT_FORCE; + if (impl->effect_support & SDL_HAPTIC_RAMP) usages[count++] = PID_USAGE_ET_RAMP; if (!hid_device_add_physical(&impl->unix_device, usages, count)) return FALSE; @@ -610,8 +611,21 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT break; case PID_USAGE_ET_RAMP: - FIXME("not implemented!"); + effect.ramp.length = params->duration; + effect.ramp.delay = params->start_delay; + effect.ramp.button = params->trigger_button; + effect.ramp.interval = params->trigger_repeat_interval; + effect.ramp.direction.type = SDL_HAPTIC_SPHERICAL; + effect.ramp.direction.dir[0] = params->direction[0] * 36000 / 256; + effect.ramp.direction.dir[1] = params->direction[1] * 36000 / 256; + effect.ramp.start = params->ramp_force.ramp_start; + effect.ramp.end = params->ramp_force.ramp_end; + effect.ramp.attack_length = params->envelope.attack_time; + effect.ramp.attack_level = params->envelope.attack_level; + effect.ramp.fade_length = params->envelope.fade_time; + effect.ramp.fade_level = params->envelope.fade_level; break; + case PID_USAGE_ET_CUSTOM_FORCE_DATA: FIXME("not implemented!"); break; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 6067500117c..cc54d6490be 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -677,6 +677,7 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d if (test_bit(ffbits, FF_INERTIA)) usages[count++] = PID_USAGE_ET_INERTIA; if (test_bit(ffbits, FF_FRICTION)) usages[count++] = PID_USAGE_ET_FRICTION; if (test_bit(ffbits, FF_CONSTANT)) usages[count++] = PID_USAGE_ET_CONSTANT_FORCE; + if (test_bit(ffbits, FF_RAMP)) usages[count++] = PID_USAGE_ET_RAMP; if (!hid_device_add_physical(iface, usages, count)) return STATUS_NO_MEMORY; @@ -1048,8 +1049,14 @@ static NTSTATUS lnxev_device_physical_effect_update(struct unix_device *iface, B break; case PID_USAGE_ET_RAMP: - FIXME("not implemented!"); + effect.u.ramp.start_level = params->ramp_force.ramp_start; + effect.u.ramp.end_level = params->ramp_force.ramp_end; + effect.u.ramp.envelope.attack_length = params->envelope.attack_time; + effect.u.ramp.envelope.attack_level = params->envelope.attack_level; + effect.u.ramp.envelope.fade_length = params->envelope.fade_time; + effect.u.ramp.envelope.fade_level = params->envelope.fade_level; break; + case PID_USAGE_ET_CUSTOM_FORCE_DATA: FIXME("not implemented!"); break; diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index 4c55367e78d..a0f07f66392 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -477,6 +477,12 @@ struct pid_set_constant_force UINT16 magnitude; }; +struct pid_set_ramp_force +{ + BYTE index; + BYTE ramp_start; + BYTE ramp_end; +}; #include "poppack.h" static BOOL hid_descriptor_add_set_periodic(struct unix_device *iface) @@ -675,6 +681,40 @@ static BOOL hid_descriptor_add_set_constant_force(struct unix_device *iface) return hid_report_descriptor_append(desc, template, sizeof(template)); } +static BOOL hid_descriptor_add_set_ramp_force(struct unix_device *iface) +{ + struct hid_report_descriptor *desc = &iface->hid_report_descriptor; + const BYTE report_id = ++desc->next_report_id[HidP_Output]; + const BYTE template[] = + { + /* Ramp Force Report Definition */ + USAGE(1, PID_USAGE_SET_RAMP_FORCE_REPORT), + COLLECTION(1, Logical), + REPORT_ID(1, report_id), + + 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_RAMP_START), + USAGE(1, PID_USAGE_RAMP_END), + LOGICAL_MINIMUM(1, 0x80), + LOGICAL_MAXIMUM(1, 0x7f), + PHYSICAL_MINIMUM(2, -10000), + PHYSICAL_MAXIMUM(2, +10000), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 2), + OUTPUT(1, Data|Var|Abs), + END_COLLECTION, + }; + + iface->hid_physical.set_ramp_force_report = report_id; + return hid_report_descriptor_append(desc, template, sizeof(template)); +} + BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT count) { struct hid_report_descriptor *desc = &iface->hid_report_descriptor; @@ -829,6 +869,7 @@ BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT co BOOL envelope = FALSE; BOOL condition = FALSE; BOOL constant_force = FALSE; + BOOL ramp_force = FALSE; ULONG i; if (!hid_report_descriptor_append(desc, device_control_header, sizeof(device_control_header))) @@ -876,6 +917,8 @@ BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT co condition = TRUE; if (usages[i] == PID_USAGE_ET_CONSTANT_FORCE) envelope = constant_force = TRUE; + if (usages[i] == PID_USAGE_ET_RAMP) + envelope = ramp_force = TRUE; } if (periodic && !hid_descriptor_add_set_periodic(iface)) @@ -886,6 +929,8 @@ BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT co return FALSE; if (constant_force && !hid_descriptor_add_set_constant_force(iface)) return FALSE; + if (ramp_force && !hid_descriptor_add_set_ramp_force(iface)) + return FALSE; /* HID nary collection indexes start at 1 */ memcpy(iface->hid_physical.effect_types + 1, usages, count * sizeof(*usages)); @@ -1082,6 +1127,20 @@ static void hid_device_set_output_report(struct unix_device *iface, HID_XFER_PAC else params->constant_force.magnitude = report->magnitude; } + else if (packet->reportId == physical->set_ramp_force_report) + { + struct pid_set_ramp_force *report = (struct pid_set_ramp_force *)(packet->reportBuffer + 1); + struct effect_params *params = iface->hid_physical.effect_params + report->index; + + io->Information = sizeof(*report) + 1; + if (packet->reportBufferLen < io->Information) + io->Status = STATUS_BUFFER_TOO_SMALL; + else + { + params->ramp_force.ramp_start = report->ramp_start; + params->ramp_force.ramp_end = report->ramp_end; + } + } else { io->Information = 0; diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index bd0e3272593..61c6dbb1deb 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -60,6 +60,12 @@ struct effect_constant_force UINT16 magnitude; }; +struct effect_ramp_force +{ + BYTE ramp_start; + BYTE ramp_end; +}; + struct effect_params { USAGE effect_type; @@ -80,6 +86,7 @@ struct effect_params struct effect_periodic periodic; struct effect_condition condition[2]; struct effect_constant_force constant_force; + struct effect_ramp_force ramp_force; }; }; @@ -156,6 +163,7 @@ struct hid_physical BYTE set_envelope_report; BYTE set_condition_report; BYTE set_constant_force_report; + BYTE set_ramp_force_report; }; struct hid_device_state
1
0
0
0
← Newer
1
...
79
80
81
82
83
84
85
...
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