inetcomm: IMimeMessage has a HBODY_ROOT node by default.

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-04-14 10:11:14 +00:00 committed by Alexandre Julliard
parent ca8a08606d
commit 7a2e5b038d
2 changed files with 30 additions and 0 deletions

View File

@ -1706,6 +1706,8 @@ static HRESULT WINAPI MimeMessage_Load(IMimeMessage *iface, IStream *pStm)
return E_FAIL;
}
empty_body_list(&This->body_tree);
IStream_AddRef(pStm);
This->stream = pStm;
offsets.cbBoundaryStart = offsets.cbHeaderStart = 0;
@ -2544,6 +2546,8 @@ static const IMimeMessageVtbl MimeMessageVtbl =
HRESULT MimeMessage_create(IUnknown *outer, void **obj)
{
MimeMessage *This;
MimeBody *mime_body;
body_t *root_body;
TRACE("(%p, %p)\n", outer, obj);
@ -2564,6 +2568,10 @@ HRESULT MimeMessage_create(IUnknown *outer, void **obj)
list_init(&This->body_tree);
This->next_index = 1;
mime_body = mimebody_create();
root_body = new_body_entry(mime_body, This->next_index++, NULL);
list_add_head(&This->body_tree, &root_body->entry);
*obj = &This->IMimeMessage_iface;
return S_OK;
}

View File

@ -332,6 +332,27 @@ static void test_CreateMessage(void)
IStream_Release(stream);
}
void test_BindToObject(void)
{
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);
}
START_TEST(mimeole)
{
OleInitialize(NULL);
@ -340,5 +361,6 @@ START_TEST(mimeole)
test_CreateBody();
test_Allocator();
test_CreateMessage();
test_BindToObject();
OleUninitialize();
}