inetcomm: GetBody returns MIME_E_NOT_FOUND when no parent found.

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-07-12 08:02:46 +00:00 committed by Alexandre Julliard
parent b8b7db8be8
commit ed880969b3
2 changed files with 18 additions and 2 deletions

View File

@ -2175,7 +2175,10 @@ static HRESULT get_body(MimeMessage *msg, BODYLOCATION location, HBODY pivot, bo
switch(location)
{
case IBL_PARENT:
*out = body->parent;
if(body->parent)
*out = body->parent;
else
hr = MIME_E_NOT_FOUND;
break;
case IBL_FIRST:
@ -2239,6 +2242,11 @@ static HRESULT WINAPI MimeMessage_GetBody(IMimeMessage *iface, BODYLOCATION loca
TRACE("(%p)->(%d, %p, %p)\n", iface, location, hPivot, phBody);
if(!phBody)
return E_INVALIDARG;
*phBody = NULL;
hr = get_body(This, location, hPivot, &body);
if(hr == S_OK) *phBody = UlongToHandle(body->index);

View File

@ -214,7 +214,7 @@ static void test_CreateMessage(void)
IStream *stream;
LARGE_INTEGER pos;
LONG ref;
HBODY hbody;
HBODY hbody, hbody2;
IMimeBody *body;
BODYOFFSETS offsets;
ULONG count;
@ -266,6 +266,14 @@ static void test_CreateMessage(void)
ok(hr == S_OK, "ret %08x\n", hr);
ok(handle != NULL, "handle %p\n", handle);
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);
PropVariantInit(&prop);
hr = IMimeMessage_GetBodyProp(msg, hbody, att_pritype, 0, &prop);
ok(hr == S_OK, "ret %08x\n", hr);