Release 960314

Wed Mar 13 19:46:50 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/edit.c]
	Removed calls to memmove (not portable).

	* [debugger/dbg.y] [debugger/debug.l]
	Prefixed all token with 't' to avoid conflicts with type
	definitions.
	Added 'walk queue', 'walk class' and 'info class' commands.

	* [debugger/info.c]
	Moved queue and window information functions to windows/queue.c
	and windows/win.c respectively.

	* [loader/signal.c]
	Added SIGHUP handling to force entry into built-in debugger.
	Cleaned up a bit.

	* [misc/spy.c]
	General cleanup and performance improvements.

	* [windows/class.c]
	Added CLASS_DumpClass() and CLASS_WalkClasses() functions for
	debugger.

	* [windows/event.c]
	Pressing Ctrl-Alt-Return forces an entry into the debugger. Not
	sure if this key combination is a good choice...

	* [windows/message.c] [windows/queue.c] (New file)
	Moved message queue handling functions to windows/queue.c.

Tue Mar 12 14:55:16 1996  Onno Hovers  <onno@stack.urc.tue.nl>

	* [if1632/except.S] [include/except.h] [win32/except.c] (New files)
	Implemented Win32 exception functions: RaiseException(),
 	RtlUnwind(), SetUnhandledExceptionFilter() and
	UnhandledExceptionFilter().

Mon Mar 11 19:23:29 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [controls/listbox.c] [include/listbox.h]
	Special handling for COMBOLBOX styles introduced via extension of
 	HEADLIST structure: lphl->dwStyle.

Mon Mar 11 13:31:06 1996  Greg Kreider <kreider@natlab.research.philips.com>

	* [controls/combo.c]
	Any mouse movement within a small distance (defined by CBLMM_EDGE)
	of the top or bottom edge causes the window to scroll.  Also moved 
	some assignments so the routine works correctly.

	* [controls/listbox.c]
	Changing selection in ListBoxSetCurSel now updates PrevFocused.
	Added to LBSetFont and CreateListBoxStruct a fake hdc that tests 
	and sets the standard text height.

Sun Mar 10 08:39:23 1996  Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [windows/dce.c]
	Fixed memory leak in DCE_ClipWindows().
diff --git a/include/class.h b/include/class.h
index 90c3a3c..073745f 100644
--- a/include/class.h
+++ b/include/class.h
@@ -31,9 +31,10 @@
 #pragma pack(4)
 #endif
 
-
-HCLASS CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance, CLASS **ptr );
-CLASS * CLASS_FindClassPtr( HCLASS hclass );
-
+extern void CLASS_DumpClass( HCLASS hClass );
+extern void CLASS_WalkClasses(void);
+extern HCLASS CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance,
+                                     CLASS **ptr );
+extern CLASS * CLASS_FindClassPtr( HCLASS hclass );
 
 #endif  /* CLASS_H */
diff --git a/include/debugger.h b/include/debugger.h
index 8cc7c48..42b4206 100644
--- a/include/debugger.h
+++ b/include/debugger.h
@@ -89,10 +89,6 @@
 extern void DEBUG_PrintAddress( const DBG_ADDR *addr, int addrlen );
 extern void DEBUG_Help(void);
 extern void DEBUG_List( DBG_ADDR *addr, int count );
-extern void DEBUG_InitWalk(void);
-extern void DEBUG_WndWalk( HWND );
-extern void DEBUG_WndDump( HWND );
-extern void DEBUG_QueueDump( HQUEUE );
 
   /* debugger/memory.c */
 extern BOOL DEBUG_IsBadReadPtr( const DBG_ADDR *address, int size );
diff --git a/include/except.h b/include/except.h
new file mode 100644
index 0000000..c3654fb
--- /dev/null
+++ b/include/except.h
@@ -0,0 +1,283 @@
+/*
+ * except.h
+ * Copyright (c) 1996, Onno Hovers (onno@stack.urc.tue.nl)
+ */
+
+#ifndef __WINE_EXCEPT_H
+#define __WINE_EXCEPT_H
+
+#include"windows.h"
+
+/* 
+ * general definitions
+ */
+ 
+#ifndef PVOID
+#define PVOID void *
+#endif
+
+/*
+ * exception codes
+ */
+ 
+#define STATUS_WAIT_0                    0x00000000
+#define STATUS_ABANDONED_WAIT_0          0x00000080
+#define STATUS_USER_APC                  0x000000C0
+#define STATUS_TIMEOUT                   0x00000102
+#define STATUS_PENDING                   0x00000103
+#define STATUS_DATATYPE_MISALIGNMENT     0x80000002
+#define STATUS_BREAKPOINT                0x80000003
+#define STATUS_SINGLE_STEP               0x80000004
+#define STATUS_ACCESS_VIOLATION          0xC0000005
+#define STATUS_IN_PAGE_ERROR             0xC0000006
+#define STATUS_NO_MEMORY                 0xC0000017
+#define STATUS_ILLEGAL_INSTRUCTION       0xC000001D
+#define STATUS_NONCONTINUABLE_EXCEPTION  0xC0000025
+#define STATUS_INVALID_DISPOSITION       0xC0000026
+#define STATUS_ARRAY_BOUNDS_EXCEEDED     0xC000008C
+#define STATUS_FLOAT_DENORMAL_OPERAND    0xC000008D
+#define STATUS_FLOAT_DIVIDE_BY_ZERO      0xC000008E
+#define STATUS_FLOAT_INEXACT_RESULT      0xC000008F
+#define STATUS_FLOAT_INVALID_OPERATION   0xC0000090
+#define STATUS_FLOAT_OVERFLOW            0xC0000091
+#define STATUS_FLOAT_STACK_CHECK         0xC0000092
+#define STATUS_FLOAT_UNDERFLOW           0xC0000093
+#define STATUS_INTEGER_DIVIDE_BY_ZERO    0xC0000094
+#define STATUS_INTEGER_OVERFLOW          0xC0000095
+#define STATUS_PRIVILEGED_INSTRUCTION    0xC0000096
+#define STATUS_STACK_OVERFLOW            0xC00000FD
+#define STATUS_CONTROL_C_EXIT            0xC000013A
+
+#define EXCEPTION_ACCESS_VIOLATION      STATUS_ACCESS_VIOLATION
+#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
+#define EXCEPTION_BREAKPOINT            STATUS_BREAKPOINT
+#define EXCEPTION_SINGLE_STEP           STATUS_SINGLE_STEP
+#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
+#define EXCEPTION_FLT_DENORMAL_OPERAND  STATUS_FLOAT_DENORMAL_OPERAND
+#define EXCEPTION_FLT_DIVIDE_BY_ZERO    STATUS_FLOAT_DIVIDE_BY_ZERO
+#define EXCEPTION_FLT_INEXACT_RESULT    STATUS_FLOAT_INEXACT_RESULT
+#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
+#define EXCEPTION_FLT_OVERFLOW          STATUS_FLOAT_OVERFLOW
+#define EXCEPTION_FLT_STACK_CHECK       STATUS_FLOAT_STACK_CHECK
+#define EXCEPTION_FLT_UNDERFLOW         STATUS_FLOAT_UNDERFLOW
+#define EXCEPTION_INT_DIVIDE_BY_ZERO    STATUS_INTEGER_DIVIDE_BY_ZERO
+#define EXCEPTION_INT_OVERFLOW          STATUS_INTEGER_OVERFLOW
+#define EXCEPTION_PRIV_INSTRUCTION      STATUS_PRIVILEGED_INSTRUCTION
+#define EXCEPTION_IN_PAGE_ERROR         STATUS_IN_PAGE_ERROR
+
+/*
+ * return values from the actual exception handlers
+ */
+
+#define ExceptionContinueExecution 0
+#define ExceptionContinueSearch    1
+#define ExceptionNestedException   2
+#define ExceptionCollidedUnwind    3
+ 
+/*
+ * return values from filters in except() and from UnhandledExceptionFilter
+ */
+ 
+#define EXCEPTION_EXECUTE_HANDLER        1
+#define EXCEPTION_CONTINUE_SEARCH        0
+#define EXCEPTION_CONTINUE_EXECUTION    -1
+
+/*
+ * from OS/2 2.0 exception handling
+ * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
+ */
+
+#define EH_NONCONTINUABLE   0x01
+#define EH_UNWINDING        0x02
+#define EH_EXIT_UNWIND      0x04
+#define EH_STACK_INVALID    0x08
+#define EH_NESTED_CALL      0x10
+
+#define EXCEPTION_CONTINUABLE        0
+#define EXCEPTION_NONCONTINUABLE     EH_NONCONTINUABLE
+ 
+/* 
+ * data types
+ */
+
+/*
+ * The i386 context used by Win32 for almost everything. 
+ */
+  
+#define SIZE_OF_80387_REGISTERS      80
+
+typedef struct _FLOATING_SAVE_AREA
+{
+    DWORD   ControlWord;
+    DWORD   StatusWord;
+    DWORD   TagWord;    
+    DWORD   ErrorOffset;
+    DWORD   ErrorSelector;
+    DWORD   DataOffset;
+    DWORD   DataSelector;    
+    BYTE    RegisterArea[SIZE_OF_80387_REGISTERS];
+    DWORD   Cr0NpxState;
+} FLOATING_SAVE_AREA;
+
+typedef struct __CONTEXT
+{
+    DWORD   ContextFlags;
+    DWORD   Dr0;
+    DWORD   Dr1;    
+    DWORD   Dr2;    
+    DWORD   Dr3;
+    DWORD   Dr6;
+    DWORD   Dr7;    
+    FLOATING_SAVE_AREA FloatSave;
+    DWORD   SegGs;
+    DWORD   SegFs;
+    DWORD   SegEs;
+    DWORD   SegDs;    
+    DWORD   Edi;
+    DWORD   Esi;
+    DWORD   Ebx;
+    DWORD   Edx;    
+    DWORD   Ecx;
+    DWORD   Eax;
+    DWORD   Ebp;    
+    DWORD   Eip;
+    DWORD   SegCs;
+    DWORD   EFlags;
+    DWORD   Esp;
+    DWORD   SegSs;
+} CONTEXT;
+
+typedef struct __CONTEXT *PCONTEXT;
+
+/*
+ * The exception record used by Win32 to give additional information 
+ * about exception to exception handlers.
+ */
+
+#define EXCEPTION_MAXIMUM_PARAMETERS 15
+
+typedef struct __EXCEPTION_RECORD
+{
+    DWORD    ExceptionCode;
+    DWORD    ExceptionFlags;
+    struct __EXCEPTION_RECORD *ExceptionRecord;
+
+    PVOID    ExceptionAddress;
+    DWORD    NumberParameters;
+    DWORD    ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+} EXCEPTION_RECORD;
+
+typedef struct __EXCEPTION_RECORD_MIN
+{
+    DWORD    ExceptionCode;
+    DWORD    ExceptionFlags;
+    struct __EXCEPTION_RECORD *ExceptionRecord;
+
+    PVOID    ExceptionAddress;
+    DWORD    NumberParameters;
+    DWORD    ExceptionInformation[0];
+} EXCEPTION_RECORD_MIN;
+
+typedef struct __EXCEPTION_RECORD *PEXCEPTION_RECORD;
+
+/*
+ * The exception pointers structure passed to exception filters
+ * in except() and the UnhandledExceptionFilter().
+ */
+ 
+typedef struct __EXCEPTION_POINTERS 
+{
+  PEXCEPTION_RECORD  ExceptionRecord;
+  PCONTEXT           ContextRecord;
+} EXCEPTION_POINTERS;
+
+typedef struct __EXCEPTION_POINTERS *PEXCEPTION_POINTERS;
+
+/*
+ * the function pointer to a exception handler
+ */
+
+/* forward definition */
+struct __EXCEPTION_FRAME;
+
+typedef DWORD ( *PEXCEPTION_HANDLER)( PEXCEPTION_RECORD          pexcrec,
+                                      struct __EXCEPTION_FRAME  *pestframe,
+                                      PCONTEXT                   pcontext,
+                                      PVOID                      pdispatcher);
+
+/*
+ * function pointer to a UnhandledExceptionFilter();
+ */
+
+typedef long (WINAPI *__PTOP_EXCFILTER)
+                   (PEXCEPTION_POINTERS ExceptionInfo);
+
+typedef __PTOP_EXCFILTER PTOP_LEVER_EXCEPTION_FILTER;
+typedef __PTOP_EXCFILTER LPTOP_LEVEL_EXCEPTION_FILTER;
+                                 
+/*
+ * The exception frame, used for registering exception handlers 
+ * Win32 cares only about this, but compilers generally emit 
+ * larger exception frames for their own use.
+ */
+
+typedef struct __EXCEPTION_FRAME
+{
+  struct __EXCEPTION_FRAME *Prev;
+  PEXCEPTION_HANDLER       Handler;
+} EXCEPTION_FRAME;
+
+typedef struct __EXCEPTION_FRAME *PEXCEPTION_FRAME;
+
+extern PEXCEPTION_FRAME  TebExceptionFrame asm("%fs:0");
+
+#define EXC_GetFrame()   TebExceptionFrame
+#define EXC_SetFrame(a) (TebExceptionFrame=(a))
+
+/*
+ * Function definitions  
+ */
+ 
+void EXC_RaiseException(DWORD exccode, DWORD excflags, 
+                        DWORD nargs, const LPDWORD pargs,
+                        PCONTEXT pcontext); 
+                        
+void EXC_RtlUnwind( PEXCEPTION_FRAME pestframe,
+                    LPVOID unusedEIP,
+                    PEXCEPTION_RECORD pexcrec,
+                    DWORD contextEAX,
+                    PCONTEXT pcontext );
+                    
+DWORD EXC_CallUnhandledExceptionFilter( PEXCEPTION_RECORD precord,
+                                        PCONTEXT          pcontext);
+
+void EXC_Init(void);
+
+BOOL WINAPI RaiseException(DWORD exccode, DWORD excflags,
+                           DWORD nargs, const LPDWORD pargs);
+
+/*
+ *  this undocumented function is called when an exception
+ *  handler wants all the frames to be unwound. RtlUnwind
+ *  calls all exception handlers with the EH_UNWIND or
+ *  EH_EXIT_UNWIND flags set in the exception record
+ *
+ *  This prototype assumes RtlUnwind takes the same
+ *  parameters as OS/2 2.0 DosUnwindException
+ *  Disassembling RtlUnwind shows this is true, except for
+ *  the TargetEIP parameter, which is unused. There is 
+ *  a fourth parameter, that is used as the eax in the 
+ *  context.   
+ */
+
+BOOL  WINAPI RtlUnwind( PEXCEPTION_FRAME pestframe,
+                        LPVOID unusedEIP,
+                        PEXCEPTION_RECORD pexcrec,
+                        DWORD contextEAX );
+
+DWORD WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS epointers);
+
+__PTOP_EXCFILTER WINAPI SetUnhandledExceptionFilter(
+      LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
+  
+#endif  /* __WINE_EXCEPT_H */
diff --git a/include/kernel32.h b/include/kernel32.h
index 12e5761..53e28b6 100644
--- a/include/kernel32.h
+++ b/include/kernel32.h
@@ -10,6 +10,7 @@
 int KERN32_Init(void);
 void SetLastError(DWORD error);
 DWORD ErrnoToLastError(int errno_num);
+void ExitProcess(DWORD exitcode);
 
 /* Code page information.
  */
diff --git a/include/listbox.h b/include/listbox.h
index 5430172..60bed75 100644
--- a/include/listbox.h
+++ b/include/listbox.h
@@ -25,6 +25,7 @@
         WORD    CtlID;
 	LPLISTSTRUCT lpFirst;
 	HWND	hSelf;
+	DWORD   dwStyle;      /* added for COMBOLBOX style faking */
 	HWND    hParent;
 	HFONT   hFont;
 	BOOL    bRedrawFlag;
diff --git a/include/message.h b/include/message.h
index bf242b7..870695c 100644
--- a/include/message.h
+++ b/include/message.h
@@ -1,83 +1,20 @@
 /*
- * Message queues definitions
+ * Message definitions
  *
  * Copyright 1993 Alexandre Julliard
  */
 
-#ifndef MESSAGE_H
-#define MESSAGE_H
+#ifndef __WINE_MESSAGE_H
+#define __WINE_MESSAGE_H
 
 #include "windows.h"
 
-#ifndef WINELIB
-#pragma pack(1)
-#endif
-
-  /* Message as stored in the queue (contains the extraInfo field) */
-typedef struct tagQMSG
-{
-    DWORD   extraInfo;  /* Only in 3.1 */
-    MSG     msg;
-} QMSG;
-
-
-typedef struct tagMESSAGEQUEUE
-{
-  HANDLE    next;                   /* 00 Next queue */
-  HTASK     hTask;                  /* 02 hTask owning the queue */
-  WORD      msgSize;                /* 04 Size of messages in the queue */
-  WORD      msgCount;               /* 06 Number of waiting messages */
-  WORD      nextMessage;            /* 08 Next message to be retrieved */
-  WORD      nextFreeMessage;        /* 0a Next available slot in the queue */
-  WORD      queueSize;              /* 0c Size of the queue */
-  DWORD     GetMessageTimeVal WINE_PACKED;  /* 0e Value for GetMessageTime */
-  DWORD     GetMessagePosVal WINE_PACKED;   /* 12 Value for GetMessagePos */
-  WORD      reserved1;              /* 16 Unknown */
-  DWORD     GetMessageExtraInfoVal; /* 18 Value for GetMessageExtraInfo */
-  WORD      reserved2;              /* 1c Unknown */
-  LPARAM    lParam WINE_PACKED;     /* 1e Next 4 values set by SendMessage */
-  WPARAM    wParam;                 /* 22 */
-  UINT      msg;                    /* 24 */
-  HWND      hWnd;                   /* 26 */
-  DWORD     SendMessageReturn;      /* 28 Return value for SendMessage */
-  WORD      wPostQMsg;              /* 2c PostQuitMessage flag */
-  WORD      wExitCode;              /* 2e PostQuitMessage exit code */
-  WORD      reserved3[3];           /* 30 Unknown */
-  WORD      wWinVersion;            /* 36 Expected Windows version */
-  HQUEUE    InSendMessageHandle;    /* 38 Queue of task that sent a message */
-  HTASK     hSendingTask;           /* 3a Handle of task that sent a message */
-  HTASK     hPrevSendingTask;       /* 3c Handle of previous sender */
-  WORD      wPaintCount;            /* 3e Number of WM_PAINT needed */
-  WORD      wTimerCount;            /* 40 Number of timers for this task */
-  WORD      tempStatus;             /* 42 State reset by GetQueueStatus */
-  WORD      status;                 /* 44 Queue state */
-  WORD      wakeMask;               /* 46 Task wake-up mask */
-  WORD      SendMsgReturnPtrs[3];   /* 48 Near ptr to return values (?) */
-  HANDLE    hCurHook;               /* 4e Current hook */
-  HANDLE    hooks[WH_NB_HOOKS];     /* 50 Task hooks list */
-  WORD      reserved4[3];           /* 68 Unknown */
-  QMSG      messages[1];            /* 6e Queue messages */
-} MESSAGEQUEUE;
-
-#ifndef WINELIB
-#pragma pack(4)
-#endif
-
 extern DWORD MSG_WineStartTicks;  /* Ticks at Wine startup */
 
-extern void MSG_IncPaintCount( HANDLE hQueue );
-extern void MSG_DecPaintCount( HANDLE hQueue );
-extern void MSG_IncTimerCount( HANDLE hQueue );
-extern void MSG_DecTimerCount( HANDLE hQueue );
 extern void MSG_Synchronize();
 extern BOOL MSG_WaitXEvent( LONG maxWait );
-extern BOOL MSG_CreateSysMsgQueue( int size );
-extern BOOL MSG_DeleteMsgQueue( HANDLE hQueue );
-extern HTASK MSG_GetQueueTask( HANDLE hQueue );
-extern void hardware_event( WORD message, WORD wParam, LONG lParam,
-			    int xPos, int yPos, DWORD time, DWORD extraInfo );
 extern BOOL MSG_GetHardwareMessage( LPMSG msg );
 extern BOOL MSG_InternalGetMessage( SEGPTR msg, HWND hwnd, HWND hwndOwner,
 				    short code, WORD flags, BOOL sendIdle );
 
-#endif  /* MESSAGE_H */
+#endif  /* __WINE_MESSAGE_H */
diff --git a/include/queue.h b/include/queue.h
new file mode 100644
index 0000000..fba9398
--- /dev/null
+++ b/include/queue.h
@@ -0,0 +1,83 @@
+/*
+ * Message queues definitions
+ *
+ * Copyright 1993 Alexandre Julliard
+ */
+
+#ifndef __WINE_QUEUE_H
+#define __WINE_QUEUE_H
+
+#include "windows.h"
+
+#ifndef WINELIB
+#pragma pack(1)
+#endif
+
+  /* Message as stored in the queue (contains the extraInfo field) */
+typedef struct tagQMSG
+{
+    DWORD   extraInfo;  /* Only in 3.1 */
+    MSG     msg;
+} QMSG;
+
+
+typedef struct tagMESSAGEQUEUE
+{
+  HQUEUE    next;                   /* 00 Next queue */
+  HTASK     hTask;                  /* 02 hTask owning the queue */
+  WORD      msgSize;                /* 04 Size of messages in the queue */
+  WORD      msgCount;               /* 06 Number of waiting messages */
+  WORD      nextMessage;            /* 08 Next message to be retrieved */
+  WORD      nextFreeMessage;        /* 0a Next available slot in the queue */
+  WORD      queueSize;              /* 0c Size of the queue */
+  DWORD     GetMessageTimeVal WINE_PACKED;  /* 0e Value for GetMessageTime */
+  DWORD     GetMessagePosVal WINE_PACKED;   /* 12 Value for GetMessagePos */
+  WORD      reserved1;              /* 16 Unknown */
+  DWORD     GetMessageExtraInfoVal; /* 18 Value for GetMessageExtraInfo */
+  WORD      reserved2;              /* 1c Unknown */
+  LPARAM    lParam WINE_PACKED;     /* 1e Next 4 values set by SendMessage */
+  WPARAM    wParam;                 /* 22 */
+  UINT      msg;                    /* 24 */
+  HWND      hWnd;                   /* 26 */
+  DWORD     SendMessageReturn;      /* 28 Return value for SendMessage */
+  WORD      wPostQMsg;              /* 2c PostQuitMessage flag */
+  WORD      wExitCode;              /* 2e PostQuitMessage exit code */
+  WORD      reserved3[3];           /* 30 Unknown */
+  WORD      wWinVersion;            /* 36 Expected Windows version */
+  HQUEUE    InSendMessageHandle;    /* 38 Queue of task that sent a message */
+  HTASK     hSendingTask;           /* 3a Handle of task that sent a message */
+  HTASK     hPrevSendingTask;       /* 3c Handle of previous sender */
+  WORD      wPaintCount;            /* 3e Number of WM_PAINT needed */
+  WORD      wTimerCount;            /* 40 Number of timers for this task */
+  WORD      tempStatus;             /* 42 State reset by GetQueueStatus */
+  WORD      status;                 /* 44 Queue state */
+  WORD      wakeMask;               /* 46 Task wake-up mask */
+  WORD      SendMsgReturnPtrs[3];   /* 48 Near ptr to return values (?) */
+  HANDLE    hCurHook;               /* 4e Current hook */
+  HANDLE    hooks[WH_NB_HOOKS];     /* 50 Task hooks list */
+  WORD      reserved4[3];           /* 68 Unknown */
+  QMSG      messages[1];            /* 6e Queue messages */
+} MESSAGEQUEUE;
+
+#ifndef WINELIB
+#pragma pack(4)
+#endif
+
+extern void QUEUE_DumpQueue( HQUEUE hQueue );
+extern void QUEUE_WalkQueues(void);
+extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
+extern void QUEUE_IncPaintCount( HQUEUE hQueue );
+extern void QUEUE_DecPaintCount( HQUEUE hQueue );
+extern void QUEUE_IncTimerCount( HQUEUE hQueue );
+extern void QUEUE_DecTimerCount( HQUEUE hQueue );
+extern BOOL QUEUE_CreateSysMsgQueue( int size );
+extern BOOL QUEUE_DeleteMsgQueue( HQUEUE hQueue );
+extern HTASK QUEUE_GetQueueTask( HQUEUE hQueue );
+extern BOOL QUEUE_AddMsg( HQUEUE hQueue, MSG * msg, DWORD extraInfo );
+extern int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND hwnd,
+                          int first, int last );
+extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos );
+extern void hardware_event( WORD message, WORD wParam, LONG lParam,
+			    int xPos, int yPos, DWORD time, DWORD extraInfo );
+
+#endif  /* __WINE_QUEUE_H */
diff --git a/include/spy.h b/include/spy.h
index d4d9c65..c039241 100644
--- a/include/spy.h
+++ b/include/spy.h
@@ -5,18 +5,16 @@
 #ifndef __WINE_SPY_H
 #define __WINE_SPY_H
 
-#define SPY_DISPATCHMESSAGE     0x0099
-#define SPY_SENDMESSAGE         0x0100
-#define SPY_DEFWNDPROC          0x0101
+#define SPY_DISPATCHMESSAGE     0x0100
+#define SPY_SENDMESSAGE         0x0101
+#define SPY_DEFWNDPROC          0x0102
 
 #define SPY_RESULT_OK           0x0000
 #define SPY_RESULT_INVALIDHWND  0x0001
 
-#define SPY_MAX_MSGNUM          WM_USER
-#define SPY_MAX_INDENTLEVEL     64
-
-extern void EnterSpyMessage( int, HWND, WORD, WORD, LONG);
-extern void  ExitSpyMessage( int, HWND, WORD, LONG);
-extern void         SpyInit( void);
+extern void SPY_EnterMessage( int iFlag, HWND hwnd, UINT msg,
+                              WPARAM wParam, LPARAM lParam );
+extern void SPY_ExitMessage( int iFlag, HWND hwnd, UINT msg, LRESULT lReturn );
+extern int SPY_Init(void);
 
 #endif /* __WINE_SPY_H */
diff --git a/include/task.h b/include/task.h
index d2a2b30..82bc80e 100644
--- a/include/task.h
+++ b/include/task.h
@@ -73,7 +73,7 @@
     WORD    version;                    /* Expected Windows version */
     HANDLE  hInstance;                  /* Instance handle for this task */
     HMODULE hModule;                    /* Module handle */
-    HANDLE  hQueue;                     /* Selector of task message queue */
+    HQUEUE  hQueue;                     /* Selector of task message queue */
     HTASK   hParent;                    /* Selector of TDB of parent task */
     WORD    signal_flags;               /* Flags related to signal handler */
     DWORD   sighandler WINE_PACKED;     /* Signal handler */
diff --git a/include/win.h b/include/win.h
index 37184a7..f3b49b1 100644
--- a/include/win.h
+++ b/include/win.h
@@ -75,6 +75,8 @@
 
   /* Window functions */
 extern WND *WIN_FindWndPtr( HWND hwnd );
+extern void WIN_DumpWindow( HWND hwnd );
+extern void WIN_WalkWindows( HWND hwnd, int indent );
 extern Window WIN_GetXWindow( HWND hwnd );
 extern BOOL WIN_UnlinkWindow( HWND hwnd );
 extern BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
diff --git a/include/windows.h b/include/windows.h
index 3fd0086..53be8c8 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -2222,6 +2222,14 @@
 typedef COMPAREITEMSTRUCT NEAR* PCOMPAREITEMSTRUCT;
 typedef COMPAREITEMSTRUCT FAR* LPCOMPAREITEMSTRUCT;
 
+/* WM_KEYUP/DOWN/CHAR HIWORD(lParam) flags */
+#define KF_EXTENDED         0x0100
+#define KF_DLGMODE          0x0800
+#define KF_MENUMODE         0x1000
+#define KF_ALTDOWN          0x2000
+#define KF_REPEAT           0x4000
+#define KF_UP               0x8000
+
 /* Virtual key codes */
 #define VK_LBUTTON          0x01
 #define VK_RBUTTON          0x02
@@ -2947,7 +2955,7 @@
 VOID       GetSystemTime(LPSYSTEMTIME); /* Win32 */
 DWORD      GetTabbedTextExtent(HDC,LPSTR,int,int,LPINT);
 HINSTANCE  GetTaskDS(void);
-HGLOBAL    GetTaskQueue(HTASK);
+HQUEUE     GetTaskQueue(HTASK);
 BYTE       GetTempDrive(BYTE);
 INT        GetTempFileName(BYTE,LPCSTR,UINT,LPSTR);
 WORD       GetTextAlign(HDC);
@@ -3122,7 +3130,7 @@
 BOOL       Polyline(HDC,LPPOINT,int);
 BOOL       PostAppMessage(HANDLE,WORD,WORD,LONG);
 BOOL       PostMessage(HWND,WORD,WORD,LONG);
-void       PostQuitMessage(int);
+void       PostQuitMessage(INT);
 WORD       PrestoChangoSelector(WORD,WORD);
 void       ProfClear(void);
 void       ProfFinish(void);
@@ -3244,7 +3252,7 @@
 HWND       SetSysModalWindow(HWND);
 WORD       SetSystemPaletteUse(HDC,WORD);
 WORD       SetSystemTimer(HWND,WORD,WORD,FARPROC);
-HGLOBAL    SetTaskQueue(HTASK,HGLOBAL);
+HQUEUE     SetTaskQueue(HTASK,HQUEUE);
 WORD       SetTextAlign(HDC,WORD);
 short      SetTextCharacterExtra(HDC,short);
 DWORD      SetTextColor(HDC,DWORD);