Huw Davies : oleaut32: Fixes for the PICTYPE_UNINITIALIZED case.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 6 07:41:52 CDT 2007


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Jun  5 10:33:24 2007 +0100

oleaut32: Fixes for the PICTYPE_UNINITIALIZED case.

---

 dlls/oleaut32/olepicture.c       |    2 ++
 dlls/oleaut32/tests/olepicture.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 3eb6e3e..5d3a9f0 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -365,6 +365,7 @@ static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
       DeleteEnhMetaFile(Obj->desc.u.emf.hemf);
       break;
     case PICTYPE_NONE:
+    case PICTYPE_UNINITIALIZED:
       /* Nothing to do */
       break;
     default:
@@ -505,6 +506,7 @@ static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface,
   TRACE("(%p)->(%p)\n", This, phandle);
   switch(This->desc.picType) {
   case PICTYPE_NONE:
+  case PICTYPE_UNINITIALIZED:
     *phandle = 0;
     break;
   case PICTYPE_BITMAP:
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index 1f65c3d..00027de 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -43,6 +43,7 @@
 static HMODULE hOleaut32;
 
 static HRESULT (WINAPI *pOleLoadPicture)(LPSTREAM,LONG,BOOL,REFIID,LPVOID*);
+static HRESULT (WINAPI *pOleCreatePictureIndirect)(PICTDESC*,REFIID,BOOL,LPVOID*);
 
 #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
 
@@ -396,10 +397,38 @@ static void test_Invoke(void)
     IPictureDisp_Release(picdisp);
 }
 
+static void test_OleCreatePictureIndirect(void)
+{
+    IPicture *pict;
+    HRESULT hr;
+    short type;
+    OLE_HANDLE handle;
+
+    if(!pOleCreatePictureIndirect)
+    {
+        skip("Skipping OleCreatePictureIndirect tests\n");
+        return;
+    }
+
+    hr = pOleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict);
+    ok(hr == S_OK, "hr %08x\n", hr);
+
+    hr = IPicture_get_Type(pict, &type);
+    ok(hr == S_OK, "hr %08x\n", hr);
+    ok(type == PICTYPE_UNINITIALIZED, "type %d\n", type);
+
+    hr = IPicture_get_Handle(pict, &handle);
+    ok(hr == S_OK, "hr %08x\n", hr);
+    ok(handle == 0, "handle %08x\n", handle);
+
+    IPicture_Release(pict);
+}
+
 START_TEST(olepicture)
 {
 	hOleaut32 = LoadLibraryA("oleaut32.dll");
 	pOleLoadPicture = (void*)GetProcAddress(hOleaut32, "OleLoadPicture");
+	pOleCreatePictureIndirect = (void*)GetProcAddress(hOleaut32, "OleCreatePictureIndirect");
 	if (!pOleLoadPicture)
 	    return;
 
@@ -414,6 +443,7 @@ START_TEST(olepicture)
 	test_empty_image_2();
 
 	test_Invoke();
+        test_OleCreatePictureIndirect();
 }
 
 




More information about the wine-cvs mailing list