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
September 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1030 discussions
Start a n
N
ew thread
Nikolay Sivov : ole32: Simplify CommonPrefixWith() for class moniker.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: e2f8a3e4ed6dcbcca3471ebcc6a0acfe90b7f815 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e2f8a3e4ed6dcbcca3471ebc…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Sep 14 11:47:53 2021 +0300 ole32: Simplify CommonPrefixWith() for class moniker. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/classmoniker.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index c52aaa9fbcf..1aa008270a1 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -452,39 +452,27 @@ static HRESULT WINAPI ClassMoniker_Inverse(IMoniker* iface,IMoniker** ppmk) return CreateAntiMoniker(ppmk); } -/****************************************************************************** - * ClassMoniker_CommonPrefixWith - ******************************************************************************/ -static HRESULT WINAPI ClassMoniker_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix) +static HRESULT WINAPI ClassMoniker_CommonPrefixWith(IMoniker *iface, IMoniker *other, IMoniker **prefix) { - DWORD mkSys; - - TRACE("(%p, %p)\n", pmkOther, ppmkPrefix); + ClassMoniker *moniker = impl_from_IMoniker(iface), *other_moniker; - *ppmkPrefix = NULL; + TRACE("%p, %p, %p\n", iface, other, prefix); - IMoniker_IsSystemMoniker(pmkOther, &mkSys); + *prefix = NULL; - /* If the other moniker is an class moniker that is equal to this moniker, this method sets *ppmkPrefix */ - /* to this moniker and returns MK_S_US */ + other_moniker = unsafe_impl_from_IMoniker(other); - if (mkSys == MKSYS_CLASSMONIKER) + if (other_moniker) { - if (IMoniker_IsEqual(iface, pmkOther) == S_OK) - { - *ppmkPrefix = iface; + if (!IsEqualGUID(&moniker->clsid, &other_moniker->clsid)) return MK_E_NOPREFIX; - IMoniker_AddRef(iface); + *prefix = iface; + IMoniker_AddRef(iface); - return MK_S_US; - } - else - return MK_E_NOPREFIX; + return MK_S_US; } - else - /* otherwise, the method calls the MonikerCommonPrefixWith function. This function correctly handles */ - /* the case where the other moniker is a generic composite. */ - return MonikerCommonPrefixWith(iface, pmkOther, ppmkPrefix); + + return MonikerCommonPrefixWith(iface, other, prefix); } /******************************************************************************
1
0
0
0
Nikolay Sivov : ole32: Simplify CreateClassMoniker().
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: 5e1a8ada72c55d5b4243ad16b843edc4730ad8e0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5e1a8ada72c55d5b4243ad16…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Sep 14 11:47:52 2021 +0300 ole32: Simplify CreateClassMoniker(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/classmoniker.c | 44 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index 5f303be037c..c52aaa9fbcf 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -656,48 +656,26 @@ static const IROTDataVtbl ROTDataVtbl = ClassMonikerROTData_GetComparisonData }; -/****************************************************************************** - * ClassMoniker_Construct (local function) - *******************************************************************************/ -static HRESULT ClassMoniker_Construct(ClassMoniker* This, REFCLSID rclsid) -{ - TRACE("(%p,%s)\n",This,debugstr_guid(rclsid)); - - /* Initialize the virtual function table. */ - This->IMoniker_iface.lpVtbl = &ClassMonikerVtbl; - This->IROTData_iface.lpVtbl = &ROTDataVtbl; - This->ref = 0; - This->clsid = *rclsid; - This->pMarshal = NULL; - - return S_OK; -} - /****************************************************************************** * CreateClassMoniker [OLE32.@] ******************************************************************************/ -HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **ppmk) +HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **moniker) { - ClassMoniker* newClassMoniker; - HRESULT hr; + ClassMoniker *object; - TRACE("(%s,%p)\n", debugstr_guid(rclsid), ppmk); + TRACE("%s, %p\n", debugstr_guid(rclsid), moniker); - newClassMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(ClassMoniker)); + if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) + return E_OUTOFMEMORY; - if (!newClassMoniker) - return STG_E_INSUFFICIENTMEMORY; + object->IMoniker_iface.lpVtbl = &ClassMonikerVtbl; + object->IROTData_iface.lpVtbl = &ROTDataVtbl; + object->ref = 1; + object->clsid = *rclsid; - hr = ClassMoniker_Construct(newClassMoniker, rclsid); + *moniker = &object->IMoniker_iface; - if (FAILED(hr)) - { - HeapFree(GetProcessHeap(), 0, newClassMoniker); - return hr; - } - - return ClassMoniker_QueryInterface(&newClassMoniker->IMoniker_iface, &IID_IMoniker, - (void**)ppmk); + return S_OK; } HRESULT ClassMoniker_CreateFromDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten,
1
0
0
0
Nikolay Sivov : ole32: Simplify IsEqual() for class moniker.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: 39070fd4f67169ce49ba002f8699b4d459337952 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=39070fd4f67169ce49ba002f…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Sep 14 11:47:51 2021 +0300 ole32: Simplify IsEqual() for class moniker. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/classmoniker.c | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index 8149b8e2edc..5f303be037c 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -57,6 +57,15 @@ static inline ClassMoniker *impl_from_IROTData(IROTData *iface) return CONTAINING_RECORD(iface, ClassMoniker, IROTData_iface); } +static const IMonikerVtbl ClassMonikerVtbl; + +static ClassMoniker *unsafe_impl_from_IMoniker(IMoniker *iface) +{ + if (iface->lpVtbl != &ClassMonikerVtbl) + return NULL; + return CONTAINING_RECORD(iface, ClassMoniker, IMoniker_iface); +} + /******************************************************************************* * ClassMoniker_QueryInterface *******************************************************************************/ @@ -373,37 +382,20 @@ static HRESULT WINAPI ClassMoniker_Enum(IMoniker* iface,BOOL fForward, IEnumMoni return S_OK; } -/****************************************************************************** - * ClassMoniker_IsEqual - ******************************************************************************/ -static HRESULT WINAPI ClassMoniker_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker) +static HRESULT WINAPI ClassMoniker_IsEqual(IMoniker *iface, IMoniker *other) { + ClassMoniker *moniker = impl_from_IMoniker(iface), *other_moniker; - CLSID clsid; - LPOLESTR dispName1,dispName2; - IBindCtx* bind; - HRESULT res = S_FALSE; - - TRACE("(%p,%p)\n",iface,pmkOtherMoniker); - - if (!pmkOtherMoniker) return S_FALSE; + TRACE("%p, %p.\n", iface, other); + if (!other) + return E_INVALIDARG; - /* check if both are ClassMoniker */ - if(FAILED (IMoniker_GetClassID(pmkOtherMoniker,&clsid))) return S_FALSE; - if(!IsEqualCLSID(&clsid,&CLSID_ClassMoniker)) return S_FALSE; + other_moniker = unsafe_impl_from_IMoniker(other); + if (!other_moniker) + return S_FALSE; - /* check if both displaynames are the same */ - if(SUCCEEDED ((res = CreateBindCtx(0,&bind)))) { - if(SUCCEEDED (IMoniker_GetDisplayName(iface,bind,NULL,&dispName1))) { - if(SUCCEEDED (IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2))) { - if(wcscmp(dispName1,dispName2)==0) res = S_OK; - CoTaskMemFree(dispName2); - } - CoTaskMemFree(dispName1); - } - } - return res; + return IsEqualGUID(&moniker->clsid, &other_moniker->clsid) ? S_OK : S_FALSE; } /****************************************************************************** @@ -627,9 +619,6 @@ static HRESULT WINAPI ClassMonikerROTData_GetComparisonData(IROTData* iface, return S_OK; } -/********************************************************************************/ -/* Virtual function table for the ClassMoniker class which include IPersist,*/ -/* IPersistStream and IMoniker functions. */ static const IMonikerVtbl ClassMonikerVtbl = { ClassMoniker_QueryInterface,
1
0
0
0
Nikolay Sivov : ole32: Simplify GetDisplayName() for class moniker.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: c79678ed31fc02cf5ad6f3de5dfab68b62e4f0fb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c79678ed31fc02cf5ad6f3de…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Sep 14 11:47:50 2021 +0300 ole32: Simplify GetDisplayName() for class moniker. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/classmoniker.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index 662baa3cd39..8149b8e2edc 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -510,37 +510,30 @@ static HRESULT WINAPI ClassMoniker_RelativePathTo(IMoniker* iface,IMoniker* pmOt return MK_E_NOTBINDABLE; } -/****************************************************************************** - * ClassMoniker_GetDisplayName - ******************************************************************************/ -static HRESULT WINAPI ClassMoniker_GetDisplayName(IMoniker* iface, - IBindCtx* pbc, - IMoniker* pmkToLeft, - LPOLESTR *ppszDisplayName) +static HRESULT WINAPI ClassMoniker_GetDisplayName(IMoniker *iface, + IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *name) { - ClassMoniker *This = impl_from_IMoniker(iface); - static const WCHAR wszClsidPrefix[] = L"clsid:"; + ClassMoniker *moniker = impl_from_IMoniker(iface); + static const int name_len = CHARS_IN_GUID + 5 /* prefix */; + const GUID *guid = &moniker->clsid; - TRACE("(%p, %p, %p)\n", pbc, pmkToLeft, ppszDisplayName); + TRACE("%p, %p, %p, %p.\n", iface, pbc, pmkToLeft, name); - if (!ppszDisplayName) + if (!name) return E_POINTER; if (pmkToLeft) return E_INVALIDARG; - *ppszDisplayName = CoTaskMemAlloc(sizeof(wszClsidPrefix) + (CHARS_IN_GUID-2) * sizeof(WCHAR)); - - StringFromGUID2(&This->clsid, *ppszDisplayName+ARRAY_SIZE(wszClsidPrefix)-2, CHARS_IN_GUID); + if (!(*name = CoTaskMemAlloc(name_len * sizeof(WCHAR)))) + return E_OUTOFMEMORY; - /* note: this overwrites the opening curly bracket of the CLSID string generated above */ - memcpy(*ppszDisplayName, wszClsidPrefix, sizeof(wszClsidPrefix)-sizeof(WCHAR)); + swprintf(*name, name_len, L"clsid:%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X:", + guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], + guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); - /* note: this overwrites the closing curly bracket of the CLSID string generated above */ - (*ppszDisplayName)[ARRAY_SIZE(wszClsidPrefix)-2+CHARS_IN_GUID-2] = ':'; - (*ppszDisplayName)[ARRAY_SIZE(wszClsidPrefix)-2+CHARS_IN_GUID-1] = '\0'; + TRACE("Returning %s\n", debugstr_w(*name)); - TRACE("string is %s\n", debugstr_w(*ppszDisplayName)); return S_OK; }
1
0
0
0
Rémi Bernon : winebus.sys: Free unix device in unix_device_remove.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: 1f12b2160dd5cc76cc1cd15a1d68606f304fc9e3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1f12b2160dd5cc76cc1cd15a…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 14 08:58:24 2021 +0200 winebus.sys: Free unix device in unix_device_remove. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_iohid.c | 1 - dlls/winebus.sys/bus_sdl.c | 1 - dlls/winebus.sys/bus_udev.c | 4 ---- dlls/winebus.sys/unix_private.h | 1 - dlls/winebus.sys/unixlib.c | 8 +------- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 93b3605f8d2..d9de7059be3 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -139,7 +139,6 @@ static void handle_IOHIDDeviceIOHIDReportCallback(void *context, static void iohid_device_destroy(struct unix_device *iface) { - unix_device_destroy(iface); } static int iohid_device_compare(struct unix_device *iface, void *context) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index cda9e9bdcd9..a0b44283182 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -480,7 +480,6 @@ failed: static void sdl_device_destroy(struct unix_device *iface) { - unix_device_destroy(iface); } static int sdl_device_compare(struct unix_device *iface, void *context) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 004bbb379c4..e26e11c720d 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -560,8 +560,6 @@ static void hidraw_device_destroy(struct unix_device *iface) close(private->device_fd); udev_device_unref(private->udev_device); - - unix_device_destroy(iface); } static int udev_device_compare(struct unix_device *iface, void *platform_dev) @@ -814,8 +812,6 @@ static void lnxev_device_destroy(struct unix_device *iface) close(ext->base.device_fd); udev_device_unref(ext->base.udev_device); - - unix_device_destroy(iface); } static DWORD CALLBACK lnxev_device_report_thread(void *args); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 3b0375bb761..6234c2c7bbc 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -48,7 +48,6 @@ struct unix_device }; extern void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) DECLSPEC_HIDDEN; -extern void unix_device_destroy(struct unix_device *iface) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index b433c0dcbdf..ade38c19854 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -49,7 +49,6 @@ static void mouse_destroy(struct unix_device *iface) { struct mouse_device *impl = mouse_from_unix_device(iface); hid_descriptor_free(&impl->desc); - unix_device_destroy(iface); } static int mouse_compare(struct unix_device *iface, void *context) @@ -154,7 +153,6 @@ static void keyboard_destroy(struct unix_device *iface) { struct keyboard_device *impl = keyboard_from_unix_device(iface); hid_descriptor_free(&impl->desc); - unix_device_destroy(iface); } static int keyboard_compare(struct unix_device *iface, void *context) @@ -254,16 +252,12 @@ void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) return iface; } -void unix_device_destroy(struct unix_device *iface) -{ - HeapFree(GetProcessHeap(), 0, iface); -} - static NTSTATUS unix_device_remove(void *args) { struct unix_device *iface = args; iface->vtbl->stop(iface); iface->vtbl->destroy(iface); + HeapFree(GetProcessHeap(), 0, iface); return STATUS_SUCCESS; }
1
0
0
0
Rémi Bernon : winebus.sys: Allocate mouse and keyboard devices dynamically.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: bf1446523cb8592f83fc6e7289371c2cbccb099d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bf1446523cb8592f83fc6e72…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 14 08:58:23 2021 +0200 winebus.sys: Allocate mouse and keyboard devices dynamically. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/unixlib.c | 67 +++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index b37d9534540..b433c0dcbdf 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -34,11 +34,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); -static struct hid_descriptor mouse_desc; -static struct hid_descriptor keyboard_desc; +struct mouse_device +{ + struct unix_device unix_device; + struct hid_descriptor desc; +}; + +static inline struct mouse_device *mouse_from_unix_device(struct unix_device *iface) +{ + return CONTAINING_RECORD(iface, struct mouse_device, unix_device); +} static void mouse_destroy(struct unix_device *iface) { + struct mouse_device *impl = mouse_from_unix_device(iface); + hid_descriptor_free(&impl->desc); + unix_device_destroy(iface); } static int mouse_compare(struct unix_device *iface, void *context) @@ -48,11 +59,13 @@ static int mouse_compare(struct unix_device *iface, void *context) static NTSTATUS mouse_start(struct unix_device *iface, DEVICE_OBJECT *device) { - if (!hid_descriptor_begin(&mouse_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_MOUSE)) + struct mouse_device *impl = mouse_from_unix_device(iface); + + if (!hid_descriptor_begin(&impl->desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_MOUSE)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_buttons(&mouse_desc, HID_USAGE_PAGE_BUTTON, 1, 3)) + if (!hid_descriptor_add_buttons(&impl->desc, HID_USAGE_PAGE_BUTTON, 1, 3)) return STATUS_NO_MEMORY; - if (!hid_descriptor_end(&mouse_desc)) + if (!hid_descriptor_end(&impl->desc)) return STATUS_NO_MEMORY; return STATUS_SUCCESS; @@ -64,12 +77,14 @@ static void mouse_stop(struct unix_device *iface) static NTSTATUS mouse_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { + struct mouse_device *impl = mouse_from_unix_device(iface); + TRACE("buffer %p, length %u.\n", buffer, length); - *ret_length = mouse_desc.size; - if (length < mouse_desc.size) return STATUS_BUFFER_TOO_SMALL; + *ret_length = impl->desc.size; + if (length < impl->desc.size) return STATUS_BUFFER_TOO_SMALL; - memcpy(buffer, mouse_desc.data, mouse_desc.size); + memcpy(buffer, impl->desc.data, impl->desc.size); return STATUS_SUCCESS; } @@ -115,18 +130,31 @@ static const struct device_desc mouse_device_desc = .product = {"Wine HID mouse"}, .serialnumber = {"0000"}, }; -static struct unix_device mouse_device = {.vtbl = &mouse_vtbl}; static NTSTATUS mouse_device_create(void *args) { struct device_create_params *params = args; params->desc = mouse_device_desc; - params->device = &mouse_device; + params->device = unix_device_create(&mouse_vtbl, sizeof(struct mouse_device)); return STATUS_SUCCESS; } +struct keyboard_device +{ + struct unix_device unix_device; + struct hid_descriptor desc; +}; + +static inline struct keyboard_device *keyboard_from_unix_device(struct unix_device *iface) +{ + return CONTAINING_RECORD(iface, struct keyboard_device, unix_device); +} + static void keyboard_destroy(struct unix_device *iface) { + struct keyboard_device *impl = keyboard_from_unix_device(iface); + hid_descriptor_free(&impl->desc); + unix_device_destroy(iface); } static int keyboard_compare(struct unix_device *iface, void *context) @@ -136,11 +164,13 @@ static int keyboard_compare(struct unix_device *iface, void *context) static NTSTATUS keyboard_start(struct unix_device *iface, DEVICE_OBJECT *device) { - if (!hid_descriptor_begin(&keyboard_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_KEYBOARD)) + struct keyboard_device *impl = keyboard_from_unix_device(iface); + + if (!hid_descriptor_begin(&impl->desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_KEYBOARD)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_buttons(&keyboard_desc, HID_USAGE_PAGE_KEYBOARD, 0, 101)) + if (!hid_descriptor_add_buttons(&impl->desc, HID_USAGE_PAGE_KEYBOARD, 0, 101)) return STATUS_NO_MEMORY; - if (!hid_descriptor_end(&keyboard_desc)) + if (!hid_descriptor_end(&impl->desc)) return STATUS_NO_MEMORY; return STATUS_SUCCESS; @@ -152,12 +182,14 @@ static void keyboard_stop(struct unix_device *iface) static NTSTATUS keyboard_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { + struct keyboard_device *impl = keyboard_from_unix_device(iface); + TRACE("buffer %p, length %u.\n", buffer, length); - *ret_length = keyboard_desc.size; - if (length < keyboard_desc.size) return STATUS_BUFFER_TOO_SMALL; + *ret_length = impl->desc.size; + if (length < impl->desc.size) return STATUS_BUFFER_TOO_SMALL; - memcpy(buffer, keyboard_desc.data, keyboard_desc.size); + memcpy(buffer, impl->desc.data, impl->desc.size); return STATUS_SUCCESS; } @@ -203,13 +235,12 @@ static const struct device_desc keyboard_device_desc = .product = {"Wine HID keyboard"}, .serialnumber = {"0000"}, }; -static struct unix_device keyboard_device = {.vtbl = &keyboard_vtbl}; static NTSTATUS keyboard_device_create(void *args) { struct device_create_params *params = args; params->desc = keyboard_device_desc; - params->device = &keyboard_device; + params->device = unix_device_create(&keyboard_vtbl, sizeof(struct keyboard_device)); return STATUS_SUCCESS; }
1
0
0
0
Rémi Bernon : winebus.sys: Use helpers to create and destroy unix devices.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: b86eade743c1edd6e181373c7f1876ea0b643169 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b86eade743c1edd6e181373c…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 14 08:58:22 2021 +0200 winebus.sys: Use helpers to create and destroy unix devices. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_iohid.c | 7 ++----- dlls/winebus.sys/bus_sdl.c | 8 ++------ dlls/winebus.sys/bus_udev.c | 12 ++++-------- dlls/winebus.sys/unix_private.h | 3 +++ dlls/winebus.sys/unixlib.c | 15 +++++++++++++++ 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index d362906637a..93b3605f8d2 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -139,8 +139,7 @@ static void handle_IOHIDDeviceIOHIDReportCallback(void *context, static void iohid_device_destroy(struct unix_device *iface) { - struct platform_private *private = impl_from_unix_device(iface); - HeapFree(GetProcessHeap(), 0, private); + unix_device_destroy(iface); } static int iohid_device_compare(struct unix_device *iface, void *context) @@ -337,9 +336,7 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * TRACE("dev %p, desc %s.\n", IOHIDDevice, debugstr_device_desc(&desc)); - if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) - return; - private->unix_device.vtbl = &iohid_device_vtbl; + if (!(private = unix_device_create(&iohid_device_vtbl, sizeof(struct platform_private)))) return; private->device = IOHIDDevice; private->buffer = NULL; diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 73562fec14f..cda9e9bdcd9 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -480,9 +480,7 @@ failed: static void sdl_device_destroy(struct unix_device *iface) { - struct platform_private *ext = impl_from_unix_device(iface); - - HeapFree(GetProcessHeap(), 0, ext); + unix_device_destroy(iface); } static int sdl_device_compare(struct unix_device *iface, void *context) @@ -761,9 +759,7 @@ static void sdl_add_device(unsigned int index) TRACE("%s id %d, desc %s.\n", controller ? "controller" : "joystick", id, debugstr_device_desc(&desc)); - if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*private)))) - return; - private->unix_device.vtbl = &sdl_device_vtbl; + if (!(private = unix_device_create(&sdl_device_vtbl, sizeof(struct platform_private)))) return; private->sdl_joystick = joystick; private->sdl_controller = controller; private->id = id; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 25a408489a4..004bbb379c4 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -561,7 +561,7 @@ static void hidraw_device_destroy(struct unix_device *iface) close(private->device_fd); udev_device_unref(private->udev_device); - HeapFree(GetProcessHeap(), 0, private); + unix_device_destroy(iface); } static int udev_device_compare(struct unix_device *iface, void *platform_dev) @@ -815,7 +815,7 @@ static void lnxev_device_destroy(struct unix_device *iface) close(ext->base.device_fd); udev_device_unref(ext->base.udev_device); - HeapFree(GetProcessHeap(), 0, ext); + unix_device_destroy(iface); } static DWORD CALLBACK lnxev_device_report_thread(void *args); @@ -1084,9 +1084,7 @@ static void udev_add_device(struct udev_device *dev) if (strcmp(subsystem, "hidraw") == 0) { - if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) - return; - private->unix_device.vtbl = &hidraw_device_vtbl; + if (!(private = unix_device_create(&hidraw_device_vtbl, sizeof(struct platform_private)))) return; EnterCriticalSection(&udev_cs); list_add_tail(&device_list, &private->unix_device.entry); LeaveCriticalSection(&udev_cs); @@ -1098,9 +1096,7 @@ static void udev_add_device(struct udev_device *dev) #ifdef HAS_PROPER_INPUT_HEADER else if (strcmp(subsystem, "input") == 0) { - if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wine_input_private)))) - return; - private->unix_device.vtbl = &lnxev_device_vtbl; + if (!(private = unix_device_create(&lnxev_device_vtbl, sizeof(struct wine_input_private)))) return; EnterCriticalSection(&udev_cs); list_add_tail(&device_list, &private->unix_device.entry); LeaveCriticalSection(&udev_cs); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 2a878cdb583..3b0375bb761 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -47,6 +47,9 @@ struct unix_device struct list entry; }; +extern void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) DECLSPEC_HIDDEN; +extern void unix_device_destroy(struct unix_device *iface) DECLSPEC_HIDDEN; + extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_stop(void *) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 2407a2af468..b37d9534540 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -213,6 +213,21 @@ static NTSTATUS keyboard_device_create(void *args) return STATUS_SUCCESS; } +void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) +{ + struct unix_device *iface; + + if (!(iface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size))) return NULL; + iface->vtbl = vtbl; + + return iface; +} + +void unix_device_destroy(struct unix_device *iface) +{ + HeapFree(GetProcessHeap(), 0, iface); +} + static NTSTATUS unix_device_remove(void *args) { struct unix_device *iface = args;
1
0
0
0
Rémi Bernon : winebus.sys: Split destroy to a separate stop method.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: cd830398dd39ebcd35245fcaea9844246a5f0696 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cd830398dd39ebcd35245fca…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 14 08:58:21 2021 +0200 winebus.sys: Split destroy to a separate stop method. So we can stop the device when it's removed from the ntoskrnl.exe device list, and then destroy it only when it's not referenced anymore. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_iohid.c | 8 ++++++ dlls/winebus.sys/bus_sdl.c | 16 +++++++---- dlls/winebus.sys/bus_udev.c | 64 ++++++++++++++++++++++++----------------- dlls/winebus.sys/unix_private.h | 1 + dlls/winebus.sys/unixlib.c | 19 +++++++++--- 5 files changed, 72 insertions(+), 36 deletions(-) diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 18e318f7789..d362906637a 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -167,6 +167,13 @@ static NTSTATUS iohid_device_start(struct unix_device *iface, DEVICE_OBJECT *dev return STATUS_SUCCESS; } +static void iohid_device_stop(struct unix_device *iface) +{ + struct platform_private *private = impl_from_unix_device(iface); + + IOHIDDeviceRegisterInputReportCallback(private->device, NULL, 0, NULL, NULL); +} + static NTSTATUS iohid_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -246,6 +253,7 @@ static const struct unix_device_vtbl iohid_device_vtbl = iohid_device_destroy, iohid_device_compare, iohid_device_start, + iohid_device_stop, iohid_device_get_report_descriptor, iohid_device_set_output_report, iohid_device_get_feature_report, diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 8d6df3e1f13..73562fec14f 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -482,12 +482,6 @@ static void sdl_device_destroy(struct unix_device *iface) { struct platform_private *ext = impl_from_unix_device(iface); - pSDL_JoystickClose(ext->sdl_joystick); - if (ext->sdl_controller) - pSDL_GameControllerClose(ext->sdl_controller); - if (ext->sdl_haptic) - pSDL_HapticClose(ext->sdl_haptic); - HeapFree(GetProcessHeap(), 0, ext); } @@ -503,6 +497,15 @@ static NTSTATUS sdl_device_start(struct unix_device *iface, DEVICE_OBJECT *devic return build_report_descriptor(ext); } +static void sdl_device_stop(struct unix_device *iface) +{ + struct platform_private *private = impl_from_unix_device(iface); + + pSDL_JoystickClose(private->sdl_joystick); + if (private->sdl_controller) pSDL_GameControllerClose(private->sdl_controller); + if (private->sdl_haptic) pSDL_HapticClose(private->sdl_haptic); +} + static NTSTATUS sdl_device_get_reportdescriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -579,6 +582,7 @@ static const struct unix_device_vtbl sdl_device_vtbl = sdl_device_destroy, sdl_device_compare, sdl_device_start, + sdl_device_stop, sdl_device_get_reportdescriptor, sdl_device_set_output_report, sdl_device_get_feature_report, diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 3010e50ce98..25a408489a4 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -558,19 +558,6 @@ static void hidraw_device_destroy(struct unix_device *iface) { struct platform_private *private = impl_from_unix_device(iface); - EnterCriticalSection(&udev_cs); - list_remove(&private->unix_device.entry); - LeaveCriticalSection(&udev_cs); - - if (private->report_thread) - { - write(private->control_pipe[1], "q", 1); - WaitForSingleObject(private->report_thread, INFINITE); - close(private->control_pipe[0]); - close(private->control_pipe[1]); - CloseHandle(private->report_thread); - } - close(private->device_fd); udev_device_unref(private->udev_device); @@ -608,6 +595,24 @@ static NTSTATUS hidraw_device_start(struct unix_device *iface, DEVICE_OBJECT *de return STATUS_SUCCESS; } +static void hidraw_device_stop(struct unix_device *iface) +{ + struct platform_private *private = impl_from_unix_device(iface); + + EnterCriticalSection(&udev_cs); + list_remove(&private->unix_device.entry); + LeaveCriticalSection(&udev_cs); + + if (private->report_thread) + { + write(private->control_pipe[1], "q", 1); + WaitForSingleObject(private->report_thread, INFINITE); + close(private->control_pipe[0]); + close(private->control_pipe[1]); + CloseHandle(private->report_thread); + } +} + static NTSTATUS hidraw_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -780,6 +785,7 @@ static const struct unix_device_vtbl hidraw_device_vtbl = hidraw_device_destroy, udev_device_compare, hidraw_device_start, + hidraw_device_stop, hidraw_device_get_report_descriptor, hidraw_device_set_output_report, hidraw_device_get_feature_report, @@ -802,19 +808,6 @@ static void lnxev_device_destroy(struct unix_device *iface) { struct wine_input_private *ext = input_impl_from_unix_device(iface); - EnterCriticalSection(&udev_cs); - list_remove(&ext->base.unix_device.entry); - LeaveCriticalSection(&udev_cs); - - if (ext->base.report_thread) - { - write(ext->base.control_pipe[1], "q", 1); - WaitForSingleObject(ext->base.report_thread, INFINITE); - close(ext->base.control_pipe[0]); - close(ext->base.control_pipe[1]); - CloseHandle(ext->base.report_thread); - } - HeapFree(GetProcessHeap(), 0, ext->current_report_buffer); HeapFree(GetProcessHeap(), 0, ext->last_report_buffer); hid_descriptor_free(&ext->desc); @@ -853,6 +846,24 @@ static NTSTATUS lnxev_device_start(struct unix_device *iface, DEVICE_OBJECT *dev return STATUS_SUCCESS; } +static void lnxev_device_stop(struct unix_device *iface) +{ + struct wine_input_private *ext = input_impl_from_unix_device(iface); + + EnterCriticalSection(&udev_cs); + list_remove(&ext->base.unix_device.entry); + LeaveCriticalSection(&udev_cs); + + if (ext->base.report_thread) + { + write(ext->base.control_pipe[1], "q", 1); + WaitForSingleObject(ext->base.report_thread, INFINITE); + close(ext->base.control_pipe[0]); + close(ext->base.control_pipe[1]); + CloseHandle(ext->base.report_thread); + } +} + static NTSTATUS lnxev_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -920,6 +931,7 @@ static const struct unix_device_vtbl lnxev_device_vtbl = lnxev_device_destroy, udev_device_compare, lnxev_device_start, + lnxev_device_stop, lnxev_device_get_report_descriptor, lnxev_device_set_output_report, lnxev_device_get_feature_report, diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 767c9335114..2a878cdb583 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -34,6 +34,7 @@ struct unix_device_vtbl void (*destroy)(struct unix_device *iface); int (*compare)(struct unix_device *iface, void *platform_dev); NTSTATUS (*start)(struct unix_device *iface, DEVICE_OBJECT *device); + void (*stop)(struct unix_device *iface); NTSTATUS (*get_report_descriptor)(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length); void (*set_output_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); void (*get_feature_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 67efb794e4f..2407a2af468 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -37,7 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); static struct hid_descriptor mouse_desc; static struct hid_descriptor keyboard_desc; -static void mouse_remove(struct unix_device *iface) +static void mouse_destroy(struct unix_device *iface) { } @@ -58,6 +58,10 @@ static NTSTATUS mouse_start(struct unix_device *iface, DEVICE_OBJECT *device) return STATUS_SUCCESS; } +static void mouse_stop(struct unix_device *iface) +{ +} + static NTSTATUS mouse_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { TRACE("buffer %p, length %u.\n", buffer, length); @@ -92,9 +96,10 @@ static void mouse_set_feature_report(struct unix_device *iface, HID_XFER_PACKET static const struct unix_device_vtbl mouse_vtbl = { - mouse_remove, + mouse_destroy, mouse_compare, mouse_start, + mouse_stop, mouse_get_report_descriptor, mouse_set_output_report, mouse_get_feature_report, @@ -120,7 +125,7 @@ static NTSTATUS mouse_device_create(void *args) return STATUS_SUCCESS; } -static void keyboard_remove(struct unix_device *iface) +static void keyboard_destroy(struct unix_device *iface) { } @@ -141,6 +146,10 @@ static NTSTATUS keyboard_start(struct unix_device *iface, DEVICE_OBJECT *device) return STATUS_SUCCESS; } +static void keyboard_stop(struct unix_device *iface) +{ +} + static NTSTATUS keyboard_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { TRACE("buffer %p, length %u.\n", buffer, length); @@ -175,9 +184,10 @@ static void keyboard_set_feature_report(struct unix_device *iface, HID_XFER_PACK static const struct unix_device_vtbl keyboard_vtbl = { - keyboard_remove, + keyboard_destroy, keyboard_compare, keyboard_start, + keyboard_stop, keyboard_get_report_descriptor, keyboard_set_output_report, keyboard_get_feature_report, @@ -206,6 +216,7 @@ static NTSTATUS keyboard_device_create(void *args) static NTSTATUS unix_device_remove(void *args) { struct unix_device *iface = args; + iface->vtbl->stop(iface); iface->vtbl->destroy(iface); return STATUS_SUCCESS; }
1
0
0
0
Paul Gofman : wbemprox: Add Microsoft\\Windows\\Storage namespace.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: bb727d2e983ba1426ef5de1c5abc3eb2d5ca7361 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bb727d2e983ba1426ef5de1c…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Sep 13 17:13:29 2021 +0300 wbemprox: Add Microsoft\\Windows\\Storage namespace. Fixes Life is Strange: True Colors error on start. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wbemprox/builtin.c | 1 + dlls/wbemprox/tests/services.c | 39 +++++++++++++++++++++++++++++++++++++++ dlls/wbemprox/wbemprox_private.h | 1 + 3 files changed, 41 insertions(+) diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index ad96182af6b..442a9015951 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -4128,6 +4128,7 @@ static const struct builtin_namespaces[WBEMPROX_NAMESPACE_LAST] = { {L"cimv2", cimv2_builtin_classes, ARRAY_SIZE(cimv2_builtin_classes)}, + {L"Microsoft\\Windows\\Storage", NULL, 0}, }; void init_table_list( void ) diff --git a/dlls/wbemprox/tests/services.c b/dlls/wbemprox/tests/services.c index 5ad73e7a8ec..86ee99c335c 100644 --- a/dlls/wbemprox/tests/services.c +++ b/dlls/wbemprox/tests/services.c @@ -247,11 +247,50 @@ todo_wine IWbemContext_Release( context ); } +static void test_namespaces(void) +{ + static const struct + { + const WCHAR *path; + BOOL broken; + } + tests[] = + { + {L"ROOT\\CIMV2"}, + {L"ROOT\\Microsoft\\Windows\\Storage", TRUE /* Before Win8. */}, + }; + IWbemLocator *locator; + IWbemServices *services; + unsigned int i; + BSTR resource; + HRESULT hr; + + hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (void **)&locator ); + if (hr != S_OK) + { + win_skip( "can't create instance of WbemLocator.\n" ); + return; + } + + for (i = 0; i < ARRAY_SIZE( tests ); i++) + { + resource = SysAllocString( tests[i].path ); + hr = IWbemLocator_ConnectServer( locator, resource, NULL, NULL, NULL, 0, NULL, NULL, &services ); + ok( hr == S_OK || broken( tests[i].broken && hr == WBEM_E_INVALID_NAMESPACE ), "%u: got %08x\n", i, hr ); + SysFreeString( resource ); + if (hr == S_OK) + IWbemServices_Release( services ); + } + + IWbemLocator_Release( locator ); +} + START_TEST(services) { CoInitialize( NULL ); test_IClientSecurity(); test_IWbemLocator(); test_IWbemContext(); + test_namespaces(); CoUninitialize(); } diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index cd655e54243..6b94bbb9ef6 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -23,6 +23,7 @@ enum wbm_namespace { WBEMPROX_NAMESPACE_CIMV2, + WBEMPROX_NAMESPACE_MS_WINDOWS_STORAGE, WBEMPROX_NAMESPACE_LAST, };
1
0
0
0
Paul Gofman : wbemprox: Return WBEM_E_INVALID_CLASS from create_view() if namespace is empty.
by Alexandre Julliard
14 Sep '21
14 Sep '21
Module: wine Branch: master Commit: 73aab21de686e8a6bf663fc05563a745574b1a85 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=73aab21de686e8a6bf663fc0…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Sep 13 17:13:28 2021 +0300 wbemprox: Return WBEM_E_INVALID_CLASS from create_view() if namespace is empty. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wbemprox/query.c | 1 + dlls/wbemprox/tests/query.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index 108e3b4ad81..77ed27e105d 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -62,6 +62,7 @@ HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *pa heap_free( view ); return hr; } + else if (!table && ns == WBEMPROX_NAMESPACE_LAST) return WBEM_E_INVALID_CLASS; view->proplist = proplist; view->cond = cond; break; diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 784ebd3503d..69bb8e7977e 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -2061,6 +2061,33 @@ static void test_Win32_LogicalDisk( IWbemServices *services ) SysFreeString( wql ); } +static void test_empty_namespace( IWbemLocator *locator ) +{ + BSTR path = SysAllocString( L"ROOT" ); + BSTR wql = SysAllocString( L"wql" ); + IEnumWbemClassObject *result; + IWbemServices *services; + BSTR query; + HRESULT hr; + + hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services ); + ok( hr == S_OK, "failed to get IWbemServices interface %08x\n", hr ); + + query = SysAllocString( L"SELECT * FROM __ASSOCIATORS" ); + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == WBEM_E_INVALID_CLASS, "Query failed: %08x\n", hr ); + SysFreeString( query ); + + query = SysAllocString( L"SELECT * FROM Win32_OperatingSystem" ); + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == WBEM_E_INVALID_CLASS, "got %08x\n", hr ); + SysFreeString( query ); + + SysFreeString( wql ); + SysFreeString( path ); + IWbemServices_Release( services ); +} + START_TEST(query) { BSTR path = SysAllocString( L"ROOT\\CIMV2" ); @@ -2138,6 +2165,7 @@ START_TEST(query) test_Win32_VideoController( services ); test_Win32_WinSAT( services ); test_SystemRestore( services ); + test_empty_namespace( locator ); SysFreeString( path ); IWbemServices_Release( services );
1
0
0
0
← Newer
1
...
65
66
67
68
69
70
71
...
103
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
Results per page:
10
25
50
100
200