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
August 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
1 participants
1051 discussions
Start a n
N
ew thread
Rémi Bernon : dinput: Support disabled by default option in device_disabled_registry.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 0ba137e36db87b270f03c152c9e9bc88c809df14 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0ba137e36db87b270f03c152…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 25 18:20:26 2021 +0200 dinput: Support disabled by default option in device_disabled_registry. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick.c | 17 ++++++++++++----- dlls/dinput/joystick_linux.c | 2 +- dlls/dinput/joystick_linuxinput.c | 2 +- dlls/dinput/joystick_private.h | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 8ea7850621c..60153d0d0f3 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -271,13 +271,13 @@ void dump_DIEFFECT(LPCDIEFFECT eff, REFGUID guid, DWORD dwFlags) } } -BOOL device_disabled_registry(const char* name) +BOOL device_disabled_registry(const char* name, BOOL disable) { static const char disabled_str[] = "disabled"; + static const char enabled_str[] = "enabled"; static const char joystick_key[] = "Joysticks"; char buffer[MAX_PATH]; HKEY hkey, appkey, temp; - BOOL do_disable = FALSE; get_app_key(&hkey, &appkey); @@ -297,16 +297,23 @@ BOOL device_disabled_registry(const char* name) /* Look for the "controllername"="disabled" key */ if (!get_config_key(hkey, appkey, name, buffer, sizeof(buffer))) - if (!strcmp(disabled_str, buffer)) + { + if (!disable && !strcmp(disabled_str, buffer)) { TRACE("Disabling joystick '%s' based on registry key.\n", name); - do_disable = TRUE; + disable = TRUE; + } + else if (disable && !strcmp(enabled_str, buffer)) + { + TRACE("Enabling joystick '%s' based on registry key.\n", name); + disable = FALSE; } + } if (appkey) RegCloseKey(appkey); if (hkey) RegCloseKey(hkey); - return do_disable; + return disable; } BOOL is_xinput_device(const DIDEVCAPS *devcaps, WORD vid, WORD pid) diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 258f6e9e5e0..3a8b0f07704 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -175,7 +175,7 @@ static INT find_joystick_devices(void) /* Append driver name */ strcat(joydev.name, JOYDEVDRIVER); - if (device_disabled_registry(joydev.name)) { + if (device_disabled_registry(joydev.name, FALSE)) { close(fd); continue; } diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 06a735f7d91..27dd75a8b55 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -264,7 +264,7 @@ static void find_joydevs(void) else joydev.name = joydev.device; - if (device_disabled_registry(joydev.name)) { + if (device_disabled_registry(joydev.name, FALSE)) { close(fd); HeapFree(GetProcessHeap(), 0, joydev.name); if (joydev.name != joydev.device) diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index 874bf3e69a7..9cc30605234 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -57,7 +57,7 @@ HRESULT setup_dinput_options(JoystickGenericImpl *This, const int *default_axis_ DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN; -BOOL device_disabled_registry(const char* name) DECLSPEC_HIDDEN; +BOOL device_disabled_registry(const char* name, BOOL disable) DECLSPEC_HIDDEN; ULONG WINAPI JoystickWGenericImpl_Release(LPDIRECTINPUTDEVICE8W iface);
1
0
0
0
Rémi Bernon : dinput: Allocate data format on device creation.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 2726644124b10c80f9e1ef2640a9eb1a2b74ef1f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2726644124b10c80f9e1ef26…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 25 18:20:25 2021 +0200 dinput: Allocate data format on device creation. It's accessed on Release, and this will make it easier to handle device creation failure cleanup. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 9 +++++++++ dlls/dinput/joystick_linux.c | 3 +-- dlls/dinput/joystick_linuxinput.c | 3 +-- dlls/dinput/joystick_osx.c | 3 +-- dlls/dinput/keyboard.c | 4 +--- dlls/dinput/mouse.c | 3 +-- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index ac60a21326c..25084f82a9c 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1708,11 +1708,20 @@ HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl * const GUID *guid, IDirectInputImpl *dinput, void **out ) { IDirectInputDeviceImpl *This; + DIDATAFORMAT *format; + if (!(This = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size ))) return DIERR_OUTOFMEMORY; + if (!(format = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*format) ))) + { + HeapFree( GetProcessHeap(), 0, This ); + return DIERR_OUTOFMEMORY; + } + This->IDirectInputDevice8A_iface.lpVtbl = &dinput_device_a_vtbl; This->IDirectInputDevice8W_iface.lpVtbl = vtbl; This->ref = 1; This->guid = *guid; + This->data_format.wine_df = format; InitializeCriticalSection( &This->crit ); This->dinput = dinput; IDirectInput_AddRef( &dinput->IDirectInput7A_iface ); diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 3215978c995..258f6e9e5e0 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -411,6 +411,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, rguid, dinput, (void **)&newDevice ))) return hr; + df = newDevice->generic.base.data_format.wine_df; newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit"); newDevice->joydev = &joystick_devices[index]; @@ -438,7 +439,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm goto FAILED1; /* Create copy of default data format */ - if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto FAILED; memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize); df->dwNumObjs = newDevice->generic.devcaps.dwAxes + newDevice->generic.devcaps.dwPOVs + newDevice->generic.devcaps.dwButtons; @@ -465,7 +465,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm df->rgodf[idx ].pguid = &GUID_Button; df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_PSHBUTTON; } - newDevice->generic.base.data_format.wine_df = df; /* initialize default properties */ for (i = 0; i < c_dfDIJoystick2.dwNumObjs; i++) { diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 2b970271ec3..06a735f7d91 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -407,6 +407,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, rguid, dinput, (void **)&newDevice ))) return hr; + df = newDevice->generic.base.data_format.wine_df; newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->base.crit"); newDevice->generic.joy_polldev = joy_polldev; @@ -468,7 +469,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm if (setup_dinput_options(&newDevice->generic, default_axis_map) != DI_OK) goto failed; /* Create copy of default data format */ - if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto failed; memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize); if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed; @@ -514,7 +514,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->generic.devcaps.dwButtons++) | DIDFT_PSHBUTTON; } df->dwNumObjs = idx; - newDevice->generic.base.data_format.wine_df = df; fake_current_js_state(newDevice); diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 27a47b07639..62a063b6da1 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -1075,6 +1075,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, rguid, dinput, (void **)&newDevice ))) return hr; + df = newDevice->generic.base.data_format.wine_df; newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit"); newDevice->id = index; @@ -1138,7 +1139,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm } /* Create copy of default data format */ - if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto FAILED; memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize); df->dwNumObjs = newDevice->generic.devcaps.dwAxes + newDevice->generic.devcaps.dwPOVs + newDevice->generic.devcaps.dwButtons; @@ -1203,7 +1203,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm df->rgodf[idx ].pguid = &GUID_Button; df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_PSHBUTTON; } - newDevice->generic.base.data_format.wine_df = df; /* initialize default properties */ get_osx_device_elements_props(newDevice); diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index fc9dbdb2ed4..5d532ab8059 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -203,12 +203,12 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysKeyboar if (FAILED(hr = direct_input_device_alloc( sizeof(SysKeyboardImpl), &SysKeyboardWvt, rguid, dinput, (void **)&newDevice ))) return hr; + df = newDevice->base.data_format.wine_df; newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit"); newDevice->subtype = get_keyboard_subtype(); /* Create copy of default data format */ - if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIKeyboard.dwSize))) goto failed; memcpy(df, &c_dfDIKeyboard, c_dfDIKeyboard.dwSize); if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed; @@ -226,8 +226,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysKeyboar } df->dwNumObjs = idx; - newDevice->base.data_format.wine_df = df; - *out = newDevice; return DI_OK; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 22e40a60285..145a792f396 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -149,6 +149,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm if (FAILED(hr = direct_input_device_alloc( sizeof(SysMouseImpl), &SysMouseWvt, rguid, dinput, (void **)&newDevice ))) return hr; + df = newDevice->base.data_format.wine_df; newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit"); newDevice->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; @@ -165,7 +166,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm if (hkey) RegCloseKey(hkey); /* Create copy of default data format */ - if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIMouse2.dwSize))) goto failed; memcpy(df, &c_dfDIMouse2, c_dfDIMouse2.dwSize); if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed; memcpy(df->rgodf, c_dfDIMouse2.rgodf, df->dwNumObjs * df->dwObjSize); @@ -177,7 +177,6 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm else df->rgodf[i].dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_PSHBUTTON; - newDevice->base.data_format.wine_df = df; if (dinput->dwVersion >= 0x0800) { newDevice->base.use_raw_input = TRUE;
1
0
0
0
Rémi Bernon : hid: Implement HidP_SetScaledUsageValue.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 74b7845ff04da620a49e4d898c31687e7bda7a47 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=74b7845ff04da620a49e4d89…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 25 18:08:33 2021 +0200 hid: Implement HidP_SetScaledUsageValue. The function seems to actually do overflows and rounding errors. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hid/hid.spec | 2 +- dlls/hid/hidp.c | 47 ++++++++++++++++++++ dlls/ntoskrnl.exe/tests/driver_hid.c | 10 +++++ dlls/ntoskrnl.exe/tests/ntoskrnl.c | 86 +++++++++++++++++++++++++++++++++--- include/ddk/hidpi.h | 1 + 5 files changed, 138 insertions(+), 8 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=74b7845ff04da620a49e…
1
0
0
0
Rémi Bernon : hid: Implement HidP_UnsetUsages.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 3b40a032675fdf3cc24e1b207896aa4c8cadc8cc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3b40a032675fdf3cc24e1b20…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 25 18:08:32 2021 +0200 hid: Implement HidP_UnsetUsages. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hid/hid.spec | 2 +- dlls/hid/hidp.c | 59 ++++++++++++++++++++++++++++++++++++++ dlls/ntoskrnl.exe/tests/ntoskrnl.c | 12 ++++++-- include/ddk/hidpi.h | 1 + 4 files changed, 71 insertions(+), 3 deletions(-) diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec index edfdb004fd0..5d4706e3727 100644 --- a/dlls/hid/hid.spec +++ b/dlls/hid/hid.spec @@ -40,5 +40,5 @@ @ stdcall HidP_SetUsageValueArray(long long long long ptr long ptr ptr long) @ stdcall HidP_SetUsages(long long long ptr ptr ptr ptr long) @ stdcall HidP_TranslateUsagesToI8042ScanCodes(ptr long long ptr ptr ptr) -@ stub HidP_UnsetUsages +@ stdcall HidP_UnsetUsages(long long long ptr ptr ptr ptr long) @ stub HidP_UsageListDifference diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 31f1b85f14a..8c43d27f252 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -481,6 +481,65 @@ NTSTATUS WINAPI HidP_SetUsages( HIDP_REPORT_TYPE report_type, USAGE usage_page, return HIDP_STATUS_SUCCESS; } +struct unset_usage_params +{ + USAGE usage; + char *report_buf; + BOOL found; +}; + +static NTSTATUS unset_usage( const struct hid_value_caps *caps, void *user ) +{ + struct unset_usage_params *params = user; + ULONG bit, index, last; + + if (HID_VALUE_CAPS_IS_ARRAY( caps )) + { + for (bit = caps->start_bit, last = bit + caps->report_count * caps->bit_size - 1; bit <= last; bit += 8) + { + index = caps->start_index + params->usage - caps->usage_min; + if (params->report_buf[bit / 8] != index) continue; + params->report_buf[bit / 8] = 0; + params->found = TRUE; + break; + } + + return HIDP_STATUS_NULL; + } + + bit = caps->start_bit + params->usage - caps->usage_min; + if (params->report_buf[bit / 8] & (1 << (bit % 8))) params->found = TRUE; + params->report_buf[bit / 8] &= ~(1 << (bit % 8)); + return HIDP_STATUS_NULL; +} + +NTSTATUS WINAPI HidP_UnsetUsages( HIDP_REPORT_TYPE report_type, USAGE usage_page, USHORT collection, USAGE *usages, + ULONG *usage_count, PHIDP_PREPARSED_DATA preparsed_data, char *report_buf, ULONG report_len ) +{ + struct hid_preparsed_data *preparsed = (struct hid_preparsed_data *)preparsed_data; + struct unset_usage_params params = {.report_buf = report_buf, .found = FALSE}; + struct caps_filter filter = {.buttons = TRUE, .usage_page = usage_page, .collection = collection}; + NTSTATUS status; + USHORT limit = 1; + ULONG i, count = *usage_count; + + TRACE( "report_type %d, usage_page %x, collection %d, usages %p, usage_count %p, preparsed_data %p, " + "report_buf %p, report_len %u.\n", + report_type, usage_page, collection, usages, usage_count, preparsed_data, report_buf, report_len ); + + if (!report_len) return HIDP_STATUS_INVALID_REPORT_LENGTH; + + filter.report_id = report_buf[0]; + for (i = 0; i < count; ++i) + { + params.usage = filter.usage = usages[i]; + status = enum_value_caps( preparsed, report_type, report_len, &filter, unset_usage, ¶ms, &limit ); + if (status != HIDP_STATUS_SUCCESS) return status; + } + + if (!params.found) return HIDP_STATUS_BUTTON_NOT_PRESSED; + return HIDP_STATUS_SUCCESS; +} NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 2f5c2cd81cc..115032dbb52 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2344,8 +2344,16 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled report[caps.InputReportByteLength - 2]); ok(report[caps.InputReportByteLength - 1] == 4, "unexpected usage index %d, expected 4\n", report[caps.InputReportByteLength - 1]); - report[caps.InputReportByteLength - 2] = 0; - report[caps.InputReportByteLength - 1] = 0; + status = HidP_UnsetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, + report, caps.InputReportByteLength); + ok(status == HIDP_STATUS_SUCCESS, "HidP_UnsetUsages returned %#x\n", status); + ok(report[caps.InputReportByteLength - 2] == 0, "unexpected usage index %d, expected 0\n", + report[caps.InputReportByteLength - 2]); + ok(report[caps.InputReportByteLength - 1] == 0, "unexpected usage index %d, expected 0\n", + report[caps.InputReportByteLength - 1]); + status = HidP_UnsetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, + report, caps.InputReportByteLength); + ok(status == HIDP_STATUS_BUTTON_NOT_PRESSED, "HidP_UnsetUsages returned %#x\n", status); value = 1; usages[0] = 0x8c; status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h index 6dfe5919b4f..305c38a95d3 100644 --- a/include/ddk/hidpi.h +++ b/include/ddk/hidpi.h @@ -209,6 +209,7 @@ NTSTATUS WINAPI HidP_SetUsageValueArray( HIDP_REPORT_TYPE ReportType, USAGE Usag NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); +NTSTATUS WINAPI HidP_UnsetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, HIDP_KEYBOARD_MODIFIER_STATE *ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, VOID *InsertCodesContext); NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_BUTTON_CAPS *ButtonCaps, USHORT *ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData); NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_VALUE_CAPS *ValueCaps, USHORT *ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
1
0
0
0
Rémi Bernon : hidclass.sys: Fix nary usage collections index ordering.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: b117f6548a3f3734b23f865f2e9aeceed27062ed URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b117f6548a3f3734b23f865f…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 25 18:08:31 2021 +0200 hidclass.sys: Fix nary usage collections index ordering. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hidparse.sys/main.c | 4 ++-- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dlls/hidparse.sys/main.c b/dlls/hidparse.sys/main.c index 185cefbb3e5..3a57c338165 100644 --- a/dlls/hidparse.sys/main.c +++ b/dlls/hidparse.sys/main.c @@ -354,14 +354,13 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY } value = state->values[type] + *value_idx; - state->items.start_index = 0; + state->items.start_index = usages_size; if (!(is_array = HID_VALUE_CAPS_IS_ARRAY( &state->items ))) state->items.report_count -= usages_size - 1; else state->items.start_bit -= state->items.report_count * state->items.bit_size; while (usages_size--) { if (!is_array) state->items.start_bit -= state->items.report_count * state->items.bit_size; - else state->items.start_index += 1; state->items.usage_page = state->usages_page[usages_size]; state->items.usage_min = state->usages_min[usages_size]; state->items.usage_max = state->usages_max[usages_size]; @@ -371,6 +370,7 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY *value++ = state->items; *value_idx += 1; if (!is_array) state->items.report_count = 1; + else state->items.start_index -= 1; } state->items.usage_page = usage_page; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 85380cd9df2..2f5c2cd81cc 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2340,10 +2340,8 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, report, caps.InputReportByteLength); ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status); - todo_wine ok(report[caps.InputReportByteLength - 2] == 3, "unexpected usage index %d, expected 3\n", report[caps.InputReportByteLength - 2]); - todo_wine ok(report[caps.InputReportByteLength - 1] == 4, "unexpected usage index %d, expected 4\n", report[caps.InputReportByteLength - 1]); report[caps.InputReportByteLength - 2] = 0; @@ -2353,7 +2351,6 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, report, caps.InputReportByteLength); ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status); - todo_wine ok(report[caps.InputReportByteLength - 2] == 1, "unexpected usage index %d, expected 1\n", report[caps.InputReportByteLength - 2]);
1
0
0
0
Rémi Bernon : ntoskrnl.exe/tests: Add more HID usage nary tests.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 6b504fe7783b3680b911d739b60dedcbeec0e2f3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6b504fe7783b3680b911d739…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 25 18:08:30 2021 +0200 ntoskrnl.exe/tests: Add more HID usage nary tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/tests/driver_hid.c | 12 ++++++++- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 49 ++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index 8111af23c06..ce942815dcb 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -299,6 +299,16 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) REPORT_COUNT(1, 8), REPORT_SIZE(1, 1), INPUT(1, Data|Var|Abs), + + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8c), + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8d), + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8e), + USAGE(4, (HID_USAGE_PAGE_KEYBOARD<<16)|0x8f), + LOGICAL_MINIMUM(1, 1), + LOGICAL_MAXIMUM(1, 16), + REPORT_COUNT(1, 2), + REPORT_SIZE(1, 8), + INPUT(1, Data|Ary|Abs), END_COLLECTION, USAGE_PAGE(2, HID_USAGE_PAGE_HAPTICS), @@ -477,7 +487,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_READ_REPORT: { - ULONG expected_size = 23; + ULONG expected_size = 25; ok(!in_size, "got input size %u\n", in_size); ok(out_size == expected_size, "got output size %u\n", out_size); diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 9886be69ccb..85380cd9df2 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -1684,13 +1684,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled { .Usage = HID_USAGE_GENERIC_JOYSTICK, .UsagePage = HID_USAGE_PAGE_GENERIC, - .InputReportByteLength = 24, + .InputReportByteLength = 26, .OutputReportByteLength = 3, .FeatureReportByteLength = 18, .NumberLinkCollectionNodes = 10, - .NumberInputButtonCaps = 13, + .NumberInputButtonCaps = 17, .NumberInputValueCaps = 7, - .NumberInputDataIndices = 43, + .NumberInputDataIndices = 47, .NumberFeatureButtonCaps = 1, .NumberFeatureValueCaps = 5, .NumberFeatureDataIndices = 7, @@ -1699,13 +1699,13 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled { .Usage = HID_USAGE_GENERIC_JOYSTICK, .UsagePage = HID_USAGE_PAGE_GENERIC, - .InputReportByteLength = 23, + .InputReportByteLength = 25, .OutputReportByteLength = 2, .FeatureReportByteLength = 17, .NumberLinkCollectionNodes = 10, - .NumberInputButtonCaps = 13, + .NumberInputButtonCaps = 17, .NumberInputValueCaps = 7, - .NumberInputDataIndices = 43, + .NumberInputDataIndices = 47, .NumberFeatureButtonCaps = 1, .NumberFeatureValueCaps = 5, .NumberFeatureDataIndices = 7, @@ -1872,12 +1872,12 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled HIDP_LINK_COLLECTION_NODE collections[16]; PHIDP_PREPARSED_DATA preparsed_data; USAGE_AND_PAGE usage_and_pages[16]; - HIDP_BUTTON_CAPS button_caps[16]; + HIDP_BUTTON_CAPS button_caps[32]; HIDP_VALUE_CAPS value_caps[16]; char buffer[200], report[200]; DWORD collection_count; DWORD waveform_list; - HIDP_DATA data[32]; + HIDP_DATA data[64]; USAGE usages[16]; NTSTATUS status; HIDP_CAPS caps; @@ -2186,7 +2186,7 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled value = HidP_MaxUsageListLength(HidP_Feature + 1, 0, preparsed_data); ok(value == 0, "HidP_MaxUsageListLength(HidP_Feature + 1, 0) returned %d, expected %d\n", value, 0); value = HidP_MaxUsageListLength(HidP_Input, 0, preparsed_data); - ok(value == 42, "HidP_MaxUsageListLength(HidP_Input, 0) returned %d, expected %d\n", value, 42); + ok(value == 50, "HidP_MaxUsageListLength(HidP_Input, 0) returned %d, expected %d\n", value, 50); value = HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON, preparsed_data); ok(value == 32, "HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON) returned %d, expected %d\n", value, 32); value = HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_LED, preparsed_data); @@ -2307,7 +2307,7 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled value = HidP_MaxDataListLength(HidP_Feature + 1, preparsed_data); ok(value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0); value = HidP_MaxDataListLength(HidP_Input, preparsed_data); - ok(value == 50, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 50); + ok(value == 58, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 58); value = HidP_MaxDataListLength(HidP_Output, preparsed_data); ok(value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0); value = HidP_MaxDataListLength(HidP_Feature, preparsed_data); @@ -2328,6 +2328,35 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled winetest_pop_context(); } + /* HID nary usage collections are set with 1-based usage index in their declaration order */ + + memset(report, 0, caps.InputReportByteLength); + status = HidP_InitializeReportForID(HidP_Input, report_id, preparsed_data, report, + caps.InputReportByteLength); + ok(status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status); + value = 2; + usages[0] = 0x8e; + usages[1] = 0x8f; + status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, + report, caps.InputReportByteLength); + ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status); + todo_wine + ok(report[caps.InputReportByteLength - 2] == 3, "unexpected usage index %d, expected 3\n", + report[caps.InputReportByteLength - 2]); + todo_wine + ok(report[caps.InputReportByteLength - 1] == 4, "unexpected usage index %d, expected 4\n", + report[caps.InputReportByteLength - 1]); + report[caps.InputReportByteLength - 2] = 0; + report[caps.InputReportByteLength - 1] = 0; + value = 1; + usages[0] = 0x8c; + status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data, + report, caps.InputReportByteLength); + ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status); + todo_wine + ok(report[caps.InputReportByteLength - 2] == 1, "unexpected usage index %d, expected 1\n", + report[caps.InputReportByteLength - 2]); + memset(report, 0xcd, sizeof(report)); status = HidP_InitializeReportForID(HidP_Feature, 3, preparsed_data, report, caps.FeatureReportByteLength); ok(status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#x\n", status);
1
0
0
0
Francois Gouget : kernel32: Fix NLS_GetDateTimeFormatA() Unicode to ANSI conversion.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: c388453184a5e90e3eefc00b726b7d7c5b6af365 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c388453184a5e90e3eefc00b…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Thu Aug 26 18:26:36 2021 +0200 kernel32: Fix NLS_GetDateTimeFormatA() Unicode to ANSI conversion. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/lcformat.c | 25 ++++++++----------------- dlls/kernel32/tests/locale.c | 16 ++-------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c index a9dfbf09be2..5711d05b76f 100644 --- a/dlls/kernel32/lcformat.c +++ b/dlls/kernel32/lcformat.c @@ -737,7 +737,7 @@ invalid_flags: /****************************************************************************** * NLS_GetDateTimeFormatA <internal> * - * ASCII wrapper for GetDateFormatA/GetTimeFormatA. + * ANSI wrapper for GetDateFormatA/GetTimeFormatA. */ static INT NLS_GetDateTimeFormatA(LCID lcid, DWORD dwFlags, const SYSTEMTIME* lpTime, @@ -745,12 +745,12 @@ static INT NLS_GetDateTimeFormatA(LCID lcid, DWORD dwFlags, { DWORD cp = CP_ACP; WCHAR szFormat[128], szOut[128]; - INT iRet; + INT iRet, cchOutW; TRACE("(0x%04x,0x%08x,%p,%s,%p,%d)\n", lcid, dwFlags, lpTime, debugstr_a(lpFormat), lpStr, cchOut); - if (NLS_IsUnicodeOnlyLcid(lcid)) + if ((cchOut && !lpStr) || NLS_IsUnicodeOnlyLcid(lcid)) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -771,21 +771,12 @@ static INT NLS_GetDateTimeFormatA(LCID lcid, DWORD dwFlags, if (lpFormat) MultiByteToWideChar(cp, 0, lpFormat, -1, szFormat, ARRAY_SIZE(szFormat)); - if (cchOut > (int) ARRAY_SIZE(szOut)) - cchOut = ARRAY_SIZE(szOut); - - szOut[0] = '\0'; - + /* If cchOut == 0 we need the full string to get the accurate ANSI size */ + cchOutW = (cchOut && cchOut <= ARRAY_SIZE(szOut)) ? cchOut : ARRAY_SIZE(szOut); iRet = NLS_GetDateTimeFormatW(lcid, dwFlags, lpTime, lpFormat ? szFormat : NULL, - lpStr ? szOut : NULL, cchOut); - - if (lpStr) - { - if (szOut[0]) - WideCharToMultiByte(cp, 0, szOut, iRet ? -1 : cchOut, lpStr, cchOut, 0, 0); - else if (cchOut && iRet) - *lpStr = '\0'; - } + szOut, cchOutW); + if (iRet) + iRet = WideCharToMultiByte(cp, 0, szOut, -1, lpStr, cchOut, NULL, NULL); return iRet; } diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 43dcf2a7dbf..fa0ec374d34 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -639,25 +639,18 @@ static void test_GetTimeFormatA(void) lcid = MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN), SORT_DEFAULT); ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", buffer, 5); - if (broken(1)) /* FIXME Remove once Wine is less broken */ expect_str(ret, buffer, "12\x93\xfa"); /* only 3+1 WCHARs */ - todo_wine ok(ret == strlen("12\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("12\x93\xfa") + 1, ret); - ok(strcmp(buffer, "12\x93\xfa") == 0, "Expected '12\x93\xfa', got '%s'\n", buffer); ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", buffer, 4); - todo_wine expect_err(ret, NULL, ERROR_INSUFFICIENT_BUFFER); + expect_err(ret, NULL, ERROR_INSUFFICIENT_BUFFER); SetLastError(0xdeadbeef); ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", NULL, 0); - if (broken(1)) /* FIXME Remove once Wine is less broken */ expect_str(ret, NULL, "12\x93\xfa"); - todo_wine ok(ret == strlen("12\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("12\x93\xfa") + 1, ret); strcpy(buffer, "pristine"); /* clear previous identical result */ ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", buffer, 0); - if (broken(1)) /* FIXME Remove once Wine is less broken */ expect_str(ret, NULL, "12\x93\xfa"); - todo_wine ok(ret == strlen("12\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("12\x93\xfa") + 1, ret); ok(strcmp(buffer, "pristine") == 0, "Expected a pristine buffer, got '%s'\n", buffer); } @@ -967,20 +960,15 @@ static void test_GetDateFormatA(void) */ ret = GetDateFormatA(lcid_ja, 0, &curtime, "d\x93\xfa", buffer, 4); - if (broken(1)) /* FIXME Remove once Wine is less broken */ expect_str(ret, buffer, "4\x93\xfa"); /* only 2+1 WCHARs */ - todo_wine ok(ret == strlen("4\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("4\x93\xfa") + 1, ret); - ok(strcmp(buffer, "4\x93\xfa") == 0, "Expected '4\x93\xfa', got '%s'\n", buffer); ret = GetDateFormatA(lcid_ja, 0, &curtime, "d\x93\xfa", buffer, 3); - todo_wine expect_err(ret, NULL, ERROR_INSUFFICIENT_BUFFER); + expect_err(ret, NULL, ERROR_INSUFFICIENT_BUFFER); SetLastError(0xdeadbeef); strcpy(buffer, "pristine"); /* clear previous identical result */ ret = GetDateFormatA(lcid_ja, 0, &curtime, "d\x93\xfa", NULL, 0); - if (broken(1)) /* FIXME Remove once Wine is less broken */ expect_str(ret, NULL, "4\x93\xfa"); - todo_wine ok(ret == strlen("4\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("4\x93\xfa") + 1, ret); } static void test_GetDateFormatEx(void)
1
0
0
0
Francois Gouget : kernel32/tests: Test GetDateFormatA()'s Unicode to ANSI conversion.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 263157a03d7174824d0a6b1f28e0e274455f1bc6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=263157a03d7174824d0a6b1f…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Thu Aug 26 18:26:29 2021 +0200 kernel32/tests: Test GetDateFormatA()'s Unicode to ANSI conversion. The ANSI string may be longer than the Unicode one and GetDateFormatA()'s return value should reflect that. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/locale.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 45bf56d8ad7..43dcf2a7dbf 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -839,6 +839,7 @@ static void test_GetDateFormatA(void) SYSTEMTIME curtime; LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); LCID lcid_ru = MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_NEUTRAL), SORT_DEFAULT); + LCID lcid_ja = MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN), SORT_DEFAULT); char buffer[BUFFER_SIZE], Expected[BUFFER_SIZE]; char short_day[10], month[10], genitive_month[10]; @@ -959,6 +960,27 @@ static void test_GetDateFormatA(void) ret = GetDateFormatA(lcid_ru, 0, &curtime, "ddd',' MMMM dd", buffer, ARRAY_SIZE(buffer)); sprintf(Expected, "%s, %s 04", short_day, genitive_month); expect_str(ret, buffer, Expected); + + /* The ANSI string may be longer than the Unicode one. + * In particular, in the Japanese code page, "\x93\xfa" = L"\x65e5". + * See the corresponding GetDateFormatW() test. + */ + + ret = GetDateFormatA(lcid_ja, 0, &curtime, "d\x93\xfa", buffer, 4); + if (broken(1)) /* FIXME Remove once Wine is less broken */ + expect_str(ret, buffer, "4\x93\xfa"); /* only 2+1 WCHARs */ + todo_wine ok(ret == strlen("4\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("4\x93\xfa") + 1, ret); + ok(strcmp(buffer, "4\x93\xfa") == 0, "Expected '4\x93\xfa', got '%s'\n", buffer); + + ret = GetDateFormatA(lcid_ja, 0, &curtime, "d\x93\xfa", buffer, 3); + todo_wine expect_err(ret, NULL, ERROR_INSUFFICIENT_BUFFER); + SetLastError(0xdeadbeef); + + strcpy(buffer, "pristine"); /* clear previous identical result */ + ret = GetDateFormatA(lcid_ja, 0, &curtime, "d\x93\xfa", NULL, 0); + if (broken(1)) /* FIXME Remove once Wine is less broken */ + expect_str(ret, NULL, "4\x93\xfa"); + todo_wine ok(ret == strlen("4\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("4\x93\xfa") + 1, ret); } static void test_GetDateFormatEx(void) @@ -1115,6 +1137,20 @@ static void test_GetDateFormatW(void) wcscpy(buffer, L"pristine"); ret = GetDateFormatW (lcid, 0, &curtime, L"dddd d MMMM yyyy", buffer, ARRAY_SIZE(buffer)); expect_werr(ret, buffer, ERROR_INVALID_PARAMETER); + SetLastError(0xdeadbeef); + + /* See the corresponding GetDateFormatA() test */ + + lcid = MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN), SORT_DEFAULT); + + curtime.wYear = 2002; + curtime.wMonth = 5; + curtime.wDay = 4; + ret = GetDateFormatW(lcid, 0, &curtime, L"d\x65e5", buffer, 3); + expect_wstr(ret, buffer, L"4\x65e5"); + + ret = GetDateFormatW(lcid, 0, &curtime, L"d\x65e5", NULL, 0); + expect_wstr(ret, NULL, L"4\x65e5"); }
1
0
0
0
Francois Gouget : kernel32/tests: Test GetTimeFormatA()'s Unicode to ANSI conversion.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 10db4147dd416cfef8acc0043f8be7f2b6b3a17d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=10db4147dd416cfef8acc004…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Thu Aug 26 18:26:26 2021 +0200 kernel32/tests: Test GetTimeFormatA()'s Unicode to ANSI conversion. The ANSI string may be longer than the Unicode one and the return value should reflect that. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/locale.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index b83cdc6b956..45bf56d8ad7 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -631,6 +631,34 @@ static void test_GetTimeFormatA(void) curtime.wMonth = 60; ret = GetTimeFormatA(lcid, 0, &curtime, "h:m:s", buffer, ARRAY_SIZE(buffer)); expect_str(ret, buffer, "12:56:13"); + + /* The ANSI string may be longer than the Unicode one. + * In particular, in the Japanese code page, "\x93\xfa" = L"\x65e5". + */ + + lcid = MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN), SORT_DEFAULT); + + ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", buffer, 5); + if (broken(1)) /* FIXME Remove once Wine is less broken */ + expect_str(ret, buffer, "12\x93\xfa"); /* only 3+1 WCHARs */ + todo_wine ok(ret == strlen("12\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("12\x93\xfa") + 1, ret); + ok(strcmp(buffer, "12\x93\xfa") == 0, "Expected '12\x93\xfa', got '%s'\n", buffer); + + ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", buffer, 4); + todo_wine expect_err(ret, NULL, ERROR_INSUFFICIENT_BUFFER); + SetLastError(0xdeadbeef); + + ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", NULL, 0); + if (broken(1)) /* FIXME Remove once Wine is less broken */ + expect_str(ret, NULL, "12\x93\xfa"); + todo_wine ok(ret == strlen("12\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("12\x93\xfa") + 1, ret); + + strcpy(buffer, "pristine"); /* clear previous identical result */ + ret = GetTimeFormatA(lcid, 0, &curtime, "h\x93\xfa", buffer, 0); + if (broken(1)) /* FIXME Remove once Wine is less broken */ + expect_str(ret, NULL, "12\x93\xfa"); + todo_wine ok(ret == strlen("12\x93\xfa") + 1, "Expected ret %d, got %d\n", strlen("12\x93\xfa") + 1, ret); + ok(strcmp(buffer, "pristine") == 0, "Expected a pristine buffer, got '%s'\n", buffer); } static void test_GetTimeFormatEx(void)
1
0
0
0
Francois Gouget : winedbg: dbg_get_debuggee_info() is not used anymore. Remove it.
by Alexandre Julliard
26 Aug '21
26 Aug '21
Module: wine Branch: master Commit: 7d82abd2befecfcc6fc1a3be85aa48ee548083ad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7d82abd2befecfcc6fc1a3be…
Author: Francois Gouget <fgouget(a)free.fr> Date: Thu Aug 26 14:51:30 2021 +0200 winedbg: dbg_get_debuggee_info() is not used anymore. Remove it. Signed-off-by: Francois Gouget <fgouget(a)free.fr> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/debugger.h | 1 - programs/winedbg/winedbg.c | 39 --------------------------------------- 2 files changed, 40 deletions(-) diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 3733e1b410f..e7a4901a769 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -464,7 +464,6 @@ extern struct dbg_thread* dbg_get_thread(struct dbg_process* p, DWORD tid); extern void dbg_del_thread(struct dbg_thread* t); extern BOOL dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade); extern BOOL dbg_load_module(HANDLE hProc, HANDLE hFile, const WCHAR* name, DWORD_PTR base, DWORD size); -extern BOOL dbg_get_debuggee_info(HANDLE hProcess, IMAGEHLP_MODULE64* imh_mod); extern void dbg_set_option(const char*, const char*); extern void dbg_start_interactive(HANDLE hFile); extern void dbg_init_console(void); diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 5e433bbb699..6b363168cd7 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -411,45 +411,6 @@ BOOL dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade) return ret; } -struct mod_loader_info -{ - HANDLE handle; - IMAGEHLP_MODULE64* imh_mod; -}; - -static BOOL CALLBACK mod_loader_cb(PCSTR mod_name, DWORD64 base, PVOID ctx) -{ - struct mod_loader_info* mli = ctx; - - if (!strcmp(mod_name, "<wine-loader>")) - { - if (SymGetModuleInfo64(mli->handle, base, mli->imh_mod)) - return FALSE; /* stop enum */ - } - return TRUE; -} - -BOOL dbg_get_debuggee_info(HANDLE hProcess, IMAGEHLP_MODULE64* imh_mod) -{ - struct mod_loader_info mli; - BOOL opt; - - /* this will resynchronize builtin dbghelp's internal ELF module list */ - SymLoadModule(hProcess, 0, 0, 0, 0, 0); - mli.handle = hProcess; - mli.imh_mod = imh_mod; - imh_mod->SizeOfStruct = sizeof(*imh_mod); - imh_mod->BaseOfImage = 0; - /* this is a wine specific options to return also ELF modules in the - * enumeration - */ - opt = SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES, TRUE); - SymEnumerateModules64(hProcess, mod_loader_cb, &mli); - SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES, opt); - - return imh_mod->BaseOfImage != 0; -} - BOOL dbg_load_module(HANDLE hProc, HANDLE hFile, const WCHAR* name, DWORD_PTR base, DWORD size) { BOOL ret = SymLoadModuleExW(hProc, NULL, name, NULL, base, size, NULL, 0);
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
106
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
Results per page:
10
25
50
100
200