Commit dcb659f0 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

inetcomm: Improve IMimeMessage SetOption.

parent 2fff4d03
......@@ -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;
......
......@@ -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);
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment