Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- 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
September 2018
- 70 participants
- 1549 messages
[PATCH v5 3/4] riched20: Add IID_ITextDocument2Old support for ITextServices_QueryInterface().
by Jactry Zeng
Superseded patch 151801.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=20613
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com>
---
dlls/riched20/tests/txtsrv.c | 34 ++++++++++++++++++++++++++++++++++
dlls/riched20/txtsrv.c | 5 +++--
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index a8cf6ff1ad..1aa08f89a4 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -904,6 +904,7 @@ static void test_QueryInterface(void)
HRESULT hres;
IRichEditOle *reole, *txtsrv_reole;
ITextDocument *txtdoc, *txtsrv_txtdoc;
+ ITextDocument2Old *txtdoc2old, *txtsrv_txtdoc2old;
ULONG refcount;
if(!init_texthost(&txtserv, &host))
@@ -930,6 +931,17 @@ static void test_QueryInterface(void)
ITextDocument_Release(txtdoc);
refcount = get_refcount((IUnknown *)txtserv);
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+
+ hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
+ ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+ refcount = get_refcount((IUnknown *)txtsrv_reole);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+
+ ITextDocument2Old_Release(txtdoc2old);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
IRichEditOle_Release(txtsrv_reole);
refcount = get_refcount((IUnknown *)txtserv);
ok(refcount == 1, "got wrong ref count: %d\n", refcount);
@@ -956,6 +968,28 @@ static void test_QueryInterface(void)
refcount = get_refcount((IUnknown *)txtserv);
ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+ /* ITextDocument2Old */
+ hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument2Old, (void **)&txtsrv_txtdoc2old);
+ ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+ refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+
+ hres = ITextDocument2Old_QueryInterface(txtsrv_txtdoc2old, &IID_IRichEditOle, (void **)&reole);
+ ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08x\n", hres);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+ refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+
+ IRichEditOle_Release(reole);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+ ITextDocument2Old_Release(txtsrv_txtdoc2old);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+
ITextServices_Release(txtserv);
ITextHost_Release(host);
}
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index 5ab3322e6b..cf957cff89 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -78,11 +78,12 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID r
*ppv = &This->IUnknown_inner;
else if (IsEqualIID(riid, &IID_ITextServices))
*ppv = &This->ITextServices_iface;
- else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument)) {
+ else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument) ||
+ IsEqualIID(riid, &IID_ITextDocument2Old)) {
if (!This->editor->reOle)
if (!CreateIRichEditOle(This->outer_unk, This->editor, (void **)(&This->editor->reOle)))
return E_OUTOFMEMORY;
- if (IsEqualIID(riid, &IID_ITextDocument))
+ if (IsEqualIID(riid, &IID_ITextDocument) || IsEqualIID(riid, &IID_ITextDocument2Old))
ME_GetITextDocument2OldInterface(This->editor->reOle, ppv);
else
*ppv = This->editor->reOle;
--
2.19.0
Sept. 26, 2018
[PATCH v5 2/4] riched20: Add stub for ITextDocument2Old interface.
by Jactry Zeng
Superseded patch 151800.
ChangLog:
v4: Add tests of type info.
v5: Better tests of type info.
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com>
---
dlls/riched20/editor.h | 2 +-
dlls/riched20/richole.c | 435 ++++++++++++++++++++++++----------
dlls/riched20/tests/richole.c | 50 ++++
dlls/riched20/txtsrv.c | 2 +-
4 files changed, 361 insertions(+), 128 deletions(-)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 141c63aca9..eba6d35fc7 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -233,7 +233,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, BOOL selected) DECLSPE
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
-void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN;
+void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN;
/* editor.c */
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 11b9920b57..dc1a3b8405 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -46,6 +46,7 @@ DEFINE_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xa
DEFINE_GUID(IID_ITextHost, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
DEFINE_GUID(IID_ITextHost2, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
+DEFINE_GUID(IID_ITextDocument2Old, 0x01c25500, 0x4268, 0x11d1, 0x88, 0x3a, 0x3c, 0x8b, 0x00, 0xc1, 0x00, 0x00);
DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
DEFINE_GUID(IID_ITextFont, 0x8cc497c3, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
@@ -208,7 +209,7 @@ enum range_update_op {
typedef struct IRichEditOleImpl {
IUnknown IUnknown_inner;
IRichEditOle IRichEditOle_iface;
- ITextDocument ITextDocument_iface;
+ ITextDocument2Old ITextDocument2Old_iface;
IUnknown *outer_unk;
LONG ref;
@@ -267,9 +268,9 @@ static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface);
}
-static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
+static inline IRichEditOleImpl *impl_from_ITextDocument2Old(ITextDocument2Old *iface)
{
- return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface);
+ return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument2Old_iface);
}
static inline IRichEditOleImpl *impl_from_IUnknown(IUnknown *iface)
@@ -943,8 +944,8 @@ static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, R
*ppvObj = &This->IUnknown_inner;
else if (IsEqualGUID(riid, &IID_IRichEditOle))
*ppvObj = &This->IRichEditOle_iface;
- else if (IsEqualGUID(riid, &IID_ITextDocument))
- *ppvObj = &This->ITextDocument_iface;
+ else if (IsEqualGUID(riid, &IID_ITextDocument) || IsEqualGUID(riid, &IID_ITextDocument2Old))
+ *ppvObj = &This->ITextDocument2Old_iface;
if (*ppvObj)
{
IUnknown_AddRef((IUnknown *)*ppvObj);
@@ -3859,43 +3860,38 @@ static HRESULT create_textpara(ITextRange *range, ITextPara **ret)
}
/* ITextDocument */
-static HRESULT WINAPI
-ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
- void** ppvObject)
+static HRESULT WINAPI ITextDocument2Old_fnQueryInterface(ITextDocument2Old* iface, REFIID riid,
+ void **ppvObject)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
return IRichEditOle_QueryInterface(&This->IRichEditOle_iface, riid, ppvObject);
}
-static ULONG WINAPI
-ITextDocument_fnAddRef(ITextDocument* me)
+static ULONG WINAPI ITextDocument2Old_fnAddRef(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
return IRichEditOle_AddRef(&This->IRichEditOle_iface);
}
-static ULONG WINAPI
-ITextDocument_fnRelease(ITextDocument* me)
+static ULONG WINAPI ITextDocument2Old_fnRelease(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
return IRichEditOle_Release(&This->IRichEditOle_iface);
}
-static HRESULT WINAPI
-ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
- UINT* pctinfo)
+static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfoCount(ITextDocument2Old *iface,
+ UINT *pctinfo)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
TRACE("(%p)->(%p)\n", This, pctinfo);
*pctinfo = 1;
return S_OK;
}
-static HRESULT WINAPI
-ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
- ITypeInfo** ppTInfo)
+static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfo(ITextDocument2Old *iface, UINT iTInfo, LCID lcid,
+ ITypeInfo **ppTInfo)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
HRESULT hr;
TRACE("(%p)->(%u,%d,%p)\n", This, iTInfo, lcid, ppTInfo);
@@ -3906,11 +3902,11 @@ ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
return hr;
}
-static HRESULT WINAPI
-ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
- LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
+static HRESULT WINAPI ITextDocument2Old_fnGetIDsOfNames(ITextDocument2Old *iface, REFIID riid,
+ LPOLESTR *rgszNames, UINT cNames,
+ LCID lcid, DISPID *rgDispId)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
ITypeInfo *ti;
HRESULT hr;
@@ -3923,12 +3919,12 @@ ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
return hr;
}
-static HRESULT WINAPI
-ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
- REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
- VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
+static HRESULT WINAPI ITextDocument2Old_fnInvoke(ITextDocument2Old *iface, DISPID dispIdMember,
+ REFIID riid, LCID lcid, WORD wFlags,
+ DISPPARAMS *pDispParams, VARIANT *pVarResult,
+ EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
ITypeInfo *ti;
HRESULT hr;
@@ -3938,24 +3934,22 @@ ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
hr = get_typeinfo(ITextDocument_tid, &ti);
if (SUCCEEDED(hr))
- hr = ITypeInfo_Invoke(ti, me, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+ hr = ITypeInfo_Invoke(ti, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return hr;
}
-static HRESULT WINAPI
-ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
+static HRESULT WINAPI ITextDocument2Old_fnGetName(ITextDocument2Old *iface, BSTR *pName)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnGetSelection(ITextDocument *me, ITextSelection **selection)
+static HRESULT WINAPI ITextDocument2Old_fnGetSelection(ITextDocument2Old *iface, ITextSelection **selection)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- TRACE("(%p)->(%p)\n", me, selection);
+ TRACE("(%p)->(%p)\n", iface, selection);
if (!selection)
return E_INVALIDARG;
@@ -3973,125 +3967,110 @@ ITextDocument_fnGetSelection(ITextDocument *me, ITextSelection **selection)
return S_OK;
}
-static HRESULT WINAPI
-ITextDocument_fnGetStoryCount(ITextDocument* me, LONG* pCount)
+static HRESULT WINAPI ITextDocument2Old_fnGetStoryCount(ITextDocument2Old *iface, LONG *pCount)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnGetStoryRanges(ITextDocument* me,
- ITextStoryRanges** ppStories)
+static HRESULT WINAPI ITextDocument2Old_fnGetStoryRanges(ITextDocument2Old *iface,
+ ITextStoryRanges **ppStories)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnGetSaved(ITextDocument* me, LONG* pValue)
+static HRESULT WINAPI ITextDocument2Old_fnGetSaved(ITextDocument2Old *iface, LONG *pValue)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnSetSaved(ITextDocument* me, LONG Value)
+static HRESULT WINAPI ITextDocument2Old_fnSetSaved(ITextDocument2Old *iface, LONG Value)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
+static HRESULT WINAPI ITextDocument2Old_fnGetDefaultTabStop(ITextDocument2Old *iface, float *pValue)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
+static HRESULT WINAPI ITextDocument2Old_fnSetDefaultTabStop(ITextDocument2Old *iface, float Value)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnNew(ITextDocument* me)
+static HRESULT WINAPI ITextDocument2Old_fnNew(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, LONG Flags,
- LONG CodePage)
+static HRESULT WINAPI ITextDocument2Old_fnOpen(ITextDocument2Old *iface, VARIANT *pVar,
+ LONG Flags, LONG CodePage)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, LONG Flags,
- LONG CodePage)
+static HRESULT WINAPI ITextDocument2Old_fnSave(ITextDocument2Old *iface, VARIANT *pVar,
+ LONG Flags, LONG CodePage)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnFreeze(ITextDocument* me, LONG* pCount)
+static HRESULT WINAPI ITextDocument2Old_fnFreeze(ITextDocument2Old *iface, LONG *pCount)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnUnfreeze(ITextDocument* me, LONG* pCount)
+static HRESULT WINAPI ITextDocument2Old_fnUnfreeze(ITextDocument2Old *iface, LONG *pCount)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnBeginEditCollection(ITextDocument* me)
+static HRESULT WINAPI ITextDocument2Old_fnBeginEditCollection(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnEndEditCollection(ITextDocument* me)
+static HRESULT WINAPI ITextDocument2Old_fnEndEditCollection(ITextDocument2Old *iface)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnUndo(ITextDocument* me, LONG Count, LONG* prop)
+static HRESULT WINAPI ITextDocument2Old_fnUndo(ITextDocument2Old *iface, LONG Count, LONG *prop)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop)
+static HRESULT WINAPI ITextDocument2Old_fnRedo(ITextDocument2Old *iface, LONG Count, LONG *prop)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
@@ -4112,11 +4091,10 @@ static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end, I
return S_OK;
}
-static HRESULT WINAPI
-ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
- ITextRange** ppRange)
+static HRESULT WINAPI ITextDocument2Old_fnRange(ITextDocument2Old *iface, LONG cp1, LONG cp2,
+ ITextRange **ppRange)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
const int len = ME_GetTextLength(This->editor) + 1;
TRACE("%p %p %d %d\n", This, ppRange, cp1, cp2);
@@ -4140,42 +4118,247 @@ ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
return CreateITextRange(This, cp1, cp2, ppRange);
}
-static HRESULT WINAPI
-ITextDocument_fnRangeFromPoint(ITextDocument* me, LONG x, LONG y,
- ITextRange** ppRange)
+static HRESULT WINAPI ITextDocument2Old_fnRangeFromPoint(ITextDocument2Old *iface, LONG x, LONG y,
+ ITextRange **ppRange)
{
- IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
FIXME("stub %p\n",This);
return E_NOTIMPL;
}
-static const ITextDocumentVtbl tdvt = {
- ITextDocument_fnQueryInterface,
- ITextDocument_fnAddRef,
- ITextDocument_fnRelease,
- ITextDocument_fnGetTypeInfoCount,
- ITextDocument_fnGetTypeInfo,
- ITextDocument_fnGetIDsOfNames,
- ITextDocument_fnInvoke,
- ITextDocument_fnGetName,
- ITextDocument_fnGetSelection,
- ITextDocument_fnGetStoryCount,
- ITextDocument_fnGetStoryRanges,
- ITextDocument_fnGetSaved,
- ITextDocument_fnSetSaved,
- ITextDocument_fnGetDefaultTabStop,
- ITextDocument_fnSetDefaultTabStop,
- ITextDocument_fnNew,
- ITextDocument_fnOpen,
- ITextDocument_fnSave,
- ITextDocument_fnFreeze,
- ITextDocument_fnUnfreeze,
- ITextDocument_fnBeginEditCollection,
- ITextDocument_fnEndEditCollection,
- ITextDocument_fnUndo,
- ITextDocument_fnRedo,
- ITextDocument_fnRange,
- ITextDocument_fnRangeFromPoint
+/* ITextDocument2Old methods */
+static HRESULT WINAPI ITextDocument2Old_fnAttachMsgFilter(ITextDocument2Old *iface, IUnknown *filter)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, filter);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnSetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF cr)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d, 0x%x): stub\n", This, index, cr);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF *cr)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d, %p): stub\n", This, index, cr);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetCaretType(ITextDocument2Old *iface, LONG *type)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, type);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnSetCaretType(ITextDocument2Old *iface, LONG type)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d): stub\n", This, type);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetImmContext(ITextDocument2Old *iface, LONG *context)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, context);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnReleaseImmContext(ITextDocument2Old *iface, LONG context)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d): stub\n", This, context);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetPreferredFont(ITextDocument2Old *iface, LONG cp, LONG charrep,
+ LONG options, LONG current_charrep, LONG current_fontsize,
+ BSTR *bstr, LONG *pitch_family, LONG *new_fontsize)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d, %d, %d, %d, %d, %p, %p, %p): stub\n", This, cp, charrep, options, current_charrep,
+ current_fontsize, bstr, pitch_family, new_fontsize);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetNotificationMode(ITextDocument2Old *iface, LONG *mode)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, mode);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnSetNotificationMode(ITextDocument2Old *iface, LONG mode)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(0x%x): stub\n", This, mode);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetClientRect(ITextDocument2Old *iface, LONG type, LONG *left, LONG *top,
+ LONG *right, LONG *bottom)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d, %p, %p, %p, %p): stub\n", This, type, left, top, right, bottom);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetSelectionEx(ITextDocument2Old *iface, ITextSelection **selection)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, selection);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetWindow(ITextDocument2Old *iface, LONG *hwnd)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, hwnd);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnGetFEFlags(ITextDocument2Old *iface, LONG *flags)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnUpdateWindow(ITextDocument2Old *iface)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p): stub\n", This);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnCheckTextLimit(ITextDocument2Old *iface, LONG cch, LONG *exceed)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d, %p): stub\n", This, cch, exceed);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnIMEInProgress(ITextDocument2Old *iface, LONG mode)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(0x%x): stub\n", This, mode);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnSysBeep(ITextDocument2Old *iface)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p): stub\n", This);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnUpdate(ITextDocument2Old *iface, LONG mode)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(0x%x): stub\n", This, mode);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ITextDocument2Old_fnNotify(ITextDocument2Old *iface, LONG notify)
+{
+ IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
+
+ FIXME("(%p)->(%d): stub\n", This, notify);
+
+ return E_NOTIMPL;
+}
+
+static const ITextDocument2OldVtbl tdvt = {
+ ITextDocument2Old_fnQueryInterface,
+ ITextDocument2Old_fnAddRef,
+ ITextDocument2Old_fnRelease,
+ ITextDocument2Old_fnGetTypeInfoCount,
+ ITextDocument2Old_fnGetTypeInfo,
+ ITextDocument2Old_fnGetIDsOfNames,
+ ITextDocument2Old_fnInvoke,
+ ITextDocument2Old_fnGetName,
+ ITextDocument2Old_fnGetSelection,
+ ITextDocument2Old_fnGetStoryCount,
+ ITextDocument2Old_fnGetStoryRanges,
+ ITextDocument2Old_fnGetSaved,
+ ITextDocument2Old_fnSetSaved,
+ ITextDocument2Old_fnGetDefaultTabStop,
+ ITextDocument2Old_fnSetDefaultTabStop,
+ ITextDocument2Old_fnNew,
+ ITextDocument2Old_fnOpen,
+ ITextDocument2Old_fnSave,
+ ITextDocument2Old_fnFreeze,
+ ITextDocument2Old_fnUnfreeze,
+ ITextDocument2Old_fnBeginEditCollection,
+ ITextDocument2Old_fnEndEditCollection,
+ ITextDocument2Old_fnUndo,
+ ITextDocument2Old_fnRedo,
+ ITextDocument2Old_fnRange,
+ ITextDocument2Old_fnRangeFromPoint,
+ /* ITextDocument2Old methods */
+ ITextDocument2Old_fnAttachMsgFilter,
+ ITextDocument2Old_fnSetEffectColor,
+ ITextDocument2Old_fnGetEffectColor,
+ ITextDocument2Old_fnGetCaretType,
+ ITextDocument2Old_fnSetCaretType,
+ ITextDocument2Old_fnGetImmContext,
+ ITextDocument2Old_fnReleaseImmContext,
+ ITextDocument2Old_fnGetPreferredFont,
+ ITextDocument2Old_fnGetNotificationMode,
+ ITextDocument2Old_fnSetNotificationMode,
+ ITextDocument2Old_fnGetClientRect,
+ ITextDocument2Old_fnGetSelectionEx,
+ ITextDocument2Old_fnGetWindow,
+ ITextDocument2Old_fnGetFEFlags,
+ ITextDocument2Old_fnUpdateWindow,
+ ITextDocument2Old_fnCheckTextLimit,
+ ITextDocument2Old_fnIMEInProgress,
+ ITextDocument2Old_fnSysBeep,
+ ITextDocument2Old_fnUpdate,
+ ITextDocument2Old_fnNotify
};
/* ITextSelection */
@@ -5276,7 +5459,7 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p
reo->IUnknown_inner.lpVtbl = &reo_unk_vtbl;
reo->IRichEditOle_iface.lpVtbl = &revt;
- reo->ITextDocument_iface.lpVtbl = &tdvt;
+ reo->ITextDocument2Old_iface.lpVtbl = &tdvt;
reo->ref = 1;
reo->editor = editor;
reo->txtSel = NULL;
@@ -5509,8 +5692,8 @@ void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags)
}
}
-void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj)
+void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj)
{
IRichEditOleImpl *This = impl_from_IRichEditOle(iface);
- *ppvObj = &This->ITextDocument_iface;
+ *ppvObj = &This->ITextDocument2Old_iface;
}
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index aaf52bcfdd..d3ffdce4a7 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -113,10 +113,36 @@ static ULONG get_refcount(IUnknown *iface)
return IUnknown_Release(iface);
}
+#define CHECK_TYPEINFO(disp,expected_riid) _check_typeinfo((IDispatch *)disp, expected_riid, __LINE__)
+static void _check_typeinfo(IDispatch* disp, REFIID expected_riid, int line)
+{
+ ITypeInfo *typeinfo;
+ TYPEATTR *typeattr;
+ UINT count;
+ HRESULT hr;
+
+ count = 10;
+ hr = IDispatch_GetTypeInfoCount(disp, &count);
+ ok_(__FILE__,line)(hr == S_OK, "IDispatch_GetTypeInfoCount failed: 0x%08x.\n", hr);
+ ok_(__FILE__,line)(count == 1, "got wrong count: %u.\n", count);
+
+ hr = IDispatch_GetTypeInfo(disp, 0, LOCALE_SYSTEM_DEFAULT, &typeinfo);
+ ok_(__FILE__,line)(hr == S_OK, "IDispatch_GetTypeInfo failed: 0x%08x.\n", hr);
+
+ hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
+ ok_(__FILE__,line)(hr == S_OK, "ITypeInfo_GetTypeAttr failed: 0x%08x.\n", hr);
+ ok_(__FILE__,line)(IsEqualGUID(&typeattr->guid, expected_riid),
+ "Unexpected type guid: %s.\n", wine_dbgstr_guid(&typeattr->guid));
+
+ ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
+ ITypeInfo_Release(typeinfo);
+}
+
static void test_Interfaces(void)
{
IRichEditOle *reOle = NULL, *reOle1 = NULL;
ITextDocument *txtDoc = NULL;
+ ITextDocument2Old *txtDoc2Old = NULL;
ITextSelection *txtSel = NULL, *txtSel2;
IUnknown *punk;
HRESULT hres;
@@ -144,6 +170,7 @@ static void test_Interfaces(void)
(void **) &txtDoc);
ok(hres == S_OK, "IRichEditOle_QueryInterface\n");
ok(txtDoc != NULL, "IRichEditOle_QueryInterface\n");
+ CHECK_TYPEINFO(txtDoc, &IID_ITextDocument);
hres = ITextDocument_GetSelection(txtDoc, NULL);
ok(hres == E_INVALIDARG, "ITextDocument_GetSelection: 0x%x\n", hres);
@@ -195,6 +222,16 @@ static void test_Interfaces(void)
hres = IRichEditOle_QueryInterface(reOle, &IID_IOleInPlaceSite, (void **) &punk);
ok(hres == E_NOINTERFACE, "IRichEditOle_QueryInterface\n");
+ hres = IRichEditOle_QueryInterface(reOle, &IID_ITextDocument2Old, (void **)&txtDoc2Old);
+ ok(hres == S_OK, "IRichEditOle_QueryInterface\n");
+ ok(txtDoc2Old != NULL, "IRichEditOle_QueryInterface\n");
+ ok((ITextDocument *)txtDoc2Old == txtDoc, "interface pointer isn't equal.\n");
+ EXPECT_REF(txtDoc2Old, 5);
+ EXPECT_REF(reOle, 5);
+ CHECK_TYPEINFO(txtDoc2Old, &IID_ITextDocument);
+
+ ITextDocument2Old_Release(txtDoc2Old);
+
ITextDocument_Release(txtDoc);
IRichEditOle_Release(reOle);
refcount = IRichEditOle_Release(reOle);
@@ -207,6 +244,19 @@ static void test_Interfaces(void)
ok(hres == CO_E_RELEASED, "ITextSelection after ITextDocument destroyed\n");
ITextSelection_Release(txtSel);
+
+ w = new_richedit(NULL);
+ res = SendMessageA(w, EM_GETOLEINTERFACE, 0, (LPARAM)&reOle);
+ ok(res, "SendMessage\n");
+ ok(reOle != NULL, "EM_GETOLEINTERFACE\n");
+
+ hres = IRichEditOle_QueryInterface(reOle, &IID_ITextDocument2Old, (void **)&txtDoc2Old);
+ ok(hres == S_OK, "IRichEditOle_QueryInterface failed: 0x%08x.\n", hres);
+ ok(txtDoc2Old != NULL, "IRichEditOle_QueryInterface\n");
+ CHECK_TYPEINFO(txtDoc2Old, &IID_ITextDocument);
+ ITextDocument2Old_Release(txtDoc2Old);
+ IRichEditOle_Release(reOle);
+ DestroyWindow(w);
}
static void test_ITextDocument_Open(void)
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index ee65621b1d..5ab3322e6b 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -83,7 +83,7 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID r
if (!CreateIRichEditOle(This->outer_unk, This->editor, (void **)(&This->editor->reOle)))
return E_OUTOFMEMORY;
if (IsEqualIID(riid, &IID_ITextDocument))
- ME_GetITextDocumentInterface(This->editor->reOle, ppv);
+ ME_GetITextDocument2OldInterface(This->editor->reOle, ppv);
else
*ppv = This->editor->reOle;
} else {
--
2.19.0
Sept. 26, 2018
[PATCH v5 1/4] include: Add ITextDocument2Old and ITextDocument2 interface.
by Jactry Zeng
Superseded patch 151799.
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com>
---
include/tom.idl | 91 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
diff --git a/include/tom.idl b/include/tom.idl
index 357b0457a5..afc24ca5fb 100644
--- a/include/tom.idl
+++ b/include/tom.idl
@@ -237,6 +237,97 @@ interface ITextDocument : IDispatch
HRESULT RangeFromPoint([in]LONG x, [in]LONG y, [retval, out]ITextRange **ppRange);
}
+[
+ object,
+ uuid(01C25500-4268-11D1-883A-3C8B00C10000)
+]
+interface ITextDocument2Old : ITextDocument
+{
+ HRESULT AttachMsgFilter([in]IUnknown *filter);
+ HRESULT SetEffectColor([in]LONG index, [in]COLORREF cr);
+ HRESULT GetEffectColor([in]LONG index, [out]COLORREF *cr);
+ HRESULT GetCaretType([retval, out]LONG *type);
+ HRESULT SetCaretType([in]LONG type);
+ HRESULT GetImmContext([retval, out]LONG *context);
+ HRESULT ReleaseImmContext([in]LONG context);
+ HRESULT GetPreferredFont([in]LONG cp, [in]LONG codepage, [in]LONG option, [in]LONG current_codepage, [in]LONG current_fontsize,
+ [out]BSTR *bstr, [out]LONG *pitch_family, [out]LONG *new_fontsize);
+ HRESULT GetNotificationMode([retval, out]LONG *mode);
+ HRESULT SetNotificationMode([in]LONG mode);
+ HRESULT GetClientRect([in]LONG type, [out]LONG *left, [out]LONG *top, [out]LONG *right, [out]LONG *bottom);
+ HRESULT GetSelectionEx([retval, out]ITextSelection **selection);
+ HRESULT GetWindow([out]LONG *hwnd);
+ HRESULT GetFEFlags([out]LONG *flags);
+ HRESULT UpdateWindow();
+ HRESULT CheckTextLimit([in]LONG cch, [out]LONG *exceed);
+ HRESULT IMEInProgress([in]LONG mode);
+ HRESULT SysBeep();
+ HRESULT Update([in]LONG mode);
+ HRESULT Notify([in]LONG notify);
+}
+
+interface ITextDisplays;
+interface ITextFont2;
+interface ITextPara2;
+interface ITextRange2;
+interface ITextSelection2;
+interface ITextStory;
+interface ITextStoryRanges2;
+interface ITextStrings;
+
+[
+ object,
+ uuid(c241f5e0-7206-11d8-a2c7-00a0d1d6c6b3)
+]
+interface ITextDocument2 : ITextDocument
+{
+ HRESULT GetCaretType([retval, out]LONG *value);
+ HRESULT SetCaretType([in]LONG value);
+ HRESULT GetDisplays([retval, out]ITextDisplays **displays);
+ HRESULT GetDocumentFont([retval, out]ITextFont2 **font);
+ HRESULT SetDocumentFont([in]ITextFont2 *font);
+ HRESULT GetDocumentPara([retval, out]ITextPara2 **para);
+ HRESULT SetDocumentPara([in]ITextPara2 *para);
+ HRESULT GetEastAsianFlags([retval, out]LONG *flags);
+ HRESULT GetGenerator([retval, out]BSTR *bstr);
+ HRESULT SetIMEInProgress([in]LONG value);
+ HRESULT GetNotificationMode([retval, out]LONG *mode);
+ HRESULT SetNotificationMode([in]LONG mode);
+ HRESULT GetSelection2([retval, out]ITextSelection2 **selection);
+ HRESULT GetStoryRanges2([retval, out]ITextStoryRanges2 **stories);
+ HRESULT GetTypographyOptions([retval, out]LONG *options);
+ HRESULT GetVersion([retval, out]LONG *value);
+ HRESULT GetWindow([retval, out]LONG *hwnd);
+ HRESULT AttachMsgFilter([in]IUnknown *filter);
+ HRESULT CheckTextLimit([in]LONG cch, [out]LONG *exceed);
+ HRESULT GetCallManager([retval, out]IUnknown **manager);
+ HRESULT GetClientRect([in]LONG type, [out]LONG *left, [out]LONG *top, [out]LONG *right, [out]LONG *bottom);
+ HRESULT GetEffectColor([in]LONG index, [out]COLORREF *cr);
+ HRESULT GetImmContext([retval, out]LONG *context);
+ HRESULT GetPreferredFont([in]LONG cp, [in]LONG codepage, [in]LONG option, [in]LONG current_codepage, [in]LONG current_fontsize,
+ [out]BSTR *bstr, [out]LONG *pitch_family, [out]LONG *new_fontsize);
+ HRESULT GetProperty([in]LONG type, [out]LONG *value);
+ HRESULT GetStrings([out]ITextStrings **strings);
+ HRESULT Notify([in]LONG notify);
+ HRESULT Range2([in]LONG cp_active, [in]LONG cp_anchor, [retval, out]ITextRange2 **range);
+ HRESULT RangeFromPoint2([in]LONG x, [in]LONG y, [in]LONG type, [retval, out]ITextRange2 **range);
+ HRESULT ReleaseCallManager([in]IUnknown *manager);
+ HRESULT ReleaseImmContext([in]LONG context);
+ HRESULT SetEffectColor([in]LONG index, [in]LONG value);
+ HRESULT SetProperty([in]LONG type, [in]LONG value);
+ HRESULT SetTypographyOptions([in]LONG options, [in]LONG mask);
+ HRESULT SysBeep();
+ HRESULT Update([in]LONG value);
+ HRESULT UpdateWindow();
+ HRESULT GetMathProperties([out]LONG *options);
+ HRESULT SetMathProperties([in]LONG options, [in]LONG mask);
+ HRESULT GetActiveStory([retval, out]ITextStory **story);
+ HRESULT SetActiveStory([in]ITextStory *story);
+ HRESULT GetMainStory([retval, out]ITextStory **story);
+ HRESULT GetNewStory([retval, out]ITextStory **story);
+ HRESULT GetStory([in]LONG index, [retval, out]ITextStory **story);
+}
+
interface ITextFont;
interface ITextPara;
--
2.19.0
Sept. 26, 2018
Re: [PATCH v2] riched20: Avoid using GCC's typeof extension
by Huw Davies
On Mon, Sep 24, 2018 at 10:42:03PM -0600, Alex Henrie wrote:
> Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
> ---
> dlls/riched20/txthost.c | 94 ++++++++++++++++++++++-------------------
> dlls/riched20/txtsrv.c | 15 ++++++-
> 2 files changed, 64 insertions(+), 45 deletions(-)
>
> diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
> index b479bde81b..ec180200e1 100644
> --- a/dlls/riched20/txthost.c
> +++ b/dlls/riched20/txthost.c
> @@ -501,9 +501,17 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
>
> #ifdef __i386__ /* thiscall functions are i386-specific */
>
> -#define THISCALL(func) __thiscall_ ## func
> +#define DEFINE_ARGS_PLACEHOLDER(args) struct __args_placeholder ## args { char a[args]; };
> +DEFINE_ARGS_PLACEHOLDER(4);
> +DEFINE_ARGS_PLACEHOLDER(8);
> +DEFINE_ARGS_PLACEHOLDER(12);
> +DEFINE_ARGS_PLACEHOLDER(16);
> +DEFINE_ARGS_PLACEHOLDER(20);
> +DEFINE_ARGS_PLACEHOLDER(32);
> +
> +#define THISCALL(func) (void *) __thiscall_ ## func
> #define DEFINE_THISCALL_WRAPPER(func,args) \
> - extern typeof(func) THISCALL(func); \
> + extern HRESULT WINAPI __thiscall_ ## func(struct __args_placeholder ## args); \
> __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \
> "popl %eax\n\t" \
> "pushl %ecx\n\t" \
Could this be made to work in the same way as msvcrt handles thiscall?
Huw.
Sept. 26, 2018
[PATCH 2/2] msi: Allow recursive changes to the target folder path.
by Hans Leidekker
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/action.c | 10 +++-------
dlls/msi/tests/msi.c | 24 ++++++++----------------
2 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index af867618c6..0d6da3e2cc 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -2394,15 +2394,11 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa
else
path = msi_build_directory_name( 2, folder->TargetDefault, NULL );
}
+
normalized_path = msi_normalize_path( path );
- msi_free( path );
- if (folder->ResolvedTarget && !strcmpiW( normalized_path, folder->ResolvedTarget ))
- {
- TRACE("%s already resolved to %s\n", debugstr_w(name), debugstr_w(folder->ResolvedTarget));
- msi_free( normalized_path );
- return;
- }
msi_set_property( package->db, folder->Directory, normalized_path, -1 );
+ msi_free( path );
+
msi_free( folder->ResolvedTarget );
folder->ResolvedTarget = normalized_path;
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index 842ed112f5..015cd6538e 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -336,16 +336,18 @@ static const char spf_custom_action_dat[] =
"Action\tType\tSource\tTarget\tISComments\n"
"s72\ti2\tS64\tS0\tS255\n"
"CustomAction\tAction\n"
- "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n";
+ "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n"
+ "SetFolderProp2\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\\added2\t\n";
static const char spf_install_exec_seq_dat[] =
"Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
"InstallExecuteSequence\tAction\n"
- "CostFinalize\t\t1000\n"
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
"SetFolderProp\t\t950\n"
+ "SetFolderProp2\t\t960\n"
+ "CostFinalize\t\t1000\n"
"InstallFiles\t\t4000\n"
"InstallServices\t\t5000\n"
"InstallFinalize\t\t6600\n"
@@ -14095,7 +14097,6 @@ static void test_setpropertyfolder(void)
{
UINT r;
CHAR path[MAX_PATH];
- DWORD attr;
if (is_process_limited())
{
@@ -14120,19 +14121,10 @@ static void test_setpropertyfolder(void)
goto error;
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
- attr = GetFileAttributesA(path);
- if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
- {
- ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
- ok(delete_pf("msitest\\added", FALSE), "Directory not created\n");
- ok(delete_pf("msitest", FALSE), "Directory not created\n");
- }
- else
- {
- trace("changing folder property not supported\n");
- ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
- ok(delete_pf("msitest", FALSE), "Directory not created\n");
- }
+ ok(delete_pf("msitest\\added\\added2\\maximus", TRUE), "File not installed\n");
+ ok(delete_pf("msitest\\added\\added2", FALSE), "Directory not created\n");
+ ok(delete_pf("msitest\\added", FALSE), "Directory not created\n");
+ ok(delete_pf("msitest", FALSE), "Directory not created\n");
error:
DeleteFileA(msifile);
--
2.11.0
Sept. 26, 2018
[PATCH 1/2] msi/tests: Drop workarounds for Windows 2000.
by Hans Leidekker
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/tests/Makefile.in | 2 +-
dlls/msi/tests/action.c | 14 +++----------
dlls/msi/tests/automation.c | 10 ++-------
dlls/msi/tests/install.c | 7 ++-----
dlls/msi/tests/msi.c | 51 +++++++++++++++++++--------------------------
dlls/msi/tests/package.c | 49 +++++++++++--------------------------------
dlls/msi/tests/patch.c | 7 +------
dlls/msi/tests/source.c | 25 +++-------------------
8 files changed, 45 insertions(+), 120 deletions(-)
diff --git a/dlls/msi/tests/Makefile.in b/dlls/msi/tests/Makefile.in
index a0fdcaeb84..9398ffe93b 100644
--- a/dlls/msi/tests/Makefile.in
+++ b/dlls/msi/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = msi.dll
-IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version odbccp32
+IMPORTS = secur32 cabinet msi shell32 ole32 oleaut32 user32 advapi32 version odbccp32
custom_IMPORTS = uuid msi ole32 shell32 advapi32 odbccp32 oleaut32
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index f7ef07d0ac..084dbe4532 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/action.c
@@ -34,6 +34,7 @@
#include <shellapi.h>
#include <winsvc.h>
#include <odbcinst.h>
+#include <sddl.h>
#include "wine/test.h"
#include "utils.h"
@@ -50,11 +51,9 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
static UINT (WINAPI *pMsiQueryFeatureStateExA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
-static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
-static HMODULE hsrclient;
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
@@ -2356,6 +2355,7 @@ static void init_functionpointers(void)
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
+ HMODULE hsrclient = LoadLibraryA("srclient.dll");
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func); \
@@ -2368,11 +2368,9 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiGetComponentPathExA);
GET_PROC(hmsi, MsiQueryFeatureStateExA);
- GET_PROC(hadvapi32, ConvertSidToStringSidA);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
- hsrclient = LoadLibraryA("srclient.dll");
GET_PROC(hsrclient, SRRemoveRestorePoint);
GET_PROC(hsrclient, SRSetRestorePointA);
@@ -2386,17 +2384,12 @@ static char *get_user_sid(void)
TOKEN_USER *user;
char *usersid = NULL;
- if (!pConvertSidToStringSidA)
- {
- win_skip("ConvertSidToStringSidA is not available\n");
- return NULL;
- }
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
GetTokenInformation(token, TokenUser, NULL, size, &size);
user = HeapAlloc(GetProcessHeap(), 0, size);
GetTokenInformation(token, TokenUser, user, size, &size);
- pConvertSidToStringSidA(user->User.Sid, &usersid);
+ ConvertSidToStringSidA(user->User.Sid, &usersid);
HeapFree(GetProcessHeap(), 0, user);
CloseHandle(token);
@@ -6467,7 +6460,6 @@ START_TEST(action)
if (ret)
remove_restore_point(status.llSequenceNumber);
}
- FreeLibrary(hsrclient);
SetCurrentDirectoryA(prev_path);
}
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index 2554df7ee6..7e5124c1a1 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -35,8 +35,6 @@
static BOOL is_wow64;
-static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
-static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
@@ -219,8 +217,6 @@ static void init_functionpointers(void)
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
- GET_PROC(hadvapi32, CheckTokenMembership);
- GET_PROC(hadvapi32, OpenProcessToken);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
@@ -234,11 +230,9 @@ static BOOL is_process_limited(void)
BOOL IsInGroup;
HANDLE token;
- if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
-
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
- !pCheckTokenMembership(NULL, Group, &IsInGroup))
+ !CheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
@@ -252,7 +246,7 @@ static BOOL is_process_limited(void)
return TRUE;
}
- if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
+ if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
{
BOOL ret;
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 4fa186246a..e20d827d7a 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -44,13 +44,11 @@ static UINT (WINAPI *pMsiSourceListEnumSourcesA)
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
-static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **);
static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *);
-static HMODULE hsrclient = 0;
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
@@ -2146,6 +2144,7 @@ static void init_functionpointers(void)
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
+ HMODULE hsrclient = LoadLibraryA("srclient.dll");
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func); \
@@ -2156,13 +2155,11 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiSourceListEnumSourcesA);
GET_PROC(hmsi, MsiGetComponentPathExA);
- GET_PROC(hadvapi32, ConvertSidToStringSidA);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
GET_PROC(hkernel32, Wow64DisableWow64FsRedirection);
GET_PROC(hkernel32, Wow64RevertWow64FsRedirection);
- hsrclient = LoadLibraryA("srclient.dll");
GET_PROC(hsrclient, SRRemoveRestorePoint);
GET_PROC(hsrclient, SRSetRestorePointA);
@@ -6239,6 +6236,7 @@ START_TEST(install)
if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
test_MsiInstallProduct();
+ test_MsiInstallProduct();
test_MsiSetComponentState();
test_packagecoltypes();
test_continuouscabs();
@@ -6294,7 +6292,6 @@ START_TEST(install)
if (ret)
remove_restore_point(status.llSequenceNumber);
}
- FreeLibrary(hsrclient);
SetCurrentDirectoryA(prev_path);
}
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index f4afef15db..842ed112f5 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -38,7 +38,6 @@ static BOOL is_wow64;
static const char msifile[] = "winetest.msi";
static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','.','m','s','i',0};
-static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
@@ -104,7 +103,6 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiEnumComponentsExA)
GET_PROC(hmsi, MsiSourceListGetInfoA)
- GET_PROC(hadvapi32, ConvertSidToStringSidA)
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
@@ -1180,7 +1178,7 @@ static char *get_user_sid(void)
user = HeapAlloc(GetProcessHeap(), 0, size);
GetTokenInformation(token, TokenUser, user, size, &size);
- pConvertSidToStringSidA(user->User.Sid, &usersid);
+ ConvertSidToStringSidA(user->User.Sid, &usersid);
HeapFree(GetProcessHeap(), 0, user);
CloseHandle(token);
@@ -14445,33 +14443,26 @@ START_TEST(msi)
test_MsiGetFileHash();
test_MsiSetInternalUI();
test_MsiSetExternalUI();
-
- if (!pConvertSidToStringSidA)
- win_skip("ConvertSidToStringSidA not implemented\n");
- else
- {
- /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
- test_MsiQueryProductState();
- test_MsiQueryFeatureState();
- test_MsiQueryComponentState();
- test_MsiGetComponentPath();
- test_MsiGetComponentPathEx();
- test_MsiProvideComponent();
- test_MsiGetProductCode();
- test_MsiEnumClients();
- test_MsiGetProductInfo();
- test_MsiGetProductInfoEx();
- test_MsiGetUserInfo();
- test_MsiOpenProduct();
- test_MsiEnumPatchesEx();
- test_MsiEnumPatches();
- test_MsiGetPatchInfoEx();
- test_MsiGetPatchInfo();
- test_MsiEnumProducts();
- test_MsiEnumProductsEx();
- test_MsiEnumComponents();
- test_MsiEnumComponentsEx();
- }
+ test_MsiQueryProductState();
+ test_MsiQueryFeatureState();
+ test_MsiQueryComponentState();
+ test_MsiGetComponentPath();
+ test_MsiGetComponentPathEx();
+ test_MsiProvideComponent();
+ test_MsiGetProductCode();
+ test_MsiEnumClients();
+ test_MsiGetProductInfo();
+ test_MsiGetProductInfoEx();
+ test_MsiGetUserInfo();
+ test_MsiOpenProduct();
+ test_MsiEnumPatchesEx();
+ test_MsiEnumPatches();
+ test_MsiGetPatchInfoEx();
+ test_MsiGetPatchInfo();
+ test_MsiEnumProducts();
+ test_MsiEnumProductsEx();
+ test_MsiEnumComponents();
+ test_MsiEnumComponentsEx();
test_MsiGetFileVersion();
test_MsiGetFileSignatureInformation();
test_MsiConfigureProductEx();
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index d6d90ce39f..fd45a03e3c 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -29,6 +29,7 @@
#include <msiquery.h>
#include <srrestoreptapi.h>
#include <shlobj.h>
+#include <sddl.h>
#include "wine/test.h"
@@ -39,18 +40,10 @@ static const WCHAR msifileW[] =
static char CURR_DIR[MAX_PATH];
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
-static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
-static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
-static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
-static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
-static void (WINAPI *pGetSystemInfo)(LPSYSTEM_INFO);
-static void (WINAPI *pGetNativeSystemInfo)(LPSYSTEM_INFO);
-static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR, UINT);
-
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
@@ -59,28 +52,20 @@ static void init_functionpointers(void)
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
- HMODULE hshell32 = GetModuleHandleA("shell32.dll");
- HMODULE hsrclient;
+ HMODULE hsrclient = LoadLibraryA("srclient.dll");
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func);
GET_PROC(hmsi, MsiGetComponentPathExA);
- GET_PROC(hshell32, SHGetFolderPathA);
- GET_PROC(hadvapi32, CheckTokenMembership);
- GET_PROC(hadvapi32, ConvertSidToStringSidA);
- GET_PROC(hadvapi32, OpenProcessToken);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hadvapi32, RegDeleteKeyExW)
GET_PROC(hkernel32, IsWow64Process)
- GET_PROC(hkernel32, GetNativeSystemInfo)
- GET_PROC(hkernel32, GetSystemInfo)
- GET_PROC(hkernel32, GetSystemWow64DirectoryA)
- hsrclient = LoadLibraryA("srclient.dll");
GET_PROC(hsrclient, SRRemoveRestorePoint);
GET_PROC(hsrclient, SRSetRestorePointA);
+
#undef GET_PROC
}
@@ -91,11 +76,9 @@ static BOOL is_process_limited(void)
BOOL IsInGroup;
HANDLE token;
- if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
-
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
- !pCheckTokenMembership(NULL, Group, &IsInGroup))
+ !CheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is an administrator\n");
FreeSid(Group);
@@ -109,7 +92,7 @@ static BOOL is_process_limited(void)
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_POWER_USERS,
0, 0, 0, 0, 0, 0, &Group) ||
- !pCheckTokenMembership(NULL, Group, &IsInGroup))
+ !CheckTokenMembership(NULL, Group, &IsInGroup))
{
trace("Could not check if the current user is a power user\n");
return FALSE;
@@ -121,7 +104,7 @@ static BOOL is_process_limited(void)
}
}
- if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
+ if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
{
BOOL ret;
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
@@ -148,17 +131,12 @@ static char *get_user_sid(void)
TOKEN_USER *user;
char *usersid = NULL;
- if (!pConvertSidToStringSidA)
- {
- win_skip("ConvertSidToStringSidA is not available\n");
- return NULL;
- }
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
GetTokenInformation(token, TokenUser, NULL, size, &size);
user = HeapAlloc(GetProcessHeap(), 0, size);
GetTokenInformation(token, TokenUser, user, size, &size);
- pConvertSidToStringSidA(user->User.Sid, &usersid);
+ ConvertSidToStringSidA(user->User.Sid, &usersid);
HeapFree(GetProcessHeap(), 0, user);
CloseHandle(token);
@@ -4705,7 +4683,7 @@ static void test_appsearch_reglocator(void)
ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
memset(&si, 0, sizeof(si));
- if (pGetNativeSystemInfo) pGetNativeSystemInfo(&si);
+ GetNativeSystemInfo(&si);
if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
{
@@ -5721,10 +5699,7 @@ static void test_installprops(void)
r = MsiGetPropertyA(hpkg, "MsiNetAssemblySupport", buf, &size);
if (r == ERROR_SUCCESS) trace( "MsiNetAssemblySupport \"%s\"\n", buf );
- if (pGetNativeSystemInfo)
- pGetNativeSystemInfo(&si);
- else
- pGetSystemInfo(&si);
+ GetNativeSystemInfo(&si);
if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
{
@@ -5739,7 +5714,7 @@ static void test_installprops(void)
strcat(path, "\\");
check_prop(hpkg, "System64Folder", path);
- pGetSystemWow64DirectoryA(path, MAX_PATH);
+ GetSystemWow64DirectoryA(path, MAX_PATH);
strcat(path, "\\");
check_prop(hpkg, "SystemFolder", path);
@@ -9634,7 +9609,7 @@ START_TEST(package)
* This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
* creation of restore points.
*/
- if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
+ if (!pMsiGetComponentPathExA)
{
memset(&status, 0, sizeof(status));
ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
@@ -9678,7 +9653,7 @@ START_TEST(package)
test_controlevent();
test_top_level_action();
- if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
+ if (!pMsiGetComponentPathExA && ret)
{
ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
if (ret)
diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c
index b577982443..63d38b8ff9 100644
--- a/dlls/msi/tests/patch.c
+++ b/dlls/msi/tests/patch.c
@@ -36,7 +36,6 @@ static UINT (WINAPI *pMsiGetPatchInfoExA)( LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCON
LPCSTR, LPSTR, DWORD * );
static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR,
LPSTR, MSIINSTALLCONTEXT *, LPSTR, LPDWORD );
-static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
static const char *msifile = "winetest-patch.msi";
static const char *mspfile = "winetest-patch.msp";
@@ -145,7 +144,6 @@ static const struct msi_table tables[] =
static void init_function_pointers( void )
{
HMODULE hmsi = GetModuleHandleA( "msi.dll" );
- HMODULE hadvapi32 = GetModuleHandleA( "advapi32.dll" );
#define GET_PROC( mod, func ) \
p ## func = (void *)GetProcAddress( mod, #func ); \
@@ -156,7 +154,6 @@ static void init_function_pointers( void )
GET_PROC( hmsi, MsiGetPatchInfoExA );
GET_PROC( hmsi, MsiEnumPatchesExA );
- GET_PROC( hadvapi32, OpenProcessToken );
#undef GET_PROC
}
@@ -164,9 +161,7 @@ static BOOL is_process_limited(void)
{
HANDLE token;
- if (!pOpenProcessToken) return FALSE;
-
- if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
+ if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
{
BOOL ret;
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c
index a03cf557aa..654df35f54 100644
--- a/dlls/msi/tests/source.c
+++ b/dlls/msi/tests/source.c
@@ -34,9 +34,7 @@
static BOOL is_wow64;
-static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
-static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static UINT (WINAPI *pMsiSourceListAddMediaDiskA)
@@ -60,7 +58,6 @@ static void init_functionpointers(void)
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
- HMODULE hsecur32 = LoadLibraryA("secur32.dll");
#define GET_PROC(dll, func) \
p ## func = (void *)GetProcAddress(dll, #func); \
@@ -75,10 +72,8 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiSourceListSetInfoA)
GET_PROC(hmsi, MsiSourceListAddSourceA)
- GET_PROC(hadvapi32, ConvertSidToStringSidA)
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
- GET_PROC(hsecur32, GetUserNameExA)
#undef GET_PROC
}
@@ -142,17 +137,12 @@ static char *get_user_sid(void)
TOKEN_USER *user;
char *usersid = NULL;
- if (!pConvertSidToStringSidA)
- {
- win_skip("ConvertSidToStringSidA is not available\n");
- return NULL;
- }
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
GetTokenInformation(token, TokenUser, NULL, size, &size);
user = HeapAlloc(GetProcessHeap(), 0, size);
GetTokenInformation(token, TokenUser, user, size, &size);
- pConvertSidToStringSidA(user->User.Sid, &usersid);
+ ConvertSidToStringSidA(user->User.Sid, &usersid);
HeapFree(GetProcessHeap(), 0, user);
CloseHandle(token);
@@ -3241,7 +3231,7 @@ static void test_MsiSourceListAddSource(void)
CHAR prod_squashed[MAX_PATH];
CHAR keypath[MAX_PATH*2];
CHAR username[MAX_PATH];
- LPSTR usersid, ptr;
+ LPSTR usersid;
LONG res;
UINT r;
HKEY prodkey, userkey, net, source;
@@ -3263,16 +3253,7 @@ static void test_MsiSourceListAddSource(void)
/* MACHINENAME\username */
size = MAX_PATH;
- if (pGetUserNameExA != NULL)
- pGetUserNameExA(NameSamCompatible, username, &size);
- else
- {
- GetComputerNameA(username, &size);
- lstrcatA(username, "\\");
- ptr = username + lstrlenA(username);
- size = MAX_PATH - (ptr - username);
- GetUserNameA(ptr, &size);
- }
+ GetUserNameExA(NameSamCompatible, username, &size);
trace("username: %s\n", username);
if (is_wow64)
--
2.11.0
Sept. 26, 2018
[PATCH 3/3] crypt32: Fix formatted output length for base64.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/crypt32/base64.c | 10 ++++++----
dlls/crypt32/tests/base64.c | 26 ++++++++++++++++++++++----
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c
index 5caab97b17..ac288b7c5e 100644
--- a/dlls/crypt32/base64.c
+++ b/dlls/crypt32/base64.c
@@ -104,8 +104,9 @@ static LONG encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep,
LPSTR ptr;
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
- needed = bytes + pad_bytes + 1;
- needed += (needed / 64 + 1) * strlen(sep);
+ needed = bytes + pad_bytes;
+ needed += (needed / 64 + (needed % 64 ? 1 : 0)) * strlen(sep);
+ needed++;
if (needed > *out_len)
{
@@ -303,8 +304,9 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
LPWSTR ptr;
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
- needed = bytes + pad_bytes + 1;
- needed += (needed / 64 + 1) * strlenW(sep);
+ needed = bytes + pad_bytes;
+ needed += (needed / 64 + (needed % 64 ? 1 : 0)) * strlenW(sep);
+ needed++;
if (needed > *out_len)
{
diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c
index 2249e1bf5a..e6adc7ab38 100644
--- a/dlls/crypt32/tests/base64.c
+++ b/dlls/crypt32/tests/base64.c
@@ -55,6 +55,8 @@ static const BYTE toEncode4[] =
"abcdefghijlkmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"
"abcdefghijlkmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"
"abcdefghijlkmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890";
+static const BYTE toEncode5[] =
+ "abcdefghijlkmnopqrstuvwxyz01234567890ABCDEFGHI";
static const struct BinTests tests[] = {
{ toEncode1, sizeof(toEncode1), "AA==\r\n", },
@@ -66,6 +68,8 @@ static const struct BinTests tests[] = {
"d3h5ejAxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVowMTIzNDU2\r\n"
"Nzg5MGFiY2RlZmdoaWpsa21ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OTBBQkNERUZH\r\n"
"SElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkwAA==\r\n" },
+ { toEncode5, sizeof(toEncode5),
+ "YWJjZGVmZ2hpamxrbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5MEFCQ0RFRkdISQA=\r\n" },
};
static const struct BinTests testsNoCR[] = {
@@ -78,6 +82,8 @@ static const struct BinTests testsNoCR[] = {
"d3h5ejAxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVowMTIzNDU2\n"
"Nzg5MGFiY2RlZmdoaWpsa21ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OTBBQkNERUZH\n"
"SElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkwAA==\n" },
+ { toEncode5, sizeof(toEncode5),
+ "YWJjZGVmZ2hpamxrbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5MEFCQ0RFRkdISQA=\n" },
};
static WCHAR *strdupAtoW(const char *str)
@@ -96,15 +102,21 @@ static WCHAR *strdupAtoW(const char *str)
static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
DWORD format, const char *expected, const char *header, const char *trailer)
{
- DWORD strLen, strLen2;
+ DWORD strLen, strLen2, required;
const char *ptr;
LPSTR str = NULL;
BOOL ret;
+ required = strlen(expected) + 1;
+ if (header)
+ required += strlen(header);
+ if (trailer)
+ required += strlen(trailer);
+
strLen = 0;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
- ok(strLen > 0, "Unexpected required length.\n");
+ ok(strLen == required, "Unexpected required length %u, expected %u.\n", required, strLen);
strLen2 = strLen;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen2);
@@ -154,16 +166,22 @@ todo_wine {
static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWORD format,
const WCHAR *expected, const char *header, const char *trailer)
{
- WCHAR *headerW, *trailerW;
+ WCHAR *headerW, *trailerW, required;
DWORD strLen, strLen2;
WCHAR *strW = NULL;
const WCHAR *ptr;
BOOL ret;
+ required = lstrlenW(expected) + 1;
+ if (header)
+ required += strlen(header);
+ if (trailer)
+ required += strlen(trailer);
+
strLen = 0;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
- ok(strLen > 0, "Unexpected required length.\n");
+ ok(strLen == required, "Unexpected required length %u, expected %u.\n", strLen, required);
/* Same call with non-zero length value. */
strLen2 = strLen;
--
2.19.0
Sept. 26, 2018
[PATCH 2/3] crypt32: Fix output buffer handling for CRYPT_STRING_BINARY case.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/crypt32/base64.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c
index e25e4c10ff..5caab97b17 100644
--- a/dlls/crypt32/base64.c
+++ b/dlls/crypt32/base64.c
@@ -77,23 +77,20 @@ static BOOL EncodeBinaryToBinaryA(const BYTE *pbBinary,
{
BOOL ret = TRUE;
- if (*pcchString < cbBinary)
+ if (pszString)
{
- if (!pszString)
- *pcchString = cbBinary;
- else
+ if (*pcchString < cbBinary)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
- *pcchString = cbBinary;
ret = FALSE;
}
- }
- else
- {
- if (cbBinary)
+ else if (cbBinary)
memcpy(pszString, pbBinary, cbBinary);
- *pcchString = cbBinary;
}
+ else
+
+ *pcchString = cbBinary;
+
return ret;
}
--
2.19.0
Sept. 26, 2018
[resend PATCH 1/3] crypt32: Fix NULL output buffer handling for CryptBinaryToString().
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/crypt32/base64.c | 98 +++++++++++++++++--------------
dlls/crypt32/tests/base64.c | 111 ++++++++++++++++++++++++++----------
2 files changed, 136 insertions(+), 73 deletions(-)
diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c
index bc30779098..e25e4c10ff 100644
--- a/dlls/crypt32/base64.c
+++ b/dlls/crypt32/base64.c
@@ -215,36 +215,41 @@ static BOOL BinaryToBase64A(const BYTE *pbBinary,
charsNeeded += strlen(header) + strlen(sep);
if (trailer)
charsNeeded += strlen(trailer) + strlen(sep);
- if (charsNeeded <= *pcchString)
- {
- LPSTR ptr = pszString;
- DWORD size = charsNeeded;
- if (header)
+ if (pszString)
+ {
+ if (charsNeeded <= *pcchString)
{
- strcpy(ptr, header);
- ptr += strlen(ptr);
- strcpy(ptr, sep);
- ptr += strlen(sep);
+ LPSTR ptr = pszString;
+ DWORD size = charsNeeded;
+
+ if (header)
+ {
+ strcpy(ptr, header);
+ ptr += strlen(ptr);
+ strcpy(ptr, sep);
+ ptr += strlen(sep);
+ }
+ encodeBase64A(pbBinary, cbBinary, sep, ptr, &size);
+ ptr += size - 1;
+ if (trailer)
+ {
+ strcpy(ptr, trailer);
+ ptr += strlen(ptr);
+ strcpy(ptr, sep);
+ }
+ *pcchString = charsNeeded - 1;
}
- encodeBase64A(pbBinary, cbBinary, sep, ptr, &size);
- ptr += size - 1;
- if (trailer)
+ else
{
- strcpy(ptr, trailer);
- ptr += strlen(ptr);
- strcpy(ptr, sep);
+ *pcchString = charsNeeded;
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ ret = FALSE;
}
- *pcchString = charsNeeded - 1;
- }
- else if (pszString)
- {
- *pcchString = charsNeeded;
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- ret = FALSE;
}
else
*pcchString = charsNeeded;
+
return ret;
}
@@ -409,36 +414,41 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
charsNeeded += strlenW(header) + strlenW(sep);
if (trailer)
charsNeeded += strlenW(trailer) + strlenW(sep);
- if (charsNeeded <= *pcchString)
- {
- LPWSTR ptr = pszString;
- DWORD size = charsNeeded;
- if (header)
+ if (pszString)
+ {
+ if (charsNeeded <= *pcchString)
{
- strcpyW(ptr, header);
- ptr += strlenW(ptr);
- strcpyW(ptr, sep);
- ptr += strlenW(sep);
+ LPWSTR ptr = pszString;
+ DWORD size = charsNeeded;
+
+ if (header)
+ {
+ strcpyW(ptr, header);
+ ptr += strlenW(ptr);
+ strcpyW(ptr, sep);
+ ptr += strlenW(sep);
+ }
+ encodeBase64W(pbBinary, cbBinary, sep, ptr, &size);
+ ptr += size - 1;
+ if (trailer)
+ {
+ strcpyW(ptr, trailer);
+ ptr += strlenW(ptr);
+ strcpyW(ptr, sep);
+ }
+ *pcchString = charsNeeded - 1;
}
- encodeBase64W(pbBinary, cbBinary, sep, ptr, &size);
- ptr += size - 1;
- if (trailer)
+ else
{
- strcpyW(ptr, trailer);
- ptr += strlenW(ptr);
- strcpyW(ptr, sep);
+ *pcchString = charsNeeded;
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ ret = FALSE;
}
- *pcchString = charsNeeded - 1;
- }
- else if (pszString)
- {
- *pcchString = charsNeeded;
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- ret = FALSE;
}
else
*pcchString = charsNeeded;
+
return ret;
}
diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c
index 7bc1ec7d0e..2249e1bf5a 100644
--- a/dlls/crypt32/tests/base64.c
+++ b/dlls/crypt32/tests/base64.c
@@ -96,60 +96,113 @@ static WCHAR *strdupAtoW(const char *str)
static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
DWORD format, const char *expected, const char *header, const char *trailer)
{
- DWORD strLen = 0;
+ DWORD strLen, strLen2;
+ const char *ptr;
LPSTR str = NULL;
BOOL ret;
+ strLen = 0;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
- str = HeapAlloc(GetProcessHeap(), 0, strLen);
- if (str)
- {
- DWORD strLen2 = strLen;
- LPCSTR ptr = str;
+ ok(strLen > 0, "Unexpected required length.\n");
- ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str,
- &strLen2);
- ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
- ok(strLen2 == strLen - 1, "Expected length %d, got %d\n",
- strLen - 1, strLen);
- if (header)
- {
- ok(!strncmp(header, ptr, strlen(header)),
- "Expected header %s, got %s\n", header, ptr);
- ptr += strlen(header);
- }
- ok(!strncmp(expected, ptr, strlen(expected)),
- "Expected %s, got %s\n", expected, ptr);
- ptr += strlen(expected);
- if (trailer)
- ok(!strncmp(trailer, ptr, strlen(trailer)),
- "Expected trailer %s, got %s\n", trailer, ptr);
- HeapFree(GetProcessHeap(), 0, str);
+ strLen2 = strLen;
+ ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen2);
+ ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
+ ok(strLen == strLen2, "Unexpected required length.\n");
+
+ strLen2 = strLen - 1;
+ ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen2);
+ ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
+ ok(strLen == strLen2, "Unexpected required length.\n");
+
+ str = heap_alloc(strLen);
+
+ /* Partially filled output buffer. */
+ strLen2 = strLen - 1;
+ str[0] = 0x12;
+ ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str, &strLen2);
+todo_wine
+ ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringA failed %d, error %d.\n",
+ ret, GetLastError());
+ ok(strLen2 == strLen || broken(strLen2 == strLen - 1), "Expected length %d, got %d\n", strLen - 1, strLen);
+todo_wine {
+ if (header)
+ ok(str[0] == header[0], "Unexpected buffer contents %#x.\n", str[0]);
+ else
+ ok(str[0] == expected[0], "Unexpected buffer contents %#x.\n", str[0]);
+}
+ strLen2 = strLen;
+ ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str, &strLen2);
+ ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
+ ok(strLen2 == strLen - 1, "Expected length %d, got %d\n", strLen - 1, strLen);
+
+ ptr = str;
+ if (header)
+ {
+ ok(!strncmp(header, ptr, strlen(header)), "Expected header %s, got %s\n", header, ptr);
+ ptr += strlen(header);
}
+ ok(!strncmp(expected, ptr, strlen(expected)), "Expected %s, got %s\n", expected, ptr);
+ ptr += strlen(expected);
+ if (trailer)
+ ok(!strncmp(trailer, ptr, strlen(trailer)), "Expected trailer %s, got %s\n", trailer, ptr);
+
+ heap_free(str);
}
static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWORD format,
const WCHAR *expected, const char *header, const char *trailer)
{
WCHAR *headerW, *trailerW;
- DWORD strLen = 0, strLen2;
+ DWORD strLen, strLen2;
+ WCHAR *strW = NULL;
const WCHAR *ptr;
- WCHAR *strW;
BOOL ret;
+ strLen = 0;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+ ok(strLen > 0, "Unexpected required length.\n");
+ /* Same call with non-zero length value. */
strLen2 = strLen;
- strW = heap_alloc(strLen * sizeof(WCHAR));
- ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
+ ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen2);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
- ok(strLen2 == strLen - 1, "Expected length %d, got %d\n", strLen - 1, strLen);
+ ok(strLen == strLen2, "Unexpected required length.\n");
+
+ strLen2 = strLen - 1;
+ ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen2);
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+ ok(strLen == strLen2, "Unexpected required length.\n");
+
+ strLen2 = strLen - 1;
+ ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen2);
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+ ok(strLen == strLen2, "Unexpected required length.\n");
+
+ strW = heap_alloc(strLen * sizeof(WCHAR));
headerW = strdupAtoW(header);
trailerW = strdupAtoW(trailer);
+ strLen2 = strLen - 1;
+ strW[0] = 0x1234;
+ ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
+todo_wine
+ ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringW failed, %d, error %d\n",
+ ret, GetLastError());
+ if (headerW)
+ ok(strW[0] == 0x1234, "Unexpected buffer contents %#x.\n", strW[0]);
+ else
+ ok(strW[0] == 0x1234 || broken(strW[0] != 0x1234) /* XP */, "Unexpected buffer contents %#x.\n", strW[0]);
+
+ strLen2 = strLen;
+ ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+
+ ok(strLen2 == strLen - 1, "Expected length %d, got %d\n", strLen - 1, strLen);
+
ptr = strW;
if (headerW)
{
--
2.19.0
Sept. 26, 2018
[PATCH v4 4/4] msftedit: Add tests for interfaces.
by Jactry Zeng
Superseded patch 151085.
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com>
---
configure | 1 +
configure.ac | 1 +
dlls/msftedit/tests/Makefile.in | 5 +
dlls/msftedit/tests/richole.c | 197 ++++++++++++++++++++++++++++++++
4 files changed, 204 insertions(+)
create mode 100644 dlls/msftedit/tests/Makefile.in
create mode 100644 dlls/msftedit/tests/richole.c
diff --git a/configure b/configure
index 657ff9ae83..dbdf5d0499 100755
--- a/configure
+++ b/configure
@@ -19595,6 +19595,7 @@ wine_fn_config_makefile dlls/msdmo enable_msdmo
wine_fn_config_makefile dlls/msdmo/tests enable_tests
wine_fn_config_makefile dlls/msdrm enable_msdrm
wine_fn_config_makefile dlls/msftedit enable_msftedit
+wine_fn_config_makefile dlls/msftedit/tests enable_tests
wine_fn_config_makefile dlls/msg711.acm enable_msg711_acm
wine_fn_config_makefile dlls/msgsm32.acm enable_msgsm32_acm
wine_fn_config_makefile dlls/mshtml.tlb enable_mshtml_tlb
diff --git a/configure.ac b/configure.ac
index 6936a71b6f..0566cfd30c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3451,6 +3451,7 @@ WINE_CONFIG_MAKEFILE(dlls/msdmo)
WINE_CONFIG_MAKEFILE(dlls/msdmo/tests)
WINE_CONFIG_MAKEFILE(dlls/msdrm)
WINE_CONFIG_MAKEFILE(dlls/msftedit)
+WINE_CONFIG_MAKEFILE(dlls/msftedit/tests)
WINE_CONFIG_MAKEFILE(dlls/msg711.acm)
WINE_CONFIG_MAKEFILE(dlls/msgsm32.acm)
WINE_CONFIG_MAKEFILE(dlls/mshtml.tlb)
diff --git a/dlls/msftedit/tests/Makefile.in b/dlls/msftedit/tests/Makefile.in
new file mode 100644
index 0000000000..99cc46a007
--- /dev/null
+++ b/dlls/msftedit/tests/Makefile.in
@@ -0,0 +1,5 @@
+TESTDLL = msftedit.dll
+IMPORTS = ole32 oleaut32 user32
+
+C_SRCS = \
+ richole.c
diff --git a/dlls/msftedit/tests/richole.c b/dlls/msftedit/tests/richole.c
new file mode 100644
index 0000000000..1d336f1099
--- /dev/null
+++ b/dlls/msftedit/tests/richole.c
@@ -0,0 +1,197 @@
+/*
+ * Tests for IRichEditOle and friends.
+ *
+ * Copyright 2008 Google (Dan Hipschman)
+ * Copyright 2018 Jactry Zeng 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
+ */
+
+#define COBJMACROS
+
+#include <stdarg.h>
+
+#include <windef.h>
+#include <winbase.h>
+#include <initguid.h>
+#include <ole2.h>
+#include <richedit.h>
+#include <richole.h>
+#include <tom.h>
+#include <wine/test.h>
+
+static HMODULE msftedit_hmodule;
+
+#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
+static void _expect_ref(IUnknown* obj, ULONG ref, int line)
+{
+ ULONG rc;
+ IUnknown_AddRef(obj);
+ rc = IUnknown_Release(obj);
+ ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d.\n", ref, rc);
+}
+
+static HWND new_window(LPCWSTR classname, DWORD dwstyle, HWND parent)
+{
+ HWND hwnd = CreateWindowW(classname, NULL,
+ dwstyle | WS_POPUP | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
+ 0, 0, 200, 60, parent, NULL, msftedit_hmodule, NULL);
+ ok(hwnd != NULL, "class: %s, error: %d.\n", wine_dbgstr_w(classname), (int) GetLastError());
+ return hwnd;
+}
+
+static void test_Interfaces(void)
+{
+ IRichEditOle *reole = NULL, *reole1 = NULL;
+ ITextDocument *txtdoc = NULL;
+ ITextDocument2Old *txtdoc2old = NULL;
+ ITextDocument2 *txtdoc2 = NULL;
+ ITextSelection *txtsel = NULL, *txtsel2;
+ IUnknown *punk;
+ HRESULT hres;
+ LRESULT res;
+ HWND hwnd;
+ ULONG refcount;
+
+ hwnd = new_window(MSFTEDIT_CLASS, ES_MULTILINE, NULL);
+ if (!hwnd)
+ {
+ skip("Couldn't create window.\n");
+ return;
+ }
+
+ res = SendMessageA(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&reole);
+ ok(res, "SendMessage\n");
+ ok(reole != NULL, "EM_GETOLEINTERFACE\n");
+ EXPECT_REF(reole, 2);
+
+ res = SendMessageA(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&reole1);
+ ok(res == 1, "SendMessage\n");
+ ok(reole1 == reole, "Should not return a new IRichEditOle interface.\n");
+ EXPECT_REF(reole, 3);
+
+ hres = IRichEditOle_QueryInterface(reole, &IID_ITextDocument, (void **)&txtdoc);
+ ok(hres == S_OK, "IRichEditOle_QueryInterface failed: 0x%08x.\n", hres);
+ ok(txtdoc != NULL, "IRichEditOle_QueryInterface\n");
+
+ hres = ITextDocument_GetSelection(txtdoc, NULL);
+ ok(hres == E_INVALIDARG, "ITextDocument_GetSelection: 0x%08x.\n", hres);
+
+ EXPECT_REF(txtdoc, 4);
+
+ hres = ITextDocument_GetSelection(txtdoc, &txtsel);
+ ok(hres == S_OK, "ITextDocument_GetSelection failed 0x%08x.\n", hres);
+
+ EXPECT_REF(txtdoc, 4);
+ EXPECT_REF(txtsel, 2);
+
+ hres = ITextDocument_GetSelection(txtdoc, &txtsel2);
+ ok(hres == S_OK, "ITextDocument_GetSelection failed: 0x%08x.\n", hres);
+ ok(txtsel2 == txtsel, "got %p, %p\n", txtsel, txtsel2);
+
+ EXPECT_REF(txtdoc, 4);
+ EXPECT_REF(txtsel, 3);
+
+ ITextSelection_Release(txtsel2);
+
+ punk = NULL;
+ hres = ITextSelection_QueryInterface(txtsel, &IID_ITextSelection, (void **)&punk);
+ ok(hres == S_OK, "ITextSelection_QueryInterface failed: 0x%08x.\n", hres);
+ ok(punk != NULL, "ITextSelection_QueryInterface\n");
+ IUnknown_Release(punk);
+
+ punk = NULL;
+ hres = ITextSelection_QueryInterface(txtsel, &IID_ITextRange, (void **)&punk);
+ ok(hres == S_OK, "ITextSelection_QueryInterface failed: 0x%08x.\n", hres);
+ ok(punk != NULL, "ITextSelection_QueryInterface\n");
+ IUnknown_Release(punk);
+
+ punk = NULL;
+ hres = ITextSelection_QueryInterface(txtsel, &IID_IDispatch, (void **)&punk);
+ ok(hres == S_OK, "ITextSelection_QueryInterface failed: 0x%08x.\n", hres);
+ ok(punk != NULL, "ITextSelection_QueryInterface\n");
+ IUnknown_Release(punk);
+
+ punk = NULL;
+ hres = IRichEditOle_QueryInterface(reole, &IID_IOleClientSite, (void **)&punk);
+ ok(hres == E_NOINTERFACE, "IRichEditOle_QueryInterface: 0x%08x.\n", hres);
+
+ punk = NULL;
+ hres = IRichEditOle_QueryInterface(reole, &IID_IOleWindow, (void **)&punk);
+ ok(hres == E_NOINTERFACE, "IRichEditOle_QueryInterface: 0x%08x.\n", hres);
+
+ punk = NULL;
+ hres = IRichEditOle_QueryInterface(reole, &IID_IOleInPlaceSite, (void **)&punk);
+ ok(hres == E_NOINTERFACE, "IRichEditOle_QueryInterface: 0x%08x.\n", hres);
+
+ /* ITextDocument2 is implemented on msftedit after win8 for superseding ITextDocument2Old */
+ hres = IRichEditOle_QueryInterface(reole, &IID_ITextDocument2, (void **)&txtdoc2);
+ ok(hres == S_OK ||
+ hres == E_NOINTERFACE /* before win8 */, "IRichEditOle_QueryInterface: 0x%08x.\n", hres);
+ if (hres != E_NOINTERFACE)
+ {
+ ok(txtdoc2 != NULL, "IRichEditOle_QueryInterface\n");
+ ok((ITextDocument *)txtdoc2 == txtdoc, "Interface pointer isn't equal.\n");
+ EXPECT_REF(txtdoc2, 5);
+ EXPECT_REF(reole, 5);
+
+ hres = ITextDocument2_QueryInterface(txtdoc2, &IID_ITextDocument2Old, (void **)&txtdoc2old);
+ ok(hres == S_OK, "ITextDocument2_QueryInterface failed: 0x%08x.\n", hres);
+ EXPECT_REF(txtdoc2, 5);
+ EXPECT_REF(reole, 5);
+ EXPECT_REF(txtdoc2old, 1);
+ ITextDocument2Old_Release(txtdoc2old);
+ ITextDocument2_Release(txtdoc2);
+
+ hres = IRichEditOle_QueryInterface(reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
+ ok(hres == S_OK, "IRichEditOle_QueryInterface failed: 0x%08x.\n", hres);
+ ok(txtdoc2old != NULL, "IRichEditOle_QueryInterface\n");
+ ok((ITextDocument *)txtdoc2old != txtdoc, "Interface pointer is equal.\n");
+ EXPECT_REF(txtdoc2old, 1);
+ EXPECT_REF(reole, 4);
+ ITextDocument2Old_Release(txtdoc2old);
+ }
+ else
+ {
+ hres = IRichEditOle_QueryInterface(reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
+ ok(hres == S_OK, "IRichEditOle_QueryInterface failed: 0x%08x.\n", hres);
+ ok(txtdoc2old != NULL, "IRichEditOle_QueryInterface\n");
+ ok((ITextDocument *)txtdoc2old == txtdoc, "Interface pointer is equal.\n");
+ EXPECT_REF(txtdoc2old, 5);
+ EXPECT_REF(reole, 5);
+ ITextDocument2Old_Release(txtdoc2old);
+ }
+
+ ITextDocument_Release(txtdoc);
+ IRichEditOle_Release(reole);
+ refcount = IRichEditOle_Release(reole);
+ ok(refcount == 1, "Got wrong ref count: %d.\n", refcount);
+ DestroyWindow(hwnd);
+
+ /* Methods should return CO_E_RELEASED if the backing document has
+ been released. One test should suffice. */
+ hres = ITextSelection_CanEdit(txtsel, NULL);
+ ok(hres == CO_E_RELEASED, "ITextSelection after ITextDocument destroyed\n");
+
+ ITextSelection_Release(txtsel);
+}
+
+START_TEST(richole)
+{
+ msftedit_hmodule = LoadLibraryA("msftedit.dll");
+ ok(msftedit_hmodule != NULL, "error: %d\n", (int) GetLastError());
+
+ test_Interfaces();
+}
--
2.19.0
Sept. 26, 2018