Piotr Caban : vbscript: Added IMatch interface to Match2 object.
Alexandre Julliard
julliard at winehq.org
Mon Mar 25 14:19:39 CDT 2013
Module: wine
Branch: master
Commit: 79632a2212cdcb5b0bb62b18547d57adeb069eef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=79632a2212cdcb5b0bb62b18547d57adeb069eef
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Mar 25 12:34:49 2013 +0100
vbscript: Added IMatch interface to Match2 object.
---
dlls/vbscript/tests/vbscript.c | 4 ++
dlls/vbscript/vbregexp.c | 87 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/dlls/vbscript/tests/vbscript.c b/dlls/vbscript/tests/vbscript.c
index f37c7cb..9e86a5f 100644
--- a/dlls/vbscript/tests/vbscript.c
+++ b/dlls/vbscript/tests/vbscript.c
@@ -875,6 +875,10 @@ static void test_RegExp(void)
ok(hres == S_OK, "QueryInterface(IID_IMatch2) returned %x\n", hres);
IDispatch_Release(disp);
+ hres = IMatch2_QueryInterface(match, &IID_IMatch, (void**)&unk);
+ ok(hres == S_OK, "QueryInterface(IID_IMatch) returned %x\n", hres);
+ IUnknown_Release(unk);
+
hres = IMatch2_get_Value(match, NULL);
ok(hres == E_POINTER, "get_Value returned %x, expected E_POINTER\n", hres);
diff --git a/dlls/vbscript/vbregexp.c b/dlls/vbscript/vbregexp.c
index b464232..ada364f 100644
--- a/dlls/vbscript/vbregexp.c
+++ b/dlls/vbscript/vbregexp.c
@@ -91,6 +91,7 @@ struct SubMatches {
typedef struct Match2 {
IMatch2 IMatch2_iface;
+ IMatch IMatch_iface;
LONG ref;
@@ -354,6 +355,9 @@ static HRESULT WINAPI Match2_QueryInterface(
}else if(IsEqualGUID(riid, &IID_IMatch2)) {
TRACE("(%p)->(IID_IMatch2 %p)\n", This, ppv);
*ppv = &This->IMatch2_iface;
+ }else if(IsEqualGUID(riid, &IID_IMatch)) {
+ TRACE("(%p)->(IID_IMatch %p)\n", This, ppv);
+ *ppv = &This->IMatch_iface;
}else if(IsEqualGUID(riid, &IID_IDispatchEx)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = NULL;
@@ -510,6 +514,88 @@ static const IMatch2Vtbl Match2Vtbl = {
Match2_get_SubMatches
};
+static inline Match2 *impl_from_IMatch(IMatch *iface)
+{
+ return CONTAINING_RECORD(iface, Match2, IMatch_iface);
+}
+
+static HRESULT WINAPI Match_QueryInterface(IMatch *iface, REFIID riid, void **ppv)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_QueryInterface(&This->IMatch2_iface, riid, ppv);
+}
+
+static ULONG WINAPI Match_AddRef(IMatch *iface)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_AddRef(&This->IMatch2_iface);
+}
+
+static ULONG WINAPI Match_Release(IMatch *iface)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_Release(&This->IMatch2_iface);
+}
+
+static HRESULT WINAPI Match_GetTypeInfoCount(IMatch *iface, UINT *pctinfo)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_GetTypeInfoCount(&This->IMatch2_iface, pctinfo);
+}
+
+static HRESULT WINAPI Match_GetTypeInfo(IMatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_GetTypeInfo(&This->IMatch2_iface, iTInfo, lcid, ppTInfo);
+}
+
+static HRESULT WINAPI Match_GetIDsOfNames(IMatch *iface, REFIID riid,
+ LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_GetIDsOfNames(&This->IMatch2_iface, riid, rgszNames, cNames, lcid, rgDispId);
+}
+
+static HRESULT WINAPI Match_Invoke(IMatch *iface, DISPID dispIdMember,
+ REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+ VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_Invoke(&This->IMatch2_iface, dispIdMember, riid, lcid,
+ wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI Match_get_Value(IMatch *iface, BSTR *pValue)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_get_Value(&This->IMatch2_iface, pValue);
+}
+
+static HRESULT WINAPI Match_get_FirstIndex(IMatch *iface, LONG *pFirstIndex)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_get_FirstIndex(&This->IMatch2_iface, pFirstIndex);
+}
+
+static HRESULT WINAPI Match_get_Length(IMatch *iface, LONG *pLength)
+{
+ Match2 *This = impl_from_IMatch(iface);
+ return IMatch2_get_Length(&This->IMatch2_iface, pLength);
+}
+
+static IMatchVtbl MatchVtbl = {
+ Match_QueryInterface,
+ Match_AddRef,
+ Match_Release,
+ Match_GetTypeInfoCount,
+ Match_GetTypeInfo,
+ Match_GetIDsOfNames,
+ Match_Invoke,
+ Match_get_Value,
+ Match_get_FirstIndex,
+ Match_get_Length
+};
+
static HRESULT create_match2(DWORD pos, match_state_t **result, IMatch2 **match)
{
Match2 *ret;
@@ -533,6 +619,7 @@ static HRESULT create_match2(DWORD pos, match_state_t **result, IMatch2 **match)
*result = NULL;
ret->IMatch2_iface.lpVtbl = &Match2Vtbl;
+ ret->IMatch_iface.lpVtbl = &MatchVtbl;
ret->ref = 1;
*match = &ret->IMatch2_iface;
More information about the wine-cvs
mailing list