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
August 2020
----- 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
692 discussions
Start a n
N
ew thread
Nikolay Sivov : combase: Move CoWaitForMultipleHandles().
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: e56061bb4cb619f05f16c614fcb8fad5e4be1a5e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e56061bb4cb619f05f16c614…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Aug 19 11:29:12 2020 +0300 combase: Move CoWaitForMultipleHandles(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/combase/combase.c | 163 +++++++++++++++++++++++++++++++++++++ dlls/combase/combase.spec | 2 +- dlls/combase/combase_private.h | 40 ++++++++- dlls/combase/marshal.c | 3 +- dlls/ole32/compobj.c | 179 ----------------------------------------- dlls/ole32/ole32.spec | 2 +- 6 files changed, 206 insertions(+), 183 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=e56061bb4cb619f05f16…
1
0
0
0
Nikolay Sivov : combase: Move CoRegisterInitializeSpy()/CoRevokeInitializeSpy().
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: c9586634d4109547f8b28d827d34968b85039409 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c9586634d4109547f8b28d82…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Aug 19 11:29:11 2020 +0300 combase: Move CoRegisterInitializeSpy()/CoRevokeInitializeSpy(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/combase/combase.c | 95 +++++++++++++++++++++++++++++++++++++++ dlls/combase/combase.spec | 4 +- dlls/ole32/compobj.c | 110 ---------------------------------------------- dlls/ole32/ole32.spec | 4 +- 4 files changed, 99 insertions(+), 114 deletions(-) diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index 52a159d7fe..114ea89e05 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -65,6 +65,26 @@ struct progidredirect_data ULONG clsid_offset; }; +struct init_spy +{ + struct list entry; + IInitializeSpy *spy; + unsigned int id; +}; + +static struct init_spy *get_spy_entry(struct tlsdata *tlsdata, unsigned int id) +{ + struct init_spy *spy; + + LIST_FOR_EACH_ENTRY(spy, &tlsdata->spies, struct init_spy, entry) + { + if (id == spy->id && spy->spy) + return spy; + } + + return NULL; +} + static NTSTATUS create_key(HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr) { NTSTATUS status = NtCreateKey((HANDLE *)retkey, access, attr, 0, NULL, 0, NULL); @@ -1426,3 +1446,78 @@ HRESULT WINAPI CoSwitchCallContext(IUnknown *context, IUnknown **old_context) return S_OK; } + +/****************************************************************************** + * CoRegisterInitializeSpy (combase.@) + */ +HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie) +{ + struct tlsdata *tlsdata; + struct init_spy *entry; + unsigned int id; + HRESULT hr; + + TRACE("%p, %p\n", spy, cookie); + + if (!spy || !cookie) + return E_INVALIDARG; + + if (FAILED(hr = com_get_tlsdata(&tlsdata))) + return hr; + + hr = IInitializeSpy_QueryInterface(spy, &IID_IInitializeSpy, (void **)&spy); + if (FAILED(hr)) + return hr; + + entry = heap_alloc(sizeof(*entry)); + if (!entry) + { + IInitializeSpy_Release(spy); + return E_OUTOFMEMORY; + } + + entry->spy = spy; + + id = 0; + while (get_spy_entry(tlsdata, id) != NULL) + { + id++; + } + + entry->id = id; + list_add_head(&tlsdata->spies, &entry->entry); + + cookie->u.HighPart = GetCurrentThreadId(); + cookie->u.LowPart = entry->id; + + return S_OK; +} + +/****************************************************************************** + * CoRevokeInitializeSpy (combase.@) + */ +HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie) +{ + struct tlsdata *tlsdata; + struct init_spy *spy; + HRESULT hr; + + TRACE("%s\n", wine_dbgstr_longlong(cookie.QuadPart)); + + if (cookie.u.HighPart != GetCurrentThreadId()) + return E_INVALIDARG; + + if (FAILED(hr = com_get_tlsdata(&tlsdata))) + return hr; + + if (!(spy = get_spy_entry(tlsdata, cookie.u.LowPart))) return E_INVALIDARG; + + IInitializeSpy_Release(spy->spy); + spy->spy = NULL; + if (!tlsdata->spies_lock) + { + list_remove(&spy->entry); + heap_free(spy); + } + return S_OK; +} diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 55ba999a37..0842681078 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -140,7 +140,7 @@ @ stub CoReactivateObject @ stub CoRegisterActivationFilter @ stdcall CoRegisterClassObject(ptr ptr long long ptr) ole32.CoRegisterClassObject -@ stdcall CoRegisterInitializeSpy(ptr ptr) ole32.CoRegisterInitializeSpy +@ stdcall CoRegisterInitializeSpy(ptr ptr) @ stdcall CoRegisterMallocSpy(ptr) @ stdcall CoRegisterMessageFilter(ptr ptr) ole32.CoRegisterMessageFilter @ stdcall CoRegisterPSClsid(ptr ptr) ole32.CoRegisterPSClsid @@ -152,7 +152,7 @@ @ stub CoRetireServer @ stdcall CoRevertToSelf() @ stdcall CoRevokeClassObject(long) ole32.CoRevokeClassObject -@ stdcall CoRevokeInitializeSpy(int64) ole32.CoRevokeInitializeSpy +@ stdcall CoRevokeInitializeSpy(int64) @ stdcall CoRevokeMallocSpy() @ stub CoSetCancelObject @ stdcall CoSetErrorInfo(long ptr) SetErrorInfo diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 4e7cd3c667..2a5e9f573a 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -1775,19 +1775,6 @@ DWORD WINAPI CoBuildVersion(void) return (rmm<<16)+rup; } -static struct init_spy *get_spy_entry(struct oletls *info, unsigned int id) -{ - struct init_spy *spy; - - LIST_FOR_EACH_ENTRY(spy, &info->spies, struct init_spy, entry) - { - if (id == spy->id && spy->spy) - return spy; - } - - return NULL; -} - /* * When locked, don't modify list (unless we add a new head), so that it's * safe to iterate it. Freeing of list entries is delayed and done on unlock. @@ -1811,103 +1798,6 @@ static void unlock_init_spies(struct oletls *info) } } -/****************************************************************************** - * CoRegisterInitializeSpy [OLE32.@] - * - * Add a Spy that watches CoInitializeEx calls - * - * PARAMS - * spy [I] Pointer to IUnknown interface that will be QueryInterface'd. - * cookie [II] cookie receiver - * - * RETURNS - * Success: S_OK if not already initialized, S_FALSE otherwise. - * Failure: HRESULT code. - * - * SEE ALSO - * CoInitializeEx - */ -HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie) -{ - struct oletls *info = COM_CurrentInfo(); - struct init_spy *entry; - unsigned int id; - HRESULT hr; - - TRACE("(%p, %p)\n", spy, cookie); - - if (!spy || !cookie || !info) - { - if (!info) - WARN("Could not allocate tls\n"); - return E_INVALIDARG; - } - - hr = IInitializeSpy_QueryInterface(spy, &IID_IInitializeSpy, (void **)&spy); - if (FAILED(hr)) - return hr; - - entry = heap_alloc(sizeof(*entry)); - if (!entry) - { - IInitializeSpy_Release(spy); - return E_OUTOFMEMORY; - } - - entry->spy = spy; - - id = 0; - while (get_spy_entry(info, id) != NULL) - { - id++; - } - - entry->id = id; - list_add_head(&info->spies, &entry->entry); - - cookie->HighPart = GetCurrentThreadId(); - cookie->LowPart = entry->id; - - return S_OK; -} - -/****************************************************************************** - * CoRevokeInitializeSpy [OLE32.@] - * - * Remove a spy that previously watched CoInitializeEx calls - * - * PARAMS - * cookie [I] The cookie obtained from a previous CoRegisterInitializeSpy call - * - * RETURNS - * Success: S_OK if a spy is removed - * Failure: E_INVALIDARG - * - * SEE ALSO - * CoInitializeEx - */ -HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie) -{ - struct oletls *info = COM_CurrentInfo(); - struct init_spy *spy; - - TRACE("(%s)\n", wine_dbgstr_longlong(cookie.QuadPart)); - - if (!info || cookie.HighPart != GetCurrentThreadId()) - return E_INVALIDARG; - - if (!(spy = get_spy_entry(info, cookie.LowPart))) return E_INVALIDARG; - - IInitializeSpy_Release(spy->spy); - spy->spy = NULL; - if (!info->spies_lock) - { - list_remove(&spy->entry); - heap_free(spy); - } - return S_OK; -} - HRESULT enter_apartment( struct oletls *info, DWORD model ) { HRESULT hr = S_OK; diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index b64b511409..a4837bd6ff 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -66,7 +66,7 @@ @ stub CoQueryReleaseObject @ stdcall CoRegisterChannelHook(ptr ptr) @ stdcall CoRegisterClassObject(ptr ptr long long ptr) -@ stdcall CoRegisterInitializeSpy(ptr ptr) +@ stdcall CoRegisterInitializeSpy(ptr ptr) combase.CoRegisterInitializeSpy @ stdcall CoRegisterMallocSpy(ptr) combase.CoRegisterMallocSpy @ stdcall CoRegisterMessageFilter(ptr ptr) @ stdcall CoRegisterPSClsid(ptr ptr) @@ -77,7 +77,7 @@ @ stdcall CoResumeClassObjects() @ stdcall CoRevertToSelf() combase.CoRevertToSelf @ stdcall CoRevokeClassObject(long) -@ stdcall CoRevokeInitializeSpy(int64) +@ stdcall CoRevokeInitializeSpy(int64) combase.CoRevokeInitializeSpy @ stdcall CoRevokeMallocSpy() combase.CoRevokeMallocSpy @ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) combase.CoSetProxyBlanket @ stdcall CoSetState(ptr)
1
0
0
0
Nikolay Sivov : combase: Move CoSwitchCallContext().
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: 5fbfee619d8ec6b82b1eeda1af244ed47ee7ba90 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5fbfee619d8ec6b82b1eeda1…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Aug 19 11:29:10 2020 +0300 combase: Move CoSwitchCallContext(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/combase/combase.c | 20 ++++++++++++++++++++ dlls/combase/combase.spec | 2 +- dlls/ole32/compobj.c | 29 ----------------------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index c4a7f71912..52a159d7fe 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -1406,3 +1406,23 @@ HRESULT WINAPI CoGetCallContext(REFIID riid, void **obj) return IUnknown_QueryInterface(tlsdata->call_state, riid, obj); } + +/*********************************************************************** + * CoSwitchCallContext (combase.@) + */ +HRESULT WINAPI CoSwitchCallContext(IUnknown *context, IUnknown **old_context) +{ + struct tlsdata *tlsdata; + HRESULT hr; + + TRACE("%p, %p\n", context, old_context); + + if (FAILED(hr = com_get_tlsdata(&tlsdata))) + return hr; + + /* Reference counts are not touched. */ + *old_context = tlsdata->call_state; + tlsdata->call_state = context; + + return S_OK; +} diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 8293c9de25..55ba999a37 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -158,7 +158,7 @@ @ stdcall CoSetErrorInfo(long ptr) SetErrorInfo @ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) @ stdcall CoSuspendClassObjects() ole32.CoSuspendClassObjects -@ stdcall CoSwitchCallContext(ptr ptr) ole32.CoSwitchCallContext +@ stdcall CoSwitchCallContext(ptr ptr) @ stdcall CoTaskMemAlloc(long) @ stdcall CoTaskMemFree(ptr) @ stdcall CoTaskMemRealloc(ptr long) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 2dc2d417e0..4e7cd3c667 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -3458,35 +3458,6 @@ HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, void *pvReserved) return S_OK; } -/*********************************************************************** - * CoSwitchCallContext [OLE32.@] - * - * Switches the context of the currently executing server call in the current - * thread. - * - * PARAMS - * pObject [I] Pointer to new context object - * ppOldObject [O] Pointer to memory that will receive old context object pointer - * - * RETURNS - * Success: S_OK. - * Failure: HRESULT code. - */ -HRESULT WINAPI CoSwitchCallContext(IUnknown *pObject, IUnknown **ppOldObject) -{ - struct oletls *info = COM_CurrentInfo(); - - TRACE("(%p, %p)\n", pObject, ppOldObject); - - if (!info) - return E_OUTOFMEMORY; - - *ppOldObject = info->call_state; - info->call_state = pObject; /* CoSwitchCallContext does not addref nor release objects */ - - return S_OK; -} - static BOOL COM_PeekMessage(struct apartment *apt, MSG *msg) { /* first try to retrieve messages for incoming COM calls to the apartment window */ diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index 4323755019..b64b511409 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -82,7 +82,7 @@ @ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) combase.CoSetProxyBlanket @ stdcall CoSetState(ptr) @ stdcall CoSuspendClassObjects() -@ stdcall CoSwitchCallContext(ptr ptr) +@ stdcall CoSwitchCallContext(ptr ptr) combase.CoSwitchCallContext @ stdcall CoTaskMemAlloc(long) combase.CoTaskMemAlloc @ stdcall CoTaskMemFree(ptr) combase.CoTaskMemFree @ stdcall CoTaskMemRealloc(ptr long) combase.CoTaskMemRealloc
1
0
0
0
Nikolay Sivov : combase: Move CoGetCallContext().
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: 06a90f7f115b7df8f29cff70827d35a561dfb23a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=06a90f7f115b7df8f29cff70…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Aug 19 11:29:09 2020 +0300 combase: Move CoGetCallContext(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/combase/combase.c | 19 +++++++++++++++++++ dlls/combase/combase.spec | 2 +- dlls/ole32/compobj.c | 29 ----------------------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 21 insertions(+), 31 deletions(-) diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index cceb36a593..c4a7f71912 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -1387,3 +1387,22 @@ void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void) { CoFreeUnusedLibrariesEx(INFINITE, 0); } + +/*********************************************************************** + * CoGetCallContext (combase.@) + */ +HRESULT WINAPI CoGetCallContext(REFIID riid, void **obj) +{ + struct tlsdata *tlsdata; + HRESULT hr; + + TRACE("%s, %p\n", debugstr_guid(riid), obj); + + if (FAILED(hr = com_get_tlsdata(&tlsdata))) + return hr; + + if (!tlsdata->call_state) + return RPC_E_CALL_COMPLETE; + + return IUnknown_QueryInterface(tlsdata->call_state, riid, obj); +} diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 8a91088ca4..8293c9de25 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -97,7 +97,7 @@ @ stdcall CoGetActivationState(int128 long ptr) @ stub CoGetApartmentID @ stdcall CoGetApartmentType(ptr ptr) ole32.CoGetApartmentType -@ stdcall CoGetCallContext(ptr ptr) ole32.CoGetCallContext +@ stdcall CoGetCallContext(ptr ptr) @ stdcall CoGetCallState(long ptr) @ stdcall CoGetCallerTID(ptr) ole32.CoGetCallerTID @ stub CoGetCancelObject diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 350508ac9a..2dc2d417e0 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -3458,35 +3458,6 @@ HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, void *pvReserved) return S_OK; } -/*********************************************************************** - * CoGetCallContext [OLE32.@] - * - * Gets the context of the currently executing server call in the current - * thread. - * - * PARAMS - * riid [I] Context interface to return. - * ppv [O] Pointer to memory that will receive the context on return. - * - * RETURNS - * Success: S_OK. - * Failure: HRESULT code. - */ -HRESULT WINAPI CoGetCallContext(REFIID riid, void **ppv) -{ - struct oletls *info = COM_CurrentInfo(); - - TRACE("(%s, %p)\n", debugstr_guid(riid), ppv); - - if (!info) - return E_OUTOFMEMORY; - - if (!info->call_state) - return RPC_E_CALL_COMPLETE; - - return IUnknown_QueryInterface(info->call_state, riid, ppv); -} - /*********************************************************************** * CoSwitchCallContext [OLE32.@] * diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index f21f6429ca..4323755019 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -27,7 +27,7 @@ @ stdcall CoFreeUnusedLibrariesEx(long long) @ stdcall CoGetActivationState(int128 long ptr) combase.CoGetActivationState @ stdcall CoGetApartmentType(ptr ptr) -@ stdcall CoGetCallContext(ptr ptr) +@ stdcall CoGetCallContext(ptr ptr) combase.CoGetCallContext @ stdcall CoGetCallState(long ptr) combase.CoGetCallState @ stdcall CoGetCallerTID(ptr) @ stdcall CoGetClassObject(ptr long ptr ptr ptr)
1
0
0
0
Damjan Jovanovic : riched20: Implement ITextRange::StartOf() and ITextRange::EndOf() for tomCharacter.
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: 7a347c20dce8b55f6f72dea7f289eb0c13f85cb9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7a347c20dce8b55f6f72dea7…
Author: Damjan Jovanovic <damjan.jov(a)gmail.com> Date: Wed Aug 19 05:19:52 2020 +0200 riched20: Implement ITextRange::StartOf() and ITextRange::EndOf() for tomCharacter. Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/richole.c | 100 ++++++++++++++++++++++++++++++++++++++---- dlls/riched20/tests/richole.c | 64 +++++++++++++++++++++++++++ 2 files changed, 156 insertions(+), 8 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index c7a84b6e78..47d8442d5c 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -2153,17 +2153,91 @@ static HRESULT WINAPI ITextRange_fnSelect(ITextRange *me) return S_OK; } +static HRESULT textrange_startof(ITextRange *range, LONG unit, LONG extend, LONG *delta) +{ + HRESULT hr; + LONG start, end; + LONG moved; + + ITextRange_GetStart(range, &start); + ITextRange_GetEnd(range, &end); + + switch (unit) + { + case tomCharacter: + { + moved = 0; + if (extend == tomMove) { + if (start != end) { + ITextRange_SetEnd(range, start); + moved = -1; + } + } + if (delta) + *delta = moved; + hr = moved ? S_OK : S_FALSE; + break; + } + default: + FIXME("unit %d is not supported\n", unit); + return E_NOTIMPL; + } + return hr; +} + static HRESULT WINAPI ITextRange_fnStartOf(ITextRange *me, LONG unit, LONG extend, LONG *delta) { ITextRangeImpl *This = impl_from_ITextRange(me); - FIXME("(%p)->(%d %d %p): stub\n", This, unit, extend, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, extend, delta); if (!This->child.reole) return CO_E_RELEASED; - return E_NOTIMPL; + return textrange_startof(me, unit, extend, delta); +} + +static HRESULT textrange_endof(ITextRange *range, ME_TextEditor *editor, LONG unit, LONG extend, LONG *delta) +{ + HRESULT hr; + LONG old_start, old_end, new_end; + LONG moved; + + ITextRange_GetStart(range, &old_start); + ITextRange_GetEnd(range, &old_end); + + switch (unit) + { + case tomCharacter: + { + moved = 0; + new_end = old_end; + if (old_end == 0) { + ME_Cursor cursor; + ME_CursorFromCharOfs(editor, old_end, &cursor); + moved = ME_MoveCursorChars(editor, &cursor, 1, TRUE); + new_end = old_end + moved; + } else { + if (extend == tomMove) { + if (old_start != old_end) { + moved = 1; + } + } + } + ITextRange_SetEnd(range, new_end); + if (extend == tomMove) + ITextRange_SetStart(range, new_end); + if (delta) + *delta = moved; + hr = moved ? S_OK : S_FALSE; + break; + } + default: + FIXME("unit %d is not supported\n", unit); + return E_NOTIMPL; + } + return hr; } static HRESULT WINAPI ITextRange_fnEndOf(ITextRange *me, LONG unit, LONG extend, @@ -2171,12 +2245,12 @@ static HRESULT WINAPI ITextRange_fnEndOf(ITextRange *me, LONG unit, LONG extend, { ITextRangeImpl *This = impl_from_ITextRange(me); - FIXME("(%p)->(%d %d %p): stub\n", This, unit, extend, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, extend, delta); if (!This->child.reole) return CO_E_RELEASED; - return E_NOTIMPL; + return textrange_endof(me, This->child.reole->editor, unit, extend, delta); } static HRESULT textrange_move(ITextRange *range, ME_TextEditor *editor, LONG unit, LONG count, LONG *delta) @@ -5064,26 +5138,36 @@ static HRESULT WINAPI ITextSelection_fnStartOf(ITextSelection *me, LONG unit, LO LONG *delta) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL; + HRESULT hr; - FIXME("(%p)->(%d %d %p): stub\n", This, unit, extend, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, extend, delta); if (!This->reOle) return CO_E_RELEASED; - return E_NOTIMPL; + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + hr = textrange_startof(range, unit, extend, delta); + ITextRange_Release(range); + return hr; } static HRESULT WINAPI ITextSelection_fnEndOf(ITextSelection *me, LONG unit, LONG extend, LONG *delta) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL; + HRESULT hr; - FIXME("(%p)->(%d %d %p): stub\n", This, unit, extend, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, extend, delta); if (!This->reOle) return CO_E_RELEASED; - return E_NOTIMPL; + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + hr = textrange_endof(range, This->reOle->editor, unit, extend, delta); + ITextRange_Release(range); + return hr; } static HRESULT WINAPI ITextSelection_fnMove(ITextSelection *me, LONG unit, LONG count, LONG *delta) diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 7fde2ca232..16ff1fafa6 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -3912,6 +3912,68 @@ static void test_character_move(ITextRange *range, int textlen, int i, int j, LO } } +static void test_character_startof(ITextRange *range, int textlen, int i, int j) +{ + HRESULT hr; + LONG delta; + + hr = ITextRange_SetRange(range, i, j); + ok(SUCCEEDED(hr), "got 0x%08x\n", hr); + hr = ITextRange_StartOf(range, tomCharacter, tomMove, &delta); + if (i == j) { + ok(hr == S_FALSE, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr); + ok(delta == 0, "(%d,%d) tomMove got delta %d\n", i, j, delta); + } else { + ok(hr == S_OK, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr); + ok(delta == -1, "(%d,%d) tomMove got delta %d\n", i, j, delta); + } + CHECK_RANGE(range, i, i); + + hr = ITextRange_SetRange(range, i, j); + ok(SUCCEEDED(hr), "got 0x%08x\n", hr); + hr = ITextRange_StartOf(range, tomCharacter, tomExtend, &delta); + ok(hr == S_FALSE, "(%d,%d) tomExtend got hr=0x%08x\n", i, j, hr); + ok(delta == 0, "(%d,%d) tomExtend got delta %d\n", i, j, delta); + CHECK_RANGE(range, i, j); +} + +static void test_character_endof(ITextRange *range, int textlen, int i, int j) +{ + HRESULT hr; + LONG end; + LONG delta; + + hr = ITextRange_SetRange(range, i, j); + ok(SUCCEEDED(hr), "got 0x%08x\n", hr); + hr = ITextRange_EndOf(range, tomCharacter, tomMove, &delta); + + /* A character "end", apparently cannot be before the very first character */ + end = j; + if (j == 0) + ++end; + + if (i == end) { + ok(hr == S_FALSE, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr); + ok(delta == 0, "(%d,%d) tomMove got delta %d\n", i, j, delta); + } else { + ok(hr == S_OK, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr); + ok(delta == 1, "(%d,%d) tomMove got delta %d\n", i, j, delta); + } + CHECK_RANGE(range, end, end); + + hr = ITextRange_SetRange(range, i, j); + ok(SUCCEEDED(hr), "got 0x%08x\n", hr); + hr = ITextRange_EndOf(range, tomCharacter, tomExtend, &delta); + if (0 < j) { + ok(hr == S_FALSE, "(%d,%d) tomExtend got hr=0x%08x\n", i, j, hr); + ok(delta == 0, "(%d,%d) tomExtend got delta %d\n", i, j, delta); + } else { + ok(hr == S_OK, "(%d,%d) tomExtend got hr=0x%08x\n", i, j, hr); + ok(delta == 1, "(%d,%d) tomExtend got delta %d\n", i, j, delta); + } + CHECK_RANGE(range, i, end); +} + static void test_character_movement(void) { static const char test_text1[] = "ab\n c"; @@ -3940,6 +4002,8 @@ static void test_character_movement(void) test_character_movestart(range, textlen, i, j, target); test_character_move(range, textlen, i, j, target); } + test_character_startof(range, textlen, i, j); + test_character_endof(range, textlen, i, j); } }
1
0
0
0
Damjan Jovanovic : riched20: Implement ITextRange::Move() for tomCharacter.
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: 55d4cf27afba05860682da729e85196113f0ddbc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=55d4cf27afba05860682da72…
Author: Damjan Jovanovic <damjan.jov(a)gmail.com> Date: Wed Aug 19 05:19:47 2020 +0200 riched20: Implement ITextRange::Move() for tomCharacter. Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/richole.c | 75 ++++++++++++++++++++++++++++++++++++++++--- dlls/riched20/tests/richole.c | 47 +++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 4 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index c30db2841c..c7a84b6e78 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -2179,16 +2179,78 @@ static HRESULT WINAPI ITextRange_fnEndOf(ITextRange *me, LONG unit, LONG extend, return E_NOTIMPL; } +static HRESULT textrange_move(ITextRange *range, ME_TextEditor *editor, LONG unit, LONG count, LONG *delta) +{ + LONG old_start, old_end, new_start, new_end; + LONG move_by; + LONG moved; + HRESULT hr = S_OK; + + if (!count) + { + if (delta) + *delta = 0; + return S_FALSE; + } + + ITextRange_GetStart(range, &old_start); + ITextRange_GetEnd(range, &old_end); + switch (unit) + { + case tomCharacter: + { + ME_Cursor cursor; + + if (count > 0) { + ME_CursorFromCharOfs(editor, old_end, &cursor); + move_by = count; + if (old_start != old_end) + --move_by; + } else { + ME_CursorFromCharOfs(editor, old_start, &cursor); + move_by = count; + if (old_start != old_end) + ++move_by; + } + moved = ME_MoveCursorChars(editor, &cursor, move_by, FALSE); + if (count > 0) { + new_end = old_end + moved; + new_start = new_end; + if (old_start != old_end) + ++moved; + } else { + new_start = old_start + moved; + new_end = new_start; + if (old_start != old_end) + --moved; + } + if (delta) { + *delta = moved; + } + break; + } + default: + FIXME("unit %d is not supported\n", unit); + return E_NOTIMPL; + } + if (moved == 0) + hr = S_FALSE; + ITextRange_SetStart(range, new_start); + ITextRange_SetEnd(range, new_end); + + return hr; +} + static HRESULT WINAPI ITextRange_fnMove(ITextRange *me, LONG unit, LONG count, LONG *delta) { ITextRangeImpl *This = impl_from_ITextRange(me); - FIXME("(%p)->(%d %d %p): stub\n", This, unit, count, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, count, delta); if (!This->child.reole) return CO_E_RELEASED; - return E_NOTIMPL; + return textrange_move(me, This->child.reole->editor, unit, count, delta); } static HRESULT textrange_movestart(ITextRange *range, ME_TextEditor *editor, LONG unit, LONG count, LONG *delta) @@ -5027,13 +5089,18 @@ static HRESULT WINAPI ITextSelection_fnEndOf(ITextSelection *me, LONG unit, LONG static HRESULT WINAPI ITextSelection_fnMove(ITextSelection *me, LONG unit, LONG count, LONG *delta) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL; + HRESULT hr; - FIXME("(%p)->(%d %d %p): stub\n", This, unit, count, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, count, delta); if (!This->reOle) return CO_E_RELEASED; - return E_NOTIMPL; + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + hr = textrange_movestart(range, This->reOle->editor, unit, count, delta); + ITextRange_Release(range); + return hr; } static HRESULT WINAPI ITextSelection_fnMoveStart(ITextSelection *me, LONG unit, LONG count, diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 5f903aa1ac..7fde2ca232 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -3866,6 +3866,52 @@ static void test_character_moveend(ITextRange *range, int textlen, int i, int j, } } +static void test_character_move(ITextRange *range, int textlen, int i, int j, LONG target) +{ + HRESULT hr; + LONG move_by; + LONG delta = 0; + LONG expected_delta; + LONG expected_location = target; + + if (expected_location < 0) + expected_location = 0; + else if (expected_location > textlen) + expected_location = textlen; + + if (target <= i) { + move_by = target - i; + expected_delta = expected_location - i; + if (i != j) { + --move_by; + --expected_delta; + } + } else if (j <= target) { + move_by = target - j; + expected_delta = expected_location - j; + if (i != j) { + ++move_by; + ++expected_delta; + } + } else { + /* There's no way to move to a point between start and end: */ + return; + } + + hr = ITextRange_SetRange(range, i, j); + ok(SUCCEEDED(hr), "got 0x%08x\n", hr); + hr = ITextRange_Move(range, tomCharacter, move_by, &delta); + if (expected_delta == 0) { + ok(hr == S_FALSE, "(%d,%d) move by %d got hr=0x%08x\n", i, j, move_by, hr); + ok(delta == 0, "(%d,%d) move by %d got delta %d\n", i, j, move_by, delta); + CHECK_RANGE(range, expected_location, expected_location); + } else { + ok(hr == S_OK, "(%d,%d) move by %d got hr=0x%08x\n", i, j, move_by, hr); + ok(delta == expected_delta, "(%d,%d) move by %d got delta %d\n", i, j, move_by, delta); + CHECK_RANGE(range, expected_location, expected_location); + } +} + static void test_character_movement(void) { static const char test_text1[] = "ab\n c"; @@ -3892,6 +3938,7 @@ static void test_character_movement(void) for (target = -2; target <= textlen + 3; target++) { test_character_moveend(range, textlen, i, j, target); test_character_movestart(range, textlen, i, j, target); + test_character_move(range, textlen, i, j, target); } } }
1
0
0
0
Damjan Jovanovic : riched20: Implement ITextRange::MoveStart() and ITextRange::MoveEnd() for tomCharacter.
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: 41915acaed6c6dffb0333ca8f16991ec3c56a09d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=41915acaed6c6dffb0333ca8…
Author: Damjan Jovanovic <damjan.jov(a)gmail.com> Date: Wed Aug 19 05:19:39 2020 +0200 riched20: Implement ITextRange::MoveStart() and ITextRange::MoveEnd() for tomCharacter. Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/richole.c | 77 ++++++++++++++++++++++++++++++---- dlls/riched20/tests/richole.c | 98 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 166 insertions(+), 9 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index 7c281ab364..c30db2841c 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -2191,20 +2191,63 @@ static HRESULT WINAPI ITextRange_fnMove(ITextRange *me, LONG unit, LONG count, L return E_NOTIMPL; } +static HRESULT textrange_movestart(ITextRange *range, ME_TextEditor *editor, LONG unit, LONG count, LONG *delta) +{ + LONG old_start, old_end, new_start, new_end; + HRESULT hr = S_OK; + + if (!count) + { + if (delta) + *delta = 0; + return S_FALSE; + } + + ITextRange_GetStart(range, &old_start); + ITextRange_GetEnd(range, &old_end); + switch (unit) + { + case tomCharacter: + { + ME_Cursor cursor; + LONG moved; + + ME_CursorFromCharOfs(editor, old_start, &cursor); + moved = ME_MoveCursorChars(editor, &cursor, count, FALSE); + new_start = old_start + moved; + new_end = old_end; + if (new_end < new_start) + new_end = new_start; + if (delta) + *delta = moved; + break; + } + default: + FIXME("unit %d is not supported\n", unit); + return E_NOTIMPL; + } + if (new_start == old_start) + hr = S_FALSE; + ITextRange_SetStart(range, new_start); + ITextRange_SetEnd(range, new_end); + + return hr; +} + static HRESULT WINAPI ITextRange_fnMoveStart(ITextRange *me, LONG unit, LONG count, LONG *delta) { ITextRangeImpl *This = impl_from_ITextRange(me); - FIXME("(%p)->(%d %d %p): stub\n", This, unit, count, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, count, delta); if (!This->child.reole) return CO_E_RELEASED; - return E_NOTIMPL; + return textrange_movestart(me, This->child.reole->editor, unit, count, delta); } -static HRESULT textrange_moveend(ITextRange *range, LONG unit, LONG count, LONG *delta) +static HRESULT textrange_moveend(ITextRange *range, ME_TextEditor *editor, LONG unit, LONG count, LONG *delta) { LONG old_start, old_end, new_start, new_end; HRESULT hr = S_OK; @@ -2220,6 +2263,21 @@ static HRESULT textrange_moveend(ITextRange *range, LONG unit, LONG count, LONG ITextRange_GetEnd(range, &old_end); switch (unit) { + case tomCharacter: + { + ME_Cursor cursor; + LONG moved; + + ME_CursorFromCharOfs(editor, old_end, &cursor); + moved = ME_MoveCursorChars(editor, &cursor, count, TRUE); + new_start = old_start; + new_end = old_end + moved; + if (new_end < new_start) + new_start = new_end; + if (delta) + *delta = moved; + break; + } case tomStory: if (count < 0) new_start = new_end = 0; @@ -2260,7 +2318,7 @@ static HRESULT WINAPI ITextRange_fnMoveEnd(ITextRange *me, LONG unit, LONG count if (!This->child.reole) return CO_E_RELEASED; - return textrange_moveend(me, unit, count, delta); + return textrange_moveend(me, This->child.reole->editor, unit, count, delta); } static HRESULT WINAPI ITextRange_fnMoveWhile(ITextRange *me, VARIANT *charset, LONG count, @@ -4982,13 +5040,18 @@ static HRESULT WINAPI ITextSelection_fnMoveStart(ITextSelection *me, LONG unit, LONG *delta) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL; + HRESULT hr; - FIXME("(%p)->(%d %d %p): stub\n", This, unit, count, delta); + TRACE("(%p)->(%d %d %p)\n", This, unit, count, delta); if (!This->reOle) return CO_E_RELEASED; - return E_NOTIMPL; + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + hr = textrange_movestart(range, This->reOle->editor, unit, count, delta); + ITextRange_Release(range); + return hr; } static HRESULT WINAPI ITextSelection_fnMoveEnd(ITextSelection *me, LONG unit, LONG count, @@ -5004,7 +5067,7 @@ static HRESULT WINAPI ITextSelection_fnMoveEnd(ITextSelection *me, LONG unit, LO return CO_E_RELEASED; ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); - hr = textrange_moveend(range, unit, count, delta); + hr = textrange_moveend(range, This->reOle->editor, unit, count, delta); ITextRange_Release(range); return hr; } diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 70646202f0..5f903aa1ac 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -3694,7 +3694,7 @@ static void test_Expand(void) ITextRange_Release(range); } -static void test_MoveEnd(void) +static void test_MoveEnd_story(void) { static const char test_text1[] = "Word1 Word2"; IRichEditOle *reole = NULL; @@ -3808,6 +3808,99 @@ static void test_MoveEnd(void) ITextRange_Release(range); } +static void test_character_movestart(ITextRange *range, int textlen, int i, int j, LONG target) +{ + HRESULT hr; + LONG delta = 0; + LONG expected_delta; + LONG expected_start = target; + + if (expected_start < 0) + expected_start = 0; + else if (expected_start > textlen) + expected_start = textlen; + expected_delta = expected_start - i; + hr = ITextRange_SetRange(range, i, j); + ok(SUCCEEDED(hr), "got 0x%08x\n", hr); + hr = ITextRange_MoveStart(range, tomCharacter, target - i, &delta); + if (expected_start == i) { + ok(hr == S_FALSE, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - i, hr); + ok(delta == 0, "(%d,%d) move by %d got delta %d\n", i, j, target - i, delta); + CHECK_RANGE(range, i, j); + } else { + ok(hr == S_OK, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - i, hr); + ok(delta == expected_delta, "(%d,%d) move by %d got delta %d\n", i, j, target - i, delta); + if (expected_start <= j) + CHECK_RANGE(range, expected_start, j); + else + CHECK_RANGE(range, expected_start, expected_start); + } +} + +static void test_character_moveend(ITextRange *range, int textlen, int i, int j, LONG target) +{ + HRESULT hr; + LONG delta; + LONG expected_delta; + LONG expected_end = target; + + if (expected_end < 0) + expected_end = 0; + else if (expected_end > textlen + 1) + expected_end = textlen + 1; + expected_delta = expected_end - j; + hr = ITextRange_SetRange(range, i, j); + ok(SUCCEEDED(hr), "got 0x%08x\n", hr); + hr = ITextRange_MoveEnd(range, tomCharacter, target - j, &delta); + if (expected_end == j) { + ok(hr == S_FALSE, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - j, hr); + ok(delta == 0, "(%d,%d) move by %d got delta %d\n", i, j, target - j, delta); + CHECK_RANGE(range, i, j); + } else { + ok(hr == S_OK, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - j, hr); + ok(delta == expected_delta, "(%d,%d) move by %d got delta %d\n", i, j, target - j, delta); + if (i <= expected_end) + CHECK_RANGE(range, i, expected_end); + else + CHECK_RANGE(range, expected_end, expected_end); + } +} + +static void test_character_movement(void) +{ + static const char test_text1[] = "ab\n c"; + IRichEditOle *reole = NULL; + ITextDocument *doc = NULL; + ITextRange *range; + ITextSelection *selection; + HRESULT hr; + HWND hwnd; + int i, j; + const int textlen = strlen(test_text1); + + create_interfaces(&hwnd, &reole, &doc, &selection); + SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1); + + hr = ITextDocument_Range(doc, 0, 0, &range); + ok(hr == S_OK, "got 0x%08x\n", hr); + + /* Exhaustive test of every possible combination of (start,end) locations, + * against every possible target location to move to. */ + for (i = 0; i <= textlen; i++) { + for (j = i; j <= textlen; j++) { + LONG target; + for (target = -2; target <= textlen + 3; target++) { + test_character_moveend(range, textlen, i, j, target); + test_character_movestart(range, textlen, i, j, target); + } + } + } + + release_interfaces(&hwnd, &reole, &doc, NULL); + ITextSelection_Release(selection); + ITextRange_Release(range); +} + START_TEST(richole) { /* Must explicitly LoadLibrary(). The test has no references to functions in @@ -3846,5 +3939,6 @@ START_TEST(richole) test_GetStoryLength(); test_ITextSelection_GetDuplicate(); test_Expand(); - test_MoveEnd(); + test_MoveEnd_story(); + test_character_movement(); }
1
0
0
0
Ziqing Hui : windowscodecs/tests: Add macro BLOCK_WIDTH and BLOCK_HEIGHT.
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: c525dae7abce37ac9968d5720fd985e33ef7dc83 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c525dae7abce37ac9968d572…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Wed Aug 19 10:04:05 2020 +0800 windowscodecs/tests: Add macro BLOCK_WIDTH and BLOCK_HEIGHT. Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/tests/ddsformat.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index 18ce0a241a..790c28315a 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -30,6 +30,9 @@ #define MAKE_RGB565(r, g, b) ((WORD)(((BYTE)(r) << 11) | ((BYTE)(g) << 5) | (BYTE)(b))) #define MAKE_ARGB(a, r, g, b) (((DWORD)(a) << 24) | ((DWORD)(r) << 16) | ((DWORD)(g) << 8) | (DWORD)(b)) +#define BLOCK_WIDTH 4 +#define BLOCK_HEIGHT 4 + /* 1x1 uncompressed(Alpha) DDS image */ static BYTE test_dds_alpha[] = { 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -645,10 +648,10 @@ static void decode_block(const BYTE *block_data, UINT block_count, DXGI_FORMAT f buffer[x + y * width] = rgb565_to_argb(color_value, alpha_value); } - block_x += 4; + block_x += BLOCK_WIDTH; if (block_x >= width) { block_x = 0; - block_y += 4; + block_y += BLOCK_HEIGHT; } } } @@ -883,8 +886,8 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod expected_block_width = 1; expected_block_height = 1; } else { - expected_block_width = 4; - expected_block_height = 4; + expected_block_width = BLOCK_WIDTH; + expected_block_height = BLOCK_HEIGHT; } hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, NULL);
1
0
0
0
Ziqing Hui : windowscodecs/tests: Merge decode_bc*() into a single function.
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: b447bd97e55e2e6a88f872c4fb7a37f5e251a0e9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b447bd97e55e2e6a88f872c4…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Wed Aug 19 10:03:37 2020 +0800 windowscodecs/tests: Merge decode_bc*() into a single function. Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/tests/ddsformat.c | 208 ++++++++++++++--------------------- 1 file changed, 80 insertions(+), 128 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=b447bd97e55e2e6a88f8…
1
0
0
0
Ziqing Hui : windowscodecs/tests: Add tests for decoding BC3 format.
by Alexandre Julliard
19 Aug '20
19 Aug '20
Module: wine Branch: master Commit: 8e599287780c2aef7ecae1e35f597e534d7f626e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8e599287780c2aef7ecae1e3…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Wed Aug 19 10:03:04 2020 +0800 windowscodecs/tests: Add tests for decoding BC3 format. Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/tests/ddsformat.c | 67 +++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index 8f283b3f0f..b28d4938ab 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -629,6 +629,67 @@ static void decode_bc2(const BYTE *blocks, UINT block_count, UINT width, UINT he } } +static void decode_bc3(const BYTE *block_data, UINT block_count, UINT width, UINT height, DWORD *buffer) +{ + static const UINT BLOCK_SIZE = 16; + + int i, j, color_index, alpha_index, block_x, block_y, x, y; + const BYTE *block, *color_indices, *alpha_indices; + WORD color[4]; + BYTE alpha[8]; + + block_x = 0; + block_y = 0; + + for (i = 0; i < block_count; i++) + { + block = block_data + i * BLOCK_SIZE; + + color[0] = *((WORD *)(block + 8)); + color[1] = *((WORD *)(block + 10)); + color[2] = MAKE_RGB565(((GET_RGB565_R(color[0]) * 2 + GET_RGB565_R(color[1]) + 1) / 3), + ((GET_RGB565_G(color[0]) * 2 + GET_RGB565_G(color[1]) + 1) / 3), + ((GET_RGB565_B(color[0]) * 2 + GET_RGB565_B(color[1]) + 1) / 3)); + color[3] = MAKE_RGB565(((GET_RGB565_R(color[0]) + GET_RGB565_R(color[1]) * 2 + 1) / 3), + ((GET_RGB565_G(color[0]) + GET_RGB565_G(color[1]) * 2 + 1) / 3), + ((GET_RGB565_B(color[0]) + GET_RGB565_B(color[1]) * 2 + 1) / 3)); + + alpha[0] = *block; + alpha[1] = *(block + 1); + if (alpha[0] > alpha[1]) { + for (j = 2; j < 8; j++) + { + alpha[j] = (BYTE)((alpha[0] * (8 - j) + alpha[1] * (j - 1) + 3) / 7); + } + } else { + for (j = 2; j < 6; j++) + { + alpha[j] = (BYTE)((alpha[0] * (6 - j) + alpha[1] * (j - 1) + 2) / 5); + } + alpha[6] = 0; + alpha[7] = 0xFF; + } + + alpha_indices = block + 2; + color_indices = block + 12; + for (j = 0; j < 16; j++) + { + x = block_x + j % 4; + y = block_y + j / 4; + if (x >= width || y >= height) continue; + alpha_index = (*((DWORD *)(alpha_indices + (j / 8) * 3)) >> ((j % 8) * 3)) & 0x7; + color_index = (color_indices[j / 4] >> ((j % 4) * 2)) & 0x3; + buffer[x + y * width] = rgb565_to_argb(color[color_index], alpha[alpha_index]); + } + + block_x += 4; + if (block_x >= width) { + block_x = 0; + block_y += 4; + } + } +} + static BOOL color_match(DWORD color_a, DWORD color_b) { static const int tolerance = 8; @@ -1080,7 +1141,8 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr); if (format_info.DxgiFormat == DXGI_FORMAT_BC1_UNORM || - format_info.DxgiFormat == DXGI_FORMAT_BC2_UNORM ) { + format_info.DxgiFormat == DXGI_FORMAT_BC2_UNORM || + format_info.DxgiFormat == DXGI_FORMAT_BC3_UNORM ) { switch (format_info.DxgiFormat) { case DXGI_FORMAT_BC1_UNORM: @@ -1089,6 +1151,9 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra case DXGI_FORMAT_BC2_UNORM: decode_bc2(test_data[i].data + block_offset, width_in_blocks * height_in_blocks, frame_width, frame_height, pixels); break; + case DXGI_FORMAT_BC3_UNORM: + decode_bc3(test_data[i].data + block_offset, width_in_blocks * height_in_blocks, frame_width, frame_height, pixels); + break; default: break; }
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
70
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
Results per page:
10
25
50
100
200