From 8599014c2dd2ad58b8d51e023ccfd71f4001e3d1 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 19 Apr 2016 09:26:02 +0000 Subject: [PATCH] inetcomm: Implement MimeOleGetPropertySchema. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Alexandre Julliard --- dlls/inetcomm/mimeole.c | 125 +++++++++++++++++++++++++++++++++++++++++- dlls/inetcomm/tests/mimeole.c | 12 ++++ 2 files changed, 135 insertions(+), 2 deletions(-) diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c index 8aebb3891a4..7a0b5bfef7c 100644 --- a/dlls/inetcomm/mimeole.c +++ b/dlls/inetcomm/mimeole.c @@ -115,6 +115,17 @@ static inline MimeBody *impl_from_IMimeBody(IMimeBody *iface) return CONTAINING_RECORD(iface, MimeBody, IMimeBody_iface); } +typedef struct propschema +{ + IMimePropertySchema IMimePropertySchema_iface; + LONG ref; +} propschema; + +static inline propschema *impl_from_IMimePropertySchema(IMimePropertySchema *iface) +{ + return CONTAINING_RECORD(iface, propschema, IMimePropertySchema_iface); +} + static LPSTR strdupA(LPCSTR str) { char *ret; @@ -3032,8 +3043,118 @@ HRESULT VirtualStream_create(IUnknown *outer, void **obj) return MimeOleCreateVirtualStream((IStream **)obj); } -HRESULT WINAPI MimeOleGetPropertySchema(IMimePropertySchema **schema) +/* IMimePropertySchema Interface */ +static HRESULT WINAPI propschema_QueryInterface(IMimePropertySchema *iface, REFIID riid, void **out) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), out); + + *out = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IMimePropertySchema)) + { + *out = iface; + } + else + { + FIXME("no interface for %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IMimePropertySchema_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI propschema_AddRef(IMimePropertySchema *iface) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI propschema_Release(IMimePropertySchema *iface) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI propschema_RegisterProperty(IMimePropertySchema *iface, const char *name, DWORD flags, + DWORD rownumber, VARTYPE vtdefault, DWORD *propid) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %x, %d, %d, %p) stub\n", This, debugstr_a(name), flags, rownumber, vtdefault, propid); + return E_NOTIMPL; +} + +static HRESULT WINAPI propschema_ModifyProperty(IMimePropertySchema *iface, const char *name, DWORD flags, + DWORD rownumber, VARTYPE vtdefault) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %x, %d, %d) stub\n", This, debugstr_a(name), flags, rownumber, vtdefault); + return E_NOTIMPL; +} + +static HRESULT WINAPI propschema_GetPropertyId(IMimePropertySchema *iface, const char *name, DWORD *propid) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %p) stub\n", This, debugstr_a(name), propid); + return E_NOTIMPL; +} + +static HRESULT WINAPI propschema_GetPropertyName(IMimePropertySchema *iface, DWORD propid, char **name) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%d, %p) stub\n", This, propid, name); + return E_NOTIMPL; +} + +static HRESULT WINAPI propschema_RegisterAddressType(IMimePropertySchema *iface, const char *name, DWORD *adrtype) { - FIXME("(%p) stub\n", schema); + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %p) stub\n", This, debugstr_a(name), adrtype); return E_NOTIMPL; } + +static IMimePropertySchemaVtbl prop_schema_vtbl = +{ + propschema_QueryInterface, + propschema_AddRef, + propschema_Release, + propschema_RegisterProperty, + propschema_ModifyProperty, + propschema_GetPropertyId, + propschema_GetPropertyName, + propschema_RegisterAddressType +}; + + +HRESULT WINAPI MimeOleGetPropertySchema(IMimePropertySchema **schema) +{ + propschema *This; + + TRACE("(%p) stub\n", schema); + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + if (!This) + return E_OUTOFMEMORY; + + This->IMimePropertySchema_iface.lpVtbl = &prop_schema_vtbl; + This->ref = 1; + + *schema = &This->IMimePropertySchema_iface; + + return S_OK; +} diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c index 2b6dee202c4..3b706854efc 100644 --- a/dlls/inetcomm/tests/mimeole.c +++ b/dlls/inetcomm/tests/mimeole.c @@ -353,6 +353,17 @@ void test_BindToObject(void) IMimeMessage_Release(msg); } +static void test_MimeOleGetPropertySchema(void) +{ + HRESULT hr; + IMimePropertySchema *schema = NULL; + + hr = MimeOleGetPropertySchema(&schema); + ok(hr == S_OK, "ret %08x\n", hr); + + IMimePropertySchema_Release(schema); +} + START_TEST(mimeole) { OleInitialize(NULL); @@ -362,5 +373,6 @@ START_TEST(mimeole) test_Allocator(); test_CreateMessage(); test_BindToObject(); + test_MimeOleGetPropertySchema(); OleUninitialize(); } -- 2.11.4.GIT