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/winpos.c b/windows/winpos.c
index 5f71349..b1f7139 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -603,9 +603,8 @@
     HANDLE hparams;
     LONG result;
 
-    if (!(hparams = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(*params) )))
-	return 0;
-    params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR( hparams );
+    if (!(hparams = USER_HEAP_ALLOC( sizeof(*params) ))) return 0;
+    params = (NCCALCSIZE_PARAMS *) USER_HEAP_LIN_ADDR( hparams );
     params->rgrc[0] = *newWindowRect;
     if (calcValidRect)
     {
@@ -613,7 +612,8 @@
 	params->rgrc[2] = *oldClientRect;
 	params->lppos = winpos;
     }
-    result = SendMessage( hwnd, WM_NCCALCSIZE, calcValidRect, (LONG)params);
+    result = SendMessage( hwnd, WM_NCCALCSIZE, calcValidRect,
+                          USER_HEAP_SEG_ADDR(hparams) );
     *newClientRect = params->rgrc[0];
     USER_HEAP_FREE( hparams );
     return result;
@@ -758,61 +758,71 @@
 
 
 /***********************************************************************
- *           WINPOS_InternalSetWindowPos
- *
- * Helper function for SetWindowPos.
+ *           SetWindowPos   (USER.232)
  */
-static BOOL WINPOS_InternalSetWindowPos( WINDOWPOS *winpos )
+BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y,
+		   INT cx, INT cy, WORD flags )
 {
-    HWND hwndAfter;
+    HLOCAL hWinPos;
+    WINDOWPOS *winpos;
     WND *wndPtr;
     RECT newWindowRect, newClientRect;
-    int flags, result;
-
-      /* Send WM_WINDOWPOSCHANGING message */
-
-    if (!(winpos->flags & SWP_NOSENDCHANGING))
-	SendMessage( winpos->hwnd, WM_WINDOWPOSCHANGING, 0, (LONG)winpos );
+    int result;
 
       /* Check window handle */
 
-    if (winpos->hwnd == GetDesktopWindow()) return FALSE;
-    if (!(wndPtr = WIN_FindWndPtr( winpos->hwnd ))) return FALSE;
+    if (hwnd == GetDesktopWindow()) return FALSE;
+    if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
 
       /* Check dimensions */
 
-    if (winpos->cx <= 0) winpos->cx = 1;
-    if (winpos->cy <= 0) winpos->cy = 1;
+    if (cx <= 0) cx = 1;
+    if (cy <= 0) cy = 1;
 
       /* Check flags */
 
-    if (winpos->hwnd == hwndActive)
-        winpos->flags |= SWP_NOACTIVATE;   /* Already active */
-    if ((wndPtr->rectWindow.right-wndPtr->rectWindow.left == winpos->cx) &&
-        (wndPtr->rectWindow.bottom-wndPtr->rectWindow.top == winpos->cy))
-        winpos->flags |= SWP_NOSIZE;    /* Already the right size */
-    if ((wndPtr->rectWindow.left == winpos->x) &&
-        (wndPtr->rectWindow.top == winpos->y))
-        winpos->flags |= SWP_NOMOVE;    /* Already the right position */
-    flags = winpos->flags;
+    if (hwnd == hwndActive) flags |= SWP_NOACTIVATE;   /* Already active */
+    if ((wndPtr->rectWindow.right - wndPtr->rectWindow.left == cx) &&
+        (wndPtr->rectWindow.bottom - wndPtr->rectWindow.top == cy))
+        flags |= SWP_NOSIZE;    /* Already the right size */
+    if ((wndPtr->rectWindow.left == x) && (wndPtr->rectWindow.top == y))
+        flags |= SWP_NOMOVE;    /* Already the right position */
 
-      /* Check hwndAfter */
+      /* Check hwndInsertAfter */
 
-    hwndAfter = winpos->hwndInsertAfter;
-    if (!(winpos->flags & (SWP_NOZORDER | SWP_NOACTIVATE)))
+    if (!(flags & (SWP_NOZORDER | SWP_NOACTIVATE)))
     {
 	  /* Ignore TOPMOST flags when activating a window */
           /* _and_ moving it in Z order. */
-	if ((hwndAfter == HWND_TOPMOST) || (hwndAfter == HWND_NOTOPMOST))
-	    hwndAfter = HWND_TOP;	
+	if ((hwndInsertAfter == HWND_TOPMOST) ||
+            (hwndInsertAfter == HWND_NOTOPMOST))
+	    hwndInsertAfter = HWND_TOP;	
     }
       /* TOPMOST not supported yet */
-    if ((hwndAfter == HWND_TOPMOST) || (hwndAfter == HWND_NOTOPMOST))
-	hwndAfter = HWND_TOP;
-      /* hwndAfter must be a sibling of the window */
-    if ((hwndAfter != HWND_TOP) && (hwndAfter != HWND_BOTTOM) &&
-	(GetParent(winpos->hwnd) != GetParent(hwndAfter))) return FALSE;
-    winpos->hwndInsertAfter = hwndAfter;
+    if ((hwndInsertAfter == HWND_TOPMOST) ||
+        (hwndInsertAfter == HWND_NOTOPMOST)) hwndInsertAfter = HWND_TOP;
+      /* hwndInsertAfter must be a sibling of the window */
+    if ((hwndInsertAfter != HWND_TOP) && (hwndInsertAfter != HWND_BOTTOM) &&
+	(GetParent(hwnd) != GetParent(hwndInsertAfter))) return FALSE;
+
+      /* Allocate the WINDOWPOS structure */
+
+    hWinPos = USER_HEAP_ALLOC( sizeof(WINDOWPOS) );
+    if (!hWinPos) return FALSE;
+    winpos = USER_HEAP_LIN_ADDR( hWinPos );
+    winpos->hwnd = hwnd;
+    winpos->hwndInsertAfter = hwndInsertAfter;
+    winpos->x = x;
+    winpos->y = y;
+    winpos->cx = cx;
+    winpos->cy = cy;
+    winpos->flags = flags;
+    
+      /* Send WM_WINDOWPOSCHANGING message */
+
+    if (!(flags & SWP_NOSENDCHANGING))
+	SendMessage( hwnd, WM_WINDOWPOSCHANGING, 0,
+                     USER_HEAP_SEG_ADDR(hWinPos) );
 
       /* Calculate new position and size */
 
@@ -839,9 +849,9 @@
         if (wndPtr->window)
         {
             WIN_UnlinkWindow( winpos->hwnd );
-            WIN_LinkWindow( winpos->hwnd, hwndAfter );
+            WIN_LinkWindow( winpos->hwnd, hwndInsertAfter );
         }
-        else WINPOS_MoveWindowZOrder( winpos->hwnd, hwndAfter );
+        else WINPOS_MoveWindowZOrder( winpos->hwnd, hwndInsertAfter );
     }
 
       /* Send WM_NCCALCSIZE message to get new client area */
@@ -952,7 +962,10 @@
       /* And last, send the WM_WINDOWPOSCHANGED message */
 
     if (!(winpos->flags & SWP_NOSENDCHANGING))
-        SendMessage( winpos->hwnd, WM_WINDOWPOSCHANGED, 0, (LONG)winpos );
+        SendMessage( winpos->hwnd, WM_WINDOWPOSCHANGED, 0,
+                     USER_HEAP_SEG_ADDR(hWinPos) );
+
+    USER_HEAP_FREE( hWinPos );
     return TRUE;
 }
 
@@ -966,10 +979,9 @@
     DWP *pDWP;
 
     if (count <= 0) return 0;
-    handle = USER_HEAP_ALLOC( GMEM_MOVEABLE,
-                              sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
+    handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
     if (!handle) return 0;
-    pDWP = (DWP *) USER_HEAP_ADDR( handle );
+    pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle );
     pDWP->actualCount    = 0;
     pDWP->suggestedCount = count;
     pDWP->valid          = TRUE;
@@ -989,7 +1001,7 @@
     int i;
     HDWP newhdwp = hdwp;
 
-    pDWP = (DWP *) USER_HEAP_ADDR( hdwp );
+    pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
     if (!pDWP) return 0;
 
       /* All the windows of a DeferWindowPos() must have the same parent */
@@ -1032,9 +1044,9 @@
     if (pDWP->actualCount >= pDWP->suggestedCount)
     {
         newhdwp = USER_HEAP_REALLOC( hdwp,
-                      sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS), 0);
+                      sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS) );
         if (!newhdwp) return 0;
-        pDWP = (DWP *) USER_HEAP_ADDR( newhdwp );
+        pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp );
         pDWP->suggestedCount++;
     }
     pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
@@ -1055,14 +1067,17 @@
 BOOL EndDeferWindowPos( HDWP hdwp )
 {
     DWP *pDWP;
+    WINDOWPOS *winpos;
     BOOL res = TRUE;
     int i;
 
-    pDWP = (DWP *) USER_HEAP_ADDR( hdwp );
+    pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
     if (!pDWP) return FALSE;
-    for (i = 0; i < pDWP->actualCount; i++)
+    for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
     {
-        if (!(res = WINPOS_InternalSetWindowPos( &pDWP->winPos[i] ))) break;
+        if (!(res = SetWindowPos( winpos->hwnd, winpos->hwndInsertAfter,
+                                  winpos->x, winpos->y, winpos->cx, winpos->cy,
+                                  winpos->flags ))) break;
     }
     USER_HEAP_FREE( hdwp );
     return res;
@@ -1070,22 +1085,6 @@
 
 
 /***********************************************************************
- *           SetWindowPos   (USER.232)
- */
-BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y,
-		   INT cx, INT cy, WORD flags )
-{
-    HDWP hdwp;
-
-    dprintf_win(stddeb, "SetWindowPos: %04X %d %d,%d %dx%d 0x%x\n",
-            hwnd, hwndInsertAfter, x, y, cx, cy, flags );
-    if (!(hdwp = BeginDeferWindowPos( 1 ))) return FALSE;
-    if (!(hdwp = DeferWindowPos( hdwp, hwnd, hwndInsertAfter,
-                                 x, y, cx, cy, flags ))) return FALSE;
-    return EndDeferWindowPos( hdwp );
-}
-
-/***********************************************************************
  *           TileChildWindows   (USER.199)
  */
 void TileChildWindows( HWND parent, WORD action )