diff --git a/dlls/inetcomm/inetcomm.spec b/dlls/inetcomm/inetcomm.spec index a9e7d1634ab..0266bb1671c 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 81303b3aecf..15350df89e2 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 2a419252f35..bf6e5ce31dd 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 59619df810f..f0185d454ff 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 97759fc2e3e..620cfa78ef4 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 51135d165ba..97fe6e62f34 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(); }