Jacek Caban : mshtml: IPropertyBag stub implementation.

Alexandre Julliard julliard at winehq.org
Fri Dec 10 11:57:01 CST 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Dec 10 16:35:40 2010 +0100

mshtml: IPropertyBag stub implementation.

---

 dlls/mshtml/Makefile.in  |    1 +
 dlls/mshtml/pluginhost.c |    7 +--
 dlls/mshtml/pluginhost.h |    2 +
 dlls/mshtml/propbag.c    |  128 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 132 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in
index 2b4e66d..9ea7512 100644
--- a/dlls/mshtml/Makefile.in
+++ b/dlls/mshtml/Makefile.in
@@ -62,6 +62,7 @@ C_SRCS = \
 	omnavigator.c \
 	persist.c \
 	pluginhost.c \
+	propbag.c \
 	protocol.c \
 	script.c \
 	secmgr.c \
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index cfd40fa..f58b765 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -60,17 +60,12 @@ static BOOL check_load_safety(PluginHost *host)
     return policy == URLPOLICY_ALLOW;
 }
 
-static HRESULT create_prop_bag(IPropertyBag **ret) {
-    *ret = NULL;
-    return S_OK;
-}
-
 static void load_prop_bag(PluginHost *host, IPersistPropertyBag *persist_prop_bag)
 {
     IPropertyBag *prop_bag;
     HRESULT hres;
 
-    hres = create_prop_bag(&prop_bag);
+    hres = create_param_prop_bag(&prop_bag);
     if(FAILED(hres))
         return;
 
diff --git a/dlls/mshtml/pluginhost.h b/dlls/mshtml/pluginhost.h
index 7b88612..b9a9c1b 100644
--- a/dlls/mshtml/pluginhost.h
+++ b/dlls/mshtml/pluginhost.h
@@ -52,3 +52,5 @@ extern const IID IID_HTMLPluginContainer;
 HRESULT create_plugin_host(HTMLDocumentNode*,nsIDOMElement*,IUnknown*,const CLSID*,PluginHost**);
 void update_plugin_window(PluginHost*,HWND,const RECT*);
 void detach_plugin_hosts(HTMLDocumentNode*);
+
+HRESULT create_param_prop_bag(IPropertyBag**);
diff --git a/dlls/mshtml/propbag.c b/dlls/mshtml/propbag.c
new file mode 100644
index 0000000..fd44f03
--- /dev/null
+++ b/dlls/mshtml/propbag.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2010 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "shlobj.h"
+
+#include "mshtml_private.h"
+#include "pluginhost.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+
+typedef struct {
+    IPropertyBag  IPropertyBag_iface;
+
+    LONG ref;
+} PropertyBag;
+
+static inline PropertyBag *impl_from_IPropertyBag(IPropertyBag *iface)
+{
+    return CONTAINING_RECORD(iface, PropertyBag, IPropertyBag_iface);
+}
+
+static HRESULT WINAPI PropertyBag_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppv)
+{
+    PropertyBag *This = impl_from_IPropertyBag(iface);
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = &This->IPropertyBag_iface;
+    }else if(IsEqualGUID(&IID_IPropertyBag, riid)) {
+        TRACE("(%p)->(IID_IPropertyBag %p)\n", This, ppv);
+        *ppv = &This->IPropertyBag_iface;
+    }else {
+        WARN("Unsopported interface %s\n", debugstr_guid(riid));
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI PropertyBag_AddRef(IPropertyBag *iface)
+{
+    PropertyBag *This = impl_from_IPropertyBag(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI PropertyBag_Release(IPropertyBag *iface)
+{
+    PropertyBag *This = impl_from_IPropertyBag(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if(!ref)
+        heap_free(This);
+
+    return ref;
+}
+
+static HRESULT WINAPI PropertyBag_Read(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog)
+{
+    PropertyBag *This = impl_from_IPropertyBag(iface);
+    FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(pszPropName), pVar, pErrorLog);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI PropertyBag_Write(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar)
+{
+    PropertyBag *This = impl_from_IPropertyBag(iface);
+    FIXME("(%p)->(%s %s)\n", This, debugstr_w(pszPropName), debugstr_variant(pVar));
+    return E_NOTIMPL;
+}
+
+static const IPropertyBagVtbl PropertyBagVtbl = {
+    PropertyBag_QueryInterface,
+    PropertyBag_AddRef,
+    PropertyBag_Release,
+    PropertyBag_Read,
+    PropertyBag_Write
+};
+
+HRESULT create_param_prop_bag(IPropertyBag **ret)
+{
+    PropertyBag *prop_bag;
+
+    prop_bag = heap_alloc(sizeof(*prop_bag));
+    if(!prop_bag)
+        return E_OUTOFMEMORY;
+
+    prop_bag->IPropertyBag_iface.lpVtbl  = &PropertyBagVtbl;
+    prop_bag->ref = 1;
+
+    *ret = &prop_bag->IPropertyBag_iface;
+    return S_OK;
+}




More information about the wine-cvs mailing list