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

inetcomm: IMimeMessage has a HBODY_ROOT node by default.

parent ca8a0860
...@@ -1706,6 +1706,8 @@ static HRESULT WINAPI MimeMessage_Load(IMimeMessage *iface, IStream *pStm) ...@@ -1706,6 +1706,8 @@ static HRESULT WINAPI MimeMessage_Load(IMimeMessage *iface, IStream *pStm)
return E_FAIL; return E_FAIL;
} }
empty_body_list(&This->body_tree);
IStream_AddRef(pStm); IStream_AddRef(pStm);
This->stream = pStm; This->stream = pStm;
offsets.cbBoundaryStart = offsets.cbHeaderStart = 0; offsets.cbBoundaryStart = offsets.cbHeaderStart = 0;
...@@ -2544,6 +2546,8 @@ static const IMimeMessageVtbl MimeMessageVtbl = ...@@ -2544,6 +2546,8 @@ static const IMimeMessageVtbl MimeMessageVtbl =
HRESULT MimeMessage_create(IUnknown *outer, void **obj) HRESULT MimeMessage_create(IUnknown *outer, void **obj)
{ {
MimeMessage *This; MimeMessage *This;
MimeBody *mime_body;
body_t *root_body;
TRACE("(%p, %p)\n", outer, obj); TRACE("(%p, %p)\n", outer, obj);
...@@ -2564,6 +2568,10 @@ HRESULT MimeMessage_create(IUnknown *outer, void **obj) ...@@ -2564,6 +2568,10 @@ HRESULT MimeMessage_create(IUnknown *outer, void **obj)
list_init(&This->body_tree); list_init(&This->body_tree);
This->next_index = 1; 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; *obj = &This->IMimeMessage_iface;
return S_OK; return S_OK;
} }
......
...@@ -332,6 +332,27 @@ static void test_CreateMessage(void) ...@@ -332,6 +332,27 @@ static void test_CreateMessage(void)
IStream_Release(stream); 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) START_TEST(mimeole)
{ {
OleInitialize(NULL); OleInitialize(NULL);
...@@ -340,5 +361,6 @@ START_TEST(mimeole) ...@@ -340,5 +361,6 @@ START_TEST(mimeole)
test_CreateBody(); test_CreateBody();
test_Allocator(); test_Allocator();
test_CreateMessage(); test_CreateMessage();
test_BindToObject();
OleUninitialize(); OleUninitialize();
} }
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