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
March 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1138 discussions
Start a n
N
ew thread
Rémi Bernon : windows.gaming.input: Check the controller type and create Gamepad instances.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: 5518b29cfa4f68a82be86c2a55c7d066a4a77d9a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5518b29cfa4f68a82be86c2a…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Mar 8 10:55:24 2022 +0100 windows.gaming.input: Check the controller type and create Gamepad instances. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.gaming.input/manager.c | 24 ++++++++++++++++++++++++ dlls/windows.gaming.input/provider.c | 21 +++++++++++++++++++++ dlls/windows.gaming.input/provider.idl | 8 ++++++++ 3 files changed, 53 insertions(+) diff --git a/dlls/windows.gaming.input/manager.c b/dlls/windows.gaming.input/manager.c index 33f2a3c3df9..f5b5654a4c6 100644 --- a/dlls/windows.gaming.input/manager.c +++ b/dlls/windows.gaming.input/manager.c @@ -437,12 +437,27 @@ static HRESULT controller_create( ICustomGameControllerFactory *factory, IGameCo void manager_on_provider_created( IGameControllerProvider *provider ) { + IWineGameControllerProvider *wine_provider; struct list *entry, *next, *list; struct controller *controller; + WineGameControllerType type; HRESULT hr; TRACE( "provider %p\n", provider ); + if (FAILED(IGameControllerProvider_QueryInterface( provider, &IID_IWineGameControllerProvider, + (void **)&wine_provider ))) + { + FIXME( "IWineGameControllerProvider isn't implemented by provider %p\n", provider ); + return; + } + if (FAILED(hr = IWineGameControllerProvider_get_Type( wine_provider, &type ))) + { + WARN( "Failed to get controller type, hr %#lx\n", hr ); + type = WineGameControllerType_Joystick; + } + IWineGameControllerProvider_Release( wine_provider ); + EnterCriticalSection( &manager_cs ); if (list_empty( &controller_list )) list = &controller_list; @@ -451,6 +466,15 @@ void manager_on_provider_created( IGameControllerProvider *provider ) if (SUCCEEDED(controller_create( controller_factory, provider, &controller ))) list_add_tail( &controller_list, &controller->entry ); + switch (type) + { + case WineGameControllerType_Joystick: break; + case WineGameControllerType_Gamepad: + if (SUCCEEDED(controller_create( gamepad_factory, provider, &controller ))) + list_add_tail( &controller_list, &controller->entry ); + break; + } + LIST_FOR_EACH_SAFE( entry, next, list ) { controller = LIST_ENTRY( entry, struct controller, entry ); diff --git a/dlls/windows.gaming.input/provider.c b/dlls/windows.gaming.input/provider.c index 9ab9682f221..b4817b42c46 100644 --- a/dlls/windows.gaming.input/provider.c +++ b/dlls/windows.gaming.input/provider.c @@ -125,6 +125,25 @@ static HRESULT WINAPI wine_provider_GetTrustLevel( IWineGameControllerProvider * return E_NOTIMPL; } +static HRESULT WINAPI wine_provider_get_Type( IWineGameControllerProvider *iface, WineGameControllerType *value ) +{ + struct provider *impl = impl_from_IWineGameControllerProvider( iface ); + DIDEVICEINSTANCEW instance = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + HRESULT hr; + + TRACE( "iface %p, value %p.\n", iface, value ); + + if (FAILED(hr = IDirectInputDevice8_GetDeviceInfo( impl->dinput_device, &instance ))) return hr; + + switch (GET_DIDEVICE_TYPE( instance.dwDevType )) + { + case DI8DEVTYPE_GAMEPAD: *value = WineGameControllerType_Gamepad; break; + default: *value = WineGameControllerType_Joystick; break; + } + + return S_OK; +} + static const struct IWineGameControllerProviderVtbl wine_provider_vtbl = { wine_provider_QueryInterface, @@ -134,6 +153,8 @@ static const struct IWineGameControllerProviderVtbl wine_provider_vtbl = wine_provider_GetIids, wine_provider_GetRuntimeClassName, wine_provider_GetTrustLevel, + /* IWineGameControllerProvider methods */ + wine_provider_get_Type, }; DEFINE_IINSPECTABLE( game_provider, IGameControllerProvider, struct provider, IWineGameControllerProvider_iface ) diff --git a/dlls/windows.gaming.input/provider.idl b/dlls/windows.gaming.input/provider.idl index d6c4f1d16ec..6af700bb12d 100644 --- a/dlls/windows.gaming.input/provider.idl +++ b/dlls/windows.gaming.input/provider.idl @@ -31,9 +31,16 @@ import "windows.gaming.input.idl"; import "windows.gaming.input.custom.idl"; namespace Windows.Gaming.Input.Custom { + typedef enum WineGameControllerType WineGameControllerType; interface IWineGameControllerProvider; runtimeclass WineGameControllerProvider; + enum WineGameControllerType + { + Joystick = 0, + Gamepad = 1, + }; + [ uuid(06e58977-7684-4dc5-bad1-cda52a4aa06d) ] @@ -51,6 +58,7 @@ namespace Windows.Gaming.Input.Custom { interface IWineGameControllerProvider : IInspectable requires Windows.Gaming.Input.Custom.IGameControllerProvider { + [propget] HRESULT Type([out, retval] WineGameControllerType *value); } [
1
0
0
0
Rémi Bernon : windows.gaming.input: Implement IRawGameControllerStatics_FromGameController.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: d45a2a14cd51d1b5fc011eb5a80beb4b68cba76f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d45a2a14cd51d1b5fc011eb5…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Mar 8 10:55:23 2022 +0100 windows.gaming.input: Implement IRawGameControllerStatics_FromGameController. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.gaming.input/controller.c | 16 ++++++++++++++-- dlls/windows.gaming.input/main.c | 7 +++---- dlls/windows.gaming.input/manager.c | 27 ++++++++++++++++++++++++--- dlls/windows.gaming.input/private.h | 2 +- 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c index 27c5d6ebd32..94343c0927d 100644 --- a/dlls/windows.gaming.input/controller.c +++ b/dlls/windows.gaming.input/controller.c @@ -174,8 +174,20 @@ static HRESULT WINAPI statics_get_RawGameControllers( IRawGameControllerStatics static HRESULT WINAPI statics_FromGameController( IRawGameControllerStatics *iface, IGameController *game_controller, IRawGameController **value ) { - FIXME( "iface %p, game_controller %p, value %p stub!\n", iface, game_controller, value ); - return E_NOTIMPL; + struct controller_statics *impl = impl_from_IRawGameControllerStatics( iface ); + IGameController *controller; + HRESULT hr; + + TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value ); + + hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface, + game_controller, &controller ); + if (FAILED(hr)) return hr; + + hr = IGameController_QueryInterface( controller, &IID_IRawGameController, (void **)value ); + IGameController_Release( controller ); + + return hr; } static const struct IRawGameControllerStaticsVtbl statics_vtbl = diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index e71043fcb0f..c5b7f19c987 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -169,7 +169,7 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory ** { static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; const WCHAR *buffer = WindowsGetStringRawBuffer( class_str, NULL ); - HRESULT hr = S_OK; + HRESULT hr = REGDB_E_CLASSNOTREG; TRACE( "class %s, factory %p.\n", debugstr_w(buffer), factory ); @@ -182,10 +182,9 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory ** if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_Gamepad )) hr = ICustomGameControllerFactory_QueryInterface( gamepad_factory, &IID_IActivationFactory, (void **)factory ); if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_Custom_GameControllerFactoryManager )) - IActivationFactory_AddRef( (*factory = manager_factory) ); + hr = IGameControllerFactoryManagerStatics2_QueryInterface( manager_factory, &IID_IActivationFactory, (void **)factory ); - if (SUCCEEDED(hr) && *factory) return S_OK; - return REGDB_E_CLASSNOTREG; + return hr; } BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) diff --git a/dlls/windows.gaming.input/manager.c b/dlls/windows.gaming.input/manager.c index 15388f7df5d..33f2a3c3df9 100644 --- a/dlls/windows.gaming.input/manager.c +++ b/dlls/windows.gaming.input/manager.c @@ -370,8 +370,29 @@ statics2_TryGetFactoryControllerFromGameController( IGameControllerFactoryManage ICustomGameControllerFactory *factory, IGameController *controller, IGameController **value ) { - FIXME( "iface %p, factory %p, controller %p, value %p stub!\n", iface, factory, controller, value ); - return E_NOTIMPL; + struct controller *entry, *other; + BOOL found = FALSE; + + TRACE( "iface %p, factory %p, controller %p, value %p.\n", iface, factory, controller, value ); + + EnterCriticalSection( &manager_cs ); + + LIST_FOR_EACH_ENTRY( entry, &controller_list, struct controller, entry ) + if ((found = &entry->IGameController_iface == controller)) break; + + if (!found) WARN( "Failed to find controller %p\n", controller ); + else + { + LIST_FOR_EACH_ENTRY( other, &controller_list, struct controller, entry ) + if ((found = entry->provider == other->provider && other->factory == factory)) break; + if (!found) WARN( "Failed to find controller %p, factory %p\n", controller, factory ); + else IGameController_AddRef( (*value = &other->IGameController_iface) ); + } + + LeaveCriticalSection( &manager_cs ); + + if (!found) return E_FAIL; + return S_OK; } static const struct IGameControllerFactoryManagerStatics2Vtbl statics2_vtbl = @@ -395,7 +416,7 @@ static struct manager_statics manager_statics = 1, }; -IActivationFactory *manager_factory = &manager_statics.IActivationFactory_iface; +IGameControllerFactoryManagerStatics2 *manager_factory = &manager_statics.IGameControllerFactoryManagerStatics2_iface; static HRESULT controller_create( ICustomGameControllerFactory *factory, IGameControllerProvider *provider, struct controller **out ) diff --git a/dlls/windows.gaming.input/private.h b/dlls/windows.gaming.input/private.h index 27dbdb8416c..56d03abad44 100644 --- a/dlls/windows.gaming.input/private.h +++ b/dlls/windows.gaming.input/private.h @@ -39,7 +39,7 @@ extern HINSTANCE windows_gaming_input; extern ICustomGameControllerFactory *controller_factory; extern ICustomGameControllerFactory *gamepad_factory; -extern IActivationFactory *manager_factory; +extern IGameControllerFactoryManagerStatics2 *manager_factory; extern HRESULT vector_create( REFIID iid, REFIID view_iid, void **out );
1
0
0
0
Rémi Bernon : windows.gaming.input: Instantiate IGameController(BatteryInfo) stub from providers.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: 09cb88e91b746aca447cf359624de67575ffcdc7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=09cb88e91b746aca447cf359…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Mar 8 10:55:22 2022 +0100 windows.gaming.input: Instantiate IGameController(BatteryInfo) stub from providers. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.gaming.input/manager.c | 265 +++++++++++++++++++++++++++++++++++- dlls/windows.gaming.input/private.h | 1 + 2 files changed, 264 insertions(+), 2 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=09cb88e91b746aca447c…
1
0
0
0
Dmitry Timoshkov : dllhost: Implement ISurrogate::LoadDllServer().
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: f23f3d2f44a5dec911fff87fcde36604c098fb49 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f23f3d2f44a5dec911fff87f…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Feb 24 11:50:40 2022 +0300 dllhost: Implement ISurrogate::LoadDllServer(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/dllhost/dllhost.c | 200 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 198 insertions(+), 2 deletions(-) diff --git a/programs/dllhost/dllhost.c b/programs/dllhost/dllhost.c index a0d3b9937f1..691f233906a 100644 --- a/programs/dllhost/dllhost.c +++ b/programs/dllhost/dllhost.c @@ -28,9 +28,182 @@ WINE_DEFAULT_DEBUG_CHANNEL(dllhost); +struct factory +{ + IClassFactory IClassFactory_iface; + IMarshal IMarshal_iface; + CLSID clsid; + LONG ref; +}; + +static inline struct factory *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, struct factory, IClassFactory_iface); +} + +static inline struct factory *impl_from_IMarshal(IMarshal *iface) +{ + return CONTAINING_RECORD(iface, struct factory, IMarshal_iface); +} + +static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, + REFIID iid, void **ppv) +{ + struct factory *factory = impl_from_IClassFactory(iface); + + TRACE("(%p,%s,%p)\n", iface, wine_dbgstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(iid, &IID_IUnknown) || + IsEqualIID(iid, &IID_IClassFactory)) + { + IClassFactory_AddRef(&factory->IClassFactory_iface); + *ppv = &factory->IClassFactory_iface; + return S_OK; + } + else if (IsEqualIID(iid, &IID_IMarshal)) + { + IClassFactory_AddRef(&factory->IClassFactory_iface); + *ppv = &factory->IMarshal_iface; + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef(IClassFactory *iface) +{ + struct factory *factory = impl_from_IClassFactory(iface); + ULONG ref = InterlockedIncrement(&factory->ref); + + TRACE("(%p)->%lu\n", iface, ref); + return ref; +} + +static ULONG WINAPI factory_Release(IClassFactory *iface) +{ + struct factory *factory = impl_from_IClassFactory(iface); + ULONG ref = InterlockedDecrement(&factory->ref); + + TRACE("(%p)->%lu\n", iface, ref); + + if (!ref) + HeapFree(GetProcessHeap(), 0, factory); + + return ref; +} + +static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, + IUnknown *punkouter, REFIID iid, void **ppv) +{ + FIXME("(%p,%p,%s,%p): stub\n", iface, punkouter, wine_dbgstr_guid(iid), ppv); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock) +{ + TRACE("(%p,%d)\n", iface, lock); + return S_OK; +} + +static const IClassFactoryVtbl ClassFactory_Vtbl = +{ + factory_QueryInterface, + factory_AddRef, + factory_Release, + factory_CreateInstance, + factory_LockServer +}; + +static HRESULT WINAPI marshal_QueryInterface(IMarshal *iface, REFIID iid, LPVOID *ppv) +{ + struct factory *factory = impl_from_IMarshal(iface); + + TRACE("(%p,%s,%p)\n", iface, wine_dbgstr_guid(iid), ppv); + + return IClassFactory_QueryInterface(&factory->IClassFactory_iface, iid, ppv); +} + +static ULONG WINAPI marshal_AddRef(IMarshal *iface) +{ + struct factory *factory = impl_from_IMarshal(iface); + + TRACE("(%p)\n", iface); + + return IClassFactory_AddRef(&factory->IClassFactory_iface); +} + +static ULONG WINAPI marshal_Release(IMarshal *iface) +{ + struct factory *factory = impl_from_IMarshal(iface); + + TRACE("(%p)\n", iface); + + return IClassFactory_Release(&factory->IClassFactory_iface); +} + +static HRESULT WINAPI marshal_GetUnmarshalClass(IMarshal *iface, REFIID iid, void *pv, + DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *clsid) +{ + FIXME("(%p,%s,%p,%08lx,%p,%08lx,%p): stub\n", iface, wine_dbgstr_guid(iid), pv, + dwDestContext, pvDestContext, mshlflags, clsid); + return E_NOTIMPL; +} + +static HRESULT WINAPI marshal_GetMarshalSizeMax(IMarshal *iface, REFIID iid, void *pv, + DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *size) +{ + FIXME("(%p,%s,%p,%08lx,%p,%08lx,%p): stub\n", iface, wine_dbgstr_guid(iid), pv, + dwDestContext, pvDestContext, mshlflags, size); + return E_NOTIMPL; +} + +static HRESULT WINAPI marshal_MarshalInterface(IMarshal *iface, IStream *stream, REFIID iid, + void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags) +{ + FIXME("(%p,%s,%p,%08lx,%p,%08lx): stub\n", stream, wine_dbgstr_guid(iid), pv, dwDestContext, pvDestContext, mshlflags); + return E_NOTIMPL; +} + +static HRESULT WINAPI marshal_UnmarshalInterface(IMarshal *iface, IStream *stream, + REFIID iid, void **ppv) +{ + FIXME("(%p,%p,%s,%p): stub\n", iface, stream, wine_dbgstr_guid(iid), ppv); + return E_NOTIMPL; +} + +static HRESULT WINAPI marshal_ReleaseMarshalData(IMarshal *iface, IStream *stream) +{ + TRACE("(%p,%p)\n", iface, stream); + return S_OK; +} + +static HRESULT WINAPI marshal_DisconnectObject(IMarshal *iface, DWORD reserved) +{ + TRACE("(%p, %08lx)\n", iface, reserved); + return S_OK; +} + +static const IMarshalVtbl Marshal_Vtbl = +{ + marshal_QueryInterface, + marshal_AddRef, + marshal_Release, + marshal_GetUnmarshalClass, + marshal_GetMarshalSizeMax, + marshal_MarshalInterface, + marshal_UnmarshalInterface, + marshal_ReleaseMarshalData, + marshal_DisconnectObject +}; + struct surrogate { ISurrogate ISurrogate_iface; + IClassFactory *factory; + DWORD cookie; LONG ref; }; @@ -74,8 +247,29 @@ static ULONG WINAPI surrogate_Release(ISurrogate *iface) static HRESULT WINAPI surrogate_LoadDllServer(ISurrogate *iface, const CLSID *clsid) { - FIXME("(%p,%s): stub\n", iface, wine_dbgstr_guid(clsid)); - return E_NOTIMPL; + struct surrogate *surrogate = impl_from_ISurrogate(iface); + struct factory *factory; + HRESULT hr; + + TRACE("(%p,%s)\n", iface, wine_dbgstr_guid(clsid)); + + factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory)); + if (!factory) + return E_OUTOFMEMORY; + + factory->IClassFactory_iface.lpVtbl = &ClassFactory_Vtbl; + factory->IMarshal_iface.lpVtbl = &Marshal_Vtbl; + factory->clsid = *clsid; + factory->ref = 1; + + hr = CoRegisterClassObject(clsid, (IUnknown *)&factory->IClassFactory_iface, + CLSCTX_LOCAL_SERVER, REGCLS_SURROGATE, &surrogate->cookie); + if (hr != S_OK) + IClassFactory_Release(&factory->IClassFactory_iface); + else + surrogate->factory = &factory->IClassFactory_iface; + + return hr; } static HRESULT WINAPI surrogate_FreeSurrogate(ISurrogate *iface) @@ -105,6 +299,8 @@ int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int sho cmdline += 11; surrogate.ISurrogate_iface.lpVtbl = &Surrogate_Vtbl; + surrogate.factory = NULL; + surrogate.cookie = 0; surrogate.ref = 1; CoInitializeEx(NULL, COINIT_MULTITHREADED);
1
0
0
0
Dmitry Timoshkov : dllhost: Add ISurrogate stub implementation.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: 6b7686946b07caf55e3d38548394a1072559ae3a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6b7686946b07caf55e3d3854…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Feb 24 11:50:37 2022 +0300 dllhost: Add ISurrogate stub implementation. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/dllhost/Makefile.in | 2 +- programs/dllhost/dllhost.c | 84 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/programs/dllhost/Makefile.in b/programs/dllhost/Makefile.in index a92add9c2f0..bca6c208cdc 100644 --- a/programs/dllhost/Makefile.in +++ b/programs/dllhost/Makefile.in @@ -1,5 +1,5 @@ MODULE = dllhost.exe -IMPORTS = ole32 +IMPORTS = ole32 uuid EXTRADLLFLAGS = -mwindows -municode diff --git a/programs/dllhost/dllhost.c b/programs/dllhost/dllhost.c index 39d2194db4b..a0d3b9937f1 100644 --- a/programs/dllhost/dllhost.c +++ b/programs/dllhost/dllhost.c @@ -18,6 +18,8 @@ #include <stdarg.h> +#define COBJMACROS + #include <windef.h> #include <winbase.h> #include <objbase.h> @@ -26,24 +28,104 @@ WINE_DEFAULT_DEBUG_CHANNEL(dllhost); +struct surrogate +{ + ISurrogate ISurrogate_iface; + LONG ref; +}; + +static inline struct surrogate *impl_from_ISurrogate(ISurrogate *iface) +{ + return CONTAINING_RECORD(iface, struct surrogate, ISurrogate_iface); +} + +static HRESULT WINAPI surrogate_QueryInterface(ISurrogate *iface, + REFIID iid, void **ppv) +{ + struct surrogate *surrogate = impl_from_ISurrogate(iface); + + TRACE("(%p,%s,%p)\n", iface, wine_dbgstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(iid, &IID_IUnknown) || + IsEqualIID(iid, &IID_ISurrogate)) + { + ISurrogate_AddRef(&surrogate->ISurrogate_iface); + *ppv = &surrogate->ISurrogate_iface; + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI surrogate_AddRef(ISurrogate *iface) +{ + TRACE("(%p)\n", iface); + return 2; +} + +static ULONG WINAPI surrogate_Release(ISurrogate *iface) +{ + TRACE("(%p)\n", iface); + return 1; +} + +static HRESULT WINAPI surrogate_LoadDllServer(ISurrogate *iface, const CLSID *clsid) +{ + FIXME("(%p,%s): stub\n", iface, wine_dbgstr_guid(clsid)); + return E_NOTIMPL; +} + +static HRESULT WINAPI surrogate_FreeSurrogate(ISurrogate *iface) +{ + FIXME("(%p): stub\n", iface); + return E_NOTIMPL; +} + +static const ISurrogateVtbl Surrogate_Vtbl = +{ + surrogate_QueryInterface, + surrogate_AddRef, + surrogate_Release, + surrogate_LoadDllServer, + surrogate_FreeSurrogate +}; + int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int showcmd) { HRESULT hr; CLSID clsid; + struct surrogate surrogate; if (wcsnicmp(cmdline, L"/PROCESSID:", 11)) return 0; cmdline += 11; + surrogate.ISurrogate_iface.lpVtbl = &Surrogate_Vtbl; + surrogate.ref = 1; + CoInitializeEx(NULL, COINIT_MULTITHREADED); hr = CLSIDFromString(cmdline, &clsid); if (hr == S_OK) { - FIXME("hosting object %s is not implemented\n", wine_dbgstr_guid(&clsid)); + CoRegisterSurrogate(&surrogate.ISurrogate_iface); + + hr = ISurrogate_LoadDllServer(&surrogate.ISurrogate_iface, &clsid); + if (hr != S_OK) + { + ERR("Can't create instance of %s\n", wine_dbgstr_guid(&clsid)); + goto cleanup; + } + + /* FIXME: wait for FreeSurrogate being called */ + Sleep(INFINITE); } +cleanup: CoUninitialize(); return 0;
1
0
0
0
Dmitry Timoshkov : dllhost: Add stub implementation.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: 36ac0c1cfbd298bb8d82a465c00adacdb387599c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=36ac0c1cfbd298bb8d82a465…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Feb 24 11:50:34 2022 +0300 dllhost: Add stub implementation. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 2 ++ configure.ac | 1 + programs/dllhost/Makefile.in | 7 +++++++ programs/dllhost/dllhost.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/configure b/configure index ad2ef2e7b8d..305f71e18d8 100755 --- a/configure +++ b/configure @@ -1556,6 +1556,7 @@ enable_conhost enable_control enable_cscript enable_dism +enable_dllhost enable_dplaysvr enable_dpnsvr enable_dpvsetup @@ -21984,6 +21985,7 @@ wine_fn_config_makefile programs/conhost/tests enable_tests wine_fn_config_makefile programs/control enable_control wine_fn_config_makefile programs/cscript enable_cscript wine_fn_config_makefile programs/dism enable_dism +wine_fn_config_makefile programs/dllhost enable_dllhost wine_fn_config_makefile programs/dplaysvr enable_dplaysvr wine_fn_config_makefile programs/dpnsvr enable_dpnsvr wine_fn_config_makefile programs/dpvsetup enable_dpvsetup diff --git a/configure.ac b/configure.ac index 4245f7efb0f..5a85fce12a4 100644 --- a/configure.ac +++ b/configure.ac @@ -3251,6 +3251,7 @@ WINE_CONFIG_MAKEFILE(programs/conhost/tests) WINE_CONFIG_MAKEFILE(programs/control) WINE_CONFIG_MAKEFILE(programs/cscript) WINE_CONFIG_MAKEFILE(programs/dism) +WINE_CONFIG_MAKEFILE(programs/dllhost) WINE_CONFIG_MAKEFILE(programs/dplaysvr) WINE_CONFIG_MAKEFILE(programs/dpnsvr) WINE_CONFIG_MAKEFILE(programs/dpvsetup) diff --git a/programs/dllhost/Makefile.in b/programs/dllhost/Makefile.in new file mode 100644 index 00000000000..a92add9c2f0 --- /dev/null +++ b/programs/dllhost/Makefile.in @@ -0,0 +1,7 @@ +MODULE = dllhost.exe +IMPORTS = ole32 + +EXTRADLLFLAGS = -mwindows -municode + +C_SRCS = \ + dllhost.c diff --git a/programs/dllhost/dllhost.c b/programs/dllhost/dllhost.c new file mode 100644 index 00000000000..39d2194db4b --- /dev/null +++ b/programs/dllhost/dllhost.c @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Dmitry Timoshkov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include <windef.h> +#include <winbase.h> +#include <objbase.h> + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dllhost); + +int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int showcmd) +{ + HRESULT hr; + CLSID clsid; + + if (wcsnicmp(cmdline, L"/PROCESSID:", 11)) + return 0; + + cmdline += 11; + + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + hr = CLSIDFromString(cmdline, &clsid); + if (hr == S_OK) + { + FIXME("hosting object %s is not implemented\n", wine_dbgstr_guid(&clsid)); + } + + CoUninitialize(); + + return 0; +}
1
0
0
0
Huw Davies : maintainers: Add dllhost.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: 1d1253ba55338a33a4bf99b1b755a250675311d5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1d1253ba55338a33a4bf99b1…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Mar 8 15:41:49 2022 +0000 maintainers: Add dllhost. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index a90c91b60b7..9ceae9e80bf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -233,6 +233,7 @@ F: dlls/combase/ F: dlls/ole32/compobj.c F: dlls/ole32/marshal.c F: dlls/ole32/usrmarshal.c +F: programs/dllhost/ OLE Storage M: Esme Povirk <esme(a)codeweavers.com>
1
0
0
0
Jacek Caban : win32u: Move is_window_drawable implementation from user32.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: 9daec6fd94b1b750779f385417fe64649b0c39fc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9daec6fd94b1b750779f3854…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Mar 8 14:24:28 2022 +0100 win32u: Move is_window_drawable implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/win.c | 90 ++-------------------------------------------------- dlls/win32u/window.c | 32 +++++++++++++++++++ include/ntuser.h | 2 ++ 3 files changed, 36 insertions(+), 88 deletions(-) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index a22b80da6a9..a5d1a640335 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -287,76 +287,6 @@ static HWND *list_window_children( HDESK desktop, HWND hwnd, UNICODE_STRING *cla } -/******************************************************************* - * list_window_parents - * - * Build an array of all parents of a given window, starting with - * the immediate parent. The array must be freed with HeapFree. - */ -static HWND *list_window_parents( HWND hwnd ) -{ - WND *win; - HWND current, *list; - int i, pos = 0, size = 16, count; - - if (!(list = HeapAlloc( GetProcessHeap(), 0, size * sizeof(HWND) ))) return NULL; - - current = hwnd; - for (;;) - { - if (!(win = WIN_GetPtr( current ))) goto empty; - if (win == WND_OTHER_PROCESS) break; /* need to do it the hard way */ - if (win == WND_DESKTOP) - { - if (!pos) goto empty; - list[pos] = 0; - return list; - } - list[pos] = current = win->parent; - WIN_ReleasePtr( win ); - if (!current) return list; - if (++pos == size - 1) - { - /* need to grow the list */ - HWND *new_list = HeapReAlloc( GetProcessHeap(), 0, list, (size+16) * sizeof(HWND) ); - if (!new_list) goto empty; - list = new_list; - size += 16; - } - } - - /* at least one parent belongs to another process, have to query the server */ - - for (;;) - { - count = 0; - SERVER_START_REQ( get_window_parents ) - { - req->handle = wine_server_user_handle( hwnd ); - wine_server_set_reply( req, list, (size-1) * sizeof(user_handle_t) ); - if (!wine_server_call( req )) count = reply->count; - } - SERVER_END_REQ; - if (!count) goto empty; - if (size > count) - { - /* start from the end since HWND is potentially larger than user_handle_t */ - for (i = count - 1; i >= 0; i--) - list[i] = wine_server_ptr_handle( ((user_handle_t *)list)[i] ); - list[count] = 0; - return list; - } - HeapFree( GetProcessHeap(), 0, list ); - size = count + 1; - if (!(list = HeapAlloc( GetProcessHeap(), 0, size * sizeof(HWND) ))) return NULL; - } - - empty: - HeapFree( GetProcessHeap(), 0, list ); - return NULL; -} - - /******************************************************************* * send_parent_notify */ @@ -3029,24 +2959,8 @@ BOOL WINAPI IsWindowVisible( HWND hwnd ) */ BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL icon ) { - HWND *list; - BOOL retval = TRUE; - int i; - LONG style = GetWindowLongW( hwnd, GWL_STYLE ); - - if (!(style & WS_VISIBLE)) return FALSE; - if ((style & WS_MINIMIZE) && icon && GetClassLongPtrW( hwnd, GCLP_HICON )) return FALSE; - - if (!(list = list_window_parents( hwnd ))) return TRUE; - if (list[0]) - { - for (i = 0; list[i+1]; i++) - if ((GetWindowLongW( list[i], GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != WS_VISIBLE) - break; - retval = !list[i+1] && (list[i] == GetDesktopWindow()); /* top message window isn't visible */ - } - HeapFree( GetProcessHeap(), 0, list ); - return retval; + /* FIXME: move callers to win32u */ + return NtUserCallHwndParam( hwnd, icon, NtUserIsWindowDrawable ); } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index e13107d1d64..7b5a6b3da03 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -625,6 +625,35 @@ static BOOL is_window_visible( HWND hwnd ) return retval; } +/*********************************************************************** + * is_window_drawable + * + * hwnd is drawable when it is visible, all parents are not + * minimized, and it is itself not minimized unless we are + * trying to draw its default class icon. + */ +static BOOL is_window_drawable( HWND hwnd, BOOL icon ) +{ + HWND *list; + BOOL retval = TRUE; + int i; + LONG style = get_window_long( hwnd, GWL_STYLE ); + + if (!(style & WS_VISIBLE)) return FALSE; + if ((style & WS_MINIMIZE) && icon && get_class_long_ptr( hwnd, GCLP_HICON, FALSE )) return FALSE; + + if (!(list = list_window_parents( hwnd ))) return TRUE; + if (list[0]) + { + for (i = 0; list[i+1]; i++) + if ((get_window_long( list[i], GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != WS_VISIBLE) + break; + retval = !list[i+1] && (list[i] == user_callbacks->pGetDesktopWindow()); /* top message window isn't visible */ + } + free( list ); + return retval; +} + static LONG_PTR get_win_data( const void *ptr, UINT size ) { if (size == sizeof(WORD)) @@ -1015,6 +1044,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return get_window_word( hwnd, param ); case NtUserIsChild: return is_child( hwnd, UlongToHandle(param) ); + /* temporary exports */ + case NtUserIsWindowDrawable: + return is_window_drawable( hwnd, param ); default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index 20fa61bacec..3fca830d5b2 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -161,6 +161,8 @@ enum NtUserGetWindowThread, NtUserGetWindowWord, NtUserIsChild, + /* temporary exports */ + NtUserIsWindowDrawable, }; /* color index used to retrieve system 55aa brush */
1
0
0
0
Jacek Caban : win32u: Move IsWindowVisible implementation from user32.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: a36fcc827acb1c2934dcf03ff76be99353325c93 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a36fcc827acb1c2934dcf03f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Mar 8 14:24:20 2022 +0100 win32u: Move IsWindowVisible implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/win.c | 15 +-------------- dlls/win32u/window.c | 21 +++++++++++++++++++++ include/ntuser.h | 1 + 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 58c581c26da..a22b80da6a9 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -3016,20 +3016,7 @@ BOOL WINAPI IsChild( HWND parent, HWND child ) */ BOOL WINAPI IsWindowVisible( HWND hwnd ) { - HWND *list; - BOOL retval = TRUE; - int i; - - if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE; - if (!(list = list_window_parents( hwnd ))) return TRUE; - if (list[0]) - { - for (i = 0; list[i+1]; i++) - if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE)) break; - retval = !list[i+1] && (list[i] == GetDesktopWindow()); /* top message window isn't visible */ - } - HeapFree( GetProcessHeap(), 0, list ); - return retval; + return NtUserCallHwnd( hwnd, NtUserIsWindowVisible ); } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 3c65d3ec1ce..e13107d1d64 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -606,6 +606,25 @@ BOOL is_child( HWND parent, HWND child ) return ret; } +/* see IsWindowVisible */ +static BOOL is_window_visible( HWND hwnd ) +{ + HWND *list; + BOOL retval = TRUE; + int i; + + if (!(get_window_long( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE; + if (!(list = list_window_parents( hwnd ))) return TRUE; + if (list[0]) + { + for (i = 0; list[i+1]; i++) + if (!(get_window_long( list[i], GWL_STYLE ) & WS_VISIBLE)) break; + retval = !list[i+1] && (list[i] == user_callbacks->pGetDesktopWindow()); /* top message window isn't visible */ + } + free( list ); + return retval; +} + static LONG_PTR get_win_data( const void *ptr, UINT size ) { if (size == sizeof(WORD)) @@ -955,6 +974,8 @@ DWORD WINAPI NtUserCallHwnd( HWND hwnd, DWORD code ) return get_server_window_text( hwnd, NULL, 0 ); case NtUserIsWindow: return is_window( hwnd ); + case NtUserIsWindowVisible: + return is_window_visible( hwnd ); default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index 8d724971d53..20fa61bacec 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -142,6 +142,7 @@ enum NtUserGetParent, NtUserGetWindowTextLength, NtUserIsWindow, + NtUserIsWindowVisible, }; /* NtUserCallHwndParam codes, not compatible with Windows */
1
0
0
0
Jacek Caban : win32u: Move IsChild implementation from user32.
by Alexandre Julliard
08 Mar '22
08 Mar '22
Module: wine Branch: master Commit: be1f46bba453162dfff28cd1cb51183044210909 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=be1f46bba453162dfff28cd1…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Mar 8 14:24:15 2022 +0100 win32u: Move IsChild implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/user_main.c | 1 - dlls/user32/win.c | 19 +------------------ dlls/win32u/ntuser_private.h | 2 +- dlls/win32u/palette.c | 2 +- dlls/win32u/window.c | 25 +++++++++++++++++++++++++ include/ntuser.h | 1 + 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 3afda0d528d..f9fce07ddab 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -138,7 +138,6 @@ static const struct user_callbacks user_funcs = CopyImage, GetDesktopWindow, GetWindowRect, - IsChild, RedrawWindow, SendMessageTimeoutW, WindowFromDC, diff --git a/dlls/user32/win.c b/dlls/user32/win.c index fe8d929a102..58c581c26da 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -3007,24 +3007,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent ) */ BOOL WINAPI IsChild( HWND parent, HWND child ) { - HWND *list; - int i; - BOOL ret = FALSE; - - if (!(GetWindowLongW( child, GWL_STYLE ) & WS_CHILD)) return FALSE; - if (!(list = list_window_parents( child ))) return FALSE; - parent = WIN_GetFullHandle( parent ); - for (i = 0; list[i]; i++) - { - if (list[i] == parent) - { - ret = list[i] && list[i+1]; - break; - } - if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_CHILD)) break; - } - HeapFree( GetProcessHeap(), 0, list ); - return ret; + return NtUserCallHwndParam( parent, HandleToUlong(child), NtUserIsChild ); } diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 5f3cf41c1a2..4c05d070a0a 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -32,7 +32,6 @@ struct user_callbacks HANDLE (WINAPI *pCopyImage)( HANDLE, UINT, INT, INT, UINT ); HWND (WINAPI *pGetDesktopWindow)(void); BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect ); - BOOL (WINAPI *pIsChild)( HWND, HWND ); BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT ); LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR ); HWND (WINAPI *pWindowFromDC)( HDC ); @@ -232,6 +231,7 @@ void *get_user_handle_ptr( HANDLE handle, unsigned int type ) DECLSPEC_HIDDEN; void release_user_handle_ptr( void *ptr ) DECLSPEC_HIDDEN; WND *get_win_ptr( HWND hwnd ) DECLSPEC_HIDDEN; +BOOL is_child( HWND parent, HWND child ); BOOL is_window( HWND hwnd ) DECLSPEC_HIDDEN; #endif /* __WINE_NTUSER_PRIVATE_H */ diff --git a/dlls/win32u/palette.c b/dlls/win32u/palette.c index d09fc9d4d73..367bfea21b4 100644 --- a/dlls/win32u/palette.c +++ b/dlls/win32u/palette.c @@ -521,7 +521,7 @@ HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg ) { /* set primary palette if it's related to current active */ HWND foreground = NtUserGetForegroundWindow(); - is_primary = foreground == hwnd || user_callbacks->pIsChild( foreground, hwnd ); + is_primary = foreground == hwnd || is_child( foreground, hwnd ); } } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index f7f0d4e6a65..3c65d3ec1ce 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -583,6 +583,29 @@ HWND WINAPI NtUserGetAncestor( HWND hwnd, UINT type ) return ret; } +/* see IsChild */ +BOOL is_child( HWND parent, HWND child ) +{ + HWND *list; + int i; + BOOL ret = FALSE; + + if (!(get_window_long( child, GWL_STYLE ) & WS_CHILD)) return FALSE; + if (!(list = list_window_parents( child ))) return FALSE; + parent = get_full_window_handle( parent ); + for (i = 0; list[i]; i++) + { + if (list[i] == parent) + { + ret = list[i] && list[i+1]; + break; + } + if (!(get_window_long( list[i], GWL_STYLE ) & WS_CHILD)) break; + } + free( list ); + return ret; +} + static LONG_PTR get_win_data( const void *ptr, UINT size ) { if (size == sizeof(WORD)) @@ -969,6 +992,8 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return get_window_thread( hwnd, (DWORD *)param ); case NtUserGetWindowWord: return get_window_word( hwnd, param ); + case NtUserIsChild: + return is_child( hwnd, UlongToHandle(param) ); default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index d62a4ed4459..8d724971d53 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -159,6 +159,7 @@ enum NtUserGetWindowRelative, NtUserGetWindowThread, NtUserGetWindowWord, + NtUserIsChild, }; /* color index used to retrieve system 55aa brush */
1
0
0
0
← Newer
1
...
76
77
78
79
80
81
82
...
114
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Results per page:
10
25
50
100
200