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
June
May
April
March
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
February 2020
----- 2025 -----
June 2025
May 2025
April 2025
March 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
874 discussions
Start a n
N
ew thread
Jacek Caban : oleaut32: Return missing function custom data as VT_EMPTY.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: cdb72b091eec4075cbf2a95732237a069e612c09 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cdb72b091eec4075cbf2a957…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Feb 10 14:56:58 2020 +0100 oleaut32: Return missing function custom data as VT_EMPTY. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/tests/typelib.c | 24 ++++++++++++++++++++++++ dlls/oleaut32/typelib.c | 11 +++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 79861dd46f..e8956fb3b1 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -4798,13 +4798,17 @@ static void test_dump_typelib(const WCHAR *name) { ITypeLib *typelib; int ticount = ARRAY_SIZE(info); + CUSTDATA cust_data; int iface, func; + VARIANT v; + HRESULT hr; ole_check(LoadTypeLibEx(name, REGKIND_NONE, &typelib)); expect_eq(ITypeLib_GetTypeInfoCount(typelib), ticount, UINT, "%d"); for (iface = 0; iface < ticount; iface++) { const type_info *ti = &info[iface]; + ITypeInfo2 *typeinfo2; ITypeInfo *typeinfo; TYPEATTR *typeattr; BSTR bstrIfName; @@ -4845,6 +4849,9 @@ static void test_dump_typelib(const WCHAR *name) if (hr == S_OK) ITypeInfo_Release(typeinfo2); } + hr = ITypeInfo_QueryInterface(typeinfo, &IID_ITypeInfo2, (void**)&typeinfo2); + ok(hr == S_OK, "Could not get ITypeInfo2: %08x\n", hr); + for (func = 0; func < typeattr->cFuncs; func++) { const function_info *fn_info = &ti->funcs[func]; @@ -4893,10 +4900,27 @@ static void test_dump_typelib(const WCHAR *name) } expect_int(fn_info->params[desc->cParams].vt, (VARTYPE)-1); + V_VT(&v) = VT_ERROR; + hr = ITypeInfo2_GetFuncCustData(typeinfo2, func, &IID_NULL, &v); + ok(hr == S_OK, "GetFuncCustData failed: %08x\n", hr); + ok(V_VT(&v) == VT_EMPTY, "V_VT(&v) = %d\n", V_VT(&v)); + VariantClear(&v); + + V_VT(&v) = VT_ERROR; + hr = ITypeInfo2_GetFuncCustData(typeinfo2, func, &IID_IBaseIface, &v); + ok(hr == S_OK, "GetFuncCustData failed: %08x\n", hr); + ok(V_VT(&v) == VT_EMPTY, "V_VT(&v) = %d\n", V_VT(&v)); + VariantClear(&v); + + memset(&cust_data, 0, sizeof(cust_data)); + hr = ITypeInfo2_GetAllCustData(typeinfo2, &cust_data); ITypeInfo_ReleaseFuncDesc(typeinfo, desc); + ClearCustData(&cust_data); } ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); + + ITypeInfo2_Release(typeinfo2); ITypeInfo_Release(typeinfo); } ITypeLib_Release(typelib); diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 6375dc3de0..7020f68ba7 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -8387,8 +8387,8 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncCustData( VARIANT *pVarVal) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); - TLBCustData *pCData; const TLBFuncDesc *desc; + TLBCustData *data; UINT hrefoffset; HRESULT hr; @@ -8401,14 +8401,9 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncCustData( return hr; } - pCData = TLB_get_custdata_by_guid(&desc->custdata_list, guid); - if(!pCData) - return TYPE_E_ELEMENTNOTFOUND; - VariantInit(pVarVal); - VariantCopy(pVarVal, &pCData->data); - - return S_OK; + data = TLB_get_custdata_by_guid(&desc->custdata_list, guid); + return data ? VariantCopy(pVarVal, &data->data) : S_OK; } /* ITypeInfo2::GetParamCustData
1
0
0
0
Kevin Puetz : oleaut32: Use ITypeInfoImpl_GetInternalFuncDesc in ITypeInfo2_fnGetFuncCustData.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: af2edc175cae6e23bc24b618b0087510ad7edb03 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=af2edc175cae6e23bc24b618…
Author: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Date: Mon Feb 10 14:56:54 2020 +0100 oleaut32: Use ITypeInfoImpl_GetInternalFuncDesc in ITypeInfo2_fnGetFuncCustData. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/typelib.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 4d8bd256be..6375dc3de0 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1727,7 +1727,7 @@ static inline TLBVarDesc *TLB_get_vardesc_by_name(ITypeInfoImpl *typeinfo, const return NULL; } -static inline TLBCustData *TLB_get_custdata_by_guid(struct list *custdata_list, REFGUID guid) +static inline TLBCustData *TLB_get_custdata_by_guid(const struct list *custdata_list, REFGUID guid) { TLBCustData *cust_data; LIST_FOR_EACH_ENTRY(cust_data, custdata_list, TLBCustData, entry) @@ -8388,14 +8388,20 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncCustData( { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); TLBCustData *pCData; - TLBFuncDesc *pFDesc = &This->funcdescs[index]; + const TLBFuncDesc *desc; + UINT hrefoffset; + HRESULT hr; TRACE("%p %u %s %p\n", This, index, debugstr_guid(guid), pVarVal); - if(index >= This->typeattr.cFuncs) - return TYPE_E_ELEMENTNOTFOUND; + hr = ITypeInfoImpl_GetInternalFuncDesc((ITypeInfo *)iface, index, &desc, &hrefoffset); + if (FAILED(hr)) + { + WARN("description for function %d not found\n", index); + return hr; + } - pCData = TLB_get_custdata_by_guid(&pFDesc->custdata_list, guid); + pCData = TLB_get_custdata_by_guid(&desc->custdata_list, guid); if(!pCData) return TYPE_E_ELEMENTNOTFOUND;
1
0
0
0
Kevin Puetz : oleaut32: Return function description as TLBFuncDesc from ITypeInfoImpl_GetInternalDispatchFuncDesc.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: e9f8971398794beb825bb2c7b9780d938765302d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e9f8971398794beb825bb2c7…
Author: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Date: Mon Feb 10 14:56:49 2020 +0100 oleaut32: Return function description as TLBFuncDesc from ITypeInfoImpl_GetInternalDispatchFuncDesc. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/typelib.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index d2393c9c08..4d8bd256be 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -5883,7 +5883,7 @@ static void TLB_FreeVarDesc(VARDESC *var_desc) /* internal function to make the inherited interfaces' methods appear * part of the interface */ static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface, - UINT index, const FUNCDESC **ppFuncDesc, UINT *funcs, UINT *hrefoffset) + UINT index, const TLBFuncDesc **ppFuncDesc, UINT *funcs, UINT *hrefoffset) { ITypeInfoImpl *This = impl_from_ITypeInfo(iface); HRESULT hr; @@ -5926,11 +5926,11 @@ static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface, if (index >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; - *ppFuncDesc = &This->funcdescs[index].funcdesc; + *ppFuncDesc = &This->funcdescs[index]; return S_OK; } -static HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const FUNCDESC **func_desc, UINT *hrefoffset ) +static HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const TLBFuncDesc **func_desc, UINT *hrefoffset ) { ITypeInfoImpl *This = impl_from_ITypeInfo(iface); @@ -5940,7 +5940,7 @@ static HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, if (index >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; - *func_desc = &This->funcdescs[index].funcdesc; + *func_desc = &This->funcdescs[index]; return S_OK; } @@ -5985,7 +5985,7 @@ static HRESULT WINAPI ITypeInfo_fnGetFuncDesc( ITypeInfo2 *iface, UINT index, LPFUNCDESC *ppFuncDesc) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); - const FUNCDESC *internal_funcdesc; + const TLBFuncDesc *internal_funcdesc; HRESULT hr; UINT hrefoffset = 0; @@ -6006,7 +6006,7 @@ static HRESULT WINAPI ITypeInfo_fnGetFuncDesc( ITypeInfo2 *iface, UINT index, } hr = TLB_AllocAndInitFuncDesc( - internal_funcdesc, + &internal_funcdesc->funcdesc, ppFuncDesc, This->typeattr.typekind == TKIND_DISPATCH);
1
0
0
0
Jacek Caban : oleaut32: Move TKIND_DISPATCH logic to ITypeInfoImpl_GetInternalFuncDesc.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: af905ffec9103deab5cb33f5b481d0cc65d037a6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=af905ffec9103deab5cb33f5…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Feb 10 14:56:45 2020 +0100 oleaut32: Move TKIND_DISPATCH logic to ITypeInfoImpl_GetInternalFuncDesc. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/typelib.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 89d3940980..d2393c9c08 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -5880,17 +5880,6 @@ static void TLB_FreeVarDesc(VARDESC *var_desc) SysFreeString((BSTR)var_desc); } -HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const FUNCDESC **ppFuncDesc ) -{ - ITypeInfoImpl *This = impl_from_ITypeInfo(iface); - - if (index >= This->typeattr.cFuncs) - return TYPE_E_ELEMENTNOTFOUND; - - *ppFuncDesc = &This->funcdescs[index].funcdesc; - return S_OK; -} - /* internal function to make the inherited interfaces' methods appear * part of the interface */ static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface, @@ -5932,8 +5921,27 @@ static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface, if (index < implemented_funcs) return E_INVALIDARG; - return ITypeInfoImpl_GetInternalFuncDesc(iface, index - implemented_funcs, - ppFuncDesc); + index -= implemented_funcs; + + if (index >= This->typeattr.cFuncs) + return TYPE_E_ELEMENTNOTFOUND; + + *ppFuncDesc = &This->funcdescs[index].funcdesc; + return S_OK; +} + +static HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const FUNCDESC **func_desc, UINT *hrefoffset ) +{ + ITypeInfoImpl *This = impl_from_ITypeInfo(iface); + + if (This->typeattr.typekind == TKIND_DISPATCH) + return ITypeInfoImpl_GetInternalDispatchFuncDesc(iface, index, func_desc, NULL, hrefoffset); + + if (index >= This->typeattr.cFuncs) + return TYPE_E_ELEMENTNOTFOUND; + + *func_desc = &This->funcdescs[index].funcdesc; + return S_OK; } static inline void ITypeInfoImpl_ElemDescAddHrefOffset( LPELEMDESC pElemDesc, UINT hrefoffset) @@ -5989,13 +5997,8 @@ static HRESULT WINAPI ITypeInfo_fnGetFuncDesc( ITypeInfo2 *iface, UINT index, if (This->needs_layout) ICreateTypeInfo2_LayOut(&This->ICreateTypeInfo2_iface); - if (This->typeattr.typekind == TKIND_DISPATCH) - hr = ITypeInfoImpl_GetInternalDispatchFuncDesc((ITypeInfo *)iface, index, - &internal_funcdesc, NULL, - &hrefoffset); - else - hr = ITypeInfoImpl_GetInternalFuncDesc((ITypeInfo *)iface, index, - &internal_funcdesc); + hr = ITypeInfoImpl_GetInternalFuncDesc((ITypeInfo *)iface, index, + &internal_funcdesc, &hrefoffset); if (FAILED(hr)) { WARN("description for function %d not found\n", index);
1
0
0
0
Kevin Puetz : oleaut32: Fix handling resource IDs in paths when registering typelib helpdir.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: 5ecd6e4807d4b145a06e653dc1bb2f16678d0c14 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5ecd6e4807d4b145a06e653d…
Author: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Date: Mon Feb 10 14:56:39 2020 +0100 oleaut32: Fix handling resource IDs in paths when registering typelib helpdir. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/typelib.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index a65f432af0..89d3940980 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -722,17 +722,26 @@ HRESULT WINAPI RegisterTypeLib(ITypeLib *ptlib, const WCHAR *szFullPath, const W KEY_WRITE, NULL, &subKey, &disposition) == ERROR_SUCCESS) { BSTR freeHelpDir = NULL; - OLECHAR* pIndexStr; + WCHAR *file_name; /* if we created a new key, and helpDir was null, set the helpdir to the directory which contains the typelib. However, if we just opened an existing key, we leave the helpdir alone */ if ((disposition == REG_CREATED_NEW_KEY) && (szHelpDir == NULL)) { szHelpDir = freeHelpDir = SysAllocString(szFullPath); - pIndexStr = wcsrchr(szHelpDir, '\\'); - if (pIndexStr) { - *pIndexStr = 0; + file_name = wcsrchr(szHelpDir, '\\'); + if (file_name && file_name[0]) { + /* possible remove a numeric \index (resource-id) */ + WCHAR *end_ptr = file_name + 1; + while ('0' <= *end_ptr && *end_ptr <= '9') end_ptr++; + if (!*end_ptr) + { + *file_name = 0; + file_name = wcsrchr(szHelpDir, '\\'); + } } + if (file_name) + *file_name = 0; } /* if we have an szHelpDir, set it! */
1
0
0
0
Jacek Caban : oleaut32/tests: Add test of reference typelib caching.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: 2822b577d8a7eaece0623ce5fc55adde286ce8c6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2822b577d8a7eaece0623ce5…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Feb 10 14:56:33 2020 +0100 oleaut32/tests: Add test of reference typelib caching. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/tests/Makefile.in | 1 + dlls/oleaut32/tests/test_simple.idl | 34 ++++++++++++++++++++++++ dlls/oleaut32/tests/tmarshal.rc | 3 +++ dlls/oleaut32/tests/typelib.c | 53 ++++++++++++++++++++++++++++--------- 4 files changed, 78 insertions(+), 13 deletions(-) diff --git a/dlls/oleaut32/tests/Makefile.in b/dlls/oleaut32/tests/Makefile.in index 036c63d67d..098ea9deef 100644 --- a/dlls/oleaut32/tests/Makefile.in +++ b/dlls/oleaut32/tests/Makefile.in @@ -17,5 +17,6 @@ RC_SRCS = tmarshal.rc IDL_SRCS = \ test_reg.idl \ + test_simple.idl \ test_tlb.idl \ tmarshal.idl diff --git a/dlls/oleaut32/tests/test_simple.idl b/dlls/oleaut32/tests/test_simple.idl new file mode 100644 index 0000000000..fa0a08cad9 --- /dev/null +++ b/dlls/oleaut32/tests/test_simple.idl @@ -0,0 +1,34 @@ +/* + * Copyright 2020 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep ident +#pragma makedep typelib + +import "oaidl.idl"; /* needed by widl */ + +[uuid(8b05fe77-4a6c-4133-b9cd-8f00007af786)] +library base +{ + importlib("stdole2.tlb"); + + [uuid(b14b6bb5-904e-4ff9-b247-bd361f7a0004)] + interface IBaseIface : IDispatch + { + HRESULT simple_test(); + } +} diff --git a/dlls/oleaut32/tests/tmarshal.rc b/dlls/oleaut32/tests/tmarshal.rc index cbb3b18959..8ddfd8a529 100644 --- a/dlls/oleaut32/tests/tmarshal.rc +++ b/dlls/oleaut32/tests/tmarshal.rc @@ -35,3 +35,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* @makedep: test_reg.tlb */ 3 TYPELIB test_reg.tlb + +/* @makedep: test_simple.tlb */ +4 TL test_simple.tlb diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 2a84cd92e9..79861dd46f 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -41,6 +41,7 @@ #include "test_reg.h" #include "test_tlb.h" +#include "test_simple.h" #define expect_eq(expr, value, type, format) { type _ret = (expr); ok((value) == _ret, #expr " expected " format " got " format "\n", value, _ret); } #define expect_int(expr, value) expect_eq(expr, (int)(value), int, "%d") @@ -775,7 +776,7 @@ static void test_CreateDispTypeInfo(void) SysFreeString(methdata[3].szName); } -static void write_typelib(int res_no, const WCHAR *filename) +static void write_typelib(int res_no, const WCHAR *filename, const WCHAR *type) { DWORD written; HANDLE file; @@ -785,8 +786,8 @@ static void write_typelib(int res_no, const WCHAR *filename) file = CreateFileW( filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 ); ok( file != INVALID_HANDLE_VALUE, "file creation failed\n" ); if (file == INVALID_HANDLE_VALUE) return; - res = FindResourceA( GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(res_no), "TYPELIB" ); - ok( res != 0, "couldn't find resource\n" ); + res = FindResourceW( GetModuleHandleA(NULL), (const WCHAR *)MAKEINTRESOURCE(res_no), type ); + ok( res != 0, "couldn't find resource %d %s\n", res_no, debugstr_w(type) ); ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res )); WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL ); ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" ); @@ -820,12 +821,12 @@ static void test_invoke_func(ITypeInfo *typeinfo) ok(hres == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hres); } -static WCHAR *create_test_typelib(int res_no) +static WCHAR *create_test_typelib(int res_no, const WCHAR *type) { static WCHAR filename[MAX_PATH]; GetTempFileNameW(L".", L"tlb", 0, filename); - write_typelib(res_no, filename); + write_typelib(res_no, filename, type); return filename; } @@ -1028,7 +1029,7 @@ static void test_TypeInfo(void) ITypeInfo_Release(pTypeInfo); ITypeLib_Release(pTypeLib); - filename = create_test_typelib(3); + filename = create_test_typelib(3, L"TYPELIB"); hr = LoadTypeLib(filename, &pTypeLib); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -5036,7 +5037,7 @@ static void test_register_typelib(BOOL system_registration) if (pIsWow64Process) pIsWow64Process(GetCurrentProcess(), &is_wow64); - filename = create_test_typelib(3); + filename = create_test_typelib(3, L"TYPELIB"); hr = LoadTypeLibEx(filename, REGKIND_NONE, &typelib); ok(hr == S_OK, "got %08x\n", hr); @@ -5787,8 +5788,8 @@ static void test_LoadRegTypeLib(void) DeleteFileA("main.manifest"); /* create typelib file */ - write_typelib(1, L"test_actctx_tlb.tlb"); - write_typelib(3, L"test_actctx_tlb2.tlb"); + write_typelib(1, L"test_actctx_tlb.tlb", L"TYPELIB"); + write_typelib(3, L"test_actctx_tlb2.tlb", L"TYPELIB"); hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &tl); ok(hr == TYPE_E_LIBNOTREGISTERED, "got 0x%08x\n", hr); @@ -6388,11 +6389,11 @@ static void test_dep(void) { trace("Starting typelib dependency tests\n"); - refFilename = create_test_typelib(2); + refFilename = create_test_typelib(4, L"TL"); hr = LoadTypeLibEx(refFilename, REGKIND_NONE, &preftLib); ok(hr == S_OK, "got %08x\n", hr); - hr = ITypeLib_GetTypeInfoOfGuid(preftLib, &IID_ISimpleIface, &preftInfo); + hr = ITypeLib_GetTypeInfoOfGuid(preftLib, &IID_IBaseIface, &preftInfo); ok(hr == S_OK, "got %08x\n", hr); GetTempFileNameA(".", "tlb", 0, filename); @@ -6448,13 +6449,39 @@ static void test_dep(void) { ok(hr == S_OK, "got: %x\n", hr); hr = ITypeInfo_GetRefTypeInfo(ptInfo, refType, &ptInfoExt); - ok(hr == S_OK || broken(hr == TYPE_E_CANTLOADLIBRARY) /* win 2000 */, "got: %x\n", hr); + ok(hr == TYPE_E_CANTLOADLIBRARY, "got: %x\n", hr); ITypeInfo_Release(ptInfo); if(ptInfoExt) ITypeInfo_Release(ptInfoExt); ITypeLib_Release(ptLib); + hr = LoadTypeLibEx(filenameW, REGKIND_NONE, &ptLib); + ok(hr == S_OK, "got %08x\n", hr); + + hr = ITypeLib_GetTypeInfo(ptLib, 0, &ptInfo); + ok(hr == S_OK, "GetTypeInfo failed: %08x\n", hr); + + hr = ITypeInfo_GetRefTypeOfImplType(ptInfo, 0, &refType); + ok(hr == S_OK, "GetRefTypeOfImplType failed: %08x\n", hr); + + hr = ITypeInfo_GetRefTypeInfo(ptInfo, refType, &ptInfoExt); + ok(hr == TYPE_E_CANTLOADLIBRARY, "got: %x\n", hr); + + refFilename = create_test_typelib(4, L"TL"); + hr = LoadTypeLibEx(refFilename, REGKIND_NONE, &preftLib); + ok(hr == S_OK, "got %08x\n", hr); + + hr = ITypeInfo_GetRefTypeInfo(ptInfo, refType, &ptInfoExt); + ok(hr == S_OK, "got: %x\n", hr); + ITypeInfo_Release(ptInfoExt); + + ITypeLib_Release(preftLib); + DeleteFileW(refFilename); + + ITypeInfo_Release(ptInfo); + ITypeLib_Release(ptLib); + DeleteFileW(filenameW); } @@ -6580,7 +6607,7 @@ START_TEST(typelib) test_SetDocString(); test_FindName(); - if ((filename = create_test_typelib(2))) + if ((filename = create_test_typelib(2, L"TYPELIB"))) { test_dump_typelib( filename ); DeleteFileW( filename );
1
0
0
0
Kevin Puetz : oleaut32: Search cache for requested typeinfo in GetRefTypeInfo.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: dc96f63f3f87ff18425c0b11dfc989ca5431da3e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dc96f63f3f87ff18425c0b11…
Author: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Date: Mon Feb 10 14:56:28 2020 +0100 oleaut32: Search cache for requested typeinfo in GetRefTypeInfo. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/typelib.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 788d853f63..a65f432af0 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -7981,21 +7981,49 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( ITypeLib_AddRef(pTLib); result = S_OK; } else { - static const WCHAR TYPELIBW[] = {'T','Y','P','E','L','I','B',0}; - struct search_res_tlb_params params; - BSTR libnam; + /* Search in cached typelibs */ + ITypeLibImpl *entry; - TRACE("typeinfo in imported typelib that isn't already loaded\n"); + EnterCriticalSection(&cache_section); + LIST_FOR_EACH_ENTRY(entry, &tlb_cache, ITypeLibImpl, entry) + { + if (entry->guid + && IsEqualIID(&entry->guid->guid, TLB_get_guid_null(ref_type->pImpTLInfo->guid)) + && entry->ver_major == ref_type->pImpTLInfo->wVersionMajor + && entry->ver_minor == ref_type->pImpTLInfo->wVersionMinor + && entry->set_lcid == ref_type->pImpTLInfo->lcid) + { + TRACE("got cached %p\n", entry); + pTLib = (ITypeLib*)&entry->ITypeLib2_iface; + ITypeLib_AddRef(pTLib); + result = S_OK; + break; + } + } + LeaveCriticalSection(&cache_section); - /* Search in resource table */ - params.guid = TLB_get_guid_null(ref_type->pImpTLInfo->guid); - params.pTLib = NULL; - EnumResourceNamesW(NULL, TYPELIBW, search_res_tlb, (LONG_PTR)¶ms); - pTLib = params.pTLib; - result = S_OK; + if (!pTLib) + { + static const WCHAR TYPELIBW[] = {'T','Y','P','E','L','I','B',0}; + struct search_res_tlb_params params; + + TRACE("typeinfo in imported typelib that isn't already loaded\n"); + + /* Search in resource table */ + params.guid = TLB_get_guid_null(ref_type->pImpTLInfo->guid); + params.pTLib = NULL; + EnumResourceNamesW(NULL, TYPELIBW, search_res_tlb, (LONG_PTR)¶ms); + if(params.pTLib) + { + pTLib = params.pTLib; + result = S_OK; + } + } if (!pTLib) { + BSTR libnam; + /* Search on disk */ result = query_typelib_path(TLB_get_guid_null(ref_type->pImpTLInfo->guid), ref_type->pImpTLInfo->wVersionMajor,
1
0
0
0
Jacek Caban : oleaut32/tests: Use Unicode strings for file names.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: f7e357aa5f094367e59302f6c731eab2eb48b7af URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f7e357aa5f094367e59302f6…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Feb 10 14:56:20 2020 +0100 oleaut32/tests: Use Unicode strings for file names. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/tests/typelib.c | 58 +++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 4ffbaa9e2d..2a84cd92e9 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -775,14 +775,14 @@ static void test_CreateDispTypeInfo(void) SysFreeString(methdata[3].szName); } -static void write_typelib(int res_no, const char *filename) +static void write_typelib(int res_no, const WCHAR *filename) { DWORD written; HANDLE file; HRSRC res; void *ptr; - file = CreateFileA( filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 ); + file = CreateFileW( filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 ); ok( file != INVALID_HANDLE_VALUE, "file creation failed\n" ); if (file == INVALID_HANDLE_VALUE) return; res = FindResourceA( GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(res_no), "TYPELIB" ); @@ -820,11 +820,11 @@ static void test_invoke_func(ITypeInfo *typeinfo) ok(hres == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hres); } -static const char *create_test_typelib(int res_no) +static WCHAR *create_test_typelib(int res_no) { - static char filename[MAX_PATH]; + static WCHAR filename[MAX_PATH]; - GetTempFileNameA( ".", "tlb", 0, filename ); + GetTempFileNameW(L".", L"tlb", 0, filename); write_typelib(res_no, filename); return filename; } @@ -847,8 +847,7 @@ static void test_TypeInfo(void) VARIANT var, res, args[2]; UINT count, i; TYPEKIND kind; - const char *filenameA; - WCHAR filename[MAX_PATH]; + const WCHAR *filename; TYPEATTR *attr; LONG l; @@ -1029,8 +1028,7 @@ static void test_TypeInfo(void) ITypeInfo_Release(pTypeInfo); ITypeLib_Release(pTypeLib); - filenameA = create_test_typelib(3); - MultiByteToWideChar(CP_ACP, 0, filenameA, -1, filename, MAX_PATH); + filename = create_test_typelib(3); hr = LoadTypeLib(filename, &pTypeLib); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -1132,7 +1130,7 @@ static void test_TypeInfo(void) ITypeInfo_Release(pTypeInfo); ITypeLib_Release(pTypeLib); - DeleteFileA(filenameA); + DeleteFileW(filename); } static int WINAPI int_func( int a0, int a1, int a2, int a3, int a4 ) @@ -4180,16 +4178,14 @@ static int get_href_type(ITypeInfo *info, TYPEDESC *tdesc) return href_type; } -static void test_dump_typelib(const char *name) +static void test_dump_typelib(const WCHAR *name) { - WCHAR wszString[260]; ITypeInfo *info; ITypeLib *lib; int count; int i; - MultiByteToWideChar(CP_ACP, 0, name, -1, wszString, 260); - OLE_CHECK(LoadTypeLib(wszString, &lib)); + OLE_CHECK(LoadTypeLib(name, &lib)); printf("/*** Autogenerated data. Do not edit, change the generator above instead. ***/\n"); @@ -4797,15 +4793,13 @@ static const type_info info[] = { expect_hex(U(*(elem)).paramdesc.wParamFlags, (info)->wParamFlags); \ } -static void test_dump_typelib(const char *name) +static void test_dump_typelib(const WCHAR *name) { - WCHAR wszName[MAX_PATH]; ITypeLib *typelib; int ticount = ARRAY_SIZE(info); int iface, func; - MultiByteToWideChar(CP_ACP, 0, name, -1, wszName, MAX_PATH); - ole_check(LoadTypeLibEx(wszName, REGKIND_NONE, &typelib)); + ole_check(LoadTypeLibEx(name, REGKIND_NONE, &typelib)); expect_eq(ITypeLib_GetTypeInfoCount(typelib), ticount, UINT, "%d"); for (iface = 0; iface < ticount; iface++) { @@ -4998,8 +4992,7 @@ static void test_create_typelibs(void) static void test_register_typelib(BOOL system_registration) { HRESULT hr; - WCHAR filename[MAX_PATH]; - const char *filenameA; + WCHAR *filename; ITypeLib *typelib; WCHAR uuidW[40]; char key_name[MAX_PATH], uuid[40]; @@ -5043,8 +5036,7 @@ static void test_register_typelib(BOOL system_registration) if (pIsWow64Process) pIsWow64Process(GetCurrentProcess(), &is_wow64); - filenameA = create_test_typelib(3); - MultiByteToWideChar(CP_ACP, 0, filenameA, -1, filename, MAX_PATH); + filename = create_test_typelib(3); hr = LoadTypeLibEx(filename, REGKIND_NONE, &typelib); ok(hr == S_OK, "got %08x\n", hr); @@ -5057,7 +5049,7 @@ static void test_register_typelib(BOOL system_registration) { win_skip("Insufficient privileges to register typelib in the registry\n"); ITypeLib_Release(typelib); - DeleteFileA(filenameA); + DeleteFileW(filename); return; } ok(hr == S_OK, "got %08x\n", hr); @@ -5187,7 +5179,7 @@ static void test_register_typelib(BOOL system_registration) } ITypeLib_Release(typelib); - DeleteFileA( filenameA ); + DeleteFileW(filename); } static void test_LoadTypeLib(void) @@ -5795,8 +5787,8 @@ static void test_LoadRegTypeLib(void) DeleteFileA("main.manifest"); /* create typelib file */ - write_typelib(1, "test_actctx_tlb.tlb"); - write_typelib(3, "test_actctx_tlb2.tlb"); + write_typelib(1, L"test_actctx_tlb.tlb"); + write_typelib(3, L"test_actctx_tlb2.tlb"); hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &tl); ok(hr == TYPE_E_LIBNOTREGISTERED, "got 0x%08x\n", hr); @@ -6377,8 +6369,7 @@ static void test_stub(void) static void test_dep(void) { HRESULT hr; - const char *refFilename; - WCHAR refFilenameW[MAX_PATH]; + const WCHAR *refFilename; ITypeLib *preftLib; ITypeInfo *preftInfo; char filename[MAX_PATH]; @@ -6398,9 +6389,7 @@ static void test_dep(void) { trace("Starting typelib dependency tests\n"); refFilename = create_test_typelib(2); - MultiByteToWideChar(CP_ACP, 0, refFilename, -1, refFilenameW, MAX_PATH); - - hr = LoadTypeLibEx(refFilenameW, REGKIND_NONE, &preftLib); + hr = LoadTypeLibEx(refFilename, REGKIND_NONE, &preftLib); ok(hr == S_OK, "got %08x\n", hr); hr = ITypeLib_GetTypeInfoOfGuid(preftLib, &IID_ISimpleIface, &preftInfo); @@ -6447,8 +6436,7 @@ static void test_dep(void) { ITypeInfo_Release(preftInfo); ITypeLib_Release(preftLib); - - DeleteFileW(refFilenameW); + DeleteFileW(refFilename); hr = LoadTypeLibEx(filenameW, REGKIND_NONE, &ptLib); ok(hr == S_OK, "got: %x\n", hr); @@ -6569,7 +6557,7 @@ static void test_DeleteImplType(void) START_TEST(typelib) { - const char *filename; + const WCHAR *filename; init_function_pointers(); @@ -6595,7 +6583,7 @@ START_TEST(typelib) if ((filename = create_test_typelib(2))) { test_dump_typelib( filename ); - DeleteFileA( filename ); + DeleteFileW( filename ); } test_register_typelib(TRUE);
1
0
0
0
Biswapriyo Nath : include: Update winhttp.h.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: f7f67c467cd75a4607d9e021c4a12a854a380ecb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f7f67c467cd75a4607d9e021…
Author: Biswapriyo Nath <nathbappai(a)gmail.com> Date: Mon Feb 10 10:22:53 2020 +0100 include: Update winhttp.h. Signed-off-by: Biswapriyo Nath <nathbappai(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/winhttp.h | 230 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 227 insertions(+), 3 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=f7f67c467cd75a4607d9…
1
0
0
0
Derek Lesho : msctf: Always provide a context when from GetBase/Top.
by Alexandre Julliard
10 Feb '20
10 Feb '20
Module: wine Branch: master Commit: 3c09634eceb8e18d2578020fe9399ad35ac49398 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3c09634eceb8e18d2578020f…
Author: Derek Lesho <dlesho(a)codeweavers.com> Date: Tue Feb 4 15:47:41 2020 -0600 msctf: Always provide a context when from GetBase/Top. Signed-off-by: Derek Lesho <dlesho(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msctf/documentmgr.c | 20 +++++++++++++++++--- dlls/msctf/tests/inputprocessor.c | 26 ++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c index 44856db632..37d55557f5 100644 --- a/dlls/msctf/documentmgr.c +++ b/dlls/msctf/documentmgr.c @@ -44,6 +44,7 @@ typedef struct tagDocumentMgr { /* Aggregation */ ITfCompartmentMgr *CompartmentMgr; + ITfContext* initialContext; ITfContext* contextStack[2]; /* limit of 2 contexts */ ITfThreadMgrEventSink* ThreadMgrSink; @@ -87,6 +88,8 @@ static void DocumentMgr_Destructor(DocumentMgr *This) ITfThreadMgr_Release(tm); } + if (This->initialContext) + ITfContext_Release(This->initialContext); if (This->contextStack[0]) ITfContext_Release(This->contextStack[0]); if (This->contextStack[1]) @@ -222,14 +225,21 @@ static HRESULT WINAPI DocumentMgr_Pop(ITfDocumentMgr *iface, DWORD dwFlags) static HRESULT WINAPI DocumentMgr_GetTop(ITfDocumentMgr *iface, ITfContext **ppic) { DocumentMgr *This = impl_from_ITfDocumentMgr(iface); + ITfContext *tgt; + TRACE("(%p)\n",This); if (!ppic) return E_INVALIDARG; if (This->contextStack[0]) - ITfContext_AddRef(This->contextStack[0]); + tgt = This->contextStack[0]; + else + tgt = This->initialContext; + + if (tgt) + ITfContext_AddRef(tgt); - *ppic = This->contextStack[0]; + *ppic = tgt; return S_OK; } @@ -245,8 +255,10 @@ static HRESULT WINAPI DocumentMgr_GetBase(ITfDocumentMgr *iface, ITfContext **pp if (This->contextStack[1]) tgt = This->contextStack[1]; - else + else if (This->contextStack[0]) tgt = This->contextStack[0]; + else + tgt = This->initialContext; if (tgt) ITfContext_AddRef(tgt); @@ -342,6 +354,7 @@ static const ITfSourceVtbl DocumentMgrSourceVtbl = HRESULT DocumentMgr_Constructor(ITfThreadMgrEventSink *ThreadMgrSink, ITfDocumentMgr **ppOut) { DocumentMgr *This; + DWORD cookie; This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(DocumentMgr)); if (This == NULL) @@ -354,6 +367,7 @@ HRESULT DocumentMgr_Constructor(ITfThreadMgrEventSink *ThreadMgrSink, ITfDocumen list_init(&This->TransitoryExtensionSink); CompartmentMgr_Constructor((IUnknown*)&This->ITfDocumentMgr_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); + Context_Constructor(processId,NULL,&This->ITfDocumentMgr_iface, &This->initialContext, &cookie); *ppOut = &This->ITfDocumentMgr_iface; TRACE("returning %p\n", *ppOut); diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index 81e692d1d2..f21042a794 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -1639,10 +1639,10 @@ static HRESULT TextEditSink_Constructor(ITfTextEditSink **ppOut) static void test_startSession(void) { HRESULT hr; - DWORD cnt; + DWORD cnt, initial_ctx_cnt; DWORD editCookie; ITfDocumentMgr *dmtest; - ITfContext *cxt,*cxt2,*cxt3,*cxtTest; + ITfContext *cxt,*cxt2,*cxt3,*cxtTest,*initial_ctx; ITextStoreACP *ts = NULL; TfClientId cid2 = 0; ITfThreadMgrEx *tmex; @@ -1684,6 +1684,23 @@ static void test_startSession(void) hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&g_dm); ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n"); + test_OnPushContext = SINK_EXPECTED; + test_OnInitDocumentMgr = SINK_EXPECTED; + + /* For some reason, even when the object isn't initialized, this yields a context */ + hr = ITfDocumentMgr_GetBase(g_dm, &initial_ctx); + ok(SUCCEEDED(hr), "GetBase Failed\n"); + hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest); + ok(SUCCEEDED(hr), "GetTop Failed\n"); + ok(cxtTest == initial_ctx, "GetTop != GetBase\n"); + + ok(initial_ctx != NULL, "Expected initial context\n"); + initial_ctx_cnt = check_context_refcount(initial_ctx); + hr = ITfContext_GetDocumentMgr(initial_ctx,&dmtest); + ok(hr == S_OK, "ITfContext_GetDocumentMgr failed with %x\n",hr); + ok(dmtest == g_dm, "Wrong documentmgr\n"); + ITfDocumentMgr_Release(dmtest); + test_EnumDocumentMgr(g_tm,g_dm,NULL); hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&dmtest); @@ -1740,6 +1757,7 @@ static void test_startSession(void) test_OnPushContext = SINK_EXPECTED; test_ACP_AdviseSink = SINK_EXPECTED; test_OnInitDocumentMgr = SINK_EXPECTED; + hr = ITfDocumentMgr_Push(g_dm, cxt); ok(SUCCEEDED(hr),"Push Failed\n"); ok(check_context_refcount(cxt) > cnt, "Ref count did not increase\n"); @@ -1749,6 +1767,9 @@ static void test_startSession(void) test_EnumContexts(g_dm, cxt); + /* the initial context is released with the document manager */ + ok(initial_ctx_cnt == check_context_refcount(initial_ctx), "Context ref count changed after documentmgr initialization\n"); + hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest); ok(SUCCEEDED(hr),"GetTop Failed\n"); ok(cxtTest == cxt, "Wrong context on top\n"); @@ -1859,6 +1880,7 @@ static void test_startSession(void) ITfContext_Release(cxt); ITfContext_Release(cxt2); ITfContext_Release(cxt3); + ITfContext_Release(initial_ctx); ITextStoreACP_Release(ts); }
1
0
0
0
← Newer
1
...
57
58
59
60
61
62
63
...
88
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
Results per page:
10
25
50
100
200