Release 950918

Sun Sep 17 16:47:49 1995  Alexandre Julliard  <julliard@sunsite.unc.edu>

	* [configure.in] [*/Makefile.in] [Make.rules.in]
	Cleaned up makefiles, added configuration option for Winelib,
	grouped common make rules in Make.rules.in.

	* [Configure]
	Renamed to 'Configure.old'; please use 'configure' instead.

	* [controls/menu.c]
	Fixed DestroyMenu() to avoid deleting the same menu twice.
	More fixes to WM_MENUSELECT, and added WM_INITMENU.

	* [if1632/relay.c]
	Fixed wrong register values displayed by RELAY_DebugCall32().

	* [memory/local.c]
	Fixed LocalLock() and LocalUnlock() to increment/decrement the
	lock count for moveable blocks.

	* [misc/commdlg.c] [misc/shell.c] [rc/winerc.c]
	Modified the generated C file so that the resource information
	(size, etc.) is also exported.
	Modified common dialogs to use the new informations.

	* [misc/main.c] [ANNOUNCE]
	Update the list of contributors. Please let me know if I forgot
	someone.

	* [rc/sysres.rc] [rc/sysres_En.rc]
	Moved English resources to sysres_En.rc.
	Changed ids from numeric to symbolic for dialogs.

	* [windows/dialog.c]
	Modified template parsing to be able to pass segmented pointers to
	CreateWindow().

	* [windows/win.c]
	CreateWindow() now takes segmented pointers for class and window
	names.
	Maxmimize or minimize the window upon creation if the WS_MAXIMIZE
	or WS_MINIMIZE bits are set.

Thu Sep 14 17:19:57 1995  Paul Wilhelm  <paul@paul.accessone.com>

	* [controls/scroll.c]
	Fixed scroll-bar bugs for non-client windows.

Thu Sep 14 14:04:14 MET DST 1995 Jochen Hoenicke <Jochen.Hoenicke@arbi.Informatik.Uni-Oldenburg.de>

	* [include/cursor.h] [windows/cursor.c]
	Cursor is not mirrored any more and the hotspot is set right.

Wed Sep 13 14:22:31 1995  Marcus Meissner  <msmeissn@faui01.informatik.uni-erlangen.de>

	* [ole.h]
	Misc small fixes.

Mon Sep  4 00:01:23 1995  Jon Tombs <jon@gte.esi.us.es>

	* [rc/sysres_Es.rc]
	First attempt at Spanish [Es] language support.

Sun Sep  3 13:22:33 1995     Martin von Loewis <loewis@informatik.hu-berlin.de>

	* [include/alias.h][windows/alias.c][include/relay32.h]
	New files

	* [controls/widgets.c]
	WIDGETS_Init: register alias window procedures

	* [if1632/callback.c]
	CallWndProc: Call alias functions if necessary

	* [if1632/gdi32.spec]
	GetStockObject, TextOutA: new relays

	* [misc/user32.c][if1632/user32.spec][misc/Makefile.in][misc/Imakefile]
	user32.c: new file
	BeginPaint,CreateWindowExA,DefWindowProcA,DispatchMessage,EndPaint,
	GetMessageA,RegisterClassA,ShowWindow,UpdateWindow: new relays

	* [if1632/winprocs32.spec][loader/pe_image.c][loader/module.c]
	PE_Win32CallToStart: new function
	MODULE_CreateInstance: removed static attribute
	LoadModule: Try loading PE image on error 21
	PE_LoadModule: new function
	PE_LoadImage: initialize pe_data with 0
	
	* [include/dlls.h][include/peexe.h]
	moved pe_data and w_files to peexe.h
	
	* [misc/shell.c]
	ShellAbout: Register AboutWndProc aliases

	* [miscemu/int21.c]
	handle 0x440A and 0xDC

	* [miscemu/int2f.c]
	handle 0x84

	* [objects/dib.c]
	CreateDIBitmap: complain if BITMAPINFOHEADER is of wrong size

	* [tools/build.c]
	include windows.h and relay32.h into generated Win32 relays,
	don't declare the implementation as int (*)();
	limit in WIN32_builtin was off by one

	* [windows/caret.c]
	CARET_Initialize: new function, call on strategic places

	* [windows/messagebox.c]
	MessageBox: register message box proc aliases

	* [if1632/advapi32.spec][if1632/comdlg32.spec]
	New files

	* [if1632/Makefile.in][if1632/Imakefile][if1632/relay32.c]
	added new spec files
	RELAY32_GetBuiltinDLL: perform lookup case insensitive
	RELAY32_GetEntryPoint: start name search at 0

	* [if1632/user.spec][if1632/kernel.spec][if1632/gdi.spec]
	Added stubs for new Win95 API

Sat Sep 2 1995  Martin Roy

	* [misc/commdlg.c]
	In WM_INITDIALOG, current filter must reflect lpofn->nFilterIndex.
  	When process IDOK button in FILEDLG_WMCommand(),
 	lpofn->nFilterIndex should be updated to current selection.

Thu Aug 31 15:00:00 1995 Ram'on Garc'ia <ramon@ie3.clubs.etsit.upm.es>

	* [loader/module.c] [loader/ne_image.c]
	Added support of self-loading modules.
diff --git a/ANNOUNCE b/ANNOUNCE
index 8120304..04036c4 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,15 +1,15 @@
-This is release 950901 of Wine the MS Windows emulator.  This is still a
+This is release 950918 of Wine the MS Windows emulator.  This is still a
 developer's only release.  There are many bugs and many unimplemented API
 features.  Most applications still do not work.
 
 Patches should be submitted to "wine-new@amscons.com".  Please don't forget
 to include a ChangeLog entry.  I'll make a new release every other week.
 
-WHAT'S NEW with Wine-950901: (see ChangeLog for details)
-	- Accesses to BIOS segment 0x40 are trapped and emulated.
-	- Multimedia improvements.
-	- IPC can now be disabled at compile-time.
-	- Documentation for the IPC code.
+WHAT'S NEW with Wine-950918: (see ChangeLog for details)
+	- Support for self-loading modules.
+	- Win32 support should begin to work again.
+	- Cursor fixes.
+	- New configure script should be useable now.
 	- Lots of bug fixes.
 
 See the README file in the distribution for installation instructions.
@@ -18,11 +18,11 @@
 the release is available at the ftp sites.  The sources will be available
 from the following locations:
 
-    sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950901.tar.gz
-    tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950901.tar.gz
-    ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950901.tar.gz
-    ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950901.tar.gz
-    aris.com:/pub/linux/ALPHA/Wine/development/Wine-950901.tar.gz
+    sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950918.tar.gz
+    tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950918.tar.gz
+    ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950918.tar.gz
+    ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950918.tar.gz
+    aris.com:/pub/linux/ALPHA/Wine/development/Wine-950918.tar.gz
 
 It should also be available from any site that mirrors tsx-11 or sunsite.
 
@@ -36,14 +36,17 @@
 Wine is available thanks to the work of Bob Amstadt, Dag Asheim,
 Martin Ayotte, Ross Biro, Erik Bos, Fons Botman, John Brezak,
 Andrew Bulhak, John Burton, Paul Falstad, Olaf Flebbe, Peter Galbavy,
-Cameron Heide, Jeffrey Hsu, Miguel de Icaza, Alexandre Julliard,
+Ramon Garcia, Hans de Graaf, Charles M. Hannum, Cameron Heide,
+Jochen Hoenicke, Jeffrey Hsu, Miguel de Icaza, Alexandre Julliard,
 Jon Konrath, Scott A. Laird, Martin von Loewis, Kenneth MacDonald,
-Peter MacDonald, William Magro, David Metcalfe, Michael Patra,
-John Richardson, Johannes Ruscheinski, Thomas Sandford,
-Constantine Sapuntzakis, Bernd Schmidt, Yngvi Sigurjonsson, Rick Sladkey,
-William Smith, Erik Svendsen, Goran Thyni, Jimmy Tirtawangsa, Jon Tombs,
-Linus Torvalds, Michael Veksler, Carl Williams, Karl Guenter Wuensch,
-Eric Youngdale, and James Youngman.
+Peter MacDonald, William Magro, Marcus Meissner, Graham Menhennitt,
+David Metcalfe, Michael Patra, John Richardson, Johannes Ruscheinski,
+Thomas Sandford, Constantine Sapuntzakis, Daniel Schepler,
+Bernd Schmidt, Yngvi Sigurjonsson, Rick Sladkey, William Smith,
+Erik Svendsen, Goran Thyni, Jimmy Tirtawangsa, Jon Tombs,
+Linus Torvalds, Gregory Trubetskoy, Michael Veksler, Morten Welinder,
+Jan Willamowius, Carl Williams, Karl Guenter Wuensch, Eric Youngdale,
+and James Youngman.
 
 --
 Alexandre Julliard
diff --git a/ChangeLog b/ChangeLog
index 5a64227..13a6e9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,143 @@
+----------------------------------------------------------------------
+Sun Sep 17 16:47:49 1995  Alexandre Julliard  <julliard@sunsite.unc.edu>
+
+	* [configure.in] [*/Makefile.in] [Make.rules.in]
+	Cleaned up makefiles, added configuration option for Winelib,
+	grouped common make rules in Make.rules.in.
+
+	* [Configure]
+	Renamed to 'Configure.old'; please use 'configure' instead.
+
+	* [controls/menu.c]
+	Fixed DestroyMenu() to avoid deleting the same menu twice.
+	More fixes to WM_MENUSELECT, and added WM_INITMENU.
+
+	* [if1632/relay.c]
+	Fixed wrong register values displayed by RELAY_DebugCall32().
+
+	* [memory/local.c]
+	Fixed LocalLock() and LocalUnlock() to increment/decrement the
+	lock count for moveable blocks.
+
+	* [misc/commdlg.c] [misc/shell.c] [rc/winerc.c]
+	Modified the generated C file so that the resource information
+	(size, etc.) is also exported.
+	Modified common dialogs to use the new informations.
+
+	* [misc/main.c] [ANNOUNCE]
+	Update the list of contributors. Please let me know if I forgot
+	someone.
+
+	* [rc/sysres.rc] [rc/sysres_En.rc]
+	Moved English resources to sysres_En.rc.
+	Changed ids from numeric to symbolic for dialogs.
+
+	* [windows/dialog.c]
+	Modified template parsing to be able to pass segmented pointers to
+	CreateWindow().
+
+	* [windows/win.c]
+	CreateWindow() now takes segmented pointers for class and window
+	names.
+	Maxmimize or minimize the window upon creation if the WS_MAXIMIZE
+	or WS_MINIMIZE bits are set.
+
+Thu Sep 14 17:19:57 1995  Paul Wilhelm  <paul@paul.accessone.com>
+
+	* [controls/scroll.c]
+	Fixed scroll-bar bugs for non-client windows.
+
+Thu Sep 14 14:04:14 MET DST 1995 Jochen Hoenicke <Jochen.Hoenicke@arbi.Informatik.Uni-Oldenburg.de>
+
+	* [include/cursor.h] [windows/cursor.c]
+	Cursor is not mirrored any more and the hotspot is set right.
+
+Wed Sep 13 14:22:31 1995  Marcus Meissner  <msmeissn@faui01.informatik.uni-erlangen.de>
+
+	* [ole.h]
+	Misc small fixes.
+
+Mon Sep  4 00:01:23 1995  Jon Tombs <jon@gte.esi.us.es>
+
+	* [rc/sysres_Es.rc]
+	First attempt at Spanish [Es] language support.
+
+Sun Sep  3 13:22:33 1995     Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+	* [include/alias.h][windows/alias.c][include/relay32.h]
+	New files
+
+	* [controls/widgets.c]
+	WIDGETS_Init: register alias window procedures
+
+	* [if1632/callback.c]
+	CallWndProc: Call alias functions if necessary
+
+	* [if1632/gdi32.spec]
+	GetStockObject, TextOutA: new relays
+
+	* [misc/user32.c][if1632/user32.spec][misc/Makefile.in][misc/Imakefile]
+	user32.c: new file
+	BeginPaint,CreateWindowExA,DefWindowProcA,DispatchMessage,EndPaint,
+	GetMessageA,RegisterClassA,ShowWindow,UpdateWindow: new relays
+
+	* [if1632/winprocs32.spec][loader/pe_image.c][loader/module.c]
+	PE_Win32CallToStart: new function
+	MODULE_CreateInstance: removed static attribute
+	LoadModule: Try loading PE image on error 21
+	PE_LoadModule: new function
+	PE_LoadImage: initialize pe_data with 0
+	
+	* [include/dlls.h][include/peexe.h]
+	moved pe_data and w_files to peexe.h
+	
+	* [misc/shell.c]
+	ShellAbout: Register AboutWndProc aliases
+
+	* [miscemu/int21.c]
+	handle 0x440A and 0xDC
+
+	* [miscemu/int2f.c]
+	handle 0x84
+
+	* [objects/dib.c]
+	CreateDIBitmap: complain if BITMAPINFOHEADER is of wrong size
+
+	* [tools/build.c]
+	include windows.h and relay32.h into generated Win32 relays,
+	don't declare the implementation as int (*)();
+	limit in WIN32_builtin was off by one
+
+	* [windows/caret.c]
+	CARET_Initialize: new function, call on strategic places
+
+	* [windows/messagebox.c]
+	MessageBox: register message box proc aliases
+
+	* [if1632/advapi32.spec][if1632/comdlg32.spec]
+	New files
+
+	* [if1632/Makefile.in][if1632/Imakefile][if1632/relay32.c]
+	added new spec files
+	RELAY32_GetBuiltinDLL: perform lookup case insensitive
+	RELAY32_GetEntryPoint: start name search at 0
+
+	* [if1632/user.spec][if1632/kernel.spec][if1632/gdi.spec]
+	Added stubs for new Win95 API
+
+Sat Sep 2 1995  Martin Roy
+
+	* [misc/commdlg.c]
+	In WM_INITDIALOG, current filter must reflect lpofn->nFilterIndex.
+  	When process IDOK button in FILEDLG_WMCommand(),
+ 	lpofn->nFilterIndex should be updated to current selection.
+
+Thu Aug 31 15:00:00 1995 Ram'on Garc'ia <ramon@ie3.clubs.etsit.upm.es>
+
+	* [loader/module.c] [loader/ne_image.c]
+	Added support of self-loading modules.
+
+---------------------------------------------------------------------
 Thu Aug 31 17:19:57 1995  Alexandre Julliard  <julliard@sunsite.unc.edu>
 
 	* [Configure]
diff --git a/Configure b/Configure.old
similarity index 100%
rename from Configure
rename to Configure.old
diff --git a/Make.rules.in b/Make.rules.in
new file mode 100644
index 0000000..c618c50
--- /dev/null
+++ b/Make.rules.in
@@ -0,0 +1,42 @@
+# Global rules shared by all makefiles
+# The makefile must define at least TOPSRC and MODULE
+
+CC 	  = @CC@
+CFLAGS 	  = @CFLAGS@
+DEFS      = @DEFS@
+LANG	  = @LANG@
+X_CFLAGS  = @X_CFLAGS@
+YACC      = @YACC@
+LEX       = @LEX@
+LEXLIB    = @LEXLIB@
+DIVINCL   = -I$(TOPSRC)/include
+ALLCFLAGS = $(CFLAGS) $(DEFS) $(LANG) $(X_CFLAGS) $(DIVINCL) $(EXTRA_DEFS)
+LDCOMBINE = ld -r
+RM        = rm -f
+@SET_MAKE@
+
+OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o)
+
+.c.o:
+	$(CC) -c $(ALLCFLAGS) -o $*.o $<
+
+.S.o:
+	$(CC) -c -o $*.o $<  
+
+$(MODULE).o: $(OBJS)
+	$(LDCOMBINE) $(OBJS) -o $(MODULE).o
+
+depend:: $(C_SRCS)
+	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
+	$(CC) $(ALLCFLAGS) -MM $(C_SRCS) >> tmp_make
+	mv tmp_make Makefile
+
+clean::
+	$(RM) *.o \#*\# *~ *.bak tmp_make
+
+distclean:: clean
+	$(RM) Makefile
+
+langclean::
+
+dummy:
diff --git a/Makefile.in b/Makefile.in
index fd71192..5559dd9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3,78 +3,92 @@
 # all (default):	build wine
 # clean:		remove all intermediate files
 # distclean:		also remove all files created by configure
-# countryclean:		remove all files which have to be remade if
+# langclean:		remove all files which have to be remade if
 #			a different LANGuage is selected
 # depend:		create the dependencies
 #
 # Author: Michael Patra   <micky@marie.physik.tu-berlin.de>
 #                         <patra@itp1.physik.tu-berlin.de>
 
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-DEFS    = @DEFS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-XPM_LIB	= -lXpm
-XLIB	= -lXext -lX11
-XDIR	= -L@x_libraries@
-LDLIBS	= -lm
-LD	= @LD@
-LANG	= @LANG@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+CC 	  = @CC@
+CFLAGS 	  = @CFLAGS@
+DEFS      = @DEFS@
+LANG	  = @LANG@
+X_CFLAGS  = @X_CFLAGS@
+X_LIBS    = @X_LIBS@
+TOPSRC    = @top_srcdir@
+DIVINCL   = -I$(TOPSRC)/include
+XPM_LIB	  = -lXpm
+XLIB	  = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
+LDLIBS	  = -lm
+AR        = ar rc
+RANLIB    = @RANLIB@
+RM        = rm -f
 @SET_MAKE@
 
-COMMONSUBDIRS = controls rc ipc loader misc multimedia objects windows
+MAIN_TARGET = @MAIN_TARGET@
 
-EMUSUBDIRS = tools debugger if1632 memory miscemu
+COMMONSUBDIRS = rc controls ipc loader misc multimedia objects windows
+
+EMUSUBDIRS = tools debugger debugger/readline if1632 memory miscemu
 
 LIBSUBDIRS = toolkit
  
-COMMONOBJS = controls/controls.o ipc/ipc.o loader/loader.o misc/misc.o \
-	multimedia/multimedia.o objects/objects.o rc/rc.o \
+ALLSUBDIRS = $(COMMONSUBDIRS) $(EMUSUBDIRS) $(LIBSUBDIRS)
+
+COMMONOBJS = \
+	controls/controls.o \
+	ipc/ipc.o \
+	loader/loader.o \
+	misc/misc.o \
+	multimedia/multimedia.o \
+	objects/objects.o \
+	rc/rc.o \
 	windows/windows.o
 
-EMUOBJS = debugger/debugger.o if1632/if1632.o memory/memory.o miscemu/miscemu.o
+EMUOBJS = \
+	debugger/debugger.o \
+	debugger/readline/readline.o \
+	if1632/if1632.o \
+	memory/memory.o \
+	miscemu/miscemu.o
 
 LIBOBJS = toolkit/toolkit.o
- 
-
-SUBDIRS = $(COMMONSUBDIRS) $(EMUSUBDIRS)
-
-OBJS = $(COMMONOBJS) $(EMUOBJS)
 
 
-all: wine wine.sym
+all: $(MAIN_TARGET)
 
-wine.sym: wine
+wine: $(COMMONSUBDIRS) $(EMUSUBDIRS) dummy
+	$(CC) -o wine $(COMMONOBJS) $(EMUOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS)
 	nm wine | grep -v _compiled | sort >wine.sym
 
-wine: $(SUBDIRS) dummy
-	$(CC) -o wine $(OBJS) $(LDOPTIONS) $(XDIR) $(XPM_LIB) $(XLIB) $(LDLIBS)
+winelib.a: $(COMMONSUBDIRS) $(LIBSUBDIRS) dummy
+	$(RM) $@
+	$(AR) $@ $(COMMONOBJS) $(LIBOBJS)
+	$(RANLIB) $@
 
-$(SUBDIRS): dummy
-	@cd $@; $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)' 'LD=$(LD)' 'LDCOMBINEFLAGS=$(LDCOMBINEFLAGS)' 'LANG=$(LANG)'
+$(ALLSUBDIRS): dummy
+	@cd $@; $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)' 'LANG=$(LANG)'
 
 depend:
-	for i in $(SUBDIRS); do (cd $$i; $(MAKE) depend); done
+	for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) depend); done
 
 etags:
 	etags `find . -name '*.[chS]' -print`
 
 clean:
-	for i in $(SUBDIRS); do (cd $$i; $(MAKE) clean); done
-	rm -f *.o \#*\# *~ *.bak wine wine.sym TAGS
+	for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) clean); done
+	$(RM) *.o \#*\# *~ *.bak wine wine.sym winelib.a TAGS
 
 distclean:
-	for i in $(SUBDIRS); do (cd $$i; $(MAKE) distclean); done
+	for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) distclean); done
 	echo "/* autoconf.h generated automatically.  Run Configure */" >autoconf.h
 	echo "#error You must run Configure before you can build the makefiles." >>autoconf.h
-	rm -f *.o \#*\# *~ *.bak wine wine.sym TAGS
-	rm -f config.* include/config.h Makefile
+	$(RM) *.o \#*\# *~ *.bak wine wine.sym winelib.a TAGS
+	$(RM) config.* include/config.h Make.rules Makefile
 
-countryclean:
-	for i in $(SUBDIRS); do (cd $$i; $(MAKE) countryclean); done
-	rm -f wine wine.sym
+langclean:
+	for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) langclean); done
+	$(RM) wine wine.sym winelib.a
 	
 dummy:
diff --git a/README b/README
index f9ca019..6dc6d64 100644
--- a/README
+++ b/README
@@ -21,9 +21,9 @@
 it are probably available on the ftp site where you got Wine. They can
 also be found on ftp.x.org and all its mirror sites.
 
-To build Wine, first do a "./Configure" and then a "make" (or "gmake"
-if you're running *BSD).  The executable "wine" will be built.  "wine"
-will load and run 16-bit Windows executables. 
+To build Wine, first do a "./configure" and then a "make depend; make".
+ The executable "wine" will be built.  "wine" will load and run 16-bit
+Windows executables.
 
 To upgrade to a new release by using a patch file, first cd to the
 top-level directory of the release (the one containing this README
@@ -32,8 +32,8 @@
     gunzip -c patch-file | patch -p1
 
 where "patch-file" is the name of the patch file (something like
-Wine-yymmdd.diff.gz). You can then re-run "./Configure", and then
-run "make". 
+Wine-yymmdd.diff.gz). You can then re-run "./configure", and then
+run "make depend; make".
 
 
 3. SETUP
@@ -147,9 +147,10 @@
 comp.emulators.ms-windows.wine. The Wine FAQ is posted there every
 month.
 
-If you add something, or fix a bug, please send a patch to
-wine-new@amscons.com for inclusion in the next release.
+If you add something, or fix a bug, please send a patch ('diff -u'
+format preferred) to wine-new@amscons.com for inclusion in the next
+release.
 
 --
 Alexandre Julliard
-julliard@lamisun.epfl.ch
+julliard@lrc.epfl.ch
diff --git a/Wine.man b/Wine.man
index e39bbfd..aeb1463 100644
--- a/Wine.man
+++ b/Wine.man
@@ -1,5 +1,5 @@
 .\" -*- nroff -*-
-.TH WINE 1 "June 29, 1995" "Version 6/20/95" "Windows Emulation"
+.TH WINE 1 "September 1, 1995" "Version 9/1/95" "Windows Emulation"
 .SH NAME
 wine \- run Windows 3.x programs under Linux
 .SH SYNOPSIS
@@ -23,7 +23,7 @@
 See the files 
 .B README,
 .B ChangeLog, 
-.B Configure, 
+.B configure, 
 and the
 .B Makefile
 contained in the source distribution
@@ -45,8 +45,11 @@
 .SH INSTALLATION
 To install 
 .B wine,
-run "./Configure", which will ask for configuration information and
-create the Makefiles, then run "make".
+run "./configure", which will detect your specific setup and create
+the Makefiles. You can run "./configure --help" to see the available
+configuration options. Then do "make depend; make" to build the
+.B wine
+executable.
 .SH OPTIONS
 .TP
 .I -depth n
@@ -122,7 +125,7 @@
 expects a configuration file (/usr/local/etc/wine.conf), 
 which should conform to the following rules.  The actual file name may
 be specified during the execution of the
-.B Configure
+.B configure
 script.  Alternatively, you may have a 
 .I .winerc
 file of this format in your home directory.
@@ -259,28 +262,26 @@
 is available thanks to the work of Bob Amstadt, Dag Asheim,
 Martin Ayotte, Ross Biro, Erik Bos, Fons Botman, John Brezak,
 Andrew Bulhak, John Burton, Paul Falstad, Olaf Flebbe, Peter Galbavy,
-Cameron Heide, Jeffrey Hsu, Miguel de Icaza, Alexandre Julliard,
+Ramon Garcia, Hans de Graaf, Charles M. Hannum, Cameron Heide,
+Jochen Hoenicke, Jeffrey Hsu, Miguel de Icaza, Alexandre Julliard,
 Jon Konrath, Scott A. Laird, Martin von Loewis, Kenneth MacDonald,
-Peter MacDonald, William Magro, David Metcalfe, Michael Patra,
-John Richardson, Johannes Ruscheinski, Thomas Sandford,
-Constantine Sapuntzakis, Bernd Schmidt, Yngvi Sigurjonsson, Rick Sladkey,
-William Smith, Erik Svendsen, Goran Thyni, Jimmy Tirtawangsa, Jon Tombs,
-Linus Torvalds, Michael Veksler, Carl Williams, Karl Guenter Wuensch,
-Eric Youngdale, and James Youngman.
+Peter MacDonald, William Magro, Marcus Meissner, Graham Menhennitt,
+David Metcalfe, Michael Patra, John Richardson, Johannes Ruscheinski,
+Thomas Sandford, Constantine Sapuntzakis, Daniel Schepler,
+Bernd Schmidt, Yngvi Sigurjonsson, Rick Sladkey, William Smith,
+Erik Svendsen, Goran Thyni, Jimmy Tirtawangsa, Jon Tombs,
+Linus Torvalds, Gregory Trubetskoy, Michael Veksler, Morten Welinder,
+Jan Willamowius, Carl Williams, Karl Guenter Wuensch, Eric Youngdale,
+and James Youngman.
 .PP
-This man page is maintained by Mike Phillips (msphil@mail.wm.edu), so please
-send all corrections, comments, flames, etc., to him.
+This man page is maintained by Mike Phillips (msphil@facstaff.wm.edu), so 
+please send all corrections, comments, flames, etc., to him.
 .SH BUGS
-There are too many to count, much less list.  Some are of note, however:
-Any Windows program using Visual Basic (VBRUNxxx.DLL) will not run yet,
-nor will any program depending on undocumented functions or on the
-COMMDLG (any standard file open/save interface) unless you disable the 
-internal COMMDLG with the 
-.I -dll -commdlg
-option.  In addition, 16-color support is imperfect at best, and 
-icons sometimes display improperly on some systems.  Certain 
-multi-language modules will not load properly.  Progress is being made 
-regularly, however.
+There are too many to count, much less list.  Some bugs of note, however,
+are that programs requiring VBRUNxxx.DLL are unreliable (with reports of
+some working), OLE is not in place, the internal COMMDLG support is not yet
+at 100% (although rapidly improving).  Color support for other than 8bpp
+(256 colors) is currently flaky.
 .PP
 Currently, no directories in the path can have upper-case letters in them
 (ex. /msdos/driveC), as the conversions necessary to handle the msdos 
@@ -288,7 +289,7 @@
 .PP
 A partial list of applications known to work with 
 .B wine
-include: sol, cruel, golf.exe, clock, notepad, charmap, and calc.
+include: sol, cruel, golf, clock, notepad, charmap, calc, and wzip11.
 The following URLs point to different success/testing lists:
 .br
 .I http://www.ifi.uio.no/~dash/wine/working-apps.html
@@ -317,12 +318,9 @@
 .I ChangeLog
 Changes in Wine, since the beginning (most recent changes first)
 .TP
-.I Configure
-Shell script to automate compilation.  Usually followed by make (or gmake 
-on *BSD systems) to compile wine; it can even build a sample 
-.B wine.conf
-file
-
+.I configure
+Shell script to automatically generate Makefiles.  Usually followed by make 
+(or gmake on *BSD systems) to compile wine.
 .TP
 .I Wine newsgroup
 Subscribe to comp.emulators.ms-windows.wine
diff --git a/configure b/configure
index 3b8d7da..e3760c8 100755
--- a/configure
+++ b/configure
@@ -13,7 +13,9 @@
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
 ac_help="$ac_help
-  --with-language=LANG    change the default language (LANG=En/De/No)"
+  --with-library          build Wine as a library instead of an emulator"
+ac_help="$ac_help
+  --with-language=LANG    change the default language (LANG=En/De/No/Es)"
 ac_help="$ac_help
   --with-ipc              use inter-process communication for DDE"
 ac_help="$ac_help
@@ -412,6 +414,20 @@
 test -z "$CFLAGS" && CFLAGS="-g -O2 -Wall" 
 test -z "$LDFLAGS" && LDFLAGS=-g 
 
+
+# Check whether --with-library or --without-library was given.
+withval="$with_library"
+if test -n "$withval"; then
+  cat >> confdefs.h <<\EOF
+#define WINELIB 1
+EOF
+ MAIN_TARGET="winelib.a"
+else
+  MAIN_TARGET="wine"
+fi
+
+
+
 # Check whether --with-language or --without-language was given.
 withval="$with_language"
 if test -n "$withval"; then
@@ -421,6 +437,7 @@
 fi
 
 
+
 # Check whether --with-ipc or --without-ipc was given.
 withval="$with_ipc"
 if test -n "$withval"; then
@@ -430,6 +447,7 @@
 
 fi
 
+
 # Check whether --with-malloc-debug or --without-malloc-debug was given.
 withval="$with_malloc_debug"
 if test -n "$withval"; then
@@ -440,6 +458,7 @@
 fi
 
 
+
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
 set dummy ${MAKE-make}; ac_make=$2
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
@@ -554,7 +573,7 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 558 "configure"
+#line 577 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
@@ -568,7 +587,7 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 572 "configure"
+#line 591 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
@@ -593,6 +612,26 @@
 fi
 echo "$ac_t""$CPP" 1>&6
 
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+if test -d /etc/conf/kconfig.d &&
+  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+then
+  echo "$ac_t""yes" 1>&6
+  ISC=yes # If later tests want to check for ISC.
+  cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+  if test "$GCC" = yes; then
+    CC="$CC -posix"
+  else
+    CC="$CC -Xp"
+  fi
+else
+  echo "$ac_t""no" 1>&6
+  ISC=
+fi
+
 # If we find X, set shell vars x_includes and x_libraries to the
 # paths, otherwise set no_x=yes.
 # Uses ac_ vars as temps to allow command line to override cache and checks.
@@ -654,7 +693,7 @@
 test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
 test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
 cat > conftest.$ac_ext <<EOF
-#line 658 "configure"
+#line 697 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
@@ -717,7 +756,7 @@
 ac_save_LIBS="$LIBS"
 LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 721 "configure"
+#line 760 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -799,6 +838,226 @@
   echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
 fi
 
+if test "$no_x" = yes; then 
+  # Not all programs may use this symbol, but it does not hurt to define it.
+  X_CFLAGS="$X_CFLAGS -DX_DISPLAY_MISSING"
+else
+  if test -n "$x_includes"; then
+    X_CFLAGS="$X_CFLAGS -I$x_includes"
+  fi
+
+  # It would be nice to have a more robust check for the -R ld option than
+  # just checking for Solaris.
+  # It would also be nice to do this for all -L options, not just this one.
+  if test -n "$x_libraries"; then
+    X_LIBS="$X_LIBS -L$x_libraries"
+    if test "`(uname) 2>/dev/null`" = SunOS &&
+      uname -r | grep '^5' >/dev/null; then
+      X_LIBS="$X_LIBS -R$x_libraries"
+    fi
+  fi
+
+  # Check for libraries that X11R6 Xt/Xaw programs need.
+
+  ac_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS -L$x_libraries"
+  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+  # check for ICE first), but we must link in the order -lSM -lICE or
+  # we get undefined symbols.  So assume we have SM if we have ICE.
+  # These have to be linked with before -lX11, unlike the other
+  # libraries we check for below, so use a different variable.
+  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+  echo $ac_n "checking for -lICE""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_lib_ICE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lICE  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 878 "configure"
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() {
+IceConnectionNumber()
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_lib_ICE=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_lib_ICE=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'ICE`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  LDFLAGS="$ac_save_LDFLAGS"
+
+  # Check for system-dependent libraries X programs must link with.
+
+  if test "$ISC" = yes; then
+    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+  else
+    # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
+    # libraries were built with DECnet support.  And karl@cs.umb.edu says
+    # the Alpha needs dnet_stub (dnet does not exist).
+    echo $ac_n "checking for -ldnet""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_lib_dnet'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldnet  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 921 "configure"
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() {
+dnet_ntoa()
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_lib_dnet=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_lib_dnet=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'dnet`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    if test $ac_cv_lib_dnet = no; then
+      echo $ac_n "checking for -ldnet_stub""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_lib_dnet_stub'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldnet_stub  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 955 "configure"
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() {
+dnet_ntoa()
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_lib_dnet_stub=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_lib_dnet_stub=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'dnet_stub`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+    # to get the SysV transport functions.
+    # Not sure which flavor of 386 UNIX this is, but it seems harmless to
+    # check for it.
+    echo $ac_n "checking for -lnsl""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_lib_nsl'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 994 "configure"
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() {
+t_accept()
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_lib_nsl=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_lib_nsl=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'nsl`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+    # lieder@skyler.mavd.honeywell.com says without -lsocket,
+    # socket/setsockopt and other routines are undefined under SCO ODT 2.0.
+    # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
+    if test "`(uname) 2>/dev/null`" != IRIX; then
+      echo $ac_n "checking for -lsocket""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_lib_socket'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1032 "configure"
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() {
+socket()
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_lib_socket=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_lib_socket=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'socket`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+  fi
+fi
+
 for ac_prog in 'bison -y' byacc
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -873,7 +1132,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 877 "configure"
+#line 1136 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -901,20 +1160,33 @@
 
 fi
 
-if test -n "$x_includes" ; then
-  x_includes="-I$x_includes"
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
 fi
-if test -n "$x_no" ; then
-  AXFILES='AXFILES='
 fi
-
-
-
-
-
-LD=ld
-LDCOMBINEFLAGS="-r"
-
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
 
 
 for ac_func in tcgetattr
@@ -924,7 +1196,7 @@
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 928 "configure"
+#line 1200 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -976,7 +1248,7 @@
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 980 "configure"
+#line 1252 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
@@ -1009,7 +1281,7 @@
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1013 "configure"
+#line 1285 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -1063,7 +1335,7 @@
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1067 "configure"
+#line 1339 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1140,7 +1412,7 @@
   ac_cv_c_cross=yes
 else
 cat > conftest.$ac_ext <<EOF
-#line 1144 "configure"
+#line 1416 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
@@ -1161,7 +1433,7 @@
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1165 "configure"
+#line 1437 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1183,7 +1455,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1187 "configure"
+#line 1459 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1201,7 +1473,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1205 "configure"
+#line 1477 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1222,7 +1494,7 @@
   ac_cv_header_stdc=no
 else
 cat > conftest.$ac_ext <<EOF
-#line 1226 "configure"
+#line 1498 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1256,7 +1528,7 @@
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1260 "configure"
+#line 1532 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1311,9 +1583,12 @@
 fi
 fi
 
+cat >> confdefs.h <<EOF
+#define WINE_INI_GLOBAL $WINE_INI_GLOBAL
+EOF
 
 
-test -z "$LDFLAGS" && LDFLAGS=-g 
+MAKE_RULES=$TOP_SRCDIR/Make.rules
 
 
 trap '' 1 2 15
@@ -1414,7 +1689,7 @@
 
 ac_given_srcdir=$srcdir
 
-trap 'rm -fr `echo "controls/Makefile ipc/Makefile loader/Makefile memory/Makefile misc/Makefile miscemu/Makefile multimedia/Makefile objects/Makefile windows/Makefile rc/Makefile debugger/Makefile debugger/readline/Makefile tools/Makefile if1632/Makefile Makefile autoconf.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Make.rules controls/Makefile ipc/Makefile loader/Makefile memory/Makefile misc/Makefile miscemu/Makefile multimedia/Makefile objects/Makefile windows/Makefile rc/Makefile debugger/Makefile debugger/readline/Makefile tools/Makefile if1632/Makefile toolkit/Makefile Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 
 # Protect against being on the right side of a sed subst in config.status. 
 sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
@@ -1430,26 +1705,28 @@
 s%@exec_prefix@%$exec_prefix%g
 s%@prefix@%$prefix%g
 s%@program_transform_name@%$program_transform_name%g
+s%@MAIN_TARGET@%$MAIN_TARGET%g
 s%@LANG@%$LANG%g
 s%@SET_MAKE@%$SET_MAKE%g
 s%@CC@%$CC%g
 s%@CPP@%$CPP%g
+s%@X_CFLAGS@%$X_CFLAGS%g
+s%@X_PRE_LIBS@%$X_PRE_LIBS%g
+s%@X_LIBS@%$X_LIBS%g
+s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
 s%@YACC@%$YACC%g
 s%@LEX@%$LEX%g
 s%@LEXLIB@%$LEXLIB%g
-s%@AXFILES@%$AXFILES%g
-s%@x_includes@%$x_includes%g
-s%@x_libraries@%$x_libraries%g
-s%@LIBOBJS@%$LIBOBJS%g
-s%@LD@%$LD%g
-s%@LDCOMBINEFLAGS@%$LDCOMBINEFLAGS%g
+s%@RANLIB@%$RANLIB%g
 s%@WINE_INI_GLOBAL@%$WINE_INI_GLOBAL%g
+/@MAKE_RULES@/r $MAKE_RULES
+s%@MAKE_RULES@%%g
 
 CEOF
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"controls/Makefile ipc/Makefile loader/Makefile memory/Makefile misc/Makefile miscemu/Makefile multimedia/Makefile objects/Makefile windows/Makefile rc/Makefile debugger/Makefile debugger/readline/Makefile tools/Makefile if1632/Makefile Makefile autoconf.h"}
+CONFIG_FILES=\${CONFIG_FILES-"Make.rules controls/Makefile ipc/Makefile loader/Makefile memory/Makefile misc/Makefile miscemu/Makefile multimedia/Makefile objects/Makefile windows/Makefile rc/Makefile debugger/Makefile debugger/readline/Makefile tools/Makefile if1632/Makefile toolkit/Makefile Makefile"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/configure.in b/configure.in
index 71aac5c..5154cd7 100644
--- a/configure.in
+++ b/configure.in
@@ -8,38 +8,35 @@
 test -z "$CFLAGS" && CFLAGS="-g -O2 -Wall" AC_SUBST(CFLAGS)
 test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)
 
+dnl **** Command-line arguments ****
+
+AC_ARG_WITH(library,
+[  --with-library          build Wine as a library instead of an emulator],
+[AC_DEFINE(WINELIB) MAIN_TARGET="winelib.a"],[MAIN_TARGET="wine"])
+AC_SUBST(MAIN_TARGET)
+
 AC_ARG_WITH(language,
-[  --with-language=LANG    change the default language (LANG=En/De/No)],
+[  --with-language=LANG    change the default language (LANG=En/De/No/Es)],
 [LANG="-ALANG\($withval\)"],
 [LANG="-ALANG\(En\)"],)
 AC_SUBST(LANG)
+
 AC_ARG_WITH(ipc,
 [  --with-ipc              use inter-process communication for DDE],
 [AC_DEFINE(CONFIG_IPC)])
+
 AC_ARG_WITH(malloc-debug,
 [  --with-malloc-debug     enable malloc() debugging],
 [AC_DEFINE(MALLOC_DEBUGGING)])
 
+dnl **** Check for some programs ****
+
 AC_PROG_MAKE_SET
 AC_PROG_CC
-AC_PATH_X
+AC_PATH_XTRA
 AC_PROG_YACC
 AC_PROG_LEX
-if test -n "$x_includes" ; then
-  x_includes="-I$x_includes"
-fi
-if test -n "$x_no" ; then
-  AXFILES='AXFILES='
-fi
-AC_SUBST(AXFILES)
-AC_SUBST(x_includes)
-AC_SUBST(x_libraries)
-AC_SUBST(LIBOBJS)
-
-LD=ld
-LDCOMBINEFLAGS="-r"
-AC_SUBST(LD)
-AC_SUBST(LDCOMBINEFLAGS)
+AC_PROG_RANLIB
 
 AC_CHECK_FUNCS(tcgetattr)
 AC_CHECK_HEADERS(stdlib.h)
@@ -75,8 +72,12 @@
 fi
 fi
 AC_SUBST(WINE_INI_GLOBAL)
+AC_DEFINE_UNQUOTED(WINE_INI_GLOBAL,$WINE_INI_GLOBAL)
 
-AC_OUTPUT(controls/Makefile ipc/Makefile loader/Makefile memory/Makefile misc/Makefile miscemu/Makefile multimedia/Makefile objects/Makefile windows/Makefile rc/Makefile debugger/Makefile debugger/readline/Makefile tools/Makefile if1632/Makefile Makefile autoconf.h)
+MAKE_RULES=$TOP_SRCDIR/Make.rules
+AC_SUBST_FILE(MAKE_RULES)
+
+AC_OUTPUT(Make.rules controls/Makefile ipc/Makefile loader/Makefile memory/Makefile misc/Makefile miscemu/Makefile multimedia/Makefile objects/Makefile windows/Makefile rc/Makefile debugger/Makefile debugger/readline/Makefile tools/Makefile if1632/Makefile toolkit/Makefile Makefile)
 
 echo
 echo "Configure finished.  Do 'make depend; make' to compile Wine."
diff --git a/controls/Makefile.in b/controls/Makefile.in
index 02cbb3b..3b018a4 100644
--- a/controls/Makefile.in
+++ b/controls/Makefile.in
@@ -1,39 +1,20 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
 TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD      = @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
 
 MODULE 	= controls
 
-SRCS 	= button.c combo.c desktop.c edit.c listbox.c menu.c scroll.c \
-	static.c widgets.c
-
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
+C_SRCS = \
+	button.c \
+	combo.c \
+	desktop.c \
+	edit.c \
+	listbox.c \
+	menu.c \
+	scroll.c \
+	static.c \
+	widgets.c
 
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/controls/combo.c b/controls/combo.c
index 1600a23..77374cd 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -14,13 +14,14 @@
 #include "windows.h"
 #include "sysmetrics.h"
 #include "combo.h"
+#include "stackframe.h"
 #include "user.h"
 #include "win.h"
-#include "stddebug.h"
-#include "debug.h"
 #include "graphics.h"
 #include "listbox.h"
 #include "dos_fs.h"
+#include "stddebug.h"
+#include "debug.h"
 
  /*
   * Note: Combos are probably implemented in a different way by Windows.
@@ -127,7 +128,7 @@
     dprintf_combo(stddeb,"CBS_SIMPLE\n");
     SetRectEmpty(&lphc->RectButton);
     lphc->LBoxTop = lphl->StdItemHeight;
-    lphc->hWndEdit = CreateWindow(editName, "", 
+    lphc->hWndEdit = CreateWindow(MAKE_SEGPTR(editName), (SEGPTR)0, 
 				  WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
 				  0, 0, rect.right, lphl->StdItemHeight,
 				  hwnd, 1, GetWindowWord(hwnd,GWW_HINSTANCE), 0L);
@@ -141,7 +142,7 @@
     SetWindowPos(hwnd, 0, 0, 0, rect.right - rect.left + 2*SYSMETRICS_CXBORDER,
 		 lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER,
 		 SWP_NOMOVE | SWP_NOZORDER);
-    lphc->hWndEdit = CreateWindow(editName, "",
+    lphc->hWndEdit = CreateWindow(MAKE_SEGPTR(editName), (SEGPTR)0,
 				  WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
 				  0, 0, lphc->RectButton.left, lphl->StdItemHeight,
 				  hwnd, 1, GetWindowWord(hwnd,GWW_HINSTANCE), 0L);
@@ -161,7 +162,7 @@
   /* FIXME: WinSight says these should be CHILD windows with the TOPMOST flag
    * set. Wine doesn't support TOPMOST, and simply setting the WS_CHILD
    * flag doesn't work. */
-  lphc->hWndLBox = CreateWindow(className, "", 
+  lphc->hWndLBox = CreateWindow(MAKE_SEGPTR(className), (SEGPTR)0, 
 				WS_POPUP | WS_BORDER | WS_VSCROLL,
 				lboxrect.left, lboxrect.top,
 				lboxrect.right - lboxrect.left, 
diff --git a/controls/menu.c b/controls/menu.c
index 598de3a..250f424 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -29,6 +29,7 @@
 /* #define DEBUG_MENUSHORTCUT */
 #include "debug.h"
 
+#include "../rc/sysres.h"
 
   /* Dimension of the menu bitmaps */
 static WORD check_bitmap_width = 0, check_bitmap_height = 0;
@@ -673,7 +674,7 @@
     {
 	WND *wndPtr = WIN_FindWndPtr( hwndOwner );
 	if (!wndPtr) return FALSE;
-	menu->hWnd = CreateWindow( (LPSTR)POPUPMENU_CLASS_ATOM, "",
+	menu->hWnd = CreateWindow( POPUPMENU_CLASS_ATOM, (SEGPTR)0,
 				   WS_POPUP | WS_BORDER, x, y, 
 				   menu->Width + 2*SYSMETRICS_CXBORDER,
 				   menu->Height + 2*SYSMETRICS_CYBORDER,
@@ -732,18 +733,25 @@
     if (lppop->FocusedItem != NO_SELECTED_ITEM) 
     {
 	if (lppop->FocusedItem == SYSMENU_SELECTED)
+        {
 	    NC_DrawSysButton( lppop->hWnd, hdc, TRUE );
+            SendMessage( hwndOwner, WM_MENUSELECT,
+                         GetSystemMenu( lppop->hWnd, FALSE ),
+                         MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) );
+        }
 	else
 	{
 	    items[lppop->FocusedItem].item_flags |= MF_HILITE;
 	    MENU_DrawMenuItem( lppop->hWnd, hdc, &items[lppop->FocusedItem], lppop->Height,
 			       !(lppop->wFlags & MF_POPUP) );
-	    dprintf_menu(stddeb,"Sending WM_MENUSELECT %04x %04x\n", items[lppop->FocusedItem].item_id,items[lppop->FocusedItem].item_flags);
 	    SendMessage( hwndOwner, WM_MENUSELECT,
                          items[lppop->FocusedItem].item_id,
 		         MAKELONG( items[lppop->FocusedItem].item_flags | MF_MOUSESELECT, hmenu));
 	}
     }
+    else SendMessage( hwndOwner, WM_MENUSELECT, hmenu,
+                      MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) );
+
     ReleaseDC( lppop->hWnd, hdc );
 }
 
@@ -1399,6 +1407,7 @@
 {
     WND *wndPtr = WIN_FindWndPtr( hwnd );
     SendMessage( hwnd, WM_ENTERMENULOOP, 0, 0 );
+    SendMessage( hwnd, WM_INITMENU, wndPtr->wIDmenu, 0 );
     MENU_TrackMenu( (HMENU)wndPtr->wIDmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
 		    pt.x, pt.y, hwnd, NULL );
     SendMessage( hwnd, WM_EXITMENULOOP, 0, 0 );
@@ -1415,6 +1424,7 @@
     WND *wndPtr = WIN_FindWndPtr( hwnd );
     if (!wndPtr->wIDmenu) return;
     SendMessage( hwnd, WM_ENTERMENULOOP, 0, 0 );
+    SendMessage( hwnd, WM_INITMENU, wndPtr->wIDmenu, 0 );
       /* Select first selectable item */
     MENU_SelectItem( hwnd, wndPtr->wIDmenu, NO_SELECTED_ITEM );
     MENU_SelectNextItem( hwnd, (HMENU)wndPtr->wIDmenu );
@@ -1425,7 +1435,7 @@
 
 
 /**********************************************************************
- *			TrackPopupMenu		[USER.416]
+ *           TrackPopupMenu   (USER.416)
  */
 BOOL TrackPopupMenu( HMENU hMenu, WORD wFlags, short x, short y,
 		     short nReserved, HWND hWnd, LPRECT lpRect )
@@ -1932,28 +1942,29 @@
  */
 BOOL DestroyMenu(HMENU hMenu)
 {
-	LPPOPUPMENU lppop;
-	dprintf_menu(stddeb,"DestroyMenu (%04X) !\n", hMenu);
-	if (hMenu == 0) return FALSE;
-	lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
-	if (lppop == NULL) return FALSE;
-	if ((lppop->wFlags & MF_POPUP) && lppop->hWnd)
-            DestroyWindow( lppop->hWnd );
+    LPPOPUPMENU lppop;
+    dprintf_menu(stddeb,"DestroyMenu (%04X) !\n", hMenu);
+    if (hMenu == 0) return FALSE;
+    lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
+    if (!lppop || (lppop->wMagic != MENU_MAGIC)) return FALSE;
+    lppop->wMagic = 0;  /* Mark it as destroyed */
+    if ((lppop->wFlags & MF_POPUP) && lppop->hWnd)
+        DestroyWindow( lppop->hWnd );
 
-	if (lppop->hItems)
-	{
-	    int i;
-	    MENUITEM *item = (MENUITEM *) USER_HEAP_LIN_ADDR( lppop->hItems );
-	    for (i = lppop->nItems; i > 0; i--, item++)
-	    {
-		if (item->item_flags & MF_POPUP)
-		    DestroyMenu( item->item_id );
-	    }
-	    USER_HEAP_FREE( lppop->hItems );
-	}
-	USER_HEAP_FREE( hMenu );
-	dprintf_menu(stddeb,"DestroyMenu (%04X) // End !\n", hMenu);
-	return TRUE;
+    if (lppop->hItems)
+    {
+        int i;
+        MENUITEM *item = (MENUITEM *) USER_HEAP_LIN_ADDR( lppop->hItems );
+        for (i = lppop->nItems; i > 0; i--, item++)
+        {
+            if (item->item_flags & MF_POPUP)
+                DestroyMenu( item->item_id );
+        }
+        USER_HEAP_FREE( lppop->hItems );
+    }
+    USER_HEAP_FREE( hMenu );
+    dprintf_menu(stddeb,"DestroyMenu (%04X) // End !\n", hMenu);
+    return TRUE;
 }
 
 /**********************************************************************
@@ -2137,10 +2148,10 @@
 {
     HMENU hMenu;
     LPPOPUPMENU menu;
-    extern unsigned char sysres_MENU_SYSMENU[];
 
-    hMenu=LoadMenuIndirect(sysres_MENU_SYSMENU);
-    if(!hMenu){
+    hMenu = LoadMenuIndirect( sysres_MENU_SYSMENU.bytes );
+    if(!hMenu)
+    {
 	dprintf_menu(stddeb,"No SYSMENU\n");
 	return 0;
     }
diff --git a/controls/scroll.c b/controls/scroll.c
index 11b8e20..230b7b4 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -593,12 +593,14 @@
                            (hittest == trackHitTest), FALSE );
         if (hittest == trackHitTest)
         {
-            SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
-                            SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
-                            (FARPROC)0 );
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
+            {
+                SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
+                                SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
+                                (FARPROC)0 );
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_LINEUP, MAKELONG( 0, hwndCtl ));
+            }
         }
         else KillSystemTimer( hwnd, SCROLL_TIMER );
         break;
@@ -609,12 +611,14 @@
                              (hittest == trackHitTest), FALSE );
         if (hittest == trackHitTest)
         {
-            SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
-                            SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
-                            (FARPROC)0 );
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
+            {
+                SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
+                                SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
+                                (FARPROC)0 );
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_PAGEUP, MAKELONG( 0, hwndCtl ));
+            }
         }
         else KillSystemTimer( hwnd, SCROLL_TIMER );
         break;
@@ -653,12 +657,14 @@
                              FALSE, (hittest == trackHitTest) );
         if (hittest == trackHitTest)
         {
-            SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
-                            SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
-                            (FARPROC)0 );
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
+            {
+                SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
+                                SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
+                                (FARPROC)0 );
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_PAGEDOWN, MAKELONG( 0, hwndCtl ));
+            }
         }
         else KillSystemTimer( hwnd, SCROLL_TIMER );
         break;
@@ -668,12 +674,14 @@
                            FALSE, (hittest == trackHitTest) );
         if (hittest == trackHitTest)
         {
-            SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
-                            SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
-                            (FARPROC)0 );
             if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
+            {
+                SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
+                                SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
+                                (FARPROC)0 );
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_LINEDOWN, MAKELONG( 0, hwndCtl ));
+            }
         }
         else KillSystemTimer( hwnd, SCROLL_TIMER );
         break;
diff --git a/controls/widgets.c b/controls/widgets.c
index cd04b2b..34d678a 100644
--- a/controls/widgets.c
+++ b/controls/widgets.c
@@ -14,6 +14,8 @@
 #include "user.h"
 #include "selectors.h"
 #include "stackframe.h"
+#include "alias.h"
+#include "relay32.h"
 
 static WNDCLASS WIDGETS_BuiltinClasses[] =
 {
@@ -58,11 +60,20 @@
 
     for (i = 0; i < NB_BUILTIN_CLASSES; i++, class++)
     {
+        DWORD WineProc,Win16Proc,Win32Proc;
+        /* currently, there is no way to get the 'real' pointer at run time */
+        WineProc=0;
+        Win16Proc = GetWndProcEntry16( (char *)class->lpfnWndProc );
+        Win32Proc = (DWORD)RELAY32_GetEntryPoint(
+             "WINPROCS32",(char *)class->lpfnWndProc, 0);
+        /* Register the alias so we don't pass Win16 pointers to Win32 apps */
+        ALIAS_RegisterAlias(WineProc,Win16Proc,Win32Proc);
+
         strcpy( name, (char *)class->lpszClassName );
         class->lpszClassName = MAKE_SEGPTR(name);
-	class->hCursor = LoadCursor( 0, IDC_ARROW );
+        class->hCursor = LoadCursor( 0, IDC_ARROW );
         class->lpfnWndProc = GetWndProcEntry16( (char *)class->lpfnWndProc );
-	if (!RegisterClass( class )) return FALSE;
+        if (!RegisterClass( class )) return FALSE;
     }
     return TRUE;
 }
diff --git a/debugger/Makefile.in b/debugger/Makefile.in
index 75b0316..c91b01e 100644
--- a/debugger/Makefile.in
+++ b/debugger/Makefile.in
@@ -1,58 +1,30 @@
-CC	= @CC@
-CFLAGS	= @CFLAGS@
-TOPSRC	= @top_srcdir@
-DIVINCL	= -I$(TOPSRC)/include
-BISON	= @YACC@
-FLEX	= @LEX@
-DIVDEFS	= -DUSE_READLINE
-COMPILE	= $(CC) $(CFLAGS) $(DIVINCL) $(DIVDEFS)
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
-@SET_MAKE@
+TOPSRC     = @top_srcdir@
+EXTRA_DEFS = -DUSE_READLINE
 
+MODULE = debugger
 
-MODULE	= debugger
+C_SRCS = \
+	break.c \
+	db_disasm.c \
+	hash.c \
+	info.c \
+	memory.c \
+	registers.c \
+	stack.c \
+	y.tab.c \
+	lex.yy.c
 
-SRCS	= break.c db_disasm.c hash.c info.c memory.c registers.c stack.c
+all: $(MODULE).o
 
-OBJS = $(SRCS:.c=.o) dbg.tab.o lex.yy.o
+@MAKE_RULES@
 
-all: $(MODULE).o dbg.tab.o lex.yy.o
+y.tab.c y.tab.h: dbg.y
+	$(YACC) -d -t dbg.y
 
-dbg.tab.c dbg.tab.h: dbg.y
-	$(BISON) -b dbg -d dbg.y
+lex.yy.c: debug.l
+	$(LEX) -8 -I debug.l
 
-lex.yy.c: debug.l dbg.tab.h
-	$(FLEX) -8 -I debug.l
-
-.c.o:
-	$(COMPILE) -c -o $*.o $<
- 
-$(MODULE).o: $(OBJS) readline
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) readline/readline.o -o $(MODULE).o
-
-readline: dummy
-	cd readline; $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'LD=$(LD)' 'LDCOMBINEFLAGS=$(LDCOMBINEFLAGS)'
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	(cd readline; $(MAKE) clean)
-	rm -f *.o \#*\# *~ *.bak tmp_make
-	rm -f dbg.tab.c dbg.tab.h lex.yy.c y.tab.c y.tab.h
-
-distclean:
-	(cd readline; $(MAKE) distclean)
-	rm -f *.o \#*\# *~ *.bak dbg.tab.c dbg.tab.h lex.yy.c y.tab.c y.tab.h tmp_make Makefile
-
-countryclean:
-
-dbg.tab.o: dbg.tab.c
-lex.yy.o: lex.yy.c
- 
-dummy:
+clean::
+	rm -f y.tab.c y.tab.h lex.yy.c
 
 ### Dependencies:
diff --git a/debugger/dbg.y b/debugger/dbg.y
index 24bde0c..5aa6780 100644
--- a/debugger/dbg.y
+++ b/debugger/dbg.y
@@ -65,6 +65,7 @@
 	| ENABLE NUM '\n'       { DEBUG_EnableBreakpoint( $2, TRUE ); }
 	| DISABLE NUM '\n'      { DEBUG_EnableBreakpoint( $2, FALSE ); }
 	| BREAK '*' addr '\n'   { DEBUG_AddBreakpoint( &$3 ); }
+        | BREAK symbol '\n'     { DEBUG_AddBreakpoint( &$2 ); }
         | BREAK '\n'            { DBG_ADDR addr = { CS_reg(DEBUG_context),
                                                     EIP_reg(DEBUG_context) };
                                   DEBUG_AddBreakpoint( &addr );
@@ -140,7 +141,7 @@
     char SymbolTableFile[256];
     int instr_len = 0, newmode;
 #ifdef YYDEBUG
-    yydebug = 1;
+    yydebug = 0;
 #endif
 
     yyin = stdin;
diff --git a/debugger/debug.l b/debugger/debug.l
index af11db4..29321e7 100644
--- a/debugger/debug.l
+++ b/debugger/debug.l
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "debugger.h"
-#include "dbg.tab.h"
+#include "y.tab.h"
 
 #ifdef USE_READLINE
 #undef YY_INPUT
diff --git a/debugger/readline/Makefile.in b/debugger/readline/Makefile.in
index 873f3d2..d3b0cad 100644
--- a/debugger/readline/Makefile.in
+++ b/debugger/readline/Makefile.in
@@ -1,41 +1,12 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-DEFS    = @DEFS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
-DIVDEFS	= $(DEFS) -DHIDE -DANSI_ARROWS
+TOPSRC     = @top_srcdir@
+EXTRA_DEFS = -DHIDE -DANSI_ARROWS
 
+MODULE = readline
 
-MODULE 	= readline
-
-SRCS 	= editline.c sysunix.c
-
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(DIVDEFS) $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
+C_SRCS = editline.c sysunix.c
 
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/if1632/Imakefile b/if1632/Imakefile
index 6e32cab..8eb6c1e 100644
--- a/if1632/Imakefile
+++ b/if1632/Imakefile
@@ -43,6 +43,8 @@
 	winprocs.spec \
 	winsock.spec
 DLLS32 = \
+	advapi32.spec \
+	comdlg32.spec \
 	gdi32.spec \
 	kernel32.spec \
 	shell32.spec \
diff --git a/if1632/Makefile.in b/if1632/Makefile.in
index 4eab62c..52e0a18 100644
--- a/if1632/Makefile.in
+++ b/if1632/Makefile.in
@@ -1,17 +1,7 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
-BUILD	= $(TOPSRC)/tools/build
-@SET_MAKE@
+TOPSRC = @top_srcdir@
+BUILD  = $(TOPSRC)/tools/build
 
-
-MODULE 	= if1632
-
-SRCS 	= callback.c relay.c relay32.c
+MODULE = if1632
 
 DLLS16	= commdlg.spec compobj.spec ddeml.spec gdi.spec kernel.spec \
 	keyboard.spec mmsystem.spec mouse.spec ole2.spec ole2conv.spec \
@@ -19,22 +9,24 @@
 	shell.spec sound.spec storage.spec stress.spec system.spec \
 	toolhelp.spec user.spec win87em.spec winprocs.spec winsock.spec
 
-DLLS32	= gdi32.spec kernel32.spec shell32.spec user32.spec winprocs32.spec
-
-
-OBJS = $(SRCS:.c=.o) $(DLLS16:.spec=.o) $(DLLS32:.spec=.o) call16.o call32.o
+DLLS32	= advapi32.spec comdlg32.spec gdi32.spec kernel32.spec shell32.spec user32.spec winprocs32.spec
 
 SPEC16_FILES = $(DLLS16:.spec=.S)
 SPEC32_FILES = $(DLLS32:.spec=.c)
 
+C_SRCS = \
+	$(SPEC32_FILES) \
+	callback.c \
+	relay.c \
+	relay32.c
+
+ASM_SRCS = \
+	$(SPEC16_FILES) \
+	call16.S \
+	call32.S
+
 .SUFFIXES: .spec
 
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
-
-.S.o:
-	$(CC) -c -o $*.o $<  
-
 .spec.S:
 	$(BUILD) -spec16 $< > $*.S
 
@@ -43,10 +35,12 @@
 
 all: checkbuild $(MODULE).o
 
-$(SPEC16_FILES) $(SPEC32_FILES): $(TOPSRC)/tools/build
+@MAKE_RULES@
 
-checkbuild:
-	cd $(TOPSRC)/tools; $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'LD=$(LD)' 'LDCOMBINEFLAGS=$(LDCOMBINEFLAGS)' build
+$(SPEC16_FILES) $(SPEC32_FILES): $(BUILD)
+
+$(BUILD) checkbuild:
+	cd $(TOPSRC)/tools; $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)' 'LANG=$(LANG)' build
 
 call16.S: $(TOPSRC)/include/callback.h $(BUILD)
 	$(BUILD) -call16 `cat $(TOPSRC)/include/callback.h | grep "extern.*CallTo16_" | sed 's/.*CallTo16_\(.*\)(.*/\1/' | sort | uniq` > call16.S
@@ -54,23 +48,7 @@
 call32.S: $(SPEC16_FILES)
 	$(BUILD) -call32 `cat $(SPEC16_FILES) | grep CallTo32_ | sed 's/.*CallTo32_\(.*\)/\1/' | sort | uniq` > call32.S
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM $(SRCS) >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-	rm -f $(DLLS16:.spec=.S) $(DLLS32:.spec=.c) call32.S call16.S
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+clean::
+	rm -f $(SPEC16_FILES) $(SPEC32_FILES) call32.S call16.S
 
 ### Dependencies:
diff --git a/if1632/advapi32.spec b/if1632/advapi32.spec
new file mode 100644
index 0000000..8e33899
--- /dev/null
+++ b/if1632/advapi32.spec
@@ -0,0 +1,204 @@
+name	advapi32
+base	1
+
+0000 stub AbortSystemShutdownA
+0001 stub AbortSystemShutdownW
+0002 stub AccessCheck
+0003 stub AccessCheckAndAuditAlarmA
+0004 stub AccessCheckAndAuditAlarmW
+0005 stub AddAccessAllowedAce
+0006 stub AddAccessDeniedAce
+0007 stub AddAce
+0008 stub AddAuditAccessAce
+0009 stub AdjustTokenGroups
+0010 stub AdjustTokenPrivileges
+0011 stub AllocateAndInitializeSid
+0012 stub AllocateLocallyUniqueId
+0013 stub AreAllAccessesGranted
+0014 stub AreAnyAccessesGranted
+0015 stub BackupEventLogA
+0016 stub BackupEventLogW
+0017 stub ChangeServiceConfigA
+0018 stub ChangeServiceConfigW
+0019 stub ClearEventLogA
+0020 stub ClearEventLogW
+0021 stub CloseEventLog
+0022 stub CloseServiceHandle
+0023 stub ControlService
+0024 stub CopySid
+0025 stub CreatePrivateObjectSecurity
+0026 stub CreateProcessAsUserA
+0027 stub CreateProcessAsUserW
+0028 stub CreateServiceA
+0029 stub CreateServiceW
+0030 stub DeleteAce
+0031 stub DeleteService
+0032 stub DeregisterEventSource
+0033 stub DestroyPrivateObjectSecurity
+0034 stub DuplicateToken
+0035 stub EnumDependentServicesA
+0036 stub EnumDependentServicesW
+0037 stub EnumServicesStatusA
+0038 stub EnumServicesStatusW
+0039 stub EqualPrefixSid
+0040 stub EqualSid
+0041 stub FindFirstFreeAce
+0042 stub FreeSid
+0043 stub GetAce
+0044 stub GetAclInformation
+0045 stub GetFileSecurityA
+0046 stub GetFileSecurityW
+0047 stub GetKernelObjectSecurity
+0048 stub GetLengthSid
+0049 stub GetNumberOfEventLogRecords
+0050 stub GetOldestEventLogRecord
+0051 stub GetPrivateObjectSecurity
+0052 stub GetSecurityDescriptorControl
+0053 stub GetSecurityDescriptorDacl
+0054 stub GetSecurityDescriptorGroup
+0055 stub GetSecurityDescriptorLength
+0056 stub GetSecurityDescriptorOwner
+0057 stub GetSecurityDescriptorSacl
+0058 stub GetServiceDisplayNameA
+0059 stub GetServiceDisplayNameW
+0060 stub GetServiceKeyNameA
+0061 stub GetServiceKeyNameW
+0062 stub GetSidIdentifierAuthority
+0063 stub GetSidLengthRequired
+0064 stub GetSidSubAuthority
+0065 stub GetSidSubAuthorityCount
+0066 stub GetTokenInformation
+0067 stub GetUserNameA
+0068 stub GetUserNameW
+0069 stub ImpersonateLoggedOnUser
+0070 stub ImpersonateNamedPipeClient
+0071 stub ImpersonateSelf
+0072 stub InitializeAcl
+0073 stub InitializeSecurityDescriptor
+0074 stub InitializeSid
+0075 stub InitiateSystemShutdownA
+0076 stub InitiateSystemShutdownW
+0077 stub IsTextUnicode
+0078 stub IsValidAcl
+0079 stub IsValidSecurityDescriptor
+0080 stub IsValidSid
+0081 stub LockServiceDatabase
+0082 stub LogonUserA
+0083 stub LogonUserW
+0084 stub LookupAccountNameA
+0085 stub LookupAccountNameW
+0086 stub LookupAccountSidA
+0087 stub LookupAccountSidW
+0088 stub LookupPrivilegeDisplayNameA
+0089 stub LookupPrivilegeDisplayNameW
+0090 stub LookupPrivilegeNameA
+0091 stub LookupPrivilegeNameW
+0092 stub LookupPrivilegeValueA
+0093 stub LookupPrivilegeValueW
+0094 stub MakeAbsoluteSD
+0095 stub MakeSelfRelativeSD
+0096 stub MapGenericMask
+0097 stub NotifyBootConfigStatus
+0098 stub NotifyChangeEventLog
+0099 stub ObjectCloseAuditAlarmA
+0100 stub ObjectCloseAuditAlarmW
+0101 stub ObjectOpenAuditAlarmA
+0102 stub ObjectOpenAuditAlarmW
+0103 stub ObjectPrivilegeAuditAlarmA
+0104 stub ObjectPrivilegeAuditAlarmW
+0105 stub OpenBackupEventLogA
+0106 stub OpenBackupEventLogW
+0107 stub OpenEventLogA
+0108 stub OpenEventLogW
+0109 stub OpenProcessToken
+0110 stub OpenSCManagerA
+0111 stub OpenSCManagerW
+0112 stub OpenServiceA
+0113 stub OpenServiceW
+0114 stub OpenThreadToken
+0115 stub PrivilegeCheck
+0116 stub PrivilegedServiceAuditAlarmA
+0117 stub PrivilegedServiceAuditAlarmW
+0118 stub QueryServiceConfigA
+0119 stub QueryServiceConfigW
+0120 stub QueryServiceLockStatusA
+0121 stub QueryServiceLockStatusW
+0122 stub QueryServiceObjectSecurity
+0123 stub QueryServiceStatus
+0124 stub ReadEventLogA
+0125 stub ReadEventLogW
+0126 stub RegCloseKey
+0127 stub RegConnectRegistryA
+0128 stub RegConnectRegistryW
+0129 stub RegCreateKeyA
+0130 stub RegCreateKeyExA
+0131 stub RegCreateKeyExW
+0132 stub RegCreateKeyW
+0133 stub RegDeleteKeyA
+0134 stub RegDeleteKeyW
+0135 stub RegDeleteValueA
+0136 stub RegDeleteValueW
+0137 stub RegEnumKeyA
+0138 stub RegEnumKeyExA
+0139 stub RegEnumKeyExW
+0140 stub RegEnumKeyW
+0141 stub RegEnumValueA
+0142 stub RegEnumValueW
+0143 stub RegFlushKey
+0144 stub RegGetKeySecurity
+0145 stub RegLoadKeyA
+0146 stub RegLoadKeyW
+0147 stub RegNotifyChangeKeyValue
+0148 stub RegOpenKeyA
+0149 stub RegOpenKeyExA
+0150 stub RegOpenKeyExW
+0151 stub RegOpenKeyW
+0152 stub RegQueryInfoKeyA
+0153 stub RegQueryInfoKeyW
+0154 stub RegQueryMultipleValuesA
+0155 stub RegQueryMultipleValuesW
+0156 stub RegQueryValueA
+0157 stub RegQueryValueExA
+0158 stub RegQueryValueExW
+0159 stub RegQueryValueW
+0160 stub RegRemapPreDefKey
+0161 stub RegReplaceKeyA
+0162 stub RegReplaceKeyW
+0163 stub RegRestoreKeyA
+0164 stub RegRestoreKeyW
+0165 stub RegSaveKeyA
+0166 stub RegSaveKeyW
+0167 stub RegSetKeySecurity
+0168 stub RegSetValueA
+0169 stub RegSetValueExA
+0170 stub RegSetValueExW
+0171 stub RegSetValueW
+0172 stub RegUnLoadKeyA
+0173 stub RegUnLoadKeyW
+0174 stub RegisterEventSourceA
+0175 stub RegisterEventSourceW
+0176 stub RegisterServiceCtrlHandlerA
+0177 stub RegisterServiceCtrlHandlerW
+0178 stub ReportEventA
+0179 stub ReportEventW
+0180 stub RevertToSelf
+0181 stub SetAclInformation
+0182 stub SetFileSecurityA
+0183 stub SetFileSecurityW
+0184 stub SetKernelObjectSecurity
+0185 stub SetPrivateObjectSecurity
+0186 stub SetSecurityDescriptorDacl
+0187 stub SetSecurityDescriptorGroup
+0188 stub SetSecurityDescriptorOwner
+0189 stub SetSecurityDescriptorSacl
+0190 stub SetServiceBits
+0191 stub SetServiceObjectSecurity
+0192 stub SetServiceStatus
+0193 stub SetThreadToken
+0194 stub SetTokenInformation
+0195 stub StartServiceA
+0196 stub StartServiceCtrlDispatcherA
+0197 stub StartServiceCtrlDispatcherW
+0198 stub StartServiceW
+0199 stub UnlockServiceDatabase
+
diff --git a/if1632/callback.c b/if1632/callback.c
index c60f46a..1cc1fde 100644
--- a/if1632/callback.c
+++ b/if1632/callback.c
@@ -10,23 +10,35 @@
 #include "callback.h"
 #include "stackframe.h"
 #include "win.h"
+#include "alias.h"
+#include "relay32.h"
 #include "stddebug.h"
 #include "debug.h"
 
 
-
 /**********************************************************************
  *	     CallWindowProc    (USER.122)
  */
 LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message,
 		     WORD wParam, LONG lParam )
 {
+    FUNCTIONALIAS *a;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
 
     if (!wndPtr) return 0;
     SpyMessage(hwnd, message, wParam, lParam);
-    return CallWndProc( (FARPROC)func, wndPtr->hInstance, 
+
+    /* check if we have something better than 16 bit relays */
+    if(!ALIAS_UseAliases || !(a=ALIAS_LookupAlias((DWORD)func)) ||
+        (!a->wine && !a->win32))
+        return CallWndProc( (FARPROC)func, wndPtr->hInstance, 
                         hwnd, message, wParam, lParam );
+    if(a->wine)
+        return ((LONG(*)(WORD,WORD,WORD,LONG))(a->wine))
+                            (hwnd,message,wParam,lParam);
+    if(!a->win32)
+        fprintf(stderr,"Where is the Win32 callback?\n");
+    return RELAY32_CallWindowProc(a->win32,hwnd,message,wParam,lParam);
 }
 
 
diff --git a/if1632/comdlg32.spec b/if1632/comdlg32.spec
new file mode 100644
index 0000000..7681ce3
--- /dev/null
+++ b/if1632/comdlg32.spec
@@ -0,0 +1,28 @@
+name	comdlg32
+base	1
+
+0000 stub ArrowBtnWndProc
+0001 stub ChooseColorA
+0002 stub ChooseColorW
+0003 stub ChooseFontA
+0004 stub ChooseFontW
+0005 stub CommDlgExtendedError
+0006 stub FindTextA
+0007 stub FindTextW
+0008 stub GetFileTitleA
+0009 stub GetFileTitleW
+0010 stub GetOpenFileNameA
+0011 stub GetOpenFileNameW
+0012 stub GetSaveFileNameA
+0013 stub GetSaveFileNameW
+0014 stub LoadAlterBitmap
+0015 stub PageSetupDlgA
+0016 stub PageSetupDlgW
+0017 stub PrintDlgA
+0018 stub PrintDlgW
+0019 stub ReplaceTextA
+0020 stub ReplaceTextW
+0021 stub WantArrows
+0022 stub dwLBSubclass
+0023 stub dwOKSubclass
+
diff --git a/if1632/gdi.spec b/if1632/gdi.spec
index 784ad66..2ea33f1 100644
--- a/if1632/gdi.spec
+++ b/if1632/gdi.spec
@@ -154,6 +154,7 @@
 179 pascal16 GetDCState(word) GetDCState
 180 pascal16 SetDCState(word word) SetDCState
 181 pascal16 RectInRegionOld(word ptr) RectInRegion
+188 stub GetTextExtentEx
 190 stub SetDCHook
 191 stub GetDCHook
 192 stub SetHookFlags
@@ -196,6 +197,17 @@
 250 pascal16 Copy(ptr ptr word) Copy
 253 stub DeleteSpoolPage
 254 stub SpoolFile
+267 stub StartDocPrintEra
+268 stub StartPagePrinter
+269 stub WritePrinter
+270 stub EndPagePrinter
+271 stub AbortPrinter
+272 stub EndDocPrinter
+274 stub ClosePrinter
+280 stub GetRealDriverInfo
+281 stub DrvSetPrinterData
+282 stub DrvGetPrinterData
+299 stub ENGINEGETCHARWIDTHEX
 300 stub ENGINEENUMERATEFONT
 301 stub ENGINEDELETEFONT
 302 stub ENGINEREALIZEFONT
@@ -211,6 +223,9 @@
 312 stub ConvertOutLineFontFile
 313 pascal16 GetRasterizerCaps(ptr word) GetRasterizerCaps
 314 stub EngineExtTextOut
+315 stub EngineRealizeFontExt
+316 stub EngineGetCharWidthStr
+317 stub EngineGetGlyphBmpExt
 330 pascal16 EnumFontFamilies(word ptr segptr long) EnumFontFamilies
 332 pascal16 GetKerningPairs(word word ptr) GetKerningPairs
 345 pascal16 GetTextAlign(word) GetTextAlign
@@ -223,6 +238,7 @@
 352 stub GetPhysicalFontHandle
 353 stub GetAspectRatioFilter
 354 stub ShrinkGDIHeap
+355 stub FTrapping0
 360 pascal16 CreatePalette(ptr) CreatePalette
 361 pascal16 GDISelectPalette(word word) GDISelectPalette
 362 pascal16 GDIRealizePalette(word) GDIRealizePalette
@@ -248,6 +264,7 @@
 400 pascal16 FastWindowFrame(word long word word long) FastWindowFrame
 401 stub GDIMOVEBITMAP
 403 stub GDIINIT2
+404 stub GetTTGlyphIndexMap
 405 stub FINALGDIINIT
 407 stub CREATEUSERBITMAP
 409 stub CREATEUSERDISCARDABLEBITMAP
@@ -296,4 +313,65 @@
              ScaleViewportExtEx
 485 pascal16 ScaleWindowExtEx(word s_word s_word s_word s_word ptr)
              ScaleWindowExtEx
-486 stub GETASPECTRATIOFILEREX
+486 stub GETASPECTRATIOFILTEREX
+489 stub CreateDIBSection
+490 stub CloseEnhMetafile
+491 stub CopyEnhMetafile
+492 stub CreateEnhMetafile
+493 stub DeleteEnhMetafile
+495 stub GDIComment
+496 stub GetEnhMetafile
+497 stub GetEnhMetafileBits
+498 stub GetEnhMetafileDescription
+499 stub GetEnhMetafileHeader
+501 stub GetEnhMetafilePaletteEntries
+502 stub PolyBezier
+503 stub PolyBezierTo
+504 stub PlayEnhMetafileRecord
+505 stub SetEnhMetafileBits
+506 stub SetMetaRgn
+508 stub ExtSelectClipRgn
+511 stub AbortPath
+512 stub BeginPath
+513 stub CloseFigure
+514 stub EndPath
+515 stub FillPath
+516 stub FlattenPath
+517 stub GetPath
+518 stub PathToRegion
+519 stub SelectClipPath
+520 stub StrokeAndFillPath
+521 stub StrokePath
+522 stub WidenPath
+523 stub ExtCreatePen
+524 stub GetArcDirection
+525 stub SetArcDirection
+526 stub GetMiterLimit
+527 stub SetMiterLimit
+528 stub GDIParametersInfo
+529 stub CreateHalftonePalette
+602 stub SetDIBColorTable
+603 stub GetDIBColorTable
+604 stub SetSolidBrush
+605 stub SysDeleteObject
+606 stub SetMagicColors
+607 stub GetRegionData
+608 stub ExtCreateRegion
+609 stub GDIFreeResources
+610 stub GDISignalProc32
+611 stub GetRandomRgn
+612 stub GetTextCharSet
+613 stub EnumFontFamiliesEx
+614 stub AddLpkToGDI
+615 stub GetCharacterPlacement
+616 stub GetFontLanguageInfo
+650 stub BuildInverseTableDIB
+701 stub GDITHKCONNECTIONDATALS
+702 stub FT_GDIFTHKTHKCONNECTIONDATA
+703 stub FDTHKCONNECTIONDATASL
+704 stub ICMTHKCONNECTIONDATASL
+820 stub ICMCreateTransform
+821 stub ICMDeleteTransform
+822 stub ICMTranslateRGB
+823 stub ICMTranslateRGBs
+824 stub ICMCheckCOlorsInGamut
diff --git a/if1632/gdi32.spec b/if1632/gdi32.spec
index 1e5b1f4..3ebcb86 100644
--- a/if1632/gdi32.spec
+++ b/if1632/gdi32.spec
@@ -221,7 +221,7 @@
 0217 stub GetRegionData
 0218 stub GetRelAbs
 0219 stub GetRgnBox
-0220 stub GetStockObject
+0220 stdcall GetStockObject(long)	GetStockObject
 0221 stub GetStretchBltMode
 0222 stub GetSystemPaletteEntries
 0223 stub GetSystemPaletteUse
@@ -356,7 +356,7 @@
 0352 stub StrokeAndFillPath
 0353 stub StrokePath
 0354 stub SwapBuffers
-0355 stub TextOutA
+0355 stdcall TextOutA(long long long ptr long) TextOut
 0356 stub TextOutW
 0357 stub UnloadNetworkFonts
 0358 stub UnrealizeObject
diff --git a/if1632/kernel.spec b/if1632/kernel.spec
index 78815bf..4cf8424 100644
--- a/if1632/kernel.spec
+++ b/if1632/kernel.spec
@@ -27,6 +27,7 @@
 24  pascal16 UnlockSegment(word) UnlockSegment
 25  pascal GlobalCompact(long) GlobalCompact
 26  pascal16 GlobalFreeAll(word) GlobalFreeAll
+27  stub GetModuleName
 28  stub GlobalMasterHandle
 29  pascal16 Yield() Yield
 30  pascal16 WaitEvent(word) WaitEvent
@@ -105,7 +106,7 @@
 107 pascal SetErrorMode(word) SetErrorMode
 108 stub SwitchStackTo
 109 stub SwitchStackBack
-110 stub PatchCodeHandle
+110 pascal16 PatchCodeHandle(word) PatchCodeHandle
 111 pascal GlobalWire(word) GlobalWire
 112 pascal16 GlobalUnWire(word) GlobalUnWire
 113 equate __AHSHIFT 3
@@ -139,6 +140,14 @@
 139 stub DoSignal
 140 stub SetSigHandler
 141 stub InitTask1
+142 stub GetProfileSectionNames
+143 stub GetPrivateProfileSectionNames
+144 stub CreateDirectory
+145 stub RemoveDirectory
+146 stub DeleteFile
+147 stub SetLastError
+148 stub GetLastError
+149 stub GetVersionEx
 150 pascal16 DirectedYield(word) DirectedYield
 151 stub WinOldApCall
 152 pascal16 GetNumTasks() GetNumTasks
@@ -196,6 +205,26 @@
 205 stub CVWBreak
 206 pascal16 AllocSelectorArray(word) AllocSelectorArray
 207 return IsDBCSLeadByte 2 0
+216 stub RegEnumKey
+217 stub RegOpenKey
+218 stub RegCreateKey
+219 stub RegDeleteValue
+220 stub RegCloseKey
+221 stub RegSetValue
+222 stub RegDeleteValue
+223 stub RegEnumValue
+224 stub RegQueryValue
+225 stub RegQueryValueEx
+226 stub RegSetValueEx
+227 stub RegFlushKey
+#228 K228
+#229 K229
+230 stub GlobalSmartPageLock
+231 stub GlobalSmartPageUnlock
+232 stub RegLoadKey
+233 stub RegUnloadKey
+234 stub RegSaveKey
+235 stub InvalidateNlsCache
 310 pascal16 LocalHandleDelta(word) LocalHandleDelta
 311 stub GetSetKernelDosProc
 314 stub DebugDefineSegment
@@ -230,9 +259,35 @@
 349 pascal16 _hread(word ptr long) _hread
 350 pascal16 _hwrite(word ptr long) _hwrite
 #351 BUNNY_351
+352 stub lstrcatn
 353 pascal lstrcpyn(segptr segptr word) lstrcpyn
 354 stub GetAppCompatFlags
 355 pascal16 GetWinDebugInfo(ptr word) GetWinDebugInfo
 356 pascal16 SetWinDebugInfo(ptr) SetWinDebugInfo
+360 stub OpenFileEx
+#361 PIGLET_361
 403 pascal16 FarSetOwner(word word) FarSetOwner
 404 pascal16 FarGetOwner(word) FarGetOwner
+406 stub WritePrivateProfileStruct
+407 stub GetPrivateProfileStruct
+411 stub GetCurrentDirectory
+412 stub SetCurrentDirectory
+413 stub FindFirstFile
+414 stub FindNextFile
+415 stub FindClose
+416 stub WritePrivateProfileSection
+417 stub WriteProfileSection
+418 stub GetPrivateProfileSection
+419 stub GetProfileSection
+420 stub GetFileAttributes
+421 stub SetFileAttributes
+422 stub GetDiskFreeSpace
+432 stub FileTimeToLocalFileTime
+491 stub RegisterServiceProcess
+513 stub LoadLibraryEx32W
+514 stub FreeLibrary32W
+515 stub GetProcAddress32W
+516 stub GetVDMPointer32W
+517 stub CallProc32W
+518 stub CallProcEx32W
+627 stub IsBadFlatReadWritePtr
diff --git a/if1632/relay.c b/if1632/relay.c
index 9322a25..d325ce8 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -98,7 +98,8 @@
 /***********************************************************************
  *           RELAY_DebugCall32
  */
-void RELAY_DebugCall32( int func_type, char *args )
+void RELAY_DebugCall32( int func_type, char *args,
+                        void *entry_point, int args32 )
 {
     STACK16FRAME *frame;
     struct dll_table_s *table;
@@ -154,7 +155,7 @@
 
     if (func_type == 2)  /* register function */
     {
-        struct sigcontext_struct *context = (struct sigcontext_struct *)args16;
+        struct sigcontext_struct *context = (struct sigcontext_struct *)&args32;
         printf( "     AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
                 AX_reg(context), BX_reg(context), CX_reg(context),
                 DX_reg(context), SI_reg(context), DI_reg(context),
@@ -166,7 +167,7 @@
 /***********************************************************************
  *           RELAY_DebugReturn
  */
-void RELAY_DebugReturn( int func_type, int ret_val )
+void RELAY_DebugReturn( int func_type, int ret_val, int args32 )
 {
     STACK16FRAME *frame;
     struct dll_table_s *table;
@@ -192,6 +193,13 @@
         break;
     case 2: /* regs */
         printf( "retval=none ds=%04x\n", frame->ds );
+        {
+            struct sigcontext_struct *context = (struct sigcontext_struct *)&args32;
+            printf( "     AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
+                    AX_reg(context), BX_reg(context), CX_reg(context),
+                    DX_reg(context), SI_reg(context), DI_reg(context),
+                    ES_reg(context), EFL_reg(context) );
+        }
         break;
     }
 }
diff --git a/if1632/relay32.c b/if1632/relay32.c
index 960d739..0d0630d 100644
--- a/if1632/relay32.c
+++ b/if1632/relay32.c
@@ -19,10 +19,21 @@
 
 WIN32_builtin	*WIN32_builtin_list;
 
+/* Functions are in generated code */
+void ADVAPI32_Init();
+void COMDLG32_Init();
+void GDI32_Init();
+void KERNEL32_Init();
+void SHELL32_Init();
+void USER32_Init();
+void WINPROCS32_Init();
+
 int RELAY32_Init(void)
 {
 #ifndef WINELIB
 	/* Add a call for each DLL */
+	ADVAPI32_Init();
+	COMDLG32_Init();
 	GDI32_Init();
 	KERNEL32_Init();
 	SHELL32_Init();
@@ -37,7 +48,7 @@
 {
 	WIN32_builtin *it;
 	for(it=WIN32_builtin_list;it;it=it->next)
-	if(strcmp(name,it->name)==0)
+	if(strcasecmp(name,it->name)==0)
 		return it;
 	return NULL;
 }
@@ -74,9 +85,10 @@
 		strcmp(item,dll->functions[hint].name)==0)
 		return dll->functions[hint].definition;
 	/* hint is incorrect, search for name */
-	for(i=1;i<dll->size;i++)
-		if(strcmp(item,dll->functions[i].name)==0)
-			return dll->functions[i].definition;
+	for(i=0;i<dll->size;i++)
+            if (dll->functions[i].name && !strcmp(item,dll->functions[i].name))
+                return dll->functions[i].definition;
+
 	/* function at hint has no name (unimplemented) */
 	if(hint && hint<dll->size && !dll->functions[hint].name)
 	{
diff --git a/if1632/user.spec b/if1632/user.spec
index 72f2b7f..dd82aee 100644
--- a/if1632/user.spec
+++ b/if1632/user.spec
@@ -39,7 +39,7 @@
 38  pascal16 GetWindowTextLength(word) GetWindowTextLength
 39  pascal16 BeginPaint(word ptr) BeginPaint
 40  pascal16 EndPaint(word ptr) EndPaint
-41  pascal16 CreateWindow(ptr ptr long s_word s_word s_word s_word
+41  pascal16 CreateWindow(segptr segptr long s_word s_word s_word s_word
 	                  word word word segptr) CreateWindow
 42  pascal16 ShowWindow(word word) ShowWindow
 43  pascal16 CloseWindow(word) CloseWindow
@@ -116,6 +116,7 @@
 115 stub ReplyMessage
 116 pascal16 PostAppMessage(word word word long) PostAppMessage
 118 pascal16 RegisterWindowMessage(long) RegisterWindowMessage
+117 stub WindowFromDC
 119 pascal   GetMessagePos() GetMessagePos
 120 pascal   GetMessageTime() GetMessageTime
 121 pascal   SetWindowsHook(s_word segptr) SetWindowsHook
@@ -217,7 +218,7 @@
 #216 USERSEEUSERDO
 217 pascal16 LookupMenuHandle(word s_word) LookupMenuHandle
 218 pascal16 DialogBoxIndirect(word word word segptr) DialogBoxIndirect
-219 pascal16 CreateDialogIndirect(word ptr word segptr) CreateDialogIndirect
+219 pascal16 CreateDialogIndirect(word segptr word segptr) CreateDialogIndirect
 220 pascal16 LoadMenuIndirect(ptr) LoadMenuIndirect
 221 pascal16 ScrollDC(word s_word s_word ptr ptr word ptr) ScrollDC
 222 pascal16 GetKeyboardState(ptr) GetKeyboardState
@@ -241,7 +242,7 @@
 240 pascal16 DialogBoxIndirectParam(word word word segptr long)
              DialogBoxIndirectParam
 241 pascal16 CreateDialogParam(word segptr word segptr long) CreateDialogParam
-242 pascal16 CreateDialogIndirectParam(word ptr word segptr long)
+242 pascal16 CreateDialogIndirectParam(word segptr word segptr long)
              CreateDialogIndirectParam
 243 pascal   GetDialogBaseUnits() GetDialogBaseUnits
 244 pascal16 EqualRect(ptr ptr) EqualRect
@@ -297,6 +298,7 @@
 293 pascal   CallNextHookEx(segptr s_word word long) CallNextHookEx
 294 stub LockWindowUpdate
 #299 MOUSE_EVENT
+300 stub UnloadInstalledDrivers
 #301 BOZOSLIVEHERE :-))
 #306 BEAR306
 308 pascal   DefDlgProc(word word word long) DefDlgProc
@@ -325,12 +327,31 @@
 358 pascal16 IsMenu(word) IsMenu
 359 pascal16 GetDCEx(word word long) GetDCEx
 362 stub DCHook
-368 stub CopyIcon
+364 stub LookupIconIDFromDirectoryEx
+368 pascal16 CopyIcon(word word) CopyIcon
 369 stub CopyCursor
 370 pascal16 GetWindowPlacement(word ptr) GetWindowPlacement
 371 pascal16 SetWindowPlacement(word ptr) SetWindowPlacement
 372 stub GetInternalIconHeader
 373 pascal16 SubtractRect(ptr ptr ptr) SubtractRect
+375 stub DrawTextEx
+376 stub SetMessageExtraInfo
+378 stub SetPropEx
+379 stub GetPropEx
+380 stub RemovePropEx
+381 stub UsrMPR_ThunkData16
+382 stub SetWindowContextHelpID
+383 stub GetWindowContextHelpID
+384 stub SetMenuContextHelpID
+385 stub GetMenuContextHelpID
+389 stub LoadImage
+390 stub CopyImage
+391 stub SignalProc32
+394 stub DrawIconEx
+395 stub GetIconInfo
+397 stub RegisterClassEx
+398 stub GetClassInfoEx
+399 stub ChildWindowFromPointEx
 400 stub FinalUserInit
 402 pascal16 GetPriorityClipboardFormat(word ptr s_word)
              GetPriorityClipboardFormat
@@ -340,6 +361,7 @@
 407 pascal16 CreateIcon(word word word byte byte ptr ptr) CreateIcon
 408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr)
 	     CreateCursorIconIndirect
+409 stub InitThreadInput
 410 pascal16 InsertMenu(word word word word ptr) InsertMenu
 411 pascal16 AppendMenu(word word word ptr) AppendMenu
 412 pascal16 RemoveMenu(word word word) RemoveMenu
@@ -355,6 +377,9 @@
 421 pascal16 wvsprintf(ptr ptr ptr) wvsprintf
 422 stub DlgDirSelectEx
 423 stub DlgDirSelectComboBoxEx
+427 stub FindWindowEx
+428 stub TileWindows
+429 stub CascadeWindows
 430 pascal16 lstrcmp(ptr ptr) lstrcmp
 431 pascal   AnsiUpper(segptr) WIN16_AnsiUpper
 432 pascal   AnsiLower(segptr) WIN16_AnsiLower
@@ -364,10 +389,16 @@
 436 pascal16 IsCharLower(byte) IsCharLower
 437 pascal16 AnsiUpperBuff(ptr word) AnsiUpperBuff
 438 pascal16 AnsiLowerBuff(ptr word) AnsiLowerBuff
+441 stub InsertMenuItem
+443 stub GetMenuItemInfo
 445 pascal   DefFrameProc(word word word word long) DefFrameProc
+446 stub SetMenuItemInfo
 447 pascal   DefMDIChildProc(word word word long) DefMDIChildProc
+448 stub DrawAnimatedRects
+449 stub DrawState
+450 stub CreateIconFromResourceEx
 451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel
-452 pascal16 CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
+452 pascal16 CreateWindowEx(long segptr segptr long s_word s_word s_word s_word
                             word word word segptr) CreateWindowEx
 454 pascal16 AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx
 455 stub GetIconId
@@ -386,6 +417,11 @@
 471 pascal16 lstrcmpi(ptr ptr) lstrcmpi
 472 pascal   AnsiNext(segptr) AnsiNext
 473 pascal   AnsiPrev(segptr segptr) AnsiPrev
+475 stub SetScrollInfo
+476 stub GetScrollInfo
+477 stub GetKeyboardLayoutName
+478 stub LoadKeyboardLayout
+479 stub MenuItemFromPoint
 480 stub GetUserLocalObjType
 #481 HARDWARE_EVENT
 482 pascal16 EnableScrollBar(word word word) EnableScrollBar
@@ -424,3 +460,57 @@
 530 pascal16 WNetGetDirectoryType(ptr ptr) WNetGetDirectoryType
 531 pascal16 WNetDirectoryNotify(word ptr word) WNetDirectoryNotify
 532 pascal16 WNetGetPropertyText(word word word ptr word) WNetGetPropertyText
+533 stub WNetInitialize
+534 stub WNetLogon
+669 stub SetWindowRgn
+600 stub GetShellWindow
+601 stub DoHotkeyStuff
+602 stub SetCheckCursorTimer
+604 stub BroadcastSystemMessage
+605 stub HackTaskMonitor
+606 stub FormatMessage
+608 stub GetForegroundWindow
+609 stub SetForegroundWindow
+610 stub DestroyIcon32
+620 stub ChangeDisplaySettings
+621 stub EnumDisplaySettings
+640 stub MsgWaitForMultipleObjects
+650 stub ActivateKeyboardLayout
+651 stub GetKeyboardLayout
+652 stub GetKeyboardLayoutList
+654 stub UnloadKeyboardLayout
+655 stub PostPostedMessages
+656 stub DrawFrameControl
+657 stub DrawCaptionTemp
+658 stub DispatchInput
+659 stub DrawEdge
+660 stub DrawCaption
+661 stub SetSysColorsTemp
+662 stub DrawMenubarTemp
+663 stub GetMenuDefaultItem
+664 stub SetMenuDefaultItem
+665 stub GetMenuItemRect
+666 stub CheckMenuRadioItem
+667 stub TrackPopupMenuEx
+668 stub SetWindowRgn
+669 stub GetWindowRgn
+800 stub CHOOSEFONT_CALLBACK16
+801 stub FINDREPLACE_CALLBACK16
+802 stub OPENFILENAME_CALLBACK16
+803 stub PRINTDLG_CALLBACK16
+804 stub CHOOSECOLOR_CALLBACK16
+819 stub PeekMessage32
+820 stub GetMessage32
+821 stub TranslateMessage32
+821 stub IsDialogMessage32
+822 stub DispatchMessage32
+825 stub PostMessage32
+826 stub PostThreadMessage32
+827 stub MessageBoxIndirect
+823 stub CallMsgFilter32
+851 stub MsgThkConnectionDataLS
+853 stub FT_USRFTHKTHKCONNECTIONDATA
+854 stub FT__USRF2THKTHKCONNECTIONDATA
+855 stub Usr32ThkConnectionDataSL
+890 stub InstallIMT
+891 stub UninstallIMT
diff --git a/if1632/user32.spec b/if1632/user32.spec
index 4b80bf0..3c7927b 100644
--- a/if1632/user32.spec
+++ b/if1632/user32.spec
@@ -10,7 +10,7 @@
 0006 stub ArrangeIconicWindows
 0007 stub AttachThreadInput
 0008 stub BeginDeferWindowPos
-0009 stub BeginPaint
+0009 stdcall BeginPaint(long ptr) USER32_BeginPaint
 0010 stub BringWindowToTop
 0011 stub BroadcastSystemMessage
 0012 stub CalcChildScroll
@@ -83,7 +83,8 @@
 0079 stub CreateMDIWindowW
 0080 stub CreateMenu
 0081 stub CreatePopupMenu
-0082 stub CreateWindowExA
+0082 stdcall CreateWindowExA(long ptr ptr long long long long long 
+							long long long ptr)	USER32_CreateWindowExA
 0083 stub CreateWindowExW
 0084 stub CreateWindowStationA
 0085 stub CreateWindowStationW
@@ -126,7 +127,7 @@
 0122 stub DefFrameProcW
 0123 stub DefMDIChildProcA
 0124 stub DefMDIChildProcW
-0125 stub DefWindowProcA
+0125 stdcall DefWindowProcA(long long long long) USER32_DefWindowProcA
 0126 stub DefWindowProcW
 0127 stub DeferWindowPos
 0128 stub DeleteMenu
@@ -141,7 +142,7 @@
 0137 stub DialogBoxIndirectParamW
 0138 stub DialogBoxParamA
 0139 stub DialogBoxParamW
-0140 stub DispatchMessageA
+0140 stdcall DispatchMessageA(ptr) USER32_DispatchMessageA
 0141 stub DispatchMessageW
 0142 stub DlgDirListA
 0143 stub DlgDirListComboBoxA
@@ -176,7 +177,7 @@
 0172 stub EndDeferWindowPos
 0173 stub EndDialog
 0174 stub EndMenu
-0175 stub EndPaint
+0175 stdcall EndPaint(long ptr) USER32_EndPaint
 0176 stub EndTask
 0177 stub EnumChildWindows
 0178 stub EnumClipboardFormats
@@ -270,7 +271,7 @@
 0266 stub GetMenuState
 0267 stub GetMenuStringA
 0268 stub GetMenuStringW
-0269 stub GetMessageA
+0269 stdcall GetMessageA(ptr long long long) USER32_GetMessageA
 0270 stub GetMessageExtraInfo
 0271 stub GetMessagePos
 0272 stub GetMessageTime
@@ -427,7 +428,7 @@
 0423 stub PtInRect
 0424 stub QuerySendMessage
 0425 stub RedrawWindow
-0426 stub RegisterClassA
+0426 stdcall RegisterClassA(ptr)	USER32_RegisterClassA
 0427 stub RegisterClassExA
 0428 stub RegisterClassExW
 0429 stub RegisterClassW
@@ -534,7 +535,7 @@
 0530 stub ShowOwnedPopups
 0531 stub ShowScrollBar
 0532 stub ShowStartGlass
-0533 stub ShowWindow
+0533 stdcall ShowWindow(long long) ShowWindow
 0534 stub ShowWindowAsync
 0535 stub SubtractRect
 0536 stub SwapMouseButton
@@ -567,7 +568,7 @@
 0563 stub UnregisterClassW
 0564 stub UnregisterHotKey
 0565 stub UpdatePerUserSystemParameters
-0566 stub UpdateWindow
+0566 stdcall UpdateWindow(long) UpdateWindow
 0567 stub UserClientDllInitialize
 0568 stub UserRealizePalette
 0569 stub UserRegisterWowHandlers
diff --git a/if1632/winprocs.spec b/if1632/winprocs.spec
index b95e074..27fd50f 100644
--- a/if1632/winprocs.spec
+++ b/if1632/winprocs.spec
@@ -26,6 +26,9 @@
 23 pascal16 CARET_Callback(word word word long) CARET_Callback
 24 pascal16 TASK_Reschedule() TASK_Reschedule
 25 pascal MMSysTimeCallback(word word word long) MMSysTimeCallback
+26 register Win32CallToStart() PE_Win32CallToStart
+27 pascal EntryAddrProc(word word) MODULE_GetEntryPoint
+28 pascal MyAlloc(word word word) MODULE_AllocateSegment
 
 # Interrupt vectors 0-255 are ordinals 100-355
 # The 'word' parameter are the flags pushed on the stack by the interrupt
@@ -286,4 +289,3 @@
 353 register INT_IntfdHandler(word) INT_DummyHandler
 354 register INT_IntfeHandler(word) INT_DummyHandler
 355 register INT_IntffHandler(word) INT_DummyHandler
-
diff --git a/include/alias.h b/include/alias.h
new file mode 100644
index 0000000..26daa04
--- /dev/null
+++ b/include/alias.h
@@ -0,0 +1,23 @@
+/*
+ * structure definitions for aliases
+ *
+ * Copyright 1995 Martin von Loewis
+ *
+ */
+
+typedef struct _FUNCTIONALIAS{
+	DWORD		wine;
+	DWORD		win16;
+	DWORD		win32;
+} FUNCTIONALIAS;
+
+extern int ALIAS_UseAliases;
+
+typedef struct _ALIASHASH{
+	DWORD used;
+	int recno;
+} ALIASHASH;
+
+void ALIAS_RegisterAlias(DWORD,DWORD,DWORD);
+FUNCTIONALIAS* ALIAS_LookupAlias(DWORD);
+
diff --git a/include/callback.h b/include/callback.h
index fac8cd2..b1a0e58 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -22,8 +22,10 @@
 
                                /* func     ds    parameters */
 extern WORD CallTo16_word_     ( FARPROC, WORD );
+extern WORD CallTo16_word_ww   ( FARPROC, WORD, WORD, WORD );
 extern WORD CallTo16_word_wl   ( FARPROC, WORD, WORD, LONG );
 extern WORD CallTo16_word_ll   ( FARPROC, WORD, LONG, LONG );
+extern WORD CallTo16_word_www  ( FARPROC, WORD, WORD, WORD, WORD );
 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 );
diff --git a/include/cursor.h b/include/cursor.h
index 21bd322..85c5c8c 100644
--- a/include/cursor.h
+++ b/include/cursor.h
@@ -17,24 +17,23 @@
         BYTE            byBitsPix;      /* bits per pixel */
         } CURSORICONINFO, FAR *LPCURSORICONINFO;
 
+typedef struct  {
+	WORD	cdReserved;
+	WORD	cdType;
+	WORD	cdCount;
+        } CURSORDIR;
+ 
 typedef struct {
-	BYTE	Width;
-	BYTE	Reserved1;
-	BYTE	Height;
-	BYTE	Reserved2;
-	WORD	curXHotspot;
-	WORD	curYHotspot;
+	WORD	Width;
+	WORD	Height;
+	WORD	Planes;
+	WORD	BitCount;
 	DWORD	curDIBSize;
-	DWORD	curDIBOffset;
+	WORD	curDIBOffset;
 	} CURSORDESCRIP;
 
-typedef struct {
-	CURSORDESCRIP	descriptor;
-	HBITMAP		hBitmap;
-	Display		*display;
-	Pixmap		pixshape;
-	Pixmap		pixmask;
-	Cursor		xcursor;
+typedef struct  {
+	Cursor	xcursor;
 	} CURSORALLOC;
 
 extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor );   /* cursor.c */
diff --git a/include/dde_atom.h b/include/dde_atom.h
index 62b50ff..dcc0e84 100644
--- a/include/dde_atom.h
+++ b/include/dde_atom.h
@@ -21,7 +21,7 @@
 ATOM DDE_GlobalAddAtom( SEGPTR str );
 ATOM DDE_GlobalDeleteAtom( ATOM atom );
 ATOM DDE_GlobalFindAtom( SEGPTR str );
-WORD DDE_GlobalGetAtomName( ATOM atom, LPSTR buffer, short count )
+WORD DDE_GlobalGetAtomName( ATOM atom, LPSTR buffer, short count );
 
 #endif  /* CONFIG_IPC */
 
diff --git a/include/dialog.h b/include/dialog.h
index 02bf8d0..aca9adc 100644
--- a/include/dialog.h
+++ b/include/dialog.h
@@ -11,11 +11,6 @@
 
 extern BOOL DIALOG_Init(void);
 extern HWND DIALOG_GetFirstTabItem( HWND hwndDlg );
-extern int DialogBoxIndirectPtr(HINSTANCE hInst, LPCSTR dlgTemplate,
-				HWND owner, WNDPROC dlgProc);
-extern int DialogBoxIndirectParamPtr(HINSTANCE hInst, LPCSTR dlgTemplate,
-				     HWND owner, WNDPROC dlgProc, 
-				     LPARAM param);
 
 #ifndef WINELIB
 #pragma pack(1)
@@ -67,12 +62,12 @@
   /* Dialog template */
 typedef struct
 {
-    DLGTEMPLATEHEADER * header;
-    unsigned char *     menuName;
-    LPSTR               className;
-    LPSTR               caption;
-    WORD                pointSize;
-    LPSTR               faceName;
+    DLGTEMPLATEHEADER  header;
+    SEGPTR             menuName;
+    SEGPTR             className;
+    SEGPTR             caption;
+    WORD               pointSize;
+    SEGPTR             faceName;
 } DLGTEMPLATE;
 
 #ifndef WINELIB
diff --git a/include/dlls.h b/include/dlls.h
index 813220b..4b4b606 100644
--- a/include/dlls.h
+++ b/include/dlls.h
@@ -12,32 +12,6 @@
 #define MAX_NAME_LENGTH		64
 
 
-
-struct pe_data {
-	struct pe_header_s *pe_header;
-	struct pe_segment_table *pe_seg;
-	struct PE_Import_Directory *pe_import;
-	struct PE_Export_Directory *pe_export;
-	struct PE_Resource_Directory *pe_resource;
-	int resource_offset; /* offset to resource typedirectory in file */
-};
-
-struct w_files
-{
-    struct w_files  * next;
-    char * name;   /* Name, as it appears in the windows binaries */
-    char * filename; /* Actual name of the unix file that satisfies this */
-    int type;        /* DLL or EXE */
-    int fd;
-    unsigned short hinstance;
-    HANDLE hModule;
-    int initialised;
-    struct mz_header_s *mz_header;
-    struct pe_data *pe;
-};
-
-extern struct  w_files *wine_files;
-
 #define DLL	0
 #define EXE	1
 
diff --git a/include/module.h b/include/module.h
index 58a3061..5ca5a59 100644
--- a/include/module.h
+++ b/include/module.h
@@ -48,6 +48,7 @@
     HANDLE  nrname_handle;    /* Handle to non-resident name table in memory */
     WORD    min_swap_area;    /* Min. swap area size */
     WORD    expected_version; /* Expected Windows version */
+    WORD    self_loading_sel; /* Selector used for self-loading apps. procs */
 } NE_MODULE;
 
   /* Loaded file info */
@@ -71,7 +72,25 @@
     WORD    selector;  /* Selector of segment in memory */
 } SEGTABLEENTRY;
 
+  /* Self-loading modules contain this structure in their first segment */
+
+typedef struct
+{
+    WORD    version;		/* Must be 0xA0 */
+    WORD    reserved;   
+    FARPROC BootApp;    	/* startup procedure */
+    FARPROC LoadAppSeg; 	/* procedure to load a segment */
+    FARPROC reserved2;
+    FARPROC MyAlloc;     	/* memory allocation procedure, 
+				 * wine must write this field */
+    FARPROC EntryAddrProc;
+    FARPROC ExitProc;		/* exit procedure */
+    WORD    reserved3[4];
+    FARPROC SetOwner;           /* Set Owner procedure, exported by wine */
+} SELFLOADHEADER;
+
   /* Parameters for LoadModule() */
+
 typedef struct
 {
     HANDLE hEnvironment;  /* Environment segment */
diff --git a/include/ole.h b/include/ole.h
index fd87acf..18cf706 100644
--- a/include/ole.h
+++ b/include/ole.h
@@ -4,9 +4,17 @@
 
 typedef LPCSTR	OLE_LPCSTR;
 
+/* object types */
+#define OT_LINK		1
+#define OT_EMBEDDED	2
+#define OT_STATIC	3
+
+/* activate verbs */
+#define OLEVERB_PRIMARY	0
+
 typedef enum
 {
-    OLE_OK=0, /* Yes Sir! */
+    OLE_OK,
     OLE_WAIT_FOR_RELEASE,
     OLE_BUSY,
     OLE_ERROR_PROTECT_ONLY,
@@ -65,28 +73,64 @@
     OLE_WARN_DELETE_DATA = 1000
 } OLESTATUS;
 
-typedef enum{
+typedef enum {
 	OLE_SERVER_MULTI,
 	OLE_SERVER_SINGLE
 } OLE_SERVER_USE;
-/* dunno if the values are correct, somebody please check */
+
 typedef enum {
 	OLE_CHANGED,
+	OLE_SAVED,
 	OLE_CLOSED,
-	OLE_QUERY_PAINT,
-	OLE_QUERY_RETRY,
-	OLE_RELEASE,
 	OLE_RENAMED,
-	OLE_SAVED
+	OLE_QUERY_PAINT,
+	OLE_RELEASE,
+	OLE_QUERY_RETRY
 } OLE_NOTIFICATION;
 
+typedef enum {
+	olerender_none,
+	olerender_draw,
+	olerender_format
+} OLEOPT_RENDER;
+
+typedef enum {
+	oleupdate_always,
+	oleupdate_onsave,
+	oleupdate_oncall,
+	oleupdate_onclose,
+} OLEOPT_UPDATE;
+
 typedef	LONG	LHSERVER;
 typedef LONG	LHSERVERDOC;
 typedef LONG	LHCLIENTDOC;
 typedef LONG	OLECLIPFORMAT;/* dunno about this type, please change/add */
-typedef LONG	OLEOPT_UPDATE;/* dunno about this type, please change/add */
-typedef OLEOPT_UPDATE*	LPOLEOPT_UPDATE;/* dunno about this type, please change/add */
-typedef LONG	*OLE_RELEASE_METHOD;/* dunno */
+typedef OLEOPT_UPDATE*	LPOLEOPT_UPDATE;
+
+typedef enum {
+	OLE_NONE,	/* none */
+	OLE_DELETE,	/* delete object */
+	OLE_LNKPASTE,	/* link paste */
+	OLE_EMBPASTE,	/* paste(and update) */
+	OLE_SHOW,
+	OLE_RUN,
+	OLE_ACTIVATE,
+	OLE_UPDATE,
+	OLE_CLOSE,
+	OLE_RECONNECT,
+	OLE_SETUPDATEOPTIONS,
+	OLE_SERVERRUNLAUNCH,	/* unlaunch (terminate?) server */
+	OLE_LOADFROMSTREAM,	/* (auto reconnect) */
+	OLE_SETDATA,		/* OleSetData */
+	OLE_REQUESTDATA,	/* OleRequestData */
+	OLE_OTHER,
+	OLE_CREATE,
+	OLE_CREATEFROMTEMPLATE,
+	OLE_CREATELINKFROMFILE,
+	OLE_COPYFROMLNK,
+	OLE_CREATREFROMFILE,
+	OLE_CREATEINVISIBLE
+} OLE_RELEASE_METHOD;
 
 typedef struct _OLETARGETDEVICE {
 	UINT	otdDeviceNameOffset;
diff --git a/include/options.h b/include/options.h
index ee1e3dc..8ac6d2d 100644
--- a/include/options.h
+++ b/include/options.h
@@ -12,6 +12,7 @@
     char * desktopGeometry; /* NULL when no desktop */
     char * programName;     /* To use when loading resources */
     int    usePrivateMap;
+    int    useFixedMap;
     int    synchronous;     /* X synchronous mode */
     int    backingstore;    /* Use backing store */
     short  cmdShow;
diff --git a/include/pe_image.h b/include/pe_image.h
index 169ddd8..cdadb66 100644
--- a/include/pe_image.h
+++ b/include/pe_image.h
@@ -1,7 +1,33 @@
 #ifndef __WINE_PE_IMAGE_H
 #define __WINE_PE_IMAGE_H
 
-extern void *RELAY32_GetEntryPoint(char *dll_name, char *item, int hint);
+#include "windows.h"
+
+struct pe_data {
+	struct pe_header_s *pe_header;
+	struct pe_segment_table *pe_seg;
+	struct PE_Import_Directory *pe_import;
+	struct PE_Export_Directory *pe_export;
+	struct PE_Resource_Directory *pe_resource;
+	int resource_offset; /* offset to resource typedirectory in file */
+};
+
+struct w_files
+{
+    struct w_files  * next;
+    char * name;   /* Name, as it appears in the windows binaries */
+    char * filename; /* Actual name of the unix file that satisfies this */
+    int type;        /* DLL or EXE */
+    int fd;
+    unsigned short hinstance;
+    HANDLE hModule;
+    int initialised;
+    struct mz_header_s *mz_header;
+    struct pe_data *pe;
+	OFSTRUCT ofs;
+};
+
+
 extern int PE_unloadImage(struct w_files *wpnt);
 extern int PE_StartProgram(struct w_files *wpnt);
 extern void PE_InitDLL(struct w_files *wpnt);
diff --git a/include/relay32.h b/include/relay32.h
new file mode 100644
index 0000000..7ebf688
--- /dev/null
+++ b/include/relay32.h
@@ -0,0 +1,58 @@
+/*
+ * Relay32 definitions
+ *
+ * Copyright 1995 Martin von Loewis
+ */
+
+void *RELAY32_GetEntryPoint(char *dll_name, char *item, int hint);
+LONG RELAY32_CallWindowProc(WNDPROC,int,int,int,int);
+
+typedef struct tagWNDCLASSA{
+	UINT	style;
+	WNDPROC	lpfnWndProc;
+	int		cbClsExtra;
+	int		cbWndExtra;
+	DWORD	hInstance;
+	DWORD	hIcon;
+	DWORD	hCursor;
+	DWORD	hbrBackground;
+	char*	lpszMenuName;
+	char*	lpszClassName;
+}WNDCLASSA;
+
+struct WIN32_POINT{
+	LONG x;
+	LONG y;
+};
+
+struct WIN32_MSG{
+	DWORD hwnd;
+	DWORD message;
+	DWORD wParam;
+	DWORD lParam;
+	DWORD time;
+	struct WIN32_POINT pt;
+};
+
+struct WIN32_RECT{
+	LONG left;
+	LONG top;
+	LONG right;
+	LONG bottom;
+};
+
+struct WIN32_PAINTSTRUCT{
+	DWORD hdc;
+	DWORD fErase;
+	struct WIN32_RECT rcPaint;
+	DWORD fRestore;
+	DWORD fIncUpdate;
+	BYTE rgbReserved[32];
+};
+
+
+ATOM USER32_RegisterClassA(WNDCLASSA *);
+LRESULT USER32_DefWindowProcA(DWORD hwnd,DWORD msg,DWORD wParam,DWORD lParam);
+BOOL USER32_GetMessageA(struct WIN32_MSG* lpmsg,DWORD hwnd,DWORD min,DWORD max);
+HDC USER32_BeginPaint(DWORD hwnd,struct WIN32_PAINTSTRUCT *lpps);
+BOOL USER32_EndPaint(DWORD hwnd,struct WIN32_PAINTSTRUCT *lpps);
diff --git a/include/windows.h b/include/windows.h
index 105237f..7f65748 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -98,8 +98,8 @@
     INT       y;
     INT       x;
     LONG      style WINE_PACKED;
-    char *    lpszName WINE_PACKED;
-    char *    lpszClass WINE_PACKED;
+    SEGPTR    lpszName WINE_PACKED;
+    SEGPTR    lpszClass WINE_PACKED;
     DWORD     dwExStyle WINE_PACKED;
 } CREATESTRUCT, *LPCREATESTRUCT;
 
@@ -111,8 +111,8 @@
 
 typedef struct
 {
-    LPSTR     szClass;
-    LPSTR     szTitle;
+    SEGPTR    szClass;
+    SEGPTR    szTitle;
     HANDLE    hOwner;
     INT       x;
     INT       y;
@@ -2427,6 +2427,7 @@
 F(WORD,GetCurrentPDB)
 F(WORD,GetDoubleClickTime)
 F(WORD,GetNumTasks)
+F(WORD,GetTaskDS)
 F(int,CountClipboardFormats)
 F(int,GetKBCodePage)
 F(int,GetThresholdStatus)
@@ -2957,7 +2958,7 @@
 Fd(HRGN,CreatePolyPolygonRgn,LPPOINT,a,LPINT,b,short,c,short,d)
 Fd(HRGN,CreateRectRgn,short,a,short,b,short,c,short,d)
 Fd(HWND,CreateDialog,HANDLE,a,SEGPTR,b,HWND,c,WNDPROC,d)
-Fd(HWND,CreateDialogIndirect,HANDLE,a,LPCSTR,b,HWND,c,WNDPROC,d)
+Fd(HWND,CreateDialogIndirect,HANDLE,a,SEGPTR,b,HWND,c,WNDPROC,d)
 Fd(INT,GetTempFileName,BYTE,a,LPCSTR,b,UINT,c,LPSTR,d)
 Fd(LONG,DefDlgProc,HWND,a,WORD,b,WORD,c,LONG,d)
 Fd(LONG,DefMDIChildProc,HWND,a,WORD,b,WORD,c,LONG,d)
@@ -3004,7 +3005,7 @@
 Fe(DWORD,ScaleViewportExt,HDC,a,short,b,short,c,short,d,short,e)
 Fe(DWORD,ScaleWindowExt,HDC,a,short,b,short,c,short,d,short,e)
 Fe(HBITMAP,CreateBitmap,short,a,short,b,BYTE,c,BYTE,d,LPSTR,e)
-Fe(HWND,CreateDialogIndirectParam,HANDLE,a,LPCSTR,b,HWND,c,WNDPROC,d,LPARAM,e)
+Fe(HWND,CreateDialogIndirectParam,HANDLE,a,SEGPTR,b,HWND,c,WNDPROC,d,LPARAM,e)
 Fe(HWND,CreateDialogParam,HANDLE,a,SEGPTR,b,HWND,c,WNDPROC,d,LPARAM,e)
 Fe(LONG,CallWindowProc,WNDPROC,a,HWND,b,WORD,c,WORD,d,LONG,e)
 Fe(LONG,DefFrameProc,HWND,a,HWND,b,WORD,c,WORD,d,LONG,e)
@@ -3054,8 +3055,8 @@
 Fi(BOOL,GrayString,HDC,a,HBRUSH,b,FARPROC,gsprc,LPARAM,lParam,INT,cch,INT,x,INT,y,INT,cx,INT,cy)
 Fi(BOOL,Pie,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd)
 Fk(BOOL,StretchBlt,HDC,a,short,b,short,c,short,d,short,e,HDC,f,short,g,short,h,short,i,short,j,DWORD,k)
-Fk(HWND,CreateWindow,LPSTR,a,LPSTR,b,DWORD,c,short,d,short,e,short,f,short,g,HWND,h,HMENU,i,HANDLE,j,SEGPTR,k)
-Fl(HWND,CreateWindowEx,DWORD,a,LPSTR,b,LPSTR,c,DWORD,d,short,e,short,f,short,g,short,h,HWND,i,HMENU,j,HANDLE,k,SEGPTR,l)
+Fk(HWND,CreateWindow,SEGPTR,a,SEGPTR,b,DWORD,c,short,d,short,e,short,f,short,g,HWND,h,HMENU,i,HANDLE,j,SEGPTR,k)
+Fl(HWND,CreateWindowEx,DWORD,a,SEGPTR,b,SEGPTR,c,DWORD,d,short,e,short,f,short,g,short,h,HWND,i,HMENU,j,HANDLE,k,SEGPTR,l)
 Fl(int,SetDIBitsToDevice,HDC,a,short,b,short,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l)
 Fm(int,StretchDIBits,HDC,a,WORD,b,WORD,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l,DWORD,m)
 Fn(HFONT,CreateFont,int,a,int,b,int,c,int,d,int,e,BYTE,f,BYTE,g,BYTE,h,BYTE,i,BYTE,j,BYTE,k,BYTE,l,BYTE,m,LPSTR,n)
diff --git a/include/winpos.h b/include/winpos.h
index 4105eb5..68edbd8 100644
--- a/include/winpos.h
+++ b/include/winpos.h
@@ -20,6 +20,7 @@
 } DWP;
 
 
+extern void WINPOS_FindIconPos( HWND hwnd );
 extern HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
 extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
 				   RECT *newWindowRect, RECT *oldWindowRect,
diff --git a/ipc/Makefile.in b/ipc/Makefile.in
index 811f2b4..a2c368b 100644
--- a/ipc/Makefile.in
+++ b/ipc/Makefile.in
@@ -1,47 +1,19 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+TOPSRC = @top_srcdir@
+MODULE = ipc
 
-
-MODULE 	= ipc
-
-SRCS =    bit_array.c \
-	  dde_atom.c  \
-	  dde_mem.c \
-          dde_proc.c  \
-          generic_hash.c \
-          shm_block.c \
-          shm_fragment.c \
-          shm_main_blk.c \
-          shm_semaph.c
-
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
+C_SRCS = \
+	bit_array.c \
+	dde_atom.c  \
+	dde_mem.c \
+	dde_proc.c  \
+	generic_hash.c \
+	shm_block.c \
+	shm_fragment.c \
+	shm_main_blk.c \
+	shm_semaph.c
 
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/loader/Makefile.in b/loader/Makefile.in
index bf3e4cf..74d6a71 100644
--- a/loader/Makefile.in
+++ b/loader/Makefile.in
@@ -1,40 +1,19 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+TOPSRC = @top_srcdir@
+MODULE = loader
 
-
-MODULE 	= loader
-
-SRCS 	= main.c module.c ne_image.c ne_resource.c pe_image.c \
-	pe_resource.c signal.c resource.c task.c
- 
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
+C_SRCS = \
+	main.c \
+	module.c \
+	ne_image.c \
+	ne_resource.c \
+	pe_image.c \
+	pe_resource.c \
+	signal.c \
+	resource.c \
+	task.c
 
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/loader/module.c b/loader/module.c
index f518e6c..928b647 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -23,6 +23,7 @@
 #include "stddebug.h"
 #include "debug.h"
 
+#include "callback.h"
 
 static HMODULE hFirstModule = 0;
 static HMODULE hCachedModule = 0;  /* Module cached by MODULE_OpenFile */
@@ -244,7 +245,43 @@
                     name, cachedfd );
     return cachedfd;
 }
+/***********************************************************************
+ *           MODULE_Ne2MemFlags
+ */
 
+/* This function translates NE segment flags to GlobalAlloc flags */
+
+static WORD MODULE_Ne2MemFlags(WORD flags)
+{ 
+    WORD memflags = 0;
+#if 0
+    if (flags & NE_SEGFLAGS_DISCARDABLE) 
+      memflags |= GMEM_DISCARDABLE;
+    if (flags & NE_SEGFLAGS_MOVEABLE || 
+	( ! (flags & NE_SEGFLAGS_DATA) &&
+	  ! (flags & NE_SEGFLAGS_LOADED) &&
+	  ! (flags & NE_SEGFLAGS_ALLOCATED)
+	 )
+	)
+      memflags |= GMEM_MOVEABLE;
+    memflags |= GMEM_ZEROINIT;
+#else
+    memflags = GMEM_ZEROINIT | GMEM_FIXED;
+    return memflags;
+#endif
+}
+
+/***********************************************************************
+ *           MODULE_AllocateSegment (WINPROCS.26)
+ */
+
+DWORD MODULE_AllocateSegment(WORD wFlags, WORD wSize, WORD wElem)
+{
+    WORD size = wSize << wElem;
+    WORD hMem = GlobalAlloc( MODULE_Ne2MemFlags(wFlags), size);
+    WORD selector = HIWORD(GlobalLock(hMem));
+    return MAKELONG(hMem, selector);
+}
 
 /***********************************************************************
  *           MODULE_CreateSegments
@@ -263,7 +300,7 @@
         if (i == pModule->ss) minsize += pModule->stack_size;
 	/* The DGROUP is allocated by MODULE_CreateInstance */
         if (i == pModule->dgroup) continue;
-        pSegment->selector = GLOBAL_Alloc( GMEM_ZEROINIT | GMEM_FIXED,
+        pSegment->selector = GLOBAL_Alloc( MODULE_Ne2MemFlags(pSegment->flags),
                                       minsize, hModule,
                                       !(pSegment->flags & NE_SEGFLAGS_DATA),
                                       FALSE,
@@ -297,7 +334,7 @@
 /***********************************************************************
  *           MODULE_CreateInstance
  */
-static HINSTANCE MODULE_CreateInstance( HMODULE hModule, LOADPARAMS *params )
+HINSTANCE MODULE_CreateInstance( HMODULE hModule, LOADPARAMS *params )
 {
     SEGTABLEENTRY *pSegment;
     NE_MODULE *pModule;
@@ -848,6 +885,8 @@
 
         if ((hModule = MODULE_LoadExeHeader( fd, &ofs )) < 32)
         {
+			if(hModule == 21)
+				return PE_LoadModule(fd,&ofs,paramBlock);
             close( fd );
             fprintf( stderr, "LoadModule: can't load '%s', error=%d\n",
                      name, hModule );
@@ -908,7 +947,46 @@
 
           /* Load the segments */
 
-        for (i = 1; i <= pModule->seg_count; i++) NE_LoadSegment( hModule, i );
+	if (pModule->flags & NE_FFLAGS_SELFLOAD)
+	{
+		/* Handle self loading modules */
+		SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule);
+		SELFLOADHEADER *selfloadheader;
+		HMODULE hselfload = GetModuleHandle("WINPROCS");
+		WORD oldss, oldsp, saved_dgroup = pSegTable[pModule->dgroup - 1].selector;
+		fprintf (stderr, "Warning:  %*.*s is a self-loading module\n"
+                                "Support for self-loading modules is very experimental\n",
+                *((BYTE*)pModule + pModule->name_table),
+                *((BYTE*)pModule + pModule->name_table),
+                (char *)pModule + pModule->name_table + 1);
+		NE_LoadSegment( hModule, 1 );
+		selfloadheader = (SELFLOADHEADER *)
+			PTR_SEG_OFF_TO_LIN(pSegTable->selector, 0);
+		selfloadheader->EntryAddrProc = 
+                                           MODULE_GetEntryPoint(hselfload,27);
+		selfloadheader->MyAlloc  = MODULE_GetEntryPoint(hselfload,28);
+		selfloadheader->SetOwner = MODULE_GetEntryPoint(GetModuleHandle("KERNEL"),403);
+		pModule->self_loading_sel = GlobalHandleToSel(
+					GLOBAL_Alloc (GMEM_ZEROINIT,
+					0xFF00, hModule, FALSE, FALSE, FALSE)
+					);
+		oldss = IF1632_Saved16_ss;
+		oldsp = IF1632_Saved16_sp;
+		IF1632_Saved16_ss = pModule->self_loading_sel;
+		IF1632_Saved16_sp = 0xFF00;
+		CallTo16_word_ww (selfloadheader->BootApp,
+			pModule->self_loading_sel, hModule, fd);
+		/* some BootApp procs overwrite the selector of dgroup */
+		pSegTable[pModule->dgroup - 1].selector = saved_dgroup;
+		IF1632_Saved16_ss = oldss;
+		IF1632_Saved16_sp = oldsp;
+		for (i = 2; i <= pModule->seg_count; i++) NE_LoadSegment( hModule, i );
+	} 
+	else
+        {
+            for (i = 1; i <= pModule->seg_count; i++)
+                NE_LoadSegment( hModule, i );
+        }
 
           /* Fixup the functions prologs */
 
diff --git a/loader/ne_image.c b/loader/ne_image.c
index 1450c0a..b05e65e 100644
--- a/loader/ne_image.c
+++ b/loader/ne_image.c
@@ -59,7 +59,41 @@
     lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET );
     size = pSeg->size ? pSeg->size : 0x10000;
     mem = GlobalLock(pSeg->selector);
-    if (!(pSeg->flags & NE_SEGFLAGS_ITERATED))
+    if (pModule->flags & NE_FFLAGS_SELFLOAD && segnum > 1) {	
+ 	/* Implement self loading segments */
+ 	SELFLOADHEADER *selfloadheader;
+ 	WORD oldss, oldsp, oldselector, newselector;
+ 	selfloadheader = (SELFLOADHEADER *)
+ 		PTR_SEG_OFF_TO_LIN(pSegTable->selector,0);
+ 	oldss = IF1632_Saved16_ss;
+ 	oldsp = IF1632_Saved16_sp;
+ 	oldselector = pSeg->selector;
+ 	IF1632_Saved16_ss = pModule->self_loading_sel;
+ 	IF1632_Saved16_sp = 0xFF00;
+ 	newselector =  CallTo16_word_www(selfloadheader->LoadAppSeg,
+ 		pModule->self_loading_sel, hModule, fd, segnum);
+ 	if (newselector != oldselector) {
+ 	  /* Self loaders like creating their own selectors; 
+ 	   * they love asking for trouble to Wine developers
+ 	   */
+ 	  if (segnum == pModule->dgroup) {
+ 	    memcpy(PTR_SEG_OFF_TO_LIN(oldselector,0),
+ 		   PTR_SEG_OFF_TO_LIN(newselector,0), 
+ 		   pSeg->minsize ? pSeg->minsize : 0x10000);
+ 	    FreeSelector(newselector);
+ 	    pSeg->selector = oldselector;
+ 	    fprintf(stderr, "A new selector was allocated for the dgroup segment\n"
+ 		    "Old selector is %d, new one is %d", oldselector, newselector);
+ 	  } else {
+ 	    FreeSelector(pSeg->selector);
+ 	    pSeg->selector = newselector;
+ 	  }
+ 	} 
+ 	
+ 	IF1632_Saved16_ss = oldss;
+ 	IF1632_Saved16_sp = oldsp;
+     }
+    else if (!(pSeg->flags & NE_SEGFLAGS_ITERATED))
       read(fd, mem, size);
     else {
       /*
@@ -85,6 +119,7 @@
       free(buff);
     }
 
+    pSeg->flags |= NE_SEGFLAGS_LOADED;
     if (!(pSeg->flags & NE_SEGFLAGS_RELOC_DATA))
         return TRUE;  /* No relocation data, we are done */
 
@@ -474,3 +509,15 @@
     }
     NE_InitDLL( hModule );
 }
+
+
+/***********************************************************************
+ *           NE_PatchCodeHandle
+ *
+ * Needed for self-loading modules.
+ */
+
+/* It does nothing */
+void PatchCodeHandle(HANDLE hSel)
+{
+}
diff --git a/loader/pe_image.c b/loader/pe_image.c
index 2d284b5..493de0f 100644
--- a/loader/pe_image.c
+++ b/loader/pe_image.c
@@ -18,6 +18,16 @@
 #include "neexe.h"
 #include "peexe.h"
 #include "pe_image.h"
+#include "relay32.h"
+#include "module.h"
+#include "alias.h"
+#include "global.h"
+#include "task.h"
+#include "ldt.h"
+#include "registers.h"
+
+#include "stddebug.h"
+#include "debug.h"
 
 #define MAP_ANONYMOUS	0x20
 
@@ -167,6 +177,7 @@
 	int i, result;
 
 	wpnt->pe = malloc(sizeof(struct pe_data));
+	memset(wpnt->pe,0,sizeof(struct pe_data));
 	wpnt->pe->pe_header = malloc(sizeof(struct pe_header_s));
 
 	/* read PE header */
@@ -225,6 +236,124 @@
 	return (wpnt->hinstance);
 }
 
+HINSTANCE PE_LoadModule(int fd, OFSTRUCT *ofs, LOADPARAMS* params)
+{
+	struct w_files *wpnt;
+	int size;
+	NE_MODULE *pModule;
+	LOADEDFILEINFO *pFileInfo;
+	SEGTABLEENTRY *pSegment;
+	char *pStr;
+	DWORD cts;
+	HMODULE hModule;
+	HINSTANCE hInstance;
+
+	ALIAS_UseAliases=1;
+
+	wpnt=malloc(sizeof(struct w_files));
+	wpnt->next=wine_files;
+	wine_files=wpnt;
+	wpnt->ofs=*ofs;
+	wpnt->fd=fd;
+	wpnt->type=0;
+	wpnt->hinstance=0;
+	wpnt->hModule=0;
+	wpnt->initialised=0;
+	lseek(fd,0,SEEK_SET);
+	wpnt->mz_header=malloc(sizeof(struct mz_header_s));
+	read(fd,wpnt->mz_header,sizeof(struct mz_header_s));
+
+	size=sizeof(NE_MODULE) +
+		/* loaded file info */
+		sizeof(LOADEDFILEINFO) + strlen(ofs->szPathName) +
+		/* segment table: DS,CS */
+		2 * sizeof(SEGTABLEENTRY) +
+		/* name table */
+		9 +
+		/* several empty tables */
+		8;
+
+	hModule = GlobalAlloc( GMEM_MOVEABLE | GMEM_ZEROINIT, size );
+	wpnt->hModule=hModule;
+	if (!hModule) return 11;  /* invalid exe */
+
+	FarSetOwner( hModule, hModule );
+	
+	pModule = GlobalLock(hModule);
+
+	/* Set all used entries */
+	pModule->magic=NE_SIGNATURE;
+	pModule->count=1;
+	pModule->next=0;
+	pModule->flags=0;
+	pModule->dgroup=1;
+	pModule->ss=1;
+	pModule->cs=2;
+	/* Who wants to LocalAlloc for a PE Module? */
+	pModule->heap_size=0x1000;
+	pModule->stack_size=0xF000;
+	pModule->seg_count=1;
+	pModule->modref_count=0;
+	pModule->nrname_size=0;
+	pModule->seg_table=sizeof(NE_MODULE)+
+			sizeof(LOADEDFILEINFO)+strlen(ofs->szPathName);
+	pModule->fileinfo=sizeof(NE_MODULE);
+	pModule->os_flags=NE_OSFLAGS_WINDOWS;
+	pModule->expected_version=0x30A;
+
+	pFileInfo=(LOADEDFILEINFO *)(pModule + 1);
+	pFileInfo->length = sizeof(LOADEDFILEINFO)+strlen(ofs->szPathName)-1;
+	strcpy(pFileInfo->filename,ofs->szPathName);
+
+	pSegment=(SEGTABLEENTRY*)((char*)pFileInfo+pFileInfo->length+1);
+	pModule->dgroup_entry=(int)pSegment-(int)pModule;
+	pSegment->size=0;
+	pSegment->flags=NE_SEGFLAGS_DATA;
+	pSegment->minsize=0x1000;
+	pSegment++;
+
+	cts=GetWndProcEntry16("Win32CallToStart");
+	pSegment->selector=cts>>16;
+	pModule->ip=cts & 0xFFFF;
+	pSegment++;
+
+	pStr=(char*)pSegment;
+	pModule->name_table=(int)pStr-(int)pModule;
+	strcpy(pStr,"\x08W32SXXXX");
+	pStr+=9;
+
+	/* All tables zero terminated */
+	pModule->res_table=pModule->import_table=pModule->entry_table=
+		(int)pStr-(int)pModule;
+
+	PE_LoadImage(wpnt);
+
+	pModule->heap_size=0x1000;
+	pModule->stack_size=0xE000;
+
+	/* CreateInstance allocates now 64KB */
+	hInstance=MODULE_CreateInstance(hModule);
+	wpnt->hinstance=hInstance;
+
+	TASK_CreateTask(hModule,hInstance,0,
+		params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine),
+		*((WORD*)PTR_SEG_TO_LIN(params->showCmd)+1));
+	
+	return hInstance;
+}
+
+void PE_Win32CallToStart(struct sigcontext_struct context)
+{
+	int fs;
+	struct w_files *wpnt=wine_files;
+	fs=GlobalAlloc(GHND,0x10000);
+	fprintf(stddeb,"Going to start Win32 program\n");	
+	InitTask(context);
+	USER_InitApp(wpnt->hModule);
+	__asm__ __volatile__("movw %w0,%%fs"::"r" (fs));
+	((void(*)())(load_addr+wpnt->pe->pe_header->opt_coff.AddressOfEntryPoint))();
+}
+
 int PE_UnloadImage(struct w_files *wpnt)
 {
 	printf("PEunloadImage() called!\n");
diff --git a/memory/Makefile.in b/memory/Makefile.in
index 791bdae..357ded9 100644
--- a/memory/Makefile.in
+++ b/memory/Makefile.in
@@ -1,44 +1,15 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+TOPSRC = @top_srcdir@
+MODULE = memory
 
-
-MODULE 	= memory
-
-SRCS = \
+C_SRCS = \
 	atom.c \
 	global.c \
 	ldt.c \
 	local.c \
 	selector.c
- 
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
 
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/memory/local.c b/memory/local.c
index a026447..fa5845b 100644
--- a/memory/local.c
+++ b/memory/local.c
@@ -825,8 +825,11 @@
     char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
 
     dprintf_local( stddeb, "LocalLock: %04x ", handle );
-    if (HANDLE_MOVEABLE(handle)) {
-	handle = *(WORD *)(ptr + handle);
+    if (HANDLE_MOVEABLE(handle))
+    {
+        LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY *)(ptr + handle);
+        if (pEntry->lock < 255) pEntry->lock++;
+        handle = pEntry->addr;
     }
     dprintf_local( stddeb, "returning %04x\n", handle );
     return handle;
@@ -838,7 +841,18 @@
  */
 BOOL LOCAL_Unlock( WORD ds, HLOCAL handle )
 {
-    return TRUE;
+    char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
+
+    dprintf_local( stddeb, "LocalUnlock: %04x\n", handle );
+    if (HANDLE_MOVEABLE(handle))
+    {
+        LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY *)(ptr + handle);
+        if (!pEntry->lock || (pEntry->lock == 255)) return FALSE;
+        /* For moveable block, return the new lock count */
+        /* (see _Windows_Internals_ p. 197) */
+        return --pEntry->lock;
+    }
+    else return FALSE;
 }
 
 
diff --git a/memory/selector.c b/memory/selector.c
index 4be163d..fed873d 100644
--- a/memory/selector.c
+++ b/memory/selector.c
@@ -309,14 +309,14 @@
     if (op == 0)  /* get */
     {
         return 1 /* accessed */ |
-               (entry.read_only << 1) |
+               ((entry.read_only == 0) << 1) |
                (entry.type << 2) |
                (entry.seg_32bit << 14) |
                (entry.limit_in_pages << 15);
     }
     else  /* set */
     {
-        entry.read_only = val & 2;
+        entry.read_only = (val & 2 == 0);
         entry.type = (val >> 2) & 3;
         entry.seg_32bit = val & 0x4000;
         entry.limit_in_pages = val & 0x8000;
diff --git a/misc/Imakefile b/misc/Imakefile
index 1470bad..2b89bd7 100644
--- a/misc/Imakefile
+++ b/misc/Imakefile
@@ -29,6 +29,7 @@
 	spy.c \
 	stress.c \
 	user.c \
+	user32.c \
 	winsocket.c
 
 OBJS = $(SRCS:.c=.o)
diff --git a/misc/Makefile.in b/misc/Makefile.in
index f2b4a96..c606b94 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -1,49 +1,44 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include -I$(TOPSRC)
-LD	= @LD@
-LANG	= @LANG@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
-@SET_MAKE@
+TOPSRC = @top_srcdir@
+MODULE = misc
 
-
-MODULE 	= misc
-
-SRCS 	= clipboard.c comm.c commdlg.c compobj.c dos_fs.c \
-	driver.c exec.c escape.c file.c keyboard.c kernel32.c lstr.c \
-	main.c ole2.c ole2disp.c ole2nls.c olecli.c olesvr.c network.c \
-	profile.c rect.c shell.c sound.c spy.c stress.c user.c \
+C_SRCS = \
+	clipboard.c \
+	comm.c \
+	commdlg.c \
+	compobj.c \
+	dos_fs.c \
+	driver.c \
+	exec.c \
+	escape.c \
+	file.c \
+	keyboard.c \
+	kernel32.c \
+	lstr.c \
+	main.c \
+	ole2.c \
+	ole2disp.c \
+	ole2nls.c \
+	olecli.c \
+	olesvr.c \
+	network.c \
+	profile.c \
+	rect.c \
+	shell.c \
+	sound.c \
+	spy.c \
+	stress.c \
+	user.c \
+	user32.c \
 	winsocket.c
- 
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) $(LANG) -o $*.o $<
 
 all: checkrc $(MODULE).o
 
 checkrc: dummy
-	cd $(TOPSRC)/rc; $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'LD=$(LD)' 'LDCOMBINEFLAGS=$(LDCOMBINEFLAGS)'
+	cd $(TOPSRC)/rc; $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)' 'LANG=$(LANG)'
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
+langclean::
+	$(RM) ole2nls.o
 
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-	rm -f ole2nls.o shell.o commdlg.o
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/misc/commdlg.c b/misc/commdlg.c
index 79cfb69..774cc84 100644
--- a/misc/commdlg.c
+++ b/misc/commdlg.c
@@ -7,9 +7,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "dialog.h"
 #include "win.h"
 #include "user.h"
+#include "global.h"
 #include "message.h"
 #include "commdlg.h"
 #include "dlgs.h"
@@ -18,9 +18,6 @@
 #include "dos_fs.h"
 #include "stackframe.h"
 
-#define OPENFILEDLG2			11
-#define SAVEFILEDLG2			12
-
 static	DWORD 		CommDlgLastError = 0;
 
 static	HBITMAP		hFolder = 0;
@@ -54,106 +51,98 @@
 }
 
 /***********************************************************************
- * 				GetOpenFileName			[COMMDLG.1]
+ *           GetOpenFileName   (COMMDLG.1)
  */
 BOOL GetOpenFileName(LPOPENFILENAME lpofn)
 {
-  HANDLE    hDlgTmpl;
-  HANDLE    hResInfo;
-  HINSTANCE hInst;
-  BOOL 	    bRet;
-  LPCSTR    dlgTemplate;
+    HINSTANCE hInst;
+    HANDLE hDlgTmpl, hResInfo;
+    BOOL bRet;
   
-  if (lpofn == NULL)
-    return FALSE;
-  if (!FileDlg_Init())
-    return FALSE;
-  if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE)
+    if (!lpofn || !FileDlg_Init()) return FALSE;
+
+    if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) hDlgTmpl = lpofn->hInstance;
+    else if (lpofn->Flags & OFN_ENABLETEMPLATE)
     {
-      dlgTemplate = GlobalLock(lpofn->hInstance);
-      if (!dlgTemplate)
-	{
-	  CommDlgLastError = CDERR_LOADRESFAILURE;
-	  return FALSE;
-	}
+        if (!(hResInfo = FindResource( lpofn->hInstance,
+                                       lpofn->lpTemplateName, RT_DIALOG)))
+        {
+            CommDlgLastError = CDERR_FINDRESFAILURE;
+            return FALSE;
+        }
+        hDlgTmpl = LoadResource( lpofn->hInstance, hResInfo );
     }
-  else
+    else hDlgTmpl = GLOBAL_CreateBlock( GMEM_FIXED,
+                                        sysres_DIALOG_OPEN_FILE.bytes,
+                                        sysres_DIALOG_OPEN_FILE.size,
+                                        GetCurrentPDB(), FALSE, FALSE,
+                                        TRUE, NULL );
+    if (!hDlgTmpl)
     {
-      if (lpofn->Flags & OFN_ENABLETEMPLATE)
-	{
-	  hInst = lpofn->hInstance;
-	  hResInfo = FindResource(hInst, lpofn->lpTemplateName, RT_DIALOG);
-	  if (hResInfo == 0)
-	    {
-	      CommDlgLastError = CDERR_FINDRESFAILURE;
-	      return FALSE;
-	    }
-	  hDlgTmpl = LoadResource(hInst, hResInfo);
-	  if (hDlgTmpl == 0)
-	    {
-	      CommDlgLastError = CDERR_LOADRESFAILURE;
-	      return FALSE;
-	    }
-	  dlgTemplate = GlobalLock(hDlgTmpl);
-	}
-      else
-	dlgTemplate = sysres_DIALOG_3;
+        CommDlgLastError = CDERR_LOADRESFAILURE;
+        return FALSE;
     }
-  hInst = GetWindowWord(lpofn->hwndOwner, GWW_HINSTANCE);
-  bRet = DialogBoxIndirectParamPtr(hInst, dlgTemplate, lpofn->hwndOwner,
-				   GetWndProcEntry16("FileOpenDlgProc"),
-				   (DWORD)lpofn);
-  printf("GetOpenFileName // return lpstrFile='%s' !\n", 
-	 (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
-  return bRet;
+
+    hInst = GetWindowWord( lpofn->hwndOwner, GWW_HINSTANCE );
+    bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpofn->hwndOwner,
+                                   GetWndProcEntry16("FileOpenDlgProc"),
+                                   (DWORD)lpofn );
+
+    if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
+    {
+        if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource( hDlgTmpl );
+        else GLOBAL_FreeBlock( hDlgTmpl );
+    }
+
+    printf("GetOpenFileName // return lpstrFile='%s' !\n", 
+           (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
+    return bRet;
 }
 
 
 /***********************************************************************
- * 				GetSaveFileName			[COMMDLG.2]
+ *           GetSaveFileName   (COMMDLG.2)
  */
 BOOL GetSaveFileName(LPOPENFILENAME lpofn)
 {
-  HANDLE    hDlgTmpl;
-  HANDLE    hResInfo;
-  HINSTANCE hInst;
-  BOOL	    bRet;
-  LPCSTR    dlgTemplate;
+    HINSTANCE hInst;
+    HANDLE hDlgTmpl, hResInfo;
+    BOOL bRet;
   
-  if (!FileDlg_Init()) return FALSE;
+    if (!lpofn || !FileDlg_Init()) return FALSE;
 
-  if (lpofn == NULL) return FALSE;
-  if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) {
-    dlgTemplate = GlobalLock(lpofn->hInstance);
-    if (!dlgTemplate) {
-      CommDlgLastError = CDERR_LOADRESFAILURE;
-      return FALSE;
+    if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) hDlgTmpl = lpofn->hInstance;
+    else if (lpofn->Flags & OFN_ENABLETEMPLATE)
+    {
+        hInst = lpofn->hInstance;
+        if (!(hResInfo = FindResource( lpofn->hInstance,
+                                       lpofn->lpTemplateName, RT_DIALOG )))
+        {
+            CommDlgLastError = CDERR_FINDRESFAILURE;
+            return FALSE;
+        }
+        hDlgTmpl = LoadResource( lpofn->hInstance, hResInfo );
     }
-  } else {
-    if (lpofn->Flags & OFN_ENABLETEMPLATE) {
-      hInst = lpofn->hInstance;
-      hResInfo = FindResource(hInst, lpofn->lpTemplateName, RT_DIALOG);
-      if (hResInfo == 0) {
-	CommDlgLastError = CDERR_FINDRESFAILURE;
-	return FALSE;
-      }
-      hDlgTmpl = LoadResource(hInst, hResInfo);
-      if (hDlgTmpl == 0) {
-	CommDlgLastError = CDERR_LOADRESFAILURE;
-	return FALSE;
-      }
-      dlgTemplate = GlobalLock(hDlgTmpl);
-    } else {
-      dlgTemplate = sysres_DIALOG_4; /* SAVEFILEDIALOG */
+    else hDlgTmpl = GLOBAL_CreateBlock( GMEM_FIXED,
+                                        sysres_DIALOG_SAVE_FILE.bytes,
+                                        sysres_DIALOG_SAVE_FILE.size,
+                                        GetCurrentPDB(), FALSE, FALSE,
+                                        TRUE, NULL );
+
+
+    hInst = GetWindowWord( lpofn->hwndOwner, GWW_HINSTANCE );
+    bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpofn->hwndOwner,
+                                   GetWndProcEntry16("FileSaveDlgProc"),
+                                   (DWORD)lpofn); 
+    if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
+    {
+        if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource( hDlgTmpl );
+        else GLOBAL_FreeBlock( hDlgTmpl );
     }
-  }
-  hInst = GetWindowWord(lpofn->hwndOwner, GWW_HINSTANCE);
-  bRet = DialogBoxIndirectParamPtr(hInst, dlgTemplate, lpofn->hwndOwner,
-				   GetWndProcEntry16("FileSaveDlgProc"),
-				   (DWORD)lpofn); 
-  printf("GetSaveFileName // return lpstrFile='%s' !\n", 
-	 (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
-  return bRet;
+
+    printf( "GetSaveFileName // return lpstrFile='%s' !\n", 
+            (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
+    return bRet;
 }
 
 /***********************************************************************
@@ -328,13 +317,16 @@
   if (lpofn->lpstrCustomFilter)
     {
       pstr = (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrCustomFilter);
+      printf("lpstrCustomFilter = %p\n", pstr);
       while(*pstr)
 	{
 	  n = strlen(pstr);
 	  strcpy(tmpstr, pstr);
+	  printf("lpstrCustomFilter // add tmpstr='%s' ", tmpstr);
 	  SendDlgItemMessage(hWnd, cmb1, CB_ADDSTRING, 0, MAKE_SEGPTR(tmpstr));
 	  pstr += n + 1;
 	  n = strlen(pstr);
+	  printf("associated to '%s'\n", pstr);
 	  pstr += n + 1;
 	}
     }
@@ -344,15 +336,21 @@
     {
       n = strlen(pstr);
       strcpy(tmpstr, pstr);
+      printf("lpstrFilter // add tmpstr='%s' ", tmpstr);
       SendDlgItemMessage(hWnd, cmb1, CB_ADDSTRING, 0, MAKE_SEGPTR(tmpstr));
       pstr += n + 1;
       n = strlen(pstr);
+      printf("associated to '%s'\n", pstr);
       pstr += n + 1;
     }
   /* set default filter */
-  SendDlgItemMessage(hWnd, cmb1, CB_SETCURSEL, 0, 0);    
+  if (lpofn->nFilterIndex == 0 && lpofn->lpstrCustomFilter == (SEGPTR)NULL)
+  	lpofn->nFilterIndex = 1;
+  SendDlgItemMessage(hWnd, cmb1, CB_SETCURSEL, lpofn->nFilterIndex - 1, 0);    
   strcpy(tmpstr, FILEDLG_GetFileType(PTR_SEG_TO_LIN(lpofn->lpstrCustomFilter),
-				     PTR_SEG_TO_LIN(lpofn->lpstrFilter), 0));
+	     PTR_SEG_TO_LIN(lpofn->lpstrFilter), lpofn->nFilterIndex - 1));
+  printf("nFilterIndex = %ld // SetText of edt1 to '%s'\n", 
+  			lpofn->nFilterIndex, tmpstr);
   SendDlgItemMessage(hWnd, edt1, WM_SETTEXT, 0, MAKE_SEGPTR(tmpstr));
   /* get drive list */
   *tmpstr = 0;
@@ -371,7 +369,7 @@
     fprintf(stderr, "FileDlg: couldn't read initial directory %s!\n", tmpstr);
   /* select current drive in combo 2 */
   n = DOS_GetDefaultDrive();
-  SendDlgItemMessage(hWnd, cmb2, CB_SETCURSEL, n - 1, 0);
+  SendDlgItemMessage(hWnd, cmb2, CB_SETCURSEL, n, 0);
   if (!(lpofn->Flags & OFN_SHOWHELP))
     ShowWindow(GetDlgItem(hWnd, pshHelp), SW_HIDE);
   if (lpofn->Flags & OFN_HIDEREADONLY)
@@ -478,6 +476,8 @@
 	strcat(tmpstr, "\\");
       lRet = SendDlgItemMessage(hWnd, cmb1, CB_GETCURSEL, 0, 0);
       if (lRet == LB_ERR) return TRUE;
+      lpofn->nFilterIndex = lRet + 1;
+      printf("commdlg: lpofn->nFilterIndex=%ld\n", lpofn->nFilterIndex);
       strcpy(tmpstr2, 
 	     FILEDLG_GetFileType(PTR_SEG_TO_LIN(lpofn->lpstrCustomFilter),
 				 PTR_SEG_TO_LIN(lpofn->lpstrFilter),
@@ -530,10 +530,10 @@
   return FALSE;
 }
 
-/***********************************************************************
- * 				FileOpenDlgProc			[COMMDLG.6]
- */
 
+/***********************************************************************
+ *           FileOpenDlgProc   (COMMDLG.6)
+ */
 BOOL FileOpenDlgProc(HWND hWnd, WORD wMsg, WORD wParam, LONG lParam)
 {  
   switch (wMsg)
@@ -566,7 +566,7 @@
 
 
 /***********************************************************************
- * 				FileSaveDlgProc			[COMMDLG.7]
+ *           FileSaveDlgProc   (COMMDLG.7)
  */
 BOOL FileSaveDlgProc(HWND hWnd, WORD wMsg, WORD wParam, LONG lParam)
 {
@@ -604,22 +604,27 @@
 
 
 /***********************************************************************
- * 				ChooseColor				[COMMDLG.5]
+ *           ChooseColor   (COMMDLG.5)
  */
 BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
 {
-        WND     *wndPtr;
-	BOOL	bRet;
-        wndPtr = WIN_FindWndPtr(lpChCol->hwndOwner);
-	bRet = DialogBoxIndirectParamPtr(wndPtr->hInstance, sysres_DIALOG_8,
-		lpChCol->hwndOwner, GetWndProcEntry16("ColorDlgProc"), 
-		(DWORD)lpChCol);
-	return bRet;
+    HANDLE hInst, hDlgTmpl;
+    BOOL bRet;
+
+    hDlgTmpl = GLOBAL_CreateBlock(GMEM_FIXED, sysres_DIALOG_CHOOSE_COLOR.bytes,
+                                  sysres_DIALOG_CHOOSE_COLOR.size,
+                                  GetCurrentPDB(), FALSE, FALSE, TRUE, NULL );
+    hInst = GetWindowWord( lpChCol->hwndOwner, GWW_HINSTANCE );
+    bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpChCol->hwndOwner,
+                                   GetWndProcEntry16("ColorDlgProc"), 
+                                   (DWORD)lpChCol );
+    GLOBAL_FreeBlock( hDlgTmpl );
+    return bRet;
 }
 
 
 /***********************************************************************
- * 				ColorDlgProc			[COMMDLG.8]
+ *           ColorDlgProc   (COMMDLG.8)
  */
 BOOL ColorDlgProc(HWND hWnd, WORD wMsg, WORD wParam, LONG lParam)
 {
@@ -646,43 +651,47 @@
 
 
 /***********************************************************************
- * 				FindTextDlg				[COMMDLG.11]
+ *           FindTextDlg   (COMMDLG.11)
  */
 BOOL FindText(LPFINDREPLACE lpFind)
 {
-  WND    *wndPtr;
-  BOOL   bRet;
-  LPCSTR lpTemplate;
-  
-  lpTemplate = sysres_DIALOG_9;
-  wndPtr = WIN_FindWndPtr(lpFind->hwndOwner);
-  bRet = DialogBoxIndirectParamPtr(wndPtr->hInstance, lpTemplate,
-				lpFind->hwndOwner, GetWndProcEntry16("FindTextDlgProc"),
-				(DWORD)lpFind);
-  return bRet;
+    HANDLE hInst, hDlgTmpl;
+    BOOL bRet;
+
+    hDlgTmpl = GLOBAL_CreateBlock(GMEM_FIXED, sysres_DIALOG_FIND_TEXT.bytes,
+                                  sysres_DIALOG_FIND_TEXT.size,
+                                  GetCurrentPDB(), FALSE, FALSE, TRUE, NULL );
+    hInst = GetWindowWord( lpFind->hwndOwner, GWW_HINSTANCE );
+    bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpFind->hwndOwner,
+                                   GetWndProcEntry16("FindTextDlgProc"), 
+                                   (DWORD)lpFind );
+    GLOBAL_FreeBlock( hDlgTmpl );
+    return bRet;
 }
 
 
 /***********************************************************************
- * 				ReplaceTextDlg			[COMMDLG.12]
+ *           ReplaceTextDlg   (COMMDLG.12)
  */
 BOOL ReplaceText(LPFINDREPLACE lpFind)
 {
-  WND    *wndPtr;
-  BOOL   bRet;
-  LPCSTR lpTemplate;
+    HANDLE hInst, hDlgTmpl;
+    BOOL bRet;
 
-  lpTemplate = sysres_DIALOG_10;
-  wndPtr = WIN_FindWndPtr(lpFind->hwndOwner);
-  bRet = DialogBoxIndirectParamPtr(wndPtr->hInstance, lpTemplate,
-				   lpFind->hwndOwner, GetWndProcEntry16("ReplaceTextDlgProc"),
-				   (DWORD)lpFind);
-  return bRet;
+    hDlgTmpl = GLOBAL_CreateBlock(GMEM_FIXED, sysres_DIALOG_REPLACE_TEXT.bytes,
+                                  sysres_DIALOG_REPLACE_TEXT.size,
+                                  GetCurrentPDB(), FALSE, FALSE, TRUE, NULL );
+    hInst = GetWindowWord( lpFind->hwndOwner, GWW_HINSTANCE );
+    bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpFind->hwndOwner,
+                                   GetWndProcEntry16("ReplaceTextDlgProc"), 
+                                   (DWORD)lpFind );
+    GLOBAL_FreeBlock( hDlgTmpl );
+    return bRet;
 }
 
 
 /***********************************************************************
- * 				FindTextDlgProc			[COMMDLG.13]
+ *           FindTextDlgProc   (COMMDLG.13)
  */
 BOOL FindTextDlgProc(HWND hWnd, WORD wMsg, WORD wParam, LONG lParam)
 {
@@ -709,7 +718,7 @@
 
 
 /***********************************************************************
- * 				ReplaceTextDlgProc		[COMMDLG.14]
+ *           ReplaceTextDlgProc   (COMMDLG.14)
  */
 BOOL ReplaceTextDlgProc(HWND hWnd, WORD wMsg, WORD wParam, LONG lParam)
 {
@@ -736,35 +745,40 @@
 
 
 /***********************************************************************
- * 				PrintDlg				[COMMDLG.20]
+ *           PrintDlg   (COMMDLG.20)
  */
 BOOL PrintDlg(LPPRINTDLG lpPrint)
 {
-  WND    *wndPtr;
-  BOOL   bRet;
-  LPCSTR lpTemplate;
-  
-  printf("PrintDlg(%p) // Flags=%08lX\n", lpPrint, lpPrint->Flags);
-  if (lpPrint->Flags & PD_PRINTSETUP)  {
-    lpTemplate = sysres_DIALOG_6;
-  } else  {
-    lpTemplate = sysres_DIALOG_5;
-  }
-  wndPtr = WIN_FindWndPtr(lpPrint->hwndOwner);
-  if (lpPrint->Flags & PD_PRINTSETUP)
-  bRet = DialogBoxIndirectParamPtr(wndPtr->hInstance, lpTemplate,
-				   lpPrint->hwndOwner, GetWndProcEntry16("PrintSetupDlgProc"),
-				   (DWORD)lpPrint);
-  else
-  bRet = DialogBoxIndirectParamPtr(wndPtr->hInstance, lpTemplate,
-				   lpPrint->hwndOwner, GetWndProcEntry16("PrintDlgProc"),
-				   (DWORD)lpPrint);
-  return bRet;
+    HANDLE hInst, hDlgTmpl;
+    BOOL bRet;
+
+    printf("PrintDlg(%p) // Flags=%08lX\n", lpPrint, lpPrint->Flags );
+
+    if (lpPrint->Flags & PD_PRINTSETUP)
+        hDlgTmpl = GLOBAL_CreateBlock( GMEM_FIXED,
+                                       sysres_DIALOG_PRINT_SETUP.bytes,
+                                       sysres_DIALOG_PRINT_SETUP.size,
+                                       GetCurrentPDB(), FALSE,
+                                       FALSE, TRUE, NULL );
+    else
+        hDlgTmpl = GLOBAL_CreateBlock( GMEM_FIXED, sysres_DIALOG_PRINT.bytes,
+                                       sysres_DIALOG_PRINT.size,
+                                       GetCurrentPDB(), FALSE,
+                                       FALSE, TRUE, NULL );
+
+    hInst = GetWindowWord( lpPrint->hwndOwner, GWW_HINSTANCE );
+    bRet = DialogBoxIndirectParam( hInst, hDlgTmpl, lpPrint->hwndOwner,
+                                   (lpPrint->Flags & PD_PRINTSETUP) ?
+                                       GetWndProcEntry16("PrintSetupDlgProc") :
+                                       GetWndProcEntry16("PrintDlgProc"),
+                                   (DWORD)lpPrint );
+    GLOBAL_FreeBlock( hDlgTmpl );
+    return bRet;
 }
 
 
 /***********************************************************************
- * 				PrintDlgProc			[COMMDLG.21]
+ *           PrintDlgProc   (COMMDLG.21)
  */
 BOOL PrintDlgProc(HWND hWnd, WORD wMsg, WORD wParam, LONG lParam)
 {
@@ -791,7 +805,7 @@
 
 
 /***********************************************************************
- * 				PrintSetupDlgProc		[COMMDLG.22]
+ *           PrintSetupDlgProc   (COMMDLG.22)
  */
 BOOL PrintSetupDlgProc(HWND hWnd, WORD wMsg, WORD wParam, LONG lParam)
 {
@@ -817,7 +831,7 @@
 
 
 /***********************************************************************
- * 				CommDlgExtendError		[COMMDLG.26]
+ *           CommDlgExtendError   (COMMDLG.26)
  */
 DWORD CommDlgExtendError(void)
 {
@@ -826,7 +840,7 @@
 
 
 /***********************************************************************
- * 				GetFileTitle			[COMMDLG.27]
+ *           GetFileTitle   (COMMDLG.27)
  */
 int GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
 {
diff --git a/misc/dos_fs.c b/misc/dos_fs.c
index 322ddab..a141798 100644
--- a/misc/dos_fs.c
+++ b/misc/dos_fs.c
@@ -29,12 +29,16 @@
 #include "windows.h"
 #include "msdos.h"
 #include "dos_fs.h"
-#include "autoconf.h"
 #include "comm.h"
 #include "task.h"
 #include "stddebug.h"
 #include "debug.h"
 
+#ifndef WINE_INI_GLOBAL
+/* Get the WINE_INI_GLOBAL definition from autoconf.h */
+#include "autoconf.h"
+#endif
+
 #define WINE_INI_USER "~/.winerc"
 #define MAX_DOS_DRIVES	26
 
diff --git a/misc/file.c b/misc/file.c
index c3dc3ed..2488c63 100644
--- a/misc/file.c
+++ b/misc/file.c
@@ -276,18 +276,15 @@
     *((WORD*)(&ofs->reserved[0]))=
          ((now->tm_year * 0x200) + (now->tm_mon * 0x20) + now->tm_mday);
 
-
     if (action & OF_VERIFY)
       return (verify_time != *((int*)ofs->reserved));
 
-    if (action & OF_EXIST)
-      return 0;
-    
     if ((handle = _lopen( ofs->szPathName, wStyle )) == -1)
     {
         ofs->nErrCode = 2;  /* not found */
         return -1;
     }
+    if (action & OF_EXIST) close(handle);
     return handle;
 }
 
diff --git a/misc/main.c b/misc/main.c
index ceb206d..2a70dc4 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -28,17 +28,20 @@
 #include "stddebug.h"
 #include "debug.h"
 
-const char people[] = "Wine is available thanks to the work of "\
-"Bob Amstadt, Dag Asheim, Martin Ayotte, Ross Biro, Erik Bos, Fons Botman, "\
-"John Brezak, Andrew Bulhak, John Burton, Paul Falstad, Olaf Flebbe, "\
-"Peter Galbavy, Cameron Heide, Jeffrey Hsu, Miguel de Icaza, "\
-"Alexandre Julliard, Jon Konrath, Scott A. Laird, Martin von Loewis, "\
-"Kenneth MacDonald, Peter MacDonald, William Magro, David Metcalfe, "\
-"Michael Patra, John Richardson, Johannes Ruscheinski, Thomas Sandford, "\
-"Constantine Sapuntzakis, Bernd Schmidt, Yngvi Sigurjonsson, Rick Sladkey, "\
-"William Smith, Erik Svendsen, Goran Thyni, Jimmy Tirtawangsa, Jon Tombs, "\
-"Linus Torvalds, Michael Veksler, Carl Williams, Karl Guenter Wuensch, "\
-"Eric Youngdale, and James Youngman.";
+const char people[] = "Wine is available thanks to the work of "
+"Bob Amstadt, Dag Asheim, Martin Ayotte, Ross Biro, Erik Bos, "
+"Fons Botman, John Brezak, Andrew Bulhak, John Burton, Paul Falstad, "
+"Olaf Flebbe, Peter Galbavy, Ramon Garcia, Hans de Graaf, "
+"Charles M. Hannum, Cameron Heide, Jochen Hoenicke, Jeffrey Hsu, "
+"Miguel de Icaza, Alexandre Julliard, Jon Konrath, Scott A. Laird, "
+"Martin von Loewis, Kenneth MacDonald, Peter MacDonald, William Magro, "
+"Marcus Meissner, Graham Menhennitt, David Metcalfe, Michael Patra, "
+"John Richardson, Johannes Ruscheinski, Thomas Sandford, "
+"Constantine Sapuntzakis, Daniel Schepler, Bernd Schmidt, "
+"Yngvi Sigurjonsson, Rick Sladkey, William Smith, Erik Svendsen, "
+"Goran Thyni, Jimmy Tirtawangsa, Jon Tombs, Linus Torvalds, "
+"Gregory Trubetskoy, Michael Veksler, Morten Welinder, Jan Willamowius, "
+"Carl Williams, Karl Guenter Wuensch, Eric Youngdale, and James Youngman.";
 
 #define WINE_CLASS    "Wine"    /* Class name for resources */
 
@@ -64,6 +67,7 @@
     NULL,           /* desktopGeometry */
     NULL,           /* programName */
     FALSE,          /* usePrivateMap */
+    FALSE,          /* useFixedMap */
     FALSE,          /* synchronous */
     FALSE,          /* backing store */
     SW_SHOWNORMAL,  /* cmdShow */
@@ -84,6 +88,7 @@
     { "-ipc",           ".ipc",             XrmoptionNoArg,  (caddr_t)"off"},
     { "-name",          ".name",            XrmoptionSepArg, (caddr_t)NULL },
     { "-privatemap",    ".privatemap",      XrmoptionNoArg,  (caddr_t)"on" },
+    { "-fixedmap",      ".fixedmap",        XrmoptionNoArg,  (caddr_t)NULL },
     { "-synchronous",   ".synchronous",     XrmoptionNoArg,  (caddr_t)"on" },
     { "-debug",         ".debug",           XrmoptionNoArg,  (caddr_t)"on" },
     { "-debugmsg",      ".debugmsg",        XrmoptionSepArg, (caddr_t)NULL },
@@ -106,6 +111,7 @@
   "    -debug          Enter debugger before starting application\n" \
   "    -name name      Set the application name\n" \
   "    -privatemap     Use a private color map\n" \
+  "    -fixedmap       Use a \"standard\" color map\n" \
   "    -synchronous    Turn on synchronous display mode\n" \
   "    -backingstore   Turn on backing store\n" \
   "    -spy file       Obsolete. Use -debugmsg +spy for Spy messages\n" \
@@ -302,6 +308,8 @@
 	Options.cmdShow = SW_SHOWMINIMIZED;
     if (MAIN_GetResource( db, ".privatemap", &value ))
 	Options.usePrivateMap = TRUE;
+    if (MAIN_GetResource( db, ".fixedmap", &value ))
+	Options.useFixedMap = TRUE;
     if (MAIN_GetResource( db, ".synchronous", &value ))
 	Options.synchronous = TRUE;
     if (MAIN_GetResource( db, ".backingstore", &value ))
diff --git a/misc/network.c b/misc/network.c
index fd10f65..abf7e1b 100644
--- a/misc/network.c
+++ b/misc/network.c
@@ -215,7 +215,7 @@
  */
 UINT WNetGetUser(LPSTR lpLocalName, LPSTR lpUserName, DWORD *lpSize)
 {
-	printf("EMPTY STUB !!! WNetGetUser('%s', %p, %p);\n", 
+	printf("EMPTY STUB !!! WNetGetUser(%p, %p, %p);\n", 
 							lpLocalName, lpUserName, lpSize);
 	return WN_NET_ERROR;
 }
diff --git a/misc/ole2nls.c b/misc/ole2nls.c
index 3eccbd3..fbec3d7 100644
--- a/misc/ole2nls.c
+++ b/misc/ole2nls.c
@@ -24,6 +24,8 @@
 	return 9;
 #elif #LANG(De)
 	return 7;
+#elif #LANG(Es)
+	return 7; /* Just a Guess :-) */
 #elif #LANG(No)
 	return 0x14;
 #else
diff --git a/misc/shell.c b/misc/shell.c
index 758feb2..7588a57 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -8,11 +8,13 @@
 #include <ctype.h>
 #include "windows.h"
 #include "shell.h"
+#include "global.h"
 #include "neexe.h"
 #include "selectors.h"
+#include "alias.h"
+#include "relay32.h"
 #include "../rc/sysres.h"
 #include "dlgs.h"
-#include "dialog.h"
 #include "stddebug.h"
 #include "debug.h"
 
@@ -477,23 +479,39 @@
  */
 INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
 {
-  if (szApp) {
-    strcpy(AppName, szApp);
-  } else  {
-    *AppName = 0;
-  }
-  if (szOtherStuff) {
-    strcpy(AppMisc, szOtherStuff);
-  } else {
-    *AppMisc = 0;
-  }
-  if (!hIcon) {
-    hIcon = LoadIcon(0,MAKEINTRESOURCE(OIC_WINEICON));
-  }
-  return DialogBoxIndirectParamPtr(GetWindowWord(hWnd, GWW_HINSTANCE),
-				   sysres_DIALOG_SHELL_ABOUT_MSGBOX,
-				   hWnd, GetWndProcEntry16("AboutDlgProc"),
-				   hIcon);
+    HANDLE handle;
+    BOOL bRet;
+    DWORD WineProc,Win16Proc,Win32Proc;
+    static int initialized=0;
+
+    if (szApp) strcpy(AppName, szApp);
+    else *AppName = 0;
+
+    if (szOtherStuff) strcpy(AppMisc, szOtherStuff);
+    else *AppMisc = 0;
+
+    if (!hIcon) hIcon = LoadIcon(0,MAKEINTRESOURCE(OIC_WINEICON));
+    
+    if(!initialized)
+    {
+        WineProc=(DWORD)AboutDlgProc;
+        Win16Proc=(DWORD)GetWndProcEntry16("AboutDlgProc");
+        Win32Proc=(DWORD)RELAY32_GetEntryPoint("WINPROCS32","AboutDlgProc",0);
+        ALIAS_RegisterAlias(WineProc,Win16Proc,Win32Proc);
+        initialized=1;
+    }
+
+    handle = GLOBAL_CreateBlock( GMEM_FIXED,
+                                 sysres_DIALOG_SHELL_ABOUT_MSGBOX.bytes,
+                                 sysres_DIALOG_SHELL_ABOUT_MSGBOX.size,
+                                 GetCurrentPDB(), FALSE, FALSE,
+                                 TRUE, NULL );
+    if (!handle) return FALSE;
+    bRet = DialogBoxIndirectParam( GetWindowWord( hWnd, GWW_HINSTANCE ),
+                                   handle, hWnd,
+                                   GetWndProcEntry16("AboutDlgProc"), hIcon );
+    GLOBAL_FreeBlock( handle );
+    return bRet;
 }
 
 /*************************************************************************
diff --git a/misc/user32.c b/misc/user32.c
new file mode 100644
index 0000000..f5b280f
--- /dev/null
+++ b/misc/user32.c
@@ -0,0 +1,160 @@
+/*
+ * Win32 user functions
+ *
+ * Copyright 1995 Martin von Loewis
+ */
+
+/* This file contains only wrappers to existing Wine functions or trivial
+   stubs. 'Real' implementations go into context specific files */
+
+#include <unistd.h>
+#include "windows.h"
+#include "winerror.h"
+#include "relay32.h"
+#include "alias.h"
+#include "stackframe.h"
+
+/* Structure copy functions */
+static void MSG16to32(MSG *msg16,struct WIN32_MSG *msg32)
+{
+	msg32->hwnd=msg16->hwnd;
+	msg32->message=msg16->message;
+	msg32->wParam=msg16->wParam;
+	msg32->lParam=msg16->lParam;
+	msg32->time=msg16->time;
+	msg32->pt.x=msg16->pt.x;
+	msg32->pt.y=msg16->pt.y;
+}
+
+static void MSG32to16(struct WIN32_MSG *msg32,MSG *msg16)
+{
+	msg16->hwnd=msg32->hwnd;
+	msg16->message=msg32->message;
+	msg16->wParam=msg32->wParam;
+	msg16->lParam=msg32->lParam;
+	msg16->time=msg32->time;
+	msg16->pt.x=msg32->pt.x;
+	msg16->pt.y=msg32->pt.y;
+}
+
+/***********************************************************************
+ *           RegisterClassA      (USER32.426)
+ */
+ATOM USER32_RegisterClassA(WNDCLASSA* wndclass)
+{
+	WNDCLASS copy;
+	char *s1,*s2;
+	copy.style=wndclass->style;
+	ALIAS_RegisterAlias(0,0,wndclass->lpfnWndProc);
+	copy.lpfnWndProc=wndclass->lpfnWndProc;
+	copy.cbClsExtra=wndclass->cbClsExtra;
+	copy.cbWndExtra=wndclass->cbWndExtra;
+	copy.hInstance=wndclass->hInstance;
+	copy.hIcon=wndclass->hIcon;
+	copy.hCursor=wndclass->hCursor;
+	copy.hbrBackground=wndclass->hbrBackground;
+	if(wndclass->lpszMenuName)
+	{
+		s1=alloca(strlen(wndclass->lpszMenuName)+1);
+		strcpy(s1,wndclass->lpszMenuName);
+		copy.lpszMenuName=MAKE_SEGPTR(s1);
+	}else
+		copy.lpszMenuName=0;
+	if(wndclass->lpszClassName)
+	{
+		s2=alloca(strlen(wndclass->lpszClassName)+1);
+		strcpy(s2,wndclass->lpszClassName);
+		copy.lpszClassName=MAKE_SEGPTR(s2);
+	}
+	return RegisterClass(&copy);
+}
+
+/***********************************************************************
+ *          DefWindowProcA       (USER32.125)
+ */
+LRESULT USER32_DefWindowProcA(DWORD hwnd,DWORD msg,DWORD wParam,DWORD lParam)
+{
+	/* some messages certainly need special casing. We come to that later */
+	return DefWindowProc(hwnd,msg,wParam,lParam);
+}
+
+/***********************************************************************
+ *          GetMessageA          (USER32.269)
+ */
+BOOL USER32_GetMessageA(struct WIN32_MSG* lpmsg,DWORD hwnd,DWORD min,DWORD max)
+{
+	BOOL ret;
+	MSG msg;
+	ret=GetMessage(MAKE_SEGPTR(&msg),hwnd,min,max);
+	MSG16to32(&msg,lpmsg);
+	return ret;
+}
+
+/***********************************************************************
+ *          BeginPaint           (USER32.9)
+ */
+HDC USER32_BeginPaint(DWORD hwnd,struct WIN32_PAINTSTRUCT *lpps)
+{
+	PAINTSTRUCT ps;
+	HDC ret;
+	ret=BeginPaint(hwnd,&ps);
+	lpps->hdc=ps.hdc;
+	lpps->fErase=ps.fErase;
+	lpps->rcPaint.top=ps.rcPaint.top;
+	lpps->rcPaint.left=ps.rcPaint.left;
+	lpps->rcPaint.right=ps.rcPaint.right;
+	lpps->rcPaint.bottom=ps.rcPaint.bottom;
+	lpps->fRestore=ps.fRestore;
+	lpps->fIncUpdate=ps.fIncUpdate;
+	return ret;
+}
+
+/***********************************************************************
+ *          EndPaint             (USER32.175)
+ */
+BOOL USER32_EndPaint(DWORD hwnd,struct WIN32_PAINTSTRUCT *lpps)
+{
+	PAINTSTRUCT ps;
+	ps.hdc=lpps->hdc;
+	ps.fErase=lpps->fErase;
+	ps.rcPaint.top=lpps->rcPaint.top;
+	ps.rcPaint.left=lpps->rcPaint.left;
+	ps.rcPaint.right=lpps->rcPaint.right;
+	ps.rcPaint.bottom=lpps->rcPaint.bottom;
+	ps.fRestore=lpps->fRestore;
+	ps.fIncUpdate=lpps->fIncUpdate;
+	EndPaint(hwnd,&ps);
+	return TRUE;
+}
+
+/***********************************************************************
+ *         DispatchMessageA       (USER32.140)
+ */
+LONG USER32_DispatchMessageA(struct WIN32_MSG* lpmsg)
+{
+	MSG msg;
+	LONG ret;
+	MSG32to16(lpmsg,&msg);
+	ret=DispatchMessage(&msg);
+	MSG16to32(&msg,lpmsg);
+	return ret;
+}
+
+/***********************************************************************
+ *         CreateWindowExA        (USER32.82)
+ */
+DWORD USER32_CreateWindowExA(long flags,char* class,char *title,
+	long style,int x,int y,int width,int height,DWORD parent,DWORD menu,
+	DWORD instance,DWORD param)
+{
+    char *classbuf, *titlebuf;
+    /*Have to translate CW_USEDEFAULT */
+    if(x==0x80000000)x=CW_USEDEFAULT;
+    if(width==0x80000000)width=CW_USEDEFAULT;
+    classbuf = alloca( strlen(class)+1 );
+    strcpy( classbuf, class );
+    titlebuf = alloca( strlen(title)+1 );
+    strcpy( titlebuf, title );
+    return CreateWindowEx( flags, MAKE_SEGPTR(classbuf), MAKE_SEGPTR(titlebuf),
+                           style,x,y,width,height,parent,menu,instance,param );
+}
diff --git a/miscemu/Makefile.in b/miscemu/Makefile.in
index 426097d..6df68b0 100644
--- a/miscemu/Makefile.in
+++ b/miscemu/Makefile.in
@@ -1,15 +1,7 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+TOPSRC = @top_srcdir@
+MODULE = miscemu
 
-
-MODULE 	= miscemu
-
-SRCS = \
+C_SRCS = \
 	dosmem.c \
 	dpmi.c \
 	emulate.c \
@@ -26,29 +18,8 @@
 	interrupts.c \
 	ioports.c
 
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
-
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/miscemu/dosmem.c b/miscemu/dosmem.c
index 4ac0444..fd673ee 100644
--- a/miscemu/dosmem.c
+++ b/miscemu/dosmem.c
@@ -7,6 +7,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "windows.h"
 #include "global.h"
 #include "ldt.h"
@@ -137,7 +138,7 @@
 static void DOSMEM_Alarm(void)
 {
     pBiosData->Ticks = INT1A_GetTicksSinceMidnight();
-    printf( "Ticks = %d\n", pBiosData->Ticks );
+    printf( "Ticks = %ld\n", pBiosData->Ticks );
 /*
     signal( SIGALRM, DOSMEM_Alarm );
     alarm( 1 );
diff --git a/miscemu/int21.c b/miscemu/int21.c
index 720806c..d580ec5 100644
--- a/miscemu/int21.c
+++ b/miscemu/int21.c
@@ -303,8 +303,9 @@
 		return;
 	} else {
 		size = read(BX_reg(context), ptr, CX_reg(context));
-        	dprintf_int(stddeb, "int21: read (%d, void *, 0x%x) = 0x%x\n",
-                            BX_reg(context), CX_reg(context), size);
+        	dprintf_int(stddeb,"int21: read(%d, %04x:%04x, 0x%x) = 0x%x\n",
+                            BX_reg(context), DS_reg(context), DX_reg(context),
+                            CX_reg(context), size );
 		if (size == -1) {
 			errno_to_doserr();
 			AX_reg(context) = ExtendedError;
@@ -622,7 +623,7 @@
 {
 	dprintf_int (stddeb, "int21: close (%d)\n", BX_reg(context));
 
-	if (close(BX_reg(context)) == -1)
+	if (_lclose( BX_reg(context) ))
         {
 		errno_to_doserr();
 		AX_reg(context) = ExtendedError;
@@ -1761,6 +1762,9 @@
 		break;
 	    }
 	    break;
+    
+      case 0xdc: /* CONNECTION SERVICES - GET CONNECTION NUMBER */
+        break;
 
 	  case 0xea: /* NOVELL NETWARE - RETURN SHELL VERSION */
 	    break;
diff --git a/miscemu/int2f.c b/miscemu/int2f.c
index 3a9cad4..66a7a01 100644
--- a/miscemu/int2f.c
+++ b/miscemu/int2f.c
@@ -44,7 +44,7 @@
     case 0x00:  /* Windows enhanced mode installation check */
         AX_reg(context) = Options.enhanced ? WINVERSION : 0;
         break;
-
+	
     case 0x0a:  /* Get Windows version and type */
         AX_reg(context) = 0;
         BX_reg(context) = (WINVERSION >> 8) | ((WINVERSION << 8) & 0xff00);
@@ -54,6 +54,15 @@
     case 0x80:  /* Release time-slice */
         break;  /* nothing to do */
 
+	case 0x84:  /* Get device API entry point */
+	    fprintf(stderr,"Application attempted to access VxD %4X\n",
+			BX_reg(context));
+		fprintf(stderr,"This device is not known to Wine.");
+		fprintf(stderr,"Expect a failure now\n");
+		ES_reg(context)=0;
+		DI_reg(context)=0;
+		break;
+
     case 0x86:  /* DPMI detect mode */
         AX_reg(context) = 0;  /* Running under DPMI */
         break;
diff --git a/multimedia/Makefile.in b/multimedia/Makefile.in
index bc034fc..1e943af 100644
--- a/multimedia/Makefile.in
+++ b/multimedia/Makefile.in
@@ -1,15 +1,7 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+TOPSRC = @top_srcdir@
+MODULE = multimedia
 
-
-MODULE 	= multimedia
-
-SRCS = \
+C_SRCS = \
 	audio.c \
 	joystick.c \
 	mcianim.c \
@@ -20,29 +12,8 @@
 	mmsystem.c \
 	time.c
 
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
-
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/multimedia/mcistring.c b/multimedia/mcistring.c
index 653a907..f860563 100644
--- a/multimedia/mcistring.c
+++ b/multimedia/mcistring.c
@@ -374,7 +374,7 @@
 			FLAG1("nostatic",MCI_ANIM_OPEN_NOSTATIC);
 			if (!STRCMP(keywords[i],"parent") && (i+1<nrofkeywords)) {
 				dwFlags |= MCI_ANIM_OPEN_PARENT;
-				sscanf(keywords[i+1],"%u",&(U.animopenParams.hWndParent));
+				sscanf(keywords[i+1],"%hu",&(U.animopenParams.hWndParent));
 				i+=2;
 				continue;
 			}
@@ -406,7 +406,7 @@
 			/* looks just like anim, but without NOSTATIC */
 			if (!STRCMP(keywords[i],"parent") && (i+1<nrofkeywords)) {
 				dwFlags |= MCI_OVLY_OPEN_PARENT;
-				sscanf(keywords[i+1],"%d",&(U.ovlyopenParams.hWndParent));
+				sscanf(keywords[i+1],"%hd",&(U.ovlyopenParams.hWndParent));
 				i+=2;
 				continue;
 			}
@@ -539,7 +539,7 @@
 static DWORD
 MCISTR_Status(_MCISTR_PROTO_) {
 	MCI_STATUS_PARMS	statusParams;
-	int			type,i,res,timef;
+	int			type = 0,i,res,timef;
 
 	statusParams.dwCallback = 0;
 	dwFlags	|= MCI_STATUS_ITEM;
@@ -1379,10 +1379,10 @@
 		case MCI_DEVTYPE_OVERLAY:
 			if (!STRCMP(keywords[i],"at") && (i+4<nrofkeywords)) {
 				dwFlags |= MCI_OVLY_RECT;
-				sscanf(keywords[i+1],"%d",&(U.ovlyloadParams.rc.left));
-				sscanf(keywords[i+2],"%d",&(U.ovlyloadParams.rc.top));
-				sscanf(keywords[i+3],"%d",&(U.ovlyloadParams.rc.right));
-				sscanf(keywords[i+4],"%d",&(U.ovlyloadParams.rc.bottom));
+				sscanf(keywords[i+1],"%hd",&(U.ovlyloadParams.rc.left));
+				sscanf(keywords[i+2],"%hd",&(U.ovlyloadParams.rc.top));
+				sscanf(keywords[i+3],"%hd",&(U.ovlyloadParams.rc.right));
+				sscanf(keywords[i+4],"%hd",&(U.ovlyloadParams.rc.bottom));
 				memcpy(keywords+i,keywords+(i+5),nrofkeywords-(i+5));
 				continue;
 			}
@@ -1431,10 +1431,10 @@
 		case MCI_DEVTYPE_OVERLAY:
 			if (!STRCMP(keywords[i],"at") && (i+4<nrofkeywords)) {
 				dwFlags |= MCI_OVLY_RECT;
-				sscanf(keywords[i+1],"%d",&(U.ovlysaveParams.rc.left));
-				sscanf(keywords[i+2],"%d",&(U.ovlysaveParams.rc.top));
-				sscanf(keywords[i+3],"%d",&(U.ovlysaveParams.rc.right));
-				sscanf(keywords[i+4],"%d",&(U.ovlysaveParams.rc.bottom));
+				sscanf(keywords[i+1],"%hd",&(U.ovlysaveParams.rc.left));
+				sscanf(keywords[i+2],"%hd",&(U.ovlysaveParams.rc.top));
+				sscanf(keywords[i+3],"%hd",&(U.ovlysaveParams.rc.right));
+				sscanf(keywords[i+4],"%hd",&(U.ovlysaveParams.rc.bottom));
 				memcpy(keywords+i,keywords+(i+5),nrofkeywords-(i+5));
 				continue;
 			}
@@ -1599,10 +1599,10 @@
 		return MCIERR_UNSUPPORTED_FUNCTION;
 	i=0;while (i<nrofkeywords) {
 		if (!STRCMP(keywords[i],"at") && (i+4<nrofkeywords)) {
-			sscanf(keywords[i+1],"%ld",&(unfreezeParams.rc.left));
-			sscanf(keywords[i+2],"%ld",&(unfreezeParams.rc.top));
-			sscanf(keywords[i+3],"%ld",&(unfreezeParams.rc.right));
-			sscanf(keywords[i+4],"%ld",&(unfreezeParams.rc.bottom));
+			sscanf(keywords[i+1],"%hd",&(unfreezeParams.rc.left));
+			sscanf(keywords[i+2],"%hd",&(unfreezeParams.rc.top));
+			sscanf(keywords[i+3],"%hd",&(unfreezeParams.rc.right));
+			sscanf(keywords[i+4],"%hd",&(unfreezeParams.rc.bottom));
 			dwFlags |= MCI_OVLY_RECT;
 			i+=5;
 			continue;
@@ -1624,10 +1624,10 @@
 		return MCIERR_UNSUPPORTED_FUNCTION;
 	i=0;while (i<nrofkeywords) {
 		if (!STRCMP(keywords[i],"at") && (i+4<nrofkeywords)) {
-			sscanf(keywords[i+1],"%ld",&(freezeParams.rc.left));
-			sscanf(keywords[i+2],"%ld",&(freezeParams.rc.top));
-			sscanf(keywords[i+3],"%ld",&(freezeParams.rc.right));
-			sscanf(keywords[i+4],"%ld",&(freezeParams.rc.bottom));
+			sscanf(keywords[i+1],"%hd",&(freezeParams.rc.left));
+			sscanf(keywords[i+2],"%hd",&(freezeParams.rc.top));
+			sscanf(keywords[i+3],"%hd",&(freezeParams.rc.right));
+			sscanf(keywords[i+4],"%hd",&(freezeParams.rc.bottom));
 			dwFlags |= MCI_OVLY_RECT;
 			i+=5;
 			continue;
@@ -1665,10 +1665,10 @@
 			FLAG1("source",MCI_ANIM_PUT_SOURCE);
 			FLAG1("destination",MCI_ANIM_PUT_DESTINATION);
 			if (!STRCMP(keywords[i],"at") && (i+4<nrofkeywords)) {
-				sscanf(keywords[i+1],"%ld",&(U.animputParams.rc.left));
-				sscanf(keywords[i+2],"%ld",&(U.animputParams.rc.top));
-				sscanf(keywords[i+3],"%ld",&(U.animputParams.rc.right));
-				sscanf(keywords[i+4],"%ld",&(U.animputParams.rc.bottom));
+				sscanf(keywords[i+1],"%hd",&(U.animputParams.rc.left));
+				sscanf(keywords[i+2],"%hd",&(U.animputParams.rc.top));
+				sscanf(keywords[i+3],"%hd",&(U.animputParams.rc.right));
+				sscanf(keywords[i+4],"%hd",&(U.animputParams.rc.bottom));
 				dwFlags |= MCI_ANIM_RECT;
 				i+=5;
 				continue;
@@ -1680,10 +1680,10 @@
 			FLAG1("video",MCI_OVLY_PUT_VIDEO);
 			FLAG1("frame",MCI_OVLY_PUT_FRAME);
 			if (!STRCMP(keywords[i],"at") && (i+4<nrofkeywords)) {
-				sscanf(keywords[i+1],"%ld",&(U.ovlyputParams.rc.left));
-				sscanf(keywords[i+2],"%ld",&(U.ovlyputParams.rc.top));
-				sscanf(keywords[i+3],"%ld",&(U.ovlyputParams.rc.right));
-				sscanf(keywords[i+4],"%ld",&(U.ovlyputParams.rc.bottom));
+				sscanf(keywords[i+1],"%hd",&(U.ovlyputParams.rc.left));
+				sscanf(keywords[i+2],"%hd",&(U.ovlyputParams.rc.top));
+				sscanf(keywords[i+3],"%hd",&(U.ovlyputParams.rc.right));
+				sscanf(keywords[i+4],"%hd",&(U.ovlyputParams.rc.bottom));
 				dwFlags |= MCI_OVLY_RECT;
 				i+=5;
 				continue;
@@ -1792,17 +1792,17 @@
 	i=0;
 	while (i<nrofkeywords) {
 		if (!STRCMP(keywords[i],"at") && (i+4<nrofkeywords)) {
-			sscanf(keywords[i+1],"%ld",&(updateParams.rc.left));
-			sscanf(keywords[i+2],"%ld",&(updateParams.rc.top));
-			sscanf(keywords[i+3],"%ld",&(updateParams.rc.right));
-			sscanf(keywords[i+4],"%ld",&(updateParams.rc.bottom));
+			sscanf(keywords[i+1],"%hd",&(updateParams.rc.left));
+			sscanf(keywords[i+2],"%hd",&(updateParams.rc.top));
+			sscanf(keywords[i+3],"%hd",&(updateParams.rc.right));
+			sscanf(keywords[i+4],"%hd",&(updateParams.rc.bottom));
 			dwFlags |= MCI_ANIM_RECT;
 			i+=5;
 			continue;
 		}
 		if (!STRCMP(keywords[i],"hdc") && (i+1<nrofkeywords)) {
 			dwFlags |= MCI_ANIM_UPDATE_HDC;
-			sscanf(keywords[i+1],"%d",&(updateParams.hDC));
+			sscanf(keywords[i+1],"%hd",&(updateParams.hDC));
 			i+=2;
 			continue;
 		}
@@ -1891,7 +1891,7 @@
 				if (!STRCMP(keywords[i+1],"default")) 
 					U.animwindowParams.hWnd = MCI_OVLY_WINDOW_DEFAULT;
 				else
-					sscanf(keywords[i+1],"%d",&(U.animwindowParams.hWnd));
+					sscanf(keywords[i+1],"%hd",&(U.animwindowParams.hWnd));
 				i+=2;
 				continue;
 			}
@@ -1960,7 +1960,7 @@
 				if (!STRCMP(keywords[i+1],"default")) 
 					U.ovlywindowParams.hWnd = MCI_OVLY_WINDOW_DEFAULT;
 				else
-					sscanf(keywords[i+1],"%d",&(U.ovlywindowParams.hWnd));
+					sscanf(keywords[i+1],"%hd",&(U.ovlywindowParams.hWnd));
 				i+=2;
 				continue;
 			}
diff --git a/multimedia/time.c b/multimedia/time.c
index bfa5abc..00bffc4 100644
--- a/multimedia/time.c
+++ b/multimedia/time.c
@@ -10,8 +10,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include "windows.h"
+#include "win.h"
 #include "ldt.h"
 #include "callback.h"
+#include "module.h"
 #include "user.h"
 #include "driver.h"
 #include "mmsystem.h"
@@ -27,6 +29,7 @@
     WORD wDelay;
     WORD wResol;
     FARPROC lpFunc;
+    HINSTANCE hInstance;
     DWORD dwUser;
     WORD wFlags;
     WORD wTimerID;
@@ -42,6 +45,7 @@
  */
 WORD MMSysTimeCallback(HWND hWnd, WORD wMsg, INT nID, DWORD dwTime)
 {
+    FARPROC	lpFunc;
     LPTIMERENTRY lpTimer = lpTimerList;
     mmSysTimeMS.u.ms += 33;
     mmSysTimeSMPTE.u.smpte.frame++;
@@ -51,8 +55,26 @@
 	    lpTimer->wCurTime = lpTimer->wDelay;
 	    if (lpTimer->lpFunc != (FARPROC) NULL) {
 		dprintf_mmtime(stddeb, "MMSysTimeCallback // before CallBack16 !\n");
-		CallTimeFuncProc(lpTimer->lpFunc, lpTimer->wTimerID, 0,
-				 lpTimer->dwUser, 0, 0);
+		dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%08lx wTimerID=%04X dwUser=%08lX !\n",
+			lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
+		dprintf_mmtime(stddeb, "MMSysTimeCallback // hInstance=%04X !\n", lpTimer->hInstance);
+/*
+		lpFunc = MakeProcInstance(lpTimer->hInstance, lpTimer->lpFunc);
+		dprintf_mmtime(stddeb, "MMSysTimeCallback // MakeProcInstance(lpFunc)=%p %p !\n", 
+			lpFunc, PTR_SEG_TO_LIN(lpFunc));
+*/
+		lpFunc = MODULE_GetEntryPoint( lpTimer->hInstance,
+                      MODULE_GetOrdinal(lpTimer->hInstance,"TimerCallBack" ));
+		dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%08lx !\n", lpFunc);
+		
+		CallTo16_word_wwlll(lpTimer->lpFunc,
+			lpTimer->hInstance, lpTimer->wTimerID, 
+			0, lpTimer->dwUser, 0, 0);
+
+/*
+		CallTimeFuncProc(lpTimer->lpFunc, lpTimer->wTimerID, 
+				0, lpTimer->dwUser, 0, 0);
+*/
 		dprintf_mmtime(stddeb, "MMSysTimeCallback // after CallBack16 !\n");
 		fflush(stdout);
 	    }
@@ -104,7 +126,7 @@
     WORD wNewID = 0;
     LPTIMERENTRY lpNewTimer;
     LPTIMERENTRY lpTimer = lpTimerList;
-    dprintf_mmsys(stddeb, "timeSetEvent(%u, %u, %p, %08lX, %04X);\n",
+    dprintf_mmtime(stddeb, "timeSetEvent(%u, %u, %p, %08lX, %04X);\n",
 		  wDelay, wResol, lpFunc, dwUser, wFlags);
     if (!mmTimeStarted)
 	StartMMTime();
@@ -130,6 +152,10 @@
     lpNewTimer->wDelay = wDelay;
     lpNewTimer->wResol = wResol;
     lpNewTimer->lpFunc = (FARPROC) lpFunc;
+    lpNewTimer->hInstance = GetTaskDS();
+	dprintf_mmtime(stddeb, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
+	dprintf_mmtime(stddeb, "timeSetEvent // PTR_SEG_TO_LIN(lpFunc)=%p !\n", 
+				PTR_SEG_TO_LIN(lpFunc));
     lpNewTimer->dwUser = dwUser;
     lpNewTimer->wFlags = wFlags;
     return lpNewTimer->wTimerID;
diff --git a/objects/Makefile.in b/objects/Makefile.in
index 9a9a6af..f88bb21 100644
--- a/objects/Makefile.in
+++ b/objects/Makefile.in
@@ -1,39 +1,27 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+TOPSRC = @top_srcdir@
+MODULE = objects
 
-
-MODULE 	= objects
-
-SRCS 	= bitblt.c bitmap.c brush.c clipping.c color.c dc.c dcvalues.c \
-	dib.c font.c gdiobj.c linedda.c metafile.c oembitmap.c palette.c \
-	pen.c region.c text.c
-
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
+C_SRCS = \
+	bitblt.c \
+	bitmap.c \
+	brush.c \
+	clipping.c \
+	color.c \
+	dc.c \
+	dcvalues.c \
+	dib.c \
+	font.c \
+	gdiobj.c \
+	linedda.c \
+	metafile.c \
+	oembitmap.c \
+	palette.c \
+	pen.c \
+	region.c \
+	text.c
 
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/objects/color.c b/objects/color.c
index c10a6c0..bde033b 100644
--- a/objects/color.c
+++ b/objects/color.c
@@ -12,9 +12,18 @@
 #include "options.h"
 #include "gdi.h"
 #include "color.h"
-
+#include "palette.h"
 
 Colormap COLOR_WinColormap = 0;
+int COLOR_FixedMap = 0;
+
+int COLOR_Redshift = 0;
+int COLOR_Redmax = 0;
+int COLOR_Greenshift = 0;
+int COLOR_Greenmax = 0;
+int COLOR_Blueshift = 0;
+int COLOR_Bluemax = 0;
+int COLOR_Graymax = 0;
 
   /* System palette static colors */
 
@@ -181,6 +190,23 @@
     return hpalette;
 }
 
+void
+COLOR_Computeshifts(unsigned long maskbits, int *shift, int *max)
+{
+    int i;
+
+    if(maskbits==0) {
+        *shift=0;
+        *max=0;
+        return;
+    }
+
+    for(i=0;!(maskbits&1);i++)
+        maskbits >>= 1;
+
+    *shift = i;
+    *max = maskbits;
+}
 
 /***********************************************************************
  *           COLOR_Init
@@ -190,12 +216,13 @@
 HPALETTE COLOR_Init(void)
 {
     Visual * visual = DefaultVisual( display, DefaultScreen(display) );
-    
+
     switch(visual->class)
     {
     case GrayScale:
     case PseudoColor:
     case DirectColor:
+        COLOR_FixedMap = 0;
 	if (Options.usePrivateMap)
 	{
 	    COLOR_WinColormap = XCreateColormap( display, rootWindow,
@@ -214,11 +241,21 @@
 		break;
 	    }
 	}
+	COLOR_WinColormap = DefaultColormapOfScreen( screen );
+        break;
 	/* Fall through */
     case StaticGray:
+	COLOR_WinColormap = DefaultColormapOfScreen( screen );
+	COLOR_FixedMap = 1;
+        COLOR_Graymax = (1<<screenDepth)-1;
+        break;
     case StaticColor:
     case TrueColor:
 	COLOR_WinColormap = DefaultColormapOfScreen( screen );
+	COLOR_FixedMap = 1;
+        COLOR_Computeshifts(visual->red_mask, &COLOR_Redshift, &COLOR_Redmax);
+        COLOR_Computeshifts(visual->green_mask, &COLOR_Greenshift, &COLOR_Greenmax);
+        COLOR_Computeshifts(visual->blue_mask, &COLOR_Blueshift, &COLOR_Bluemax);
 	break;	
     }
     return COLOR_InitPalette();
@@ -251,22 +288,84 @@
  *           COLOR_ToPhysical
  *
  * Return the physical color closest to 'color'.
+ *
+ * ESW: This still needs a lot of work; in particular, what happens when
+ * we have really large (> 8 bit) DirectColor boards?
+ * But it should work better in 16 and 24 bit modes now.
+ * (At least it pays attention to the X server's description
+ * in TrueColor mode, instead of blindly passing through the
+ * color spec and swapping red to blue or losing blue and part of the
+ * green entirely, depending on what mode one is in!)
+ *
  */
 int COLOR_ToPhysical( DC *dc, COLORREF color )
 {
     WORD index = 0;
     WORD *mapping;
 
-    if (screenDepth > 8) return color;
+    /* if (screenDepth > 8) return color; */
+
     if (dc && (dc->w.bitsPerPixel == 1) && ((color >> 24) == 0))
     {
+	/* monochrome */
         if (((color >> 16) & 0xff) +
             ((color >> 8) & 0xff) + (color & 0xff) > 255*3/2)
             return 1;  /* white */
         else return 0;  /* black */
     }
-    
-    switch(color >> 24)
+
+    if(COLOR_FixedMap) {
+
+        /* there is no colormap possible; we are going to have to compute
+           the pixel value from the visual information stored earlier */
+
+	unsigned long which = color >> 24;
+
+	unsigned long red, green, blue;
+	unsigned idx;
+	PALETTEOBJ * palPtr;
+
+	switch(which) {
+		case 0: /* RGB */
+		case 2: /* PALETTERGB -- needs some work, but why bother; we've got a REALLY LARGE number of colors...? */
+		default:
+
+		red = GetRValue(color);
+		green = GetGValue(color);
+		blue = GetBValue(color);
+		break;
+
+		case 1: /* PALETTEIDX -- hmm, get the real color from the stock palette */
+		palPtr = (PALETTEOBJ *) GDI_GetObjPtr( STOCK_DEFAULT_PALETTE, PALETTE_MAGIC);
+		idx = color & 0xffff;
+		if(idx >= palPtr->logpalette.palNumEntries) {
+			/* out of bounds */
+			red = green = blue = 0;
+		}
+		else {
+			red = palPtr->logpalette.palPalEntry[idx].peRed;
+			green = palPtr->logpalette.palPalEntry[idx].peGreen;
+			blue = palPtr->logpalette.palPalEntry[idx].peBlue;
+		}
+	}
+
+	if(COLOR_Graymax) {
+	    /* grayscale only; return scaled value */
+            return ( (red * 30 + green * 69 + blue * 11) * COLOR_Graymax) / 25500;
+	}
+	else {
+	    /* scale each individually and construct the TrueColor pixel value */
+	    if(COLOR_Redmax != 255)
+                red = (red * COLOR_Redmax) / 255;
+	    if(COLOR_Greenmax != 255)
+                green = (green * COLOR_Greenmax) / 255;
+	    if(COLOR_Bluemax != 255)
+                blue = (blue * COLOR_Bluemax) / 255;
+
+	    return (red << COLOR_Redshift) | (green << COLOR_Greenshift) | (blue << COLOR_Blueshift);
+        }
+    }
+    else switch(color >> 24)
     {
     case 0:  /* RGB */
 	index = GetNearestPaletteIndex( STOCK_DEFAULT_PALETTE, color );
@@ -338,7 +437,7 @@
     WORD index;
     DC *dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return 0;
-    if (screenDepth > 8) return color;
+    if (screenDepth > 8) return color; /* FIXME */
     index = (WORD)(COLOR_ToPhysical( dc, color & 0xffffff ) & 0xffff);
     return PALETTEINDEX( index );
 }
diff --git a/objects/dib.c b/objects/dib.c
index a023280..c976180 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -680,6 +680,12 @@
 {
     HBITMAP handle;
     
+	if(header->biSize!=sizeof(BITMAPINFOHEADER))
+	{
+		fprintf(stderr,"CreateDIBitmap: wrong size (%ld) for header\n",
+			header->biSize);
+		return 0;
+	}
     handle = CreateCompatibleBitmap( hdc, header->biWidth, header->biHeight );
 /*    handle = CreateBitmap( header->biWidth, header->biHeight,
                            1, header->biBitCount, NULL );
@@ -727,3 +733,11 @@
     SetBkColor( hDC, oldBg );
     return TRUE;
 }
+/***********************************************************************
+ *           CopyIcon    (USER.368)
+ */
+BOOL CopyIcon(HANDLE handle, HICON hIcon)
+{
+    printf("STUB !!! CopyIcon: %x %x\n",handle,hIcon);
+    return TRUE;
+}
diff --git a/rc/Makefile.in b/rc/Makefile.in
index 63c42d0..aec8d02 100644
--- a/rc/Makefile.in
+++ b/rc/Makefile.in
@@ -1,50 +1,38 @@
-CC	= @CC@
-CFLAGS	= @CFLAGS@
-TOPSRC	= @top_srcdir@
-DIVINCL	= -I$(TOPSRC)/include
-BISON	= @YACC@
-FLEX	= @LEX@
-LANG	= @LANG@
-COMPILE	= $(CC) $(CFLAGS) $(DIVINCL) $(LANG)
+TOPSRC = @top_srcdir@
 
-all: rc.o
+MODULE = rc
+
+C_SRCS = sysres.c
+
+all: $(MODULE).o
+
+@MAKE_RULES@
 
 y.tab.c y.tab.h: parser.y
-	$(BISON) -d -t parser.y
+	$(YACC) -d -t parser.y
 
-lex.yy.c: parser.l parser.h y.tab.h
-	$(FLEX) -8 -I parser.l
+lex.yy.c: parser.l
+	$(LEX) -8 -I parser.l
 
 winerc: lex.yy.o winerc.o y.tab.o
-	$(COMPILE) lex.yy.o winerc.o y.tab.o -o winerc
+	$(CC) $(ALLCFLAGS) lex.yy.o winerc.o y.tab.o -o winerc $(LEXLIB)
 
-sysres.rct: sysres.rc
+sysres.rct: sysres.rc sysres_En.rc sysres_Es.rc sysres_De.rc sysres_No.rc
 	echo "#include \"windows.h\"" >sysres.rct
 	echo WINDOWS_H_ENDS_HERE >>sysres.rct
 	cat sysres.rc >>sysres.rct
 
 sysres.c sysres.h: sysres.rct winerc
-	$(COMPILE) -E -x c -P sysres.rct > sysres.tmp
-	cat sysres.tmp | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | ./winerc -o sysres -v -p sysres
+	$(CC) $(ALLCFLAGS) -E -x c -P sysres.rct | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | ./winerc -o sysres -v -p sysres
 
-rc.o: sysres.o
-	cp sysres.o rc.o
+clean::
+	$(RM) lex.yy.c sysres.rct winerc y.tab.c y.tab.h sysres.c sysres.h
 
-.c.o:
-	$(COMPILE) -c -o $*.o $<
+langclean::
+	$(RM) sysres.c sysres.h sysres.o
 
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-	rm -f lex.yy.c sysres.tmp sysres.rct winerc y.tab.c y.tab.h sysres.c sysres.h
-
-distclean: clean
-	rm -f Makefile
-
-countryclean:
-
-depend: sysres.h
-
-y.tab.o: y.tab.c
-lex.yy.o: lex.yy.c
+y.tab.o: y.tab.c y.tab.h parser.h
+lex.yy.o: lex.yy.c y.tab.h parser.h
 winerc.o: $(TOPSRC)/include/windows.h $(TOPSRC)/include/neexe.h parser.h y.tab.h
  
+### Dependencies:
diff --git a/rc/sysres.rc b/rc/sysres.rc
index ecd7859..4cd2efd 100644
--- a/rc/sysres.rc
+++ b/rc/sysres.rc
@@ -1,210 +1,11 @@
 #if #LANG(En)
-
-SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
-{
- MENUITEM "&Restore", 61728
- MENUITEM "&Move", 61456
- MENUITEM "&Size", 61440
- MENUITEM "Mi&nimize", 61472
- MENUITEM "Ma&ximize", 61488
- MENUITEM SEPARATOR
- MENUITEM "&Close\tAlt-F4", 61536
- MENUITEM SEPARATOR
- MENUITEM "&Switch to ...\tCtrl-Esc", 61744
- MENUITEM SEPARATOR
- MENUITEM "&About WINE ...", 61761
-}
-
-MSGBOX DIALOG 100, 80, 216, 168
-STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-BEGIN
-        ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
-        LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
-        PUSHBUTTON "&Ok", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-        PUSHBUTTON "&Cancel", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-        PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-        PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-        PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-        PUSHBUTTON "&Yes", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-        PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-END
-
-SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 213, 179
-STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "About %s"
-FONT 10, "System"
-{
- DEFPUSHBUTTON "OK", 1, 86, 160, 40, 14
- CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 205, 120
- LTEXT "Text", 100, 11, 40, 190, 110, SS_NOPREFIX | WS_GROUP
- ICON "", 1088, 185, 10, 18, 20
-}
-
-
-3 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Open"
-FONT 8, "Helv"
-{
- LTEXT "File &Name:", 1090, 6, 6, 76, 9
- EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
- LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
- LTEXT "&Directories:", -1, 110, 6, 92, 9
- LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
- LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
- LTEXT "List Files of &Type:", 1089, 6, 104, 90, 9
- COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- LTEXT "Dri&ves:", 1091, 110, 104, 92, 9
- COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- DEFPUSHBUTTON "Open", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "&Help", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
- CHECKBOX "&Read Only", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
-}
-
-
-4 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Save As ..."
-FONT 8, "Helv"
-{
- LTEXT "File &Name:", 1090, 6, 6, 76, 9
- EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
- LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
- LTEXT "&Directories:", -1, 110, 6, 92, 9
- LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
- LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
- LTEXT "List Files of &Type:", 1089, 6, 104, 90, 9
- COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- LTEXT "Dri&ves:", 1091, 110, 104, 92, 9
- COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- DEFPUSHBUTTON "Save As", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "&Help", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
- CHECKBOX "&Read Only", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
-}
-
-
-5 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Print"
-FONT 8, "Helv"
-{
- LTEXT "Printer:", 1088, 6, 6, 40, 9
- LTEXT "", 1089, 60, 6, 150, 9
- GROUPBOX "Print Range", 1072, 6, 30, 160, 65, BS_GROUPBOX
- RADIOBUTTON "&All", 1056, 16, 45, 60, 12
- RADIOBUTTON "S&election", 1057, 16, 60, 60, 12
- RADIOBUTTON "&Pages", 1058, 16, 75, 60, 12
- DEFPUSHBUTTON "Print", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "&Setup", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
- LTEXT "&From:", 1090, 60, 80, 30, 9
- LTEXT "&To:", 1091, 120, 80, 30, 9
- LTEXT "Print &Quality:", 1092, 6, 100, 76, 9
- COMBOBOX 1136, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- CHECKBOX "Print to Fi&le", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- CHECKBOX "Condensed", 1041, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
-}
-
-
-6 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Print Setup"
-FONT 8, "Helv"
-{
- GROUPBOX "Printer", 1072, 6, 10, 180, 65, BS_GROUPBOX
- RADIOBUTTON "&Default Printer", 1056, 16, 20, 80, 12
- LTEXT "[none]", 1088, 35, 35, 120, 9
- RADIOBUTTON "Specific &Printer", 1057, 16, 50, 80, 12
- COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "&Setup", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
- GROUPBOX "Orientation", 1073, 6, 85, 100, 50, BS_GROUPBOX
- RADIOBUTTON "Po&rtrait", 1058, 50, 100, 40, 12
- RADIOBUTTON "&Landscape", 1059, 50, 115, 40, 12
- ICON "LANDSCAP", 1097, 10, 95, 32, 32
- ICON "PORTRAIT", 1098, 10, 95, 32, 32
- GROUPBOX "Paper", 1074, 120, 85, 180, 50, BS_GROUPBOX
- LTEXT "Si&ze", 1089, 130, 95, 30, 9
- LTEXT "&Source", 1090, 130, 110, 30, 9
- COMBOBOX 1137, 155, 95, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- COMBOBOX 1138, 155, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
-}
-
-
-7 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Font"
-FONT 8, "Helv"
-{
- LTEXT "Font:", 1088, 6, 6, 40, 9
- LTEXT "", 1089, 60, 6, 150, 9
- DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
-}
-
-
-8 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Color"
-FONT 8, "Helv"
-{
- LTEXT "&Basic Colors:", 1088, 6, 6, 40, 9
- LTEXT "&Custom Colors:", 1089, 6, 126, 40, 9
- LTEXT "Color|Sol&id", 1090, 100, 146, 40, 9
- LTEXT "&Hue:", 1091, 150, 126, 40, 9
- LTEXT "&Sat:", 1092, 150, 146, 40, 9
- LTEXT "&Lum:", 1093, 150, 166, 40, 9
- LTEXT "&Red:", 1094, 150, 126, 40, 9
- LTEXT "&Green:", 1095, 150, 146, 40, 9
- LTEXT "Bl&ue:", 1096, 150, 166, 40, 9
- DEFPUSHBUTTON "Ok", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "&Add to Custom Colors", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "&Delete Custom Colors", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
-}
-
-
-9 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 84
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Find"
-FONT 8, "Helv"
-{
- LTEXT "Fi&nd What:", 1088, 6, 6, 40, 9
- LTEXT "", 1089, 60, 6, 150, 9
- CHECKBOX "Match &Whole Word Only", 1040, 20, 30, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- CHECKBOX "Match &Case", 1041, 20, 50, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- GROUPBOX "Direction", 1072, 90, 40, 80, 40, BS_GROUPBOX
- RADIOBUTTON "&Up", 1056, 100, 50, 50, 12
- RADIOBUTTON "&Down", 1057, 150, 50, 50, 12
- DEFPUSHBUTTON "&Find Next", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
-}
-
-
-10 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 114
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Replace"
-FONT 8, "Helv"
-{
- LTEXT "Fi&nd What:", 1088, 6, 6, 40, 9
- LTEXT "", 1089, 60, 6, 150, 9
- LTEXT "Re&place With:", 1090, 6, 26, 40, 9
- LTEXT "", 1091, 60, 26, 150, 9
- CHECKBOX "Match &Whole Word Only", 1040, 20, 40, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- CHECKBOX "Match &Case", 1041, 20, 60, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- DEFPUSHBUTTON "&Find Next", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "&Replace", 1024, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Replace &All", 1025, 206, 44, 56, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", 2, 206, 64, 56, 14, WS_GROUP | WS_TABSTOP
-}
-
+#include "sysres_En.rc"
 #elif #LANG(De)
 #include "sysres_De.rc"
 #elif #LANG(No)
 #include "sysres_No.rc"
+#elif #LANG(Es)
+#include "sysres_Es.rc"
 #else
 #error LANG not set to an implemented language.
 #endif
diff --git a/rc/sysres_De.rc b/rc/sysres_De.rc
index 6201a65..770d011 100644
--- a/rc/sysres_De.rc
+++ b/rc/sysres_De.rc
@@ -27,19 +27,19 @@
         PUSHBUTTON "&Nein", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
-SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 213, 179
+SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 223, 200
 STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Info über %s"
 FONT 10, "System"
 {
- DEFPUSHBUTTON "OK", 1, 86, 160, 40, 14
- CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 205, 120
- LTEXT "Text", 100, 11, 40, 190, 110, SS_NOPREFIX | WS_GROUP
- ICON "", 1088, 185, 10, 18, 20
+ DEFPUSHBUTTON "OK", 1, 91, 180, 40, 14
+ CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 215, 140
+ LTEXT "Text", 100, 11, 40, 200, 130, SS_NOPREFIX | WS_GROUP
+ ICON "", 1088, 195, 10, 18, 20
 }
 
 
-3 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Öffnen"
 FONT 8, "Helv"
@@ -61,7 +61,7 @@
 }
 
 
-4 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Speichern als ..."
 FONT 8, "Helv"
@@ -83,7 +83,7 @@
 }
 
 
-5 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+PRINT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Drucken"
 FONT 8, "Helv"
@@ -106,7 +106,7 @@
 }
 
 
-6 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+PRINT_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Druckereinrichtung"
 FONT 8, "Helv"
@@ -132,7 +132,7 @@
 }
 
 
-7 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Font"
 FONT 8, "Helv"
@@ -144,7 +144,7 @@
 }
 
 
-8 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
+CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Farbe"
 FONT 8, "Helv"
@@ -165,7 +165,7 @@
 }
 
 
-9 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 84
+FIND_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 84
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Suchen"
 FONT 8, "Helv"
@@ -182,7 +182,7 @@
 }
 
 
-10 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 114
+REPLACE_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 114
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Ersetzen"
 FONT 8, "Helv"
diff --git a/rc/sysres_En.rc b/rc/sysres_En.rc
new file mode 100644
index 0000000..b90b9b8
--- /dev/null
+++ b/rc/sysres_En.rc
@@ -0,0 +1,200 @@
+SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
+{
+ MENUITEM "&Restore", 61728
+ MENUITEM "&Move", 61456
+ MENUITEM "&Size", 61440
+ MENUITEM "Mi&nimize", 61472
+ MENUITEM "Ma&ximize", 61488
+ MENUITEM SEPARATOR
+ MENUITEM "&Close\tAlt-F4", 61536
+ MENUITEM SEPARATOR
+ MENUITEM "&Switch to ...\tCtrl-Esc", 61744
+ MENUITEM SEPARATOR
+ MENUITEM "&About WINE ...", 61761
+}
+
+MSGBOX DIALOG 100, 80, 216, 168
+STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+BEGIN
+        ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
+        LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
+        PUSHBUTTON "&Ok", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Cancel", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Yes", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+END
+
+SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 223, 200
+STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "About %s"
+FONT 10, "System"
+{
+ DEFPUSHBUTTON "OK", 1, 91, 180, 40, 14
+ CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 215, 140
+ LTEXT "Text", 100, 11, 40, 200, 130, SS_NOPREFIX | WS_GROUP
+ ICON "", 1088, 195, 10, 18, 20
+}
+
+
+OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Open"
+FONT 8, "Helv"
+{
+ LTEXT "File &Name:", 1090, 6, 6, 76, 9
+ EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
+ LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "&Directories:", -1, 110, 6, 92, 9
+ LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
+ LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "List Files of &Type:", 1089, 6, 104, 90, 9
+ COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Dri&ves:", 1091, 110, 104, 92, 9
+ COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "Open", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Help", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ CHECKBOX "&Read Only", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+}
+
+
+SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Save As ..."
+FONT 8, "Helv"
+{
+ LTEXT "File &Name:", 1090, 6, 6, 76, 9
+ EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
+ LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "&Directories:", -1, 110, 6, 92, 9
+ LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
+ LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "List Files of &Type:", 1089, 6, 104, 90, 9
+ COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Dri&ves:", 1091, 110, 104, 92, 9
+ COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "Save As", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Help", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ CHECKBOX "&Read Only", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+}
+
+
+PRINT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Print"
+FONT 8, "Helv"
+{
+ LTEXT "Printer:", 1088, 6, 6, 40, 9
+ LTEXT "", 1089, 60, 6, 150, 9
+ GROUPBOX "Print Range", 1072, 6, 30, 160, 65, BS_GROUPBOX
+ RADIOBUTTON "&All", 1056, 16, 45, 60, 12
+ RADIOBUTTON "S&election", 1057, 16, 60, 60, 12
+ RADIOBUTTON "&Pages", 1058, 16, 75, 60, 12
+ DEFPUSHBUTTON "Print", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Setup", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ LTEXT "&From:", 1090, 60, 80, 30, 9
+ LTEXT "&To:", 1091, 120, 80, 30, 9
+ LTEXT "Print &Quality:", 1092, 6, 100, 76, 9
+ COMBOBOX 1136, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ CHECKBOX "Print to Fi&le", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ CHECKBOX "Condensed", 1041, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+}
+
+
+PRINT_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Print Setup"
+FONT 8, "Helv"
+{
+ GROUPBOX "Printer", 1072, 6, 10, 180, 65, BS_GROUPBOX
+ RADIOBUTTON "&Default Printer", 1056, 16, 20, 80, 12
+ LTEXT "[none]", 1088, 35, 35, 120, 9
+ RADIOBUTTON "Specific &Printer", 1057, 16, 50, 80, 12
+ COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Setup", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ GROUPBOX "Orientation", 1073, 6, 85, 100, 50, BS_GROUPBOX
+ RADIOBUTTON "Po&rtrait", 1058, 50, 100, 40, 12
+ RADIOBUTTON "&Landscape", 1059, 50, 115, 40, 12
+ ICON "LANDSCAP", 1097, 10, 95, 32, 32
+ ICON "PORTRAIT", 1098, 10, 95, 32, 32
+ GROUPBOX "Paper", 1074, 120, 85, 180, 50, BS_GROUPBOX
+ LTEXT "Si&ze", 1089, 130, 95, 30, 9
+ LTEXT "&Source", 1090, 130, 110, 30, 9
+ COMBOBOX 1137, 155, 95, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX 1138, 155, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+}
+
+
+CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Font"
+FONT 8, "Helv"
+{
+ LTEXT "Font:", 1088, 6, 6, 40, 9
+ LTEXT "", 1089, 60, 6, 150, 9
+ DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+
+CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Color"
+FONT 8, "Helv"
+{
+ LTEXT "&Basic Colors:", 1088, 6, 6, 40, 9
+ LTEXT "&Custom Colors:", 1089, 6, 126, 40, 9
+ LTEXT "Color|Sol&id", 1090, 100, 146, 40, 9
+ LTEXT "&Hue:", 1091, 150, 126, 40, 9
+ LTEXT "&Sat:", 1092, 150, 146, 40, 9
+ LTEXT "&Lum:", 1093, 150, 166, 40, 9
+ LTEXT "&Red:", 1094, 150, 126, 40, 9
+ LTEXT "&Green:", 1095, 150, 146, 40, 9
+ LTEXT "Bl&ue:", 1096, 150, 166, 40, 9
+ DEFPUSHBUTTON "Ok", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Add to Custom Colors", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Delete Custom Colors", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+
+FIND_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 84
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Find"
+FONT 8, "Helv"
+{
+ LTEXT "Fi&nd What:", 1088, 6, 6, 40, 9
+ LTEXT "", 1089, 60, 6, 150, 9
+ CHECKBOX "Match &Whole Word Only", 1040, 20, 30, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ CHECKBOX "Match &Case", 1041, 20, 50, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ GROUPBOX "Direction", 1072, 90, 40, 80, 40, BS_GROUPBOX
+ RADIOBUTTON "&Up", 1056, 100, 50, 50, 12
+ RADIOBUTTON "&Down", 1057, 150, 50, 50, 12
+ DEFPUSHBUTTON "&Find Next", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+
+REPLACE_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 114
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Replace"
+FONT 8, "Helv"
+{
+ LTEXT "Fi&nd What:", 1088, 6, 6, 40, 9
+ LTEXT "", 1089, 60, 6, 150, 9
+ LTEXT "Re&place With:", 1090, 6, 26, 40, 9
+ LTEXT "", 1091, 60, 26, 150, 9
+ CHECKBOX "Match &Whole Word Only", 1040, 20, 40, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ CHECKBOX "Match &Case", 1041, 20, 60, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ DEFPUSHBUTTON "&Find Next", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Replace", 1024, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Replace &All", 1025, 206, 44, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", 2, 206, 64, 56, 14, WS_GROUP | WS_TABSTOP
+}
diff --git a/rc/sysres_Es.rc b/rc/sysres_Es.rc
new file mode 100644
index 0000000..c472ae9
--- /dev/null
+++ b/rc/sysres_Es.rc
@@ -0,0 +1,202 @@
+
+SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
+{
+ MENUITEM "&Restaurer", 61728
+ MENUITEM "&Mover", 61456
+ MENUITEM "&Tamaño", 61440
+ MENUITEM "Mi&nimizar", 61472
+ MENUITEM "Ma&ximizar", 61488
+ MENUITEM SEPARATOR
+ MENUITEM "&Cerrar\tAlt-F4", 61536
+ MENUITEM SEPARATOR
+ MENUITEM "Cam&biar a ...\tCtrl-Esc", 61744
+ MENUITEM SEPARATOR
+ MENUITEM "&Acerca de WINE...", 61761
+}
+
+MSGBOX DIALOG 100, 80, 216, 168
+STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+BEGIN
+        ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
+        LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
+        PUSHBUTTON "&Aceptar", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Cancelar", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Abortar", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Reintentar", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Ignorar", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&Sí", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+        PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+END
+
+SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 223, 200
+STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Acerca de %s"
+FONT 10, "System"
+{
+ DEFPUSHBUTTON "Aceptar", 1, 91, 180, 40, 14
+ CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 215, 140
+ LTEXT "Text", 100, 11, 40, 200, 130, SS_NOPREFIX | WS_GROUP
+ ICON "", 1088, 195, 10, 18, 20
+}
+
+
+OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Abrir"
+FONT 8, "Helv"
+{
+ LTEXT "Nombre de &archivo:", 1090, 6, 6, 76, 9
+ EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
+ LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "&Directorios:", -1, 110, 6, 92, 9
+ LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
+ LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "&Mostrar archivos de tipo:", 1089, 6, 104, 90, 9
+ COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ LTEXT "U&nidades:", 1091, 110, 104, 92, 9
+ COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "Abrir", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "A&yuda", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ CHECKBOX "&Solo lectura", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+}
+
+
+SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "&Guardar como..."
+FONT 8, "Helv"
+{
+ LTEXT "Nombre de &archivo:", 1090, 6, 6, 76, 9
+ EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
+ LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "&Directorios:", -1, 110, 6, 92, 9
+ LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
+ LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
+ LTEXT "&Mostrar archivos de tipo:", 1089, 6, 104, 90, 9
+ COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ LTEXT "U&nidades:", 1091, 110, 104, 92, 9
+ COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&Guardar como", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "A&yuda", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ CHECKBOX "&Solo lectura", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+}
+
+
+PRINT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Imprimir"
+FONT 8, "Helv"
+{
+ LTEXT "Impresora:", 1088, 6, 6, 40, 9
+ LTEXT "Campo de impresión", 1089, 60, 6, 150, 9
+ GROUPBOX "", 1072, 6, 30, 160, 65, BS_GROUPBOX
+ RADIOBUTTON "&Todo", 1056, 16, 45, 60, 12
+ RADIOBUTTON "Selecc&ión", 1057, 16, 60, 60, 12
+ RADIOBUTTON "&Paginas", 1058, 16, 75, 60, 12
+ DEFPUSHBUTTON "Imprimir", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Setup", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ LTEXT "&Desde:", 1090, 60, 80, 30, 9
+ LTEXT "&Hasta:", 1091, 120, 80, 30, 9
+ LTEXT "Calidad de impre&sión:", 1092, 6, 100, 76, 9
+ COMBOBOX 1136, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ CHECKBOX "Impri&mir en un archivo", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ CHECKBOX "Condensed", 1041, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+}
+
+
+PRINT_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Configuración de impresión"
+FONT 8, "Helv"
+{
+ GROUPBOX "Impresora:", 1072, 6, 10, 180, 65, BS_GROUPBOX
+ RADIOBUTTON "Pre&determinada del sistema", 1056, 16, 20, 80, 12
+ LTEXT "[none]", 1088, 35, 35, 120, 9
+ RADIOBUTTON "Impresora &especmfica:", 1057, 16, 50, 80, 12
+ COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "Aceptar", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Configurar", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
+ GROUPBOX "Orientación", 1073, 6, 85, 100, 50, BS_GROUPBOX
+ RADIOBUTTON "&Vertical", 1058, 50, 100, 40, 12
+ RADIOBUTTON "&Horizontal", 1059, 50, 115, 40, 12
+ ICON "LANDSCAP", 1097, 10, 95, 32, 32
+ ICON "PORTRAIT", 1098, 10, 95, 32, 32
+ GROUPBOX "Papel", 1074, 120, 85, 180, 50, BS_GROUPBOX
+ LTEXT "&Tamaño", 1089, 130, 95, 30, 9
+ LTEXT "O&rigen:", 1090, 130, 110, 30, 9
+ COMBOBOX 1137, 155, 95, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX 1138, 155, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+}
+
+
+CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Fuente"
+FONT 8, "Helv"
+{
+ LTEXT "Fuente:", 1088, 6, 6, 40, 9
+ LTEXT "", 1089, 60, 6, 150, 9
+ DEFPUSHBUTTON "Aceptar", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+
+CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Color"
+FONT 8, "Helv"
+{
+ LTEXT "Colores &basicos:", 1088, 6, 6, 40, 9
+ LTEXT "Colores person&alizados:", 1089, 6, 126, 40, 9
+ LTEXT "Color|Sól&ido", 1090, 100, 146, 40, 9
+ LTEXT "&Hue:", 1091, 150, 126, 40, 9
+ LTEXT "&Sat:", 1092, 150, 146, 40, 9
+ LTEXT "&Lum:", 1093, 150, 166, 40, 9
+ LTEXT "&Rojo:", 1094, 150, 126, 40, 9
+ LTEXT "&Verde:", 1095, 150, 146, 40, 9
+ LTEXT "A&zul:", 1096, 150, 166, 40, 9
+ DEFPUSHBUTTON "Aceptar", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Agregar a los &colores personalizados", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Borrar colores personalizados", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+
+FIND_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 84
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Buscar"
+FONT 8, "Helv"
+{
+ LTEXT "Buscar:", 1088, 6, 6, 40, 9
+ LTEXT "", 1089, 60, 6, 150, 9
+ CHECKBOX "&Comparar palabra entera solamente", 1040, 20, 30, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ CHECKBOX "&Mayúsculas/minúsculas", 1041, 20, 50, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ GROUPBOX "Dirección", 1072, 90, 40, 80, 40, BS_GROUPBOX
+ RADIOBUTTON "A&rriba", 1056, 100, 50, 50, 12
+ RADIOBUTTON "&Abajo", 1057, 150, 50, 50, 12
+ DEFPUSHBUTTON "Buscar &siguiente", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+
+REPLACE_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 114
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "R&eemplazar"
+FONT 8, "Helv"
+{
+ LTEXT "Buscar:", 1088, 6, 6, 40, 9
+ LTEXT "", 1089, 60, 6, 150, 9
+ LTEXT "Re&place With:", 1090, 6, 26, 40, 9
+ LTEXT "", 1091, 60, 26, 150, 9
+ CHECKBOX "&Comparar palabra entera solamente", 1040, 20, 40, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ CHECKBOX "&Mayúsculas/minúsculas", 1041, 20, 60, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ DEFPUSHBUTTON "Reemplazar &siguiente", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Reemplazar", 1024, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Reemplazar &todo", 1025, 206, 44, 56, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancelar", 2, 206, 64, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
diff --git a/rc/sysres_No.rc b/rc/sysres_No.rc
index 3387ef1..f7ca625 100644
--- a/rc/sysres_No.rc
+++ b/rc/sysres_No.rc
@@ -27,19 +27,19 @@
         PUSHBUTTON "&Nei", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
-SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 213, 179
+SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 223, 200
 STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Om %s"
 FONT 10, "System"
 {
- DEFPUSHBUTTON "OK", 1, 86, 160, 40, 14
- CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 205, 120
- LTEXT "Tekst", 100, 11, 40, 190, 110, SS_NOPREFIX | WS_GROUP
- ICON "", 1088, 185, 10, 18, 20
+ DEFPUSHBUTTON "OK", 1, 91, 180, 40, 14
+ CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 215, 140
+ LTEXT "Tekst", 100, 11, 40, 200, 130, SS_NOPREFIX | WS_GROUP
+ ICON "", 1088, 195, 10, 18, 20
 }
 
 
-3 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Åpne"
 FONT 8, "Helv"
@@ -61,7 +61,7 @@
 }
 
 
-4 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
+SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Lagre som ..."
 FONT 8, "Helv"
@@ -83,7 +83,7 @@
 }
 
 
-5 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+PRINT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Skriv"
 FONT 8, "Helv"
@@ -106,7 +106,7 @@
 }
 
 
-6 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+PRINT_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Skriveoppsett"
 FONT 8, "Helv"
@@ -132,7 +132,7 @@
 }
 
 
-7 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Font"
 FONT 8, "Helv"
@@ -144,7 +144,7 @@
 }
 
 
-8 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
+CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Farge"
 FONT 8, "Helv"
@@ -165,7 +165,7 @@
 }
 
 
-9 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 84
+FIND_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 84
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Finn"
 FONT 8, "Helv"
@@ -182,7 +182,7 @@
 }
 
 
-10 DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 114
+REPLACE_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 114
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Bytt"
 FONT 8, "Helv"
diff --git a/rc/winerc.c b/rc/winerc.c
index c8832cf..14b0c85 100644
--- a/rc/winerc.c
+++ b/rc/winerc.c
@@ -511,62 +511,85 @@
 	return buf;
 }
 
-#define ISCONSTANT	constant?"const ":""
+#define ISCONSTANT	(constant ? "const " : "")
+
 /* create the final output */
 void create_output(gen_res* top)
 {
-	gen_res *it;
-	fprintf(header,"/*\t\t%s\n * This File is automatically generated."
-		" Do not edit\n */\n#include \"resource.h\"\n",hname);
-	fprintf(code,"/*\t\t%s\n * This File is automatically generated."
-		" Do not edit\n */\n",sname);
-	/* declare the resources */
-	for(it=top;it;it=it->next)
-		fprintf(header,"extern %sunsigned char %s[];\n",ISCONSTANT,
-		get_resource_name(it));
-	fprintf(header,"extern %sstruct ResourceTable %sTable[];\n",
-		ISCONSTANT,prefix);
+    gen_res *it;
 
-	fprintf(code,"#include \"windows.h\"\n#include \"%s\"\n",hname);
 
-	/* print the resource table (0 terminated) */
-	fprintf(code,"\n%sstruct ResourceTable %sTable[]={\n",ISCONSTANT,prefix);
-	for(it=top;it;it=it->next)
-	{	int type;
-		switch(it->type)
-		{case acc:type=NE_RSCTYPE_ACCELERATOR;break;
-		 case bmp:type=NE_RSCTYPE_BITMAP;break;
-		 case cur:type=NE_RSCTYPE_CURSOR;break;
-		 case dlg:type=NE_RSCTYPE_DIALOG;break;
-		 case fnt:type=NE_RSCTYPE_FONT;break;
-		 case ico:type=NE_RSCTYPE_ICON;break;
-		 case men:type=NE_RSCTYPE_MENU;break;
-		 case rdt:type=NE_RSCTYPE_RCDATA;break;
-		 case str:type=NE_RSCTYPE_STRING;break;
-		 default:fprintf(stderr,"Unknown restype\n");type=-1;break;
-		}
-		if(it->n_type)
-			fprintf(code,"{0,%d,\"%s\",%s,%d},\n",
-			type,it->n.s_name,get_resource_name(it),it->size);
-		else
-			fprintf(code,"{%d,%d,\"@%d\",%s,%d},\n",
-			it->n.i_name,type,it->n.i_name,get_resource_name(it),
-			it->size);
-	}
-	fprintf(code,"{0,0,0,0}};\n\n");
+    fprintf( header, "/* %s\n"
+                     " * This file is automatically generated. Do not edit!\n"
+                     " */\n\n"
+                     "struct resource\n"
+                     "{\n"
+                     "    int id, type;\n"
+                     "    char *name;\n"
+                     "    unsigned char *bytes;\n"
+                     "    unsigned int size;\n"
+                     "};\n\n", hname );
 
-	/* print the resources */
-	for(it=top;it;it=it->next)
-	{	int i;
-		fprintf(code,"%sunsigned char %s[]={\n",
-			ISCONSTANT,get_resource_name(it));
-		for(i=0;i<it->size-1;i++)
-		{
-			fprintf(code,"%#4x,",it->res[i]);
-			if((i&7)==7)fputc('\n',code);
+    /* Declare the resources */
+
+    for (it=top;it;it=it->next)
+        fprintf( header,"extern %sstruct resource %s;\n",
+                 ISCONSTANT, get_resource_name(it) );
+    fprintf( header,"\nextern %sstruct resource * %sTable[];\n",
+             ISCONSTANT, prefix );
+
+    /* Print the resources bytes */
+
+    fprintf( code, "/* %s\n"
+                   " * This file is automatically generated. Do not edit!\n"
+                   " */\n\n"
+                   "#include \"%s\"\n", sname, hname );
+    for(it=top;it;it=it->next)
+    {
+        int i;
+        fprintf( code, "static %sunsigned char %s__bytes[] = {\n",
+                 ISCONSTANT, get_resource_name(it) );
+        for (i=0;i<it->size-1;i++)
+        {
+            fprintf(code,"%#4x,",it->res[i]);
+            if ((i&7)==7)fputc('\n',code);
         }
-		fprintf(code,"%#4x};\n",it->res[i]);
-	}
+        fprintf(code,"%#4x};\n\n",it->res[i]);
+    }
+
+    /* Print the resources */
+    for (it=top;it;it=it->next)
+    {
+        int type;
+        switch(it->type)
+        {
+        case acc:type=NE_RSCTYPE_ACCELERATOR;break;
+        case bmp:type=NE_RSCTYPE_BITMAP;break;
+        case cur:type=NE_RSCTYPE_CURSOR;break;
+        case dlg:type=NE_RSCTYPE_DIALOG;break;
+        case fnt:type=NE_RSCTYPE_FONT;break;
+        case ico:type=NE_RSCTYPE_ICON;break;
+        case men:type=NE_RSCTYPE_MENU;break;
+        case rdt:type=NE_RSCTYPE_RCDATA;break;
+        case str:type=NE_RSCTYPE_STRING;break;
+        default:fprintf(stderr,"Unknown restype\n");type=-1;break;
+        }
+        if(it->n_type)
+            fprintf(code,"%sstruct resource %s = {0,%d,\"%s\",%s__bytes,%d};\n",
+                    ISCONSTANT, get_resource_name(it), type, it->n.s_name,
+                    get_resource_name(it), it->size );
+        else
+            fprintf(code,"%sstruct resource %s = {%d,%d,\"@%d\",%s__bytes,%d};\n",
+                    ISCONSTANT, get_resource_name(it), it->n.i_name, type,
+                    it->n.i_name, get_resource_name(it), it->size );
+    }
+
+    /* Print the resource table (NULL terminated) */
+
+    fprintf(code,"\n%sstruct resource * %sTable[] = {\n", ISCONSTANT, prefix);
+    for (it=top;it;it=it->next)
+        fprintf( code, "  &%s,\n", get_resource_name(it) );
+    fprintf( code, "  0\n};\n" );
 }
 
 void make_font()
diff --git a/toolkit/Makefile.in b/toolkit/Makefile.in
new file mode 100644
index 0000000..d09cb11
--- /dev/null
+++ b/toolkit/Makefile.in
@@ -0,0 +1,14 @@
+TOPSRC = @top_srcdir@
+MODULE = toolkit
+
+C_SRCS = \
+	arch.c \
+	heap.c \
+	sup.c \
+	winmain.c
+
+all: $(MODULE).o
+
+@MAKE_RULES@
+
+### Dependencies:
diff --git a/toolkit/hello.c b/toolkit/hello.c
index d9d9978..604f18b 100644
--- a/toolkit/hello.c
+++ b/toolkit/hello.c
@@ -1,4 +1,3 @@
-/* #include "autoconf.h" */
 #include <windows.h>
 
 void Write (HDC dc, int x, int y, char *s)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 01c4b10..507f691 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -1,31 +1,18 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
 TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
 
+PROGRAM = build
+MODULE  = none
 
-all: build
+C_SRCS = build.c
 
-build: build.o
-	$(CC) $(CFLAGS) -o build build.o
+all: $(PROGRAM)
 
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
+@MAKE_RULES@
 
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
+$(PROGRAM): $(OBJS)
+	$(CC) $(CFLAGS) -o build $(OBJS)
 
-clean:
-	rm -f *.o \#*\# *~ *.bak build tmp_make
-
-distclean: clean
-	rm Makefile
-
-countryclean:
-
-dummy:
+clean::
+	$(RM) $(PROGRAM)
 
 ### Dependencies:
diff --git a/tools/build.c b/tools/build.c
index ca9fac7..0221c49 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -718,9 +718,11 @@
 
     printf( "/* File generated automatically, do not edit! */\n" );
     printf( "#include <sys/types.h>\n");
+	printf( "#include \"windows.h\"\n");
     printf( "#include \"dlls.h\"\n");
     printf( "#include \"pe_image.h\"\n");
     printf( "#include \"winerror.h\"\n");
+	printf( "#include \"relay32.h\"\n");
     printf( "#include \"stddebug.h\"\n");
     printf( "#include \"debug.h\"\n");
     printf( "\nextern int RELAY32_Unimplemented();\n\n" );
@@ -758,7 +760,6 @@
                 if (argno!=argc-1) putchar( ',' );
             }
             printf( ")\n{\n" );
-            printf( "\textern int %s();\n", fdp->internal_name );
             printf( "\tdprintf_relay(stddeb,\"Entering %%s.%%s(");
             for (argno=0;argno<argc;argno++) printf( "%%x ");
             printf( ")\\n\", \"%s\", \"%s\"", UpperDLLName, odp->export_name);
@@ -817,7 +818,7 @@
     printf("};\n\n");
 
     printf( "static WIN32_builtin dll={\"%s\",functions,%d,0};\n",
-            UpperDLLName, Limit);
+            UpperDLLName, Limit+1);
 
     printf( "void %s_Init(void)\n{\n",UpperDLLName);
     printf( "\tdll.next=WIN32_builtin_list;\n");
@@ -990,14 +991,15 @@
 
     /* Transfer the arguments */
 
-    printf( "\tleal 16(%%ebp),%%esi\n" );
     printf( "\tmovl 12(%%ebp),%%ecx\n" );
     printf( "\torl %%ecx,%%ecx\n" );
     printf( "\tje 1f\n" );
+    printf( "\tleal 16(%%ebp),%%esi\n" );
     printf( "\tshll $2,%%ecx\n" );
     printf( "\tsubl %%ecx,%%esp\n" );
     printf( "\tmovl %%esp,%%edi\n" );
     printf( "\tshrl $2,%%ecx\n" );
+    printf( "\tcld\n" );
     printf( "\trep; movsl\n" );
     printf( "1:\n" );
 
diff --git a/windows/Imakefile b/windows/Imakefile
index 973215f..54c0f27 100644
--- a/windows/Imakefile
+++ b/windows/Imakefile
@@ -3,6 +3,7 @@
 MODULE = windows
 
 SRCS = \
+	alias.c \
 	caret.c \
 	class.c \
 	cursor.c \
diff --git a/windows/Makefile.in b/windows/Makefile.in
index 7621b6f..4eef8a0 100644
--- a/windows/Makefile.in
+++ b/windows/Makefile.in
@@ -1,44 +1,37 @@
-CC 	= @CC@
-CFLAGS 	= @CFLAGS@
-XINCL 	= @x_includes@
-TOPSRC  = @top_srcdir@
-DIVINCL = -I$(TOPSRC)/include
-LD	= @LD@
-LDCOMBINEFLAGS = @LDCOMBINEFLAGS@
+TOPSRC = @top_srcdir@
+MODULE = windows
 
-
-MODULE 	= windows
-
-SRCS 	= caret.c class.c cursor.c dce.c defdlg.c defwnd.c dialog.c \
-	event.c focus.c graphics.c hook.c keyboard.c mapping.c mdi.c \
-	message.c msgbox.c nonclient.c painting.c property.c scroll.c \
-	syscolor.c sysmetrics.c timer.c utility.c win.c \
+C_SRCS = \
+	alias.c \
+	caret.c \
+	class.c \
+	cursor.c \
+	dce.c \
+	defdlg.c \
+	defwnd.c \
+	dialog.c \
+	event.c \
+	focus.c \
+	graphics.c \
+	hook.c \
+	keyboard.c \
+	mapping.c \
+	mdi.c \
+	message.c \
+	msgbox.c \
+	nonclient.c \
+	painting.c \
+	property.c \
+	scroll.c \
+	syscolor.c \
+	sysmetrics.c \
+	timer.c \
+	utility.c \
+	win.c \
 	winpos.c
- 
-
-OBJS = $(SRCS:.c=.o)
-
-.c.o:
-	$(CC) -c $(CFLAGS) $(XINCL) $(DIVINCL) -o $*.o $<
 
 all: $(MODULE).o
 
-$(MODULE).o: $(OBJS)
-	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $(MODULE).o
-
-depend:
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(DIVINCL) $(XINCL) -MM *.c >> tmp_make
-	mv tmp_make Makefile
-
-clean:
-	rm -f *.o \#*\# *~ *.bak tmp_make
-
-distclean: clean
-	rm Makefile
-
-countryclean:
-
-dummy:
+@MAKE_RULES@
 
 ### Dependencies:
diff --git a/windows/alias.c b/windows/alias.c
new file mode 100644
index 0000000..59d25ce
--- /dev/null
+++ b/windows/alias.c
@@ -0,0 +1,95 @@
+/*
+ * Function alias support
+ * 
+ * Copyright 1995 Martin von Loewis
+ * 
+ */
+
+#include "windows.h"
+#include "alias.h"
+
+#include "stddebug.h"
+#include "debug.h"
+
+/* some large prime */
+#define TABLESIZE	2677
+
+static ALIASHASH AliasTable[TABLESIZE];
+/* this could be a bit smaller */
+static FUNCTIONALIAS AliasRecord[TABLESIZE];
+/* record 0 is always empty */
+static int LastRecord;
+
+int ALIAS_UseAliases;
+
+/* closed hashing */
+static int ALIAS_LocateHash(DWORD value)
+{
+	int hash,start;
+	start=hash=value%TABLESIZE;
+	while(AliasTable[hash].used && AliasTable[hash].used!=value)
+	{
+		hash++;
+		if(hash==TABLESIZE)
+			hash=0;
+		if(hash==start)
+		{
+			fprintf(stderr,"Hash table full, increase size in alias.c\n");
+			exit(0);
+		}
+	}
+	return hash;
+}
+
+void ALIAS_RegisterAlias(DWORD Wine,DWORD Win16, DWORD Win32)
+{
+    int whash = 0, w16hash = 0, w32hash = 0, recno=0;
+    if (!Wine && !Win16 && !Win32) return;
+    if (Wine)
+    {
+        whash=ALIAS_LocateHash(Wine);
+	recno=AliasTable[whash].used?AliasTable[whash].used:0;
+    }
+    if (Win16)
+    {
+        w16hash=ALIAS_LocateHash(Win16);
+	recno=AliasTable[w16hash].used?AliasTable[w16hash].used:0;
+    }
+    if (Win32)
+    {
+        w32hash=ALIAS_LocateHash(Win32);
+        recno=AliasTable[w32hash].used?AliasTable[w32hash].used:0;
+    }
+    if (!recno)
+    {
+        recno=LastRecord;
+        LastRecord++;
+    }
+    if (Wine)
+    {
+        AliasTable[whash].used=Wine;
+        AliasTable[whash].recno=recno;
+        AliasRecord[recno].wine=Wine;
+    }
+    if (Win16)
+    {
+        AliasTable[w16hash].used=Win16;
+	AliasTable[w16hash].recno=recno;
+        AliasRecord[recno].win16=Win16;
+    }
+    if (Win32)
+    {
+        AliasTable[w32hash].used=Win32;
+        AliasTable[w32hash].recno=recno;
+        AliasRecord[recno].win32=Win32;
+    }
+}
+
+FUNCTIONALIAS* ALIAS_LookupAlias(DWORD fn)
+{
+	int index;
+	index=ALIAS_LocateHash(fn);
+	if(AliasTable[index].used==fn)
+		return &AliasRecord[AliasTable[index].recno];
+	return 0;
+}
diff --git a/windows/caret.c b/windows/caret.c
index 8f32990..a85a47c 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -8,6 +8,7 @@
 
 #include "windows.h"
 #include "selectors.h"
+#include "alias.h"
 #include "stddebug.h"
 /* #define DEBUG_CARET */
 #include "debug.h"
@@ -94,6 +95,23 @@
     ReleaseDC(Caret.hwnd, hdc);
 }
 
+/*****************************************************************
+ *               CARET_Initialize
+ */
+static void CARET_Initialize()
+{
+    DWORD WineProc,Win16Proc,Win32Proc;
+    static int initialized=0;
+    if(!initialized)
+    {
+      WineProc=(DWORD)CARET_Callback;
+      Win16Proc=(DWORD)GetWndProcEntry16("CARET_Callback");
+      Win32Proc=(DWORD)RELAY32_GetEntryPoint("WINPROCS32","CARET_Callback",0);
+      ALIAS_RegisterAlias(WineProc,Win16Proc,Win32Proc);
+      initialized=1;
+    }
+}
+
 
 /*****************************************************************
  *               CreateCaret          (USER.163)
@@ -133,6 +151,8 @@
     Caret.timeout = 750;
     LockCaret = FALSE;
 
+    CARET_Initialize();
+
     Caret.timerid = SetSystemTimer( (HWND)0, 0, Caret.timeout,
                                 (FARPROC)GetWndProcEntry16("CARET_Callback"));
 
@@ -220,6 +240,8 @@
 {
     if (!Caret.hwnd) return;
 
+    CARET_Initialize();
+
     KillSystemTimer( (HWND)0, Caret.timerid);
     Caret.timeout = msecs;
     Caret.timerid = SetSystemTimer( (HWND)0, 0, Caret.timeout,
diff --git a/windows/cursor.c b/windows/cursor.c
index 5a41d3c..9875df1 100644
--- a/windows/cursor.c
+++ b/windows/cursor.c
@@ -1,7 +1,7 @@
 /*
  *    WINE
 static char Copyright[] = "Copyright  Martin Ayotte, 1993";
-*/
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -12,35 +12,40 @@
 #include <unistd.h>
 #include <X11/cursorfont.h>
 #include <X11/Xlib.h>
+#include <X11/Xutil.h>
 #include "windows.h"
 #include "win.h"
 #include "gdi.h"
 #include "neexe.h"
 #include "wine.h"
+#include "callback.h"
 #include "cursor.h"
 #include "resource.h"
 #include "stddebug.h"
 #include "debug.h"
 #include "arch.h"
+#include "bitmap.h"
 
 static int ShowCursCount = 0;
 static HCURSOR hActiveCursor;
 static HCURSOR hEmptyCursor = 0;
 RECT	ClipCursorRect;
 
-static struct { SEGPTR name; HCURSOR cursor; } system_cursor[] =
+static struct { 
+   SEGPTR name; HCURSOR cursor; unsigned int shape;
+} system_cursor[] =
 {
-    { IDC_ARROW, 0 },
-    { IDC_IBEAM, 0 },
-    { IDC_WAIT, 0 },
-    { IDC_CROSS, 0 },
-    { IDC_UPARROW, 0 },
-    { IDC_SIZE, 0 },
-    { IDC_ICON, 0 },
-    { IDC_SIZENWSE, 0 },
-    { IDC_SIZENESW, 0 },
-    { IDC_SIZEWE, 0 },
-    { IDC_SIZENS, 0 }
+    { IDC_ARROW,    0, XC_top_left_arrow},
+    { IDC_IBEAM,    0, XC_xterm },
+    { IDC_WAIT,     0, XC_watch },
+    { IDC_CROSS,    0, XC_crosshair },
+    { IDC_UPARROW,  0, XC_based_arrow_up },
+    { IDC_SIZE,     0, XC_bottom_right_corner },
+    { IDC_ICON,     0, XC_icon },
+    { IDC_SIZENWSE, 0, XC_fleur },
+    { IDC_SIZENESW, 0, XC_fleur },
+    { IDC_SIZEWE,   0, XC_sb_h_double_arrow },
+    { IDC_SIZENS,   0, XC_sb_v_double_arrow }
 };
 
 #define NB_SYS_CURSORS  (sizeof(system_cursor)/sizeof(system_cursor[0]))
@@ -54,13 +59,13 @@
     HCURSOR 	hCursor;
     HRSRC       hRsrc;
     HANDLE 	rsc_mem;
-    WORD 	*lp;
+    char        *lpbits;
     LONG        *lpl,size;
-    CURSORDESCRIP *lpcurdesc;
-    CURSORALLOC	  *lpcur;
-    HDC 	hdc;
+    CURSORALLOC *lpcur;
+    CURSORDIR   *lpcurdir;
+    CURSORDESCRIP curdesc;
+    POINT       hotspot;
     int i;
-    unsigned char *cp1,*cp2;
     dprintf_resource(stddeb,"LoadCursor: instance = %04x, name = %08lx\n",
 	   instance, cursor_name);
     if (!instance)
@@ -68,116 +73,69 @@
 	for (i = 0; i < NB_SYS_CURSORS; i++)
 	    if (system_cursor[i].name == cursor_name)
 	    {
-		if (system_cursor[i].cursor) return system_cursor[i].cursor;
-                else break;
+	        if (!system_cursor[i].cursor) 
+	        {
+		    hCursor = GlobalAlloc (GMEM_MOVEABLE, sizeof (Cursor));
+		    dprintf_cursor(stddeb,"LoadCursor Alloc hCursor=%X\n", hCursor);
+		    system_cursor[i].cursor = hCursor;
+		    lpcur = (CURSORALLOC *) GlobalLock(hCursor);
+		    lpcur->xcursor = XCreateFontCursor(display, system_cursor[i].shape);
+		    GlobalUnlock(hCursor);
+	        }
+	       	return system_cursor[i].cursor;
 	    }
-	if (i == NB_SYS_CURSORS) return 0;
-    }
-    hCursor = GlobalAlloc(GMEM_MOVEABLE, sizeof(CURSORALLOC) + 1024L); 
-    if (hCursor == (HCURSOR)NULL) return 0;
-    if (!instance) system_cursor[i].cursor = hCursor;
-
-    dprintf_cursor(stddeb,"LoadCursor Alloc hCursor=%X\n", hCursor);
-    lpcur = (CURSORALLOC *)GlobalLock(hCursor);
-    memset(lpcur, 0, sizeof(CURSORALLOC));
-    if (instance == (HANDLE)NULL) {
-	switch((LONG)cursor_name) {
-	    case IDC_ARROW:
-		lpcur->xcursor = XCreateFontCursor(display, XC_top_left_arrow);
-		GlobalUnlock(hCursor);
-	    	return hCursor;
-	    case IDC_CROSS:
-		lpcur->xcursor = XCreateFontCursor(display, XC_crosshair);
-		GlobalUnlock(hCursor);
-	    	return hCursor;
-	    case IDC_IBEAM:
-		lpcur->xcursor = XCreateFontCursor(display, XC_xterm);
-		GlobalUnlock(hCursor);
-	    	return hCursor;
-	    case IDC_WAIT:
-		lpcur->xcursor = XCreateFontCursor(display, XC_watch);
-		GlobalUnlock(hCursor);
-	    	return hCursor;
-	    case IDC_SIZENS:
-		lpcur->xcursor = XCreateFontCursor(display, XC_sb_v_double_arrow);
-		GlobalUnlock(hCursor);
-	    	return hCursor;
-	    case IDC_SIZEWE:
-		lpcur->xcursor = XCreateFontCursor(display, XC_sb_h_double_arrow);
-		GlobalUnlock(hCursor);
-	    	return hCursor;
-            case IDC_SIZENWSE:
-            case IDC_SIZENESW:
-                lpcur->xcursor = XCreateFontCursor(display, XC_fleur);
-                GlobalUnlock(hCursor);
-                return hCursor;
-	    default:
-		break;
-	    }
-	}
-
-#if 0
-    /* this code replaces all bitmap cursors with the default cursor */
-    lpcur->xcursor = XCreateFontCursor(display, XC_top_left_arrow);
-    GlobalUnlock(hCursor);
-    return hCursor;
-#endif
-
-    if (!(hdc = GetDC(0))) return 0;
-    if (!(hRsrc = FindResource( instance, cursor_name, RT_GROUP_CURSOR )))
-    {
-	ReleaseDC(0, hdc); 
 	return 0;
     }
+
+    if (!(hRsrc = FindResource( instance, cursor_name, RT_GROUP_CURSOR )))
+	return 0;
     rsc_mem = LoadResource(instance, hRsrc );
     if (rsc_mem == (HANDLE)NULL) {
-    fprintf(stderr,"LoadCursor / Cursor %08lx not Found !\n", cursor_name);
-	ReleaseDC(0, hdc); 
-	return 0;
-	}
-    lp = (WORD *)LockResource(rsc_mem);
-    if (lp == NULL) {
-        FreeResource( rsc_mem );
-	ReleaseDC(0, hdc); 
-	return 0;
-	}
-    lpcurdesc = (CURSORDESCRIP *)(lp + 3);
-#if 0
-    dprintf_cursor(stddeb,"LoadCursor / curReserved=%X\n", *lp);
-    dprintf_cursor(stddeb,"LoadCursor / curResourceType=%X\n", *(lp + 1));
-    dprintf_cursor(stddeb,"LoadCursor / curResourceCount=%X\n", *(lp + 2));
-    dprintf_cursor(stddeb,"LoadCursor / cursor Width=%d\n", 
-		(int)lpcurdesc->Width);
-    dprintf_cursor(stddeb,"LoadCursor / cursor Height=%d\n", 
-		(int)lpcurdesc->Height);
-    dprintf_cursor(stddeb,"LoadCursor / cursor curXHotspot=%d\n", 
-		(int)lpcurdesc->curXHotspot);
-    dprintf_cursor(stddeb,"LoadCursor / cursor curYHotspot=%d\n", 
-		(int)lpcurdesc->curYHotspot);
-    dprintf_cursor(stddeb,"LoadCursor / cursor curDIBSize=%lX\n", 
-		(DWORD)lpcurdesc->curDIBSize);
-    dprintf_cursor(stddeb,"LoadCursor / cursor curDIBOffset=%lX\n", 
-		(DWORD)lpcurdesc->curDIBOffset);
-#endif
-    lpcur->descriptor = *lpcurdesc;
-    FreeResource( rsc_mem );
-    if (!(hRsrc = FindResource( instance,
-                                MAKEINTRESOURCE(lpcurdesc->curDIBOffset), 
-                                RT_CURSOR )))
-    {
-	ReleaseDC(0, hdc); 
+        fprintf(stderr,"LoadCursor / Cursor %08lx not Found !\n", cursor_name);
 	return 0;
     }
+    lpcurdir = (CURSORDIR *)LockResource(rsc_mem);
+    if (lpcurdir == NULL) {
+        FreeResource( rsc_mem );
+	return 0;
+    }
+    curdesc = *(CURSORDESCRIP *)(lpcurdir + 1);  /* CONV_CURDESC ? */
+#if 0
+    dprintf_cursor(stddeb,"LoadCursor / curReserved=%X\n", lpcurdir->cdReserved);
+    dprintf_cursor(stddeb,"LoadCursor / curResourceType=%X\n", lpcurdir->cdType);
+    dprintf_cursor(stddeb,"LoadCursor / curResourceCount=%X\n", lpcurdir->cdCount);
+    dprintf_cursor(stddeb,"LoadCursor / cursor Width=%d\n", 
+		(int)curdesc.Width);
+    dprintf_cursor(stddeb,"LoadCursor / cursor Height=%d\n", 
+		(int)curdesc.Height);
+    dprintf_cursor(stddeb,"LoadCursor / cursor curDIBSize=%lX\n", 
+		(DWORD)curdesc.curDIBSize);
+    dprintf_cursor(stddeb,"LoadCursor / cursor curDIBOffset=%lX\n",
+		(DWORD)curdesc.curDIBOffset);
+#endif
+    FreeResource( rsc_mem );
+    if (!(hRsrc = FindResource( instance,
+                                MAKEINTRESOURCE(curdesc.curDIBOffset), 
+                                RT_CURSOR )))
+	return 0;
     rsc_mem = LoadResource(instance, hRsrc );
     if (rsc_mem == (HANDLE)NULL) {
     	fprintf(stderr,
 		"LoadCursor / Cursor %08lx Bitmap not Found !\n", cursor_name);
-	ReleaseDC(0, hdc); 
+	return 0;
+    }
+    lpl = (LONG *) LockResource(rsc_mem);
+    if (lpl == NULL) {
+        FreeResource( rsc_mem );
 	return 0;
 	}
-    lpl = (LONG *)LockResource(rsc_mem);
-    lpl++;
+    hotspot = *(POINT *) lpl++;  /* CONV_POINT ? */
     size = CONV_LONG (*lpl);
+#if 0
+    if (!(hdc = GetDC(0))) {
+       FreeResource( rsc_mem );
+       return 0;
+    }
     if (size == sizeof(BITMAPCOREHEADER)){
 	CONV_BITMAPCOREHEADER (lpl);
         ((BITMAPINFOHEADER *)lpl)->biHeight /= 2;
@@ -190,40 +148,32 @@
       fprintf(stderr,"No bitmap for cursor?\n");
       lpcur->hBitmap = 0;
     }
-    lpl = (LONG *)((char *)lpl + size + 8);
-  /* This is rather strange! The data is stored *BACKWARDS* and       */
-  /* mirrored! But why?? FIXME: the image must be flipped at the Y    */
-  /* axis, either here or in CreateCusor(); */
-    size = lpcur->descriptor.Height/2 * ((lpcur->descriptor.Width+7)/8);
-#if 0
-    dprintf_cursor(stddeb,"Before:\n");
-    for(i=0;i<2*size;i++)  {
-      dprintf_cursor(stddeb,"%02x ",((unsigned char *)lpl)[i]);
-      if ((i & 7) == 7) dprintf_cursor(stddeb,"\n");
-    }
-#endif
-    cp1 = (char *)lpl;
-    cp2 = cp1+2*size;
-    for(i = 0; i < size; i++)  {
-      char tmp=*--cp2;
-      *cp2 = *cp1;
-      *cp1++ = tmp;
-    }
-#if 0
-    dprintf_cursor(stddeb,"After:\n");
-    for(i=0;i<2*size;i++)  {
-      dprintf_cursor(stddeb,"%02x ",((unsigned char *)lpl)[i]);
-      if ((i & 7) == 7) dprintf_cursor(stddeb,"\n");
-    }
-#endif
-    hCursor = CreateCursor(instance, lpcur->descriptor.curXHotspot, 
- 	lpcur->descriptor.curYHotspot, lpcur->descriptor.Width,
-	lpcur->descriptor.Height/2,
-	(LPSTR)lpl, ((LPSTR)lpl)+size);
-
-    FreeResource( rsc_mem );
-    GlobalUnlock(hCursor);
     ReleaseDC(0,hdc);
+#endif
+    if (size == sizeof(BITMAPCOREHEADER))
+	lpbits = (char *)lpl + sizeof(BITMAPCOREHEADER) + 2*sizeof(RGBTRIPLE);
+    else if (size == sizeof(BITMAPINFOHEADER))
+	lpbits = (char *)lpl + sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD);
+    else  {
+      fprintf(stderr,"Invalid bitmap in cursor resource\n");
+      FreeResource(rsc_mem);
+      return 0;
+    }
+    /* The height of the cursor is the height of the XOR-Bitmap
+     * plus the height of the AND-Bitmap, so divide it by two.
+     */
+    size = curdesc.Height/2 * ((curdesc.Width+31)/32 * 4);
+#if 0
+    dprintf_cursor(stddeb,"Bitmap:\n");
+    for(i=0;i<2*size;i++)  {
+      dprintf_cursor(stddeb,"%02x ",(unsigned char) lpc[i]);
+      if ((i & 7) == 7) dprintf_cursor(stddeb,"\n");
+    }
+#endif
+    hCursor = CreateCursor(instance, hotspot.x, hotspot.y, 
+			   curdesc.Width, curdesc.Height / 2,
+			   lpbits+size, lpbits);
+    FreeResource( rsc_mem );
     return hCursor;
 }
 
@@ -252,51 +202,71 @@
 HCURSOR CreateCursor(HANDLE instance, short nXhotspot, short nYhotspot, 
 	short nWidth, short nHeight, LPSTR lpANDbitPlane, LPSTR lpXORbitPlane)
 {
-    HCURSOR 	hCursor;
-    CURSORALLOC	  *lpcur;
-    HDC 	hdc;
-    int         bpllen = (nWidth + 7)/8 * nHeight;
-    char        *tmpbpl = malloc(bpllen);
-    int         i;
+    HCURSOR	hCursor;
+    CURSORALLOC *lpcur;
+    int		bpl = (nWidth + 31)/32 * 4;
+    char	*tmpbits = malloc(bpl * nHeight);
+    char	*src, *dst;
+    int		i;
+    XImage	*image;
+    Pixmap	pixshape, pixmask;
+    extern void _XInitImageFuncPtrs( XImage* );
   
     XColor bkcolor,fgcolor;
     Colormap cmap = XDefaultColormap(display,XDefaultScreen(display));
     
-    dprintf_resource(stddeb,"CreateCursor: inst=%04x nXhotspot=%d  nYhotspot=%d nWidth=%d nHeight=%d\n",  
+    dprintf_resource(stddeb, "CreateCursor: inst=%04x nXhotspot=%d  nYhotspot=%d nWidth=%d nHeight=%d\n",  
        instance, nXhotspot, nYhotspot, nWidth, nHeight);
     dprintf_resource(stddeb,"CreateCursor: inst=%04x lpANDbitPlane=%p lpXORbitPlane=%p\n",
 	instance, lpANDbitPlane, lpXORbitPlane);
 
-    if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
-    hCursor = GlobalAlloc(GMEM_MOVEABLE, sizeof(CURSORALLOC) + 1024L); 
-    if (hCursor == (HCURSOR)NULL) {
-	ReleaseDC(GetDesktopWindow(), hdc); 
+    image = XCreateImage( display, DefaultVisualOfScreen(screen),
+                          1, ZPixmap, 0, tmpbits,
+                          nWidth, nHeight, 32, bpl );
+    if (!image) {
+	free (tmpbits);
 	return 0;
-	}
+    }
+    image->byte_order = MSBFirst;
+    image->bitmap_bit_order = MSBFirst;
+    image->bitmap_unit = 16;
+    _XInitImageFuncPtrs(image);
+
+    hCursor = GlobalAlloc(GMEM_MOVEABLE, sizeof(Cursor)); 
+    if (hCursor == (HCURSOR)NULL) {
+	XDestroyImage(image);
+	return 0;
+    }
     dprintf_cursor(stddeb,"CreateCursor Alloc hCursor=%X\n", hCursor);
     lpcur = (CURSORALLOC *)GlobalLock(hCursor);
-    memset(lpcur, 0, sizeof(CURSORALLOC));
-    lpcur->descriptor.curXHotspot = nXhotspot;
-    lpcur->descriptor.curYHotspot = nYhotspot;
-    for(i=0; i<bpllen; i++) tmpbpl[i] = ~lpANDbitPlane[i];
-    lpcur->pixmask = XCreatePixmapFromBitmapData(
-    	display, DefaultRootWindow(display), 
-        tmpbpl, nWidth, nHeight, 1, 0, 1);
-    for(i=0; i<bpllen; i++) tmpbpl[i] ^= lpXORbitPlane[i];
-    lpcur->pixshape = XCreatePixmapFromBitmapData(
-    	display, DefaultRootWindow(display),
-        tmpbpl, nWidth, nHeight, 1, 0, 1);
+
+    for(src=lpANDbitPlane, dst=tmpbits+(nHeight-1)*bpl; 
+	dst>=tmpbits; src+=bpl, dst-=bpl)
+        for(i=0; i<bpl; i++) 
+            dst[i] = ~src[i];
+    pixmask = XCreatePixmap(display, DefaultRootWindow(display), 
+			    nWidth, nHeight, 1);
+    CallTo32_LargeStack(XPutImage, 10,
+			display, pixmask, BITMAP_monoGC, image, 
+			0, 0, 0, 0, nWidth, nHeight );
+
+    for(src=lpXORbitPlane, dst=tmpbits+(nHeight-1)*bpl; 
+	dst>=tmpbits; src+=bpl, dst-=bpl)
+        for(i=0; i<bpl; i++) 
+            dst[i] = ~src[i];
+    pixshape = XCreatePixmap(display, DefaultRootWindow(display), 
+			     nWidth, nHeight, 1);
+    CallTo32_LargeStack(XPutImage, 10,
+			display, pixshape, BITMAP_monoGC, image, 
+			0, 0, 0, 0, nWidth, nHeight );
     XParseColor(display,cmap,"#000000",&fgcolor);
     XParseColor(display,cmap,"#ffffff",&bkcolor);
-    lpcur->xcursor = XCreatePixmapCursor(display,
- 	lpcur->pixshape, lpcur->pixmask, 
- 	&fgcolor, &bkcolor, lpcur->descriptor.curXHotspot, 
- 	lpcur->descriptor.curYHotspot);
-    free(tmpbpl);
-    XFreePixmap(display, lpcur->pixshape);
-    XFreePixmap(display, lpcur->pixmask);
-    ReleaseDC(GetDesktopWindow(), hdc); 
+    lpcur->xcursor = XCreatePixmapCursor(display, pixshape, pixmask,
+			                 &fgcolor, &bkcolor, nXhotspot, nYhotspot);
+    XFreePixmap(display, pixshape);
+    XFreePixmap(display, pixmask);
     GlobalUnlock(hCursor);
+    XDestroyImage(image);
     return hCursor;
 }
 
@@ -315,7 +285,7 @@
 	if (system_cursor[i].cursor == hCursor) return TRUE;
     }
     lpcur = (CURSORALLOC *)GlobalLock(hCursor);
-    if (lpcur->hBitmap != (HBITMAP)NULL) DeleteObject(lpcur->hBitmap);
+    XFreeCursor (display, lpcur->xcursor);
     GlobalUnlock(hCursor);
     GlobalFree(hCursor);
     return TRUE;
@@ -429,7 +399,7 @@
         {
             if (!hEmptyCursor)
                 hEmptyCursor = CreateCursor( 0, 1, 1, 1, 1,
-                                             "\xFF\xFF", "\xFF\xFF" );
+					    "\xFF\xFF\xFF\xFF", "\xFF\xFF\xFF\xFF" );
             CURSOR_SetCursor( hEmptyCursor );
         }
     }
diff --git a/windows/dialog.c b/windows/dialog.c
index 1b28dab..b6a3d31 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -78,42 +78,36 @@
  * Return the class and text of the control pointed to by ptr,
  * and return a pointer to the next control.
  */
-static DLGCONTROLHEADER * DIALOG_GetControl( DLGCONTROLHEADER * ptr,
-					     char ** class, char ** text )
+static SEGPTR DIALOG_GetControl( SEGPTR ptr, SEGPTR *class, SEGPTR *text )
 {
-    unsigned char * p = (unsigned char *)ptr;
+    unsigned char *base = (unsigned char *)PTR_SEG_TO_LIN( ptr );
+    unsigned char *p = base;
+
     p += 14;  /* size of control header */
 
     if (*p & 0x80)
     {
-	switch(*p++)
-	{
-	case 0x80: *class = "BUTTON"; break;
-	case 0x81: *class = "EDIT"; break;
-	case 0x82: *class = "STATIC"; break;
-	case 0x83: *class = "LISTBOX"; break;
-	case 0x84: *class = "SCROLLBAR"; break;
-	case 0x85: *class = "COMBOBOX"; break;
-	default:   *class = ""; break;
-	}
+        *class = MAKEINTRESOURCE( *p );
+        p++;
     }
     else 
     {
-	*class = p;
+	*class = ptr + (WORD)(p - base);
 	p += strlen(p) + 1;
     }
+
     if (*p == 0xff)
     {
 	  /* Integer id, not documented (?). Only works for SS_ICON controls */
-	*text = (char *)MAKEINTRESOURCE( p[1] + 256*p[2] );
+	*text = MAKEINTRESOURCE( p[1] + 256 * p[2] );
 	p += 4;
     }
     else
     {
-	*text = p;
+	*text = ptr + (WORD)(p - base);
 	p += strlen(p) + 2;
     }
-    return (DLGCONTROLHEADER *)p;
+    return ptr + (WORD)(p - base);
 }
 
 
@@ -123,32 +117,54 @@
  * Fill a DLGTEMPLATE structure from the dialog template, and return
  * a pointer to the first control.
  */
-static DLGCONTROLHEADER * DIALOG_ParseTemplate( LPCSTR template,
-					        DLGTEMPLATE * result )
+static SEGPTR DIALOG_ParseTemplate( SEGPTR template, DLGTEMPLATE * result )
 {
-    unsigned char * p = (unsigned char *)template;
+    unsigned char *base = (unsigned char *)PTR_SEG_TO_LIN(template);
+    unsigned char * p = base;
  
-    result->header = (DLGTEMPLATEHEADER *)p;
+    result->header = *(DLGTEMPLATEHEADER *)p;
     p += 13;
 
-    result->menuName = p;
-    if (*p == 0xff) p += 3;
-    else p += strlen(p) + 1;
+    /* Get the menu name */
 
-    if (*p) result->className = p;
-    else result->className = DIALOG_CLASS_NAME;
-    p += strlen(p) + 1;
-
-    result->caption = p;
-    p += strlen(p) + 1;
-
-    if (result->header->style & DS_SETFONT)
+    if (*p == 0xff)
     {
-	result->pointSize = *(WORD *)p;	p += sizeof(WORD);
-	result->faceName = p;           p += strlen(p) + 1;
+        result->menuName = MAKEINTRESOURCE( p[1] + 256 * p[2] );
+        p += 3;
+    }
+    else if (*p)
+    {
+        result->menuName = template + (WORD)(p - base);
+        p += strlen(p) + 1;
+    }
+    else
+    {
+        result->menuName = 0;
+        p++;
     }
 
-    return (DLGCONTROLHEADER *)p;
+    /* Get the class name */
+
+    if (*p) result->className = template + (WORD)(p - base);
+    else result->className = DIALOG_CLASS_ATOM;
+    p += strlen(p) + 1;
+
+    /* Get the window caption */
+
+    result->caption = template + (WORD)(p - base);
+    p += strlen(p) + 1;
+
+    /* Get the font name */
+
+    if (result->header.style & DS_SETFONT)
+    {
+	result->pointSize = *(WORD *)p;
+        p += sizeof(WORD);
+	result->faceName = template + (WORD)(p - base);
+        p += strlen(p) + 1;
+    }
+
+    return template + (WORD)(p - base);
 }
 
 
@@ -157,17 +173,27 @@
  */
 static void DIALOG_DisplayTemplate( DLGTEMPLATE * result )
 {
-    dprintf_dialog(stddeb, "DIALOG %d, %d, %d, %d\n", result->header->x, result->header->y,
-	    result->header->cx, result->header->cy );
-    dprintf_dialog(stddeb, " STYLE %08lx\n", result->header->style );
-    dprintf_dialog(stddeb, " CAPTION '%s'\n", result->caption );
-    dprintf_dialog(stddeb, " CLASS '%s'\n", result->className );
-    if (result->menuName[0] == 0xff)
-	dprintf_dialog(stddeb, " MENU %d\n", result->menuName[1] + 256*result->menuName[2] );
-    else 
-        dprintf_dialog(stddeb, " MENU '%s'\n", result->menuName );
-    if (result->header->style & DS_SETFONT)
-	dprintf_dialog(stddeb, " FONT %d,'%s'\n", result->pointSize, result->faceName );
+    dprintf_dialog(stddeb, "DIALOG %d, %d, %d, %d\n", result->header.x, result->header.y,
+	    result->header.cx, result->header.cy );
+    dprintf_dialog(stddeb, " STYLE %08lx\n", result->header.style );
+    dprintf_dialog( stddeb, " CAPTION '%s'\n",
+                    (char *)PTR_SEG_TO_LIN(result->caption) );
+
+    if (HIWORD(result->className))
+        dprintf_dialog( stddeb, " CLASS '%s'\n",
+                        (char *)PTR_SEG_TO_LIN(result->className) );
+    else
+        dprintf_dialog( stddeb, " CLASS #%d\n", LOWORD(result->className) );
+
+    if (HIWORD(result->menuName))
+        dprintf_dialog( stddeb, " MENU '%s'\n",
+                        (char *)PTR_SEG_TO_LIN(result->menuName) );
+    else if (LOWORD(result->menuName))
+	dprintf_dialog(stddeb, " MENU %04x\n", LOWORD(result->menuName) );
+
+    if (result->header.style & DS_SETFONT)
+	dprintf_dialog( stddeb, " FONT %d,'%s'\n", result->pointSize,
+                        (char *)PTR_SEG_TO_LIN(result->faceName) );
 }
 
 
@@ -190,14 +216,14 @@
     HWND hwnd = 0;
     HRSRC hRsrc;
     HGLOBAL hmem;
-    LPCSTR data;
+    SEGPTR data;
 
     dprintf_dialog(stddeb, "CreateDialogParam: %d,%08lx,%d,%08lx,%ld\n",
 	    hInst, dlgTemplate, owner, (DWORD)dlgProc, param );
      
     if (!(hRsrc = FindResource( hInst, dlgTemplate, RT_DIALOG ))) return 0;
     if (!(hmem = LoadResource( hInst, hRsrc ))) return 0;
-    if (!(data = LockResource( hmem ))) hwnd = 0;
+    if (!(data = WIN16_LockResource( hmem ))) hwnd = 0;
     else hwnd = CreateDialogIndirectParam(hInst, data, owner, dlgProc, param);
     FreeResource( hmem );
     return hwnd;
@@ -207,7 +233,7 @@
 /***********************************************************************
  *           CreateDialogIndirect   (USER.219)
  */
-HWND CreateDialogIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
+HWND CreateDialogIndirect( HINSTANCE hInst, SEGPTR dlgTemplate,
 			   HWND owner, WNDPROC dlgProc )
 {
     return CreateDialogIndirectParam( hInst, dlgTemplate, owner, dlgProc, 0 );
@@ -217,17 +243,17 @@
 /***********************************************************************
  *           CreateDialogIndirectParam   (USER.242)
  */
-HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
+HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
 			        HWND owner, WNDPROC dlgProc, LPARAM param )
 {
-    HMENU hMenu;
+    HMENU hMenu = 0;
     HFONT hFont = 0;
     HWND hwnd, hwndCtrl;
     RECT rect;
     WND * wndPtr;
     int i;
     DLGTEMPLATE template;
-    DLGCONTROLHEADER * header;
+    SEGPTR headerPtr;
     DIALOGINFO * dlgInfo;
     DWORD exStyle = 0;
     WORD xUnit = xBaseUnit;
@@ -236,40 +262,23 @@
       /* Parse dialog template */
 
     if (!dlgTemplate) return 0;
-    header = DIALOG_ParseTemplate( dlgTemplate, &template );
-    if(debugging_dialog)DIALOG_DisplayTemplate( &template );
+    headerPtr = DIALOG_ParseTemplate( dlgTemplate, &template );
+    if (debugging_dialog) DIALOG_DisplayTemplate( &template );
 
       /* Load menu */
 
-    switch (template.menuName[0])
-    {
-      case 0x00:
-	  hMenu = 0;
-	  break;
-      case 0xff:
-	  hMenu = LoadMenu( hInst, MAKEINTRESOURCE( template.menuName[1] +
-						   256*template.menuName[2] ));
-	  break;
-      default:
-          {
-                /* Need to copy the menu name to a 16-bit accessible area */
-              char name[256];
-              strncpy( name, template.menuName, 255 );
-              name[255] = '\0';
-              hMenu = LoadMenu( hInst, MAKE_SEGPTR(name) );
-          }
-	  break;
-    }
+    if (template.menuName) hMenu = LoadMenu( hInst, template.menuName );
 
       /* Create custom font if needed */
 
-    if (template.header->style & DS_SETFONT)
+    if (template.header.style & DS_SETFONT)
     {
           /* The font height must be negative as it is a point size */
           /* (see CreateFont() documentation in the Windows SDK).   */
 	hFont = CreateFont( -template.pointSize, 0, 0, 0, FW_DONTCARE,
 			    FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
-			    DEFAULT_QUALITY, FF_DONTCARE, template.faceName );
+			    DEFAULT_QUALITY, FF_DONTCARE,
+                            (LPSTR)PTR_SEG_TO_LIN(template.faceName) );
 	if (hFont)
 	{
 	    TEXTMETRIC tm;
@@ -291,18 +300,26 @@
       /* Create dialog main window */
 
     rect.left = rect.top = 0;
-    if (!(template.header->style & DS_ABSALIGN))
-	ClientToScreen( owner, (POINT *)&rect );
-    rect.right = rect.left + template.header->cx * xUnit / 4;
-    rect.bottom = rect.top + template.header->cy * yUnit / 8;
-    if (template.header->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
-    AdjustWindowRectEx( &rect, template.header->style, hMenu, exStyle );
+    rect.right = template.header.cx * xUnit / 4;
+    rect.bottom = template.header.cy * yUnit / 8;
+    if (template.header.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
+    AdjustWindowRectEx( &rect, template.header.style, hMenu, exStyle );
+    rect.right -= rect.left;
+    rect.bottom -= rect.top;
 
-    hwnd = CreateWindowEx( exStyle, template.className, template.caption,
-			   template.header->style & ~WS_VISIBLE,
-			   rect.left + template.header->x * xUnit / 4,
-			   rect.top + template.header->y * yUnit / 8,
-			   rect.right - rect.left, rect.bottom - rect.top,
+    if ((INT)template.header.x == CW_USEDEFAULT)
+        rect.left = rect.top = CW_USEDEFAULT;
+    else
+    {
+        rect.left += template.header.x * xUnit / 4;
+        rect.top += template.header.y * yUnit / 8;
+        if (!(template.header.style & DS_ABSALIGN))
+            ClientToScreen( owner, (POINT *)&rect );
+    }
+
+    hwnd = CreateWindowEx( exStyle, template.className, template.caption, 
+			   template.header.style & ~WS_VISIBLE,
+			   rect.left, rect.top, rect.right, rect.bottom,
 			   owner, hMenu, hInst, (SEGPTR)0 );
     if (!hwnd)
     {
@@ -320,48 +337,76 @@
     dlgInfo->msgResult = 0;  /* This is used to store the default button id */
     dlgInfo->hDialogHeap = 0;
 
-    for (i = 0; i < template.header->nbItems; i++)
+    for (i = 0; i < template.header.nbItems; i++)
     {
-	DLGCONTROLHEADER * next_header;
-	LPSTR class, text;
+	DLGCONTROLHEADER *header;
+	SEGPTR className, winName;
         HWND hwndDefButton = 0;
-	next_header = DIALOG_GetControl( header, &class, &text );
+        char buffer[10];
 
-	dprintf_dialog(stddeb, "   %s ", class);
-	if ((int)text & 0xffff0000) 
-	  dprintf_dialog(stddeb,"'%s'", text);
-	else 
-	  dprintf_dialog(stddeb,"%4X", (int)text & 0xffff);
+        header = (DLGCONTROLHEADER *)PTR_SEG_TO_LIN( headerPtr );
+	headerPtr = DIALOG_GetControl( headerPtr, &className, &winName );
+
+        if (!HIWORD(className))
+        {
+            switch(LOWORD(className))
+            {
+            case 0x80: strcpy( buffer, "BUTTON" ); break;
+            case 0x81: strcpy( buffer, "EDIT" ); break;
+            case 0x82: strcpy( buffer, "STATIC" ); break;
+            case 0x83: strcpy( buffer, "LISTBOX" ); break;
+            case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
+            case 0x85: strcpy( buffer, "COMBOBOX" ); break;
+            default:   buffer[0] = '\0'; break;
+            }
+            className = MAKE_SEGPTR(buffer);
+        }
+
+        if (HIWORD(className))
+            dprintf_dialog(stddeb, "   %s ", (char*)PTR_SEG_TO_LIN(className));
+        else dprintf_dialog(stddeb, "   %04x ", LOWORD(className) );
+	if (HIWORD(winName))
+            dprintf_dialog(stddeb,"'%s'", (char *)PTR_SEG_TO_LIN(winName) );
+	else dprintf_dialog(stddeb,"%04x", LOWORD(winName) );
+
 	dprintf_dialog(stddeb," %d, %d, %d, %d, %d, %08lx\n", 
-		header->id, header->x, header->y, 
-		header->cx, header->cy, header->style );
+                       header->id, header->x, header->y, 
+                       header->cx, header->cy, header->style );
 
-	if ((strcmp(class, "EDIT") == 0) &&
-	            ((header->style & DS_LOCALEDIT) != DS_LOCALEDIT)) {
-	    if (!dlgInfo->hDialogHeap) {
+	if (HIWORD(className) &&
+            !strcmp( (char *)PTR_SEG_TO_LIN(className), "EDIT") &&
+            ((header->style & DS_LOCALEDIT) != DS_LOCALEDIT))
+        {
+	    if (!dlgInfo->hDialogHeap)
+            {
 		dlgInfo->hDialogHeap = GlobalAlloc(GMEM_FIXED, 0x10000);
-		if (!dlgInfo->hDialogHeap) {
+		if (!dlgInfo->hDialogHeap)
+                {
 		    fprintf(stderr,"CreateDialogIndirectParam: Insufficient memory to create heap for edit control\n");
 		    continue;
 		}
 		LocalInit(dlgInfo->hDialogHeap, 0, 0xffff);
 	    }
-	    header->style |= WS_CHILD;
-	    hwndCtrl = CreateWindowEx( WS_EX_NOPARENTNOTIFY, 
-                           class, text, header->style,
-                           header->x * xUnit / 4, header->y * yUnit / 8,
-                           header->cx * xUnit / 4, header->cy * yUnit / 8,
-                           hwnd, header->id, dlgInfo->hDialogHeap, (SEGPTR)0 );
+	    hwndCtrl = CreateWindowEx(WS_EX_NOPARENTNOTIFY, className, winName,
+                                      header->style | WS_CHILD,
+                                      header->x * xUnit / 4,
+                                      header->y * yUnit / 8,
+                                      header->cx * xUnit / 4,
+                                      header->cy * yUnit / 8,
+                                      hwnd, header->id, dlgInfo->hDialogHeap,
+                                      (SEGPTR)0 );
 	}
 	else
         {
-	    header->style |= WS_CHILD;
-	    hwndCtrl = CreateWindowEx( WS_EX_NOPARENTNOTIFY, 
-                                class, text, header->style,
-                                header->x * xUnit / 4, header->y * yUnit / 8,
-                                header->cx * xUnit / 4, header->cy * yUnit / 8,
-                                hwnd, header->id, hInst, (SEGPTR)0 );
+	    hwndCtrl = CreateWindowEx(WS_EX_NOPARENTNOTIFY, className, winName,
+                                      header->style | WS_CHILD,
+                                      header->x * xUnit / 4,
+                                      header->y * yUnit / 8,
+                                      header->cx * xUnit / 4,
+                                      header->cy * yUnit / 8,
+                                      hwnd, header->id, hInst, (SEGPTR)0 );
 	}
+
         /* Make the control last one in Z-order, so that controls remain
            in the order in which they were created */
 	SetWindowPos( hwndCtrl, HWND_BOTTOM, 0, 0, 0, 0,
@@ -376,9 +421,8 @@
             if (hwndDefButton)
                 SendMessage( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE);
             hwndDefButton = hwndCtrl;
-            dlgInfo->msgResult = header->id;
+            dlgInfo->msgResult = GetWindowWord( hwndCtrl, GWW_ID );
         }
-	header = next_header;
     }    
 
     dprintf_dialog(stddeb, " END\n" );
@@ -398,7 +442,7 @@
 	SendMessage( hwnd, WM_SETFONT, dlgInfo->hUserFont, 0 );
     if (SendMessage( hwnd, WM_INITDIALOG, dlgInfo->hwndFocus, param ))
 	SetFocus( dlgInfo->hwndFocus );
-    if (template.header->style & WS_VISIBLE) ShowWindow(hwnd, SW_SHOW);
+    if (template.header.style & WS_VISIBLE) ShowWindow(hwnd, SW_SHOW);
     return hwnd;
 }
 
@@ -485,9 +529,9 @@
 			    HWND owner, WNDPROC dlgProc, LPARAM param )
 {
     HWND hwnd;
-    LPCSTR ptr;
+    SEGPTR ptr;
 
-    if (!(ptr = GlobalLock( dlgTemplate ))) return -1;
+    if (!(ptr = WIN16_GlobalLock( dlgTemplate ))) return -1;
     hwnd = CreateDialogIndirectParam( hInst, ptr, owner, dlgProc, param );
     GlobalUnlock( dlgTemplate );
     if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
@@ -496,29 +540,6 @@
 
 
 /***********************************************************************
- *           DialogBoxIndirectParamPtr
- *  like DialogBoxIndirectParam, but expects pointer to template
- */
-int DialogBoxIndirectParamPtr(HINSTANCE hInst,LPCSTR dlgTemplate,
-                              HWND owner, WNDPROC dlgProc, LPARAM param)
-{
-    HWND hwnd;
-    hwnd = CreateDialogIndirectParam( hInst, dlgTemplate, owner, dlgProc, param );
-    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
-    return -1;
-}
-
-/***********************************************************************
- *           DialogBoxIndirectPtr
- *  like DialogBoxIndirect, but expects pointer to template
- */
-int DialogBoxIndirectPtr( HINSTANCE hInst, LPCSTR dlgTemplate,
-                          HWND owner, WNDPROC dlgProc)
-{
-    return DialogBoxIndirectParamPtr(hInst, dlgTemplate, owner, dlgProc, 0);
-}
-
-/***********************************************************************
  *           EndDialog   (USER.88)
  */
 void EndDialog( HWND hwnd, short retval )
diff --git a/windows/mdi.c b/windows/mdi.c
index aa67bf0..de7ded7 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -107,8 +107,7 @@
     cs->x = ci->nActiveChildren * spacing;  
     cs->y = ci->nActiveChildren * spacing;
 
-    hwnd = CreateWindowEx(0, PTR_SEG_TO_LIN(cs->szClass),
-                          PTR_SEG_TO_LIN(cs->szTitle), 
+    hwnd = CreateWindow( cs->szClass, cs->szTitle,
 			  WS_CHILD | WS_BORDER | WS_CAPTION | WS_CLIPSIBLINGS |
 			  WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU |
 			  WS_THICKFRAME | WS_VISIBLE | cs->style,
diff --git a/windows/msgbox.c b/windows/msgbox.c
index c064f6d..05bc09c 100644
--- a/windows/msgbox.c
+++ b/windows/msgbox.c
@@ -7,8 +7,10 @@
 
 #include "windows.h"
 #include "dlgs.h"
-#include "dialog.h"
+#include "global.h"
 #include "selectors.h"
+#include "alias.h"
+#include "relay32.h"
 #include "../rc/sysres.h"
 #include "task.h"
 
@@ -175,15 +177,35 @@
 
 int MessageBox(HWND hWnd, LPSTR text, LPSTR title, WORD type)
 {
-  MSGBOX mbox;
+    HANDLE handle;
+    MSGBOX mbox;
+    int ret;
+    DWORD WineProc,Win16Proc,Win32Proc;
+    static int initialized = 0;
 
-  mbox.title = title;
-  mbox.text  = text;
-  mbox.type  = type;
-  return DialogBoxIndirectParamPtr(GetWindowWord(hWnd, GWW_HINSTANCE),
-				   sysres_DIALOG_MSGBOX, hWnd,
-				   GetWndProcEntry16("SystemMessageBoxProc"),
-				   (LONG)&mbox);
+    mbox.title = title;
+    mbox.text  = text;
+    mbox.type  = type;
+
+    if (!initialized)
+    {
+        WineProc=(DWORD)SystemMessageBoxProc;
+        Win16Proc=(DWORD)GetWndProcEntry16("SystemMessageBoxProc");
+        Win32Proc=(DWORD)RELAY32_GetEntryPoint("WINPROCS32","SystemMessageBoxProc",0);
+        ALIAS_RegisterAlias(WineProc,Win16Proc,Win32Proc);
+        initialized=1;
+    }
+
+    handle = GLOBAL_CreateBlock( GMEM_FIXED, sysres_DIALOG_MSGBOX.bytes,
+                                 sysres_DIALOG_MSGBOX.size, GetCurrentPDB(),
+                                 FALSE, FALSE, TRUE, NULL );
+    if (!handle) return 0;
+    ret = DialogBoxIndirectParam( GetWindowWord(hWnd, GWW_HINSTANCE),
+                                  handle, hWnd,
+                                  GetWndProcEntry16("SystemMessageBoxProc"),
+                                  (LONG)&mbox );
+    GLOBAL_FreeBlock( handle );
+    return ret;
 }
 
 /**************************************************************************
diff --git a/windows/win.c b/windows/win.c
index 5874ecb..d7e2d2d 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -279,7 +279,7 @@
 /***********************************************************************
  *           CreateWindow   (USER.41)
  */
-HWND CreateWindow( LPSTR className, LPSTR windowName,
+HWND CreateWindow( SEGPTR className, SEGPTR windowName,
 		   DWORD style, short x, short y, short width, short height,
 		   HWND parent, HMENU menu, HANDLE instance, SEGPTR data ) 
 {
@@ -291,7 +291,7 @@
 /***********************************************************************
  *           CreateWindowEx   (USER.452)
  */
-HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
+HWND CreateWindowEx( DWORD exStyle, SEGPTR className, SEGPTR windowName,
 		     DWORD style, short x, short y, short width, short height,
 		     HWND parent, HMENU menu, HANDLE instance, SEGPTR data ) 
 {
@@ -300,31 +300,25 @@
     WND *wndPtr;
     POINT maxSize, maxPos, minTrack, maxTrack;
     CREATESTRUCT createStruct;
-    HANDLE hwinName, hclassName;
     int wmcreate;
     XSetWindowAttributes win_attr;
 
     /* FIXME: windowName and className should be SEGPTRs */
 
+    dprintf_win( stddeb, "CreateWindowEx: " );
     if (HIWORD(windowName))
-	dprintf_win( stddeb, "CreateWindowEx: '%s' ", windowName );
+	dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(windowName) );
     else
-	dprintf_win( stddeb, "CreateWindowEx: %04x ", LOWORD(windowName) );
+	dprintf_win( stddeb, "%04x ", LOWORD(windowName) );
     if (HIWORD(className))
-        dprintf_win( stddeb, "'%s' ", className );
+        dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(className) );
     else
         dprintf_win( stddeb, "%04x ", LOWORD(className) );
 
     dprintf_win(stddeb, "%08lx %08lx %d,%d %dx%d %04x %04x %04x %08lx\n",
 		exStyle, style, x, y, width, height,
 		parent, menu, instance, data);
-    /* 'soundrec.exe' has negative position ! 
-       Why ? For now, here a patch : */
-    if (HIWORD(className) && !strcmp(className, "SoundRec"))
-    {
-	if (x < 0) x = 0;
-	if (y < 0) y = 0;
-    }
+
     if (x == CW_USEDEFAULT) x = y = 0;
     if (width == CW_USEDEFAULT)
     {
@@ -350,15 +344,14 @@
 	}
     }
 
+    if (!(class = CLASS_FindClassByName( className, GetExePtr(instance),
+                                         &classPtr )))
     {
-        /* FIXME!! */
-        char buff[256];
-        if (HIWORD(className)) strcpy( buff, className );
-        if (!(class = CLASS_FindClassByName( HIWORD(className) ? MAKE_SEGPTR(buff) : (SEGPTR)className,
-                                         GetExePtr( instance ), &classPtr ))) {
-            fprintf(stderr,"CreateWindow BAD CLASSNAME '%s' !\n", className);
-            return 0;
-        }
+        fprintf(stderr,"CreateWindow BAD CLASSNAME " );
+        if (HIWORD(className)) fprintf( stderr, "'%s'\n", 
+                                        (char *)PTR_SEG_TO_LIN(className) );
+        else fprintf( stderr, "%04x\n", LOWORD(className) );
+        return 0;
     }
 
       /* Correct the window style */
@@ -395,7 +388,7 @@
     wndPtr->hwndPrevActive = 0;
     wndPtr->hwndLastActive = hwnd;
     wndPtr->lpfnWndProc    = classPtr->wc.lpfnWndProc;
-    wndPtr->dwStyle        = style;
+    wndPtr->dwStyle        = style & ~WS_VISIBLE;
     wndPtr->dwExStyle      = exStyle;
     wndPtr->wIDmenu        = 0;
     wndPtr->hText          = 0;
@@ -462,7 +455,7 @@
                                         CWEventMask | CWOverrideRedirect |
                                         CWColormap | CWCursor | CWSaveUnder |
                                         CWBackingStore, &win_attr );
-        XStoreName( display, wndPtr->window, windowName );
+        XStoreName( display, wndPtr->window, PTR_SEG_TO_LIN(windowName) );
         EVENT_RegisterWindow( wndPtr->window, hwnd );
         GlobalUnlock( hCursor );
     }
@@ -486,33 +479,13 @@
     createStruct.x              = x;
     createStruct.y              = y;
     createStruct.style          = style;
+    createStruct.lpszName       = windowName;
+    createStruct.lpszClass      = className;
     createStruct.dwExStyle      = 0;
-    if (HIWORD(className))
-    {
-        hclassName = USER_HEAP_ALLOC( strlen(className)+1 );
-        strcpy( USER_HEAP_LIN_ADDR(hclassName), className );
-        createStruct.lpszClass = (LPSTR)USER_HEAP_SEG_ADDR(hclassName);
-    }
-    else
-    {
-        hclassName = 0;
-        createStruct.lpszClass = className;
-    }
-
-    if (HIWORD(windowName))
-    {
-        hwinName = USER_HEAP_ALLOC( strlen(windowName)+1 );
-        strcpy( USER_HEAP_LIN_ADDR(hwinName), windowName );
-        createStruct.lpszName = (LPSTR)USER_HEAP_SEG_ADDR(hwinName);
-    }
-    else
-    {
-        hwinName = 0;
-        createStruct.lpszName = windowName;
-    }
 
     wmcreate = SendMessage( hwnd, WM_NCCREATE, 0, MAKE_SEGPTR(&createStruct) );
-    if (!wmcreate) {
+    if (!wmcreate)
+    {
 	dprintf_win(stddeb,"CreateWindowEx: WM_NCCREATE return 0\n");
 	wmcreate = -1;
     }
@@ -523,9 +496,6 @@
 	wmcreate = SendMessage(hwnd, WM_CREATE, 0, MAKE_SEGPTR(&createStruct));
     }
 
-    if (hclassName) USER_HEAP_FREE( hclassName );
-    if (hwinName) USER_HEAP_FREE( hwinName );
-
     if (wmcreate == -1)
     {
 	  /* Abort window creation */
@@ -538,9 +508,25 @@
     if (style & WS_SYSMENU) wndPtr->hSysMenu = CopySysMenu();
 
     WIN_SendParentNotify( hwnd, WM_CREATE, MAKELONG( hwnd, wndPtr->wIDmenu ) );
-    
-    if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
-/*    if (style & WS_MINIMIZE) ShowWindow( hwnd, SW_MINIMIZE ); */
+
+    /* Show the window, maximizing or minimizing if needed */
+
+    if (wndPtr->dwStyle & WS_MINIMIZE)
+    {
+        wndPtr->dwStyle &= ~WS_MAXIMIZE;
+        WINPOS_FindIconPos( hwnd );
+        SetWindowPos( hwnd, 0, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y,
+                      SYSMETRICS_CXICON, SYSMETRICS_CYICON,
+                      SWP_FRAMECHANGED |
+                      (style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
+    }
+    else if (wndPtr->dwStyle & WS_MAXIMIZE)
+    {
+        SetWindowPos( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y,
+                      SWP_FRAMECHANGED |
+                      (style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
+    }
+    else if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
 
     dprintf_win(stddeb, "CreateWindowEx: return %04X \n", hwnd);
     return hwnd;
diff --git a/windows/winpos.c b/windows/winpos.c
index 577221d..5ef9e45 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -24,7 +24,7 @@
  * Find a suitable place for an iconic window.
  * The new position is stored into wndPtr->ptIconPos.
  */
-static void WINPOS_FindIconPos( HWND hwnd )
+void WINPOS_FindIconPos( HWND hwnd )
 {
     RECT rectParent;
     short x, y, xspacing, yspacing;