2007-11-02 16:45:39 +01:00
|
|
|
/*
|
|
|
|
* MimeOle tests
|
|
|
|
*
|
|
|
|
* Copyright 2007 Huw Davies
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
2008-02-12 15:11:34 +01:00
|
|
|
#define NONAMELESSUNION
|
2007-11-02 16:45:39 +01:00
|
|
|
|
2008-07-08 16:17:17 +02:00
|
|
|
#include "initguid.h"
|
2007-11-02 16:45:39 +01:00
|
|
|
#include "windows.h"
|
|
|
|
#include "ole2.h"
|
2007-11-14 17:39:50 +01:00
|
|
|
#include "ocidl.h"
|
|
|
|
|
2007-11-02 16:45:39 +01:00
|
|
|
#include "mimeole.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2013-12-24 09:25:35 +01:00
|
|
|
static const char msg1[] =
|
2007-11-26 13:01:12 +01:00
|
|
|
"MIME-Version: 1.0\r\n"
|
|
|
|
"Content-Type: multipart/mixed;\r\n"
|
|
|
|
" boundary=\"------------1.5.0.6\";\r\n"
|
2007-12-18 16:37:21 +01:00
|
|
|
" stuff=\"du;nno\";\r\n"
|
|
|
|
" morestuff=\"so\\\\me\\\"thing\\\"\"\r\n"
|
2007-11-26 13:01:12 +01:00
|
|
|
"foo: bar\r\n"
|
|
|
|
"From: Huw Davies <huw@codeweavers.com>\r\n"
|
|
|
|
"From: Me <xxx@codeweavers.com>\r\n"
|
|
|
|
"To: wine-patches <wine-patches@winehq.org>\r\n"
|
|
|
|
"Cc: Huw Davies <huw@codeweavers.com>,\r\n"
|
|
|
|
" \"Fred Bloggs\" <fred@bloggs.com>\r\n"
|
|
|
|
"foo: baz\r\n"
|
|
|
|
"bar: fum\r\n"
|
|
|
|
"\r\n"
|
|
|
|
"This is a multi-part message in MIME format.\r\n"
|
|
|
|
"--------------1.5.0.6\r\n"
|
|
|
|
"Content-Type: text/plain; format=fixed; charset=UTF-8\r\n"
|
|
|
|
"Content-Transfer-Encoding: 8bit\r\n"
|
|
|
|
"\r\n"
|
|
|
|
"Stuff\r\n"
|
|
|
|
"--------------1.5.0.6\r\n"
|
|
|
|
"Content-Type: text/plain; charset=\"us-ascii\"\r\n"
|
|
|
|
"Content-Transfer-Encoding: 7bit\r\n"
|
|
|
|
"\r\n"
|
|
|
|
"More stuff\r\n"
|
|
|
|
"--------------1.5.0.6--\r\n";
|
2007-11-02 16:45:39 +01:00
|
|
|
|
|
|
|
static void test_CreateVirtualStream(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IStream *pstm;
|
|
|
|
|
|
|
|
hr = MimeOleCreateVirtualStream(&pstm);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
IStream_Release(pstm);
|
|
|
|
}
|
|
|
|
|
2007-11-05 18:02:40 +01:00
|
|
|
static void test_CreateSecurity(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeSecurity *sec;
|
|
|
|
|
|
|
|
hr = MimeOleCreateSecurity(&sec);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
IMimeSecurity_Release(sec);
|
|
|
|
}
|
|
|
|
|
2007-11-14 17:39:50 +01:00
|
|
|
static void test_CreateBody(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeBody *body;
|
|
|
|
HBODY handle = (void *)0xdeadbeef;
|
2007-11-26 13:01:12 +01:00
|
|
|
IStream *in;
|
|
|
|
LARGE_INTEGER off;
|
|
|
|
ULARGE_INTEGER pos;
|
2007-11-26 13:04:08 +01:00
|
|
|
ENCODINGTYPE enc;
|
2007-12-18 16:37:21 +01:00
|
|
|
ULONG count, found_param, i;
|
2007-12-18 16:26:32 +01:00
|
|
|
MIMEPARAMINFO *param_info;
|
|
|
|
IMimeAllocator *alloc;
|
2007-12-20 16:14:35 +01:00
|
|
|
BODYOFFSETS offsets;
|
2007-11-14 17:39:50 +01:00
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_IMimeBody, NULL, CLSCTX_INPROC_SERVER, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetHandle(body, &handle);
|
|
|
|
ok(hr == MIME_E_NO_DATA, "ret %08x\n", hr);
|
|
|
|
ok(handle == NULL, "handle %p\n", handle);
|
|
|
|
|
2007-11-26 13:01:12 +01:00
|
|
|
hr = CreateStreamOnHGlobal(NULL, TRUE, &in);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
IStream_Write(in, msg1, sizeof(msg1) - 1, NULL);
|
|
|
|
off.QuadPart = 0;
|
|
|
|
IStream_Seek(in, off, STREAM_SEEK_SET, NULL);
|
|
|
|
|
|
|
|
/* Need to call InitNew before Load otherwise Load crashes with native inetcomm */
|
|
|
|
hr = IMimeBody_InitNew(body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
2007-11-26 13:04:08 +01:00
|
|
|
hr = IMimeBody_GetCurrentEncoding(body, &enc);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(enc == IET_7BIT, "encoding %d\n", enc);
|
|
|
|
|
2007-11-26 13:01:12 +01:00
|
|
|
hr = IMimeBody_Load(body, in);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
off.QuadPart = 0;
|
|
|
|
IStream_Seek(in, off, STREAM_SEEK_CUR, &pos);
|
2007-12-18 16:37:21 +01:00
|
|
|
ok(pos.u.LowPart == 359, "pos %u\n", pos.u.LowPart);
|
2007-11-26 13:01:12 +01:00
|
|
|
|
2007-11-26 13:03:35 +01:00
|
|
|
hr = IMimeBody_IsContentType(body, "multipart", "mixed");
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
hr = IMimeBody_IsContentType(body, "text", "plain");
|
|
|
|
ok(hr == S_FALSE, "ret %08x\n", hr);
|
|
|
|
hr = IMimeBody_IsContentType(body, NULL, "mixed");
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2008-09-22 15:36:13 +02:00
|
|
|
hr = IMimeBody_IsType(body, IBT_EMPTY);
|
|
|
|
ok(hr == S_OK, "got %08x\n", hr);
|
2007-11-26 13:03:35 +01:00
|
|
|
|
2007-11-26 13:04:51 +01:00
|
|
|
hr = IMimeBody_SetData(body, IET_8BIT, "text", "plain", &IID_IStream, in);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
hr = IMimeBody_IsContentType(body, "text", "plain");
|
|
|
|
todo_wine
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
hr = IMimeBody_GetCurrentEncoding(body, &enc);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(enc == IET_8BIT, "encoding %d\n", enc);
|
|
|
|
|
2007-12-20 16:14:35 +01:00
|
|
|
memset(&offsets, 0xcc, sizeof(offsets));
|
|
|
|
hr = IMimeBody_GetOffsets(body, &offsets);
|
|
|
|
ok(hr == MIME_E_NO_DATA, "ret %08x\n", hr);
|
|
|
|
ok(offsets.cbBoundaryStart == 0, "got %d\n", offsets.cbBoundaryStart);
|
|
|
|
ok(offsets.cbHeaderStart == 0, "got %d\n", offsets.cbHeaderStart);
|
|
|
|
ok(offsets.cbBodyStart == 0, "got %d\n", offsets.cbBodyStart);
|
|
|
|
ok(offsets.cbBodyEnd == 0, "got %d\n", offsets.cbBodyEnd);
|
|
|
|
|
2008-09-22 15:36:13 +02:00
|
|
|
hr = IMimeBody_IsType(body, IBT_EMPTY);
|
|
|
|
ok(hr == S_FALSE, "got %08x\n", hr);
|
|
|
|
|
2007-12-18 16:26:32 +01:00
|
|
|
hr = MimeOleGetAllocator(&alloc);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetParameters(body, "nothere", &count, ¶m_info);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
ok(count == 0, "got %d\n", count);
|
|
|
|
ok(!param_info, "got %p\n", param_info);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetParameters(body, "bar", &count, ¶m_info);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(count == 0, "got %d\n", count);
|
|
|
|
ok(!param_info, "got %p\n", param_info);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetParameters(body, "Content-Type", &count, ¶m_info);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
todo_wine /* native adds a charset parameter */
|
2007-12-18 16:37:21 +01:00
|
|
|
ok(count == 4, "got %d\n", count);
|
2007-12-18 16:26:32 +01:00
|
|
|
ok(param_info != NULL, "got %p\n", param_info);
|
|
|
|
|
2007-12-18 16:37:21 +01:00
|
|
|
found_param = 0;
|
|
|
|
for(i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
if(!strcmp(param_info[i].pszName, "morestuff"))
|
|
|
|
{
|
|
|
|
found_param++;
|
|
|
|
ok(!strcmp(param_info[i].pszData, "so\\me\"thing\""),
|
|
|
|
"got %s\n", param_info[i].pszData);
|
|
|
|
}
|
|
|
|
else if(!strcmp(param_info[i].pszName, "stuff"))
|
|
|
|
{
|
|
|
|
found_param++;
|
|
|
|
ok(!strcmp(param_info[i].pszData, "du;nno"),
|
|
|
|
"got %s\n", param_info[i].pszData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ok(found_param == 2, "matched %d params\n", found_param);
|
|
|
|
|
2007-12-18 16:26:32 +01:00
|
|
|
hr = IMimeAllocator_FreeParamInfoArray(alloc, count, param_info, TRUE);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
IMimeAllocator_Release(alloc);
|
|
|
|
|
|
|
|
IStream_Release(in);
|
2007-11-14 17:39:50 +01:00
|
|
|
IMimeBody_Release(body);
|
|
|
|
}
|
|
|
|
|
2007-12-18 12:50:22 +01:00
|
|
|
static void test_Allocator(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeAllocator *alloc;
|
|
|
|
|
|
|
|
hr = MimeOleGetAllocator(&alloc);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
IMimeAllocator_Release(alloc);
|
|
|
|
}
|
|
|
|
|
2008-02-08 13:17:43 +01:00
|
|
|
static void test_CreateMessage(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeMessage *msg;
|
|
|
|
IStream *stream;
|
|
|
|
LARGE_INTEGER pos;
|
|
|
|
LONG ref;
|
2016-07-12 10:02:46 +02:00
|
|
|
HBODY hbody, hbody2;
|
2008-02-11 13:04:49 +01:00
|
|
|
IMimeBody *body;
|
|
|
|
BODYOFFSETS offsets;
|
2008-02-12 12:59:36 +01:00
|
|
|
ULONG count;
|
2008-02-12 13:18:26 +01:00
|
|
|
FINDBODY find_struct;
|
2008-02-12 15:20:37 +01:00
|
|
|
HCHARSET hcs;
|
2016-07-12 10:02:34 +02:00
|
|
|
HBODY handle = NULL;
|
2008-02-12 15:28:11 +01:00
|
|
|
|
2008-02-12 13:18:26 +01:00
|
|
|
char text[] = "text";
|
2008-02-12 14:49:28 +01:00
|
|
|
HBODY *body_list;
|
2008-02-12 15:11:34 +01:00
|
|
|
PROPVARIANT prop;
|
2013-12-24 09:25:35 +01:00
|
|
|
static const char att_pritype[] = "att:pri-content-type";
|
2008-02-08 13:17:43 +01:00
|
|
|
|
|
|
|
hr = MimeOleCreateMessage(NULL, &msg);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
CreateStreamOnHGlobal(NULL, TRUE, &stream);
|
|
|
|
IStream_Write(stream, msg1, sizeof(msg1) - 1, NULL);
|
|
|
|
pos.QuadPart = 0;
|
|
|
|
IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
|
|
|
|
|
|
|
|
hr = IMimeMessage_Load(msg, stream);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
2008-02-12 12:59:36 +01:00
|
|
|
hr = IMimeMessage_CountBodies(msg, HBODY_ROOT, TRUE, &count);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(count == 3, "got %d\n", count);
|
|
|
|
|
|
|
|
hr = IMimeMessage_CountBodies(msg, HBODY_ROOT, FALSE, &count);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(count == 3, "got %d\n", count);
|
|
|
|
|
2008-02-11 13:04:49 +01:00
|
|
|
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
hr = IMimeBody_GetOffsets(body, &offsets);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(offsets.cbBoundaryStart == 0, "got %d\n", offsets.cbBoundaryStart);
|
|
|
|
ok(offsets.cbHeaderStart == 0, "got %d\n", offsets.cbHeaderStart);
|
|
|
|
ok(offsets.cbBodyStart == 359, "got %d\n", offsets.cbBodyStart);
|
|
|
|
ok(offsets.cbBodyEnd == 666, "got %d\n", offsets.cbBodyEnd);
|
|
|
|
IMimeBody_Release(body);
|
|
|
|
|
2008-02-12 12:49:47 +01:00
|
|
|
hr = IMimeMessage_GetBody(msg, IBL_ROOT, NULL, &hbody);
|
2011-02-07 23:57:43 +01:00
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2008-02-12 15:11:34 +01:00
|
|
|
|
2016-07-12 10:02:34 +02:00
|
|
|
hr = IMimeBody_GetHandle(body, NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetHandle(body, &handle);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(handle != NULL, "handle %p\n", handle);
|
|
|
|
|
2016-07-12 10:02:46 +02:00
|
|
|
hr = IMimeMessage_GetBody(msg, IBL_PARENT, hbody, NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hbody2 = (HBODY)0xdeadbeef;
|
|
|
|
hr = IMimeMessage_GetBody(msg, IBL_PARENT, hbody, &hbody2);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
ok(hbody2 == NULL, "hbody2 %p\n", hbody2);
|
|
|
|
|
2008-02-12 15:11:34 +01:00
|
|
|
PropVariantInit(&prop);
|
|
|
|
hr = IMimeMessage_GetBodyProp(msg, hbody, att_pritype, 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(prop.vt == VT_LPSTR, "vt %08x\n", prop.vt);
|
|
|
|
ok(!strcasecmp(prop.u.pszVal, "multipart"), "got %s\n", prop.u.pszVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
2008-02-12 12:49:47 +01:00
|
|
|
hr = IMimeMessage_GetBody(msg, IBL_FIRST, hbody, &hbody);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
hr = IMimeMessage_BindToObject(msg, hbody, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2016-07-12 10:02:34 +02:00
|
|
|
|
|
|
|
hr = IMimeBody_GetHandle(body, &handle);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(handle == hbody, "handle %p\n", handle);
|
|
|
|
|
2008-02-12 12:49:47 +01:00
|
|
|
hr = IMimeBody_GetOffsets(body, &offsets);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(offsets.cbBoundaryStart == 405, "got %d\n", offsets.cbBoundaryStart);
|
|
|
|
ok(offsets.cbHeaderStart == 428, "got %d\n", offsets.cbHeaderStart);
|
|
|
|
ok(offsets.cbBodyStart == 518, "got %d\n", offsets.cbBodyStart);
|
|
|
|
ok(offsets.cbBodyEnd == 523, "got %d\n", offsets.cbBodyEnd);
|
2008-02-12 15:20:37 +01:00
|
|
|
|
|
|
|
hr = IMimeBody_GetCharset(body, &hcs);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2008-04-20 05:06:10 +02:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(hcs != NULL, "Expected non-NULL charset\n");
|
|
|
|
}
|
2008-02-12 15:20:37 +01:00
|
|
|
|
2008-02-12 12:49:47 +01:00
|
|
|
IMimeBody_Release(body);
|
|
|
|
|
|
|
|
hr = IMimeMessage_GetBody(msg, IBL_NEXT, hbody, &hbody);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
hr = IMimeMessage_BindToObject(msg, hbody, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2016-07-12 10:02:34 +02:00
|
|
|
|
|
|
|
hr = IMimeBody_GetHandle(body, &handle);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(handle == hbody, "handle %p\n", handle);
|
|
|
|
|
2008-02-12 12:49:47 +01:00
|
|
|
hr = IMimeBody_GetOffsets(body, &offsets);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(offsets.cbBoundaryStart == 525, "got %d\n", offsets.cbBoundaryStart);
|
|
|
|
ok(offsets.cbHeaderStart == 548, "got %d\n", offsets.cbHeaderStart);
|
|
|
|
ok(offsets.cbBodyStart == 629, "got %d\n", offsets.cbBodyStart);
|
|
|
|
ok(offsets.cbBodyEnd == 639, "got %d\n", offsets.cbBodyEnd);
|
|
|
|
IMimeBody_Release(body);
|
|
|
|
|
2008-02-12 13:18:26 +01:00
|
|
|
find_struct.pszPriType = text;
|
|
|
|
find_struct.pszSubType = NULL;
|
|
|
|
|
|
|
|
hr = IMimeMessage_FindFirst(msg, &find_struct, &hbody);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeMessage_FindNext(msg, &find_struct, &hbody);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeMessage_FindNext(msg, &find_struct, &hbody);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
2008-02-12 12:49:47 +01:00
|
|
|
|
2008-02-12 14:49:28 +01:00
|
|
|
hr = IMimeMessage_GetAttachments(msg, &count, &body_list);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(count == 2, "got %d\n", count);
|
2016-08-18 13:13:02 +02:00
|
|
|
if(count == 2)
|
|
|
|
{
|
|
|
|
ENCODINGTYPE encoding;
|
|
|
|
IMimeBody *attachment;
|
|
|
|
PROPVARIANT prop;
|
|
|
|
|
|
|
|
PropVariantInit(&prop);
|
|
|
|
|
|
|
|
hr = IMimeMessage_BindToObject(msg, body_list[0], &IID_IMimeBody, (void**)&attachment);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_IsContentType(attachment, "multipart", NULL);
|
|
|
|
ok(hr == S_FALSE, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetCurrentEncoding(attachment, &encoding);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
todo_wine ok(encoding == IET_8BIT, "ret %d\n", encoding);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
hr = IMimeBody_GetProp(attachment, "Content-Transfer-Encoding", 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt);
|
|
|
|
ok(!strcmp(prop.u.pszVal, "8bit"), "got %s\n", prop.u.pszVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
hr = IMimeBody_IsType(attachment, IBT_ATTACHMENT);
|
|
|
|
todo_wine ok(hr == S_FALSE, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
IMimeBody_Release(attachment);
|
|
|
|
|
|
|
|
hr = IMimeMessage_BindToObject(msg, body_list[1], &IID_IMimeBody, (void**)&attachment);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_IsContentType(attachment, "multipart", NULL);
|
|
|
|
ok(hr == S_FALSE, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetCurrentEncoding(attachment, &encoding);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
todo_wine ok(encoding == IET_7BIT, "ret %d\n", encoding);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
hr = IMimeBody_GetProp(attachment, "Content-Transfer-Encoding", 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt);
|
|
|
|
ok(!strcmp(prop.u.pszVal, "7bit"), "got %s\n", prop.u.pszVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
hr = IMimeBody_IsType(attachment, IBT_ATTACHMENT);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
IMimeBody_Release(attachment);
|
|
|
|
}
|
2008-02-12 14:49:28 +01:00
|
|
|
CoTaskMemFree(body_list);
|
|
|
|
|
2012-08-13 11:11:26 +02:00
|
|
|
hr = IMimeBody_GetCharset(body, &hcs);
|
2008-02-12 15:20:37 +01:00
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2008-04-20 05:06:10 +02:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(hcs != NULL, "Expected non-NULL charset\n");
|
|
|
|
}
|
2008-02-12 15:20:37 +01:00
|
|
|
|
2008-02-08 13:17:43 +01:00
|
|
|
IMimeMessage_Release(msg);
|
|
|
|
|
|
|
|
ref = IStream_AddRef(stream);
|
2009-02-17 16:43:09 +01:00
|
|
|
ok(ref == 2 ||
|
|
|
|
broken(ref == 1), /* win95 */
|
|
|
|
"ref %d\n", ref);
|
2008-02-08 13:17:43 +01:00
|
|
|
IStream_Release(stream);
|
|
|
|
|
|
|
|
IStream_Release(stream);
|
|
|
|
}
|
|
|
|
|
2016-04-28 10:14:55 +02:00
|
|
|
static void test_MessageSetProp(void)
|
|
|
|
{
|
|
|
|
static const char topic[] = "wine topic";
|
2016-07-01 09:57:42 +02:00
|
|
|
static const WCHAR topicW[] = {'w','i','n','e',' ','t','o','p','i','c',0};
|
2016-04-28 10:14:55 +02:00
|
|
|
HRESULT hr;
|
|
|
|
IMimeMessage *msg;
|
|
|
|
IMimeBody *body;
|
|
|
|
PROPVARIANT prop;
|
|
|
|
|
|
|
|
hr = MimeOleCreateMessage(NULL, &msg);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
PropVariantInit(&prop);
|
|
|
|
|
|
|
|
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_SetProp(body, NULL, 0, &prop);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_SetProp(body, "Thread-Topic", 0, NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
|
|
|
strcpy(prop.u.pszVal, topic);
|
|
|
|
hr = IMimeBody_SetProp(body, "Thread-Topic", 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
2016-04-28 10:15:07 +02:00
|
|
|
hr = IMimeBody_GetProp(body, NULL, 0, &prop);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetProp(body, "Thread-Topic", 0, NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetProp(body, "Wine-Topic", 0, &prop);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
|
2016-07-01 09:57:42 +02:00
|
|
|
prop.vt = VT_LPSTR;
|
2016-04-28 10:14:55 +02:00
|
|
|
hr = IMimeBody_GetProp(body, "Thread-Topic", 0, &prop);
|
2016-04-28 10:15:07 +02:00
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2016-04-28 10:14:55 +02:00
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
2016-04-28 10:15:07 +02:00
|
|
|
ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt);
|
|
|
|
ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal);
|
2016-04-28 10:14:55 +02:00
|
|
|
PropVariantClear(&prop);
|
|
|
|
}
|
|
|
|
|
2016-05-30 12:19:16 +02:00
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
|
|
|
strcpy(prop.u.pszVal, topic);
|
|
|
|
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
2016-07-01 09:57:42 +02:00
|
|
|
prop.vt = VT_LPSTR;
|
2016-05-30 12:19:16 +02:00
|
|
|
hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt);
|
|
|
|
ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Using the name or PID returns the same result. */
|
2016-07-01 09:57:42 +02:00
|
|
|
prop.vt = VT_LPSTR;
|
2016-05-30 12:19:16 +02:00
|
|
|
hr = IMimeBody_GetProp(body, "Subject", 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt);
|
|
|
|
ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
}
|
|
|
|
|
2016-07-01 09:57:42 +02:00
|
|
|
prop.vt = VT_LPWSTR;
|
|
|
|
hr = IMimeBody_GetProp(body, "Subject", 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
ok(prop.vt == VT_LPWSTR, "type %d\n", prop.vt);
|
|
|
|
ok(!lstrcmpW(prop.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(prop.u.pwszVal));
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
}
|
|
|
|
|
2016-05-30 12:19:16 +02:00
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
|
|
|
strcpy(prop.u.pszVal, topic);
|
|
|
|
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_TO), 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
/* Out of Range PID */
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
|
|
|
strcpy(prop.u.pszVal, topic);
|
|
|
|
hr = IMimeBody_SetProp(body, PIDTOSTR(124), 0, &prop);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
2016-04-28 10:14:55 +02:00
|
|
|
IMimeBody_Release(body);
|
|
|
|
IMimeMessage_Release(msg);
|
|
|
|
}
|
|
|
|
|
2016-06-23 10:51:01 +02:00
|
|
|
static void test_MessageGetPropInfo(void)
|
|
|
|
{
|
|
|
|
static const char topic[] = "wine topic";
|
|
|
|
static const char subject[] = "wine testing";
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeMessage *msg;
|
|
|
|
IMimeBody *body;
|
|
|
|
PROPVARIANT prop;
|
|
|
|
MIMEPROPINFO info;
|
|
|
|
|
|
|
|
hr = MimeOleCreateMessage(NULL, &msg);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
PropVariantInit(&prop);
|
|
|
|
|
|
|
|
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
|
|
|
strcpy(prop.u.pszVal, topic);
|
|
|
|
hr = IMimeBody_SetProp(body, "Thread-Topic", 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(subject)+1);
|
|
|
|
strcpy(prop.u.pszVal, subject);
|
|
|
|
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
memset(&info, 0, sizeof(info));
|
|
|
|
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
|
|
|
hr = IMimeBody_GetPropInfo(body, NULL, &info);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
memset(&info, 0, sizeof(info));
|
|
|
|
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
|
|
|
hr = IMimeBody_GetPropInfo(body, "Subject", NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
memset(&info, 0xfe, sizeof(info));
|
|
|
|
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
|
|
|
hr = IMimeBody_GetPropInfo(body, "Subject", &info);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
ok(info.dwMask & (PIM_ENCODINGTYPE | PIM_FLAGS| PIM_PROPID), "Invalid mask 0x%08x\n", info.dwFlags);
|
|
|
|
todo_wine ok(info.dwFlags & 0x10000000, "Invalid flags 0x%08x\n", info.dwFlags);
|
|
|
|
ok(info.ietEncoding == 0, "Invalid encoding %d\n", info.ietEncoding);
|
|
|
|
ok(info.dwPropId == PID_HDR_SUBJECT, "Invalid propid %d\n", info.dwPropId);
|
|
|
|
ok(info.cValues == 0xfefefefe, "Invalid cValues %d\n", info.cValues);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&info, 0xfe, sizeof(info));
|
|
|
|
info.dwMask = 0;
|
|
|
|
hr = IMimeBody_GetPropInfo(body, "Subject", &info);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
ok(info.dwMask == 0, "Invalid mask 0x%08x\n", info.dwFlags);
|
|
|
|
ok(info.dwFlags == 0xfefefefe, "Invalid flags 0x%08x\n", info.dwFlags);
|
|
|
|
ok(info.ietEncoding == -16843010, "Invalid encoding %d\n", info.ietEncoding);
|
|
|
|
ok(info.dwPropId == -16843010, "Invalid propid %d\n", info.dwPropId);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&info, 0xfe, sizeof(info));
|
|
|
|
info.dwMask = 0;
|
|
|
|
info.dwPropId = 1024;
|
|
|
|
info.ietEncoding = 99;
|
|
|
|
hr = IMimeBody_GetPropInfo(body, "Subject", &info);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
ok(info.dwMask == 0, "Invalid mask 0x%08x\n", info.dwFlags);
|
|
|
|
ok(info.dwFlags == 0xfefefefe, "Invalid flags 0x%08x\n", info.dwFlags);
|
|
|
|
ok(info.ietEncoding == 99, "Invalid encoding %d\n", info.ietEncoding);
|
|
|
|
ok(info.dwPropId == 1024, "Invalid propid %d\n", info.dwPropId);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&info, 0, sizeof(info));
|
|
|
|
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
|
|
|
hr = IMimeBody_GetPropInfo(body, "Invalid Property", &info);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
IMimeBody_Release(body);
|
|
|
|
IMimeMessage_Release(msg);
|
|
|
|
}
|
|
|
|
|
2016-04-19 11:26:33 +02:00
|
|
|
static void test_MessageOptions(void)
|
|
|
|
{
|
|
|
|
static const char string[] = "XXXXX";
|
|
|
|
static const char zero[] = "0";
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeMessage *msg;
|
|
|
|
PROPVARIANT prop;
|
|
|
|
|
|
|
|
hr = MimeOleCreateMessage(NULL, &msg);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
PropVariantInit(&prop);
|
|
|
|
|
|
|
|
prop.vt = VT_BOOL;
|
|
|
|
prop.u.boolVal = TRUE;
|
|
|
|
hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
|
|
|
|
todo_wine ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt);
|
|
|
|
todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(string)+1);
|
|
|
|
strcpy(prop.u.pszVal, string);
|
|
|
|
hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
|
2016-05-03 11:17:36 +02:00
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2016-04-19 11:26:33 +02:00
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
|
|
|
|
todo_wine ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt);
|
|
|
|
todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
/* Invalid property type doesn't change the value */
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(zero)+1);
|
|
|
|
strcpy(prop.u.pszVal, zero);
|
|
|
|
hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
|
2016-05-03 11:17:36 +02:00
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
2016-04-19 11:26:33 +02:00
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop);
|
|
|
|
todo_wine ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt);
|
|
|
|
todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
/* Invalid OID */
|
|
|
|
prop.vt = VT_BOOL;
|
|
|
|
prop.u.boolVal = TRUE;
|
|
|
|
hr = IMimeMessage_SetOption(msg, 0xff00000a, &prop);
|
2016-05-03 11:17:36 +02:00
|
|
|
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);
|
2016-04-19 11:26:33 +02:00
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
IMimeMessage_Release(msg);
|
|
|
|
}
|
|
|
|
|
2016-04-23 07:48:02 +02:00
|
|
|
static void test_BindToObject(void)
|
2016-04-14 12:11:14 +02:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeMessage *msg;
|
|
|
|
IMimeBody *body;
|
|
|
|
ULONG count;
|
|
|
|
|
|
|
|
hr = MimeOleCreateMessage(NULL, &msg);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeMessage_CountBodies(msg, HBODY_ROOT, TRUE, &count);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
ok(count == 1, "got %d\n", count);
|
|
|
|
|
|
|
|
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
IMimeBody_Release(body);
|
|
|
|
|
|
|
|
IMimeMessage_Release(msg);
|
|
|
|
}
|
|
|
|
|
2016-07-01 09:57:07 +02:00
|
|
|
static void test_BodyDeleteProp(void)
|
|
|
|
{
|
|
|
|
static const char topic[] = "wine topic";
|
|
|
|
HRESULT hr;
|
|
|
|
IMimeMessage *msg;
|
|
|
|
IMimeBody *body;
|
|
|
|
PROPVARIANT prop;
|
|
|
|
|
|
|
|
hr = MimeOleCreateMessage(NULL, &msg);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
PropVariantInit(&prop);
|
|
|
|
|
|
|
|
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_DeleteProp(body, "Subject");
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT));
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
|
|
|
strcpy(prop.u.pszVal, topic);
|
|
|
|
hr = IMimeBody_SetProp(body, "Subject", 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
hr = IMimeBody_DeleteProp(body, "Subject");
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetProp(body, "Subject", 0, &prop);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
prop.vt = VT_LPSTR;
|
|
|
|
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
|
|
|
strcpy(prop.u.pszVal, topic);
|
|
|
|
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
PropVariantClear(&prop);
|
|
|
|
|
|
|
|
hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT));
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
|
|
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
IMimeBody_Release(body);
|
|
|
|
IMimeMessage_Release(msg);
|
|
|
|
}
|
|
|
|
|
2016-04-19 11:26:02 +02:00
|
|
|
static void test_MimeOleGetPropertySchema(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IMimePropertySchema *schema = NULL;
|
|
|
|
|
|
|
|
hr = MimeOleGetPropertySchema(&schema);
|
|
|
|
ok(hr == S_OK, "ret %08x\n", hr);
|
|
|
|
|
|
|
|
IMimePropertySchema_Release(schema);
|
|
|
|
}
|
|
|
|
|
2007-11-02 16:45:39 +01:00
|
|
|
START_TEST(mimeole)
|
|
|
|
{
|
|
|
|
OleInitialize(NULL);
|
|
|
|
test_CreateVirtualStream();
|
2007-11-05 18:02:40 +01:00
|
|
|
test_CreateSecurity();
|
2007-11-14 17:39:50 +01:00
|
|
|
test_CreateBody();
|
2007-12-18 12:50:22 +01:00
|
|
|
test_Allocator();
|
2008-02-08 13:17:43 +01:00
|
|
|
test_CreateMessage();
|
2016-04-28 10:14:55 +02:00
|
|
|
test_MessageSetProp();
|
2016-06-23 10:51:01 +02:00
|
|
|
test_MessageGetPropInfo();
|
2016-04-19 11:26:33 +02:00
|
|
|
test_MessageOptions();
|
2016-04-14 12:11:14 +02:00
|
|
|
test_BindToObject();
|
2016-07-01 09:57:07 +02:00
|
|
|
test_BodyDeleteProp();
|
2016-04-19 11:26:02 +02:00
|
|
|
test_MimeOleGetPropertySchema();
|
2007-11-02 16:45:39 +01:00
|
|
|
OleUninitialize();
|
|
|
|
}
|