Piotr Caban : vbscript: Added IMatchCollection interface to MatchCollection2 object.

Alexandre Julliard julliard at winehq.org
Mon Mar 25 14:19:39 CDT 2013


Module: wine
Branch: master
Commit: fbf01da470f57ce2282c03b443ca65caca5ca39b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fbf01da470f57ce2282c03b443ca65caca5ca39b

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Mar 25 12:34:38 2013 +0100

vbscript: Added IMatchCollection interface to MatchCollection2 object.

---

 dlls/vbscript/tests/vbscript.c |    4 ++
 dlls/vbscript/vbregexp.c       |   89 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/dlls/vbscript/tests/vbscript.c b/dlls/vbscript/tests/vbscript.c
index 6b25ddd..f37c7cb 100644
--- a/dlls/vbscript/tests/vbscript.c
+++ b/dlls/vbscript/tests/vbscript.c
@@ -852,6 +852,10 @@ static void test_RegExp(void)
     ok(hres == S_OK, "QueryInterface(IID_IMatchCollection2) returned %x\n", hres);
     IDispatch_Release(disp);
 
+    hres = IMatchCollection2_QueryInterface(mc, &IID_IMatchCollection, (void**)&unk);
+    ok(hres == S_OK, "QueryInterface(IID_IMatchCollection) returned %x\n", hres);
+    IUnknown_Release(unk);
+
     hres = IMatchCollection2_get_Count(mc, NULL);
     ok(hres == E_POINTER, "get_Count returned %x, expected E_POINTER\n", hres);
 
diff --git a/dlls/vbscript/vbregexp.c b/dlls/vbscript/vbregexp.c
index f3fb874..b464232 100644
--- a/dlls/vbscript/vbregexp.c
+++ b/dlls/vbscript/vbregexp.c
@@ -110,6 +110,7 @@ typedef struct MatchCollectionEnum {
 
 typedef struct MatchCollection2 {
     IMatchCollection2 IMatchCollection2_iface;
+    IMatchCollection IMatchCollection_iface;
 
     LONG ref;
 
@@ -700,6 +701,9 @@ static HRESULT WINAPI MatchCollection2_QueryInterface(
     }else if(IsEqualGUID(riid, &IID_IMatchCollection2)) {
         TRACE("(%p)->(IID_IMatchCollection2 %p)\n", This, ppv);
         *ppv = &This->IMatchCollection2_iface;
+    }else if(IsEqualGUID(riid, &IID_IMatchCollection)) {
+        TRACE("(%p)->(IID_IMatchCollection %p)\n", This, ppv);
+        *ppv = &This->IMatchCollection_iface;
     }else if(IsEqualGUID(riid, &IID_IDispatchEx)) {
         TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
         *ppv = NULL;
@@ -842,6 +846,90 @@ static const IMatchCollection2Vtbl MatchCollection2Vtbl = {
     MatchCollection2_get__NewEnum
 };
 
+static inline MatchCollection2 *impl_from_IMatchCollection(IMatchCollection *iface)
+{
+    return CONTAINING_RECORD(iface, MatchCollection2, IMatchCollection_iface);
+}
+
+static HRESULT WINAPI MatchCollection_QueryInterface(IMatchCollection *iface, REFIID riid, void **ppv)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_QueryInterface(&This->IMatchCollection2_iface, riid, ppv);
+}
+
+static ULONG WINAPI MatchCollection_AddRef(IMatchCollection *iface)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_AddRef(&This->IMatchCollection2_iface);
+}
+
+static ULONG WINAPI MatchCollection_Release(IMatchCollection *iface)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_Release(&This->IMatchCollection2_iface);
+}
+
+static HRESULT WINAPI MatchCollection_GetTypeInfoCount(IMatchCollection *iface, UINT *pctinfo)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_GetTypeInfoCount(&This->IMatchCollection2_iface, pctinfo);
+}
+
+static HRESULT WINAPI MatchCollection_GetTypeInfo(IMatchCollection *iface,
+        UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_GetTypeInfo(&This->IMatchCollection2_iface, iTInfo, lcid, ppTInfo);
+}
+
+static HRESULT WINAPI MatchCollection_GetIDsOfNames(IMatchCollection *iface, REFIID riid,
+        LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_GetIDsOfNames(&This->IMatchCollection2_iface,
+            riid, rgszNames, cNames, lcid, rgDispId);
+}
+
+static HRESULT WINAPI MatchCollection_Invoke(IMatchCollection *iface, DISPID dispIdMember,
+        REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
+        EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_Invoke(&This->IMatchCollection2_iface, dispIdMember,
+            riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI MatchCollection_get_Item(IMatchCollection *iface, LONG index, IDispatch **ppMatch)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_get_Item(&This->IMatchCollection2_iface, index, ppMatch);
+}
+
+static HRESULT WINAPI MatchCollection_get_Count(IMatchCollection *iface, LONG *pCount)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_get_Count(&This->IMatchCollection2_iface, pCount);
+}
+
+static HRESULT WINAPI MatchCollection_get__NewEnum(IMatchCollection *iface, IUnknown **ppEnum)
+{
+    MatchCollection2 *This = impl_from_IMatchCollection(iface);
+    return IMatchCollection2_get__NewEnum(&This->IMatchCollection2_iface, ppEnum);
+}
+
+static const IMatchCollectionVtbl MatchCollectionVtbl = {
+    MatchCollection_QueryInterface,
+    MatchCollection_AddRef,
+    MatchCollection_Release,
+    MatchCollection_GetTypeInfoCount,
+    MatchCollection_GetTypeInfo,
+    MatchCollection_GetIDsOfNames,
+    MatchCollection_Invoke,
+    MatchCollection_get_Item,
+    MatchCollection_get_Count,
+    MatchCollection_get__NewEnum
+};
+
 static HRESULT add_match(IMatchCollection2 *iface, IMatch2 *add)
 {
     MatchCollection2 *This = impl_from_IMatchCollection2(iface);
@@ -881,6 +969,7 @@ static HRESULT create_match_collection2(IMatchCollection2 **match_collection)
         return E_OUTOFMEMORY;
 
     ret->IMatchCollection2_iface.lpVtbl = &MatchCollection2Vtbl;
+    ret->IMatchCollection_iface.lpVtbl = &MatchCollectionVtbl;
 
     ret->ref = 1;
     *match_collection = &ret->IMatchCollection2_iface;




More information about the wine-cvs mailing list