MSHTML: Added stub implementation of protocol class factory

Jacek Caban jack at itma.pwr.wroc.pl
Sat Jun 25 18:05:40 CDT 2005


Changelog:
    Added stub implementation of protocol class factory
-------------- next part --------------
Index: dlls/mshtml/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/Makefile.in,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile.in
--- dlls/mshtml/Makefile.in	25 Jun 2005 17:58:35 -0000	1.12
+++ dlls/mshtml/Makefile.in	25 Jun 2005 22:59:56 -0000
@@ -13,6 +13,7 @@ C_SRCS = \
 	main.c \
 	oleobj.c \
 	persist.c \
+	protocol.c \
 	view.c
 
 RC_SRCS = rsrc.rc
Index: dlls/mshtml/main.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/main.c,v
retrieving revision 1.12
diff -u -p -r1.12 main.c
--- dlls/mshtml/main.c	25 Jun 2005 18:30:49 -0000	1.12
+++ dlls/mshtml/main.c	25 Jun 2005 22:59:56 -0000
@@ -37,14 +37,14 @@
 #include "advpub.h"
 
 #include "mshtml.h"
-#include "mshtml_private.h"
 
 #include "wine/unicode.h"
 #include "wine/debug.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
-
 #include "initguid.h"
+#include "mshtml_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 DEFINE_GUID( CLSID_MozillaBrowser, 0x1339B54C,0x3453,0x11D2,0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00);
 
@@ -207,8 +207,6 @@ HRESULT WINAPI MSHTML_DllGetClassObject(
     HRESULT hres;
     fnGetClassObject pGetClassObject;
 
-    TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv );
-
     if(hMozCtl && IsEqualGUID(&CLSID_HTMLDocument, rclsid)) {
         pGetClassObject = (fnGetClassObject) GetProcAddress(hMozCtl, "DllGetClassObject");
         if(pGetClassObject) {
@@ -221,9 +219,23 @@ HRESULT WINAPI MSHTML_DllGetClassObject(
     }
 
     if(IsEqualGUID(&CLSID_HTMLDocument, rclsid)) {
-        hres = ClassFactory_Create(riid, ppv, HTMLDocument_Create);
-        TRACE("hres = %08lx\n", hres);
-        return hres;
+        TRACE("(CLSID_HTMLDocument %s %p)\n", debugstr_guid(riid), ppv);
+        return ClassFactory_Create(riid, ppv, HTMLDocument_Create);
+    }else if(IsEqualGUID(&CLSID_AboutProtocol, rclsid)) {
+            TRACE("(CLSID_AboutProtocol %s %p)\n", debugstr_guid(riid), ppv);
+            return ProtocolFactory_Create(rclsid, riid, ppv);
+    }else if(IsEqualGUID(&CLSID_JSProtocol, rclsid)) {
+        TRACE("(CLSID_JSProtocol %s %p)\n", debugstr_guid(riid), ppv);
+        return ProtocolFactory_Create(rclsid, riid, ppv);
+    }else if(IsEqualGUID(&CLSID_MailtoProtocol, rclsid)) {
+        TRACE("(CLSID_MailtoProtocol %s %p)\n", debugstr_guid(riid), ppv);
+        return ProtocolFactory_Create(rclsid, riid, ppv);
+    }else if(IsEqualGUID(&CLSID_ResProtocol, rclsid)) {
+        TRACE("(CLSID_ResProtocol %s %p)\n", debugstr_guid(riid), ppv);
+        return ProtocolFactory_Create(rclsid, riid, ppv);
+    }else if(IsEqualGUID(&CLSID_SysimageProtocol, rclsid)) {
+        TRACE("(CLSID_SysimageProtocol %s %p)\n", debugstr_guid(riid), ppv);
+        return ProtocolFactory_Create(rclsid, riid, ppv);
     }
 
     FIXME("Unknown class %s\n", debugstr_guid(rclsid));
@@ -270,7 +282,6 @@ HRESULT WINAPI MSHTML_DllInstall(BOOL bI
     return S_OK;
 }
 
-DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
 DEFINE_GUID(CLSID_CAnchorBrowsePropertyPage, 0x3050F3BB, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
 DEFINE_GUID(CLSID_CBackgroundPropertyPage, 0x3050F232, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
 DEFINE_GUID(CLSID_CCDAnchorPropertyPage, 0x3050F1FC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
@@ -296,12 +307,8 @@ DEFINE_GUID(CLSID_HTMLWindowProxy, 0x305
 DEFINE_GUID(CLSID_IImageDecodeFilter, 0x607FD4E8, 0x0A03, 0x11D1, 0xAB,0x1D, 0x00,0xC0,0x4F,0xC9,0xB3,0x04);
 DEFINE_GUID(CLSID_IImgCtx, 0x3050F3D6, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
 DEFINE_GUID(CLSID_IntDitherer, 0x05F6FE1A, 0xECEF, 0x11D0, 0xAA,0xE7, 0x00,0xC0,0x4F,0xC9,0xB3,0x04);
-DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
 DEFINE_GUID(CLSID_MHTMLDocument, 0x3050F3D9, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
-DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
-DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
 DEFINE_GUID(CLSID_Scriptlet, 0xAE24FDAE, 0x03C6, 0x11D1, 0x8B,0x76, 0x00,0x80,0xC7,0x44,0xF3,0x89);
-DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
 DEFINE_GUID(CLSID_TridentAPI, 0x429AF92C, 0xA51F, 0x11D2, 0x86,0x1E, 0x00,0xC0,0x4F,0xA3,0x5C,0x89);
 
 #define INF_SET_CLSID(clsid) \
Index: dlls/mshtml/mshtml_private.h
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/mshtml_private.h,v
retrieving revision 1.8
diff -u -p -r1.8 mshtml_private.h
--- dlls/mshtml/mshtml_private.h	23 Jun 2005 16:44:43 -0000	1.8
+++ dlls/mshtml/mshtml_private.h	25 Jun 2005 22:59:56 -0000
@@ -54,4 +54,12 @@ void HTMLDocument_Persist_Init(HTMLDocum
 void HTMLDocument_OleObj_Init(HTMLDocument*);
 void HTMLDocument_View_Init(HTMLDocument*);
 
+HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
+
+DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
+DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
+DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
+DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
+DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
+
 extern HINSTANCE hInst;
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/mshtml/protocol.c	2005-06-26 00:34:38.000000000 +0200
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2005 Jacek Caban
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "docobj.h"
+
+#include "mshtml.h"
+
+#include "wine/debug.h"
+
+#include "mshtml_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+
+/********************************************************************
+ * ProtocolFactory implementation
+ */
+
+#define PROTOCOLINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl)
+#define CLASSFACTORY(x) ((IClassFactory*)         &(x)->lpClassFactoryVtbl)
+
+typedef struct {
+    const IInternetProtocolInfoVtbl *lpInternetProtocolInfoVtbl;
+    const IClassFactoryVtbl         *lpClassFactoryVtbl;
+
+    ULONG ref;
+} ProtocolFactory;
+
+#define PROTOCOLINFO_THIS \
+        ProtocolFactory* const This= \
+            (ProtocolFactory*)((BYTE*)(iface)-offsetof(ProtocolFactory,lpInternetProtocolInfoVtbl));
+
+static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
+{
+    PROTOCOLINFO_THIS
+
+    *ppv = NULL;
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = PROTOCOLINFO(This);
+    }else if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
+        TRACE("(%p)->(IID_IInternetProtocolInfo %p)\n", This, ppv);
+        *ppv = PROTOCOLINFO(This);
+    }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
+        TRACE("(%p)->(IID_IClassFactory %p)\n", This, ppv);
+        *ppv = CLASSFACTORY(This);
+    }
+
+    if(*ppv) {
+        IUnknown_AddRef((IUnknown*)*ppv);
+        return S_OK;
+    }
+
+    WARN("unknown interface %s\n", debugstr_guid(riid));
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
+{
+    PROTOCOLINFO_THIS
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%ld\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
+{
+    PROTOCOLINFO_THIS
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%ld\n", This, ref);
+
+    if(!ref)
+        HeapFree(GetProcessHeap(), 0, This);
+
+    return ref;
+}
+
+static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
+        PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
+        DWORD* pcchResult, DWORD dwReserved)
+{
+    PROTOCOLINFO_THIS
+    FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", This, debugstr_w(pwzUrl), ParseAction,
+            dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl,
+        LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult,
+        DWORD* pcchResult, DWORD dwReserved)
+{
+    PROTOCOLINFO_THIS
+    FIXME("%p)->(%s %s %08lx %p %ld %p %ld)\n", This, debugstr_w(pwzBaseUrl), debugstr_w(pwzRelativeUrl),
+            dwCombineFlags, pwzResult, cchResult, pcchResult, dwReserved);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1,
+        LPCWSTR pwzUrl2, DWORD dwCompareFlags)
+{
+    PROTOCOLINFO_THIS
+    FIXME("%p)->(%s %s %08lx)\n", This, debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
+        QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
+        DWORD dwReserved)
+{
+    PROTOCOLINFO_THIS
+    FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", This, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
+            cbBuffer, pcbBuf, dwReserved);
+    return E_NOTIMPL;
+}
+
+static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
+    InternetProtocolInfo_QueryInterface,
+    InternetProtocolInfo_AddRef,
+    InternetProtocolInfo_Release,
+    InternetProtocolInfo_ParseUrl,
+    InternetProtocolInfo_CombineUrl,
+    InternetProtocolInfo_CompareUrl,
+    InternetProtocolInfo_QueryInfo
+};
+
+#define CLASSFACTORY_THIS \
+    ProtocolFactory* const This= \
+        (ProtocolFactory*)((BYTE*)(iface)-offsetof(ProtocolFactory,lpClassFactoryVtbl));
+
+static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
+{
+    CLASSFACTORY_THIS
+    return IInternetProtocolInfo_QueryInterface(PROTOCOLINFO(This), riid, ppv);
+}
+
+static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
+{
+    CLASSFACTORY_THIS
+    return IInternetProtocolInfo_AddRef(PROTOCOLINFO(This));
+}
+
+static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
+{
+    CLASSFACTORY_THIS
+    return IInternetProtocolInfo_Release(PROTOCOLINFO(This));
+}
+
+static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
+        REFIID riid, void **ppv)
+{
+    CLASSFACTORY_THIS
+    FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+    return E_NOINTERFACE;
+}
+
+static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
+{
+    FIXME("(%p)->(%x)\n", iface, dolock);
+    return S_OK;
+}
+
+static const IClassFactoryVtbl ClassFactoryVtbl = {
+    ClassFactory_QueryInterface,
+    ClassFactory_AddRef,
+    ClassFactory_Release,
+    ClassFactory_CreateInstance,
+    ClassFactory_LockServer
+};
+
+HRESULT ProtocolFactory_Create(REFCLSID rclsid, REFIID riid, void **ppv)
+{
+    ProtocolFactory *ret;
+    HRESULT hres;
+
+    FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+
+    ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ProtocolFactory));
+
+    ret->lpInternetProtocolInfoVtbl = &InternetProtocolInfoVtbl;
+    ret->lpClassFactoryVtbl = &ClassFactoryVtbl;
+    ret->ref = 0;
+
+    hres = IUnknown_QueryInterface((IUnknown*)ret, riid, ppv);
+
+    if(FAILED(hres))
+        HeapFree(GetProcessHeap(), 0, ret);
+    
+    return hres;
+}


More information about the wine-patches mailing list