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
February 2023
----- 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
599 discussions
Start a n
N
ew thread
Piotr Caban : msvcrt: Don't crash on NULL argument in getenv.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: 86fb5c7ba639de2cd0357fa2e259971494a9cc13 URL:
https://gitlab.winehq.org/wine/wine/-/commit/86fb5c7ba639de2cd0357fa2e25997…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Feb 15 13:37:52 2023 +0100 msvcrt: Don't crash on NULL argument in getenv. --- dlls/msvcrt/environ.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/msvcrt/environ.c b/dlls/msvcrt/environ.c index e541bd5bff0..145f7d0640f 100644 --- a/dlls/msvcrt/environ.c +++ b/dlls/msvcrt/environ.c @@ -26,18 +26,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); /********************************************************************* - * getenv (MSVCRT.@) + * getenv (MSVCRT.@) */ char * CDECL getenv(const char *name) { char **env; - unsigned int length=strlen(name); + size_t len; + + if (!MSVCRT_CHECK_PMT(name != NULL)) return NULL; + len = strlen(name); for (env = MSVCRT__environ; *env; env++) { char *str = *env; char *pos = strchr(str,'='); - if (pos && ((pos - str) == length) && !_strnicmp(str,name,length)) + if (pos && ((pos - str) == len) && !_strnicmp(str, name, len)) { TRACE("(%s): got %s\n", debugstr_a(name), debugstr_a(pos + 1)); return pos + 1;
1
0
0
0
Jason Millard : vbscript: Fix compile when statement after ElseIf or after separator.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: 887e72b24ead813facc3bd2ec9fd90a268d0dcd8 URL:
https://gitlab.winehq.org/wine/wine/-/commit/887e72b24ead813facc3bd2ec9fd90…
Author: Jason Millard <jsm174(a)gmail.com> Date: Tue Feb 14 10:02:09 2023 -0500 vbscript: Fix compile when statement after ElseIf or after separator. --- dlls/vbscript/parser.y | 2 +- dlls/vbscript/tests/lang.vbs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 03415dc2b1c..9ae6c478bfa 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -314,7 +314,7 @@ ElseIfs | ElseIf ElseIfs { $1->next = $2; $$ = $1; } ElseIf - : tELSEIF Expression tTHEN tNL StatementsNl_opt + : tELSEIF Expression tTHEN StSep_opt StatementsNl_opt { $$ = new_elseif_decl(ctx, @$, $2, $5); } Else_opt diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 1707cc9a92b..4a629627a16 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -337,6 +337,23 @@ ElseIf not False Then End If Call ok(x, "elseif not called?") +' ElseIf with statement on same line +x = false +If false Then + Call ok(false, "inside if false") +ElseIf not False Then x = true +End If +Call ok(x, "elseif not called?") + +' ElseIf with statement following statement separator +x = false +If false Then + Call ok(false, "inside if false") +ElseIf not False Then +: x = true +End If +Call ok(x, "elseif not called?") + x = false if 1 then x = true Call ok(x, "if 1 not run?")
1
0
0
0
Rémi Bernon : dinput: Use rawinput interface for keyboard device.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: aa7a6b8f4284bb654c657828271a0383f652801c URL:
https://gitlab.winehq.org/wine/wine/-/commit/aa7a6b8f4284bb654c657828271a03…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 11 12:41:55 2023 +0100 dinput: Use rawinput interface for keyboard device. --- dlls/dinput/dinput_main.c | 17 ++++++++++++++++- dlls/dinput/dinput_private.h | 2 ++ dlls/dinput/keyboard.c | 15 +++++++++++++++ dlls/dinput/tests/device8.c | 11 ----------- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 15ab2fe3dce..42541b9084a 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -200,6 +200,7 @@ static LRESULT CALLBACK cbt_hook_proc( int code, WPARAM wparam, LPARAM lparam ) static void input_thread_update_device_list( struct input_thread_state *state ) { + RAWINPUTDEVICE rawinput_keyboard = {.usUsagePage = HID_USAGE_PAGE_GENERIC, .usUsage = HID_USAGE_GENERIC_KEYBOARD, .dwFlags = RIDEV_REMOVE}; RAWINPUTDEVICE rawinput_mouse = {.usUsagePage = HID_USAGE_PAGE_GENERIC, .usUsage = HID_USAGE_GENERIC_MOUSE, .dwFlags = RIDEV_REMOVE}; UINT count = 0, keyboard_ll_count = 0, mouse_ll_count = 0, foreground_count = 0; struct dinput_device *device; @@ -230,7 +231,9 @@ static void input_thread_update_device_list( struct input_thread_state *state ) break; case DIDEVTYPE_KEYBOARD: case DI8DEVTYPE_KEYBOARD: + if (device->dwCoopLevel & DISCL_EXCLUSIVE) rawinput_keyboard.dwFlags |= RIDEV_NOHOTKEYS; if (!device->use_raw_input) keyboard_ll_count++; + else rawinput_device = &rawinput_keyboard; break; } @@ -274,8 +277,12 @@ static void input_thread_update_device_list( struct input_thread_state *state ) if (!rawinput_mouse.hwndTarget != !state->rawinput_devices[0].hwndTarget && !RegisterRawInputDevices( &rawinput_mouse, 1, sizeof(RAWINPUTDEVICE) )) WARN( "Failed to (un)register rawinput mouse device.\n" ); + if (!rawinput_keyboard.hwndTarget != !state->rawinput_devices[1].hwndTarget && + !RegisterRawInputDevices( &rawinput_keyboard, 1, sizeof(RAWINPUTDEVICE) )) + WARN( "Failed to (un)register rawinput mouse device.\n" ); state->rawinput_devices[0] = rawinput_mouse; + state->rawinput_devices[1] = rawinput_keyboard; } static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) @@ -292,7 +299,9 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR size = GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER) ); if (size == (UINT)-1 || size < sizeof(RAWINPUTHEADER)) WARN( "Unable to read raw input data\n" ); - else if (ri.header.dwType == RIM_TYPEMOUSE) + else if (ri.header.dwType == RIM_TYPEHID) + WARN( "Unexpected HID rawinput message\n" ); + else { for (i = state->events_count; i < state->devices_count; ++i) { @@ -303,8 +312,14 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR { case DIDEVTYPE_MOUSE: case DI8DEVTYPE_MOUSE: + if (ri.header.dwType != RIM_TYPEMOUSE) break; dinput_mouse_rawinput_hook( &device->IDirectInputDevice8W_iface, wparam, lparam, &ri ); break; + case DIDEVTYPE_KEYBOARD: + case DI8DEVTYPE_KEYBOARD: + if (ri.header.dwType != RIM_TYPEKEYBOARD) break; + dinput_keyboard_rawinput_hook( &device->IDirectInputDevice8W_iface, wparam, lparam, &ri ); + break; default: break; } } diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 6e7ffeb0841..944d12b860f 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -72,6 +72,8 @@ extern int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM extern int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ); extern void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam, RAWINPUT *raw ); +extern void dinput_keyboard_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam, + RAWINPUT *raw ); extern void check_dinput_events(void) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 6c24ddcf24b..c49796cfa2d 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -115,6 +115,18 @@ static void keyboard_handle_event( struct keyboard *impl, DWORD vkey, DWORD scan LeaveCriticalSection( &impl->base.crit ); } +void dinput_keyboard_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam, RAWINPUT *ri ) +{ + struct keyboard *impl = impl_from_IDirectInputDevice8W( iface ); + DWORD scan_code; + + TRACE("(%p) wparam %Ix, lparam %Ix\n", iface, wparam, lparam); + + scan_code = ri->data.keyboard.MakeCode & 0xff; + if (ri->data.keyboard.Flags & RI_KEY_E0) scan_code |= 0x100; + keyboard_handle_event( impl, ri->data.keyboard.VKey, scan_code, ri->data.keyboard.Flags & RI_KEY_BREAK ); +} + int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ) { struct keyboard *impl = impl_from_IDirectInputDevice8W( iface ); @@ -189,6 +201,9 @@ HRESULT keyboard_create_device( struct dinput *dinput, const GUID *guid, IDirect impl->base.caps.dwFirmwareRevision = 100; impl->base.caps.dwHardwareRevision = 100; + if (dinput->dwVersion >= 0x0800) + impl->base.use_raw_input = TRUE; + *out = &impl->base.IDirectInputDevice8W_iface; return DI_OK; } diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index 449402621a7..1f29c9af519 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -1099,15 +1099,11 @@ static void test_mouse_keyboard(void) raw_devices_count = ARRAY_SIZE(raw_devices); memset(raw_devices, 0, sizeof(raw_devices)); hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE)); - todo_wine ok(hr == 1, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count); - todo_wine ok(raw_devices[0].usUsagePage == HID_USAGE_PAGE_GENERIC, "got usUsagePage: %x\n", raw_devices[0].usUsagePage); - todo_wine ok(raw_devices[0].usUsage == HID_USAGE_GENERIC_KEYBOARD, "got usUsage: %x\n", raw_devices[0].usUsage); todo_wine ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags); - todo_wine ok(raw_devices[0].hwndTarget != NULL, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget); hr = IDirectInputDevice8_Unacquire(di_keyboard); ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr); @@ -1139,7 +1135,6 @@ static void test_mouse_keyboard(void) ok(raw_devices[0].usUsagePage == HID_USAGE_PAGE_GENERIC, "got usUsagePage: %x\n", raw_devices[0].usUsagePage); ok(raw_devices[0].usUsage == HID_USAGE_GENERIC_MOUSE, "got usUsage: %x\n", raw_devices[0].usUsage); ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags); - todo_wine ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget); hr = IDirectInputDevice8_Unacquire(di_mouse); ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr); @@ -1185,9 +1180,6 @@ static void test_mouse_keyboard(void) ok(raw_devices[1].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[1].hwndTarget); ok(raw_devices[2].usUsagePage == HID_USAGE_PAGE_GENERIC, "got usUsagePage: %x\n", raw_devices[1].usUsagePage); ok(raw_devices[2].usUsage == HID_USAGE_GENERIC_KEYBOARD, "got usUsage: %x\n", raw_devices[1].usUsage); - todo_wine - ok(raw_devices[2].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %#lx\n", raw_devices[1].dwFlags); - todo_wine ok(raw_devices[2].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[1].hwndTarget); hr = IDirectInputDevice8_Unacquire(di_keyboard); ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr); @@ -1195,7 +1187,6 @@ static void test_mouse_keyboard(void) ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr); raw_devices_count = ARRAY_SIZE(raw_devices); GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE)); - todo_wine ok(raw_devices_count == 1, "Unexpected raw devices registered: %d\n", raw_devices_count); IDirectInputDevice8_SetCooperativeLevel(di_mouse, hwnd, DISCL_FOREGROUND|DISCL_EXCLUSIVE); @@ -1210,7 +1201,6 @@ static void test_mouse_keyboard(void) hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE)); ok(hr == 3, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count); ok(raw_devices[0].dwFlags == (RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY), "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags); - todo_wine ok(raw_devices[2].dwFlags == (RIDEV_NOHOTKEYS|RIDEV_NOLEGACY), "Unexpected raw device flags: %#lx\n", raw_devices[1].dwFlags); hr = IDirectInputDevice8_Unacquire(di_keyboard); ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr); @@ -1219,7 +1209,6 @@ static void test_mouse_keyboard(void) raw_devices_count = ARRAY_SIZE(raw_devices); hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE)); - todo_wine ok(hr == 1, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count); ok(raw_devices[0].usUsagePage == HID_USAGE_PAGE_GENERIC, "got usUsagePage: %x\n", raw_devices[0].usUsagePage); ok(raw_devices[0].usUsage == HID_USAGE_GENERIC_GAMEPAD, "got usUsage: %x\n", raw_devices[0].usUsage);
1
0
0
0
Rémi Bernon : dinput: Merge all acquired device lists together.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: a75e0d062236db2dafad44f3de3f0d3ac2120834 URL:
https://gitlab.winehq.org/wine/wine/-/commit/a75e0d062236db2dafad44f3de3f0d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Feb 12 00:38:54 2023 +0100 dinput: Merge all acquired device lists together. This is no longer needed as an optimization. --- dlls/dinput/dinput_main.c | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index cf0d8841424..15ab2fe3dce 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -88,8 +88,6 @@ static CRITICAL_SECTION_DEBUG dinput_critsect_debug = }; static CRITICAL_SECTION dinput_hook_crit = { &dinput_critsect_debug, -1, 0, 0, 0, 0 }; -static struct list acquired_mouse_list = LIST_INIT( acquired_mouse_list ); -static struct list acquired_keyboard_list = LIST_INIT( acquired_keyboard_list ); static struct list acquired_device_list = LIST_INIT( acquired_device_list ); void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ) @@ -97,12 +95,7 @@ void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ) struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); EnterCriticalSection( &dinput_hook_crit ); - if (IsEqualGUID( &impl->guid, &GUID_SysMouse )) - list_add_tail( &acquired_mouse_list, &impl->entry ); - else if (IsEqualGUID( &impl->guid, &GUID_SysKeyboard )) - list_add_tail( &acquired_keyboard_list, &impl->entry ); - else - list_add_tail( &acquired_device_list, &impl->entry ); + list_add_tail( &acquired_device_list, &impl->entry ); LeaveCriticalSection( &dinput_hook_crit ); SendMessageW( di_em_win, INPUT_THREAD_NOTIFY, NOTIFY_REFRESH_DEVICES, 0 ); @@ -177,18 +170,6 @@ static void dinput_unacquire_window_devices( HWND window ) TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); } - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) - { - if (window != impl->win) continue; - TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); - } - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) - { - if (window != impl->win) continue; - TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); - } LeaveCriticalSection( &dinput_hook_crit ); } @@ -201,10 +182,6 @@ static void dinput_unacquire_devices(void) LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry ) dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); LeaveCriticalSection( &dinput_hook_crit ); } @@ -224,7 +201,7 @@ static LRESULT CALLBACK cbt_hook_proc( int code, WPARAM wparam, LPARAM lparam ) static void input_thread_update_device_list( struct input_thread_state *state ) { RAWINPUTDEVICE rawinput_mouse = {.usUsagePage = HID_USAGE_PAGE_GENERIC, .usUsage = HID_USAGE_GENERIC_MOUSE, .dwFlags = RIDEV_REMOVE}; - UINT count = 0, keyboard_count = 0, mouse_ll_count = 0, foreground_count = 0; + UINT count = 0, keyboard_ll_count = 0, mouse_ll_count = 0, foreground_count = 0; struct dinput_device *device; EnterCriticalSection( &dinput_hook_crit ); @@ -238,11 +215,11 @@ static void input_thread_update_device_list( struct input_thread_state *state ) } state->events_count = count; - LIST_FOR_EACH_ENTRY( device, &acquired_mouse_list, struct dinput_device, entry ) + LIST_FOR_EACH_ENTRY( device, &acquired_device_list, struct dinput_device, entry ) { RAWINPUTDEVICE *rawinput_device = NULL; - if (device->dwCoopLevel & DISCL_FOREGROUND) foreground_count++; + if (device->read_event && device->vtbl->read) continue; switch (GET_DIDEVICE_TYPE( device->instance.dwDevType )) { case DIDEVTYPE_MOUSE: @@ -251,6 +228,10 @@ static void input_thread_update_device_list( struct input_thread_state *state ) if (!device->use_raw_input) mouse_ll_count++; else rawinput_device = &rawinput_mouse; break; + case DIDEVTYPE_KEYBOARD: + case DI8DEVTYPE_KEYBOARD: + if (!device->use_raw_input) keyboard_ll_count++; + break; } if (rawinput_device) @@ -263,12 +244,6 @@ static void input_thread_update_device_list( struct input_thread_state *state ) if (count < INPUT_THREAD_MAX_DEVICES) dinput_device_internal_addref( (state->devices[count++] = device) ); } - LIST_FOR_EACH_ENTRY( device, &acquired_keyboard_list, struct dinput_device, entry ) - { - if (device->dwCoopLevel & DISCL_FOREGROUND) foreground_count++; - keyboard_count++; - if (count < INPUT_THREAD_MAX_DEVICES) dinput_device_internal_addref( (state->devices[count++] = device) ); - } state->devices_count = count; LeaveCriticalSection( &dinput_hook_crit ); @@ -280,9 +255,9 @@ static void input_thread_update_device_list( struct input_thread_state *state ) state->callwndproc_hook = NULL; } - if (keyboard_count && !state->keyboard_ll_hook) + if (keyboard_ll_count && !state->keyboard_ll_hook) state->keyboard_ll_hook = SetWindowsHookExW( WH_KEYBOARD_LL, input_thread_ll_hook_proc, DINPUT_instance, 0 ); - else if (!keyboard_count && state->keyboard_ll_hook) + else if (!keyboard_ll_count && state->keyboard_ll_hook) { UnhookWindowsHookEx( state->keyboard_ll_hook ); state->keyboard_ll_hook = NULL;
1
0
0
0
Rémi Bernon : dinput: Merge mouse and rawmouse acquired lists.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: 6e0dd0d8b11be3acfaf36416e191cb2c4c53652a URL:
https://gitlab.winehq.org/wine/wine/-/commit/6e0dd0d8b11be3acfaf36416e191cb…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 11 12:36:26 2023 +0100 dinput: Merge mouse and rawmouse acquired lists. --- dlls/dinput/dinput_main.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 0b578715d1a..cf0d8841424 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -89,7 +89,6 @@ static CRITICAL_SECTION_DEBUG dinput_critsect_debug = static CRITICAL_SECTION dinput_hook_crit = { &dinput_critsect_debug, -1, 0, 0, 0, 0 }; static struct list acquired_mouse_list = LIST_INIT( acquired_mouse_list ); -static struct list acquired_rawmouse_list = LIST_INIT( acquired_rawmouse_list ); static struct list acquired_keyboard_list = LIST_INIT( acquired_keyboard_list ); static struct list acquired_device_list = LIST_INIT( acquired_device_list ); @@ -99,7 +98,7 @@ void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ) EnterCriticalSection( &dinput_hook_crit ); if (IsEqualGUID( &impl->guid, &GUID_SysMouse )) - list_add_tail( impl->use_raw_input ? &acquired_rawmouse_list : &acquired_mouse_list, &impl->entry ); + list_add_tail( &acquired_mouse_list, &impl->entry ); else if (IsEqualGUID( &impl->guid, &GUID_SysKeyboard )) list_add_tail( &acquired_keyboard_list, &impl->entry ); else @@ -184,12 +183,6 @@ static void dinput_unacquire_window_devices( HWND window ) TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); } - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry ) - { - if (window != impl->win) continue; - TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); - } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) { if (window != impl->win) continue; @@ -210,8 +203,6 @@ static void dinput_unacquire_devices(void) dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry ) - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -233,7 +224,7 @@ static LRESULT CALLBACK cbt_hook_proc( int code, WPARAM wparam, LPARAM lparam ) static void input_thread_update_device_list( struct input_thread_state *state ) { RAWINPUTDEVICE rawinput_mouse = {.usUsagePage = HID_USAGE_PAGE_GENERIC, .usUsage = HID_USAGE_GENERIC_MOUSE, .dwFlags = RIDEV_REMOVE}; - UINT count = 0, keyboard_count = 0, mouse_count = 0, foreground_count = 0; + UINT count = 0, keyboard_count = 0, mouse_ll_count = 0, foreground_count = 0; struct dinput_device *device; EnterCriticalSection( &dinput_hook_crit ); @@ -247,19 +238,29 @@ static void input_thread_update_device_list( struct input_thread_state *state ) } state->events_count = count; - LIST_FOR_EACH_ENTRY( device, &acquired_rawmouse_list, struct dinput_device, entry ) - { - if (device->dwCoopLevel & DISCL_FOREGROUND) foreground_count++; - if (device->dwCoopLevel & DISCL_BACKGROUND) rawinput_mouse.dwFlags |= RIDEV_INPUTSINK; - if (device->dwCoopLevel & DISCL_EXCLUSIVE) rawinput_mouse.dwFlags |= RIDEV_NOLEGACY | RIDEV_CAPTUREMOUSE; - rawinput_mouse.dwFlags &= ~RIDEV_REMOVE; - rawinput_mouse.hwndTarget = di_em_win; - if (count < INPUT_THREAD_MAX_DEVICES) dinput_device_internal_addref( (state->devices[count++] = device) ); - } LIST_FOR_EACH_ENTRY( device, &acquired_mouse_list, struct dinput_device, entry ) { + RAWINPUTDEVICE *rawinput_device = NULL; if (device->dwCoopLevel & DISCL_FOREGROUND) foreground_count++; - mouse_count++; + + switch (GET_DIDEVICE_TYPE( device->instance.dwDevType )) + { + case DIDEVTYPE_MOUSE: + case DI8DEVTYPE_MOUSE: + if (device->dwCoopLevel & DISCL_EXCLUSIVE) rawinput_mouse.dwFlags |= RIDEV_CAPTUREMOUSE; + if (!device->use_raw_input) mouse_ll_count++; + else rawinput_device = &rawinput_mouse; + break; + } + + if (rawinput_device) + { + if (device->dwCoopLevel & DISCL_BACKGROUND) rawinput_device->dwFlags |= RIDEV_INPUTSINK; + if (device->dwCoopLevel & DISCL_EXCLUSIVE) rawinput_device->dwFlags |= RIDEV_NOLEGACY; + rawinput_device->dwFlags &= ~RIDEV_REMOVE; + rawinput_device->hwndTarget = di_em_win; + } + if (count < INPUT_THREAD_MAX_DEVICES) dinput_device_internal_addref( (state->devices[count++] = device) ); } LIST_FOR_EACH_ENTRY( device, &acquired_keyboard_list, struct dinput_device, entry ) @@ -287,9 +288,9 @@ static void input_thread_update_device_list( struct input_thread_state *state ) state->keyboard_ll_hook = NULL; } - if (mouse_count && !state->mouse_ll_hook) + if (mouse_ll_count && !state->mouse_ll_hook) state->mouse_ll_hook = SetWindowsHookExW( WH_MOUSE_LL, input_thread_ll_hook_proc, DINPUT_instance, 0 ); - else if (!mouse_count && state->mouse_ll_hook) + else if (!mouse_ll_count && state->mouse_ll_hook) { UnhookWindowsHookEx( state->mouse_ll_hook ); state->mouse_ll_hook = NULL;
1
0
0
0
Rémi Bernon : dinput: Avoid entering the hook CS in input_thread_ll_hook_proc.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: 5c16cda656e1e486f2767acd2d30114abf820820 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5c16cda656e1e486f2767acd2d3011…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 11 12:33:58 2023 +0100 dinput: Avoid entering the hook CS in input_thread_ll_hook_proc. --- dlls/dinput/dinput_main.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 9af8e064dc4..0b578715d1a 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -138,24 +138,30 @@ static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface, DWORD static LRESULT CALLBACK input_thread_ll_hook_proc( int code, WPARAM wparam, LPARAM lparam ) { - struct dinput_device *impl; - int skip = 0; + struct input_thread_state *state = input_thread_state; + int i, skip = 0; if (code != HC_ACTION) return CallNextHookEx( 0, code, wparam, lparam ); - EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY( impl, &acquired_mouse_list, struct dinput_device, entry ) - { - TRACE( "calling dinput_mouse_hook (%p %Ix %Ix)\n", impl, wparam, lparam ); - skip |= dinput_mouse_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam ); - } - LIST_FOR_EACH_ENTRY( impl, &acquired_keyboard_list, struct dinput_device, entry ) + for (i = state->events_count; i < state->devices_count; ++i) { - if (impl->use_raw_input) continue; - TRACE( "calling dinput_keyboard_hook (%p %Ix %Ix)\n", impl, wparam, lparam ); - skip |= dinput_keyboard_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam ); + struct dinput_device *device = state->devices[i]; + if (device->use_raw_input) continue; + if (device->instance.dwDevType & DIDEVTYPE_HID) continue; + switch (GET_DIDEVICE_TYPE( device->instance.dwDevType )) + { + case DIDEVTYPE_MOUSE: + case DI8DEVTYPE_MOUSE: + TRACE( "calling dinput_mouse_hook (%p %Ix %Ix)\n", device, wparam, lparam ); + skip |= dinput_mouse_hook( &device->IDirectInputDevice8W_iface, wparam, lparam ); + break; + case DIDEVTYPE_KEYBOARD: + case DI8DEVTYPE_KEYBOARD: + TRACE( "calling dinput_keyboard_hook (%p %Ix %Ix)\n", device, wparam, lparam ); + skip |= dinput_keyboard_hook( &device->IDirectInputDevice8W_iface, wparam, lparam ); + break; + } } - LeaveCriticalSection( &dinput_hook_crit ); return skip ? 1 : CallNextHookEx( 0, code, wparam, lparam ); } @@ -248,18 +254,19 @@ static void input_thread_update_device_list( struct input_thread_state *state ) if (device->dwCoopLevel & DISCL_EXCLUSIVE) rawinput_mouse.dwFlags |= RIDEV_NOLEGACY | RIDEV_CAPTUREMOUSE; rawinput_mouse.dwFlags &= ~RIDEV_REMOVE; rawinput_mouse.hwndTarget = di_em_win; - dinput_device_internal_addref( (state->devices[count] = device) ); - if (++count >= INPUT_THREAD_MAX_DEVICES) break; + if (count < INPUT_THREAD_MAX_DEVICES) dinput_device_internal_addref( (state->devices[count++] = device) ); } LIST_FOR_EACH_ENTRY( device, &acquired_mouse_list, struct dinput_device, entry ) { if (device->dwCoopLevel & DISCL_FOREGROUND) foreground_count++; mouse_count++; + if (count < INPUT_THREAD_MAX_DEVICES) dinput_device_internal_addref( (state->devices[count++] = device) ); } LIST_FOR_EACH_ENTRY( device, &acquired_keyboard_list, struct dinput_device, entry ) { if (device->dwCoopLevel & DISCL_FOREGROUND) foreground_count++; keyboard_count++; + if (count < INPUT_THREAD_MAX_DEVICES) dinput_device_internal_addref( (state->devices[count++] = device) ); } state->devices_count = count; LeaveCriticalSection( &dinput_hook_crit );
1
0
0
0
Rémi Bernon : dinput: Introduce keyboard_handle_key_event helper.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: 2d6776e82e3597a87cd41074e7bea79f17492a9d URL:
https://gitlab.winehq.org/wine/wine/-/commit/2d6776e82e3597a87cd41074e7bea7…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 5 14:00:00 2022 +0100 dinput: Introduce keyboard_handle_key_event helper. --- dlls/dinput/keyboard.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 873a2d98434..6c24ddcf24b 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -83,22 +83,13 @@ static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType, DWORD vers return (BYTE)scanCode; } -int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ) +static void keyboard_handle_event( struct keyboard *impl, DWORD vkey, DWORD scan_code, BOOL up ) { - struct keyboard *impl = impl_from_IDirectInputDevice8W( iface ); BYTE new_diks, subtype = GET_DIDEVICE_SUBTYPE( impl->base.instance.dwDevType ); - int dik_code, ret = impl->base.dwCoopLevel & DISCL_EXCLUSIVE; - KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam; - DWORD scan_code; - - if (wparam != WM_KEYDOWN && wparam != WM_KEYUP && - wparam != WM_SYSKEYDOWN && wparam != WM_SYSKEYUP) - return 0; + IDirectInputDevice8W *iface = &impl->base.IDirectInputDevice8W_iface; + int dik_code; - TRACE( "iface %p, wparam %#Ix, lparam %#Ix, vkCode %#lx, scanCode %#lx.\n", iface, wparam, - lparam, hook->vkCode, hook->scanCode ); - - switch (hook->vkCode) + switch (vkey) { /* R-Shift is special - it is an extended key with separate scan code */ case VK_RSHIFT : dik_code = DIK_RSHIFT; break; @@ -106,25 +97,41 @@ int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lpa case VK_NUMLOCK : dik_code = DIK_NUMLOCK; break; case VK_SUBTRACT: dik_code = DIK_SUBTRACT; break; default: - scan_code = hook->scanCode & 0xff; - if (hook->flags & LLKHF_EXTENDED) scan_code |= 0x100; - dik_code = map_dik_code( scan_code, hook->vkCode, subtype, impl->base.dinput->dwVersion ); + dik_code = map_dik_code( scan_code, vkey, subtype, impl->base.dinput->dwVersion ); + break; } - new_diks = hook->flags & LLKHF_UP ? 0 : 0x80; + new_diks = (up ? 0 : 0x80); /* returns now if key event already known */ - if (new_diks == impl->base.device_state[dik_code]) return ret; + if (new_diks == impl->base.device_state[dik_code]) return; impl->base.device_state[dik_code] = new_diks; - TRACE( " setting key %02x to %02x\n", dik_code, impl->base.device_state[dik_code] ); + TRACE( "setting key %02x to %02x\n", dik_code, impl->base.device_state[dik_code] ); EnterCriticalSection( &impl->base.crit ); queue_event( iface, DIDFT_MAKEINSTANCE( dik_code ) | DIDFT_PSHBUTTON, new_diks, GetCurrentTime(), impl->base.dinput->evsequence++ ); if (impl->base.hEvent) SetEvent( impl->base.hEvent ); LeaveCriticalSection( &impl->base.crit ); +} + +int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ) +{ + struct keyboard *impl = impl_from_IDirectInputDevice8W( iface ); + KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam; + DWORD scan_code; + + TRACE( "iface %p, wparam %#Ix, lparam %#Ix, vkCode %#lx, scanCode %#lx.\n", iface, wparam, + lparam, hook->vkCode, hook->scanCode ); + + if (wparam != WM_KEYDOWN && wparam != WM_KEYUP && wparam != WM_SYSKEYDOWN && wparam != WM_SYSKEYUP) + return 0; + + scan_code = hook->scanCode & 0xff; + if (hook->flags & LLKHF_EXTENDED) scan_code |= 0x100; + keyboard_handle_event( impl, hook->vkCode, scan_code, hook->flags & LLKHF_UP ); - return ret; + return impl->base.dwCoopLevel & DISCL_EXCLUSIVE; } static DWORD get_keyboard_subtype(void)
1
0
0
0
Francois Gouget : atl100/tests: Trace GetLastError() when DeleteFile() fails.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: d384e858c1889e7749bdd141fb764f87acfed95c URL:
https://gitlab.winehq.org/wine/wine/-/commit/d384e858c1889e7749bdd141fb764f…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Sat Jan 14 00:20:04 2023 +0100 atl100/tests: Trace GetLastError() when DeleteFile() fails. test_AtlAxCreateControl()'s DeleteFile() call fails from time to time. --- dlls/atl100/tests/atl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/atl100/tests/atl.c b/dlls/atl100/tests/atl.c index a40c38df25a..2fad97d8008 100644 --- a/dlls/atl100/tests/atl.c +++ b/dlls/atl100/tests/atl.c @@ -786,7 +786,7 @@ static void test_ax_win(void) /* test file:// scheme on non-existent file */ ret = DeleteFileW(pathW); - ok(ret, "DeleteFile failed!\n"); + ok(ret, "DeleteFile failed (gle=%lu)\n", GetLastError()); hwnd = CreateWindowW(cls_names[i], file_uri1W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL); ok(hwnd != NULL, "CreateWindow failed!\n"); control = NULL; @@ -1048,7 +1048,7 @@ static void test_AtlAxCreateControl(void) /* test file:// scheme on non-existent file. */ ret = DeleteFileW(pathW); - ok(ret, "DeleteFile failed!\n"); + ok(ret, "DeleteFile failed (gle=%lu)\n", GetLastError()); container = NULL; control = NULL; hwnd = create_container_window();
1
0
0
0
Giovanni Mascellani : vkd3d-shader/hlsl: Write SM4 break instructions.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: vkd3d Branch: master Commit: 7c3dadce6b6430f82860e35001608eb8fc7ae46a URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/7c3dadce6b6430f82860e35001608…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com> Date: Fri Sep 10 08:53:17 2021 +0200 vkd3d-shader/hlsl: Write SM4 break instructions. --- libs/vkd3d-shader/hlsl.c | 14 ++++++++++++++ libs/vkd3d-shader/hlsl.h | 2 ++ libs/vkd3d-shader/hlsl_sm4.c | 26 ++++++++++++++++++++++++++ tests/function-return.shader_test | 16 ++++++++-------- tests/return.shader_test | 30 +++++++++++++++--------------- 5 files changed, 65 insertions(+), 23 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 97713343..5dbdaf7e 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1861,6 +1861,20 @@ const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type) return names[type]; } +const char *hlsl_jump_type_to_string(enum hlsl_ir_jump_type type) +{ + static const char * const names[] = + { + "HLSL_IR_JUMP_BREAK", + "HLSL_IR_JUMP_CONTINUE", + "HLSL_IR_JUMP_DISCARD", + "HLSL_IR_JUMP_RETURN", + }; + + assert(type < ARRAY_SIZE(names)); + return names[type]; +} + static void dump_instr(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct hlsl_ir_node *instr); static void dump_instr_list(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct list *list) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 53b47e40..81b1a61d 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1003,6 +1003,8 @@ struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name); struct hlsl_type *hlsl_get_element_type_from_path_index(struct hlsl_ctx *ctx, const struct hlsl_type *type, struct hlsl_ir_node *idx); +const char *hlsl_jump_type_to_string(enum hlsl_ir_jump_type type); + struct hlsl_type *hlsl_new_array_type(struct hlsl_ctx *ctx, struct hlsl_type *basic_type, unsigned int array_size); struct hlsl_ir_node *hlsl_new_binary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2); diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c index 2e7c101f..10bb1e3d 100644 --- a/libs/vkd3d-shader/hlsl_sm4.c +++ b/libs/vkd3d-shader/hlsl_sm4.c @@ -2118,6 +2118,28 @@ static void write_sm4_if(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf write_sm4_instruction(buffer, &instr); } +static void write_sm4_jump(struct hlsl_ctx *ctx, + struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_jump *jump) +{ + struct sm4_instruction instr = {0}; + + switch (jump->type) + { + case HLSL_IR_JUMP_BREAK: + instr.opcode = VKD3D_SM4_OP_BREAK; + break; + + case HLSL_IR_JUMP_RETURN: + vkd3d_unreachable(); + + default: + hlsl_fixme(ctx, &jump->node.loc, "Jump type %s.\n", hlsl_jump_type_to_string(jump->type)); + return; + } + + write_sm4_instruction(buffer, &instr); +} + static void write_sm4_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_load *load) { @@ -2375,6 +2397,10 @@ static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer * write_sm4_if(ctx, buffer, hlsl_ir_if(instr)); break; + case HLSL_IR_JUMP: + write_sm4_jump(ctx, buffer, hlsl_ir_jump(instr)); + break; + case HLSL_IR_LOAD: write_sm4_load(ctx, buffer, hlsl_ir_load(instr)); break; diff --git a/tests/function-return.shader_test b/tests/function-return.shader_test index 7d411998..cbd29749 100644 --- a/tests/function-return.shader_test +++ b/tests/function-return.shader_test @@ -145,7 +145,7 @@ uniform 0 float 0.9 draw quad probe all rgba (1.0, 0.9, 1.0, 0.6) 1 -[pixel shader todo] +[pixel shader] float func(out float o) { @@ -184,10 +184,10 @@ float4 main() : sv_target } [test] -todo draw quad +draw quad probe all rgba (0.4, 0.3, 0.3, 0.9) 1 -[pixel shader todo] +[pixel shader] uniform float f; @@ -239,23 +239,23 @@ float4 main() : sv_target [test] uniform 0 float 0.0 -todo draw quad +draw quad probe all rgba (0.3, 0.2, 0.3, 0.3) 1 uniform 0 float 0.1 -todo draw quad +draw quad probe all rgba (0.3, 0.3, 0.3, 0.3) 1 uniform 0 float 0.3 -todo draw quad +draw quad probe all rgba (0.3, 0.5, 0.3, 0.3) 1 uniform 0 float 0.7 -todo draw quad +draw quad probe all rgba (0.3, 0.9, 0.7, 0.6) 1 uniform 0 float 0.9 -todo draw quad +draw quad probe all rgba (0.4, 0.1, 0.7, 0.6) 1 [pixel shader todo] diff --git a/tests/return.shader_test b/tests/return.shader_test index 2660c6dd..3c9ea611 100644 --- a/tests/return.shader_test +++ b/tests/return.shader_test @@ -128,7 +128,7 @@ uniform 0 float 0.9 draw quad probe all rgba (0.4, 0.5, 0.6, 0.7) 1 -[pixel shader todo] +[pixel shader] void main(out float4 ret : sv_target) { @@ -143,10 +143,10 @@ void main(out float4 ret : sv_target) } [test] -todo draw quad -todo probe all rgba (0.2, 0.4, 0.6, 0.8) +draw quad +probe all rgba (0.2, 0.4, 0.6, 0.8) -[pixel shader todo] +[pixel shader] uniform float f; @@ -166,26 +166,26 @@ void main(out float4 ret : sv_target) [test] uniform 0 float 0.0 -todo draw quad -todo probe all rgba (0.1, 0.1, 0.1, 0.1) 1 +draw quad +probe all rgba (0.1, 0.1, 0.1, 0.1) 1 uniform 0 float 0.1 -todo draw quad -todo probe all rgba (0.2, 0.2, 0.2, 0.2) 1 +draw quad +probe all rgba (0.2, 0.2, 0.2, 0.2) 1 uniform 0 float 0.3 -todo draw quad +draw quad todo probe all rgba (0.4, 0.4, 0.4, 0.4) 1 uniform 0 float 0.7 -todo draw quad +draw quad todo probe all rgba (0.8, 0.8, 0.8, 0.8) 1 uniform 0 float 0.9 -todo draw quad +draw quad todo probe all rgba (0.9, 0.9, 0.9, 0.9) 1 -[pixel shader todo] +[pixel shader] uniform float f; @@ -211,10 +211,10 @@ void main(out float4 ret : sv_target) [test] uniform 0 float 0.2 -todo draw quad -todo probe all rgba (0.2, 0.2, 0.2, 0.2) +draw quad +probe all rgba (0.2, 0.2, 0.2, 0.2) uniform 0 float 0.8 -todo draw quad +draw quad probe all rgba (0.5, 0.5, 0.5, 0.5) [pixel shader todo]
1
0
0
0
Alex Henrie : ntoskrnl: Avoid calling RtlInitUnicodeString on a static constant.
by Alexandre Julliard
15 Feb '23
15 Feb '23
Module: wine Branch: master Commit: e60e8af0a9684b229ed9ee21543c0695ff754a6b URL:
https://gitlab.winehq.org/wine/wine/-/commit/e60e8af0a9684b229ed9ee21543c06…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Feb 14 19:54:25 2023 -0700 ntoskrnl: Avoid calling RtlInitUnicodeString on a static constant. --- dlls/ntoskrnl.exe/pnp.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 7c77a9a7145..25a52d7d219 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -720,8 +720,6 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'C','o','n','t','r','o','l','\\', 'D','e','v','i','c','e','C','l','a','s','s','e','s','\\',0}; - static const WCHAR controlW[] = {'C','o','n','t','r','o','l',0}; - static const WCHAR linkedW[] = {'L','i','n','k','e','d',0}; static const WCHAR slashW[] = {'\\',0}; static const WCHAR hashW[] = {'#',0}; @@ -732,6 +730,8 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable HANDLE iface_key, control_key; OBJECT_ATTRIBUTES attr = {0}; struct wine_rb_entry *entry; + UNICODE_STRING control = RTL_CONSTANT_STRING( L"Control" ); + UNICODE_STRING linked = RTL_CONSTANT_STRING( L"Linked" ); UNICODE_STRING string; DWORD data = enable; NTSTATUS ret; @@ -780,14 +780,14 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable return ret; attr.RootDirectory = iface_key; - RtlInitUnicodeString( &string, controlW ); + attr.ObjectName = &control; ret = NtCreateKey( &control_key, KEY_SET_VALUE, &attr, 0, NULL, REG_OPTION_VOLATILE, NULL ); NtClose( iface_key ); if (ret) return ret; - RtlInitUnicodeString( &string, linkedW ); - ret = NtSetValueKey( control_key, &string, 0, REG_DWORD, &data, sizeof(data) ); + attr.ObjectName = &linked; + ret = NtSetValueKey( control_key, &linked, 0, REG_DWORD, &data, sizeof(data) ); if (ret) { NtClose( control_key ); @@ -800,7 +800,7 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable ret = IoDeleteSymbolicLink( name ); if (ret) { - NtDeleteValueKey( control_key, &string ); + NtDeleteValueKey( control_key, &linked ); NtClose( control_key ); return ret; } @@ -1141,15 +1141,13 @@ static DWORD CALLBACK device_enum_thread_proc(void *arg) void pnp_manager_start(void) { - static const WCHAR driver_nameW[] = {'\\','D','r','i','v','e','r','\\','P','n','p','M','a','n','a','g','e','r',0}; WCHAR endpoint[] = L"\\pipe\\wine_plugplay"; WCHAR protseq[] = L"ncacn_np"; - UNICODE_STRING driver_nameU; + UNICODE_STRING driver_nameU = RTL_CONSTANT_STRING( L"\\Driver\\PnpManager" ); RPC_WSTR binding_str; NTSTATUS status; RPC_STATUS err; - RtlInitUnicodeString( &driver_nameU, driver_nameW ); if ((status = IoCreateDriver( &driver_nameU, pnp_manager_driver_entry ))) ERR("Failed to create PnP manager driver, status %#lx.\n", status);
1
0
0
0
← Newer
1
...
28
29
30
31
32
33
34
...
60
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
Results per page:
10
25
50
100
200