Implemented the basic COM framework.

Fixed all IUnknown of shdocvw.dll.
This commit is contained in:
Hidenori Takeshima 2002-03-20 01:02:15 +00:00 committed by Alexandre Julliard
parent 89894ffc15
commit e747da44f6
16 changed files with 2153 additions and 1813 deletions

View File

@ -4,19 +4,17 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = shdocvw MODULE = shdocvw
EXTRALIBS = $(LIBUUID)
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \ C_SRCS = \
classinfo.c \ api.c \
events.c \ browser.c \
factory.c \ comimpl.c \
misc.c \ connect.c \
oleobject.c \ shdocvw.c
persist.c \
shdocvw_main.c \
webbrowser.c
@MAKE_DLL_RULES@ @MAKE_DLL_RULES@

View File

@ -1,5 +1,6 @@
/* /*
* SHDOCVW - Internet Explorer Web Control * SHDOCVW - Internet Explorer Web Control
* FIXME - stub
* *
* Copyright 2001 John R. Sheets (for CodeWeavers) * Copyright 2001 John R. Sheets (for CodeWeavers)
* *
@ -20,7 +21,6 @@
#include <string.h> #include <string.h>
#include "winreg.h" #include "winreg.h"
#include "initguid.h"
#include "ole2.h" #include "ole2.h"
#include "shlwapi.h" #include "shlwapi.h"
@ -29,41 +29,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/***********************************************************************
* DllCanUnloadNow (SHDOCVW.109) */
HRESULT WINAPI SHDOCVW_DllCanUnloadNow(void)
{
FIXME("(void): stub\n");
return S_FALSE;
}
/*************************************************************************
* DllGetClassObject (SHDOCVW.312)
*/
HRESULT WINAPI SHDOCVW_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
TRACE("\n");
if (IsEqualGUID(&IID_IClassFactory, riid))
{
/* Pass back our shdocvw class factory */
*ppv = (LPVOID)&SHDOCVW_ClassFactory;
IClassFactory_AddRef((IClassFactory*)&SHDOCVW_ClassFactory);
return S_OK;
}
return CLASS_E_CLASSNOTAVAILABLE;
}
/*********************************************************************** /***********************************************************************
* DllGetVersion (SHDOCVW.113) * DllGetVersion (SHDOCVW.113)
*/ */
HRESULT WINAPI SHDOCVW_DllGetVersion (DLLVERSIONINFO *pdvi) HRESULT WINAPI SHDOCVW_DllGetVersion (DLLVERSIONINFO *pdvi)
{ {
FIXME("(void): stub\n"); FIXME("(void): stub\n");
return S_FALSE; return E_NOTIMPL;
} }
/************************************************************************* /*************************************************************************
@ -71,9 +43,9 @@ HRESULT WINAPI SHDOCVW_DllGetVersion (DLLVERSIONINFO *pdvi)
*/ */
HRESULT WINAPI SHDOCVW_DllInstall(BOOL bInstall, LPCWSTR cmdline) HRESULT WINAPI SHDOCVW_DllInstall(BOOL bInstall, LPCWSTR cmdline)
{ {
FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline)); FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
return S_OK; return E_NOTIMPL;
} }
/*********************************************************************** /***********************************************************************
@ -82,7 +54,7 @@ HRESULT WINAPI SHDOCVW_DllInstall(BOOL bInstall, LPCWSTR cmdline)
HRESULT WINAPI SHDOCVW_DllRegisterServer() HRESULT WINAPI SHDOCVW_DllRegisterServer()
{ {
FIXME("(), stub!\n"); FIXME("(), stub!\n");
return S_OK; return E_NOTIMPL;
} }
/*********************************************************************** /***********************************************************************
@ -91,6 +63,5 @@ HRESULT WINAPI SHDOCVW_DllRegisterServer()
HRESULT WINAPI SHDOCVW_DllUnregisterServer() HRESULT WINAPI SHDOCVW_DllUnregisterServer()
{ {
FIXME("(), stub!\n"); FIXME("(), stub!\n");
return S_OK; return E_NOTIMPL;
} }

1368
dlls/shdocvw/browser.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,168 +0,0 @@
/*
* Implementation of IProvideClassInfo interfaces for IE Web Browser control
*
* Copyright 2001 John R. Sheets (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include "wine/debug.h"
#include "shdocvw.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/**********************************************************************
* Implement the IProvideClassInfo interface
*
* FIXME: Should we just pass in the IProvideClassInfo2 methods rather
* reimplementing them here?
*/
static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IProvideClassInfoImpl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
{
ICOM_THIS(IProvideClassInfoImpl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
{
ICOM_THIS(IProvideClassInfoImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
/* Return an ITypeInfo interface to retrieve type library info about
* this control.
*/
static HRESULT WINAPI WBPCI_GetClassInfo(LPPROVIDECLASSINFO iface, LPTYPEINFO *ppTI)
{
FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
return S_OK;
}
/**********************************************************************
* IProvideClassInfo virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IProvideClassInfo) WBPCI_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBPCI_QueryInterface,
WBPCI_AddRef,
WBPCI_Release,
WBPCI_GetClassInfo
};
IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl, 1 };
/**********************************************************************
* Implement the IProvideClassInfo2 interface (inherits from
* IProvideClassInfo).
*/
static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IProvideClassInfo2Impl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface)
{
ICOM_THIS(IProvideClassInfo2Impl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface)
{
ICOM_THIS(IProvideClassInfo2Impl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
/* Return an ITypeInfo interface to retrieve type library info about
* this control.
*/
static HRESULT WINAPI WBPCI2_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO *ppTI)
{
FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
return S_OK;
}
/* Get the IID for generic default event callbacks. This IID will
* in theory be used to later query for an IConnectionPoint to connect
* an event sink (callback implmentation in the OLE control site)
* to this control.
*/
static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface,
DWORD dwGuidKind, GUID *pGUID)
{
FIXME("stub: dwGuidKind = %ld, pGUID = %s\n", dwGuidKind, debugstr_guid(pGUID));
if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
{
FIXME ("Requested unsupported GUID type: %ld\n", dwGuidKind);
return E_FAIL; /* Is there a better return type here? */
}
/* FIXME: Returning IPropertyNotifySink interface, but should really
* return a more generic event set (???) dispinterface.
* However, this hack, allows a control site to return with success
* (MFC's COleControlSite falls back to older IProvideClassInfo interface
* if GetGUID() fails to return a non-NULL GUID).
*/
memcpy(pGUID, &IID_IPropertyNotifySink, sizeof(GUID));
FIXME("Wrongly returning IPropertyNotifySink interface %s\n",
debugstr_guid(pGUID));
return S_OK;
}
/**********************************************************************
* IProvideClassInfo virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IProvideClassInfo2) WBPCI2_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBPCI2_QueryInterface,
WBPCI2_AddRef,
WBPCI2_Release,
WBPCI2_GetClassInfo,
WBPCI2_GetGUID
};
IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl, 1 };

444
dlls/shdocvw/comimpl.c Normal file
View File

@ -0,0 +1,444 @@
/*
* A basic implementation for COM DLL implementor.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "windef.h"
#include "winerror.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "ole2.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(comimpl);
#include "comimpl.h"
/*
- All threading model including Apartment and Both are supported.
- Aggregation is supported.
- CoFreeUnusedLibraries() is supported.
- DisableThreadLibraryCalls() is supported.
*/
static CRITICAL_SECTION csComImpl;
static DWORD dwComImplRef;
static HRESULT WINAPI
IUnknown_fnQueryInterface(IUnknown* iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(COMIMPL_IUnkImpl,iface);
size_t ofs;
DWORD dwIndex;
COMIMPL_IFDelegation* pDelegation;
HRESULT hr;
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
*ppobj = NULL;
ofs = 0;
if ( IsEqualGUID( &IID_IUnknown, riid ) )
{
TRACE("IID_IUnknown - returns inner object.\n");
}
else
{
for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
{
if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
{
ofs = This->pEntries[dwIndex].ofsVTPtr;
break;
}
}
if ( dwIndex == This->dwEntries )
{
hr = E_NOINTERFACE;
/* delegation */
pDelegation = This->pDelegationFirst;
while ( pDelegation != NULL )
{
hr = (*pDelegation->pOnQueryInterface)( iface, riid, ppobj );
if ( hr != E_NOINTERFACE )
break;
pDelegation = pDelegation->pNext;
}
if ( hr == E_NOINTERFACE )
{
FIXME("(%p) unknown interface: %s\n",This,debugstr_guid(riid));
}
return hr;
}
}
*ppobj = (LPVOID)(((char*)This) + ofs);
IUnknown_AddRef((IUnknown*)(*ppobj));
return S_OK;
}
static ULONG WINAPI
IUnknown_fnAddRef(IUnknown* iface)
{
ICOM_THIS(COMIMPL_IUnkImpl,iface);
TRACE("(%p)->()\n",This);
return InterlockedExchangeAdd(&(This->ref),1) + 1;
}
static ULONG WINAPI
IUnknown_fnRelease(IUnknown* iface)
{
ICOM_THIS(COMIMPL_IUnkImpl,iface);
LONG ref;
TRACE("(%p)->()\n",This);
ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
if ( ref > 0 )
return (ULONG)ref;
This->ref ++;
if ( This->pOnFinalRelease != NULL )
(*(This->pOnFinalRelease))(iface);
This->ref --;
COMIMPL_FreeObj(This);
return 0;
}
static ICOM_VTABLE(IUnknown) iunknown =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IUnknown_fnQueryInterface,
IUnknown_fnAddRef,
IUnknown_fnRelease,
};
void COMIMPL_IUnkInit( COMIMPL_IUnkImpl* pImpl, IUnknown* punkOuter )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(pImpl) = &iunknown;
pImpl->pEntries = NULL;
pImpl->dwEntries = 0;
pImpl->pDelegationFirst = NULL;
pImpl->pOnFinalRelease = NULL;
pImpl->ref = 1;
pImpl->punkControl = (IUnknown*)pImpl;
/* for implementing aggregation. */
if ( punkOuter != NULL )
pImpl->punkControl = punkOuter;
}
void COMIMPL_IUnkAddDelegationHandler(
COMIMPL_IUnkImpl* pImpl, COMIMPL_IFDelegation* pDelegation )
{
pDelegation->pNext = pImpl->pDelegationFirst;
pImpl->pDelegationFirst = pDelegation;
}
/************************************************************************/
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface);
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface);
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj);
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock);
static ICOM_VTABLE(IClassFactory) iclassfact =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IClassFactory_fnQueryInterface,
IClassFactory_fnAddRef,
IClassFactory_fnRelease,
IClassFactory_fnCreateInstance,
IClassFactory_fnLockServer
};
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IClassFactory);
LONG ref;
/* IClassFactory fields */
const COMIMPL_CLASSENTRY* pEntry;
} IClassFactoryImpl;
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%p)\n",This,riid,ppobj);
if ( ( IsEqualGUID( &IID_IUnknown, riid ) ) ||
( IsEqualGUID( &IID_IClassFactory, riid ) ) )
{
*ppobj = iface;
IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->()\n",This);
return InterlockedExchangeAdd(&(This->ref),1) + 1;
}
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
LONG ref;
TRACE("(%p)->()\n",This);
ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
if ( ref > 0 )
return (ULONG)ref;
COMIMPL_FreeObj(This);
return 0;
}
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
HRESULT hr;
IUnknown* punk;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
if ( pOuter != NULL && !IsEqualGUID( riid, &IID_IUnknown ) )
return CLASS_E_NOAGGREGATION;
*ppobj = NULL;
hr = (*This->pEntry->pCreateIUnk)(pOuter,(void**)&punk);
if ( hr != S_OK )
return hr;
hr = IUnknown_QueryInterface(punk,riid,ppobj);
IUnknown_Release(punk);
return hr;
}
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl,iface);
HRESULT hr;
TRACE("(%p)->(%d)\n",This,dolock);
if (dolock)
hr = IClassFactory_AddRef(iface);
else
hr = IClassFactory_Release(iface);
return hr;
}
static HRESULT IClassFactory_Alloc( const CLSID* pclsid, void** ppobj )
{
const COMIMPL_CLASSENTRY* pEntry;
IClassFactoryImpl* pImpl;
TRACE( "(%s,%p)\n", debugstr_guid(pclsid), ppobj );
pEntry = COMIMPL_ClassList;
while ( pEntry->pclsid != NULL )
{
if ( IsEqualGUID( pclsid, pEntry->pclsid ) )
goto found;
pEntry ++;
}
return CLASS_E_CLASSNOTAVAILABLE;
found:
pImpl = (IClassFactoryImpl*)COMIMPL_AllocObj( sizeof(IClassFactoryImpl) );
if ( pImpl == NULL )
return E_OUTOFMEMORY;
TRACE( "allocated successfully.\n" );
ICOM_VTBL(pImpl) = &iclassfact;
pImpl->ref = 1;
pImpl->pEntry = pEntry;
*ppobj = (void*)pImpl;
return S_OK;
}
/***********************************************************************
* COMIMPL_InitProcess (internal)
*/
static BOOL COMIMPL_InitProcess( HINSTANCE hInstDLL )
{
TRACE("()\n");
dwComImplRef = 0;
InitializeCriticalSection( &csComImpl );
#ifndef COMIMPL_PERTHREAD_INIT
DisableThreadLibraryCalls((HMODULE)hInstDLL);
#endif /* COMIMPL_PERTHREAD_INIT */
return TRUE;
}
/***********************************************************************
* COMIMPL_UninitProcess (internal)
*/
static void COMIMPL_UninitProcess( HINSTANCE hInstDLL )
{
CHAR szThisDLL[ MAX_PATH ];
TRACE("()\n");
if ( dwComImplRef != 0 )
{
szThisDLL[0] = '\0';
if ( !GetModuleFileNameA( (HMODULE)hInstDLL, szThisDLL, MAX_PATH ) )
szThisDLL[0] = '\0';
ERR( "you must release some objects allocated from %s.\n", szThisDLL );
}
DeleteCriticalSection( &csComImpl );
}
/***********************************************************************
* COMIMPL_DllMain
*/
BOOL WINAPI COMIMPL_DllMain(
HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
TRACE("(%08x,%08lx,%p)\n",hInstDLL,fdwReason,lpvReserved);
switch ( fdwReason )
{
case DLL_PROCESS_ATTACH:
if ( !COMIMPL_InitProcess( hInstDLL ) )
return FALSE;
break;
case DLL_PROCESS_DETACH:
COMIMPL_UninitProcess( hInstDLL );
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
/***********************************************************************
* COMIMPL_DllGetClassObject
*/
HRESULT WINAPI COMIMPL_DllGetClassObject(
const CLSID* pclsid,const IID* piid,void** ppv)
{
*ppv = NULL;
if ( IsEqualGUID( &IID_IUnknown, piid ) ||
IsEqualGUID( &IID_IClassFactory, piid ) )
{
return IClassFactory_Alloc( pclsid, ppv );
}
return CLASS_E_CLASSNOTAVAILABLE;
}
/***********************************************************************
* COMIMPL_DllCanUnloadNow
*
* RETURNS
* Success: S_OK
* Failure: S_FALSE
*/
HRESULT WINAPI COMIMPL_DllCanUnloadNow(void)
{
HRESULT hr;
EnterCriticalSection( &csComImpl );
hr = ( dwComImplRef == 0 ) ? S_OK : S_FALSE;
LeaveCriticalSection( &csComImpl );
return hr;
}
/***********************************************************************
* COMIMPL_AllocObj
*/
void* COMIMPL_AllocObj( DWORD dwSize )
{
void* pv;
EnterCriticalSection( &csComImpl );
dwComImplRef ++;
pv = HeapAlloc( COMIMPL_hHeap, 0, dwSize );
if ( pv == NULL )
dwComImplRef --;
LeaveCriticalSection( &csComImpl );
return pv;
}
/***********************************************************************
* COMIMPL_FreeObj
*/
void COMIMPL_FreeObj( void* pobj )
{
EnterCriticalSection( &csComImpl );
HeapFree( COMIMPL_hHeap, 0, pobj );
dwComImplRef --;
LeaveCriticalSection( &csComImpl );
}

171
dlls/shdocvw/comimpl.h Normal file
View File

@ -0,0 +1,171 @@
/*
* A basic implementation for COM DLL implementor.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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
*/
#ifndef WINE_COMIMPL_H
#define WINE_COMIMPL_H
/*
This code provides a basic thread-safe COM implementation
including aggregation(and an IClassFactory implementation).
This code is based on my quartz code.
The usage of this library is:
1) copy comimpl.h and comimpl.c.
2) implement the global class entries 'COMIMPL_ClassList'.
3) export COMIMPL_DllMain, COMIMPL_DllGetClassObject and
COMIMPL_DllCanUnloadNow.
4) add 'comimpl' to your debug channels.
5) implement your IUnknown as a thunk to call
COMIMPL_IUnkImpl.punk methods.
6) provide pointers of vtables in constructor.
7) optionally, you can edit comimpl.h and/or comimpl.c.
A sample allocator of class COne that supports
two interface IOne and ITwo is:
const COMIMPL_CLASSENTRY COMIMPL_ClassList[] =
{
{ &CLSID_COne, &COne_AllocObj },
{ NULL, NULL } << the last entry must be NULL >>
};
typedef struct COne
{
COMIMPL_IUnkImpl vfunk; << must be the first member of this struct >>
struct { ICOM_VFIELD(IOne); } vfone;
struct { ICOM_VFIELD(ITwo); } vftwo;
<< ... >>
} COne;
#define COne_THIS(iface,member) COne* This = ((COne*)(((char*)iface)-offsetof(COne,member)))
static COMIMPL_IFEntry IFEntries[] =
{
<< all supported interfaces >>
{ &IID_IOne, offsetof(COne,vfone)-offsetof(COne,vfunk) },
{ &IID_ITwo, offsetof(COne,vftwo)-offsetof(COne,vfunk) },
};
static void COne_Destructor(IUnknown* iface)
{
COne_THIS(iface,vfunk);
<< ... implement destructor ... >>
}
HRESULT COne_AllocObj(IUnknown* punkOuter,void** ppobj)
{
COne* This;
This = (COne*)COMIMPL_AllocObj( sizeof(COne) );
if ( This == NULL ) return E_OUTOFMEMORY;
COMIMPL_IUnkInit( &This->vfunk, punkOuter );
This->vfunk.pEntries = IFEntries;
This->vfunk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
This->vfunk.pOnFinalRelease = COne_Destructor;
ICOM_VTBL(&This->vfone) = &ione;
ICOM_VTBL(&This->vftwo) = &itwo;
<< ... implement constructor ... >>
<< if error occurs in constructing, you can call simply
punk::Release() and return HRESULT. >>
*ppobj = (void*)(&This->vfunk);
return S_OK; << return S_OK if succeeded >>
}
*/
/* if per-thread initialization is needed, uncomment the following line */
/*#define COMIMPL_PERTHREAD_INIT*/
/* If an own heap is needed, customize the following line */
#define COMIMPL_hHeap GetProcessHeap()
typedef HRESULT (*COMIMPL_pCreateIUnknown)(IUnknown* punkOuter,void** ppobj);
typedef void (*COMIMPL_pOnFinalRelease)(IUnknown* punkInner);
typedef struct COMIMPL_IFEntry COMIMPL_IFEntry;
typedef struct COMIMPL_IFDelegation COMIMPL_IFDelegation;
typedef struct COMIMPL_IUnkImpl COMIMPL_IUnkImpl;
struct COMIMPL_IFEntry
{
const IID* piid; /* interface ID. */
size_t ofsVTPtr; /* offset from IUnknown. */
};
struct COMIMPL_IFDelegation
{
struct COMIMPL_IFDelegation* pNext;
HRESULT (*pOnQueryInterface)(
IUnknown* punk, const IID* piid, void** ppobj );
};
/* COMIMPL_IUnkimpl must be aligned for InterlockedExchangeAdd. */
#include <pshpack4.h>
struct COMIMPL_IUnkImpl
{
/* pointer of IUnknown interface. */
ICOM_VFIELD(IUnknown);
/* array of supported IIDs and offsets. */
const COMIMPL_IFEntry* pEntries;
DWORD dwEntries;
/* list of delegation handlers. */
COMIMPL_IFDelegation* pDelegationFirst;
/* called on final release. */
COMIMPL_pOnFinalRelease pOnFinalRelease;
/* IUnknown fields. */
LONG ref;
IUnknown* punkControl;
};
#include <poppack.h>
typedef struct COMIMPL_CLASSENTRY
{
const CLSID* pclsid;
COMIMPL_pCreateIUnknown pCreateIUnk;
} COMIMPL_CLASSENTRY;
extern const COMIMPL_CLASSENTRY COMIMPL_ClassList[]; /* must be provided */
void COMIMPL_IUnkInit( COMIMPL_IUnkImpl* pImpl, IUnknown* punkOuter );
void COMIMPL_IUnkAddDelegationHandler(
COMIMPL_IUnkImpl* pImpl, COMIMPL_IFDelegation* pDelegation );
BOOL WINAPI COMIMPL_DllMain(
HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved );
HRESULT WINAPI COMIMPL_DllGetClassObject(
const CLSID* pclsid,const IID* piid,void** ppv);
HRESULT WINAPI COMIMPL_DllCanUnloadNow(void);
void* COMIMPL_AllocObj( DWORD dwSize );
void COMIMPL_FreeObj( void* pobj ); /* for internal use only. */
#endif /* WINE_COMIMPL_H */

View File

@ -1,10 +1,9 @@
/* /*
* Implementation of event-related interfaces for IE Web Browser control: * CConnectionPointImpl
* * FIXME - stub
* - IConnectionPointContainer
* - IConnectionPoint
* *
* Copyright 2001 John R. Sheets (for CodeWeavers) * Copyright 2001 John R. Sheets (for CodeWeavers)
* Copyright 2002 Hidenori Takeshima
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -21,97 +20,58 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <string.h> #include "config.h"
#include "wine/debug.h"
#include "shdocvw.h"
#include <string.h>
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "ole2.h"
#include "wine/obj_base.h"
#include "wine/obj_storage.h"
#include "wine/obj_misc.h"
#include "wine/obj_moniker.h"
#include "wine/obj_inplace.h"
#include "wine/obj_dataobject.h"
#include "wine/obj_oleobj.h"
#include "wine/obj_oleaut.h"
#include "wine/obj_olefont.h"
#include "wine/obj_dragdrop.h"
#include "wine/obj_oleview.h"
#include "wine/obj_control.h"
#include "wine/obj_connection.h"
#include "wine/obj_property.h"
#include "wine/obj_oleundo.h"
#include "wine/obj_webbrowser.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
#include "shdocvw.h"
/**********************************************************************
* Implement the IConnectionPointContainer interface
*/
static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface, typedef struct CConnectionPointImpl
REFIID riid, LPVOID *ppobj)
{ {
ICOM_THIS(IConnectionPointContainerImpl, iface); COMIMPL_IUnkImpl vfunk; /* must be the first member of this struct */
struct { ICOM_VFIELD(IConnectionPoint); } vfcpoint;
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); /* CConnectionPointImpl variables */
return E_NOINTERFACE;
}
static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface) } CConnectionPointImpl;
#define CConnectionPointImpl_THIS(iface,member) CConnectionPointImpl* This = ((CConnectionPointImpl*)(((char*)iface)-offsetof(CConnectionPointImpl,member)))
static COMIMPL_IFEntry IFEntries[] =
{ {
ICOM_THIS(IConnectionPointContainerImpl, iface); { &IID_IConnectionPoint, offsetof(CConnectionPointImpl,vfcpoint)-offsetof(CConnectionPointImpl,vfunk) },
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
{
ICOM_THIS(IConnectionPointContainerImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
/* Get a list of connection points inside this container. */
static HRESULT WINAPI WBCPC_EnumConnectionPoints(LPCONNECTIONPOINTCONTAINER iface,
LPENUMCONNECTIONPOINTS *ppEnum)
{
FIXME("stub: IEnumConnectionPoints = %p\n", *ppEnum);
return S_OK;
}
/* Retrieve the connection point in this container associated with the
* riid interface. When events occur in the control, the control can
* call backwards into its embedding site, through these interfaces.
*/
static HRESULT WINAPI WBCPC_FindConnectionPoint(LPCONNECTIONPOINTCONTAINER iface,
REFIID riid, LPCONNECTIONPOINT *ppCP)
{
TRACE(": IID = %s, IConnectionPoint = %p\n", debugstr_guid(riid), *ppCP);
/* For now, return the same IConnectionPoint object for both
* event interface requests.
*/
if (IsEqualGUID (&IID_INotifyDBEvents, riid))
{
TRACE("Returning connection point %p for IID_INotifyDBEvents\n",
&SHDOCVW_ConnectionPoint);
*ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
return S_OK;
}
else if (IsEqualGUID (&IID_IPropertyNotifySink, riid))
{
TRACE("Returning connection point %p for IID_IPropertyNotifySink\n",
&SHDOCVW_ConnectionPoint);
*ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
return S_OK;
}
return E_FAIL;
}
/**********************************************************************
* IConnectionPointContainer virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IConnectionPointContainer) WBCPC_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBCPC_QueryInterface,
WBCPC_AddRef,
WBCPC_Release,
WBCPC_EnumConnectionPoints,
WBCPC_FindConnectionPoint
}; };
IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl, 1 }; /***************************************************************************
*
* CConnectionPointImpl::IConnectionPoint
*/
/********************************************************************** /**********************************************************************
* Implement the IConnectionPoint interface * Implement the IConnectionPoint interface
@ -120,33 +80,35 @@ IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl,
static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface, static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
ICOM_THIS(IConnectionPointImpl, iface); CConnectionPointImpl_THIS(iface,vfcpoint);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj); TRACE("(%p)->()\n",This);
return E_NOINTERFACE;
return IUnknown_QueryInterface(This->vfunk.punkControl,riid,ppobj);
} }
static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface) static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
{ {
ICOM_THIS(IConnectionPointImpl, iface); CConnectionPointImpl_THIS(iface,vfcpoint);
TRACE("\n"); TRACE("(%p)->()\n",This);
return ++(This->ref);
return IUnknown_AddRef(This->vfunk.punkControl);
} }
static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface) static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
{ {
ICOM_THIS(IConnectionPointImpl, iface); CConnectionPointImpl_THIS(iface,vfcpoint);
/* static class, won't be freed */ TRACE("(%p)->()\n",This);
TRACE("\n");
return --(This->ref); return IUnknown_Release(This->vfunk.punkControl);
} }
static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId) static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)
{ {
FIXME("stub: %s\n", debugstr_guid(pIId)); FIXME("stub: %s\n", debugstr_guid(pIId));
return S_OK; return E_NOTIMPL;
} }
/* Get this connection point's owning container */ /* Get this connection point's owning container */
@ -155,7 +117,7 @@ WBCP_GetConnectionPointContainer(LPCONNECTIONPOINT iface,
LPCONNECTIONPOINTCONTAINER *ppCPC) LPCONNECTIONPOINTCONTAINER *ppCPC)
{ {
FIXME("stub: IConnectionPointContainer = %p\n", *ppCPC); FIXME("stub: IConnectionPointContainer = %p\n", *ppCPC);
return S_OK; return E_NOTIMPL;
} }
/* Connect the pUnkSink event-handling implementation (in the control site) /* Connect the pUnkSink event-handling implementation (in the control site)
@ -165,14 +127,16 @@ WBCP_GetConnectionPointContainer(LPCONNECTIONPOINT iface,
static HRESULT WINAPI WBCP_Advise(LPCONNECTIONPOINT iface, static HRESULT WINAPI WBCP_Advise(LPCONNECTIONPOINT iface,
LPUNKNOWN pUnkSink, DWORD *pdwCookie) LPUNKNOWN pUnkSink, DWORD *pdwCookie)
{ {
FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie);
#if 0
static int new_cookie; static int new_cookie;
FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie); FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie);
*pdwCookie = ++new_cookie; *pdwCookie = ++new_cookie;
TRACE ("Returning cookie = %ld\n", *pdwCookie); TRACE ("Returning cookie = %ld\n", *pdwCookie);
#endif
return S_OK; return E_NOTIMPL;
} }
/* Disconnect this implementation from the connection point. */ /* Disconnect this implementation from the connection point. */
@ -180,7 +144,7 @@ static HRESULT WINAPI WBCP_Unadvise(LPCONNECTIONPOINT iface,
DWORD dwCookie) DWORD dwCookie)
{ {
FIXME("stub: cookie to disconnect = %ld\n", dwCookie); FIXME("stub: cookie to disconnect = %ld\n", dwCookie);
return S_OK; return E_NOTIMPL;
} }
/* Get a list of connections in this connection point. */ /* Get a list of connections in this connection point. */
@ -188,7 +152,7 @@ static HRESULT WINAPI WBCP_EnumConnections(LPCONNECTIONPOINT iface,
LPENUMCONNECTIONS *ppEnum) LPENUMCONNECTIONS *ppEnum)
{ {
FIXME("stub: IEnumConnections = %p\n", *ppEnum); FIXME("stub: IEnumConnections = %p\n", *ppEnum);
return S_OK; return E_NOTIMPL;
} }
/********************************************************************** /**********************************************************************
@ -208,4 +172,38 @@ static ICOM_VTABLE(IConnectionPoint) WBCP_Vtbl =
WBCP_EnumConnections WBCP_EnumConnections
}; };
IConnectionPointImpl SHDOCVW_ConnectionPoint = { &WBCP_Vtbl, 1 }; /***************************************************************************
*
* new/delete CConnectionPointImpl
*
*/
static void CConnectionPointImpl_Destructor(IUnknown* iface)
{
CConnectionPointImpl_THIS(iface,vfunk);
FIXME("(%p)\n",This);
/* destructor */
}
HRESULT CConnectionPointImpl_AllocObj(IUnknown* punkOuter,void** ppobj)
{
CConnectionPointImpl* This;
This = (CConnectionPointImpl*)COMIMPL_AllocObj( sizeof(CConnectionPointImpl) );
if ( This == NULL ) return E_OUTOFMEMORY;
COMIMPL_IUnkInit( &This->vfunk, punkOuter );
This->vfunk.pEntries = IFEntries;
This->vfunk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
This->vfunk.pOnFinalRelease = CConnectionPointImpl_Destructor;
ICOM_VTBL(&This->vfcpoint) = &WBCP_Vtbl;
/* constructor */
return S_OK;
}

View File

@ -1,122 +0,0 @@
/*
* Implementation of class factory for IE Web Browser
*
* Copyright 2001 John R. Sheets (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include "wine/debug.h"
#include "shdocvw.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/**********************************************************************
* Implement the IWebBrowser class factory
*
* (Based on implementation in ddraw/main.c)
*/
/**********************************************************************
* WBCF_QueryInterface (IUnknown)
*/
static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl, iface);
TRACE ("\n");
/*
* Perform a sanity check on the parameters.
*/
if ((This == NULL) || (ppobj == NULL) )
return E_INVALIDARG;
return E_NOINTERFACE;
}
/************************************************************************
* WBCF_AddRef (IUnknown)
*/
static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl, iface);
TRACE("\n");
return ++(This->ref);
}
/************************************************************************
* WBCF_Release (IUnknown)
*/
static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
/************************************************************************
* WBCF_CreateInstance (IClassFactory)
*/
static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl, iface);
/* Don't support aggregation (yet?) */
if (pOuter)
{
TRACE ("Failed attempt to aggregate IWebBrowser\n");
return CLASS_E_NOAGGREGATION;
}
TRACE("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
if ((IsEqualGUID (&IID_IOleObject, riid)))
{
TRACE ("Instantiating IOleObject component\n");
*ppobj = (LPVOID)&SHDOCVW_OleObject;
return S_OK;
}
return CLASS_E_CLASSNOTAVAILABLE;
}
/************************************************************************
* WBCF_LockServer (IClassFactory)
*/
static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl, iface);
FIXME("(%p)->(%d),stub!\n", This, dolock);
return S_OK;
}
static ICOM_VTABLE(IClassFactory) WBCF_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBCF_QueryInterface,
WBCF_AddRef,
WBCF_Release,
WBCF_CreateInstance,
WBCF_LockServer
};
IClassFactoryImpl SHDOCVW_ClassFactory = { &WBCF_Vtbl, 1 };

View File

@ -1,94 +0,0 @@
/*
* Implementation of miscellaneous interfaces for IE Web Browser control:
*
* - IQuickActivate
*
* Copyright 2001 John R. Sheets (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/debug.h"
#include "shdocvw.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/**********************************************************************
* Implement the IQuickActivate interface
*/
static HRESULT WINAPI WBQA_QueryInterface(LPQUICKACTIVATE iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IQuickActivateImpl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WBQA_AddRef(LPQUICKACTIVATE iface)
{
ICOM_THIS(IQuickActivateImpl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBQA_Release(LPQUICKACTIVATE iface)
{
ICOM_THIS(IQuickActivateImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
/* Alternative interface for quicker, easier activation of a control. */
static HRESULT WINAPI WBQA_QuickActivate(LPQUICKACTIVATE iface,
QACONTAINER *pQaContainer,
QACONTROL *pQaControl)
{
FIXME("stub: QACONTAINER = %p, QACONTROL = %p\n", pQaContainer, pQaControl);
return S_OK;
}
static HRESULT WINAPI WBQA_SetContentExtent(LPQUICKACTIVATE iface, LPSIZEL pSizel)
{
FIXME("stub: LPSIZEL = %p\n", pSizel);
return E_NOINTERFACE;
}
static HRESULT WINAPI WBQA_GetContentExtent(LPQUICKACTIVATE iface, LPSIZEL pSizel)
{
FIXME("stub: LPSIZEL = %p\n", pSizel);
return E_NOINTERFACE;
}
/**********************************************************************
* IQuickActivate virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IQuickActivate) WBQA_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBQA_QueryInterface,
WBQA_AddRef,
WBQA_Release,
WBQA_QuickActivate,
WBQA_SetContentExtent,
WBQA_GetContentExtent
};
IQuickActivateImpl SHDOCVW_QuickActivate = { &WBQA_Vtbl, 1 };

View File

@ -1,618 +0,0 @@
/*
* Implementation of IOleObject interfaces for IE Web Browser
*
* - IOleObject
* - IOleInPlaceObject
* - IOleControl
*
* Copyright 2001 John R. Sheets (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include "wine/debug.h"
#include "shdocvw.h"
#include "ole2.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/**********************************************************************
* Implement the IOleObject interface for the web browser component
*
* Based on DefaultHandler code in dlls/ole32/defaulthandler.c.
*/
static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface);
static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface);
/************************************************************************
* WBOOBJ_QueryInterface (IUnknown)
*
* Interfaces we need to (at least pretend to) retrieve:
*
* a6bc3ac0-dbaa-11ce-9de3-00aa004bb851 IID_IProvideClassInfo2
* b196b283-bab4-101a-b69c-00aa00341d07 IID_IProvideClassInfo
* cf51ed10-62fe-11cf-bf86-00a0c9034836 IID_IQuickActivate
* 7fd52380-4e07-101b-ae2d-08002b2ec713 IID_IPersistStreamInit
* 0000010a-0000-0000-c000-000000000046 IID_IPersistStorage
* b196b284-bab4-101a-b69c-00aa00341d07 IID_IConnectionPointContainer
*/
static HRESULT WINAPI WBOOBJ_QueryInterface(LPOLEOBJECT iface,
REFIID riid, void** ppobj)
{
ICOM_THIS(IOleObjectImpl, iface);
/*
* Perform a sanity check on the parameters.
*/
if ((This == NULL) || (ppobj == NULL) )
return E_INVALIDARG;
if (IsEqualGUID (&IID_IPersistStorage, riid))
{
TRACE("Returning IID_IPersistStorage interface\n");
*ppobj = (LPVOID)&SHDOCVW_PersistStorage;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IPersistStreamInit, riid))
{
TRACE("Returning IID_IPersistStreamInit interface\n");
*ppobj = (LPVOID)&SHDOCVW_PersistStreamInit;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IProvideClassInfo, riid))
{
TRACE("Returning IID_IProvideClassInfo interface\n");
*ppobj = (LPVOID)&SHDOCVW_ProvideClassInfo;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IProvideClassInfo2, riid))
{
TRACE("Returning IID_IProvideClassInfo2 interface %p\n",
&SHDOCVW_ProvideClassInfo2);
*ppobj = (LPVOID)&SHDOCVW_ProvideClassInfo2;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IQuickActivate, riid))
{
TRACE("Returning IID_IQuickActivate interface\n");
*ppobj = (LPVOID)&SHDOCVW_QuickActivate;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IConnectionPointContainer, riid))
{
TRACE("Returning IID_IConnectionPointContainer interface\n");
*ppobj = (LPVOID)&SHDOCVW_ConnectionPointContainer;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IOleInPlaceObject, riid))
{
TRACE("Returning IID_IOleInPlaceObject interface\n");
*ppobj = (LPVOID)&SHDOCVW_OleInPlaceObject;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IOleControl, riid))
{
TRACE("Returning IID_IOleControl interface\n");
*ppobj = (LPVOID)&SHDOCVW_OleControl;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IWebBrowser, riid))
{
TRACE("Returning IID_IWebBrowser interface\n");
*ppobj = (LPVOID)&SHDOCVW_WebBrowser;
WBOOBJ_AddRef (iface);
return S_OK;
}
else if (IsEqualGUID (&IID_IDispatch, riid))
{
TRACE("Returning IID_IDispatch interface\n");
*ppobj = (LPVOID)&SHDOCVW_WebBrowser;
WBOOBJ_AddRef (iface);
return S_OK;
}
TRACE ("Failed to find iid = %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
/************************************************************************
* WBOOBJ_AddRef (IUnknown)
*/
static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface)
{
ICOM_THIS(IOleObjectImpl, iface);
TRACE("\n");
return ++(This->ref);
}
/************************************************************************
* WBOOBJ_Release (IUnknown)
*/
static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface)
{
ICOM_THIS(IOleObjectImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
/************************************************************************
* WBOOBJ_SetClientSite (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_SetClientSite(LPOLEOBJECT iface,
LPOLECLIENTSITE pClientSite)
{
FIXME("stub: (%p, %p)\n", iface, pClientSite);
return S_OK;
}
/************************************************************************
* WBOOBJ_GetClientSite (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_GetClientSite(LPOLEOBJECT iface,
LPOLECLIENTSITE* ppClientSite)
{
FIXME("stub: (%p)\n", *ppClientSite);
return S_OK;
}
/************************************************************************
* WBOOBJ_SetHostNames (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_SetHostNames(LPOLEOBJECT iface, LPCOLESTR szContainerApp,
LPCOLESTR szContainerObj)
{
FIXME("stub: (%p, %s, %s)\n", iface, debugstr_w(szContainerApp),
debugstr_w(szContainerObj));
return S_OK;
}
/************************************************************************
* WBOOBJ_Close (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_Close(LPOLEOBJECT iface, DWORD dwSaveOption)
{
FIXME("stub: ()\n");
return S_OK;
}
/************************************************************************
* WBOOBJ_SetMoniker (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_SetMoniker(LPOLEOBJECT iface,
DWORD dwWhichMoniker, IMoniker* pmk)
{
FIXME("stub: (%p, %ld, %p)\n", iface, dwWhichMoniker, pmk);
return S_OK;
}
/************************************************************************
* WBOOBJ_GetMoniker (IOleObject)
*
* Delegate this request to the client site if we have one.
*/
static HRESULT WINAPI WBOOBJ_GetMoniker(LPOLEOBJECT iface, DWORD dwAssign,
DWORD dwWhichMoniker, LPMONIKER *ppmk)
{
FIXME("stub (%p, %ld, %ld, %p)\n", iface, dwAssign, dwWhichMoniker, ppmk);
return E_UNSPEC;
}
/************************************************************************
* WBOOBJ_InitFromData (IOleObject)
*
* This method is meaningless if the server is not running
*/
static HRESULT WINAPI WBOOBJ_InitFromData(LPOLEOBJECT iface, LPDATAOBJECT pDataObject,
BOOL fCreation, DWORD dwReserved)
{
FIXME("stub: (%p, %p, %d, %ld)\n", iface, pDataObject, fCreation, dwReserved);
return OLE_E_NOTRUNNING;
}
/************************************************************************
* WBOOBJ_GetClipboardData (IOleObject)
*
* This method is meaningless if the server is not running
*/
static HRESULT WINAPI WBOOBJ_GetClipboardData(LPOLEOBJECT iface, DWORD dwReserved,
LPDATAOBJECT *ppDataObject)
{
FIXME("stub: (%p, %ld, %p)\n", iface, dwReserved, ppDataObject);
return OLE_E_NOTRUNNING;
}
/************************************************************************
* WBOOBJ_DoVerb (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_DoVerb(LPOLEOBJECT iface, LONG iVerb, struct tagMSG* lpmsg,
LPOLECLIENTSITE pActiveSite, LONG lindex,
HWND hwndParent, LPCRECT lprcPosRect)
{
FIXME(": stub iVerb = %ld\n", iVerb);
switch (iVerb)
{
case OLEIVERB_INPLACEACTIVATE:
FIXME ("stub for OLEIVERB_INPLACEACTIVATE\n");
break;
case OLEIVERB_HIDE:
FIXME ("stub for OLEIVERB_HIDE\n");
break;
}
return S_OK;
}
/************************************************************************
* WBOOBJ_EnumVerbs (IOleObject)
*
* Delegate to OleRegEnumVerbs.
*/
static HRESULT WINAPI WBOOBJ_EnumVerbs(LPOLEOBJECT iface,
IEnumOLEVERB** ppEnumOleVerb)
{
TRACE("(%p, %p)\n", iface, ppEnumOleVerb);
return OleRegEnumVerbs(&CLSID_WebBrowser, ppEnumOleVerb);
}
/************************************************************************
* WBOOBJ_EnumVerbs (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_Update(LPOLEOBJECT iface)
{
FIXME(": Stub\n");
return E_NOTIMPL;
}
/************************************************************************
* WBOOBJ_IsUpToDate (IOleObject)
*
* This method is meaningless if the server is not running
*/
static HRESULT WINAPI WBOOBJ_IsUpToDate(LPOLEOBJECT iface)
{
FIXME("(%p)\n", iface);
return OLE_E_NOTRUNNING;
}
/************************************************************************
* WBOOBJ_GetUserClassID (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_GetUserClassID(LPOLEOBJECT iface, CLSID* pClsid)
{
FIXME("stub: (%p, %p)\n", iface, pClsid);
return S_OK;
}
/************************************************************************
* WBOOBJ_GetUserType (IOleObject)
*
* Delegate to OleRegGetUserType.
*/
static HRESULT WINAPI WBOOBJ_GetUserType(LPOLEOBJECT iface, DWORD dwFormOfType,
LPOLESTR* pszUserType)
{
TRACE("(%p, %ld, %p)\n", iface, dwFormOfType, pszUserType);
return OleRegGetUserType(&CLSID_WebBrowser, dwFormOfType, pszUserType);
}
/************************************************************************
* WBOOBJ_SetExtent (IOleObject)
*
* This method is meaningless if the server is not running
*/
static HRESULT WINAPI WBOOBJ_SetExtent(LPOLEOBJECT iface, DWORD dwDrawAspect,
SIZEL* psizel)
{
FIXME("stub: (%p, %lx, (%ld x %ld))\n", iface, dwDrawAspect,
psizel->cx, psizel->cy);
return OLE_E_NOTRUNNING;
}
/************************************************************************
* WBOOBJ_GetExtent (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_GetExtent(LPOLEOBJECT iface, DWORD dwDrawAspect,
SIZEL* psizel)
{
FIXME("stub: (%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
return S_OK;
}
/************************************************************************
* WBOOBJ_Advise (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_Advise(LPOLEOBJECT iface, IAdviseSink* pAdvSink,
DWORD* pdwConnection)
{
FIXME("stub: (%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
return S_OK;
}
/************************************************************************
* WBOOBJ_Unadvise (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_Unadvise(LPOLEOBJECT iface, DWORD dwConnection)
{
FIXME("stub: (%p, %ld)\n", iface, dwConnection);
return S_OK;
}
/************************************************************************
* WBOOBJ_EnumAdvise (IOleObject)
*/
static HRESULT WINAPI WBOOBJ_EnumAdvise(LPOLEOBJECT iface, IEnumSTATDATA** ppenumAdvise)
{
FIXME("stub: (%p, %p)\n", iface, ppenumAdvise);
return S_OK;
}
/************************************************************************
* WBOOBJ_GetMiscStatus (IOleObject)
*
* Delegate to OleRegGetMiscStatus.
*/
static HRESULT WINAPI WBOOBJ_GetMiscStatus(LPOLEOBJECT iface, DWORD dwAspect,
DWORD* pdwStatus)
{
HRESULT hres;
TRACE("(%p, %lx, %p)\n", iface, dwAspect, pdwStatus);
hres = OleRegGetMiscStatus(&CLSID_WebBrowser, dwAspect, pdwStatus);
if (FAILED(hres))
*pdwStatus = 0;
return S_OK;
}
/************************************************************************
* WBOOBJ_SetColorScheme (IOleObject)
*
* This method is meaningless if the server is not running
*/
static HRESULT WINAPI WBOOBJ_SetColorScheme(LPOLEOBJECT iface,
struct tagLOGPALETTE* pLogpal)
{
FIXME("stub: (%p, %p))\n", iface, pLogpal);
return OLE_E_NOTRUNNING;
}
/**********************************************************************
* IOleObject virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IOleObject) WBOOBJ_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBOOBJ_QueryInterface,
WBOOBJ_AddRef,
WBOOBJ_Release,
WBOOBJ_SetClientSite,
WBOOBJ_GetClientSite,
WBOOBJ_SetHostNames,
WBOOBJ_Close,
WBOOBJ_SetMoniker,
WBOOBJ_GetMoniker,
WBOOBJ_InitFromData,
WBOOBJ_GetClipboardData,
WBOOBJ_DoVerb,
WBOOBJ_EnumVerbs,
WBOOBJ_Update,
WBOOBJ_IsUpToDate,
WBOOBJ_GetUserClassID,
WBOOBJ_GetUserType,
WBOOBJ_SetExtent,
WBOOBJ_GetExtent,
WBOOBJ_Advise,
WBOOBJ_Unadvise,
WBOOBJ_EnumAdvise,
WBOOBJ_GetMiscStatus,
WBOOBJ_SetColorScheme
};
IOleObjectImpl SHDOCVW_OleObject = { &WBOOBJ_Vtbl, 1 };
/**********************************************************************
* Implement the IOleInPlaceObject interface
*/
static HRESULT WINAPI WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IOleInPlaceObjectImpl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WBOIPO_AddRef(LPOLEINPLACEOBJECT iface)
{
ICOM_THIS(IOleInPlaceObjectImpl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface)
{
ICOM_THIS(IOleInPlaceObjectImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd)
{
#if 0
/* Create a fake window to fool MFC into believing that we actually
* have an implemented browser control. Avoids the assertion.
*/
HWND hwnd;
hwnd = CreateWindowA("BUTTON", "Web Control",
WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 600,
400, NULL, NULL, NULL, NULL);
*phwnd = hwnd;
TRACE ("Returning hwnd = %d\n", hwnd);
#endif
FIXME("stub HWND* = %p\n", phwnd);
return S_OK;
}
static HRESULT WINAPI WBOIPO_ContextSensitiveHelp(LPOLEINPLACEOBJECT iface,
BOOL fEnterMode)
{
FIXME("stub fEnterMode = %d\n", fEnterMode);
return S_OK;
}
static HRESULT WINAPI WBOIPO_InPlaceDeactivate(LPOLEINPLACEOBJECT iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WBOIPO_UIDeactivate(LPOLEINPLACEOBJECT iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WBOIPO_SetObjectRects(LPOLEINPLACEOBJECT iface,
LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{
FIXME("stub PosRect = %p, ClipRect = %p\n", lprcPosRect, lprcClipRect);
return S_OK;
}
static HRESULT WINAPI WBOIPO_ReactivateAndUndo(LPOLEINPLACEOBJECT iface)
{
FIXME("stub \n");
return S_OK;
}
/**********************************************************************
* IOleInPlaceObject virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IOleInPlaceObject) WBOIPO_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBOIPO_QueryInterface,
WBOIPO_AddRef,
WBOIPO_Release,
WBOIPO_GetWindow,
WBOIPO_ContextSensitiveHelp,
WBOIPO_InPlaceDeactivate,
WBOIPO_UIDeactivate,
WBOIPO_SetObjectRects,
WBOIPO_ReactivateAndUndo
};
IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = { &WBOIPO_Vtbl, 1 };
/**********************************************************************
* Implement the IOleControl interface
*/
static HRESULT WINAPI WBOC_QueryInterface(LPOLECONTROL iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IOleControlImpl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WBOC_AddRef(LPOLECONTROL iface)
{
ICOM_THIS(IOleControlImpl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBOC_Release(LPOLECONTROL iface)
{
ICOM_THIS(IOleControlImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI)
{
FIXME("stub: LPCONTROLINFO = %p\n", pCI);
return S_OK;
}
static HRESULT WINAPI WBOC_OnMnemonic(LPOLECONTROL iface, struct tagMSG *pMsg)
{
FIXME("stub: MSG* = %p\n", pMsg);
return S_OK;
}
static HRESULT WINAPI WBOC_OnAmbientPropertyChange(LPOLECONTROL iface, DISPID dispID)
{
FIXME("stub: DISPID = %ld\n", dispID);
return S_OK;
}
static HRESULT WINAPI WBOC_FreezeEvents(LPOLECONTROL iface, BOOL bFreeze)
{
FIXME("stub: bFreeze = %d\n", bFreeze);
return S_OK;
}
/**********************************************************************
* IOleControl virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IOleControl) WBOC_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBOC_QueryInterface,
WBOC_AddRef,
WBOC_Release,
WBOC_GetControlInfo,
WBOC_OnMnemonic,
WBOC_OnAmbientPropertyChange,
WBOC_FreezeEvents
};
IOleControlImpl SHDOCVW_OleControl = { &WBOC_Vtbl, 1 };

View File

@ -1,200 +0,0 @@
/*
* Implementation of IPersist interfaces for IE Web Browser control
*
* Copyright 2001 John R. Sheets (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/debug.h"
#include "shdocvw.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/**********************************************************************
* Implement the IPersistStorage interface
*/
static HRESULT WINAPI WBPS_QueryInterface(LPPERSISTSTORAGE iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IPersistStorageImpl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WBPS_AddRef(LPPERSISTSTORAGE iface)
{
ICOM_THIS(IPersistStorageImpl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBPS_Release(LPPERSISTSTORAGE iface)
{
ICOM_THIS(IPersistStorageImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
static HRESULT WINAPI WBPS_GetClassID(LPPERSISTSTORAGE iface, CLSID *pClassID)
{
FIXME("stub: CLSID = %s\n", debugstr_guid(pClassID));
return S_OK;
}
static HRESULT WINAPI WBPS_IsDirty(LPPERSISTSTORAGE iface)
{
FIXME("stub\n");
return S_OK;
}
static HRESULT WINAPI WBPS_InitNew(LPPERSISTSTORAGE iface, LPSTORAGE pStg)
{
FIXME("stub: LPSTORAGE = %p\n", pStg);
return S_OK;
}
static HRESULT WINAPI WBPS_Load(LPPERSISTSTORAGE iface, LPSTORAGE pStg)
{
FIXME("stub: LPSTORAGE = %p\n", pStg);
return S_OK;
}
static HRESULT WINAPI WBPS_Save(LPPERSISTSTORAGE iface, LPSTORAGE pStg,
BOOL fSameAsLoad)
{
FIXME("stub: LPSTORAGE = %p, fSameAsLoad = %d\n", pStg, fSameAsLoad);
return S_OK;
}
static HRESULT WINAPI WBPS_SaveCompleted(LPPERSISTSTORAGE iface, LPSTORAGE pStgNew)
{
FIXME("stub: LPSTORAGE = %p\n", pStgNew);
return S_OK;
}
/**********************************************************************
* IPersistStorage virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IPersistStorage) WBPS_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBPS_QueryInterface,
WBPS_AddRef,
WBPS_Release,
WBPS_GetClassID,
WBPS_IsDirty,
WBPS_InitNew,
WBPS_Load,
WBPS_Save,
WBPS_SaveCompleted
};
IPersistStorageImpl SHDOCVW_PersistStorage = { &WBPS_Vtbl, 1 };
/**********************************************************************
* Implement the IPersistStreamInit interface
*/
static HRESULT WINAPI WBPSI_QueryInterface(LPPERSISTSTREAMINIT iface,
REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IPersistStreamInitImpl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WBPSI_AddRef(LPPERSISTSTREAMINIT iface)
{
ICOM_THIS(IPersistStreamInitImpl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WBPSI_Release(LPPERSISTSTREAMINIT iface)
{
ICOM_THIS(IPersistStreamInitImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
static HRESULT WINAPI WBPSI_GetClassID(LPPERSISTSTREAMINIT iface, CLSID *pClassID)
{
FIXME("stub: CLSID = %s\n", debugstr_guid(pClassID));
return S_OK;
}
static HRESULT WINAPI WBPSI_IsDirty(LPPERSISTSTREAMINIT iface)
{
FIXME("stub\n");
return S_OK;
}
static HRESULT WINAPI WBPSI_Load(LPPERSISTSTREAMINIT iface, LPSTREAM pStg)
{
FIXME("stub: LPSTORAGE = %p\n", pStg);
return S_OK;
}
static HRESULT WINAPI WBPSI_Save(LPPERSISTSTREAMINIT iface, LPSTREAM pStg,
BOOL fSameAsLoad)
{
FIXME("stub: LPSTORAGE = %p, fSameAsLoad = %d\n", pStg, fSameAsLoad);
return S_OK;
}
static HRESULT WINAPI WBPSI_GetSizeMax(LPPERSISTSTREAMINIT iface,
ULARGE_INTEGER *pcbSize)
{
FIXME("stub: ULARGE_INTEGER = %p\n", pcbSize);
return S_OK;
}
static HRESULT WINAPI WBPSI_InitNew(LPPERSISTSTREAMINIT iface)
{
FIXME("stub\n");
return S_OK;
}
/**********************************************************************
* IPersistStreamInit virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IPersistStreamInit) WBPSI_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WBPSI_QueryInterface,
WBPSI_AddRef,
WBPSI_Release,
WBPSI_GetClassID,
WBPSI_IsDirty,
WBPSI_Load,
WBPSI_Save,
WBPSI_GetSizeMax,
WBPSI_InitNew
};
IPersistStreamInitImpl SHDOCVW_PersistStreamInit = { &WBPSI_Vtbl, 1 };

42
dlls/shdocvw/shdocvw.c Normal file
View File

@ -0,0 +1,42 @@
/*
* The list of exported class.
*
* Copyright 2002 Hidenori Takeshima
*
* 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 "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "ole2.h"
#include "oleauto.h"
#include "wine/obj_webbrowser.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
#include "shdocvw.h"
const COMIMPL_CLASSENTRY COMIMPL_ClassList[] =
{
{ &CLSID_WebBrowser, &CWebBrowserImpl_AllocObj },
{ NULL, NULL } /* the last entry must be NULL */
};

View File

@ -1,7 +1,6 @@
/* /*
* Header includes for shdocvw.dll
*
* Copyright 2001 John R. Sheets (for CodeWeavers) * Copyright 2001 John R. Sheets (for CodeWeavers)
* Copyright 2002 Hidenori Takeshima
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,190 +17,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef __WINE_SHDOCVW_H #ifndef WINE_SHDOCVW_H
#define __WINE_SHDOCVW_H #define WINE_SHDOCVW_H
/* FIXME: Is there a better way to deal with all these includes? */ #include "comimpl.h"
#include "wingdi.h"
#include "winbase.h"
#include "winuser.h"
#include "wine/obj_base.h" HRESULT CWebBrowserImpl_AllocObj(IUnknown* punkOuter,void** ppobj);
#include "wine/obj_storage.h" HRESULT CConnectionPointImpl_AllocObj(IUnknown* punkOuter,void** ppobj);
#include "wine/obj_misc.h"
#include "wine/obj_moniker.h"
#include "wine/obj_inplace.h"
#include "wine/obj_dataobject.h"
#include "wine/obj_oleobj.h"
#include "wine/obj_oleaut.h"
#include "wine/obj_olefont.h"
#include "wine/obj_dragdrop.h"
#include "wine/obj_oleview.h"
#include "wine/obj_control.h"
#include "wine/obj_connection.h"
#include "wine/obj_property.h"
#include "wine/obj_oleundo.h"
#include "wine/obj_webbrowser.h"
/**********************************************************************
* IClassFactory declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IClassFactory);
DWORD ref;
} IClassFactoryImpl;
extern IClassFactoryImpl SHDOCVW_ClassFactory;
/********************************************************************** /* FIXME - move to header... */
* IOleObject declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IOleObject);
DWORD ref;
} IOleObjectImpl;
extern IOleObjectImpl SHDOCVW_OleObject;
/**********************************************************************
* IOleInPlaceObject declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IOleInPlaceObject);
DWORD ref;
} IOleInPlaceObjectImpl;
extern IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject;
/**********************************************************************
* IOleControl declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IOleControl);
DWORD ref;
} IOleControlImpl;
extern IOleControlImpl SHDOCVW_OleControl;
/**********************************************************************
* IWebBrowser declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IWebBrowser);
DWORD ref;
} IWebBrowserImpl;
extern IWebBrowserImpl SHDOCVW_WebBrowser;
/**********************************************************************
* IProvideClassInfo declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IProvideClassInfo);
DWORD ref;
} IProvideClassInfoImpl;
extern IProvideClassInfoImpl SHDOCVW_ProvideClassInfo;
/**********************************************************************
* IProvideClassInfo2 declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IProvideClassInfo2);
DWORD ref;
} IProvideClassInfo2Impl;
extern IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2;
/**********************************************************************
* IPersistStorage declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IPersistStorage);
DWORD ref;
} IPersistStorageImpl;
extern IPersistStorageImpl SHDOCVW_PersistStorage;
/**********************************************************************
* IPersistStreamInit declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IPersistStreamInit);
DWORD ref;
} IPersistStreamInitImpl;
extern IPersistStreamInitImpl SHDOCVW_PersistStreamInit;
/**********************************************************************
* IQuickActivate declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IQuickActivate);
DWORD ref;
} IQuickActivateImpl;
extern IQuickActivateImpl SHDOCVW_QuickActivate;
/**********************************************************************
* IConnectionPointContainer declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IConnectionPointContainer);
DWORD ref;
} IConnectionPointContainerImpl;
extern IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer;
/**********************************************************************
* IConnectionPoint declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IConnectionPoint);
DWORD ref;
} IConnectionPointImpl;
extern IConnectionPointImpl SHDOCVW_ConnectionPoint;
/* Other stuff.. */
DEFINE_GUID(IID_INotifyDBEvents, DEFINE_GUID(IID_INotifyDBEvents,
0xdb526cc0, 0xd188, 0x11cd, 0xad, 0x48, 0x0, 0xaa, 0x0, 0x3c, 0x9c, 0xb6); 0xdb526cc0, 0xd188, 0x11cd, 0xad, 0x48, 0x0, 0xaa, 0x0, 0x3c, 0x9c, 0xb6);
#endif /* __WINE_SHDOCVW_H */
#endif /* WINE_SHDOCVW_H */

View File

@ -1,14 +1,16 @@
name shdocvw name shdocvw
type win32 type win32
init COMIMPL_DllMain
import ole32.dll import ole32.dll
import kernel32.dll
import ntdll.dll import ntdll.dll
debug_channels (shdocvw) debug_channels (shdocvw comimpl)
108 stub AddUrlToFavorites 108 stub AddUrlToFavorites
109 stdcall DllCanUnloadNow() SHDOCVW_DllCanUnloadNow 109 stdcall DllCanUnloadNow() COMIMPL_DllCanUnloadNow
312 stdcall DllGetClassObject(long long ptr) SHDOCVW_DllGetClassObject 312 stdcall DllGetClassObject(long long ptr) COMIMPL_DllGetClassObject
113 stdcall DllGetVersion(ptr) SHDOCVW_DllGetVersion 113 stdcall DllGetVersion(ptr) SHDOCVW_DllGetVersion
114 stdcall DllInstall(long wstr) SHDOCVW_DllInstall 114 stdcall DllInstall(long wstr) SHDOCVW_DllInstall
124 stdcall DllRegisterServer() SHDOCVW_DllRegisterServer 124 stdcall DllRegisterServer() SHDOCVW_DllRegisterServer

View File

@ -1,281 +0,0 @@
/*
* Implementation of IWebBrowser interface for IE Web Browser control
*
* Copyright 2001 John R. Sheets (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/debug.h"
#include "shdocvw.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/**********************************************************************
* Implement the IWebBrowser interface
*/
static HRESULT WINAPI WB_QueryInterface(LPWEBBROWSER iface, REFIID riid, LPVOID *ppobj)
{
ICOM_THIS(IWebBrowserImpl, iface);
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI WB_AddRef(LPWEBBROWSER iface)
{
ICOM_THIS(IWebBrowserImpl, iface);
TRACE("\n");
return ++(This->ref);
}
static ULONG WINAPI WB_Release(LPWEBBROWSER iface)
{
ICOM_THIS(IWebBrowserImpl, iface);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
}
/* IDispatch methods */
static HRESULT WINAPI WB_GetTypeInfoCount(LPWEBBROWSER iface, UINT *pctinfo)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_GetTypeInfo(LPWEBBROWSER iface, UINT iTInfo, LCID lcid,
LPTYPEINFO *ppTInfo)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_GetIDsOfNames(LPWEBBROWSER iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_Invoke(LPWEBBROWSER iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExepInfo, UINT *puArgErr)
{
FIXME("stub dispIdMember = %d, IID = %s\n", (int)dispIdMember, debugstr_guid(riid));
return S_OK;
}
/* IWebBrowser methods */
static HRESULT WINAPI WB_GoBack(LPWEBBROWSER iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_GoForward(LPWEBBROWSER iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_GoHome(LPWEBBROWSER iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_GoSearch(LPWEBBROWSER iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_Navigate(LPWEBBROWSER iface, BSTR *URL,
VARIANT *Flags, VARIANT *TargetFrameName,
VARIANT *PostData, VARIANT *Headers)
{
FIXME("stub: URL = %p (%p, %p, %p, %p)\n", URL, Flags, TargetFrameName,
PostData, Headers);
return S_OK;
}
static HRESULT WINAPI WB_Refresh(LPWEBBROWSER iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_Refresh2(LPWEBBROWSER iface, VARIANT *Level)
{
FIXME("stub: %p\n", Level);
return S_OK;
}
static HRESULT WINAPI WB_Stop(LPWEBBROWSER iface)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Application(LPWEBBROWSER iface, LPVOID *ppDisp)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Parent(LPWEBBROWSER iface, LPVOID *ppDisp)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Container(LPWEBBROWSER iface, LPVOID *ppDisp)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Document(LPWEBBROWSER iface, LPVOID *ppDisp)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_TopLevelContainer(LPWEBBROWSER iface, VARIANT *pBool)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Type(LPWEBBROWSER iface, BSTR *Type)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Left(LPWEBBROWSER iface, long *pl)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_put_Left(LPWEBBROWSER iface, long Left)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Top(LPWEBBROWSER iface, long *pl)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_put_Top(LPWEBBROWSER iface, long Top)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Width(LPWEBBROWSER iface, long *pl)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_put_Width(LPWEBBROWSER iface, long Width)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Height(LPWEBBROWSER iface, long *pl)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_put_Height(LPWEBBROWSER iface, long Height)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_LocationName(LPWEBBROWSER iface, BSTR *LocationName)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_LocationURL(LPWEBBROWSER iface, BSTR *LocationURL)
{
FIXME("stub \n");
return S_OK;
}
static HRESULT WINAPI WB_get_Busy(LPWEBBROWSER iface, VARIANT *pBool)
{
FIXME("stub \n");
return S_OK;
}
/**********************************************************************
* IWebBrowser virtual function table for IE Web Browser component
*/
static ICOM_VTABLE(IWebBrowser) WB_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
WB_QueryInterface,
WB_AddRef,
WB_Release,
WB_GetTypeInfoCount,
WB_GetTypeInfo,
WB_GetIDsOfNames,
WB_Invoke,
WB_GoBack,
WB_GoForward,
WB_GoHome,
WB_GoSearch,
WB_Navigate,
WB_Refresh,
WB_Refresh2,
WB_Stop,
WB_get_Application,
WB_get_Parent,
WB_get_Container,
WB_get_Document,
WB_get_TopLevelContainer,
WB_get_Type,
WB_get_Left,
WB_put_Left,
WB_get_Top,
WB_put_Top,
WB_get_Width,
WB_put_Width,
WB_get_Height,
WB_put_Height,
WB_get_LocationName,
WB_get_LocationURL,
WB_get_Busy
};
IWebBrowserImpl SHDOCVW_WebBrowser = { &WB_Vtbl, 1 };

View File

@ -64,6 +64,8 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
/* other GUIDs */ /* other GUIDs */
#include "wine/obj_webbrowser.h"
#include "vfw.h" #include "vfw.h"
/* for dshow */ /* for dshow */