wineps.drv: Make wineps16.drv into a stand-alone 16-bit module.
diff --git a/.gitignore b/.gitignore
index 6d85393..6c9437e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -120,7 +120,6 @@
 dlls/stdole2.tlb/std_ole_v2.tlb
 dlls/stdole32.tlb/std_ole_v1.tlb
 dlls/user.exe16
-dlls/wineps16.drv16
 dlls/wprocs.dll16
 include/activaut.h
 include/activdbg.h
diff --git a/configure b/configure
index dd41b9c..a68d6e8 100755
--- a/configure
+++ b/configure
@@ -17108,6 +17108,14 @@
 ac_config_files="$ac_config_files dlls/wineps.drv/Makefile"
 
 ALL_MAKEFILES="$ALL_MAKEFILES \\
+	dlls/wineps16.drv16/Makefile"
+test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
+	wineps16.drv16"
+ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
+dlls/wineps16.drv16/Makefile: dlls/wineps16.drv16/Makefile.in dlls/Makedll.rules"
+ac_config_files="$ac_config_files dlls/wineps16.drv16/Makefile"
+
+ALL_MAKEFILES="$ALL_MAKEFILES \\
 	dlls/winequartz.drv/Makefile"
 test "x$enable_winequartz_drv" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
 	winequartz.drv"
@@ -19143,6 +19151,7 @@
     "dlls/winenas.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winenas.drv/Makefile" ;;
     "dlls/wineoss.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineoss.drv/Makefile" ;;
     "dlls/wineps.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineps.drv/Makefile" ;;
+    "dlls/wineps16.drv16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineps16.drv16/Makefile" ;;
     "dlls/winequartz.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winequartz.drv/Makefile" ;;
     "dlls/winex11.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winex11.drv/Makefile" ;;
     "dlls/wing.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wing.dll16/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 8777f15..49aaa07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2501,6 +2501,7 @@
 WINE_CONFIG_MAKEFILE([dlls/winenas.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/wineoss.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/wineps.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
+WINE_CONFIG_MAKEFILE([dlls/wineps16.drv16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
 WINE_CONFIG_MAKEFILE([dlls/winequartz.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/winex11.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
 WINE_CONFIG_MAKEFILE([dlls/wing.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 8e0837d..60dc2ba 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -24,7 +24,6 @@
 	mmsystem.dll16 \
 	setupx.dll16 \
 	user.exe16 \
-	wineps16.drv16 \
 	wprocs.dll16
 
 @MAKE_RULES@
@@ -53,9 +52,6 @@
 wprocs.dll16:
 	echo "winedos.dll" >$@
 
-wineps16.drv16:
-	echo "wineps.drv" >$@
-
 mmsystem.dll16:
 	echo "winmm.dll" >$@
 
diff --git a/dlls/wineps.drv/Makefile.in b/dlls/wineps.drv/Makefile.in
index 7e8efdc..34d3473 100644
--- a/dlls/wineps.drv/Makefile.in
+++ b/dlls/wineps.drv/Makefile.in
@@ -6,8 +6,6 @@
 IMPORTS   = user32 gdi32 winspool advapi32 kernel32
 EXTRAINCL = @FREETYPEINCL@ @CUPSINCL@
 
-SPEC_SRCS16 = wineps16.drv.spec
-
 C_SRCS = \
 	afm.c \
 	bitblt.c \
diff --git a/dlls/wineps.drv/driver.c b/dlls/wineps.drv/driver.c
index 904f97a..378f4fe 100644
--- a/dlls/wineps.drv/driver.c
+++ b/dlls/wineps.drv/driver.c
@@ -176,19 +176,6 @@
 }
 
 
-/**************************************************************
- *	AdvancedSetupDialog	[WINEPS16.93]
- *
- */
-WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver,
-					 LPDEVMODEA devin, LPDEVMODEA devout)
-{
-
-  TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd,
-	hDriver, devin, devout);
-  return IDCANCEL;
-}
-
 /****************************************************************
  *       PSDRV_PaperDlgProc
  *
@@ -406,21 +393,6 @@
   }
   return IDOK;
 }
-/***************************************************************
- *	ExtDeviceMode	[WINEPS16.90]
- *
- */
-
-INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
-				   LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
-				   LPSTR lpszPort, LPDEVMODEA lpdmInput,
-				   LPSTR lpszProfile, WORD fwMode)
-
-{
-    return PSDRV_ExtDeviceMode(NULL, HWND_32(hwnd), lpdmOutput, lpszDevice,
-				 lpszPort, lpdmInput, lpszProfile, (DWORD) fwMode);
-}
-
 /***********************************************************************
  *	PSDRV_DeviceCapabilities	
  *
@@ -722,29 +694,6 @@
   return -1;
 }
 
-/**************************************************************
- *     DeviceCapabilities [WINEPS16.91]
- */
-DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice,
-			       LPCSTR lpszPort, WORD fwCapability,
-			       LPSTR lpszOutput, LPDEVMODEA lpdm)
-{
-    return PSDRV_DeviceCapabilities(NULL, lpszDevice, lpszPort, fwCapability,
-				      lpszOutput, lpdm);
-}
-
-/***************************************************************
- *	DeviceMode	[WINEPS16.13]
- *
- */
-void WINAPI PSDRV_DeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
-LPSTR lpszDevice, LPSTR lpszPort)
-{
-    PSDRV_ExtDeviceMode16( hwnd, hDriver, NULL, lpszDevice, lpszPort, NULL,
-			   NULL, DM_PROMPT );
-    return;
-}
-
 #if 0
 typedef struct {
   DWORD nPages;
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index fb90aeb..c9a4a4e 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -397,11 +397,6 @@
 extern const INT    	    PSDRV_AGLbyUVSize;	    /* sorted by UV -	    */
 extern const UNICODEGLYPH   PSDRV_AGLbyUV[];	    /*  duplicates included */
 
-
-extern INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
-		    LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort,
-		    LPDEVMODEA lpdmInput, LPSTR lpszProfile, WORD fwMode);
-
 extern HINSTANCE PSDRV_hInstance;
 extern HANDLE PSDRV_Heap;
 extern char *PSDRV_ANSIVector[256];
diff --git a/dlls/wineps16.drv16/Makefile.in b/dlls/wineps16.drv16/Makefile.in
new file mode 100644
index 0000000..ceeb97c
--- /dev/null
+++ b/dlls/wineps16.drv16/Makefile.in
@@ -0,0 +1,14 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = wineps16.drv16
+IMPORTS   = kernel32
+
+EXTRADLLFLAGS = -Wb,--subsystem,win16
+
+C_SRCS = driver.c
+
+@MAKE_DLL_RULES@
+
+@DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/wineps16.drv16/driver.c b/dlls/wineps16.drv16/driver.c
new file mode 100644
index 0000000..64dcbfb
--- /dev/null
+++ b/dlls/wineps16.drv16/driver.c
@@ -0,0 +1,89 @@
+/*
+ * Exported functions from the PostScript driver.
+ *
+ * Copyright 1998 Huw D M Davies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "wine/winuser16.h"
+#include "wownt32.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
+
+static HMODULE wineps;
+static INT (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
+static DWORD (CDECL *pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
+
+static HMODULE load_wineps(void)
+{
+    if (!wineps)
+    {
+        wineps = LoadLibraryA( "wineps.drv" );
+        pExtDeviceMode = (void *)GetProcAddress( wineps, "ExtDeviceMode" );
+        pDeviceCapabilities = (void *)GetProcAddress( wineps, "DeviceCapabilities" );
+    }
+    return wineps;
+}
+
+/**************************************************************
+ *	AdvancedSetupDialog	[WINEPS16.93]
+ */
+WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver,
+                                        LPDEVMODEA devin, LPDEVMODEA devout)
+{
+    TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd, hDriver, devin, devout);
+    return IDCANCEL;
+}
+
+/***************************************************************
+ *	ExtDeviceMode	[WINEPS16.90]
+ */
+INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
+				   LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
+				   LPSTR lpszPort, LPDEVMODEA lpdmInput,
+				   LPSTR lpszProfile, WORD fwMode)
+
+{
+    if (!load_wineps() || !pExtDeviceMode) return -1;
+    return pExtDeviceMode( NULL, HWND_32(hwnd), lpdmOutput, lpszDevice,
+                           lpszPort, lpdmInput, lpszProfile, fwMode );
+}
+
+/**************************************************************
+ *     DeviceCapabilities [WINEPS16.91]
+ */
+DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice,
+			       LPCSTR lpszPort, WORD fwCapability,
+			       LPSTR lpszOutput, LPDEVMODEA lpdm)
+{
+    if (!load_wineps() || !pDeviceCapabilities) return 0;
+    return pDeviceCapabilities( NULL, lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
+}
+
+/***************************************************************
+ *	DeviceMode	[WINEPS16.13]
+ *
+ */
+void WINAPI PSDRV_DeviceMode16(HWND16 hwnd, HANDLE16 hDriver, LPSTR lpszDevice, LPSTR lpszPort)
+{
+    PSDRV_ExtDeviceMode16( hwnd, hDriver, NULL, lpszDevice, lpszPort, NULL, NULL, DM_PROMPT );
+}
diff --git a/dlls/wineps.drv/wineps16.drv.spec b/dlls/wineps16.drv16/wineps16.drv16.spec
similarity index 100%
rename from dlls/wineps.drv/wineps16.drv.spec
rename to dlls/wineps16.drv16/wineps16.drv16.spec