Release 950319

Sun Mar 19 16:30:20 1995  Alexandre Julliard  (julliard@sunsite.unc.edu)

	* [*/*]
	Implemented a new memory mapping scheme. There's no longer a
	one-to-one mapping between 16-bit and 32-bit pointers. Please see
	file DEVELOPERS-HINTS for technical details.

	* [controls/scroll.c]
	Fixed bug when dragging mouse in horizontal scrollbars.

	* [tools/build.c] [if1632/*.spec]
	Removed support for C callback functions and for re-ordering
	of the 32-bit arguments, as these were never used. This should
	allow a more efficient callback scheme to be implemented.

	* [if1632/olecli.spec]
	Reduced the number of entries to make the 16-bit code fit in 64k.
	This limitation will soon be removed.

	* [loader/ldt.c]
	Rewrote LDT manipulation functions and implemented LDT_GetEntry().

	* [memory/global.c]
	Rewrote Global*() routines to use the new selector allocation
	mechanism.

	* [memory/local.c]
	Rewrote local heap handling to use a Windows-compatible layout
	(not really finished yet).
	Implemented TOOLHELP heap-walking routines.

	* [memory/selector.c]
	Implemented LDT manipulation API functions.

Tue Mar 14 19:50:28 EST 1995 William Magro (wmagro@tc.cornell.edu)

	* [windows/defdlg.c]
	Fixed problem where dialogs closed using the System menu 
        ('Close' item or double click on close box) would
	hang Wine.

Sun Mar 12 14:28:13 1995  Michael Patra <micky@marie.physik.TU-Berlin.DE>

	* [controls/listbox.c]
	Removed most of the statements for sending a notification message
	ListBoxDirectory(), DlgDirSelect(), DlgDirList(): Improved the
	code; Borland's standard file open dialog will work now.
	
	* [misc/main.c], [misc/file.c], [miscemu/int21.c]
	Added support for new command line option "-allowreadonly". If set
	an attempt to open a read only file in write mode will be converted 
	to opening it read only (many programs try to open all files in 
	read/write mode even if they only intend to read it - this might 
	cause a few under problems under an unix-like environment where most 
	files are read only for a "normal" user)

	* [loader/selector.c]
	GetMemoryReference(): Added support for __AHIncr and __AHShift

	* [misc/dos_fs.c]
	DOS_SimplifyPath(): This routine simplifies path names ( e.g., it
	will change "/usr///local/bin/../lib//a" to "/usr/local/lib/a" )
	match(): rewritten
	
	* [objects/text.c]
	TEXT_NextLine(): Removed a bug in the handling of LF's

	* [miscemu/int21.c]
	GetFileDateTime(): Fixed. SetFileDateTime() is still broken.

Sat Mar 11 19:46:19 1995  Martin von Loewis  <loewis@informatik.hu-berlin.de>

	* [controls/menu.c]
	ChangeMenu: defaults to MF_INSERT
	InsertMenu: allow insertion even if position is one after last item

	* [if1632/Imakefile] [if1632/compobj.spec] [if1632/relay.c]
	  [if1632/storage.spec] [include/dlls.h]
	Added stubs for STORAGE.DLL and COMPOBJ.DLL

	* [if1632/user.spec] [windows/message.c]
	InSendMessage: new function

	* [include/neexe.h][include/ne_image.c]
	NE_FixupSegment: fixed handling of additive records

	* [loader/selector.c]
	GetEntryDLLName: return NULL instead of pointer to DLL.0 if not found

	* [loader/signal.c]
	win_fault: Enter debugger on SIGFPE, too

Wed Mar  1 21:47:42 1995  Cameron Heide  (heide@ee.ualberta.ca)

        * [miscemu/int*.c]
        Various minor modifications to the clock tick counter,
        FindFirst/FindNext funcs, and DPB handling.
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index 340c95d..fff10ce 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -8,7 +8,6 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include "selectors.h"
 #include "gdi.h"
 #include "color.h"
 #include "bitmap.h"
@@ -21,7 +20,8 @@
 /* #define DEBUG_GDI */
 #include "debug.h"
 
-MDESC *GDI_Heap = NULL;
+LPSTR GDI_Heap = NULL;
+WORD GDI_HeapSel = 0;
 
 /* Object types for EnumObjects() */
 #define OBJ_PEN             1
@@ -162,20 +162,19 @@
 BOOL GDI_Init(void)
 {
     HPALETTE hpalette;
-    struct segment_descriptor_s * s;
 
 #ifndef WINELIB
-    /* Create GDI heap */
+      /* Create GDI heap */
 
-    s = (struct segment_descriptor_s *)GetNextSegment( 0, 0x10000 );
-    if (s == NULL) return FALSE;
-    HEAP_Init( &GDI_Heap, s->base_addr, GDI_HEAP_SIZE );
+    if (!(GDI_HeapSel = GlobalAlloc(GMEM_FIXED, GDI_HEAP_SIZE))) return FALSE;
+    GDI_Heap = GlobalLock( GDI_HeapSel );
+    LocalInit( GDI_HeapSel, 0, GDI_HEAP_SIZE-1 );
 #endif
     
       /* Create default palette */
 
     if (!(hpalette = COLOR_Init())) return FALSE;
-    StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *) GDI_HEAP_ADDR( hpalette );
+    StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( hpalette );
 
       /* Create default bitmap */
 
@@ -230,7 +229,7 @@
         
     for (handle = first; handle && (handle != obj); )
     {
-	GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_ADDR( handle );
+	GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
 	handle = header->hNext;
     }
     return handle;
@@ -244,9 +243,9 @@
 {
     static DWORD count = 0;
     GDIOBJHDR * obj;
-    HANDLE handle = GDI_HEAP_ALLOC( GMEM_MOVEABLE, size );
+    HANDLE handle = GDI_HEAP_ALLOC( size );
     if (!handle) return 0;
-    obj = (GDIOBJHDR *) GDI_HEAP_ADDR( handle );
+    obj = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
     obj->hNext   = 0;
     obj->wMagic  = magic;
     obj->dwCount = ++count;
@@ -267,7 +266,7 @@
       /* Can't free stock objects */
     if (handle >= FIRST_STOCK_HANDLE) return TRUE;
     
-    object = (GDIOBJHDR *) GDI_HEAP_ADDR( handle );
+    object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
     if (!object) return FALSE;
     object->wMagic = 0;  /* Mark it as invalid */
 
@@ -292,7 +291,7 @@
 	if (handle < FIRST_STOCK_HANDLE + NB_STOCK_OBJECTS)
 	    ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
     }
-    else ptr = (GDIOBJHDR *) GDI_HEAP_ADDR( handle );
+    else ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
     if (!ptr) return NULL;
     if (ptr->wMagic != magic) return NULL;
     return ptr;
@@ -306,7 +305,7 @@
 {
       /* Check if object is valid */
 
-    GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_ADDR( obj );
+    GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( obj );
     if (!header) return FALSE;
 
     dprintf_gdi(stddeb, "DeleteObject: %d\n", obj );
@@ -353,7 +352,7 @@
 	if (handle < FIRST_STOCK_HANDLE + NB_STOCK_OBJECTS)
 	    ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
     }
-    else ptr = (GDIOBJHDR *) GDI_HEAP_ADDR( handle );
+    else ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
     if (!ptr) return 0;
     
     switch(ptr->wMagic)
@@ -387,7 +386,7 @@
 	if (handle < FIRST_STOCK_HANDLE + NB_STOCK_OBJECTS)
 	    ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
     }
-    else ptr = (GDIOBJHDR *) GDI_HEAP_ADDR( handle );
+    else ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
     if (!ptr) return 0;
     
     dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -446,8 +445,8 @@
 			wMagic = PEN_MAGIC;
 			dprintf_gdi(stddeb,"EnumObjects(%04X, OBJ_PEN, %p, %p);\n", 
 									hDC, lpEnumFunc, lpData);
-			hLog = GDI_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LOGPEN));
-			lpLog = (LPSTR) GDI_HEAP_ADDR(hLog);
+			hLog = GDI_HEAP_ALLOC( sizeof(LOGPEN) );
+			lpLog = (LPSTR) GDI_HEAP_LIN_ADDR(hLog);
 			if (lpLog == NULL) {
 				fprintf(stderr,"EnumObjects // Unable to alloc LOGPEN struct !\n");
 				return 0;
@@ -457,8 +456,8 @@
 			wMagic = BRUSH_MAGIC;
 			dprintf_gdi(stddeb,"EnumObjects(%04X, OBJ_BRUSH, %p, %p);\n", 
 									hDC, lpEnumFunc, lpData);
-			hLog = GDI_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LOGBRUSH));
-			lpLog = (LPSTR) GDI_HEAP_ADDR(hLog);
+			hLog = GDI_HEAP_ALLOC( sizeof(LOGBRUSH) );
+			lpLog = (LPSTR) GDI_HEAP_LIN_ADDR(hLog);
 			if (lpLog == NULL) {
 				fprintf(stderr,"EnumObjects // Unable to alloc LOGBRUSH struct !\n");
 				return 0;
@@ -469,6 +468,7 @@
 						hDC, nObjType, lpEnumFunc, lpData);
 			return 0;
 		}
+#ifdef notdef  /* FIXME: stock object ptr won't work in callback */
 	dprintf_gdi(stddeb,"EnumObjects // Stock Objects first !\n");
 	for (i = 0; i < NB_STOCK_OBJECTS; i++) {
 		header = StockObjects[i];
@@ -491,7 +491,8 @@
 #ifdef WINELIB
 			nRet = (*lpEnumFunc)(lpLog, lpData);
 #else
-			nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLog,	2, (int)lpData);
+			nRet = CallBack16(lpEnumFunc, 4, 2,
+                                      GDI_HEAP_SEG_ADDR(hLog), 2, (int)lpData);
 #endif
 */
 			dprintf_gdi(stddeb,"EnumObjects // after CallBack16 !\n");
@@ -502,11 +503,13 @@
 				}
 			}
 		}
+#endif  /* notdef */
+
 	if (lpPenBrushList == NULL) return 0;
 	dprintf_gdi(stddeb,"EnumObjects // Now DC owned objects %p !\n", header);
 	for (lphObj = lpPenBrushList; *lphObj != 0; ) {
 		dprintf_gdi(stddeb,"EnumObjects // *lphObj=%04X\n", *lphObj);
-		header = (GDIOBJHDR *) GDI_HEAP_ADDR(*lphObj++);
+		header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR(*lphObj++);
 		if (header->wMagic == wMagic) {
 			dprintf_gdi(stddeb,"EnumObjects // DC_Obj lpLog=%p lpData=%p\n", lpLog, lpData);
 			if (header->wMagic == BRUSH_MAGIC) {
@@ -525,7 +528,8 @@
 #ifdef WINELIB
 			nRet = (*lpEnumFunc)(lpLog, lpData);
 #else
-			nRet = CallBack16(lpEnumFunc, 4, 2, (int)lpLog,	2, (int)lpData);
+			nRet = CallBack16(lpEnumFunc, 4, 2,
+                                      GDI_HEAP_SEG_ADDR(hLog), 2, (int)lpData);
 #endif
 */
 			nRet = 1;
@@ -549,7 +553,7 @@
 {
 	GDIOBJHDR *object;
 
-	object = (GDIOBJHDR *) GDI_HEAP_ADDR( handle );
+	object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
 	if (object)
 		return TRUE;
 	else