[PATCH 2/2] inetcomm: GetBody returns MIME_E_NOT_FOUND when no parent found
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Jul 12 03:02:46 CDT 2016
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/inetcomm/mimeole.c | 10 +++++++++-
dlls/inetcomm/tests/mimeole.c | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c
index 23bd930..6046c74 100644
--- a/dlls/inetcomm/mimeole.c
+++ b/dlls/inetcomm/mimeole.c
@@ -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);
diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c
index 13b21a0..5dcb584 100644
--- a/dlls/inetcomm/tests/mimeole.c
+++ b/dlls/inetcomm/tests/mimeole.c
@@ -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);
--
1.9.1
More information about the wine-patches
mailing list