Huw Davies : inetcomm: Add IMimeAllocator implementation.
Alexandre Julliard
julliard at winehq.org
Tue Dec 18 07:34:51 CST 2007
Module: wine
Branch: master
Commit: 5df59e29c9242e7f88d849d8f37ae295ce386170
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5df59e29c9242e7f88d849d8f37ae295ce386170
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Dec 18 11:50:22 2007 +0000
inetcomm: Add IMimeAllocator implementation.
---
dlls/inetcomm/inetcomm.spec | 2 +-
dlls/inetcomm/inetcomm_main.c | 8 +-
dlls/inetcomm/inetcomm_private.h | 1 +
dlls/inetcomm/mimeole.c | 205 ++++++++++++++++++++++++++++++++++++++
dlls/inetcomm/regsvr.c | 6 +
dlls/inetcomm/tests/mimeole.c | 11 ++
6 files changed, 230 insertions(+), 3 deletions(-)
diff --git a/dlls/inetcomm/inetcomm.spec b/dlls/inetcomm/inetcomm.spec
index a9e7d16..0266bb1 100644
--- a/dlls/inetcomm/inetcomm.spec
+++ b/dlls/inetcomm/inetcomm.spec
@@ -63,7 +63,7 @@
@ stub MimeOleGenerateCID
@ stub MimeOleGenerateFileName
@ stub MimeOleGenerateMID
-@ stub MimeOleGetAllocator
+@ stdcall MimeOleGetAllocator(ptr)
@ stub MimeOleGetBodyPropA
@ stub MimeOleGetBodyPropW
@ stub MimeOleGetCertsFromThumbprints
diff --git a/dlls/inetcomm/inetcomm_main.c b/dlls/inetcomm/inetcomm_main.c
index 81303b3..15350df 100644
--- a/dlls/inetcomm/inetcomm_main.c
+++ b/dlls/inetcomm/inetcomm_main.c
@@ -131,8 +131,8 @@ static const struct IClassFactoryVtbl cf_vtbl =
cf_LockServer
};
-static cf mime_body_cf = { &cf_vtbl, MimeBody_create };
-
+static cf mime_body_cf = { &cf_vtbl, MimeBody_create };
+static cf mime_allocator_cf = { &cf_vtbl, MimeAllocator_create };
/***********************************************************************
* DllGetClassObject (INETCOMM.@)
@@ -147,6 +147,10 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
{
cf = (IClassFactory*) &mime_body_cf.lpVtbl;
}
+ else if( IsEqualCLSID( rclsid, &CLSID_IMimeAllocator ))
+ {
+ cf = (IClassFactory*) &mime_allocator_cf.lpVtbl;
+ }
if ( !cf )
{
diff --git a/dlls/inetcomm/inetcomm_private.h b/dlls/inetcomm/inetcomm_private.h
index 2a41925..bf6e5ce 100644
--- a/dlls/inetcomm/inetcomm_private.h
+++ b/dlls/inetcomm/inetcomm_private.h
@@ -70,3 +70,4 @@ BOOL InternetTransport_RegisterClass(HINSTANCE hInstance);
void InternetTransport_UnregisterClass(HINSTANCE hInstance);
HRESULT MimeBody_create(IUnknown *outer, void **obj);
+HRESULT MimeAllocator_create(IUnknown *outer, void **obj);
diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c
index 59619df..f0185d4 100644
--- a/dlls/inetcomm/mimeole.c
+++ b/dlls/inetcomm/mimeole.c
@@ -1824,3 +1824,208 @@ HRESULT WINAPI MimeOleCreateSecurity(IMimeSecurity **ppSecurity)
*ppSecurity = (IMimeSecurity *)&This->lpVtbl;
return S_OK;
}
+
+
+typedef struct
+{
+ IMimeAllocatorVtbl *lpVtbl;
+} MimeAllocator;
+
+static HRESULT WINAPI MimeAlloc_QueryInterface(
+ IMimeAllocator* iface,
+ REFIID riid,
+ void **obj)
+{
+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), obj);
+
+ if (IsEqualIID(riid, &IID_IUnknown) ||
+ IsEqualIID(riid, &IID_IMalloc) ||
+ IsEqualIID(riid, &IID_IMimeAllocator))
+ {
+ *obj = iface;
+ IUnknown_AddRef(iface);
+ return S_OK;
+ }
+
+ FIXME("no interface for %s\n", debugstr_guid(riid));
+ *obj = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI MimeAlloc_AddRef(
+ IMimeAllocator* iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI MimeAlloc_Release(
+ IMimeAllocator* iface)
+{
+ return 1;
+}
+
+static LPVOID WINAPI MimeAlloc_Alloc(
+ IMimeAllocator* iface,
+ ULONG cb)
+{
+ return CoTaskMemAlloc(cb);
+}
+
+static LPVOID WINAPI MimeAlloc_Realloc(
+ IMimeAllocator* iface,
+ LPVOID pv,
+ ULONG cb)
+{
+ return CoTaskMemRealloc(pv, cb);
+}
+
+static void WINAPI MimeAlloc_Free(
+ IMimeAllocator* iface,
+ LPVOID pv)
+{
+ return CoTaskMemFree(pv);
+}
+
+static ULONG WINAPI MimeAlloc_GetSize(
+ IMimeAllocator* iface,
+ LPVOID pv)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+static int WINAPI MimeAlloc_DidAlloc(
+ IMimeAllocator* iface,
+ LPVOID pv)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+static void WINAPI MimeAlloc_HeapMinimize(
+ IMimeAllocator* iface)
+{
+ FIXME("stub\n");
+ return;
+}
+
+static HRESULT WINAPI MimeAlloc_FreeParamInfoArray(
+ IMimeAllocator* iface,
+ ULONG cParams,
+ LPMIMEPARAMINFO prgParam,
+ boolean fFreeArray)
+{
+ ULONG i;
+ TRACE("(%p)->(%d, %p, %d)\n", iface, cParams, prgParam, fFreeArray);
+
+ for(i = 0; i < cParams; i++)
+ {
+ IMimeAllocator_Free(iface, prgParam[i].pszName);
+ IMimeAllocator_Free(iface, prgParam[i].pszData);
+ }
+ if(fFreeArray) IMimeAllocator_Free(iface, prgParam);
+ return S_OK;
+}
+
+static HRESULT WINAPI MimeAlloc_FreeAddressList(
+ IMimeAllocator* iface,
+ LPADDRESSLIST pList)
+{
+ FIXME("stub\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MimeAlloc_FreeAddressProps(
+ IMimeAllocator* iface,
+ LPADDRESSPROPS pAddress)
+{
+ FIXME("stub\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MimeAlloc_ReleaseObjects(
+ IMimeAllocator* iface,
+ ULONG cObjects,
+ IUnknown **prgpUnknown,
+ boolean fFreeArray)
+{
+ FIXME("stub\n");
+ return E_NOTIMPL;
+}
+
+
+static HRESULT WINAPI MimeAlloc_FreeEnumHeaderRowArray(
+ IMimeAllocator* iface,
+ ULONG cRows,
+ LPENUMHEADERROW prgRow,
+ boolean fFreeArray)
+{
+ FIXME("stub\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MimeAlloc_FreeEnumPropertyArray(
+ IMimeAllocator* iface,
+ ULONG cProps,
+ LPENUMPROPERTY prgProp,
+ boolean fFreeArray)
+{
+ FIXME("stub\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MimeAlloc_FreeThumbprint(
+ IMimeAllocator* iface,
+ THUMBBLOB *pthumbprint)
+{
+ FIXME("stub\n");
+ return E_NOTIMPL;
+}
+
+
+static HRESULT WINAPI MimeAlloc_PropVariantClear(
+ IMimeAllocator* iface,
+ LPPROPVARIANT pProp)
+{
+ FIXME("stub\n");
+ return E_NOTIMPL;
+}
+
+static IMimeAllocatorVtbl mime_alloc_vtbl =
+{
+ MimeAlloc_QueryInterface,
+ MimeAlloc_AddRef,
+ MimeAlloc_Release,
+ MimeAlloc_Alloc,
+ MimeAlloc_Realloc,
+ MimeAlloc_Free,
+ MimeAlloc_GetSize,
+ MimeAlloc_DidAlloc,
+ MimeAlloc_HeapMinimize,
+ MimeAlloc_FreeParamInfoArray,
+ MimeAlloc_FreeAddressList,
+ MimeAlloc_FreeAddressProps,
+ MimeAlloc_ReleaseObjects,
+ MimeAlloc_FreeEnumHeaderRowArray,
+ MimeAlloc_FreeEnumPropertyArray,
+ MimeAlloc_FreeThumbprint,
+ MimeAlloc_PropVariantClear
+};
+
+static MimeAllocator mime_allocator =
+{
+ &mime_alloc_vtbl
+};
+
+HRESULT MimeAllocator_create(IUnknown *outer, void **obj)
+{
+ if(outer) return CLASS_E_NOAGGREGATION;
+
+ *obj = &mime_allocator;
+ return S_OK;
+}
+
+HRESULT WINAPI MimeOleGetAllocator(IMimeAllocator **alloc)
+{
+ return MimeAllocator_create(NULL, (void**)alloc);
+}
diff --git a/dlls/inetcomm/regsvr.c b/dlls/inetcomm/regsvr.c
index 97759fc..620cfa7 100644
--- a/dlls/inetcomm/regsvr.c
+++ b/dlls/inetcomm/regsvr.c
@@ -440,6 +440,12 @@ static struct regsvr_coclass const coclass_list[] = {
"inetcomm.dll",
"Both"
},
+ { &CLSID_IMimeAllocator,
+ "CLSID_IMimeAllocator",
+ NULL,
+ "inetcomm.dll",
+ "Both"
+ },
{ &CLSID_IMimeMessage,
"CLSID_IMimeMessage",
NULL,
diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c
index 51135d1..97fe6e6 100644
--- a/dlls/inetcomm/tests/mimeole.c
+++ b/dlls/inetcomm/tests/mimeole.c
@@ -137,11 +137,22 @@ static void test_CreateBody(void)
IMimeBody_Release(body);
}
+static void test_Allocator(void)
+{
+ HRESULT hr;
+ IMimeAllocator *alloc;
+
+ hr = MimeOleGetAllocator(&alloc);
+ ok(hr == S_OK, "ret %08x\n", hr);
+ IMimeAllocator_Release(alloc);
+}
+
START_TEST(mimeole)
{
OleInitialize(NULL);
test_CreateVirtualStream();
test_CreateSecurity();
test_CreateBody();
+ test_Allocator();
OleUninitialize();
}
More information about the wine-cvs
mailing list