Index: trunk/src/user32/oslibres.cpp
===================================================================
--- trunk/src/user32/oslibres.cpp	(revision 6594)
+++ trunk/src/user32/oslibres.cpp	(revision 6595)
@@ -1,3 +1,3 @@
-/* $Id: oslibres.cpp,v 1.19 2001-08-25 10:54:19 sandervl Exp $ */
+/* $Id: oslibres.cpp,v 1.20 2001-08-26 14:23:33 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -25,4 +25,5 @@
 #include "oslibres.h"
 #include "pmwindow.h"
+#include <wingdi32.h>
 
 #define DBG_LOCALLOG    DBG_oslibres
@@ -307,15 +308,15 @@
         pBmpColor->ulColorEncoding  = BCE_RGB;
 
-  	    os2rgb                      = &pBmpColor->argbColor[0];
-  	    rgb                         = (RGBQUAD *)(pXorBits);
-
-  	    if(pXorBmp->bmBitsPixel <= 8) {
-    	        for(i=0;i<(1<<pXorBmp->bmBitsPixel);i++) {
-    	                os2rgb->bRed   = rgb->rgbRed;
-    	                os2rgb->bBlue  = rgb->rgbBlue;
-    	                os2rgb->bGreen = rgb->rgbGreen;
-    	                os2rgb++;
-    	                rgb++;
-    	        }
+        os2rgb                      = &pBmpColor->argbColor[0];
+        rgb                         = (RGBQUAD *)(pXorBits);
+
+        if(pXorBmp->bmBitsPixel <= 8) {
+            for(i=0;i<(1<<pXorBmp->bmBitsPixel);i++) {
+                    os2rgb->bRed   = rgb->rgbRed;
+                    os2rgb->bBlue  = rgb->rgbBlue;
+                    os2rgb->bGreen = rgb->rgbGreen;
+                    os2rgb++;
+                    rgb++;
+            }
     	}
 
@@ -329,4 +330,8 @@
                     src  += pXorBmp->bmWidthBytes;
                 }
+        }
+        else    
+        if(pXorBmp->bmBitsPixel == 16) {
+                ConvertRGB555to565(os2rgb, rgb, pXorBmp->bmHeight * pXorBmp->bmWidthBytes);
         }
         else    memcpy(os2rgb, rgb, pXorBmp->bmHeight * pXorBmp->bmWidthBytes);
Index: trunk/src/user32/winicon.cpp
===================================================================
--- trunk/src/user32/winicon.cpp	(revision 6594)
+++ trunk/src/user32/winicon.cpp	(revision 6595)
@@ -1,3 +1,3 @@
-/* $Id: winicon.cpp,v 1.28 2001-08-08 10:07:19 sandervl Exp $ */
+/* $Id: winicon.cpp,v 1.29 2001-08-26 14:23:35 sandervl Exp $ */
 /*
  * Win32 Icon Code for OS/2
@@ -101,4 +101,9 @@
 static ICONCACHE* CURSORICON_FindCache(HANDLE handle);
 
+static HGLOBAL CreateCursorIconIndirect( HINSTANCE hInstance,
+                                         CURSORICONINFO *info,
+                                         LPCVOID lpANDbits,
+                                         LPCVOID lpXORbits, BOOL fIcon);
+
 /***********************************************************************
  *           CreateIcon    (USER32.75)
@@ -122,5 +127,5 @@
     info.dwResGroupId = -1;
     info.hColorBmp = 0;
-    return CreateCursorIconIndirect(0, &info, lpANDbits, lpXORbits);
+    return CreateCursorIconIndirect(0, &info, lpANDbits, lpXORbits, TRUE);
 }
 /**********************************************************************
@@ -149,5 +154,5 @@
     BITMAP bmpXor,bmpAnd;
     HICON hObj;
-    int sizeXor,sizeAnd;
+    int sizeXor,sizeAnd,colortablesize;
 
     dprintf(("USER32: CreateIconIndirect %x", iconinfo));
@@ -156,5 +161,12 @@
     GetObjectA( iconinfo->hbmMask, sizeof(bmpAnd), &bmpAnd );
 
-    sizeXor = bmpXor.bmHeight * bmpXor.bmWidthBytes;
+    colortablesize = 0;
+
+    if(bmpXor.bmBitsPixel <= 8) {
+         colortablesize = sizeof(RGBQUAD)*(1<<bmpXor.bmBitsPixel);
+         sizeXor = bmpXor.bmHeight * bmpXor.bmWidthBytes + colortablesize;
+    }
+    else sizeXor = bmpXor.bmHeight * bmpXor.bmWidthBytes;
+
     sizeAnd = bmpAnd.bmHeight * bmpAnd.bmWidthBytes;
 
@@ -189,5 +201,32 @@
         /* Transfer the bitmap bits to the CURSORICONINFO structure */
         GetBitmapBits( iconinfo->hbmMask ,sizeAnd,(char*)(info + 1) );
-        GetBitmapBits( iconinfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd);
+        if(bmpXor.bmBitsPixel > 1)
+        {
+            BITMAPINFO* pInfo = (BITMAPINFO *)malloc(sizeof(BITMAPINFO)+colortablesize+3*sizeof(DWORD)); //+ extra space for > 8bpp images
+            HBITMAP oldbmp;
+            HDC     hdc;
+
+            hdc = CreateCompatibleDC(0);
+
+            memset(pInfo, 0, sizeof(BITMAPINFO)+colortablesize+3*sizeof(DWORD));
+            pInfo->bmiHeader.biSize     = sizeof(BITMAPINFOHEADER);
+            pInfo->bmiHeader.biPlanes   = info->bPlanes;
+            pInfo->bmiHeader.biBitCount = info->bBitsPerPixel;
+
+            GetDIBits(hdc, iconinfo->hbmColor, 0, bmpXor.bmHeight, (char *)(info + 1) + sizeAnd + colortablesize, pInfo, DIB_RGB_COLORS);
+            if(colortablesize) {
+                memcpy((char *)(info + 1) + sizeAnd, (char *)&pInfo->bmiHeader + pInfo->bmiHeader.biSize, colortablesize);
+            }
+
+            DeleteDC(hdc);
+            free(pInfo);
+        }
+        else {
+            GetBitmapBits( iconinfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd);
+        }
+
+#ifdef __WIN32OS2__
+        info->hColorBmp = OSLibWinCreatePointer(info, (char*)(info + 1), (LPBITMAP_W)&bmpAnd, (char*)(info + 1) + sizeAnd, (LPBITMAP_W)&bmpXor, FALSE);
+#endif
         GlobalUnlock(hObj);
 
@@ -200,4 +239,5 @@
         }
 #endif
+        dprintf(("USER32: CreateIconIndirect %x returned %x", iconinfo, hIcon));
         return hIcon;
     }
@@ -352,5 +392,5 @@
     info.hColorBmp     = 0;
 
-    return CreateCursorIconIndirect( 0, &info, lpANDbits, lpXORbits );
+    return CreateCursorIconIndirect( 0, &info, lpANDbits, lpXORbits, FALSE);
 }
 //******************************************************************************
@@ -520,12 +560,15 @@
  *           CreateCursorIconIndirect
  */
-HGLOBAL WIN32API CreateCursorIconIndirect( HINSTANCE hInstance,
-                                           CURSORICONINFO *info,
-                                           LPCVOID lpANDbits,
-                                           LPCVOID lpXORbits )
+static HGLOBAL CreateCursorIconIndirect( HINSTANCE hInstance,
+                                         CURSORICONINFO *info,
+                                         LPCVOID lpANDbits,
+                                         LPCVOID lpXORbits, BOOL fIcon)
 {
     HGLOBAL handle;
     char *ptr;
     int sizeAnd, sizeXor;
+#ifdef __WIN32OS2__
+    BITMAP bmpXor, bmpAnd;
+#endif
 
     if (!lpXORbits || !lpANDbits || info->bPlanes != 1) return 0;
@@ -540,4 +583,23 @@
     memcpy( ptr + sizeof(CURSORICONINFO), lpANDbits, sizeAnd );
     memcpy( ptr + sizeof(CURSORICONINFO) + sizeAnd, lpXORbits, sizeXor );
+#ifdef __WIN32OS2__
+    bmpAnd.bmType       = 0;
+    bmpAnd.bmWidth      = info->nWidth;
+    bmpAnd.bmHeight     = info->nHeight;
+    bmpAnd.bmWidthBytes = BITMAP_GetWidthBytes(info->nWidth, 1);
+    bmpAnd.bmPlanes     = info->bPlanes;
+    bmpAnd.bmBitsPixel  = 1;
+    bmpAnd.bmBits       = NULL;
+
+    bmpXor.bmType       = 0;
+    bmpXor.bmWidth      = info->nWidth;
+    bmpXor.bmHeight     = info->nHeight;
+    bmpXor.bmWidthBytes = info->nWidthBytes;
+    bmpXor.bmPlanes     = info->bPlanes;
+    bmpXor.bmBitsPixel  = info->bBitsPerPixel;
+    bmpXor.bmBits       = NULL;
+    ((CURSORICONINFO *)ptr)->hColorBmp = 
+          OSLibWinCreatePointer(info, (char *)lpANDbits, (LPBITMAP_W)&bmpAnd, (char *)lpXORbits, (LPBITMAP_W)&bmpXor, fIcon == FALSE);
+#endif
     GlobalUnlock( handle );
 
@@ -549,4 +611,5 @@
         return 0;
     }
+    dprintf(("USER32: CreateCursorIconIndirect returned %x", hIcon));
     return hIcon;
 #else
