Alistair Leslie-Hughes : inetcomm: GetBody returns MIME_E_NOT_FOUND when no parent found.

Alexandre Julliard julliard at winehq.org
Mon Jul 18 09:22:33 CDT 2016


Module: wine
Branch: master
Commit: ed880969b37c873ce6d46bcc1e03177228e4061e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ed880969b37c873ce6d46bcc1e03177228e4061e

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Tue Jul 12 08:02:46 2016 +0000

inetcomm: GetBody returns MIME_E_NOT_FOUND when no parent found.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 58d0520..011c19f 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);




More information about the wine-cvs mailing list