Commit in reactos/lib/user32/windows on MAIN
cursor.c+53-191.22 -> 1.23
icon.c+89-981.23 -> 1.24
message.c+8-31.48 -> 1.49
+150-120
3 modified files
- Reimplementation of CreateCursor (now the correct way).
- Various small fixes in the cursors/icon implementation.
- Print the message about InSendMessage being unimplemented only once (per process).

reactos/lib/user32/windows
cursor.c 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- cursor.c	15 Aug 2004 21:36:29 -0000	1.22
+++ cursor.c	30 Dec 2004 02:32:26 -0000	1.23
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: cursor.c,v 1.22 2004/08/15 21:36:29 chorns Exp $
+/* $Id: cursor.c,v 1.23 2004/12/30 02:32:26 navaraf Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/cursor.c
@@ -78,7 +78,6 @@
   return (HCURSOR)0;
 }
 
-
 /*
  * @implemented
  */
@@ -91,24 +90,59 @@
 	     CONST VOID *pvANDPlane,
 	     CONST VOID *pvXORPlane)
 {
-  ICONINFO IconInfo;
-
-  IconInfo.fIcon = FALSE;
-  IconInfo.xHotspot = xHotSpot;
-  IconInfo.yHotspot = yHotSpot;
-  IconInfo.hbmMask = CreateBitmap(nWidth, nHeight, 1, 1, pvANDPlane);
-  if(!IconInfo.hbmMask)
-  {
-    return (HICON)0;
-  }
-  IconInfo.hbmColor = CreateBitmap(nWidth, nHeight, 1, 1, pvXORPlane);
-  if(!IconInfo.hbmColor)
-  {
-    DeleteObject(IconInfo.hbmMask);
-    return (HICON)0;
-  }
+   ICONINFO IconInfo;
+   BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
+   BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
+   HDC hScreenDc;
+
+   hScreenDc = CreateCompatibleDC(NULL);
+   if (hScreenDc == NULL)
+      return NULL;
+
+   bwBIH->bmiHeader.biBitCount = 1;
+   bwBIH->bmiHeader.biWidth = nWidth;
+   bwBIH->bmiHeader.biHeight = -nHeight * 2;
+   bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+   bwBIH->bmiHeader.biPlanes = 1;
+   bwBIH->bmiHeader.biSizeImage = 0;
+   bwBIH->bmiHeader.biCompression = BI_RGB;
+   bwBIH->bmiHeader.biClrImportant = 0;
+   bwBIH->bmiHeader.biClrUsed = 0;
+   bwBIH->bmiHeader.biXPelsPerMeter = 0;
+   bwBIH->bmiHeader.biYPelsPerMeter = 0;
+
+   bwBIH->bmiColors[0].rgbBlue = 0;
+   bwBIH->bmiColors[0].rgbGreen = 0;
+   bwBIH->bmiColors[0].rgbRed = 0;
+   bwBIH->bmiColors[0].rgbReserved = 0;
+
+   bwBIH->bmiColors[1].rgbBlue = 0xff;
+   bwBIH->bmiColors[1].rgbGreen = 0xff;
+   bwBIH->bmiColors[1].rgbRed = 0xff;
+   bwBIH->bmiColors[1].rgbReserved = 0;
+
+   IconInfo.hbmMask = CreateDIBitmap(hScreenDc, &bwBIH->bmiHeader, 0,
+                                     NULL, bwBIH, DIB_RGB_COLORS);
+   if (IconInfo.hbmMask)
+   {   
+      SetDIBits(hScreenDc, IconInfo.hbmMask, 0, nHeight, 
+                pvXORPlane, bwBIH, DIB_RGB_COLORS);
+      SetDIBits(hScreenDc, IconInfo.hbmMask, nHeight, nHeight, 
+                pvANDPlane, bwBIH, DIB_RGB_COLORS);
+   }
+   else
+   {
+      return NULL;
+   }
+
+   DeleteDC(hScreenDc);
+
+   IconInfo.fIcon = FALSE;
+   IconInfo.xHotspot = xHotSpot;
+   IconInfo.yHotspot = yHotSpot;
+   IconInfo.hbmColor = 0;
   
-  return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
+   return (HCURSOR)NtUserCreateCursorIconHandle(&IconInfo, FALSE);
 }
 
 

reactos/lib/user32/windows
icon.c 1.23 -> 1.24
diff -u -r1.23 -r1.24
--- icon.c	5 Oct 2004 22:08:56 -0000	1.23
+++ icon.c	30 Dec 2004 02:32:26 -0000	1.24
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: icon.c,v 1.23 2004/10/05 22:08:56 gvg Exp $
+/* $Id: icon.c,v 1.24 2004/12/30 02:32:26 navaraf Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/icon.c
@@ -38,116 +38,107 @@
 HICON
 ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
 {
-  BITMAPINFO* bwBIH;
-  ICONINFO IconInfo;
+   BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
+   BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
+   ICONINFO IconInfo;
+
+   IconInfo.fIcon = TRUE;
+   IconInfo.xHotspot = xHotspot;
+   IconInfo.yHotspot = yHotspot;
+
+   /* Load the XOR bitmap */
+   IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT,
+                                      ImageData, (BITMAPINFO*)IconImage,
+                                      DIB_RGB_COLORS);
 
-  IconInfo.fIcon = TRUE;
-  IconInfo.xHotspot = xHotspot;
-  IconInfo.yHotspot = yHotspot;
-  
-  /* Load the XOR bitmap */
-  IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT,
-			             ImageData, (BITMAPINFO*)IconImage, DIB_RGB_COLORS);
-
-  /* make ImageData point to the start of the AND image data */
-  ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth * 
+   /* Make ImageData point to the start of the AND image data. */
+   ImageData = ((PBYTE)ImageData) + (((IconImage->icHeader.biWidth * 
                                       IconImage->icHeader.biBitCount + 31) & ~31) >> 3) * 
                                       (IconImage->icHeader.biHeight );
 
-  /* create a BITMAPINFO header for the monocrome part of the icon */
-  bwBIH = RtlAllocateHeap(GetProcessHeap(), 0, sizeof (BITMAPINFOHEADER)+2*sizeof(RGBQUAD));
-
-  bwBIH->bmiHeader.biBitCount = 1;
-  bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
-  bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
-  bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-  bwBIH->bmiHeader.biPlanes = 1;
-  bwBIH->bmiHeader.biSizeImage = (((IconImage->icHeader.biWidth * 1 + 31) & ~31) >> 3) * 
-                                    (IconImage->icHeader.biHeight );
-  bwBIH->bmiHeader.biCompression = BI_RGB;
-  bwBIH->bmiHeader.biClrImportant = 0;
-  bwBIH->bmiHeader.biClrUsed = 0;
-  bwBIH->bmiHeader.biXPelsPerMeter = 0;
-  bwBIH->bmiHeader.biYPelsPerMeter = 0;
-
-  bwBIH->bmiColors[0].rgbBlue = 0;
-  bwBIH->bmiColors[0].rgbGreen = 0;
-  bwBIH->bmiColors[0].rgbRed = 0;
-  bwBIH->bmiColors[0].rgbReserved = 0;
-
-  bwBIH->bmiColors[1].rgbBlue = 0xff;
-  bwBIH->bmiColors[1].rgbGreen = 0xff;
-  bwBIH->bmiColors[1].rgbRed = 0xff;
-  bwBIH->bmiColors[1].rgbReserved = 0;
-
-  /* load the AND bitmap */
-  IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
-                                    ImageData, bwBIH, DIB_RGB_COLORS);
+   /* Create a BITMAPINFO header for the monocrome part of the icon. */
+   bwBIH->bmiHeader.biBitCount = 1;
+   bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
+   bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
+   bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+   bwBIH->bmiHeader.biPlanes = 1;
+   bwBIH->bmiHeader.biSizeImage = 0;
+   bwBIH->bmiHeader.biCompression = BI_RGB;
+   bwBIH->bmiHeader.biClrImportant = 0;
+   bwBIH->bmiHeader.biClrUsed = 0;
+   bwBIH->bmiHeader.biXPelsPerMeter = 0;
+   bwBIH->bmiHeader.biYPelsPerMeter = 0;
+
+   bwBIH->bmiColors[0].rgbBlue = 0;
+   bwBIH->bmiColors[0].rgbGreen = 0;
+   bwBIH->bmiColors[0].rgbRed = 0;
+   bwBIH->bmiColors[0].rgbReserved = 0;
+
+   bwBIH->bmiColors[1].rgbBlue = 0xff;
+   bwBIH->bmiColors[1].rgbGreen = 0xff;
+   bwBIH->bmiColors[1].rgbRed = 0xff;
+   bwBIH->bmiColors[1].rgbReserved = 0;
+
+   /* Load the AND bitmap. */
+   IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
+                                     ImageData, bwBIH, DIB_RGB_COLORS);
   
-  SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight, 
-            ImageData, bwBIH, DIB_RGB_COLORS);
+   SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
+             ImageData, bwBIH, DIB_RGB_COLORS);
   
-  RtlFreeHeap(GetProcessHeap(), 0, bwBIH);
-  
-  /* Create the icon based on everything we have so far */
-  return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
+   /* Create the icon based on everything we have so far */
+   return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
 }
 
 HICON
 ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
 {
-  /* FIXME - color cursors */
-  BITMAPINFO* bwBIH;
-  ICONINFO IconInfo;
-  PVOID XORImageData = ImageData;
-
-  IconInfo.fIcon = TRUE;
-  IconInfo.xHotspot = xHotspot;
-  IconInfo.yHotspot = yHotspot;
-  
-  /* create a BITMAPINFO header for the monocrome part of the icon */
-  bwBIH = RtlAllocateHeap(GetProcessHeap(), 0, sizeof (BITMAPINFOHEADER)+2*sizeof(RGBQUAD));
-
-  bwBIH->bmiHeader.biBitCount = 1;
-  bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
-  bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
-  bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-  bwBIH->bmiHeader.biPlanes = 1;
-  bwBIH->bmiHeader.biSizeImage = (((IconImage->icHeader.biWidth * 1 + 31) & ~31) >> 3) * 
-                                    (IconImage->icHeader.biHeight );
-  bwBIH->bmiHeader.biCompression = BI_RGB;
-  bwBIH->bmiHeader.biClrImportant = 0;
-  bwBIH->bmiHeader.biClrUsed = 0;
-  bwBIH->bmiHeader.biXPelsPerMeter = 0;
-  bwBIH->bmiHeader.biYPelsPerMeter = 0;
-
-  bwBIH->bmiColors[0].rgbBlue = 0;
-  bwBIH->bmiColors[0].rgbGreen = 0;
-  bwBIH->bmiColors[0].rgbRed = 0;
-  bwBIH->bmiColors[0].rgbReserved = 0;
-
-  bwBIH->bmiColors[1].rgbBlue = 0xff;
-  bwBIH->bmiColors[1].rgbGreen = 0xff;
-  bwBIH->bmiColors[1].rgbRed = 0xff;
-  bwBIH->bmiColors[1].rgbReserved = 0;
-
-  /* load the AND bitmap */
-  IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
-                                    XORImageData, bwBIH, DIB_RGB_COLORS);
-  
-  if(IconInfo.hbmMask)
-  {
-    SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight, 
-              XORImageData, bwBIH, DIB_RGB_COLORS);
-
-  }
-  
-  IconInfo.hbmColor = (HBITMAP)0;
+   /* FIXME - color cursors */
+   BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
+   BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
+   ICONINFO IconInfo;
+   PVOID XORImageData = ImageData;
+
+   IconInfo.fIcon = FALSE;
+   IconInfo.xHotspot = xHotspot;
+   IconInfo.yHotspot = yHotspot;
+  
+   /* Create a BITMAPINFO header for the monocrome part of the icon */
+   bwBIH->bmiHeader.biBitCount = 1;
+   bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
+   bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
+   bwBIH->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+   bwBIH->bmiHeader.biPlanes = 1;
+   bwBIH->bmiHeader.biSizeImage = 0;
+   bwBIH->bmiHeader.biCompression = BI_RGB;
+   bwBIH->bmiHeader.biClrImportant = 0;
+   bwBIH->bmiHeader.biClrUsed = 0;
+   bwBIH->bmiHeader.biXPelsPerMeter = 0;
+   bwBIH->bmiHeader.biYPelsPerMeter = 0;
+
+   bwBIH->bmiColors[0].rgbBlue = 0;
+   bwBIH->bmiColors[0].rgbGreen = 0;
+   bwBIH->bmiColors[0].rgbRed = 0;
+   bwBIH->bmiColors[0].rgbReserved = 0;
+
+   bwBIH->bmiColors[1].rgbBlue = 0xff;
+   bwBIH->bmiColors[1].rgbGreen = 0xff;
+   bwBIH->bmiColors[1].rgbRed = 0xff;
+   bwBIH->bmiColors[1].rgbReserved = 0;
+
+   /* Load the AND bitmap */
+   IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0,
+                                     XORImageData, bwBIH, DIB_RGB_COLORS);
+   if (IconInfo.hbmMask)
+   {
+      SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight, 
+                XORImageData, bwBIH, DIB_RGB_COLORS);
+   }
   
-  RtlFreeHeap(GetProcessHeap(), 0, bwBIH);
+   IconInfo.hbmColor = (HBITMAP)0;
   
-  /* Create the icon based on everything we have so far */
-  return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
+   /* Create the icon based on everything we have so far */
+   return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
 }
 
 

reactos/lib/user32/windows
message.c 1.48 -> 1.49
diff -u -r1.48 -r1.49
--- message.c	27 Dec 2004 16:48:29 -0000	1.48
+++ message.c	30 Dec 2004 02:32:26 -0000	1.49
@@ -1,4 +1,4 @@
-/* $Id: message.c,v 1.48 2004/12/27 16:48:29 navaraf Exp $
+/* $Id: message.c,v 1.49 2004/12/30 02:32:26 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -882,8 +882,13 @@
 STDCALL
 InSendMessage(VOID)
 {
+  static DWORD ShowNotImplemented = TRUE;
+  if (ShowNotImplemented)
+    {
+      DbgPrint("InSendMessage is unimplemented\n");
+      ShowNotImplemented = FALSE;
+    }
   /* return(NtUserGetThreadState(THREADSTATE_INSENDMESSAGE) != ISMEX_NOSEND); */
-  UNIMPLEMENTED;
   return FALSE;
 }
 
@@ -1919,7 +1924,7 @@
 	if(!gfMessagePumpHook)
 		return FALSE;
 	
-    /* This code checks for WOW16. */
+    /* This code checks if we're inside SendMessage. */
 #if 0
 	/* Since our TEB doesnt match that of real windows, testing this value is useless until we know what it does
 	PUCHAR NtTeb = (PUCHAR)NtCurrentTeb();
CVSspam 0.2.8