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

inetcomm: GetBody returns MIME_E_NOT_FOUND when no parent found.

parent b8b7db8b
......@@ -2175,7 +2175,10 @@ static HRESULT get_body(MimeMessage *msg, BODYLOCATION location, HBODY pivot, bo
switch(location)
{
case IBL_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);
......
......@@ -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);
......
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