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/windows/dialog.c b/windows/dialog.c
index ead08ba..479592f 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -12,9 +12,9 @@
 #include "windows.h"
 #include "dialog.h"
 #include "win.h"
+#include "ldt.h"
 #include "user.h"
 #include "message.h"
-#include "heap.h"
 #include "stddebug.h"
 /* #define DEBUG_DIALOG */
 #include "debug.h"
@@ -173,7 +173,7 @@
 /***********************************************************************
  *           CreateDialog   (USER.89)
  */
-HWND CreateDialog( HINSTANCE hInst, LPCSTR dlgTemplate,
+HWND CreateDialog( HINSTANCE hInst, SEGPTR dlgTemplate,
 		   HWND owner, WNDPROC dlgProc )
 {
     return CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, 0 );
@@ -183,14 +183,14 @@
 /***********************************************************************
  *           CreateDialogParam   (USER.241)
  */
-HWND CreateDialogParam( HINSTANCE hInst, LPCSTR dlgTemplate,
+HWND CreateDialogParam( HINSTANCE hInst, SEGPTR dlgTemplate,
 		        HWND owner, WNDPROC dlgProc, LPARAM param )
 {
     HWND hwnd = 0;
     HANDLE hres, hmem;
     LPCSTR data;
 
-    dprintf_dialog(stddeb, "CreateDialogParam: %d,'%p',%d,%p,%ld\n",
+    dprintf_dialog(stddeb, "CreateDialogParam: %d,%08lx,%d,%p,%ld\n",
 	    hInst, dlgTemplate, owner, dlgProc, param );
      
       /* FIXME: MAKEINTRESOURCE should be replaced by RT_DIALOG */
@@ -251,7 +251,13 @@
 						   256*template.menuName[2] ));
 	  break;
       default:
-	  hMenu = LoadMenu( hInst, template.menuName );
+          {
+                /* Need to copy the menu name to a 16-bit area */
+              HANDLE handle = USER_HEAP_ALLOC( strlen(template.menuName)+1 );
+              strcpy( USER_HEAP_LIN_ADDR( handle ), template.menuName );
+              hMenu = LoadMenu( hInst, USER_HEAP_SEG_ADDR( handle ) );
+              USER_HEAP_FREE( handle );
+          }
 	  break;
     }
 
@@ -297,8 +303,7 @@
 			   rect.left + template.header->x * xUnit / 4,
 			   rect.top + template.header->y * yUnit / 8,
 			   rect.right - rect.left, rect.bottom - rect.top,
-			   owner, hMenu, hInst,
-			   NULL );
+			   owner, hMenu, hInst, (SEGPTR)0 );
     if (!hwnd)
     {
 	if (hFont) DeleteObject( hFont );
@@ -339,14 +344,14 @@
 		    fprintf(stderr,"CreateDialogIndirectParam: Insufficient memory to create heap for edit control\n");
 		    continue;
 		}
-		HEAP_LocalInit(dlgInfo->hDialogHeap, GlobalLock(dlgInfo->hDialogHeap), 0x10000);
+		LocalInit(dlgInfo->hDialogHeap, 0, 0xffff);
 	    }
 	    header->style |= WS_CHILD;
 	    hwndCtrl = CreateWindowEx( WS_EX_NOPARENTNOTIFY, 
                            class, text, header->style,
                            header->x * xUnit / 4, header->y * yUnit / 8,
                            header->cx * xUnit / 4, header->cy * yUnit / 8,
-                           hwnd, header->id, dlgInfo->hDialogHeap, NULL );
+                           hwnd, header->id, dlgInfo->hDialogHeap, (SEGPTR)0 );
 	}
 	else
         {
@@ -355,7 +360,7 @@
                                 class, text, header->style,
                                 header->x * xUnit / 4, header->y * yUnit / 8,
                                 header->cx * xUnit / 4, header->cy * yUnit / 8,
-                                hwnd, header->id, hInst, NULL );
+                                hwnd, header->id, hInst, (SEGPTR)0 );
 	}
         /* Make the control last one in Z-order, so that controls remain
            in the order in which they were created */
@@ -412,13 +417,13 @@
       /* Owner must be a top-level window */
     while (owner && GetParent(owner)) owner = GetParent(owner);
     if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return -1;
-    if (!(msgHandle = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(MSG)))) return -1;
-    lpmsg = (MSG *) USER_HEAP_ADDR( msgHandle );
+    if (!(msgHandle = USER_HEAP_ALLOC( sizeof(MSG) ))) return -1;
+    lpmsg = (MSG *) USER_HEAP_LIN_ADDR( msgHandle );
     dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
     EnableWindow( owner, FALSE );
     ShowWindow( hwnd, SW_SHOW );
 
-    while (MSG_InternalGetMessage( lpmsg, hwnd, owner,
+    while (MSG_InternalGetMessage( USER_HEAP_SEG_ADDR(msgHandle), hwnd, owner,
                                    MSGF_DIALOGBOX, PM_REMOVE,
                                    !(wndPtr->dwStyle & DS_NOIDLEMSG) ))
     {
@@ -440,7 +445,7 @@
 /***********************************************************************
  *           DialogBox   (USER.87)
  */
-int DialogBox( HINSTANCE hInst, LPCSTR dlgTemplate,
+int DialogBox( HINSTANCE hInst, SEGPTR dlgTemplate,
 	       HWND owner, WNDPROC dlgProc )
 {
     return DialogBoxParam( hInst, dlgTemplate, owner, dlgProc, 0 );
@@ -450,12 +455,12 @@
 /***********************************************************************
  *           DialogBoxParam   (USER.239)
  */
-int DialogBoxParam( HINSTANCE hInst, LPCSTR dlgTemplate,
+int DialogBoxParam( HINSTANCE hInst, SEGPTR dlgTemplate,
 		    HWND owner, WNDPROC dlgProc, LPARAM param )
 {
     HWND hwnd;
     
-    dprintf_dialog(stddeb, "DialogBoxParam: %d,'%p',%d,%p,%ld\n",
+    dprintf_dialog(stddeb, "DialogBoxParam: %d,%08lx,%d,%p,%ld\n",
 	    hInst, dlgTemplate, owner, dlgProc, param );
     hwnd = CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, param );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
@@ -666,7 +671,7 @@
 /*******************************************************************
  *           SetDlgItemText   (USER.92)
  */
-void SetDlgItemText( HWND hwnd, WORD id, LPSTR lpString )
+void SetDlgItemText( HWND hwnd, WORD id, SEGPTR lpString )
 {
     SendDlgItemMessage( hwnd, id, WM_SETTEXT, 0, (DWORD)lpString );
 }
@@ -675,7 +680,7 @@
 /***********************************************************************
  *           GetDlgItemText   (USER.93)
  */
-int GetDlgItemText( HWND hwnd, WORD id, LPSTR str, WORD max )
+int GetDlgItemText( HWND hwnd, WORD id, SEGPTR str, WORD max )
 {
     return (int)SendDlgItemMessage( hwnd, id, WM_GETTEXT, max, (DWORD)str );
 }
@@ -686,12 +691,13 @@
  */
 void SetDlgItemInt( HWND hwnd, WORD id, WORD value, BOOL fSigned )
 {
-    HANDLE hText = USER_HEAP_ALLOC(0, 10 );
-    char * str = (char *) USER_HEAP_ADDR( hText );
+    HANDLE hText = USER_HEAP_ALLOC( 10 );
+    char * str = (char *) USER_HEAP_LIN_ADDR( hText );
 
     if (fSigned) sprintf( str, "%d", value );
     else sprintf( str, "%u", value );
-    SendDlgItemMessage( hwnd, id, WM_SETTEXT, 0, (DWORD)str );
+    SendDlgItemMessage( hwnd, id, WM_SETTEXT, 0,
+                        USER_HEAP_SEG_ADDR(hText) );
     USER_HEAP_FREE( hText );
 }
 
@@ -709,10 +715,10 @@
     if (translated) *translated = FALSE;
     if (!(len = SendDlgItemMessage( hwnd, id, WM_GETTEXTLENGTH, 0, 0 )))
 	return 0;
-    if (!(hText = USER_HEAP_ALLOC(0, len+1 )))
-	return 0;
-    str = (char *) USER_HEAP_ADDR( hText );
-    if (SendDlgItemMessage( hwnd, id, WM_GETTEXT, len+1, (DWORD)str ))
+    if (!(hText = USER_HEAP_ALLOC( len+1 ))) return 0;
+    str = (char *) USER_HEAP_LIN_ADDR( hText );
+    if (SendDlgItemMessage( hwnd, id, WM_GETTEXT, len+1,
+                            USER_HEAP_SEG_ADDR(hText) ))
     {
 	char * endptr;
 	result = strtol( str, &endptr, 10 );