Release 980726

Sat Jul 25 19:45:45 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [include/shlobj.h][misc/shell.c][misc/shellord.c][ole/folders.c]
	[shell32.spec]
	Added SHFILEOPSTRUCT32[A|W] and constants, prototypes.
	Implemented SHGetSpecialFolderLocation, SHGetPathFromIDList32[A].
	Many IShellFolder, pidl, shell -related changes.

	SHChangeNotifyRegister, SHChangeNotifyDeregister,
	SHShellFolderView_Message, SHMapPIDLToSystemImageListIndex,
	SHAddToRecentDocs32, SHFileOperation, SHChangeNotify, 
	SHCreateShellFolderViewEx stubs.

Sat Jul 25 17:16:25 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [files/profile.c]
	Fix return value of PROFILE_GetSection().

Fri Jul 24 22:45:19 1998  Ove Kaaven <ovek@isflak.arcticnet.no>

	* [controls/edit.c]
	Killed the modified flag on WM_SETTEXT. Eudora should no longer
	bother asking whether you want to save an unchanged message.

Fri Jul 24 21:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [controls/menu.c]
	Fixed bug in GetMenuState32.
	Doesn't fix Free Agent 32 :((

	* [documentation/debugging]
	Hints added.

	* [files/dos_fs.c] [include/msdos.h] [msdos/int21.c]
	Enhanced DOS device support.

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/rasapi16.spec]
	  [relay32/Makefile.in] [relay32/builtin32.c] [relay32/rasapi32.spec]
	Added RASAPI16/32.DLL.

	* [misc/aspi.c] [relay32/wnaspi32.spec]
	Implemented GetASPI32SupportInfo.

	* [multimedia/mmsystem.c]
	Implemented mmTaskCreate.

Fri Jul 24 20:55:31 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/toolbar.c]
	Fixed some bugs and added new features.

	* [controls/tooltips.c][include/tooltips.h]
	Added more messages and started display code.

	* [misc/shell.c][misc/shellord.c][relay32/shell.spec]
	Fixed StrToOleStrN (SHELL32_79) and added OleStrToStrN (SHELL32_78).
	Added some new stubs.

	* [objects/cursoricon.c][misc/imagelist.c][include/windows.h]
	Fixed GetIconInfo and removed the GetIconInfo hack from the
	image list code.

	* [controls/pager.c][include/pager.h][controls/treeview.c]
	  [include/treeview.h]
	Added some messages.

	* [misc/tweak.c][winows/nonclient.c][documentation/win95look]
	Removed unused tweak variables.

	* [documentation/common_controls]
	Updated.

Fri Jul 24 18:36:32 1998  James Moody <013263m@dragon.acadiau.ca>

	* [objects/font.c]
	Fixed a bug in GetTextFace.

Fri Jul 24 17:09:33 1998  Marcus Meissner <marcus@jet.franken.de>

	* [misc/commdlg.c]
	Fixed stacksmashing bug due to invalid specified function
	pointers.

	* [files/dos_fs.c]
	Small change in case handling... be able to create files with
	uppercase in them (like Program Files/).

	* [graphics/ddraw.c]
	XF86DGA support made threadsafe, added more Xlib dependent stuff
	(create Window using CreateWindow(), draw into it). xlib support
	is not satisfying.

	* [scheduler/critsection.c]
	Don't recurse on HeapLock with semaphore id 0.

	* [win32/user32.c][windows/message.c][windows/event.c]
	Moved win32 *Message functions where they belong.
	Removed some potential races between XPending and XNextEvent by
	a bit more locking.

Fri Jul 24 13:58:19 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [loader/pe_image.c] [loader/ne/segment.c]
	Use bogus pointer value instead of NULL for unresolved externals.

	* [memory/selector.c]
	Clear saved_fs on selector free.

	* [msdos/cdrom.c] [configure.in]
	Added check for linux/ucdrom.h.

	* [scheduler/client.c] [server/socket.c]
	Fix for missing struct cmsghdr.
	Attempt to support msg_accrights fd passing (completely untested).

	* [windows/event.c]
	Do not grab the pointer in SetCapture (Win32 behavior).

Tue Jul 21 22:28:13 1998  James Juran  <jrj120@psu.edu>

	* [Make.rules.in]
	Changed $(MKDIR) macro to use -p option (make parent directories
	if they don't already exist.  This fixes an error in 'make install'
	if /usr/local/include doesn't already exist.

Tue Jul 21 13:37:04 Rein Klazes <rklazes@casema.net>

	* [include/heap.h]
	Replaced macro SEGPTR_GET by inline function to avoid *lots*
	of wrong use of this macro.

	* [relay32/comdlg32.spec]
	Corrected GetSaveFileNameW entry.

	* [relay32/advapi32.spec] [win32/advapi.c]
	  [relay32/ole32.spec] [ ole/moniker.c]
	Added stubs for SetFileSecurity[AW] and CreateFileMoniker32

	* [graphics/x11drv/graphics.c]
	Finished implementation of bezier drawing code.

Tue Jul 21 11:00:51 1998  Claus Fischer <cfischer@td2cad.intel.com>

	* [files/drive.c]
	Remove label trailing blanks in GetVolumeInformation32A.

	* [documentation/cdrom-labels]
	Added documentation on how to find out a CD-ROM label.

Sun Jul 19 23:16:41 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [include/windows.h]
	Added some DM_* and DISP_CHANGE_* flags.

	* [relay32/user32.spec] [windows/user.c]
	Added stub for ChangeDisplaySettingA.

	* [ole/ole2nls.c]
	is_punctuation: reuse information from another table.

Sun Jul 19 22:04:46 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [Make.rules.in]
	Updated automatic documentation rules.

	* [graphics/path.c] [misc/aspi.c] [misc/ntdll.c] [misc/winsock_dns.c]
	[ole/ole2dsp.c] [relay32/user32.spec]
	Comment format futzing to keep c2man happy.

	* [documentation/README.documentation]
	Updated description of automatic documentation.

Wed Jul 15 19:10:09 1998   Andrew M. Bishop <amb@gedanken.demon.co.uk>

	* [files/profile.c]
	Cache the 10 most recently used .ini files.

Tue May 20 19:20:23 1997  Pablo Saratxaga <srtxg@chanae.alphanet.ch>

	* [misc/commdlg.c]
	Makes PrintDlg32A() return TRUE even if it is an empty
	stub, so most programs are happy and run anyway instead of
	aborting at startup.

	* [graphics/x11drv/xfont.c]
	Increased the maximum font families as (X11) font aliases
	eated up a lot of families causing wine to stop reading fonts.
diff --git a/windows/event.c b/windows/event.c
index 3257d3d..3caa4b9 100644
--- a/windows/event.c
+++ b/windows/event.c
@@ -387,19 +387,22 @@
 
     /* Process current X event (and possibly others that occurred in the meantime) */
 
-    while (TSXPending( display ))
+    EnterCriticalSection(&X11DRV_CritSection);
+    while (XPending( display ))
     {
 
 #ifdef CONFIG_IPC
         if (DDE_GetRemoteMessage())
         {
+            LeaveCriticalSection(&X11DRV_CritSection);
             while(DDE_GetRemoteMessage()) ;
             return TRUE;
         }
 #endif  /* CONFIG_IPC */
 
-	TSXNextEvent( display, &event );
+	XNextEvent( display, &event );
 
+        LeaveCriticalSection(&X11DRV_CritSection);
         if( peek )
         {
 	  WND*		pWnd;
@@ -433,7 +436,9 @@
           }
         }
         else EVENT_ProcessEvent( &event );
+        EnterCriticalSection(&X11DRV_CritSection);
     }
+    LeaveCriticalSection(&X11DRV_CritSection);
     return TRUE;
 }
 
@@ -447,12 +452,20 @@
 {
     XEvent event;
 
-    TSXSync( display, False );
-    while (TSXPending( display ))
+    /* Use of the X critical section is needed or we have a small
+     * race between XPending() and XNextEvent().
+     */
+    EnterCriticalSection( &X11DRV_CritSection );
+    XSync( display, False );
+    while (XPending( display ))
     {
-	TSXNextEvent( display, &event );
+	XNextEvent( display, &event );
+	/* unlock X critsection for EVENT_ProcessEvent() might switch tasks */
+	LeaveCriticalSection( &X11DRV_CritSection );
 	EVENT_ProcessEvent( &event );
+	EnterCriticalSection( &X11DRV_CritSection );
     }    
+    LeaveCriticalSection( &X11DRV_CritSection );
 }
 
 /***********************************************************************
@@ -1126,18 +1139,13 @@
 
     if (!hwnd)
     {
-        TSXUngrabPointer(display, CurrentTime );
-        captureWnd = NULL; captureHT = 0; 
+        captureWnd = NULL;
+        captureHT = 0; 
     }
-    else if ((win = WIN_GetXWindow( hwnd )))
+    else
     {
 	WND* wndPtr = WIN_FindWndPtr( hwnd );
-
-        if ( wndPtr && 
-	     (TSXGrabPointer(display, win, False, 
-			   ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
-                           GrabModeAsync, GrabModeAsync,
-                           None, None, CurrentTime ) == GrabSuccess) )
+        if (wndPtr)
 	{
             TRACE(win, "(0x%04x)\n", hwnd );
             captureWnd   = hwnd;
diff --git a/windows/keyboard.c b/windows/keyboard.c
index 1e20339..ac4b542 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -169,6 +169,7 @@
     KeyCode *kcp;
     XKeyEvent e2;
     WORD vkey, OEMvkey;
+    int keyc;
 
     TSXDisplayKeycodes(display, &min_keycode, &max_keycode);
     ksp = TSXGetKeyboardMapping(display, min_keycode,
@@ -210,8 +211,9 @@
     e2.state = 0;
 
     OEMvkey = VK_OEM_7; /* next is available.  */
-    for (e2.keycode=min_keycode; e2.keycode<=max_keycode; e2.keycode++)
+    for (keyc = min_keycode; keyc <= max_keycode; keyc++)
     {
+        e2.keycode = (KeyCode)keyc;
         TSXLookupString(&e2, NULL, 0, &keysym, NULL);
         vkey = 0;
         if (keysym)  /* otherwise, keycode not used */
@@ -979,7 +981,7 @@
 	switch(wMapType) {
 		case 0:	{ /* vkey-code to scan-code */
 			/* let's do vkey -> keycode -> scan */
-			KeyCode keyc;
+			int keyc;
 			for (keyc=min_keycode; keyc<=max_keycode; keyc++) /* see event.c */
 				if ((keyc2vkey[keyc] & 0xFF)== wCode)
 					returnMVK (keyc - 8);
@@ -1099,7 +1101,7 @@
     KeySym keysym;
     static XComposeStatus cs;
     INT32 ret;
-    WORD keyc;
+    int keyc;
 
     e.display = display;
     e.keycode = 0;
diff --git a/windows/mdi.c b/windows/mdi.c
index b305ba0..3478cb4 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -621,9 +621,11 @@
 	    if( total < ci->nActiveChildren )
 		delta = SYSMETRICS_CYICONSPACING + SYSMETRICS_CYICON;
 
-	    /* walk the list and move windows */
-	    while ( *ppWnd )
+	    /* walk the list (backwards) and move windows */
+            while (*ppWnd) ppWnd++;
+	    while (ppWnd != heapPtr)
 	    {
+                ppWnd--;
 		TRACE(mdi, "move %04x to (%d,%d) size [%d,%d]\n", 
                             (*ppWnd)->hwndSelf, pos[0].x, pos[0].y, pos[1].x, pos[1].y);
 
@@ -631,7 +633,6 @@
 		SetWindowPos32( (*ppWnd)->hwndSelf, 0, pos[0].x, pos[0].y,
                                 pos[1].x, pos[1].y,
                                 SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER);
-		ppWnd++;
 	    }
 	}
 	HeapFree( SystemHeap, 0, heapPtr );
diff --git a/windows/message.c b/windows/message.c
index 82638ed..fa351b0 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -26,6 +26,7 @@
 #include "process.h"
 #include "thread.h"
 #include "options.h"
+#include "struct32.h"
 #include "debug.h"
 
 #define WM_NCMOUSEFIRST         WM_NCMOUSEMOVE
@@ -927,6 +928,29 @@
     return MSG_PeekMessage( msg, hwnd, first, last, flags, TRUE );
 }
 
+/***********************************************************************
+ *         PeekMessageA
+ */
+BOOL32 WINAPI PeekMessage32A( LPMSG32 lpmsg, HWND32 hwnd,
+                              UINT32 min,UINT32 max,UINT32 wRemoveMsg)
+{
+	MSG16 msg;
+	BOOL32 ret;
+	ret=PeekMessage16(&msg,hwnd,min,max,wRemoveMsg);
+        /* FIXME: should translate the message to Win32 */
+	STRUCT32_MSG16to32(&msg,lpmsg);
+	return ret;
+}
+
+/***********************************************************************
+ *         PeekMessageW
+ */
+BOOL32 WINAPI PeekMessage32W( LPMSG32 lpmsg, HWND32 hwnd,
+                              UINT32 min,UINT32 max,UINT32 wRemoveMsg)
+{
+	/* FIXME: Should perform Unicode translation on specific messages */
+	return PeekMessage32A(lpmsg,hwnd,min,max,wRemoveMsg);
+}
 
 /***********************************************************************
  *           GetMessage16   (USER.108)
@@ -943,6 +967,36 @@
     return (lpmsg->message != WM_QUIT);
 }
 
+/***********************************************************************
+ *          GetMessage32A   (USER32.270)
+ */
+BOOL32 WINAPI GetMessage32A(MSG32* lpmsg,HWND32 hwnd,UINT32 min,UINT32 max)
+{
+    BOOL32 ret;
+    MSG16 *msg = SEGPTR_NEW(MSG16);
+    if (!msg) return 0;
+    ret=GetMessage16(SEGPTR_GET(msg),(HWND16)hwnd,min,max);
+    /* FIXME */
+    STRUCT32_MSG16to32(msg,lpmsg);
+    SEGPTR_FREE(msg);
+    return ret;
+}
+
+/***********************************************************************
+ *          GetMessage32W   (USER32.274)
+ */
+BOOL32 WINAPI GetMessage32W(MSG32* lpmsg,HWND32 hwnd,UINT32 min,UINT32 max)
+{
+    BOOL32 ret;
+    MSG16 *msg = SEGPTR_NEW(MSG16);
+    if (!msg) return 0;
+    ret=GetMessage16(SEGPTR_GET(msg),(HWND16)hwnd,min,max);
+    /* FIXME */
+    STRUCT32_MSG16to32(msg,lpmsg);
+    SEGPTR_FREE(msg);
+    return ret;
+}
+
 
 /***********************************************************************
  *           PostMessage16   (USER.110)
diff --git a/windows/nonclient.c b/windows/nonclient.c
index f9917ee..8ab8abf 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -26,14 +26,9 @@
 #include "options.h"
 
 
-int  NC_CaptionLeftNudge;
-int  NC_CaptionTopNudge;
-int  NC_SysControlNudge;
 int  NC_MaxControlNudge;
 int  NC_MinControlNudge;
 UINT32  NC_CaptionTextFlags;
-HBRUSH32  NC_WinHighlight95;
-HBRUSH32  NC_WinShadow95;
 
 static HBITMAP16 hbitmapClose = 0;
 static HBITMAP16 hbitmapCloseD = 0;
@@ -176,7 +171,6 @@
 		rect->top -= SYSMETRICS_CYSMCAPTION;
 	    else
 		rect->top -= SYSMETRICS_CYCAPTION;
-//            rect->top -= sysMetrics[SM_CYCAPTION];
     }
 
     if (menu)
@@ -570,7 +564,7 @@
  *
  * Handle a WM_NCHITTEST message. Called from NC_HandleNCHitTest().
  *
- * FIXME:  Just a copy of the Win 3.1 version.
+ * FIXME:  Just a modified copy of the Win 3.1 version.
  */
 
 LONG
@@ -828,11 +822,15 @@
 	    hIcon = wndPtr->class->hIconSm;
 	else if (wndPtr->class->hIcon)
 	    hIcon = wndPtr->class->hIcon;
+//	else
+//	    hIcon = LoadIcon32A (0, IDI_APPLICATION);
 
 	if (hIcon)
 	    DrawIconEx32 (hdc, rect.left + 2, rect.top + 1, hIcon,
-			  sysMetrics[SM_CYCAPTION] - 3,
-			  sysMetrics[SM_CYCAPTION] - 3, 0, 0, DI_NORMAL);
+			  sysMetrics[SM_CXSMICON],
+			  sysMetrics[SM_CYSMICON],
+			  0, 0, DI_NORMAL);
+
 	return (hIcon != 0);
     }
     return FALSE;
diff --git a/windows/user.c b/windows/user.c
index 0a6611a..97cc773 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -304,6 +304,33 @@
     return FALSE;
 }
 
+
+/***********************************************************************
+ *           ChangeDisplaySettingA    (USER32.589)
+ */
+LONG WINAPI ChangeDisplaySettings32A( LPDEVMODE32A devmode, DWORD flags )
+{
+  FIXME(system, ": stub\n");
+  if (devmode==NULL)
+    FIXME(system,"   devmode=NULL (return to default mode)\n");
+  else if ( (devmode->dmBitsPerPel != DefaultDepthOfScreen(screen)) 
+	    || (devmode->dmPelsHeight != screenHeight)
+	    || (devmode->dmPelsWidth != screenWidth) )
+
+  {
+
+    if (devmode->dmFields & DM_BITSPERPEL)
+      FIXME(system,"   bpp=%ld\n",devmode->dmBitsPerPel);
+    if (devmode->dmFields & DM_PELSWIDTH)
+      FIXME(system,"   width=%ld\n",devmode->dmPelsWidth);
+    if (devmode->dmFields & DM_PELSHEIGHT)
+      FIXME(system,"   height=%ld\n",devmode->dmPelsHeight);
+    FIXME(system," (Putting X in this mode beforehand might help)\n"); 
+  }
+  return DISP_CHANGE_SUCCESSFUL;
+}
+
+
 /***********************************************************************
  *           EnumDisplaySettingsA   (USER32.592)
  */