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
January 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
467 discussions
Start a n
N
ew thread
Alexandre Julliard : user32: Copy directly to the buffer in unpack_message().
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: d5756ff8cfb6231cef952f4265bfcf5b2ebb42d5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/d5756ff8cfb6231cef952f4265bfcf…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jan 27 10:23:56 2023 +0100 user32: Copy directly to the buffer in unpack_message(). This avoids compiler warnings. --- dlls/user32/winproc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 6cd41b51435..9fd35e1d24e 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -831,7 +831,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa if (!check_string( str, size )) return FALSE; cs.lpszClass = str; } - memcpy( &ps->cs, &cs, sizeof(cs) ); + memcpy( *buffer, &cs, sizeof(cs) ); break; } case WM_GETTEXT: @@ -865,7 +865,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa dis.hDC = unpack_handle( ps->dis.hDC ); dis.rcItem = ps->dis.rcItem; dis.itemData = (ULONG_PTR)unpack_ptr( ps->dis.itemData ); - memcpy( &ps->dis, &dis, sizeof(dis) ); + memcpy( *buffer, &dis, sizeof(dis) ); break; } case WM_MEASUREITEM: @@ -878,7 +878,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa mis.itemWidth = ps->mis.itemWidth; mis.itemHeight = ps->mis.itemHeight; mis.itemData = (ULONG_PTR)unpack_ptr( ps->mis.itemData ); - memcpy( &ps->mis, &mis, sizeof(mis) ); + memcpy( *buffer, &mis, sizeof(mis) ); break; } case WM_DELETEITEM: @@ -890,7 +890,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa dls.itemID = ps->dls.itemID; dls.hwndItem = unpack_handle( ps->dls.hwndItem ); dls.itemData = (ULONG_PTR)unpack_ptr( ps->dls.itemData ); - memcpy( &ps->dls, &dls, sizeof(dls) ); + memcpy( *buffer, &dls, sizeof(dls) ); break; } case WM_COMPAREITEM: @@ -905,7 +905,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa cis.itemID2 = ps->cis.itemID2; cis.itemData2 = (ULONG_PTR)unpack_ptr( ps->cis.itemData2 ); cis.dwLocaleId = ps->cis.dwLocaleId; - memcpy( &ps->cis, &cis, sizeof(cis) ); + memcpy( *buffer, &cis, sizeof(cis) ); break; } case WM_WINDOWPOSCHANGING: @@ -920,7 +920,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa wp.cx = ps->wp.cx; wp.cy = ps->wp.cy; wp.flags = ps->wp.flags; - memcpy( &ps->wp, &wp, sizeof(wp) ); + memcpy( *buffer, &wp, sizeof(wp) ); break; } case WM_COPYDATA: @@ -1080,7 +1080,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa mnm.hmenuIn = unpack_handle( ps->mnm.hmenuIn ); mnm.hmenuNext = unpack_handle( ps->mnm.hmenuNext ); mnm.hwndNext = unpack_handle( ps->mnm.hwndNext ); - memcpy( &ps->mnm, &mnm, sizeof(mnm) ); + memcpy( *buffer, &mnm, sizeof(mnm) ); break; } case WM_SIZING: @@ -1116,7 +1116,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa if (!check_string( str, size )) return FALSE; mcs.szTitle = str; } - memcpy( &ps->mcs, &mcs, sizeof(mcs) ); + memcpy( *buffer, &mcs, sizeof(mcs) ); break; } case WM_MDIGETACTIVE:
1
0
0
0
Rémi Bernon : dinput: Keep track of input thread users using public refcounts.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: 80d1d087877cb2012203927795596fca8da3945b URL:
https://gitlab.winehq.org/wine/wine/-/commit/80d1d087877cb2012203927795596f…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Jan 22 12:30:44 2023 +0100 dinput: Keep track of input thread users using public refcounts. And start the input thread when first user is created, then stop it when last user is destroyed. The thread will not need to enter the hook critical section on stop, as no public reference are held and devices are already unacquired. --- dlls/dinput/device.c | 3 +++ dlls/dinput/dinput.c | 3 +++ dlls/dinput/dinput_main.c | 49 +++++++++++++++++++++++--------------------- dlls/dinput/dinput_private.h | 3 +++ 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 7f97067bd81..04788b22f9a 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -734,6 +734,7 @@ static ULONG WINAPI dinput_device_Release( IDirectInputDevice8W *iface ) if (!ref) { IDirectInputDevice_Unacquire( iface ); + input_thread_remove_user(); dinput_device_internal_release( impl ); } @@ -2127,6 +2128,8 @@ void dinput_device_init( struct dinput_device *device, const struct dinput_devic InitializeCriticalSection( &device->crit ); dinput_internal_addref( (device->dinput = dinput) ); device->vtbl = vtbl; + + input_thread_add_user(); } static const GUID *object_instance_guid( const DIDEVICEOBJECTINSTANCEW *instance ) diff --git a/dlls/dinput/dinput.c b/dlls/dinput/dinput.c index 7cf06364dc3..db367e1f1ba 100644 --- a/dlls/dinput/dinput.c +++ b/dlls/dinput/dinput.c @@ -146,6 +146,7 @@ static ULONG WINAPI dinput7_Release( IDirectInput7W *iface ) if (!ref) { + input_thread_remove_user(); dinput_internal_release( impl ); } @@ -819,6 +820,8 @@ static HRESULT dinput_create( IUnknown **out ) #else *out = (IUnknown *)&impl->IDirectInput8W_iface; #endif + + input_thread_add_user(); return DI_OK; } diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index aceed841df5..f264c367305 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -69,6 +69,7 @@ static HWND di_em_win; static HANDLE dinput_thread; static DWORD dinput_thread_id; +static UINT input_thread_user_count; static CRITICAL_SECTION dinput_hook_crit; static CRITICAL_SECTION_DEBUG dinput_critsect_debug = @@ -347,34 +348,39 @@ done: return 0; } -static BOOL WINAPI dinput_thread_start_once( INIT_ONCE *once, void *param, void **context ) +void input_thread_add_user(void) { - HANDLE start_event; - - start_event = CreateEventW( NULL, FALSE, FALSE, NULL ); - if (!start_event) ERR( "failed to create start event, error %lu\n", GetLastError() ); + EnterCriticalSection( &dinput_hook_crit ); + if (!input_thread_user_count++) + { + HANDLE start_event; - dinput_thread = CreateThread( NULL, 0, dinput_thread_proc, start_event, 0, &dinput_thread_id ); - if (!dinput_thread) ERR( "failed to create internal thread, error %lu\n", GetLastError() ); + TRACE( "Starting input thread.\n" ); - WaitForSingleObject( start_event, INFINITE ); - CloseHandle( start_event ); + if (!(start_event = CreateEventW( NULL, FALSE, FALSE, NULL ))) + ERR( "Failed to create start event, error %lu\n", GetLastError() ); + else if (!(dinput_thread = CreateThread( NULL, 0, dinput_thread_proc, start_event, 0, &dinput_thread_id ))) + ERR( "Failed to create internal thread, error %lu\n", GetLastError() ); + else + WaitForSingleObject( start_event, INFINITE ); - return TRUE; + CloseHandle( start_event ); + } + LeaveCriticalSection( &dinput_hook_crit ); } -static void dinput_thread_start(void) +void input_thread_remove_user(void) { - static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; - InitOnceExecuteOnce( &init_once, dinput_thread_start_once, NULL, NULL ); -} + EnterCriticalSection( &dinput_hook_crit ); + if (!--input_thread_user_count) + { + TRACE( "Stopping input thread.\n" ); -static void dinput_thread_stop(void) -{ - PostThreadMessageW( dinput_thread_id, WM_USER + 0x10, 0, 0 ); - if (WaitForSingleObject( dinput_thread, 500 ) == WAIT_TIMEOUT) - WARN("Timeout while waiting for internal thread\n"); - CloseHandle( dinput_thread ); + PostThreadMessageW( dinput_thread_id, WM_USER + 0x10, 0, 0 ); + WaitForSingleObject( dinput_thread, INFINITE ); + CloseHandle( dinput_thread ); + } + LeaveCriticalSection( &dinput_hook_crit ); } void check_dinput_hooks( IDirectInputDevice8W *iface, BOOL acquired ) @@ -384,8 +390,6 @@ void check_dinput_hooks( IDirectInputDevice8W *iface, BOOL acquired ) struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HANDLE hook_change_finished_event = NULL; - dinput_thread_start(); - EnterCriticalSection(&dinput_hook_crit); if (impl->dwCoopLevel & DISCL_FOREGROUND) @@ -468,7 +472,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) break; case DLL_PROCESS_DETACH: if (reserved) break; - dinput_thread_stop(); unregister_di_em_win_class(); break; } diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index fb9558716a3..f10d5120c89 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -63,6 +63,9 @@ struct DevicePlayer { struct list entry; }; +extern void input_thread_add_user(void); +extern void input_thread_remove_user(void); + extern void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ); extern void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ); extern int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam );
1
0
0
0
Rémi Bernon : dinput: Unacquire all devices on internal thread error.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: 5119753a33e3b0bed98186b574eb1a82cb18664e URL:
https://gitlab.winehq.org/wine/wine/-/commit/5119753a33e3b0bed98186b574eb1a…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Jan 22 12:28:14 2023 +0100 dinput: Unacquire all devices on internal thread error. --- dlls/dinput/dinput_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 21b77b32cac..aceed841df5 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -201,7 +201,7 @@ static void dinput_unacquire_window_devices( HWND window ) LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry ) { - if (window == impl->win) + if (!window || window == impl->win) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -209,7 +209,7 @@ static void dinput_unacquire_window_devices( HWND window ) } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) { - if (window == impl->win) + if (!window || window == impl->win) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -217,7 +217,7 @@ static void dinput_unacquire_window_devices( HWND window ) } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry ) { - if (window == impl->win) + if (!window || window == impl->win) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -225,7 +225,7 @@ static void dinput_unacquire_window_devices( HWND window ) } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) { - if (window == impl->win) + if (!window || window == impl->win) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -335,7 +335,8 @@ static DWORD WINAPI dinput_thread_proc( void *params ) } } - if (ret != state.events_count) ERR("Unexpected termination, ret %#lx\n", ret); + ERR( "Unexpected termination, ret %#lx\n", ret ); + dinput_unacquire_window_devices( 0 ); done: while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] );
1
0
0
0
Rémi Bernon : dinput: Introduce new dinput_unacquire_window_devices helper.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: 7c88cf0f26f34e57ab582c2e8b397608cc8c1b52 URL:
https://gitlab.winehq.org/wine/wine/-/commit/7c88cf0f26f34e57ab582c2e8b3976…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Jan 5 14:25:57 2022 +0100 dinput: Introduce new dinput_unacquire_window_devices helper. --- dlls/dinput/dinput_main.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 1334bf28431..21b77b32cac 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -193,22 +193,15 @@ static LRESULT CALLBACK input_thread_ll_hook_proc( int code, WPARAM wparam, LPAR return skip ? 1 : CallNextHookEx( 0, code, wparam, lparam ); } -static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam ) +static void dinput_unacquire_window_devices( HWND window ) { struct dinput_device *impl, *next; - CWPSTRUCT *msg = (CWPSTRUCT *)lparam; - HWND foreground; - - if (code != HC_ACTION || (msg->message != WM_KILLFOCUS && - msg->message != WM_ACTIVATEAPP && msg->message != WM_ACTIVATE)) - return CallNextHookEx( 0, code, wparam, lparam ); - - foreground = GetForegroundWindow(); EnterCriticalSection( &dinput_hook_crit ); + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry ) { - if (msg->hwnd == impl->win && msg->hwnd != foreground) + if (window == impl->win) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -216,7 +209,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) { - if (msg->hwnd == impl->win && msg->hwnd != foreground) + if (window == impl->win) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -224,7 +217,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry ) { - if (msg->hwnd == impl->win && msg->hwnd != foreground) + if (window == impl->win) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); @@ -232,13 +225,25 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) { - if (msg->hwnd == impl->win && msg->hwnd != foreground) + if (window == impl->win) { 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 ); +} + +static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam ) +{ + CWPSTRUCT *msg = (CWPSTRUCT *)lparam; + + if (code != HC_ACTION || (msg->message != WM_KILLFOCUS && + msg->message != WM_ACTIVATEAPP && msg->message != WM_ACTIVATE)) + return CallNextHookEx( 0, code, wparam, lparam ); + + if (msg->hwnd != GetForegroundWindow()) dinput_unacquire_window_devices( msg->hwnd ); return CallNextHookEx( 0, code, wparam, lparam ); }
1
0
0
0
Rémi Bernon : dinput: Cleanup low-level hooks on input thread exit.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: 0a355d8a54864b9c7de4ab10d48bfe027ef9cc22 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0a355d8a54864b9c7de4ab10d48bfe…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Jan 22 12:27:40 2023 +0100 dinput: Cleanup low-level hooks on input thread exit. --- dlls/dinput/dinput_main.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 2b7528a20ea..1334bf28431 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -282,9 +282,9 @@ static void input_thread_update_device_list( struct input_thread_state *state ) static DWORD WINAPI dinput_thread_proc( void *params ) { - HANDLE finished_event, start_event = params; struct input_thread_state state = {0}; struct dinput_device *device; + HANDLE start_event = params; DWORD ret; MSG msg; @@ -320,22 +320,13 @@ static DWORD WINAPI dinput_thread_proc( void *params ) continue; } - finished_event = (HANDLE)msg.lParam; - TRACE( "Processing hook change notification wparam %#Ix, lparam %#Ix.\n", msg.wParam, msg.lParam ); - if (!msg.wParam) - { - if (state.keyboard_ll_hook) UnhookWindowsHookEx( state.keyboard_ll_hook ); - if (state.mouse_ll_hook) UnhookWindowsHookEx( state.mouse_ll_hook ); - state.keyboard_ll_hook = state.mouse_ll_hook = NULL; - goto done; - } + if (!msg.wParam) goto done; while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] ); input_thread_update_device_list( &state ); - - SetEvent(finished_event); + SetEvent( (HANDLE)msg.lParam ); } } @@ -343,6 +334,8 @@ static DWORD WINAPI dinput_thread_proc( void *params ) done: while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] ); + if (state.keyboard_ll_hook) UnhookWindowsHookEx( state.keyboard_ll_hook ); + if (state.mouse_ll_hook) UnhookWindowsHookEx( state.mouse_ll_hook ); DestroyWindow( di_em_win ); di_em_win = NULL; return 0;
1
0
0
0
Rémi Bernon : dinput: Update the device status while holding its CS.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: 721437b43618db9ba9e0d4384014e0bbc7895a15 URL:
https://gitlab.winehq.org/wine/wine/-/commit/721437b43618db9ba9e0d4384014e0…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Jan 22 12:26:51 2023 +0100 dinput: Update the device status while holding its CS. --- dlls/dinput/dinput_main.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index c9bbb34e554..2b7528a20ea 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -107,7 +107,7 @@ void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ) LeaveCriticalSection( &dinput_hook_crit ); } -static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface ) +static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface, DWORD status ) { struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); @@ -117,7 +117,7 @@ static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface ) if (impl->status == STATUS_ACQUIRED) { impl->vtbl->unacquire( iface ); - impl->status = STATUS_UNACQUIRED; + impl->status = status; list_remove( &impl->entry ); } LeaveCriticalSection( &impl->crit ); @@ -211,7 +211,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam if (msg->hwnd == impl->win && msg->hwnd != foreground) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); } } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) @@ -219,7 +219,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam if (msg->hwnd == impl->win && msg->hwnd != foreground) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); } } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry ) @@ -227,7 +227,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam if (msg->hwnd == impl->win && msg->hwnd != foreground) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); } } LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) @@ -235,7 +235,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam if (msg->hwnd == impl->win && msg->hwnd != foreground) { TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); - dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED ); } } LeaveCriticalSection( &dinput_hook_crit ); @@ -301,9 +301,8 @@ static DWORD WINAPI dinput_thread_proc( void *params ) if ((device = state.devices[ret]) && FAILED( device->vtbl->read( &device->IDirectInputDevice8W_iface ) )) { EnterCriticalSection( &dinput_hook_crit ); - dinput_device_internal_unacquire( &device->IDirectInputDevice8W_iface ); + dinput_device_internal_unacquire( &device->IDirectInputDevice8W_iface, STATUS_UNPLUGGED ); LeaveCriticalSection( &dinput_hook_crit ); - device->status = STATUS_UNPLUGGED; state.events[ret] = state.events[--state.events_count]; state.devices[ret] = state.devices[state.events_count];
1
0
0
0
Rémi Bernon : dinput: Update the input thread device list when notified only.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: 6122dddf4ffe006127f69052414a5068a8c08aec URL:
https://gitlab.winehq.org/wine/wine/-/commit/6122dddf4ffe006127f69052414a50…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sun Jan 22 12:23:53 2023 +0100 dinput: Update the input thread device list when notified only. --- dlls/dinput/dinput_main.c | 64 ++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 48aa53c63cb..c9bbb34e554 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -52,6 +52,8 @@ struct input_thread_state { UINT events_count; UINT devices_count; + HHOOK mouse_ll_hook; + HHOOK keyboard_ll_hook; struct dinput_device *devices[INPUT_THREAD_MAX_DEVICES]; HANDLE events[INPUT_THREAD_MAX_DEVICES]; }; @@ -167,7 +169,7 @@ static void unregister_di_em_win_class(void) WARN( "Unable to unregister message window class\n" ); } -static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) +static LRESULT CALLBACK input_thread_ll_hook_proc( int code, WPARAM wparam, LPARAM lparam ) { struct dinput_device *impl; int skip = 0; @@ -243,8 +245,8 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam static void input_thread_update_device_list( struct input_thread_state *state ) { + UINT count = 0, keyboard_count, mouse_count; struct dinput_device *device; - UINT count = 0; EnterCriticalSection( &dinput_hook_crit ); LIST_FOR_EACH_ENTRY( device, &acquired_device_list, struct dinput_device, entry ) @@ -256,14 +258,32 @@ static void input_thread_update_device_list( struct input_thread_state *state ) } state->events_count = count; state->devices_count = count; + + keyboard_count = list_count( &acquired_keyboard_list ); + mouse_count = list_count( &acquired_mouse_list ); LeaveCriticalSection( &dinput_hook_crit ); + + if (keyboard_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) + { + UnhookWindowsHookEx( state->keyboard_ll_hook ); + state->keyboard_ll_hook = NULL; + } + + if (mouse_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) + { + UnhookWindowsHookEx( state->mouse_ll_hook ); + state->mouse_ll_hook = NULL; + } } static DWORD WINAPI dinput_thread_proc( void *params ) { HANDLE finished_event, start_event = params; struct input_thread_state state = {0}; - static HHOOK kbd_hook, mouse_hook; struct dinput_device *device; DWORD ret; MSG msg; @@ -276,8 +296,6 @@ static DWORD WINAPI dinput_thread_proc( void *params ) while ((ret = MsgWaitForMultipleObjectsEx( state.events_count, state.events, INFINITE, QS_ALLINPUT, 0 )) <= state.events_count) { - UINT kbd_cnt = 0, mice_cnt = 0; - if (ret < state.events_count) { if ((device = state.devices[ret]) && FAILED( device->vtbl->read( &device->IDirectInputDevice8W_iface ) )) @@ -286,6 +304,11 @@ static DWORD WINAPI dinput_thread_proc( void *params ) dinput_device_internal_unacquire( &device->IDirectInputDevice8W_iface ); LeaveCriticalSection( &dinput_hook_crit ); device->status = STATUS_UNPLUGGED; + + state.events[ret] = state.events[--state.events_count]; + state.devices[ret] = state.devices[state.events_count]; + state.devices[state.events_count] = state.devices[--state.devices_count]; + dinput_device_internal_release( device ); } } @@ -304,38 +327,17 @@ static DWORD WINAPI dinput_thread_proc( void *params ) if (!msg.wParam) { - if (kbd_hook) UnhookWindowsHookEx( kbd_hook ); - if (mouse_hook) UnhookWindowsHookEx( mouse_hook ); - kbd_hook = mouse_hook = NULL; + if (state.keyboard_ll_hook) UnhookWindowsHookEx( state.keyboard_ll_hook ); + if (state.mouse_ll_hook) UnhookWindowsHookEx( state.mouse_ll_hook ); + state.keyboard_ll_hook = state.mouse_ll_hook = NULL; goto done; } - EnterCriticalSection( &dinput_hook_crit ); - kbd_cnt = list_count( &acquired_keyboard_list ); - mice_cnt = list_count( &acquired_mouse_list ); - LeaveCriticalSection( &dinput_hook_crit ); - - if (kbd_cnt && !kbd_hook) - kbd_hook = SetWindowsHookExW( WH_KEYBOARD_LL, LL_hook_proc, DINPUT_instance, 0 ); - else if (!kbd_cnt && kbd_hook) - { - UnhookWindowsHookEx( kbd_hook ); - kbd_hook = NULL; - } - - if (mice_cnt && !mouse_hook) - mouse_hook = SetWindowsHookExW( WH_MOUSE_LL, LL_hook_proc, DINPUT_instance, 0 ); - else if (!mice_cnt && mouse_hook) - { - UnhookWindowsHookEx( mouse_hook ); - mouse_hook = NULL; - } + while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] ); + input_thread_update_device_list( &state ); SetEvent(finished_event); } - - while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] ); - input_thread_update_device_list( &state ); } if (ret != state.events_count) ERR("Unexpected termination, ret %#lx\n", ret);
1
0
0
0
Mohamad Al-Jaf : windows.system.profile.systemmanufacturers: Implement ISmbiosInformationStatics_get_SerialNumber.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: e1169dfabe356e0f22ba7c21fd7ca03f25dae742 URL:
https://gitlab.winehq.org/wine/wine/-/commit/e1169dfabe356e0f22ba7c21fd7ca0…
Author: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> Date: Mon Nov 28 23:22:34 2022 -0500 windows.system.profile.systemmanufacturers: Implement ISmbiosInformationStatics_get_SerialNumber. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53747
--- .../Makefile.in | 2 +- .../main.c | 62 +++++++++++++++++++++- .../private.h | 2 + .../tests/smbios.c | 4 +- 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/dlls/windows.system.profile.systemmanufacturers/Makefile.in b/dlls/windows.system.profile.systemmanufacturers/Makefile.in index a2d6076740f..9d07caa287c 100644 --- a/dlls/windows.system.profile.systemmanufacturers/Makefile.in +++ b/dlls/windows.system.profile.systemmanufacturers/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.system.profile.systemmanufacturers.dll -IMPORTS = combase +IMPORTS = combase oleaut32 C_SRCS = \ main.c diff --git a/dlls/windows.system.profile.systemmanufacturers/main.c b/dlls/windows.system.profile.systemmanufacturers/main.c index 35b4529ad7a..d2feb32054e 100644 --- a/dlls/windows.system.profile.systemmanufacturers/main.c +++ b/dlls/windows.system.profile.systemmanufacturers/main.c @@ -128,10 +128,68 @@ static const struct IActivationFactoryVtbl factory_vtbl = DEFINE_IINSPECTABLE( statics, ISmbiosInformationStatics, struct smbios_statics, IActivationFactory_iface ) +static HRESULT get_bios_serialnumber( BSTR *value ) +{ + const WCHAR *class = L"Win32_BIOS"; + IEnumWbemClassObject *wbem_enum; + IWbemClassObject *wbem_class; + IWbemServices *wbem_service; + IWbemLocator *wbem_locator; + VARIANT serial; + ULONG count; + HRESULT hr; + BSTR bstr; + + hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (void**)&wbem_locator ); + if (FAILED(hr)) return hr; + + bstr = SysAllocString( L"ROOT\\CIMV2" ); + if (!bstr) + { + IWbemLocator_Release( wbem_locator ); + return E_OUTOFMEMORY; + } + hr = IWbemLocator_ConnectServer( wbem_locator, bstr, NULL, NULL, NULL, 0, NULL, NULL, &wbem_service ); + IWbemLocator_Release( wbem_locator ); + SysFreeString( bstr ); + if (FAILED(hr)) return hr; + + bstr = SysAllocString( class ); + if (!bstr) + { + IWbemServices_Release( wbem_service ); + return E_OUTOFMEMORY; + } + hr = IWbemServices_CreateInstanceEnum( wbem_service, bstr, WBEM_FLAG_SYSTEM_ONLY, NULL, &wbem_enum ); + IWbemServices_Release( wbem_service ); + SysFreeString( bstr ); + if (FAILED(hr)) return hr; + + hr = IEnumWbemClassObject_Next( wbem_enum, 1000, 1, &wbem_class, &count ); + IEnumWbemClassObject_Release( wbem_enum ); + if (FAILED(hr)) return hr; + + hr = IWbemClassObject_Get( wbem_class, L"SerialNumber", 0, &serial, NULL, NULL ); + IWbemClassObject_Release( wbem_class ); + if (FAILED(hr)) return hr; + + *value = V_BSTR( &serial ); + VariantClear( &serial ); + return hr; +} + static HRESULT WINAPI statics_get_SerialNumber( ISmbiosInformationStatics *iface, HSTRING *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + BSTR serial; + HRESULT hr; + + TRACE( "iface %p, value %p.\n", iface, value ); + + if (FAILED( hr = get_bios_serialnumber( &serial ) )) return hr; + if (FAILED( hr = WindowsCreateString( serial, wcslen(serial), value ) )) return hr; + + TRACE( "Returning serial number: %s.\n", debugstr_w( serial ) ); + return hr; } static const struct ISmbiosInformationStaticsVtbl statics_vtbl = diff --git a/dlls/windows.system.profile.systemmanufacturers/private.h b/dlls/windows.system.profile.systemmanufacturers/private.h index 42c19710dcb..374a2829130 100644 --- a/dlls/windows.system.profile.systemmanufacturers/private.h +++ b/dlls/windows.system.profile.systemmanufacturers/private.h @@ -30,6 +30,8 @@ #define WIDL_using_Windows_System_Profile_SystemManufacturers #include "windows.system.profile.systemmanufacturers.h" +#include "wbemcli.h" + #define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ static inline impl_type *impl_from( iface_type *iface ) \ { \ diff --git a/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c b/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c index 49e90216c42..8d02b2c423a 100644 --- a/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c +++ b/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c @@ -75,11 +75,11 @@ static void test_Smbios_Statics(void) if (0) /* Win8 Crash */ { hr = ISmbiosInformationStatics_get_SerialNumber( smbios_statics, &serial ); - todo_wine ok( hr == S_OK || broken(hr == E_UNEXPECTED), "got hr %#lx.\n", hr ); + ok( hr == S_OK || broken(hr == E_UNEXPECTED), "got hr %#lx.\n", hr ); if (hr == S_OK) { buf = WindowsGetStringRawBuffer( serial, &len ); - todo_wine ok( buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len ); + ok( buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len ); WindowsDeleteString( serial ); } }
1
0
0
0
Mohamad Al-Jaf : windows.system.profile.systemmanufacturers/tests: Add ISmbiosInformationStatics_get_SerialNumber tests.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: d58a24d9c393907dd0fa34da7d9d1a6ad7b0197e URL:
https://gitlab.winehq.org/wine/wine/-/commit/d58a24d9c393907dd0fa34da7d9d1a…
Author: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> Date: Mon Nov 28 23:20:30 2022 -0500 windows.system.profile.systemmanufacturers/tests: Add ISmbiosInformationStatics_get_SerialNumber tests. --- .../tests/smbios.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c b/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c index e23a4d9adb7..49e90216c42 100644 --- a/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c +++ b/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c @@ -47,8 +47,10 @@ static void test_Smbios_Statics(void) static const WCHAR *smbios_statics_name = L"Windows.System.Profile.SystemManufacturers.SmbiosInformation"; ISmbiosInformationStatics *smbios_statics; IActivationFactory *factory; - HSTRING str; + HSTRING str, serial; + const WCHAR *buf; HRESULT hr; + UINT32 len; LONG ref; hr = WindowsCreateString( smbios_statics_name, wcslen( smbios_statics_name ), &str ); @@ -70,6 +72,18 @@ static void test_Smbios_Statics(void) hr = IActivationFactory_QueryInterface( factory, &IID_ISmbiosInformationStatics, (void **)&smbios_statics ); ok( hr == S_OK, "got hr %#lx.\n", hr ); + if (0) /* Win8 Crash */ + { + hr = ISmbiosInformationStatics_get_SerialNumber( smbios_statics, &serial ); + todo_wine ok( hr == S_OK || broken(hr == E_UNEXPECTED), "got hr %#lx.\n", hr ); + if (hr == S_OK) + { + buf = WindowsGetStringRawBuffer( serial, &len ); + todo_wine ok( buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len ); + WindowsDeleteString( serial ); + } + } + ref = ISmbiosInformationStatics_Release( smbios_statics ); ok( ref == 2, "got ref %ld.\n", ref );
1
0
0
0
Mohamad Al-Jaf : windows.system.profile.systemmanufacturers: Stub ISmbiosInformationStatics interface.
by Alexandre Julliard
27 Jan '23
27 Jan '23
Module: wine Branch: master Commit: 34ff248bf2d471b0f2cf10f246f1037edaebf3b8 URL:
https://gitlab.winehq.org/wine/wine/-/commit/34ff248bf2d471b0f2cf10f246f103…
Author: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> Date: Mon Nov 28 03:15:39 2022 -0500 windows.system.profile.systemmanufacturers: Stub ISmbiosInformationStatics interface. --- .../main.c | 30 +++++++++++++++++ .../private.h | 38 ++++++++++++++++++++++ .../tests/smbios.c | 7 ++++ 3 files changed, 75 insertions(+) diff --git a/dlls/windows.system.profile.systemmanufacturers/main.c b/dlls/windows.system.profile.systemmanufacturers/main.c index 3f5e937392e..35b4529ad7a 100644 --- a/dlls/windows.system.profile.systemmanufacturers/main.c +++ b/dlls/windows.system.profile.systemmanufacturers/main.c @@ -36,6 +36,7 @@ static const char *debugstr_hstring( HSTRING hstr ) struct smbios_statics { IActivationFactory IActivationFactory_iface; + ISmbiosInformationStatics ISmbiosInformationStatics_iface; LONG ref; }; @@ -60,6 +61,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; } + if (IsEqualGUID( iid, &IID_ISmbiosInformationStatics )) + { + *out = &impl->ISmbiosInformationStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -118,9 +126,31 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, }; +DEFINE_IINSPECTABLE( statics, ISmbiosInformationStatics, struct smbios_statics, IActivationFactory_iface ) + +static HRESULT WINAPI statics_get_SerialNumber( ISmbiosInformationStatics *iface, HSTRING *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct ISmbiosInformationStaticsVtbl statics_vtbl = +{ + statics_QueryInterface, + statics_AddRef, + statics_Release, + /* IInspectable methods */ + statics_GetIids, + statics_GetRuntimeClassName, + statics_GetTrustLevel, + /* ISmbiosInformationStatics methods */ + statics_get_SerialNumber, +}; + static struct smbios_statics smbios_statics = { {&factory_vtbl}, + {&statics_vtbl}, 1, }; diff --git a/dlls/windows.system.profile.systemmanufacturers/private.h b/dlls/windows.system.profile.systemmanufacturers/private.h index e3672c3aec5..42c19710dcb 100644 --- a/dlls/windows.system.profile.systemmanufacturers/private.h +++ b/dlls/windows.system.profile.systemmanufacturers/private.h @@ -29,3 +29,41 @@ #define WIDL_using_Windows_System_Profile_SystemManufacturers #include "windows.system.profile.systemmanufacturers.h" + +#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) diff --git a/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c b/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c index fa3308f21ab..e23a4d9adb7 100644 --- a/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c +++ b/dlls/windows.system.profile.systemmanufacturers/tests/smbios.c @@ -45,6 +45,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_Smbios_Statics(void) { static const WCHAR *smbios_statics_name = L"Windows.System.Profile.SystemManufacturers.SmbiosInformation"; + ISmbiosInformationStatics *smbios_statics; IActivationFactory *factory; HSTRING str; HRESULT hr; @@ -66,6 +67,12 @@ static void test_Smbios_Statics(void) check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject ); + hr = IActivationFactory_QueryInterface( factory, &IID_ISmbiosInformationStatics, (void **)&smbios_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = ISmbiosInformationStatics_Release( smbios_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); + ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
47
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
Results per page:
10
25
50
100
200