Release 950403

Sun Apr  2 18:31:12 1995  Alexandre Julliard  (julliard@sunsite.unc.edu)

	* [Configure] [if1632/Imakefile]
	Removed new build and short names options.

	* [if1632/*.c] [tools/build.c]
	Implemented compiled call-back functions for better performance;
	all the relay code is now done in assembly code generated by the
	build program.
	Relay code is no longer dependent on being loaded below 64K.

	* [loader/resource.c]
	Fixed memory leak in LoadString(). A fix will also be needed for
	other resources.

	* [memory/global.c]
	Implemented global heap arenas, so we can store informations about
	global blocks, like lock counts or owner handle.
	Implemented FarGetOwner() and FarSetOwner().
	Implemented global heap TOOLHELP functions.

	* [memory/selector.c]
	Bug fix: it was not possible to re-use a free selector.

Sun Apr 2 01:34:52 1995 Constantine Sapuntzakis  (csapuntz@mit.edu)

	*  [controls/listbox.c]
	Major work on listbox code
         - Many bugs fixed (still many bugs)
         - More messages supported
         - Code simplified

Fri Mar 31 03:27:16 EST 1995 William Magro (wmagro@tc.cornell.edu)

	* [controls/edit.c]
	Lots of bug fixes related to diappearing text, lost carets,
	highlighting, segmentation faults, occurance of random
	characters, insertion of characters over selection, misplaced
	caret location, display corruption, end of line behavior, etc.

	* [controls/widgets.c]
	EDIT class doesn't want to use CS_PARENTDC flag.

Thu Mar 30 20:58:25 1995   Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
        
	* [loader/selector.c]
	  FixupFunctionPrologs() should also handle multiple data modules.
	  (this bug only became visible because MakeProcInstance() was fixed
	  in 950319)
	
	* [misc/dosfs.c]
	  Simplified DOS_SimplifyPath.
	  Small fix to DOS_opendir to reuse an entry if an open directory
	  is opened again, to prevent "too many open directories" messages.

Thu Mar 30 12:05:05 1995 Martin von Loewis  <loewis@informatik.hu-berlin.de>

	* [if1632/compobj.spec][include/compobj.h][misc/compobj.c]
	CoDisconnectObject: new stub function

	* [include/msdos.h]
	fix DOSVERSION

	* [loader/ne_image.c]
	NE_FixupSegment: Be more generous on additive fixups

	* [if1632/user.spec][misc/network.c]
	Add more WNet* stubs

Wed Mar 29 11:47:22 1995   Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>

        * [controls/listbox.c]
	  DlgDirList(): send segptr instead of linear pointer 
	  in message to static control
	* [controls/menu.c]
	  Tried to implement ownerdrawn menuitems. Doesn't work.
	* [if1632/gdi.spec] [include/windows.h] [objects/font.c]
	  Provide a stub for GetRasterizerCaps()
	* [loader/selector.c]
	  Pass end address instead of length to LocalInit() in 
	  CreateSelectors()
	* [memory/local.c]
	  LocalInit(): If there's already a local heap in the segment, do
	  nothing and return TRUE
	* [objects/linedda.c]
	  Replaced buggy LineDDA() with a Bresenham algorithm. Should work
	  now.
	* [windows/cursor.c]
	  LoadCursor()/CreateCursor(): Cleaned up the mess. Needs some
	  more work still.

Tue Mar 21 17:54:43 1995   Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>

        * [if1632/relay.c] [if1632/callback.c] [include/dlls.h]
	  [if1632/winprocs.spec] [if1632/winprocs.c] [include/winprocs.h]
	  [controls/widgets.c] [misc/shell.c] [misc/commdlg.c]
	  [windows/nonclient.c] [misc/message.c]
	  Added a new builtin DLL that provides 16 bit entry points for all
	  the Def*Procs (DefDlgProc, ButtonProc etc.). OWL programs work
	  again.
	* [misc/shell.c]
	  RegOpenKey()/RegCreateKey() bugs fixed.
        * [loader/ne_image.c]
	  Skipping the initialization of a DLL when CS == 0 was broken.
diff --git a/include/callback.h b/include/callback.h
index 18206c9..01a87d6 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -1,21 +1,93 @@
-/* $Id$
- */
 /*
- * Copyright  Robert J. Amstadt, 1993
+ * 16-bit mode callback functions
+ *
+ * Copyright 1995 Alexandre Julliard
  */
 
-#ifndef CALLBACK_H
-#define CALLBACK_H
+#ifndef WINE_CALLBACK_H
+#define WINE_CALLBACK_H
 
 #include <stdlib.h>
 #include <stdarg.h>
 
-#define CALLBACK_SIZE_WORD	0
-#define CALLBACK_SIZE_LONG	1
+#include "stackframe.h"
 
-extern int CallTo16(unsigned int csip, unsigned short ds);
-extern int CallBack16(void *func, int n_args, ...);
+#ifndef WINELIB
 
-extern BOOL CallGrayStringProc(FARPROC func, HDC hdc, LPARAM lParam, INT cch);
+/* List of the 16-bit callback functions. This list is used  */
+/* by the build program to generate the file if1632/call16.S */
 
-#endif /* CALLBACK_H */
+                               /* func     ds    parameters */
+extern WORD CallTo16_word_wl   ( FARPROC, WORD, WORD, LONG );
+extern WORD CallTo16_word_ll   ( FARPROC, WORD, LONG, LONG );
+extern WORD CallTo16_word_wwl  ( FARPROC, WORD, WORD, WORD, LONG );
+extern WORD CallTo16_word_wlw  ( FARPROC, WORD, WORD, LONG, WORD );
+extern LONG CallTo16_long_wwl  ( FARPROC, WORD, WORD, WORD, LONG );
+extern WORD CallTo16_word_llwl ( FARPROC, WORD, LONG, LONG, WORD, LONG );
+extern LONG CallTo16_long_wwwl ( FARPROC, WORD, WORD, WORD, WORD, LONG );
+extern WORD CallTo16_word_wllwl( FARPROC, WORD, WORD, LONG, LONG, WORD, LONG );
+extern WORD CallTo16_word_wwlll( FARPROC, WORD, WORD, WORD, LONG, LONG, LONG );
+
+extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD ax, WORD bx,
+                            WORD cx, WORD dx, WORD si, WORD di );
+
+#define CallEnumChildProc( func, hwnd, lParam ) \
+    CallTo16_word_wl( func, CURRENT_DS, hwnd, lParam )
+#define CallEnumFontFamProc( func, lpfont, lpmetric, type, lParam ) \
+    CallTo16_word_llwl( func, CURRENT_DS, lpfont, lpmetric, type, lParam )
+#define CallEnumFontsProc( func, lpfont, lpmetric, type, lParam ) \
+    CallTo16_word_llwl( func, CURRENT_DS, lpfont, lpmetric, type, lParam )
+#define CallEnumMetafileProc( func, hdc, lptable, lprecord, objs, lParam ) \
+    CallTo16_word_wllwl(func, CURRENT_DS, hdc, lptable, lprecord, objs, lParam)
+#define CallEnumObjectsProc( func, lpobj, lParam ) \
+    CallTo16_word_ll( func, CURRENT_DS, lpobj, lParam )
+#define CallEnumPropProc( func, hwnd, lpstr, data ) \
+    CallTo16_word_wlw( func, CURRENT_DS, hwnd, lpstr, data )
+#define CallEnumTaskWndProc( func, hwnd, lParam ) \
+    CallTo16_word_wl( func, CURRENT_DS, hwnd, lParam )
+#define CallEnumWindowsProc( func, hwnd, lParam ) \
+    CallTo16_word_wl( func, CURRENT_DS, hwnd, lParam )
+#define CallLineDDAProc( func, xPos, yPos, lParam ) \
+    CallTo16_word_wwl( func, CURRENT_DS, xPos, yPos, lParam )
+#define CallGrayStringProc( func, hdc, lParam, cch ) \
+    CallTo16_word_wlw( func, CURRENT_DS, hdc, lParam, cch )
+#define CallHookProc( func, code, wParam, lParam ) \
+    CallTo16_long_wwl( func, CURRENT_DS, code, wParam, lParam )
+#define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \
+    CallTo16_word_wwlll( func, CURRENT_DS, id, msg, dwUser, dw1, dw2 )
+#define CallWndProc( func, hwnd, msg, wParam, lParam ) \
+    CallTo16_long_wwwl( func, CURRENT_DS, hwnd, msg, wParam, lParam )
+
+#else  /* WINELIB */
+
+#define CallEnumChildProc( func, hwnd, lParam ) \
+    (*func)( hwnd, lParam )
+#define CallEnumFontFamProc( func, lpfont, lpmetric, type, lParam ) \
+    (*func)( lpfont, lpmetric, type, lParam )
+#define CallEnumFontsProc( func, lpfont, lpmetric, type, lParam ) \
+    (*func)( lpfont, lpmetric, type, lParam )
+#define CallEnumMetafileProc( func, hdc, lptable, lprecord, objs, lParam ) \
+    (*func)( hdc, lptable, lprecord, objs, lParam)
+#define CallEnumObjectsProc( func, lpobj, lParam ) \
+    (*func)( lpobj, lParam )
+#define CallEnumPropProc( func, hwnd, lpstr, data ) \
+    (*func)( hwnd, lpstr, data )
+#define CallEnumTaskWndProc( func, hwnd, lParam ) \
+    (*func)( hwnd, lParam )
+#define CallEnumWindowsProc( func, hwnd, lParam ) \
+    (*func)( hwnd, lParam )
+#define CallLineDDAProc( func, xPos, yPos, lParam ) \
+    (*func)( xPos, yPos, lParam )
+#define CallGrayStringProc( func, hdc, lParam, cch ) \
+    (*func)( hdc, lParam, cch )
+#define CallHookProc( func, code, wParam, lParam ) \
+    (*func)( code, wParam, lParam )
+#define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \
+    (*func)( id, msg, dwUser, dw1, dw2 )
+#define CallWndProc( func, hwnd, msg, wParam, lParam ) \
+    (*func)( hwnd, msg, wParam, lParam )
+
+#endif  /* WINELIB */
+
+
+#endif /* WINE_CALLBACK_H */
diff --git a/include/compobj.h b/include/compobj.h
new file mode 100644
index 0000000..d9482dc
--- /dev/null
+++ b/include/compobj.h
@@ -0,0 +1,5 @@
+/*
+ *	compobj.h	-	Declarations for COMPOBJ
+ */
+
+typedef	LPVOID	LPUNKNOWN;
diff --git a/include/debug.h b/include/debug.h
index 34493c8..24c4730 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -69,7 +69,6 @@
 #undef DEBUG_SCROLL
 #undef DEBUG_SELECTOR
 #undef DEBUG_SELECTORS
-#undef DEBUG_STACK
 #undef DEBUG_STRESS
 #undef DEBUG_SYSCOLOR
 #undef DEBUG_TASK
@@ -145,7 +144,6 @@
 #define DEBUG_SCROLL
 #define DEBUG_SELECTOR
 #define DEBUG_SELECTORS
-#define DEBUG_STACK
 #define DEBUG_STRESS
 #define DEBUG_SYSCOLOR
 #define DEBUG_TASK
@@ -475,11 +473,6 @@
 #else
     0,
 #endif
-#ifdef DEBUG_STACK
-    1,
-#else
-    0,
-#endif
 #ifdef DEBUG_STRESS
     1,
 #else
@@ -1352,21 +1345,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_stack if(!debug_msg_enabled[63]) ; else fprintf
-#define debugging_stack debug_msg_enabled[63]
-#else
-#ifdef DEBUG_STACK
-#define dprintf_stack fprintf
-#define debugging_stack 1
-#else
-#define dprintf_stack while(0) fprintf
-#define debugging_stack 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_stress if(!debug_msg_enabled[64]) ; else fprintf
-#define debugging_stress debug_msg_enabled[64]
+#define dprintf_stress if(!debug_msg_enabled[63]) ; else fprintf
+#define debugging_stress debug_msg_enabled[63]
 #else
 #ifdef DEBUG_STRESS
 #define dprintf_stress fprintf
@@ -1378,8 +1358,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_syscolor if(!debug_msg_enabled[65]) ; else fprintf
-#define debugging_syscolor debug_msg_enabled[65]
+#define dprintf_syscolor if(!debug_msg_enabled[64]) ; else fprintf
+#define debugging_syscolor debug_msg_enabled[64]
 #else
 #ifdef DEBUG_SYSCOLOR
 #define dprintf_syscolor fprintf
@@ -1391,8 +1371,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_task if(!debug_msg_enabled[66]) ; else fprintf
-#define debugging_task debug_msg_enabled[66]
+#define dprintf_task if(!debug_msg_enabled[65]) ; else fprintf
+#define debugging_task debug_msg_enabled[65]
 #else
 #ifdef DEBUG_TASK
 #define dprintf_task fprintf
@@ -1404,8 +1384,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_text if(!debug_msg_enabled[67]) ; else fprintf
-#define debugging_text debug_msg_enabled[67]
+#define dprintf_text if(!debug_msg_enabled[66]) ; else fprintf
+#define debugging_text debug_msg_enabled[66]
 #else
 #ifdef DEBUG_TEXT
 #define dprintf_text fprintf
@@ -1417,8 +1397,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_timer if(!debug_msg_enabled[68]) ; else fprintf
-#define debugging_timer debug_msg_enabled[68]
+#define dprintf_timer if(!debug_msg_enabled[67]) ; else fprintf
+#define debugging_timer debug_msg_enabled[67]
 #else
 #ifdef DEBUG_TIMER
 #define dprintf_timer fprintf
@@ -1430,8 +1410,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_toolhelp if(!debug_msg_enabled[69]) ; else fprintf
-#define debugging_toolhelp debug_msg_enabled[69]
+#define dprintf_toolhelp if(!debug_msg_enabled[68]) ; else fprintf
+#define debugging_toolhelp debug_msg_enabled[68]
 #else
 #ifdef DEBUG_TOOLHELP
 #define dprintf_toolhelp fprintf
@@ -1443,8 +1423,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_utility if(!debug_msg_enabled[70]) ; else fprintf
-#define debugging_utility debug_msg_enabled[70]
+#define dprintf_utility if(!debug_msg_enabled[69]) ; else fprintf
+#define debugging_utility debug_msg_enabled[69]
 #else
 #ifdef DEBUG_UTILITY
 #define dprintf_utility fprintf
@@ -1456,8 +1436,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_win if(!debug_msg_enabled[71]) ; else fprintf
-#define debugging_win debug_msg_enabled[71]
+#define dprintf_win if(!debug_msg_enabled[70]) ; else fprintf
+#define debugging_win debug_msg_enabled[70]
 #else
 #ifdef DEBUG_WIN
 #define dprintf_win fprintf
@@ -1469,8 +1449,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_winsock if(!debug_msg_enabled[72]) ; else fprintf
-#define debugging_winsock debug_msg_enabled[72]
+#define dprintf_winsock if(!debug_msg_enabled[71]) ; else fprintf
+#define debugging_winsock debug_msg_enabled[71]
 #else
 #ifdef DEBUG_WINSOCK
 #define dprintf_winsock fprintf
@@ -1548,7 +1528,6 @@
     "scroll",
     "selector",
     "selectors",
-    "stack",
     "stress",
     "syscolor",
     "task",
diff --git a/include/dlls.h b/include/dlls.h
index cdceae5..10f2f08 100644
--- a/include/dlls.h
+++ b/include/dlls.h
@@ -7,6 +7,8 @@
 #ifndef DLLS_H
 #define DLLS_H
 
+#include "wintypes.h"
+
 #define MAX_NAME_LENGTH		64
 
 typedef struct resource_name_table
@@ -54,119 +56,67 @@
 #define DLL	0
 #define EXE	1
 
-#define DLL_ARGTYPE_SIGNEDWORD	0
-#define DLL_ARGTYPE_WORD	1
-#define DLL_ARGTYPE_LONG	2
-#define DLL_ARGTYPE_FARPTR	3
-#define DLL_MAX_ARGS		16
-
-#define DLL_HANDLERTYPE_PASCAL	16
-
 struct dll_table_entry_s
 {
     /*
      * Relocation data
      */
-    unsigned int selector;	/* Selector to access this entry point	  */
-    void *address;		/* Offset in segment of entry point	  */
+    WORD selector;  /* Selector of entry point */
+    WORD offset;    /* Offset in segment of entry point */
 
     /*
      * 16->32 bit interface data
      */
     char *export_name;
-    void *handler;		/* Address of function to process request */
-    char n_args;			/* Number of arguments passed to function */
-    short conv_reference ; /* reference to Argument conversion data  */
 #ifdef WINESTAT
     int used;			/* Number of times this function referenced */
 #endif
-    
+};
+
+struct dll_table_s
+{
+    struct dll_table_entry_s *dll_table;
+    int dll_table_length;
+    int dll_number;
+    void *code_start;  /* 32-bit address of DLL code */
+    void *code_end;
+    void *data_start;  /* 32-bit address of DLL data */
+    void *data_end;
 };
 
 struct dll_name_table_entry_s
 {
     char *dll_name;
-    struct dll_table_entry_s *dll_table;
-    int dll_table_length;
-    int dll_number;
+    struct dll_table_s *table;
     int dll_is_used;   /* use MS provided if set to zero */
 };
 
-extern struct dll_table_entry_s KERNEL_table[];
-extern struct dll_table_entry_s USER_table[];
-extern struct dll_table_entry_s GDI_table[];
-extern struct dll_table_entry_s WIN87EM_table[];
-extern struct dll_table_entry_s MMSYSTEM_table[];
-extern struct dll_table_entry_s SHELL_table[];
-extern struct dll_table_entry_s SOUND_table[];
-extern struct dll_table_entry_s KEYBOARD_table[];
-extern struct dll_table_entry_s WINSOCK_table[];
-extern struct dll_table_entry_s STRESS_table[];
-extern struct dll_table_entry_s SYSTEM_table[];
-extern struct dll_table_entry_s TOOLHELP_table[];
-extern struct dll_table_entry_s MOUSE_table[];
-extern struct dll_table_entry_s COMMDLG_table[];
-extern struct dll_table_entry_s OLE2_table[];
-extern struct dll_table_entry_s OLE2CONV_table[];
-extern struct dll_table_entry_s OLE2DISP_table[];
-extern struct dll_table_entry_s OLE2NLS_table[];
-extern struct dll_table_entry_s OLE2PROX_table[];
-extern struct dll_table_entry_s OLECLI_table[];
-extern struct dll_table_entry_s OLESVR_table[];
-extern struct dll_table_entry_s COMPOBJ_table[];
-extern struct dll_table_entry_s STORAGE_table[];
+extern struct dll_table_s KERNEL_table;
+extern struct dll_table_s USER_table;
+extern struct dll_table_s GDI_table;
+extern struct dll_table_s WIN87EM_table;
+extern struct dll_table_s MMSYSTEM_table;
+extern struct dll_table_s SHELL_table;
+extern struct dll_table_s SOUND_table;
+extern struct dll_table_s KEYBOARD_table;
+extern struct dll_table_s WINSOCK_table;
+extern struct dll_table_s STRESS_table;
+extern struct dll_table_s SYSTEM_table;
+extern struct dll_table_s TOOLHELP_table;
+extern struct dll_table_s MOUSE_table;
+extern struct dll_table_s COMMDLG_table;
+extern struct dll_table_s OLE2_table;
+extern struct dll_table_s OLE2CONV_table;
+extern struct dll_table_s OLE2DISP_table;
+extern struct dll_table_s OLE2NLS_table;
+extern struct dll_table_s OLE2PROX_table;
+extern struct dll_table_s OLECLI_table;
+extern struct dll_table_s OLESVR_table;
+extern struct dll_table_s COMPOBJ_table;
+extern struct dll_table_s STORAGE_table;
+extern struct dll_table_s WINPROCS_table;
 
-
-extern unsigned short KERNEL_offsets[];
-extern unsigned short USER_offsets[];
-extern unsigned short GDI_offsets[];
-extern unsigned short WIN87EM_offsets[];
-extern unsigned short MMSYSTEM_offsets[];
-extern unsigned short SHELL_offsets[];
-extern unsigned short SOUND_offsets[];
-extern unsigned short KEYBOARD_offsets[];
-extern unsigned short WINSOCK_offsets[];
-extern unsigned short STRESS_offsets[];
-extern unsigned short SYSTEM_offsets[];
-extern unsigned short TOOLHELP_offsets[];
-extern unsigned short MOUSE_offsets[];
-extern unsigned short COMMDLG_offsets[];
-extern unsigned short OLE2_offsets[];
-extern unsigned short OLE2CONV_offsets[];
-extern unsigned short OLE2DISP_offsets[];
-extern unsigned short OLE2NLS_offsets[];
-extern unsigned short OLE2PROX_offsets[];
-extern unsigned short OLECLI_offsets[];
-extern unsigned short OLESVR_offsets[];
-extern unsigned short COMPOBJ_offsets[];
-extern unsigned short STORAGE_offsets[];
-
-
-extern unsigned char KERNEL_types[];
-extern unsigned char USER_types[];
-extern unsigned char GDI_types[];
-extern unsigned char WIN87EM_types[];
-extern unsigned char MMSYSTEM_types[];
-extern unsigned char SHELL_types[];
-extern unsigned char SOUND_types[];
-extern unsigned char KEYBOARD_types[];
-extern unsigned char WINSOCK_types[];
-extern unsigned char STRESS_types[];
-extern unsigned char SYSTEM_types[];
-extern unsigned char TOOLHELP_types[];
-extern unsigned char MOUSE_types[];
-extern unsigned char COMMDLG_types[];
-extern unsigned char OLE2_types[];
-extern unsigned char OLE2CONV_types[];
-extern unsigned char OLE2DISP_types[];
-extern unsigned char OLE2NLS_types[];
-extern unsigned char OLE2PROX_types[];
-extern unsigned char OLECLI_types[];
-extern unsigned char OLESVR_types[];
-extern unsigned char COMPOBJ_types[];
-extern unsigned char STORAGE_types[];
-
-#define N_BUILTINS	23
+#define N_BUILTINS	24
 
 #endif /* DLLS_H */
 
diff --git a/include/global.h b/include/global.h
new file mode 100644
index 0000000..626890f
--- /dev/null
+++ b/include/global.h
@@ -0,0 +1,16 @@
+/*
+ * Global heap declarations
+ *
+ * Copyright 1995 Alexandre Julliard
+ */
+
+#ifndef __WINE_GLOBAL_H
+#define __WINE_GLOBAL_H
+
+#include "wintypes.h"
+
+extern HGLOBAL GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL hOwner,
+                             BOOL isCode, BOOL isReadOnly );
+extern WORD GlobalHandleToSel( HGLOBAL handle );
+
+#endif  /* __WINE_GLOBAL_H */
diff --git a/include/hook.h b/include/hook.h
index 303fdd8..bd91822 100644
--- a/include/hook.h
+++ b/include/hook.h
@@ -9,6 +9,7 @@
 
 #include "windows.h"
 #include "ldt.h"
+#include "callback.h"
 
   /* Hook data (pointed to by a HHOOK) */
 typedef struct
@@ -34,9 +35,6 @@
 #define CALL_TASK_HOOK(id,code,wparam,lparam) \
     INTERNAL_CALL_HOOK(TASK_HOOK(id),code,wparam,lparam)
 
-extern DWORD CallHookProc( HOOKPROC func, short code,
-			   WPARAM wParam, LPARAM lParam );  /* callback.c */
-
 extern HHOOK systemHooks[];
 extern HHOOK taskHooks[];
 
diff --git a/include/if1632.h b/include/if1632.h
index 03621a6..96726dd 100644
--- a/include/if1632.h
+++ b/include/if1632.h
@@ -7,12 +7,11 @@
 			unsigned short ds);
 extern int CallTo16cx(unsigned long csip, unsigned long dscx);
 extern int CallToDllEntry(unsigned long csip, unsigned long dscx, unsigned short di);
-extern int CallBack16(void *func, int n_args, ...);
-extern void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam);
 extern void winestat(void);
-extern int DLLRelay(unsigned int func_num, unsigned int seg_off);
-extern struct dll_table_entry_s *FindDLLTable(char *dll_name);
+extern struct dll_table_s *FindDLLTable(char *dll_name);
 extern int FindOrdinalFromName(struct dll_table_entry_s *dll_table, char *func_name);
 extern int ReturnArg(int arg);
 
+extern BOOL RELAY_Init(void);
+
 #endif /* __WINE_IF1632_H */
diff --git a/include/listbox.h b/include/listbox.h
index c1b2278..307a74e 100644
--- a/include/listbox.h
+++ b/include/listbox.h
@@ -8,7 +8,7 @@
 	HANDLE		hMem;
 	HANDLE		hData;
 	char		*itemText;
-	void		*lpNext;
+	struct tagLISTSTRUCT *lpNext;
 } LISTSTRUCT;
 typedef LISTSTRUCT FAR* LPLISTSTRUCT;
 
@@ -21,15 +21,17 @@
 	short	ItemsPerColumn;
 	short	ItemFocused;
 	short	PrevFocused;
-	short	SelCount;
 	short 	StdItemHeight;
 	short	ColumnsWidth;
 	short	DrawCtlType;
-	void	*lpFirst; 
+	void	*lpFirst;
 	DWORD	dwStyle;
 	HWND	hWndLogicParent;
 	HFONT	hFont;
 	BOOL	bRedrawFlag;
+	WORD    iNumStops;
+	LPINT   TabStops;
+	HANDLE  hDrawItemStruct;
 /*	MDESC	*Heap; */
 } HEADLIST;
 typedef HEADLIST FAR* LPHEADLIST;
diff --git a/include/local.h b/include/local.h
index eb813e9..a676a13 100644
--- a/include/local.h
+++ b/include/local.h
@@ -4,8 +4,8 @@
  * Copyright 1995 Alexandre Julliard
  */
 
-#ifndef __WINE_HEAP_H
-#define __WINE_HEAP_H
+#ifndef __WINE_LOCAL_H
+#define __WINE_LOCAL_H
 
 #include "wintypes.h"
 
@@ -21,4 +21,4 @@
 extern WORD LOCAL_Flags( WORD ds, HLOCAL handle );
 extern WORD LOCAL_HeapSize( WORD ds );
 
-#endif  /* __WINE_HEAP_H */
+#endif  /* __WINE_LOCAL_H */
diff --git a/include/msdos.h b/include/msdos.h
index 35b8d92..7b2bda7 100644
--- a/include/msdos.h
+++ b/include/msdos.h
@@ -30,7 +30,7 @@
 	BYTE dummy2[9];
 };
 
-#define DOSVERSION 0x0500;      /* Might as well pretend we're DOS 5.0 */
+#define DOSVERSION 0x0005;      /* Major version in low byte: DOS 5.00 */
 #define MAX_DOS_DRIVES	26
 
 extern WORD ExtendedError;
diff --git a/include/neexe.h b/include/neexe.h
index ad26cbe..51e860d 100644
--- a/include/neexe.h
+++ b/include/neexe.h
@@ -12,18 +12,19 @@
  */
 struct mz_header_s
 {
-    u_char dont_care1[0x18];	/* MZ Header stuff			*/
-    u_char must_be_0x40;	/* 0x40 for non-MZ program		*/
-    u_char dont_care2[0x23];	/* More MZ header stuff			*/
-    u_short ne_offset;		/* Offset to extended header		*/
+    u_short mz_magic;         /* MZ Header signature */
+    u_char  dont_care[0x3a];  /* MZ Header stuff */
+    u_short ne_offset;        /* Offset to extended header */
 };
 
+#define MZ_SIGNATURE  ('M' | ('Z' << 8))
+
 /*
  * This is the Windows executable (NE) header.
  */
 struct ne_header_s
 {
-    char    header_type[2];	/* Must contain 'N' 'E'			*/
+    u_short ne_magic;           /* NE signature 'NE' */
     u_char  linker_version;	/* Linker version number		*/
     u_char  linker_revision;	/* Linker revision number		*/
     u_short entry_tab_offset;	/* Offset to entry table relative to NE */
@@ -57,6 +58,9 @@
     u_short expect_version;	/* Expected Windows version number	*/
 };
 
+#define NE_SIGNATURE  ('N' | ('E' << 8))
+#define PE_SIGNATURE  ('P' | ('E' << 8))
+
 /*
  * NE Header FORMAT FLAGS
  */
diff --git a/include/registers.h b/include/registers.h
index ce06a0f..0298c23 100644
--- a/include/registers.h
+++ b/include/registers.h
@@ -5,6 +5,8 @@
 
 #ifndef PROCEMU
 
+#include "wine.h"
+
 #define EAX context->sc_eax
 #define EBX context->sc_ebx
 #define ECX context->sc_ecx
diff --git a/include/selectors.h b/include/selectors.h
index 55715b9..13cb836 100644
--- a/include/selectors.h
+++ b/include/selectors.h
@@ -20,12 +20,14 @@
 
 extern WORD *CreateSelectors( struct w_files * wpnt );
 
-extern unsigned int GetEntryDLLName(char *dll_name, char *function, WORD *sel,
-					int *addr);
-extern unsigned int GetEntryDLLOrdinal(char *dll_name, int ordinal, WORD *sel,
-					int *addr);
-extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt, 
-					int ordinal);
+extern unsigned int GetEntryDLLName(char *dll_name, char *function,
+                                    WORD *sel, WORD *offset);
+extern unsigned int GetEntryDLLOrdinal(char *dll_name, int ordinal,
+                                       WORD *sel, WORD *offset);
+extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
+                                             int ordinal);
 extern void InitSelectors(void);
 
+extern WNDPROC GetWndProcEntry16( char *name );
+
 #endif /* __WINE_SELECTORS_H */
diff --git a/include/stackframe.h b/include/stackframe.h
index d029ec1..3a1bf2d 100644
--- a/include/stackframe.h
+++ b/include/stackframe.h
@@ -10,19 +10,29 @@
 #include <windows.h>
 #include "ldt.h"
 
+#ifndef WINELIB
+#pragma pack(1)
+#endif
+
 typedef struct
 {
-    WORD    saved_ss;
+    WORD    saved_ss;                /* saved previous 16-bit stack */
     WORD    saved_bp;
     WORD    saved_sp;
-    WORD    ds;
-    WORD    bp;
-    WORD    arg_length;
-    WORD    ip;
+    WORD    ds;                      /* 16-bit ds */
+    DWORD   entry_point WINE_PACKED; /* entry point to call */
+    WORD    ordinal_number;          /* ordinal number of entry point */
+    WORD    dll_id;                  /* DLL id of entry point */
+    WORD    bp;                      /* 16-bit bp */
+    WORD    ip;                      /* return address */
     WORD    cs;
-    WORD    args[1];
+    WORD    args[1];                 /* arguments to API function */
 } STACK16FRAME;
 
+#ifndef WINELIB
+#pragma pack(4)
+#endif
+
 extern WORD IF1632_Saved16_ss;
 extern WORD IF1632_Saved16_sp;
 extern WORD IF1632_Saved16_bp;
diff --git a/include/stddebug.h b/include/stddebug.h
index 4abb78e..2b4114e 100644
--- a/include/stddebug.h
+++ b/include/stddebug.h
@@ -139,7 +139,6 @@
 #undef DEBUG_SCROLL
 #undef DEBUG_SELECTOR
 #undef DEBUG_SELECTORS
-#undef DEBUG_STACK
 #undef DEBUG_STRESS
 #undef DEBUG_SYSCOLOR
 #undef DEBUG_TASK
@@ -215,7 +214,6 @@
 #define DEBUG_SCROLL
 #define DEBUG_SELECTOR
 #define DEBUG_SELECTORS
-#define DEBUG_STACK
 #define DEBUG_STRESS
 #define DEBUG_SYSCOLOR
 #define DEBUG_TASK
diff --git a/include/toolhelp.h b/include/toolhelp.h
index 85ab7b3..ba1a05a 100644
--- a/include/toolhelp.h
+++ b/include/toolhelp.h
@@ -10,8 +10,76 @@
 
 /* Global heap */
 
-WORD GlobalHandleToSel( HANDLE handle );
+typedef struct
+{
+    DWORD dwSize;
+    WORD  wcItems;
+    WORD  wcItemsFree;
+    WORD  wcItemsLRU;
+} GLOBALINFO;
 
+typedef struct
+{
+    DWORD   dwSize;
+    DWORD   dwAddress;
+    DWORD   dwBlockSize;
+    HGLOBAL hBlock;
+    WORD    wcLock;
+    WORD    wcPageLock;
+    WORD    wFlags;
+    BOOL    wHeapPresent;
+    HGLOBAL hOwner;
+    WORD    wType;
+    WORD    wData;
+    DWORD   dwNext;
+    DWORD   dwNextAlt;
+} GLOBALENTRY;
+
+  /* GlobalFirst()/GlobalNext() flags */
+#define GLOBAL_ALL      0
+#define GLOBAL_LRU      1
+#define GLOBAL_FREE     2
+
+  /* wType values */
+#define GT_UNKNOWN      0
+#define GT_DGROUP       1
+#define GT_DATA         2
+#define GT_CODE         3
+#define GT_TASK         4
+#define GT_RESOURCE     5
+#define GT_MODULE       6
+#define GT_FREE         7
+#define GT_INTERNAL     8
+#define GT_SENTINEL     9
+#define GT_BURGERMASTER 10
+
+/* wData values */
+#define GD_USERDEFINED      0
+#define GD_CURSORCOMPONENT  1
+#define GD_BITMAP           2
+#define GD_ICONCOMPONENT    3
+#define GD_MENU             4
+#define GD_DIALOG           5
+#define GD_STRING           6
+#define GD_FONTDIR          7
+#define GD_FONT             8
+#define GD_ACCELERATORS     9
+#define GD_RCDATA           10
+#define GD_ERRTABLE         11
+#define GD_CURSOR           12
+#define GD_ICON             14
+#define GD_NAMETABLE        15
+#define GD_MAX_RESOURCE     15
+
+/* wFlags values */
+#define GF_PDB_OWNER        0x0100      /* Low byte is KERNEL flags */
+
+BOOL GlobalInfo( GLOBALINFO *pInfo );
+BOOL GlobalFirst( GLOBALENTRY *pGlobal, WORD wFlags );
+BOOL GlobalNext( GLOBALENTRY *pGlobal, WORD wFlags) ;
+BOOL GlobalEntryHandle( GLOBALENTRY *pGlobal, HGLOBAL hItem );
+BOOL GlobalEntryModule( GLOBALENTRY *pGlobal, HMODULE hModule, WORD wSeg );
+WORD GlobalHandleToSel( HGLOBAL handle );
 
 /* Local heap */
 
diff --git a/include/windows.h b/include/windows.h
index 5ff1c25..2e639f9 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -680,6 +680,17 @@
 #define ETO_OPAQUE          0x02
 #define ETO_CLIPPED         0x04
 
+  /* Rasterizer status */
+typedef struct
+{
+    WORD nSize;
+    WORD wFlags;
+    WORD nLanguageID;
+} RASTERIZER_STATUS, *LPRASTERIZER_STATUS;
+
+#define TT_AVAILABLE        0x0001
+#define TT_ENABLED          0x0002
+
 typedef struct tagPALETTEENTRY
 {
 	BYTE peRed, peGreen, peBlue, peFlags;
@@ -2469,8 +2480,8 @@
 Fa(SEGPTR,AnsiNext,SEGPTR,a)
 Fa(LPSTR,AnsiUpper,LPSTR,a)
 Fa(LPSTR,GlobalLock,HGLOBAL,a)
-Fa(LPSTR,GlobalWire,HGLOBAL,a)
 Fa(LPSTR,LockResource,HANDLE,a)
+Fa(SEGPTR,GlobalWire,HGLOBAL,a)
 Fa(SEGPTR,WIN16_GlobalLock,HGLOBAL,a)
 Fa(UINT,GDIRealizePalette,HDC,a)
 Fa(UINT,RealizePalette,HDC,a)
diff --git a/include/wine.h b/include/wine.h
index bd426f3..101f50e 100644
--- a/include/wine.h
+++ b/include/wine.h
@@ -1,8 +1,5 @@
 #ifndef  WINE_H
 #define  WINE_H
-#if 0
-#define __ELF__
-#endif
 
 extern char *WineIniFileName(void);
 extern char *WinIniFileName(void);
@@ -36,12 +33,8 @@
 	unsigned long cr2;
 };
 #define WINE_DATA_SELECTOR 0x2b
-#ifdef __ELF__
-#define WINE_CODE_SELECTOR 0x0f
-#else
 #define WINE_CODE_SELECTOR 0x23
-#endif
-#endif
+#endif  /* linux */
 
 #if defined(__NetBSD__) || defined(__FreeBSD__)
 #include <signal.h>