inetcomm: Improve IMimeMessage SetOption.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2016-05-03 09:17:36 +00:00 committed by Alexandre Julliard
parent 2fff4d0343
commit dcb659f032
3 changed files with 26 additions and 7 deletions

View File

@ -2305,27 +2305,35 @@ static HRESULT WINAPI MimeMessage_SetOption(
const TYPEDID oid,
LPCPROPVARIANT pValue)
{
HRESULT hr = E_NOTIMPL;
HRESULT hr = S_OK;
TRACE("(%p)->(%08x, %p)\n", iface, oid, pValue);
/* Message ID is checked before type.
* OID 0x4D -> 0x56 and 0x58 aren't defined but will filtered out later.
*/
if(TYPEDID_ID(oid) < TYPEDID_ID(OID_ALLOW_8BIT_HEADER) || TYPEDID_ID(oid) > TYPEDID_ID(OID_SECURITY_2KEY_CERT_BAG_64))
{
WARN("oid (%08x) out of range\n", oid);
return MIME_E_INVALID_OPTION_ID;
}
if(pValue->vt != TYPEDID_TYPE(oid))
{
WARN("Called with vartype %04x and oid %08x\n", pValue->vt, oid);
return E_INVALIDARG;
return S_OK;
}
switch(oid)
{
case OID_HIDE_TNEF_ATTACHMENTS:
FIXME("OID_HIDE_TNEF_ATTACHMENTS (value %d): ignoring\n", pValue->u.boolVal);
hr = S_OK;
break;
case OID_SHOW_MACBINARY:
FIXME("OID_SHOW_MACBINARY (value %d): ignoring\n", pValue->u.boolVal);
hr = S_OK;
break;
default:
FIXME("Unhandled oid %08x\n", oid);
hr = MIME_E_INVALID_OPTION_ID;
}
return hr;

View File

@ -412,7 +412,7 @@ static void test_MessageOptions(void)
prop.u.pszVal = CoTaskMemAlloc(strlen(string)+1);
strcpy(prop.u.pszVal, string);
hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
todo_wine ok(hr == S_OK, "ret %08x\n", hr);
ok(hr == S_OK, "ret %08x\n", hr);
PropVariantClear(&prop);
hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
@ -426,7 +426,7 @@ static void test_MessageOptions(void)
prop.u.pszVal = CoTaskMemAlloc(strlen(zero)+1);
strcpy(prop.u.pszVal, zero);
hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
todo_wine ok(hr == S_OK, "ret %08x\n", hr);
ok(hr == S_OK, "ret %08x\n", hr);
PropVariantClear(&prop);
hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
@ -439,7 +439,14 @@ static void test_MessageOptions(void)
prop.vt = VT_BOOL;
prop.u.boolVal = TRUE;
hr = IMimeMessage_SetOption(msg, 0xff00000a, &prop);
todo_wine ok(hr == MIME_E_INVALID_OPTION_ID, "ret %08x\n", hr);
ok(hr == MIME_E_INVALID_OPTION_ID, "ret %08x\n", hr);
PropVariantClear(&prop);
/* Out of range before type. */
prop.vt = VT_I4;
prop.u.lVal = 1;
hr = IMimeMessage_SetOption(msg, 0xff00000a, &prop);
ok(hr == MIME_E_INVALID_OPTION_ID, "ret %08x\n", hr);
PropVariantClear(&prop);
IMimeMessage_Release(msg);

View File

@ -153,6 +153,7 @@ cpp_quote(" PID_ATT_ACCOUNTNAME = 78,")
cpp_quote(" PID_LAST = 79,")
cpp_quote("} MIMEPROPID;")
cpp_quote("#define TYPEDID_ID(_typedid) (((ULONG)(_typedid))>>16)")
cpp_quote("#define TYPEDID_MASK ((ULONG)0xffff)")
cpp_quote("#define TYPEDID_TYPE(t) ((VARTYPE)((t) & TYPEDID_MASK))")
@ -177,6 +178,9 @@ cpp_quote("#define OID_CAN_INLINE_TEXT_BODIES (0x00380000 | VT_BOOL)")
cpp_quote("#define OID_SHOW_MACBINARY (0x00390000 | VT_BOOL)")
cpp_quote("#define OID_SAVEBODY_KEEPBOUNDARY (0x00400000 | VT_BOOL)")
cpp_quote("#define OID_SECURITY_2KEY_CERT_BAG (0x00590000 | VT_VECTOR | VT_UI4)")
cpp_quote("#define OID_SECURITY_2KEY_CERT_BAG_64 (0x00590000 | VT_VECTOR | VT_UI8)")
[
uuid(e4b28371-83b0-11d0-8259-00c04fd85ab4),
version(1.0)