Release 960902

Sun Sep  1 19:22:46 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [misc/commdlg.c] [if1632/commdlg.spec]
	Fixed some SEGPTR problems.

	* [windows/winproc.c]
	Added message translation for WM_COMPAREITEM, WM_DELETEITEM
	and WM_MEASUREITEM
	Fixed 16-to-32 translation for WM_HSCROLL/WM_VSCROLL.

Fri Aug 30 13:39:00 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
	* [files/drive.c]
	GetDriveType16 should report CDROMs as DRIVE_REMOTE (ACME setup).

	* [multimedia/audio.c]
	The minimum audiobuffer size shrunk somewhere in linux 1.3.xx
	below 4096 bytes.

	* [multimedia/mcistring.c]
	Segptr string handling fixed & enhanced.

	* [if1632/crtdll.spec][misc/crtdll.c]
	malloc,free,_strupr,_stricmp,_strcmpi added.

	* [if1632/wsock32.spec][misc/winsock.c]
	More direct thunks into unix libc and WsControl-stub added.

Thu Aug 29 23:54:25 1996  Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>

	* [objects/metafile.c]
	Bug fixes to both recording and playback of ExtTextOut().

Tue Aug 27 15:43:21 1996  Slaven Rezic  <eserte@cs.tu-berlin.de>

	* [multimedia/audio.c] [multimedia/mcianim.c]
	  [multimedia/mcicda.c] [multimedia/midi.c]
	Made cdaudio, audio and midi work for FreeBSD.

Sun Aug 25 20:18:56 1996  Jukka Iivonen <iivonen@cc.helsinki.fi>

	* [misc/crtdll.c] [if1632/crtdll.spec]
	Added a lot of functions.

	* [misc/ole2nls.c]
	Added ID values for all languages in GetUserDefaultLCID().
	
Fri Aug 24 21:02:28 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [windows/event.c] [windows/message.c]
	First attempt at hook WH_JOURNALPLAYBACK.
diff --git a/windows/message.c b/windows/message.c
index 4624478..b61ecb3 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -6,6 +6,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <sys/time.h>
 #include <sys/types.h>
 
@@ -31,8 +32,13 @@
 #define HWND_BROADCAST16  ((HWND16)0xffff)
 #define HWND_BROADCAST32  ((HWND32)0xffffffff)
 
-extern BYTE* 	KeyStateTable;				 /* event.c */
+#define ASCII_CHAR_HACK 0x0800 
+
 extern WPARAM	lastEventChar;				 /* event.c */
+extern BOOL MouseButtonsStates[3];
+extern BOOL AsyncMouseButtonsStates[3];
+extern BYTE KeyStateTable[256];
+extern BYTE AsyncKeyStateTable[256];
 
 DWORD MSG_WineStartTicks; /* Ticks at Wine startup */
 
@@ -263,8 +269,8 @@
         HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION, 0,
                         (LPARAM)SEGPTR_GET(event) );
     }
-    else if ((msg->message >= WM_NCMOUSEMOVE) &&
-             (msg->message <= WM_NCMBUTTONDBLCLK))
+    else if ((msg->message >= WM_NCMOUSEFIRST) &&
+             (msg->message <= WM_NCMOUSELAST))
     {
         event->paramL = LOWORD(msg->lParam);       /* X pos */
         event->paramH = HIWORD(msg->lParam);       /* Y pos */ 
@@ -275,6 +281,108 @@
     SEGPTR_FREE(event);
 }
 
+/*****************************************************************
+ *              MSG_JournalPlayBackIsAscii
+ */
+static BOOL MSG_JournalPlayBackIsAscii(WPARAM wParam)
+{
+ return ((wParam>VK_HELP && wParam<VK_F1) || 
+          wParam == VK_SPACE  ||
+          wParam == VK_ESCAPE ||
+          wParam == VK_RETURN ||
+          wParam == VK_TAB    ||
+          wParam == VK_BACK);   
+}
+
+
+/***********************************************************************
+ *          MSG_JournalPlayBackMsg
+ *
+ * Get an EVENTMSG struct via call JOURNALPAYBACK hook function 
+ */
+static int MSG_JournalPlayBackMsg(void)
+{
+ EVENTMSG16 *tmpMsg;
+ long wtime,lParam;
+ WORD keyDown,i,wParam,result=0;
+
+ if ( HOOK_GetHook(WH_JOURNALPLAYBACK, 0) )
+ {
+  tmpMsg = SEGPTR_NEW(EVENTMSG16);
+  wtime=HOOK_CallHooks( WH_JOURNALPLAYBACK, HC_GETNEXT, 0, (LPARAM)SEGPTR_GET(tmpMsg));
+  /*  dprintf_msg(stddeb,"Playback wait time =%ld\n",wtime); */
+  if (wtime<=0)
+  {
+   wtime=0;
+   if ((tmpMsg->message>= WM_KEYFIRST) && (tmpMsg->message <= WM_KEYLAST))
+   {
+     wParam=tmpMsg->paramL & 0xFF;
+     lParam=MAKELONG(tmpMsg->paramH&0x7ffff,tmpMsg->paramL>>8);
+     if (tmpMsg->message == WM_KEYDOWN || tmpMsg->message == WM_SYSKEYDOWN)
+     {
+       for (keyDown=i=0; i<256 && !keyDown; i++)
+          if (KeyStateTable[i] & 0x80)
+            keyDown++;
+       if (!keyDown)
+         lParam |= 0x40000000;       
+       AsyncKeyStateTable[wParam]=KeyStateTable[wParam] |= 0x80;
+       if (MSG_JournalPlayBackIsAscii(wParam))
+       {
+         lastEventChar= wParam;         /* control TranslateMessage() */
+         lParam |= (LONG)((LONG)ASCII_CHAR_HACK*0x10000L);
+
+         if (!(KeyStateTable[VK_SHIFT] & 0x80) &&
+             !(KeyStateTable[VK_CAPITAL] & 0x80))
+           lastEventChar= tolower(lastEventChar);
+         if (KeyStateTable[VK_CONTROL] & 0x80)
+           lastEventChar&=0x1f;
+       }  
+     }  
+     else                                       /* WM_KEYUP, WM_SYSKEYUP */
+     {
+       lParam |= 0xC0000000;      
+       AsyncKeyStateTable[wParam]=KeyStateTable[wParam] &= ~0x80;
+     }
+     if (KeyStateTable[VK_MENU] & 0x80)
+       lParam |= 0x20000000;     
+     if (tmpMsg->paramH & 0x8000)              /*special_key bit*/
+       lParam |= 0x01000000;
+     hardware_event( tmpMsg->message, wParam, lParam,0, 0, tmpMsg->time, 0 );     
+   }
+   else
+   {
+    if ((tmpMsg->message>= WM_MOUSEFIRST) && (tmpMsg->message <= WM_MOUSELAST))
+    {
+     switch (tmpMsg->message)
+     {
+      case WM_LBUTTONDOWN:MouseButtonsStates[0]=AsyncMouseButtonsStates[0]=1;break;
+      case WM_LBUTTONUP:  MouseButtonsStates[0]=AsyncMouseButtonsStates[0]=0;break;
+      case WM_MBUTTONDOWN:MouseButtonsStates[1]=AsyncMouseButtonsStates[1]=1;break;
+      case WM_MBUTTONUP:  MouseButtonsStates[1]=AsyncMouseButtonsStates[1]=0;break;
+      case WM_RBUTTONDOWN:MouseButtonsStates[2]=AsyncMouseButtonsStates[2]=1;break;
+      case WM_RBUTTONUP:  MouseButtonsStates[2]=AsyncMouseButtonsStates[2]=0;break;      
+     }
+     AsyncKeyStateTable[VK_LBUTTON]= KeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] << 8;
+     AsyncKeyStateTable[VK_MBUTTON]= KeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] << 8;
+     AsyncKeyStateTable[VK_RBUTTON]= KeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] << 8;
+     SetCursorPos(tmpMsg->paramL,tmpMsg->paramH);
+     lParam=MAKELONG(tmpMsg->paramL,tmpMsg->paramH);
+     wParam=0;             
+     if (MouseButtonsStates[0]) wParam |= MK_LBUTTON;
+     if (MouseButtonsStates[1]) wParam |= MK_MBUTTON;
+     if (MouseButtonsStates[2]) wParam |= MK_RBUTTON;
+     hardware_event( tmpMsg->message, wParam, lParam,  
+                     tmpMsg->paramL, tmpMsg->paramH, tmpMsg->time, 0 );
+    }
+   }
+   HOOK_CallHooks( WH_JOURNALPLAYBACK, HC_SKIP, 0, (LPARAM)SEGPTR_GET(tmpMsg));
+  }
+  else
+    result= QS_MOUSE | QS_KEY;
+  SEGPTR_FREE(tmpMsg);
+ }
+ return result;
+} 
 
 /***********************************************************************
  *           MSG_PeekHardwareMsg
@@ -490,6 +598,8 @@
             break;
         }
 
+        msgQueue->changeBits |= MSG_JournalPlayBackMsg();
+
         /* Now find a hardware event */
 
         if (((msgQueue->wakeBits & mask) & (QS_MOUSE | QS_KEY)) &&
@@ -909,7 +1019,6 @@
  * This should call ToAscii but it is currently broken
  */
 
-#define ASCII_CHAR_HACK 0x0800
 
 BOOL TranslateMessage( LPMSG16 msg )
 {