Release 950606

Tue Jun  6 12:11:41 1995  Alexandre Julliard  (julliard@sunsite.unc.edu)

	* [controls/menu.c]
	Fixed bug with drawing multi-column menus with vertical separator.

	* [debugger/debug.l]
	Fixed NULL-pointer reference after readline().

	* [if1632/winprocs.spec] [miscemu/int21.c] [miscemu/interrupts.c]
	Added interrupt vector emulation. Allows to retrieve an interrupt
	vector and jump to it without crashing.

	* [loader/ldt.c]
	Moved ldt.c to memory directory.

	* [loader/task.c]
	Implemented LockCurrentTask() and GetInstanceData().

	* [objects/bitblt.c]
	Fixed a bug that caused StretchBlt() to use wrong colors when
	stretching a monochrome bitmap to a color display.

	* [objects/bitmap.c]
	Fixed a segmented pointer bug in CreateBitmapIndirect().

	* [tools/build.c]
	Added possibility to have arguments for register functions; used
	by interrupt vectors to remove the flags from the stack.
	Generate a new function CallTo32_LargeStack(), that allows calling
	a 32-bit function using the original 32-bit stack, for functions
	that need more that 64k of stack.

Tue May 30 10:29:56 1995  Martin von Loewis  <martin@informatik.hu-berlin.de>

	* [if1632/shell.spec] [misc/shell.c]
	DoEnvironmentSubst: fixed prototype

	* [if1632/gdi.spec] [objects/palette.c]
	SetSystemPaletteUse: new function

	* [if1632/kernel.spec] [loader/resource.c]
	DirectResAlloc: new function

	* [if1632/user.spec] [windows/keyboard.c]
	SetKeyboardState: new function

Mon May 29 12:58:28 1995   Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
        
	* [tools/build.c]
        Prevent interrupts from destroying the args for a 32 bit function
        by loading the correct value into %esp directly after %ss.

	* [loader/ne_image.c] [loader/module.c]
	The new instance must be created earlier in LoadModule(), so that
	fixups referencing it will be handled correctly.
        Initialize the local heap for a DGROUP in NE_LoadSegment().
	
	* [objects/dib.c]
	Like RLE8 bitmaps, RLE4 bitmaps don't always end with a proper code.
	This used to crash Wine. Fixed.

        * [objects/text.c]
	Fix possible null pointer dereference in debugging output.
	
	* [misc/commdlg.c]
	Handle user input in the edit control better. Some bugs fixed.
	
	* [memory/local.c]
	Started implementing moveable blocks. This is unfinished (!), but
	at least it does not seem to break things.

Wed May 24 13:26:36 1995   Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
        
	* [loader/module.c]
	LoadModule(): DLLs occasionally have a data segment, and they work
	much better if it is loaded :-)
	LoadLibrary(): pass HMODULE instead of HINSTANCE to NE_InitializeDLLs.
	FindModule(): also strip off the last backslash of the pathnames
	(Winhelp tried to load C:\WINDOWS\SYSTEM\COMMDLG.DLL).
	GetModuleHandle(): just call MODULE_FindModule, it does the same job,
	only better.
	
	* [loader/ne_image.c]
	LocalInit() the heap of a DLL in NE_InitDLL. (This is probably
	not really correct, it seems that all programs and DLLs try to do
	this themselves. But they pass weird parameters.)
	NE_InitializeDLLs should also call NE_InitDLL for the passed hModule.
	
	* [loader/task.c] [misc/user.c]
	Finish global initializations in InitTask instead of InitApp, or
	all the DLLs will be initialized in InitTask without any available
	window classes!
diff --git a/objects/bitmap.c b/objects/bitmap.c
index e394ccb..e0f15c4 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -2,15 +2,14 @@
  * GDI bitmap objects
  *
  * Copyright 1993 Alexandre Julliard
- *
-static char Copyright[] = "Copyright  Alexandre Julliard, 1993";
-*/
+ */
 #include <stdio.h>
 #include <stdlib.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include "gdi.h"
 #include "arch.h"
+#include "callback.h"
 #include "dc.h"
 #include "bitmap.h"
 #include "prototypes.h"
@@ -81,10 +80,43 @@
 HBITMAP CreateBitmap( short width, short height, 
 		      BYTE planes, BYTE bpp, LPSTR bits )
 {
-    BITMAP bitmap = { 0, width, height, 0, planes, bpp, bits };
-    dprintf_gdi(stddeb, "CreateBitmap: %dx%d, %d colors\n", 
-	     width, height, 1 << (planes*bpp) );
-    return CreateBitmapIndirect( &bitmap );
+    BITMAPOBJ * bmpObjPtr;
+    HBITMAP hbitmap;
+
+    dprintf_gdi( stddeb, "CreateBitmap: %dx%d, %d colors\n", 
+                 width, height, 1 << (planes*bpp) );
+
+      /* Check parameters */
+    if (!height || !width || planes != 1) return 0;
+    if ((bpp != 1) && (bpp != screenDepth)) return 0;
+    if (height < 0) height = -height;
+    if (width < 0) width = -width;
+
+      /* Create the BITMAPOBJ */
+    hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
+    if (!hbitmap) return 0;
+    bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LIN_ADDR( hbitmap );
+
+    bmpObjPtr->size.cx = 0;
+    bmpObjPtr->size.cy = 0;
+    bmpObjPtr->bitmap.bmType = 0;
+    bmpObjPtr->bitmap.bmWidth = width;
+    bmpObjPtr->bitmap.bmHeight = height;
+    bmpObjPtr->bitmap.bmPlanes = planes;
+    bmpObjPtr->bitmap.bmBitsPixel = bpp;
+    bmpObjPtr->bitmap.bmWidthBytes = (width * bpp + 15) / 16 * 2;
+    bmpObjPtr->bitmap.bmBits = NULL;
+
+      /* Create the pixmap */
+    bmpObjPtr->pixmap = XCreatePixmap(display, rootWindow, width, height, bpp);
+    if (!bmpObjPtr->pixmap)
+    {
+	GDI_HEAP_FREE( hbitmap );
+	hbitmap = 0;
+    }
+    else if (bits)  /* Set bitmap bits */
+	SetBitmapBits( hbitmap, height * bmpObjPtr->bitmap.bmWidthBytes, bits);
+    return hbitmap;
 }
 
 
@@ -106,43 +138,8 @@
  */
 HBITMAP CreateBitmapIndirect( BITMAP * bmp )
 {
-    BITMAPOBJ * bmpObjPtr;
-    HBITMAP hbitmap;
-
-      /* Check parameters */
-    if (!bmp->bmHeight || !bmp->bmWidth) return 0;
-    if (bmp->bmPlanes != 1) return 0;
-    if ((bmp->bmBitsPixel != 1) && (bmp->bmBitsPixel != screenDepth)) return 0;
-
-    if (bmp->bmHeight < 0)
-	bmp->bmHeight = -bmp->bmHeight;
-    
-    if (bmp->bmWidth < 0)
-	bmp->bmWidth = -bmp->bmWidth;
-    
-
-      /* Create the BITMAPOBJ */
-    hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
-    if (!hbitmap) return 0;
-    bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LIN_ADDR( hbitmap );
-
-    bmpObjPtr->size.cx = 0;
-    bmpObjPtr->size.cy = 0;
-    bmpObjPtr->bitmap  = *bmp;
-    bmpObjPtr->bitmap.bmBits = NULL;
-    bmpObjPtr->bitmap.bmWidthBytes = (bmp->bmWidth*bmp->bmBitsPixel+15)/16 * 2;
-
-      /* Create the pixmap */
-    bmpObjPtr->pixmap = XCreatePixmap( display, rootWindow, bmp->bmWidth,
-				       bmp->bmHeight, bmp->bmBitsPixel );
-    if (!bmpObjPtr->pixmap)
-    {
-	GDI_HEAP_FREE( hbitmap );
-	hbitmap = 0;
-    }
-    else if (bmp->bmBits)  /* Set bitmap bits */
-	SetBitmapBits( hbitmap, bmpObjPtr->bitmap.bmHeight*bmpObjPtr->bitmap.bmWidthBytes, bmp->bmBits );
-    return hbitmap;
+    return CreateBitmap( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
+                         bmp->bmBitsPixel, PTR_SEG_TO_LIN( bmp->bmBits ) );
 }
 
 
@@ -167,8 +164,9 @@
     if (!height) return 0;
     
     if (!(image = BITMAP_BmpToImage( &bmp->bitmap, buffer ))) return 0;
-    XGetSubImage( display, bmp->pixmap, 0, 0, bmp->bitmap.bmWidth, height,
-		  AllPlanes, ZPixmap, image, 0, 0 );
+    CallTo32_LargeStack( (int(*)())XGetSubImage, 11,
+                         display, bmp->pixmap, 0, 0, bmp->bitmap.bmWidth,
+                         height, AllPlanes, ZPixmap, image, 0, 0 );
     image->data = NULL;
     XDestroyImage( image );
     return height * bmp->bitmap.bmWidthBytes;
@@ -197,8 +195,9 @@
     if (!height) return 0;
     	
     if (!(image = BITMAP_BmpToImage( &bmp->bitmap, buffer ))) return 0;
-    XPutImage( display, bmp->pixmap, BITMAP_GC(bmp), image, 0, 0,
-	       0, 0, bmp->bitmap.bmWidth, height );
+    CallTo32_LargeStack( XPutImage, 10,
+                         display, bmp->pixmap, BITMAP_GC(bmp), image, 0, 0,
+                         0, 0, bmp->bitmap.bmWidth, height );
     image->data = NULL;
     XDestroyImage( image );
     return height * bmp->bitmap.bmWidthBytes;