Daniel Jelinski : oleaut32: Added support for loading cursors in OLEPicture .

Alexandre Julliard julliard at winehq.org
Mon May 7 14:29:26 CDT 2012


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

Author: Daniel Jelinski <djelinski1 at gmail.com>
Date:   Sun May  6 21:35:57 2012 +0200

oleaut32: Added support for loading cursors in OLEPicture.

---

 dlls/oleaut32/olepicture.c |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 2195ba5..348529e 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -1228,16 +1228,34 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x
 	}
 	if (i==cifd->idCount) i=0;
     }
-
-    hicon = CreateIconFromResourceEx(
-		xbuf+cifd->idEntries[i].dwDIBOffset,
-		cifd->idEntries[i].dwDIBSize,
-		TRUE, /* is icon */
-		0x00030000,
-		cifd->idEntries[i].bWidth,
-		cifd->idEntries[i].bHeight,
-		0
-    );
+    if (cifd->idType == 2)
+    {
+        LPBYTE buf = HeapAlloc(GetProcessHeap(), 0, cifd->idEntries[i].dwDIBSize + 4);
+        memcpy(buf, &cifd->idEntries[i].xHotspot, 4);
+        memcpy(buf + 4, xbuf+cifd->idEntries[i].dwDIBOffset, cifd->idEntries[i].dwDIBSize);
+        hicon = CreateIconFromResourceEx(
+		    buf,
+		    cifd->idEntries[i].dwDIBSize + 4,
+		    FALSE, /* is cursor */
+		    0x00030000,
+		    cifd->idEntries[i].bWidth,
+		    cifd->idEntries[i].bHeight,
+		    0
+	);
+	HeapFree(GetProcessHeap(), 0, buf);
+    }
+    else
+    {
+        hicon = CreateIconFromResourceEx(
+		    xbuf+cifd->idEntries[i].dwDIBOffset,
+		    cifd->idEntries[i].dwDIBSize,
+		    TRUE, /* is icon */
+		    0x00030000,
+		    cifd->idEntries[i].bWidth,
+		    cifd->idEntries[i].bHeight,
+		    0
+	);
+    }
     if (!hicon) {
 	ERR("CreateIcon failed.\n");
 	return E_FAIL;
@@ -1322,7 +1340,7 @@ static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This,
  * 	DWORD magic;
  * 	DWORD len;
  *
- * Currently implemented: BITMAP, ICON, JPEG, GIF, WMF, EMF
+ * Currently implemented: BITMAP, ICON, CURSOR, JPEG, GIF, WMF, EMF
  */
 static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm) {
   HRESULT	hr;
@@ -1477,7 +1495,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm)
   case BITMAP_FORMAT_APM: /* APM */
     hr = OLEPictureImpl_LoadAPM(This, xbuf, xread);
     break;
-  case 0x0000: { /* ICON , first word is dwReserved */
+  case 0x0000: { /* ICON or CURSOR, first word is dwReserved */
     hr = OLEPictureImpl_LoadIcon(This, xbuf, xread);
     break;
   }




More information about the wine-cvs mailing list