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
Bernhard Kölbl : windows.media.speech: Add IIterator<HSTRING>.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: a709f24292dbc7e344a26f4909b76122d541759c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a709f24292dbc7e344a26f49…
Author: Bernhard Kölbl <besentv(a)gmail.com> Date: Tue Mar 29 19:30:47 2022 +0200 windows.media.speech: Add IIterator<HSTRING>. And implement the IIterable<HSTRING>_First methods. Signed-off-by: Bernhard Kölbl <besentv(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.media.speech/vector.c | 169 ++++++++++++++++++++++++++++++++++++- 1 file changed, 165 insertions(+), 4 deletions(-) diff --git a/dlls/windows.media.speech/vector.c b/dlls/windows.media.speech/vector.c index da3a45fbb59..c399e91593f 100644 --- a/dlls/windows.media.speech/vector.c +++ b/dlls/windows.media.speech/vector.c @@ -23,6 +23,141 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech); +/* + * + * IIterator<HSTRING> + * + */ + +struct iterator_hstring +{ + IIterator_HSTRING IIterator_HSTRING_iface; + LONG ref; + + IVectorView_HSTRING *view; + UINT32 index; + UINT32 size; +}; + +static inline struct iterator_hstring *impl_from_IIterator_HSTRING( IIterator_HSTRING *iface ) +{ + return CONTAINING_RECORD(iface, struct iterator_hstring, IIterator_HSTRING_iface); +} + +static HRESULT WINAPI iterator_hstring_QueryInterface( IIterator_HSTRING *iface, REFIID iid, void **out ) +{ + struct iterator_hstring *impl = impl_from_IIterator_HSTRING(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IIterator_HSTRING)) + { + IInspectable_AddRef((*out = &impl->IIterator_HSTRING_iface)); + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI iterator_hstring_AddRef( IIterator_HSTRING *iface ) +{ + struct iterator_hstring *impl = impl_from_IIterator_HSTRING(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p increasing refcount to %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI iterator_hstring_Release( IIterator_HSTRING *iface ) +{ + struct iterator_hstring *impl = impl_from_IIterator_HSTRING(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + + TRACE("iface %p decreasing refcount to %lu.\n", iface, ref); + + if (!ref) + { + IVectorView_HSTRING_Release(impl->view); + free(impl); + } + + return ref; +} + +static HRESULT WINAPI iterator_hstring_GetIids( IIterator_HSTRING *iface, ULONG *iid_count, IID **iids ) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT WINAPI iterator_hstring_GetRuntimeClassName( IIterator_HSTRING *iface, HSTRING *class_name ) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI iterator_hstring_GetTrustLevel( IIterator_HSTRING *iface, TrustLevel *trust_level ) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT WINAPI iterator_hstring_get_Current( IIterator_HSTRING *iface, HSTRING *value ) +{ + struct iterator_hstring *impl = impl_from_IIterator_HSTRING(iface); + TRACE("iface %p, value %p.\n", iface, value); + return IVectorView_HSTRING_GetAt(impl->view, impl->index, value); +} + +static HRESULT WINAPI iterator_hstring_get_HasCurrent( IIterator_HSTRING *iface, BOOL *value ) +{ + struct iterator_hstring *impl = impl_from_IIterator_HSTRING(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + *value = impl->index < impl->size; + return S_OK; +} + +static HRESULT WINAPI iterator_hstring_MoveNext( IIterator_HSTRING *iface, BOOL *value ) +{ + struct iterator_hstring *impl = impl_from_IIterator_HSTRING(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + if (impl->index < impl->size) impl->index++; + return IIterator_HSTRING_get_HasCurrent(iface, value); +} + +static HRESULT WINAPI iterator_hstring_GetMany( IIterator_HSTRING *iface, UINT32 items_size, + HSTRING *items, UINT *count ) +{ + struct iterator_hstring *impl = impl_from_IIterator_HSTRING(iface); + TRACE("iface %p, items_size %u, items %p, count %p.\n", iface, items_size, items, count); + return IVectorView_HSTRING_GetMany(impl->view, impl->index, items_size, items, count); +} + +static const IIterator_HSTRINGVtbl iterator_hstring_vtbl = +{ + /* IUnknown methods */ + iterator_hstring_QueryInterface, + iterator_hstring_AddRef, + iterator_hstring_Release, + /* IInspectable methods */ + iterator_hstring_GetIids, + iterator_hstring_GetRuntimeClassName, + iterator_hstring_GetTrustLevel, + /* IIterator<HSTRING> methods */ + iterator_hstring_get_Current, + iterator_hstring_get_HasCurrent, + iterator_hstring_MoveNext, + iterator_hstring_GetMany, +}; + /* * * IVectorView<HSTRING> @@ -204,8 +339,20 @@ DEFINE_IINSPECTABLE_(iterable_view_hstring, IIterable_HSTRING, struct vector_vie static HRESULT WINAPI iterable_view_hstring_First( IIterable_HSTRING *iface, IIterator_HSTRING **value ) { - TRACE("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + struct vector_view_hstring *impl = view_impl_from_IIterable_HSTRING(iface); + struct iterator_hstring *iter; + + TRACE("iface %p, value %p.\n", iface, value); + + if (!(iter = calloc(1, sizeof(*iter)))) return E_OUTOFMEMORY; + iter->IIterator_HSTRING_iface.lpVtbl = &iterator_hstring_vtbl; + iter->ref = 1; + + IVectorView_HSTRING_AddRef((iter->view = &impl->IVectorView_HSTRING_iface)); + iter->size = impl->size; + + *value = &iter->IIterator_HSTRING_iface; + return S_OK; } static const struct IIterable_HSTRINGVtbl iterable_view_hstring_vtbl = @@ -533,8 +680,22 @@ DEFINE_IINSPECTABLE(iterable_hstring, IIterable_HSTRING, struct vector_hstring, static HRESULT WINAPI iterable_hstring_First( IIterable_HSTRING *iface, IIterator_HSTRING **value ) { - FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + struct vector_hstring *impl = impl_from_IIterable_HSTRING(iface); + IIterable_HSTRING *iterable; + IVectorView_HSTRING *view; + HRESULT hr; + + TRACE("iface %p, value %p.\n", iface, value); + + if (FAILED(hr = IVector_HSTRING_GetView(&impl->IVector_HSTRING_iface, &view))) return hr; + + hr = IVectorView_HSTRING_QueryInterface(view, &IID_IIterable_HSTRING, (void **)&iterable); + IVectorView_HSTRING_Release(view); + if (FAILED(hr)) return hr; + + hr = IIterable_HSTRING_First(iterable, value); + IIterable_HSTRING_Release(iterable); + return hr; } static const struct IIterable_HSTRINGVtbl iterable_hstring_vtbl =
1
0
0
0
Bernhard Kölbl : windows.media.speech: Add IIterable<HSTRING> stubs.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: c6b9d9bc4e895d00cb5f1b30802beaef92f1df29 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c6b9d9bc4e895d00cb5f1b30…
Author: Bernhard Kölbl <besentv(a)gmail.com> Date: Tue Mar 29 19:30:46 2022 +0200 windows.media.speech: Add IIterable<HSTRING> stubs. To both IVector<HSTRING> and IVectorView<HSTRING>. Signed-off-by: Bernhard Kölbl <besentv(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.media.speech/vector.c | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/dlls/windows.media.speech/vector.c b/dlls/windows.media.speech/vector.c index c4112f10a3e..da3a45fbb59 100644 --- a/dlls/windows.media.speech/vector.c +++ b/dlls/windows.media.speech/vector.c @@ -32,6 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech); struct vector_view_hstring { IVectorView_HSTRING IVectorView_HSTRING_iface; + IIterable_HSTRING IIterable_HSTRING_iface; LONG ref; UINT32 size; @@ -58,6 +59,12 @@ static HRESULT WINAPI vector_view_hstring_QueryInterface( IVectorView_HSTRING *i return S_OK; } + if (IsEqualGUID(iid, &IID_IIterable_HSTRING)) + { + IInspectable_AddRef((*out = &impl->IIterable_HSTRING_iface)); + return S_OK; + } + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -186,6 +193,35 @@ static const struct IVectorView_HSTRINGVtbl vector_view_hstring_vtbl = vector_view_hstring_GetMany, }; +/* + * + * IIterable<HSTRING> + * + */ + +DEFINE_IINSPECTABLE_(iterable_view_hstring, IIterable_HSTRING, struct vector_view_hstring, view_impl_from_IIterable_HSTRING, + IIterable_HSTRING_iface, &impl->IVectorView_HSTRING_iface) + +static HRESULT WINAPI iterable_view_hstring_First( IIterable_HSTRING *iface, IIterator_HSTRING **value ) +{ + TRACE("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static const struct IIterable_HSTRINGVtbl iterable_view_hstring_vtbl = +{ + /* IUnknown methods */ + iterable_view_hstring_QueryInterface, + iterable_view_hstring_AddRef, + iterable_view_hstring_Release, + /* IInspectable methods */ + iterable_view_hstring_GetIids, + iterable_view_hstring_GetRuntimeClassName, + iterable_view_hstring_GetTrustLevel, + /* IIterable<HSTRING> methods */ + iterable_view_hstring_First, +}; + /* * * IVector<HSTRING> @@ -195,6 +231,7 @@ static const struct IVectorView_HSTRINGVtbl vector_view_hstring_vtbl = struct vector_hstring { IVector_HSTRING IVector_HSTRING_iface; + IIterable_HSTRING IIterable_HSTRING_iface; LONG ref; UINT32 size; @@ -222,6 +259,12 @@ static HRESULT WINAPI vector_hstring_QueryInterface( IVector_HSTRING *iface, REF return S_OK; } + if (IsEqualGUID(iid, &IID_IIterable_HSTRING)) + { + IInspectable_AddRef((*out = &impl->IIterable_HSTRING_iface)); + return S_OK; + } + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -300,6 +343,7 @@ static HRESULT WINAPI vector_hstring_GetView( IVector_HSTRING *iface, IVectorVie if (!(view = calloc(1, offsetof(struct vector_view_hstring, elements[impl->size])))) return E_OUTOFMEMORY; view->IVectorView_HSTRING_iface.lpVtbl = &vector_view_hstring_vtbl; + view->IIterable_HSTRING_iface.lpVtbl = &iterable_view_hstring_vtbl; view->ref = 1; for (i = 0; i < impl->size; ++i) @@ -479,6 +523,34 @@ static const struct IVector_HSTRINGVtbl vector_hstring_vtbl = vector_hstring_ReplaceAll, }; +/* + * + * IIterable<HSTRING> + * + */ + +DEFINE_IINSPECTABLE(iterable_hstring, IIterable_HSTRING, struct vector_hstring, IVector_HSTRING_iface) + +static HRESULT WINAPI iterable_hstring_First( IIterable_HSTRING *iface, IIterator_HSTRING **value ) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static const struct IIterable_HSTRINGVtbl iterable_hstring_vtbl = +{ + /* IUnknown methods */ + iterable_hstring_QueryInterface, + iterable_hstring_AddRef, + iterable_hstring_Release, + /* IInspectable methods */ + iterable_hstring_GetIids, + iterable_hstring_GetRuntimeClassName, + iterable_hstring_GetTrustLevel, + /* IIterable<HSTRING> methods */ + iterable_hstring_First, +}; + HRESULT vector_hstring_create( IVector_HSTRING **out ) { struct vector_hstring *impl; @@ -487,6 +559,7 @@ HRESULT vector_hstring_create( IVector_HSTRING **out ) if (!(impl = calloc(1, sizeof(*impl)))) return E_OUTOFMEMORY; impl->IVector_HSTRING_iface.lpVtbl = &vector_hstring_vtbl; + impl->IIterable_HSTRING_iface.lpVtbl = &iterable_hstring_vtbl; impl->ref = 1; *out = &impl->IVector_HSTRING_iface;
1
0
0
0
Bernhard Kölbl : windows.media.speech: Add IVectorView<HSTRING>.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: 016b0a1b04b5247e7ec7fe0363631b84015bf3fd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=016b0a1b04b5247e7ec7fe03…
Author: Bernhard Kölbl <besentv(a)gmail.com> Date: Tue Mar 29 19:30:45 2022 +0200 windows.media.speech: Add IVectorView<HSTRING>. And make it obtainable from IVector<HSTRING>_GetView. Signed-off-by: Bernhard Kölbl <besentv(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.media.speech/vector.c | 186 ++++++++++++++++++++++++++++++++++++- 1 file changed, 184 insertions(+), 2 deletions(-) diff --git a/dlls/windows.media.speech/vector.c b/dlls/windows.media.speech/vector.c index 13a36499a46..c4112f10a3e 100644 --- a/dlls/windows.media.speech/vector.c +++ b/dlls/windows.media.speech/vector.c @@ -23,6 +23,169 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech); +/* + * + * IVectorView<HSTRING> + * + */ + +struct vector_view_hstring +{ + IVectorView_HSTRING IVectorView_HSTRING_iface; + LONG ref; + + UINT32 size; + HSTRING elements[]; +}; + +static inline struct vector_view_hstring *impl_from_IVectorView_HSTRING( IVectorView_HSTRING *iface ) +{ + return CONTAINING_RECORD(iface, struct vector_view_hstring, IVectorView_HSTRING_iface); +} + +static HRESULT WINAPI vector_view_hstring_QueryInterface( IVectorView_HSTRING *iface, REFIID iid, void **out ) +{ + struct vector_view_hstring *impl = impl_from_IVectorView_HSTRING(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IVectorView_HSTRING)) + { + IInspectable_AddRef((*out = &impl->IVectorView_HSTRING_iface)); + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI vector_view_hstring_AddRef( IVectorView_HSTRING *iface ) +{ + struct vector_view_hstring *impl = impl_from_IVectorView_HSTRING(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p increasing refcount to %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI vector_view_hstring_Release( IVectorView_HSTRING *iface ) +{ + struct vector_view_hstring *impl = impl_from_IVectorView_HSTRING(iface); + ULONG i, ref = InterlockedDecrement(&impl->ref); + + TRACE("iface %p decreasing refcount to %lu.\n", iface, ref); + + if (!ref) + { + for (i = 0; i < impl->size; ++i) WindowsDeleteString(impl->elements[i]); + free(impl); + } + + return ref; +} + +static HRESULT WINAPI vector_view_hstring_GetIids( IVectorView_HSTRING *iface, ULONG *iid_count, IID **iids ) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT WINAPI vector_view_hstring_GetRuntimeClassName( IVectorView_HSTRING *iface, HSTRING *class_name ) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI vector_view_hstring_GetTrustLevel( IVectorView_HSTRING *iface, TrustLevel *trust_level ) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT WINAPI vector_view_hstring_GetAt( IVectorView_HSTRING *iface, UINT32 index, HSTRING *value ) +{ + struct vector_view_hstring *impl = impl_from_IVectorView_HSTRING(iface); + + TRACE("iface %p, index %u, value %p.\n", iface, index, value); + + *value = NULL; + if (index >= impl->size) return E_BOUNDS; + + return WindowsDuplicateString(impl->elements[index], value); +} + +static HRESULT WINAPI vector_view_hstring_get_Size( IVectorView_HSTRING *iface, UINT32 *value ) +{ + struct vector_view_hstring *impl = impl_from_IVectorView_HSTRING(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + *value = impl->size; + return S_OK; +} + +static HRESULT WINAPI vector_view_hstring_IndexOf( IVectorView_HSTRING *iface, HSTRING element, + UINT32 *index, BOOLEAN *found ) +{ + struct vector_view_hstring *impl = impl_from_IVectorView_HSTRING(iface); + ULONG i; + + TRACE("iface %p, element %p, index %p, found %p.\n", iface, element, index, found); + + for (i = 0; i < impl->size; ++i) if (impl->elements[i] == element) break; + if ((*found = (i < impl->size))) *index = i; + else *index = 0; + + return S_OK; +} + +static HRESULT WINAPI vector_view_hstring_GetMany( IVectorView_HSTRING *iface, UINT32 start_index, + UINT32 items_size, HSTRING *items, UINT *count ) +{ + struct vector_view_hstring *impl = impl_from_IVectorView_HSTRING(iface); + HRESULT hr; + UINT32 i; + + TRACE( "iface %p, start_index %u, items_size %u, items %p, count %p.\n", + iface, start_index, items_size, items, count ); + + if (start_index >= impl->size) return E_BOUNDS; + + for (i = start_index; i < impl->size; ++i) + { + if (i - start_index >= items_size) break; + if (FAILED(hr = WindowsDuplicateString(impl->elements[i], &items[i - start_index]))) goto error; + } + *count = i - start_index; + + return S_OK; + +error: + *count = 0; + while (i-- > start_index) WindowsDeleteString(items[i-start_index]); + return hr; +} + +static const struct IVectorView_HSTRINGVtbl vector_view_hstring_vtbl = +{ + /* IUnknown methods */ + vector_view_hstring_QueryInterface, + vector_view_hstring_AddRef, + vector_view_hstring_Release, + /* IInspectable methods */ + vector_view_hstring_GetIids, + vector_view_hstring_GetRuntimeClassName, + vector_view_hstring_GetTrustLevel, + /* IVectorView<HSTRING> methods */ + vector_view_hstring_GetAt, + vector_view_hstring_get_Size, + vector_view_hstring_IndexOf, + vector_view_hstring_GetMany, +}; + /* * * IVector<HSTRING> @@ -128,8 +291,27 @@ static HRESULT WINAPI vector_hstring_get_Size( IVector_HSTRING *iface, UINT32 *v static HRESULT WINAPI vector_hstring_GetView( IVector_HSTRING *iface, IVectorView_HSTRING **value ) { - FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + struct vector_hstring *impl = impl_from_IVector_HSTRING(iface); + struct vector_view_hstring *view; + HRESULT hr; + ULONG i; + + TRACE("iface %p, value %p.\n", iface, value); + + if (!(view = calloc(1, offsetof(struct vector_view_hstring, elements[impl->size])))) return E_OUTOFMEMORY; + view->IVectorView_HSTRING_iface.lpVtbl = &vector_view_hstring_vtbl; + view->ref = 1; + + for (i = 0; i < impl->size; ++i) + if (FAILED(hr = WindowsDuplicateString(impl->elements[i], &view->elements[view->size++]))) goto error; + + *value = &view->IVectorView_HSTRING_iface; + return S_OK; + +error: + while (i-- > 0) WindowsDeleteString(view->elements[i]); + free(view); + return hr; } static HRESULT WINAPI vector_hstring_IndexOf( IVector_HSTRING *iface, HSTRING element, UINT32 *index, BOOLEAN *found )
1
0
0
0
Bernhard Kölbl : windows.media.speech: Add IVector<HSTRING>.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: d8c9e6705947fd04d3d73b6d1020c86486808caf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d8c9e6705947fd04d3d73b6d…
Author: Bernhard Kölbl <besentv(a)gmail.com> Date: Tue Mar 29 19:30:44 2022 +0200 windows.media.speech: Add IVector<HSTRING>. And use it in listconstraint. Signed-off-by: Bernhard Kölbl <besentv(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.media.speech/Makefile.in | 3 +- dlls/windows.media.speech/listconstraint.c | 11 +- dlls/windows.media.speech/private.h | 2 + dlls/windows.media.speech/vector.c | 313 +++++++++++++++++++++++++++++ 4 files changed, 326 insertions(+), 3 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=d8c9e6705947fd04d3d7…
1
0
0
0
Rémi Bernon : kernelbase: Make (Global|Local)* traces and identifiers more consistent.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: 4ba774d85ea1596b9573c38bab234a5515b7eab7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4ba774d85ea1596b9573c38b…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Mar 29 15:24:39 2022 +0200 kernelbase: Make (Global|Local)* traces and identifiers more consistent. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/memory.c | 185 +++++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 88 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=4ba774d85ea1596b9573…
1
0
0
0
Rémi Bernon : kernelbase: Fix indentation of LocalReAlloc.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: 424e38f3f8bdeb5bb6b45ea88d8c66070ec49b34 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=424e38f3f8bdeb5bb6b45ea8…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Mar 29 15:24:38 2022 +0200 kernelbase: Fix indentation of LocalReAlloc. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/memory.c | 183 +++++++++++++++++++++++------------------------ 1 file changed, 91 insertions(+), 92 deletions(-) diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index 42ffd1bcdd9..8c818f33ca6 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -791,98 +791,97 @@ LPVOID WINAPI DECLSPEC_HOTPATCH LocalLock( HLOCAL hmem ) */ HLOCAL WINAPI DECLSPEC_HOTPATCH LocalReAlloc( HLOCAL hmem, SIZE_T size, UINT flags ) { - struct local_header *header; - void *ptr; - HLOCAL ret = 0; - DWORD heap_flags = (flags & LMEM_ZEROINIT) ? HEAP_ZERO_MEMORY : 0; - - RtlLockHeap( GetProcessHeap() ); - if (flags & LMEM_MODIFY) /* modify flags */ - { - if (is_pointer( hmem ) && (flags & LMEM_MOVEABLE)) - { - /* make a fixed block moveable - * actually only NT is able to do this. But it's soo simple - */ - if (hmem == 0) - { - WARN( "null handle\n"); - SetLastError( ERROR_NOACCESS ); - } - else - { - size = RtlSizeHeap( GetProcessHeap(), 0, hmem ); - ret = LocalAlloc( flags, size ); - ptr = LocalLock( ret ); - memcpy( ptr, hmem, size ); - LocalUnlock( ret ); - LocalFree( hmem ); - } - } - else if (!is_pointer( hmem ) && (flags & LMEM_DISCARDABLE)) - { - /* change the flags to make our block "discardable" */ - header = get_header( hmem ); - header->flags |= LMEM_DISCARDABLE >> 8; - ret = hmem; - } - else SetLastError( ERROR_INVALID_PARAMETER ); - } - else - { - if (is_pointer( hmem )) - { - /* reallocate fixed memory */ - if (!(flags & LMEM_MOVEABLE)) heap_flags |= HEAP_REALLOC_IN_PLACE_ONLY; - ret = HeapReAlloc( GetProcessHeap(), heap_flags, hmem, size ); - } - else - { - /* reallocate a moveable block */ - header = get_header( hmem ); - if (size != 0) - { - if (size <= INT_MAX - HLOCAL_STORAGE) - { - if (header->ptr) - { - if ((ptr = HeapReAlloc( GetProcessHeap(), heap_flags, - (char *)header->ptr - HLOCAL_STORAGE, - size + HLOCAL_STORAGE ))) - { - header->ptr = (char *)ptr + HLOCAL_STORAGE; - ret = hmem; - } - } - else - { - if ((ptr = HeapAlloc( GetProcessHeap(), heap_flags, size + HLOCAL_STORAGE ))) - { - *(HLOCAL *)ptr = hmem; - header->ptr = (char *)ptr + HLOCAL_STORAGE; - ret = hmem; - } - } - } - else SetLastError( ERROR_OUTOFMEMORY ); - } - else - { - if (header->lock == 0) - { - if (header->ptr) - { - HeapFree( GetProcessHeap(), 0, (char *)header->ptr - HLOCAL_STORAGE ); - header->ptr = NULL; - } - ret = hmem; - } - else WARN( "not freeing memory associated with locked handle\n" ); - } - } - } - RtlUnlockHeap( GetProcessHeap() ); - return ret; + struct local_header *header; + void *ptr; + HLOCAL ret = 0; + DWORD heap_flags = (flags & LMEM_ZEROINIT) ? HEAP_ZERO_MEMORY : 0; + + RtlLockHeap( GetProcessHeap() ); + if (flags & LMEM_MODIFY) /* modify flags */ + { + if (is_pointer( hmem ) && (flags & LMEM_MOVEABLE)) + { + /* make a fixed block moveable + * actually only NT is able to do this. But it's soo simple + */ + if (hmem == 0) + { + WARN( "null handle\n" ); + SetLastError( ERROR_NOACCESS ); + } + else + { + size = RtlSizeHeap( GetProcessHeap(), 0, hmem ); + ret = LocalAlloc( flags, size ); + ptr = LocalLock( ret ); + memcpy( ptr, hmem, size ); + LocalUnlock( ret ); + LocalFree( hmem ); + } + } + else if (!is_pointer( hmem ) && (flags & LMEM_DISCARDABLE)) + { + /* change the flags to make our block "discardable" */ + header = get_header( hmem ); + header->flags |= LMEM_DISCARDABLE >> 8; + ret = hmem; + } + else SetLastError( ERROR_INVALID_PARAMETER ); + } + else + { + if (is_pointer( hmem )) + { + /* reallocate fixed memory */ + if (!(flags & LMEM_MOVEABLE)) heap_flags |= HEAP_REALLOC_IN_PLACE_ONLY; + ret = HeapReAlloc( GetProcessHeap(), heap_flags, hmem, size ); + } + else + { + /* reallocate a moveable block */ + header = get_header( hmem ); + if (size != 0) + { + if (size <= INT_MAX - HLOCAL_STORAGE) + { + if (header->ptr) + { + if ((ptr = HeapReAlloc( GetProcessHeap(), heap_flags, (char *)header->ptr - HLOCAL_STORAGE, + size + HLOCAL_STORAGE ))) + { + header->ptr = (char *)ptr + HLOCAL_STORAGE; + ret = hmem; + } + } + else + { + if ((ptr = HeapAlloc( GetProcessHeap(), heap_flags, size + HLOCAL_STORAGE ))) + { + *(HLOCAL *)ptr = hmem; + header->ptr = (char *)ptr + HLOCAL_STORAGE; + ret = hmem; + } + } + } + else SetLastError( ERROR_OUTOFMEMORY ); + } + else + { + if (header->lock == 0) + { + if (header->ptr) + { + HeapFree( GetProcessHeap(), 0, (char *)header->ptr - HLOCAL_STORAGE ); + header->ptr = NULL; + } + ret = hmem; + } + else WARN( "not freeing memory associated with locked handle\n" ); + } + } + } + RtlUnlockHeap( GetProcessHeap() ); + return ret; }
1
0
0
0
Rémi Bernon : kernel32: Make Global* traces and identifiers more consistent.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: fc12f812c3f7a234e12c1fde455f452aa6fe26c1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fc12f812c3f7a234e12c1fde…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Mar 29 15:24:37 2022 +0200 kernel32: Make Global* traces and identifiers more consistent. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/heap.c | 111 +++++++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index 7e366eb991e..fefb88d6857 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -183,7 +183,7 @@ typedef struct __GLOBAL32_INTERN * Lock a global memory object and return a pointer to first byte of the memory * * PARAMS - * hmem [I] Handle of the global memory object + * handle [I] Handle of the global memory object * * RETURNS * Success: Pointer to first byte of the memory block @@ -193,9 +193,9 @@ typedef struct __GLOBAL32_INTERN * When the handle is invalid, last error is set to ERROR_INVALID_HANDLE * */ -LPVOID WINAPI GlobalLock(HGLOBAL hmem) +void *WINAPI GlobalLock( HGLOBAL handle ) { - return LocalLock( hmem ); + return LocalLock( handle ); } @@ -205,7 +205,7 @@ LPVOID WINAPI GlobalLock(HGLOBAL hmem) * Unlock a global memory object. * * PARAMS - * hmem [I] Handle of the global memory object + * handle [I] Handle of the global memory object * * RETURNS * Success: Object is still locked @@ -215,10 +215,10 @@ LPVOID WINAPI GlobalLock(HGLOBAL hmem) * When the handle is invalid, last error is set to ERROR_INVALID_HANDLE * */ -BOOL WINAPI GlobalUnlock(HGLOBAL hmem) +BOOL WINAPI GlobalUnlock( HGLOBAL handle ) { - if (ISPOINTER( hmem )) return TRUE; - return LocalUnlock( hmem ); + if (ISPOINTER( handle )) return TRUE; + return LocalUnlock( handle ); } @@ -231,13 +231,15 @@ BOOL WINAPI GlobalUnlock(HGLOBAL hmem) * Handle: Success * NULL: Failure */ -HGLOBAL WINAPI GlobalHandle( LPCVOID pmem ) +HGLOBAL WINAPI GlobalHandle( const void *ptr ) { + PGLOBAL32_INTERN mem; HGLOBAL handle; - PGLOBAL32_INTERN maybe_intern; LPCVOID test; - if (!pmem) + TRACE_(globalmem)( "ptr %p\n", ptr ); + + if (!ptr) { SetLastError( ERROR_INVALID_PARAMETER ); return 0; @@ -248,27 +250,27 @@ HGLOBAL WINAPI GlobalHandle( LPCVOID pmem ) { handle = 0; - /* note that if pmem is a pointer to a block allocated by */ + /* note that if ptr is a pointer to a block allocated by */ /* GlobalAlloc with GMEM_MOVEABLE then magic test in HeapValidate */ /* will fail. */ - if (ISPOINTER( pmem )) + if (ISPOINTER( ptr )) { - if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, pmem )) + if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, ptr )) { - handle = (HGLOBAL)pmem; /* valid fixed block */ + handle = (HGLOBAL)ptr; /* valid fixed block */ break; } - handle = POINTER_TO_HANDLE( pmem ); + handle = POINTER_TO_HANDLE( ptr ); } - else handle = (HGLOBAL)pmem; + else handle = (HGLOBAL)ptr; /* Now test handle either passed in or retrieved from pointer */ - maybe_intern = HANDLE_TO_INTERN( handle ); - if (maybe_intern->Magic == MAGIC_GLOBAL_USED) + mem = HANDLE_TO_INTERN( handle ); + if (mem->Magic == MAGIC_GLOBAL_USED) { - test = maybe_intern->Pointer; + test = mem->Pointer; if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, (const char *)test - HGLOBAL_STORAGE ) && /* obj(-handle) valid arena? */ - HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, maybe_intern )) /* intern valid arena? */ + HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, mem )) /* intern valid arena? */ break; /* valid moveable block */ } handle = 0; @@ -294,9 +296,9 @@ HGLOBAL WINAPI GlobalHandle( LPCVOID pmem ) * Handle: Success * NULL: Failure */ -HGLOBAL WINAPI GlobalReAlloc( HGLOBAL hmem, SIZE_T size, UINT flags ) +HGLOBAL WINAPI GlobalReAlloc( HGLOBAL handle, SIZE_T size, UINT flags ) { - return LocalReAlloc( hmem, size, flags ); + return LocalReAlloc( handle, size, flags ); } @@ -306,7 +308,7 @@ HGLOBAL WINAPI GlobalReAlloc( HGLOBAL hmem, SIZE_T size, UINT flags ) * Get the size of a global memory object. * * PARAMS - * hmem [I] Handle of the global memory object + * handle [I] Handle of the global memory object * * RETURNS * Failure: 0 @@ -316,44 +318,45 @@ HGLOBAL WINAPI GlobalReAlloc( HGLOBAL hmem, SIZE_T size, UINT flags ) * When the handle is invalid, last error is set to ERROR_INVALID_HANDLE * */ -SIZE_T WINAPI GlobalSize(HGLOBAL hmem) +SIZE_T WINAPI GlobalSize( HGLOBAL handle ) { + PGLOBAL32_INTERN mem; SIZE_T retval; - PGLOBAL32_INTERN pintern; - if (!((ULONG_PTR)hmem >> 16)) + TRACE_(globalmem)( "handle %p\n", handle ); + + if (!((ULONG_PTR)handle >> 16)) { SetLastError( ERROR_INVALID_HANDLE ); return 0; } - if (ISPOINTER( hmem )) + if (ISPOINTER( handle )) { - retval = HeapSize( GetProcessHeap(), 0, hmem ); + retval = HeapSize( GetProcessHeap(), 0, handle ); if (retval == ~(SIZE_T)0) /* It might be a GMEM_MOVEABLE data pointer */ { - retval = HeapSize( GetProcessHeap(), 0, (char *)hmem - HGLOBAL_STORAGE ); + retval = HeapSize( GetProcessHeap(), 0, (char *)handle - HGLOBAL_STORAGE ); if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE; } } else { RtlLockHeap( GetProcessHeap() ); - pintern = HANDLE_TO_INTERN( hmem ); - - if (pintern->Magic == MAGIC_GLOBAL_USED) + mem = HANDLE_TO_INTERN( handle ); + if (mem->Magic == MAGIC_GLOBAL_USED) { - if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */ + if (!mem->Pointer) /* handle case of GlobalAlloc( ??,0) */ retval = 0; else { - retval = HeapSize( GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE ); + retval = HeapSize( GetProcessHeap(), 0, (char *)mem->Pointer - HGLOBAL_STORAGE ); if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE; } } else { - WARN( "invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic ); + WARN_(globalmem)( "invalid handle %p\n", handle ); SetLastError( ERROR_INVALID_HANDLE ); retval = 0; } @@ -367,36 +370,36 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem) /*********************************************************************** * GlobalWire (KERNEL32.@) */ -LPVOID WINAPI GlobalWire(HGLOBAL hmem) +void *WINAPI GlobalWire( HGLOBAL handle ) { - return GlobalLock( hmem ); + return GlobalLock( handle ); } /*********************************************************************** * GlobalUnWire (KERNEL32.@) */ -BOOL WINAPI GlobalUnWire(HGLOBAL hmem) +BOOL WINAPI GlobalUnWire( HGLOBAL handle ) { - return GlobalUnlock( hmem); + return GlobalUnlock( handle ); } /*********************************************************************** * GlobalFix (KERNEL32.@) */ -VOID WINAPI GlobalFix(HGLOBAL hmem) +VOID WINAPI GlobalFix( HGLOBAL handle ) { - GlobalLock( hmem ); + GlobalLock( handle ); } /*********************************************************************** * GlobalUnfix (KERNEL32.@) */ -VOID WINAPI GlobalUnfix(HGLOBAL hmem) +VOID WINAPI GlobalUnfix( HGLOBAL handle ) { - GlobalUnlock( hmem); + GlobalUnlock( handle ); } @@ -406,34 +409,36 @@ VOID WINAPI GlobalUnfix(HGLOBAL hmem) * Get information about a global memory object. * * PARAMS - * hmem [I] Handle of the global memory object + * handle [I] Handle of the global memory object * * RETURNS - * Failure: GMEM_INVALID_HANDLE, when the provided handle is invalid + * Failure: GMEM_INVALID_HANDLE, when the provided handle is invalid * Success: Value specifying allocation flags and lock count * */ -UINT WINAPI GlobalFlags(HGLOBAL hmem) +UINT WINAPI GlobalFlags( HGLOBAL handle ) { + PGLOBAL32_INTERN mem; DWORD retval; - PGLOBAL32_INTERN pintern; - if (ISPOINTER( hmem )) + TRACE_(globalmem)( "handle %p\n", handle ); + + if (ISPOINTER( handle )) { retval = 0; } else { RtlLockHeap( GetProcessHeap() ); - pintern = HANDLE_TO_INTERN( hmem ); - if (pintern->Magic == MAGIC_GLOBAL_USED) + mem = HANDLE_TO_INTERN( handle ); + if (mem->Magic == MAGIC_GLOBAL_USED) { - retval = pintern->LockCount + (pintern->Flags << 8); - if (pintern->Pointer == 0) retval |= GMEM_DISCARDED; + retval = mem->LockCount + (mem->Flags << 8); + if (mem->Pointer == 0) retval |= GMEM_DISCARDED; } else { - WARN( "invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic ); + WARN_(globalmem)( "invalid handle %p\n", handle ); SetLastError( ERROR_INVALID_HANDLE ); retval = GMEM_INVALID_HANDLE; }
1
0
0
0
Rémi Bernon : kernel32: Fix indentation of Global* functions.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: 48ebc410efb9644fa7cab53ee0747ca058a73c03 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=48ebc410efb9644fa7cab53e…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Mar 29 15:24:36 2022 +0200 kernel32: Fix indentation of Global* functions. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/heap.c | 171 +++++++++++++++++++++++++-------------------------- 1 file changed, 85 insertions(+), 86 deletions(-) diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index 8e767d03211..7e366eb991e 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -231,11 +231,10 @@ BOOL WINAPI GlobalUnlock(HGLOBAL hmem) * Handle: Success * NULL: Failure */ -HGLOBAL WINAPI GlobalHandle( - LPCVOID pmem /* [in] Pointer to global memory block */ -) { +HGLOBAL WINAPI GlobalHandle( LPCVOID pmem ) +{ HGLOBAL handle; - PGLOBAL32_INTERN maybe_intern; + PGLOBAL32_INTERN maybe_intern; LPCVOID test; if (!pmem) @@ -244,7 +243,7 @@ HGLOBAL WINAPI GlobalHandle( return 0; } - RtlLockHeap(GetProcessHeap()); + RtlLockHeap( GetProcessHeap() ); __TRY { handle = 0; @@ -252,22 +251,25 @@ HGLOBAL WINAPI GlobalHandle( /* note that if pmem is a pointer to a block allocated by */ /* GlobalAlloc with GMEM_MOVEABLE then magic test in HeapValidate */ /* will fail. */ - if (ISPOINTER(pmem)) { - if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, pmem )) { - handle = (HGLOBAL)pmem; /* valid fixed block */ + if (ISPOINTER( pmem )) + { + if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, pmem )) + { + handle = (HGLOBAL)pmem; /* valid fixed block */ break; } - handle = POINTER_TO_HANDLE(pmem); - } else - handle = (HGLOBAL)pmem; + handle = POINTER_TO_HANDLE( pmem ); + } + else handle = (HGLOBAL)pmem; /* Now test handle either passed in or retrieved from pointer */ maybe_intern = HANDLE_TO_INTERN( handle ); - if (maybe_intern->Magic == MAGIC_GLOBAL_USED) { + if (maybe_intern->Magic == MAGIC_GLOBAL_USED) + { test = maybe_intern->Pointer; if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, (const char *)test - HGLOBAL_STORAGE ) && /* obj(-handle) valid arena? */ - HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, maybe_intern )) /* intern valid arena? */ - break; /* valid moveable block */ + HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, maybe_intern )) /* intern valid arena? */ + break; /* valid moveable block */ } handle = 0; SetLastError( ERROR_INVALID_HANDLE ); @@ -278,12 +280,11 @@ HGLOBAL WINAPI GlobalHandle( handle = 0; } __ENDTRY - RtlUnlockHeap(GetProcessHeap()); + RtlUnlockHeap( GetProcessHeap() ); return handle; } - /*********************************************************************** * GlobalReAlloc (KERNEL32.@) * @@ -317,50 +318,49 @@ HGLOBAL WINAPI GlobalReAlloc( HGLOBAL hmem, SIZE_T size, UINT flags ) */ SIZE_T WINAPI GlobalSize(HGLOBAL hmem) { - SIZE_T retval; - PGLOBAL32_INTERN pintern; - - if (!((ULONG_PTR)hmem >> 16)) - { - SetLastError(ERROR_INVALID_HANDLE); - return 0; - } - - if(ISPOINTER(hmem)) - { - retval=HeapSize(GetProcessHeap(), 0, hmem); - - if (retval == ~(SIZE_T)0) /* It might be a GMEM_MOVEABLE data pointer */ - { - retval = HeapSize(GetProcessHeap(), 0, (char*)hmem - HGLOBAL_STORAGE); - if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE; - } - } - else - { - RtlLockHeap(GetProcessHeap()); - pintern=HANDLE_TO_INTERN(hmem); - - if(pintern->Magic==MAGIC_GLOBAL_USED) - { - if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */ - retval = 0; - else - { - retval = HeapSize(GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE ); - if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE; - } - } - else - { - WARN("invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic); - SetLastError(ERROR_INVALID_HANDLE); - retval=0; - } - RtlUnlockHeap(GetProcessHeap()); - } - if (retval == ~(SIZE_T)0) retval = 0; - return retval; + SIZE_T retval; + PGLOBAL32_INTERN pintern; + + if (!((ULONG_PTR)hmem >> 16)) + { + SetLastError( ERROR_INVALID_HANDLE ); + return 0; + } + + if (ISPOINTER( hmem )) + { + retval = HeapSize( GetProcessHeap(), 0, hmem ); + if (retval == ~(SIZE_T)0) /* It might be a GMEM_MOVEABLE data pointer */ + { + retval = HeapSize( GetProcessHeap(), 0, (char *)hmem - HGLOBAL_STORAGE ); + if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE; + } + } + else + { + RtlLockHeap( GetProcessHeap() ); + pintern = HANDLE_TO_INTERN( hmem ); + + if (pintern->Magic == MAGIC_GLOBAL_USED) + { + if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */ + retval = 0; + else + { + retval = HeapSize( GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE ); + if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE; + } + } + else + { + WARN( "invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic ); + SetLastError( ERROR_INVALID_HANDLE ); + retval = 0; + } + RtlUnlockHeap( GetProcessHeap() ); + } + if (retval == ~(SIZE_T)0) retval = 0; + return retval; } @@ -415,32 +415,31 @@ VOID WINAPI GlobalUnfix(HGLOBAL hmem) */ UINT WINAPI GlobalFlags(HGLOBAL hmem) { - DWORD retval; - PGLOBAL32_INTERN pintern; - - if(ISPOINTER(hmem)) - { - retval=0; - } - else - { - RtlLockHeap(GetProcessHeap()); - pintern=HANDLE_TO_INTERN(hmem); - if(pintern->Magic==MAGIC_GLOBAL_USED) - { - retval=pintern->LockCount + (pintern->Flags<<8); - if(pintern->Pointer==0) - retval|= GMEM_DISCARDED; - } - else - { - WARN("invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic); - SetLastError(ERROR_INVALID_HANDLE); - retval = GMEM_INVALID_HANDLE; - } - RtlUnlockHeap(GetProcessHeap()); - } - return retval; + DWORD retval; + PGLOBAL32_INTERN pintern; + + if (ISPOINTER( hmem )) + { + retval = 0; + } + else + { + RtlLockHeap( GetProcessHeap() ); + pintern = HANDLE_TO_INTERN( hmem ); + if (pintern->Magic == MAGIC_GLOBAL_USED) + { + retval = pintern->LockCount + (pintern->Flags << 8); + if (pintern->Pointer == 0) retval |= GMEM_DISCARDED; + } + else + { + WARN( "invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic ); + SetLastError( ERROR_INVALID_HANDLE ); + retval = GMEM_INVALID_HANDLE; + } + RtlUnlockHeap( GetProcessHeap() ); + } + return retval; }
1
0
0
0
Nikolay Sivov : wer: Use CRT memory allocation functions.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: 56c57f8ae220e403ff02051c5b11f6ae8db379b8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=56c57f8ae220e403ff02051c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Mar 29 15:11:49 2022 +0300 wer: Use CRT memory allocation functions. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wer/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/wer/main.c b/dlls/wer/main.c index 44c6718f310..b0f18b0568d 100644 --- a/dlls/wer/main.c +++ b/dlls/wer/main.c @@ -18,12 +18,12 @@ */ #include <stdarg.h> +#include <stdlib.h> #include "windef.h" #include "winbase.h" #include "winreg.h" #include "werapi.h" -#include "wine/heap.h" #include "wine/list.h" #include "wine/debug.h" @@ -219,7 +219,7 @@ HRESULT WINAPI WerReportCloseHandle(HREPORT hreport) if (!found) return E_INVALIDARG; - heap_free(report); + free(report); return S_OK; } @@ -259,7 +259,7 @@ HRESULT WINAPI WerReportCreate(PCWSTR eventtype, WER_REPORT_TYPE reporttype, PWE return E_INVALIDARG; } - report = heap_alloc_zero(FIELD_OFFSET(report_t, eventtype[lstrlenW(eventtype) + 1])); + report = calloc(1, FIELD_OFFSET(report_t, eventtype[lstrlenW(eventtype) + 1])); if (!report) return __HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
1
0
0
0
Dmitry Timoshkov : wined3d: Avoid calling _strnicmp() with limit -1.
by Alexandre Julliard
29 Mar '22
29 Mar '22
Module: wine Branch: master Commit: 0e4f31ac93f6fdbee5c8d147ae280e4442b9fead URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0e4f31ac93f6fdbee5c8d147…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Mar 29 16:02:20 2022 +0300 wined3d: Avoid calling _strnicmp() with limit -1. It's considered invalid by native ucrtbase (installed with winetricks). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/shader.c | 2 +- dlls/wined3d/shader_sm4.c | 2 +- dlls/wined3d/wined3d_main.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 6282883ed04..a296e34bc9f 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3736,7 +3736,7 @@ static struct wined3d_shader_signature_element *shader_find_signature_element(co for (i = 0; i < s->element_count; ++i) { if (e[i].stream_idx == stream_idx - && !_strnicmp(e[i].semantic_name, semantic_name, -1) + && !stricmp(e[i].semantic_name, semantic_name) && e[i].semantic_idx == semantic_idx) return &e[i]; } diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 868d9b3cc64..266b54d1d15 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -1319,7 +1319,7 @@ static void *shader_sm4_init(const DWORD *byte_code, size_t byte_code_size, struct wined3d_shader_signature_element *e = &output_signature->elements[i]; if (priv->shader_version.type == WINED3D_SHADER_TYPE_PIXEL - && _strnicmp(e->semantic_name, "SV_TARGET", -1)) + && stricmp(e->semantic_name, "SV_TARGET")) continue; if (e->register_idx >= ARRAY_SIZE(priv->output_map)) { diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 4f50e8aeb7d..35973e210b0 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -329,17 +329,17 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) } if (!get_config_key(hkey, appkey, env, "shader_backend", buffer, size)) { - if (!_strnicmp(buffer, "glsl", -1)) + if (!stricmp(buffer, "glsl")) { ERR_(winediag)("Using the GLSL shader backend.\n"); wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_GLSL; } - else if (!_strnicmp(buffer, "arb", -1)) + else if (!stricmp(buffer, "arb")) { ERR_(winediag)("Using the ARB shader backend.\n"); wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_ARB; } - else if (!_strnicmp(buffer, "none", -1)) + else if (!stricmp(buffer, "none")) { ERR_(winediag)("Disabling shader backends.\n"); wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_NONE;
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
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