inetcomm: Added MimeHtmlProtocol stub implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-01-25 12:05:47 +01:00 committed by Alexandre Julliard
parent d5d9aa361a
commit 6832273ed8
6 changed files with 234 additions and 1 deletions

View File

@ -9,6 +9,7 @@ C_SRCS = \
mimeintl.c \
mimeole.c \
pop3transport.c \
protocol.c \
smtptransport.c
RC_SRCS = inetcomm.rc

View File

@ -90,7 +90,9 @@ static HRESULT WINAPI cf_QueryInterface( IClassFactory *iface, REFIID riid, LPVO
return S_OK;
}
FIXME("interface %s not implemented\n", debugstr_guid(riid));
if (!IsEqualGUID(riid, &IID_IInternetProtocolInfo))
FIXME("interface %s not implemented\n", debugstr_guid(riid));
*ppobj = NULL;
return E_NOINTERFACE;
}
@ -145,6 +147,7 @@ static cf mime_allocator_cf = { { &cf_vtbl }, MimeAllocator_create };
static cf mime_message_cf = { { &cf_vtbl }, MimeMessage_create };
static cf mime_security_cf = { { &cf_vtbl }, MimeSecurity_create };
static cf virtual_stream_cf = { { &cf_vtbl }, VirtualStream_create };
static cf mhtml_protocol_cf = { { &cf_vtbl }, MimeHtmlProtocol_create };
/***********************************************************************
* DllGetClassObject (INETCOMM.@)
@ -187,6 +190,10 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
{
cf = &virtual_stream_cf.IClassFactory_iface;
}
else if( IsEqualCLSID( rclsid, &CLSID_IMimeHtmlProtocol ))
{
cf = &mhtml_protocol_cf.IClassFactory_iface;
}
if ( !cf )
{

View File

@ -76,9 +76,20 @@ HRESULT MimeAllocator_create(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT MimeMessage_create(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT MimeSecurity_create(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT VirtualStream_create(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT MimeHtmlProtocol_create(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT MimeInternational_Construct(IMimeInternational **internat) DECLSPEC_HIDDEN;
HRESULT SMTPTransportCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
HRESULT IMAPTransportCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
HRESULT POP3TransportCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
}
static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}

192
dlls/inetcomm/protocol.c Normal file
View File

@ -0,0 +1,192 @@
/*
* Copyright 2017 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
*/
#define COBJMACROS
#include <assert.h>
#include "mimeole.h"
#include "inetcomm_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(inetcomm);
typedef struct {
IInternetProtocol IInternetProtocol_iface;
LONG ref;
} MimeHtmlProtocol;
static inline MimeHtmlProtocol *impl_from_IInternetProtocol(IInternetProtocol *iface)
{
return CONTAINING_RECORD(iface, MimeHtmlProtocol, IInternetProtocol_iface);
}
static HRESULT WINAPI MimeHtmlProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
*ppv = &This->IInternetProtocol_iface;
}else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface, ppv);
*ppv = &This->IInternetProtocol_iface;
}else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface, ppv);
*ppv = &This->IInternetProtocol_iface;
}else {
FIXME("unknown interface %s\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI MimeHtmlProtocol_AddRef(IInternetProtocol *iface)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI MimeHtmlProtocol_Release(IInternetProtocol *iface)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%x\n", This, ref);
if(!ref)
heap_free(This);
return ref;
}
static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCHAR *szUrl,
IInternetProtocolSink* pOIProtSink, IInternetBindInfo* pOIBindInfo,
DWORD grfPI, HANDLE_PTR dwReserved)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
pOIBindInfo, grfPI, dwReserved);
return E_NOTIMPL;
}
static HRESULT WINAPI MimeHtmlProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)->(%p)\n", This, pProtocolData);
return E_NOTIMPL;
}
static HRESULT WINAPI MimeHtmlProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
return E_NOTIMPL;
}
static HRESULT WINAPI MimeHtmlProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
TRACE("(%p)->(%08x)\n", This, dwOptions);
return S_OK;
}
static HRESULT WINAPI MimeHtmlProtocol_Suspend(IInternetProtocol *iface)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI MimeHtmlProtocol_Resume(IInternetProtocol *iface)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI MimeHtmlProtocol_Read(IInternetProtocol *iface, void* pv, ULONG cb, ULONG* pcbRead)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
return E_NOTIMPL;
}
static HRESULT WINAPI MimeHtmlProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
return E_NOTIMPL;
}
static HRESULT WINAPI MimeHtmlProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)->(%d)\n", This, dwOptions);
return S_OK;
}
static HRESULT WINAPI MimeHtmlProtocol_UnlockRequest(IInternetProtocol *iface)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface);
FIXME("(%p)\n", This);
return S_OK;
}
static const IInternetProtocolVtbl MimeHtmlProtocolVtbl = {
MimeHtmlProtocol_QueryInterface,
MimeHtmlProtocol_AddRef,
MimeHtmlProtocol_Release,
MimeHtmlProtocol_Start,
MimeHtmlProtocol_Continue,
MimeHtmlProtocol_Abort,
MimeHtmlProtocol_Terminate,
MimeHtmlProtocol_Suspend,
MimeHtmlProtocol_Resume,
MimeHtmlProtocol_Read,
MimeHtmlProtocol_Seek,
MimeHtmlProtocol_LockRequest,
MimeHtmlProtocol_UnlockRequest
};
HRESULT MimeHtmlProtocol_create(IUnknown *outer, void **obj)
{
MimeHtmlProtocol *protocol;
if(outer)
FIXME("outer not supported\n");
protocol = heap_alloc(sizeof(*protocol));
if(!protocol)
return E_OUTOFMEMORY;
protocol->IInternetProtocol_iface.lpVtbl = &MimeHtmlProtocolVtbl;
protocol->ref = 1;
*obj = &protocol->IInternetProtocol_iface;
return S_OK;
}

View File

@ -760,6 +760,25 @@ static void test_MimeOleGetPropertySchema(void)
IMimePropertySchema_Release(schema);
}
static void test_mhtml_protocol(void)
{
IUnknown *unk, *unk2;
HRESULT hres;
/* test class factory */
hres = CoGetClassObject(&CLSID_IMimeHtmlProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&unk2);
ok(hres == S_OK, "Could not get IClassFactory iface: %08x\n", hres);
IUnknown_Release(unk2);
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&unk2);
ok(hres == E_NOINTERFACE, "IInternetProtocolInfo supported\n");
IUnknown_Release(unk);
}
START_TEST(mimeole)
{
OleInitialize(NULL);
@ -774,5 +793,6 @@ START_TEST(mimeole)
test_BindToObject();
test_BodyDeleteProp();
test_MimeOleGetPropertySchema();
test_mhtml_protocol();
OleUninitialize();
}

View File

@ -34,6 +34,8 @@ cpp_quote("DEFINE_GUID(CLSID_IMimeAllocator, 0xfd853cdd, 0x7f86, 0x11d0, 0x82, 0
cpp_quote("DEFINE_GUID(CLSID_IMimeMessage, 0xfd853ce3, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
cpp_quote("DEFINE_GUID(CLSID_IMimeSecurity, 0xfd853cde, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
cpp_quote("DEFINE_GUID(CLSID_IVirtualStream, 0xfd853cdf, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
cpp_quote("DEFINE_GUID(CLSID_IMimeHtmlProtocol,0x5300401,0xbcbc, 0x11d0, 0x85, 0xe3, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
cpp_quote("DEFINE_GUID(CLSID_MimeEdit, 0x1c82ead9, 0x508e, 0x11d1, 0x8d, 0xcf, 0x0, 0xc0, 0x4f, 0xb9, 0x51, 0xf9);")
cpp_quote("#define MIME_E_REG_CREATE_KEY 0x800cce01")
cpp_quote("#define MIME_E_REG_QUERY_INFO 0x800cce02")