Aric Stewart : strmbase: Implement BaseDispatch.

Alexandre Julliard julliard at winehq.org
Fri Apr 20 12:49:29 CDT 2012


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri Apr 20 07:26:18 2012 -0500

strmbase: Implement BaseDispatch.

---

 dlls/strmbase/Makefile.in |    1 +
 dlls/strmbase/dispatch.c  |   82 +++++++++++++++++++++++++++++++++++++++++++++
 include/wine/strmbase.h   |   10 +++++
 3 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/dlls/strmbase/Makefile.in b/dlls/strmbase/Makefile.in
index e65d4df..f89c2c0 100644
--- a/dlls/strmbase/Makefile.in
+++ b/dlls/strmbase/Makefile.in
@@ -1,6 +1,7 @@
 MODULE    = libstrmbase.a
 
 C_SRCS = \
+	dispatch.c \
 	dllfunc.c \
 	enumpins.c \
 	filter.c \
diff --git a/dlls/strmbase/dispatch.c b/dlls/strmbase/dispatch.c
new file mode 100644
index 0000000..59ac99d3
--- /dev/null
+++ b/dlls/strmbase/dispatch.c
@@ -0,0 +1,82 @@
+/*
+ * Generic Implementation of IDispatch for strmbase classes
+ *
+ * Copyright 2012 Aric Stewart, 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 "dshow.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
+#include "wine/strmbase.h"
+#include "uuids.h"
+#include "vfwmsgs.h"
+#include <assert.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
+
+HRESULT WINAPI BaseDispatch_Init(BaseDispatch *This, REFIID riid)
+{
+    HRESULT hr = E_FAIL;
+    ITypeLib *pTypeLib;
+
+    This->pTypeInfo = NULL;
+    hr = LoadRegTypeLib(&LIBID_QuartzTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &pTypeLib);
+    if (SUCCEEDED(hr))
+    {
+        hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, riid, &This->pTypeInfo);
+
+    if (pTypeLib)
+        ITypeLib_Release(pTypeLib);
+    }
+    return hr;
+}
+
+HRESULT WINAPI BaseDispatch_Destroy(BaseDispatch *This)
+{
+    if (This->pTypeInfo)
+        ITypeInfo_Release(This->pTypeInfo);
+    return S_OK;
+}
+
+HRESULT WINAPI BaseDispatchImpl_GetIDsOfNames(BaseDispatch *This, REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
+{
+    if (This->pTypeInfo)
+        return ITypeInfo_GetIDsOfNames(This->pTypeInfo, rgszNames, cNames, rgdispid);
+    return E_NOTIMPL;
+}
+
+HRESULT WINAPI BaseDispatchImpl_GetTypeInfo(BaseDispatch *This, REFIID riid, UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
+{
+    if (This->pTypeInfo)
+    {
+        ITypeInfo_AddRef(This->pTypeInfo);
+        *pptinfo = This->pTypeInfo;
+        return S_OK;
+    }
+    return E_NOTIMPL;
+}
+
+HRESULT WINAPI BaseDispatchImpl_GetTypeInfoCount(BaseDispatch *This, UINT *pctinfo)
+{
+    if (This->pTypeInfo)
+        *pctinfo = 1;
+    else
+        *pctinfo = 0;
+    return S_OK;
+}
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index 770055a..4fa0e27 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -403,6 +403,16 @@ RECT WINAPI BaseWindowImpl_GetDefaultRect(BaseWindow *This);
 LRESULT WINAPI BaseWindowImpl_OnReceiveMessage(BaseWindow *This, HWND hwnd, INT uMsg, WPARAM wParam, LPARAM lParam);
 BOOL WINAPI BaseWindowImpl_OnSize(BaseWindow *This, LONG Height, LONG Width);
 
+typedef struct{
+    ITypeInfo *pTypeInfo;
+} BaseDispatch;
+
+HRESULT WINAPI BaseDispatch_Init(BaseDispatch *This, REFIID riid);
+HRESULT WINAPI BaseDispatch_Destroy(BaseDispatch *This);
+HRESULT WINAPI BaseDispatchImpl_GetIDsOfNames(BaseDispatch *This, REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid);
+HRESULT WINAPI BaseDispatchImpl_GetTypeInfo(BaseDispatch *This, REFIID riid, UINT itinfo, LCID lcid, ITypeInfo **pptinfo);
+HRESULT WINAPI BaseDispatchImpl_GetTypeInfoCount(BaseDispatch *This, UINT *pctinfo);
+
 #ifdef __IVideoWindow_FWD_DEFINED__
 typedef struct tagBaseControlWindow
 {




More information about the wine-cvs mailing list