diff --git a/Make.rules.in b/Make.rules.in
index 8c74900189037b24f3d481a206242d1c273e848c..0fdd73494365d37590030fbe67e83f5bea1b0c1a 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -85,6 +85,8 @@ DLLS = \
 	comctl32 \
 	comdlg32 \
 	dciman32 \
+	ddraw \
+	dinput \
 	dplayx \
 	dsound \
 	icmp \
diff --git a/configure b/configure
index f625d261564b51123f898aa36c95618115dde2aa..06a8fdd7190a974b65e398a4386920cf5b33d5c7 100755
--- a/configure
+++ b/configure
@@ -6185,6 +6185,8 @@ dlls/comctl32/Makefile
 dlls/commdlg/Makefile
 dlls/crtdll/Makefile
 dlls/dciman32/Makefile
+dlls/ddraw/Makefile
+dlls/dinput/Makefile
 dlls/display/Makefile
 dlls/dplayx/Makefile
 dlls/dsound/Makefile
@@ -6401,6 +6403,8 @@ dlls/comctl32/Makefile
 dlls/commdlg/Makefile
 dlls/crtdll/Makefile
 dlls/dciman32/Makefile
+dlls/ddraw/Makefile
+dlls/dinput/Makefile
 dlls/display/Makefile
 dlls/dplayx/Makefile
 dlls/dsound/Makefile
diff --git a/configure.in b/configure.in
index ef8024d0abd131550c4982576e3151cacae39eb1..b7391c94b34a36b1c464d1df803ba555cc6c1e1d 100644
--- a/configure.in
+++ b/configure.in
@@ -947,6 +947,8 @@ dlls/comctl32/Makefile
 dlls/commdlg/Makefile
 dlls/crtdll/Makefile
 dlls/dciman32/Makefile
+dlls/ddraw/Makefile
+dlls/dinput/Makefile
 dlls/display/Makefile
 dlls/dplayx/Makefile
 dlls/dsound/Makefile
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 45a5bfdfbdccff40b3dc5affdca3b1302efee348..82696c5f94a78d32515a94eaca3d3f9ff57d1583 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -8,6 +8,8 @@ DLLFILES = \
 	comctl32/libcomctl32.@LIBEXT@ \
 	commdlg/libcomdlg32.@LIBEXT@ \
 	dciman32/libdciman32.@LIBEXT@ \
+	ddraw/libddraw.@LIBEXT@ \
+	dinput/libdinput.@LIBEXT@ \
 	dplayx/libdplayx.@LIBEXT@ \
 	dsound/libdsound.@LIBEXT@ \
 	icmp/libicmp.@LIBEXT@ \
@@ -94,6 +96,12 @@ libcomdlg32.@LIBEXT@ libcommdlg.@LIBEXT@: commdlg/libcomdlg32.@LIBEXT@
 libdciman32.@LIBEXT@: dciman32/libdciman32.@LIBEXT@
 	$(RM) $@ && $(LN_S) dciman32/libdciman32.@LIBEXT@ $@
 
+libddraw.@LIBEXT@: ddraw/libddraw.@LIBEXT@
+	$(RM) $@ && $(LN_S) ddraw/libddraw.@LIBEXT@ $@
+
+libdinput.@LIBEXT@: dinput/libdinput.@LIBEXT@
+	$(RM) $@ && $(LN_S) dinput/libdinput.@LIBEXT@ $@
+
 libdplayx.@LIBEXT@ libdplay.@LIBEXT@: dplayx/libdplayx.@LIBEXT@
 	$(RM) $@ && $(LN_S) dplayx/libdplayx.@LIBEXT@ $@
 
diff --git a/dlls/ddraw/.cvsignore b/dlls/ddraw/.cvsignore
new file mode 100644
index 0000000000000000000000000000000000000000..2586cb49cba41537a82461003c41c89b4527c2e2
--- /dev/null
+++ b/dlls/ddraw/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+ddraw.spec.c
+libddraw.so.1.0
diff --git a/dlls/ddraw/Makefile.in b/dlls/ddraw/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..abd64aa68f93b4c96e89d4abc32e2dcc5a532f0b
--- /dev/null
+++ b/dlls/ddraw/Makefile.in
@@ -0,0 +1,23 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = ddraw
+SOVERSION = 1.0
+
+SPEC_SRCS = ddraw.spec
+
+C_SRCS = \
+	d3dcommon.c \
+	d3ddevices.c \
+	d3dexecutebuffer.c \
+	d3dlight.c \
+	d3dmaterial.c \
+	d3dtexture.c \
+	d3dviewport.c \
+	ddraw_main.c
+
+@MAKE_DLL_RULES@
+
+### Dependencies:
+
diff --git a/graphics/d3d_private.h b/dlls/ddraw/d3d_private.h
similarity index 100%
rename from graphics/d3d_private.h
rename to dlls/ddraw/d3d_private.h
diff --git a/graphics/d3dcommon.c b/dlls/ddraw/d3dcommon.c
similarity index 100%
rename from graphics/d3dcommon.c
rename to dlls/ddraw/d3dcommon.c
diff --git a/graphics/d3ddevices.c b/dlls/ddraw/d3ddevices.c
similarity index 100%
rename from graphics/d3ddevices.c
rename to dlls/ddraw/d3ddevices.c
diff --git a/graphics/d3dexecutebuffer.c b/dlls/ddraw/d3dexecutebuffer.c
similarity index 100%
rename from graphics/d3dexecutebuffer.c
rename to dlls/ddraw/d3dexecutebuffer.c
diff --git a/graphics/d3dlight.c b/dlls/ddraw/d3dlight.c
similarity index 100%
rename from graphics/d3dlight.c
rename to dlls/ddraw/d3dlight.c
diff --git a/graphics/d3dmaterial.c b/dlls/ddraw/d3dmaterial.c
similarity index 100%
rename from graphics/d3dmaterial.c
rename to dlls/ddraw/d3dmaterial.c
diff --git a/graphics/d3dtexture.c b/dlls/ddraw/d3dtexture.c
similarity index 100%
rename from graphics/d3dtexture.c
rename to dlls/ddraw/d3dtexture.c
diff --git a/graphics/d3dviewport.c b/dlls/ddraw/d3dviewport.c
similarity index 100%
rename from graphics/d3dviewport.c
rename to dlls/ddraw/d3dviewport.c
diff --git a/relay32/ddraw.spec b/dlls/ddraw/ddraw.spec
similarity index 100%
rename from relay32/ddraw.spec
rename to dlls/ddraw/ddraw.spec
diff --git a/graphics/ddraw.c b/dlls/ddraw/ddraw_main.c
similarity index 100%
rename from graphics/ddraw.c
rename to dlls/ddraw/ddraw_main.c
diff --git a/graphics/ddraw_private.h b/dlls/ddraw/ddraw_private.h
similarity index 100%
rename from graphics/ddraw_private.h
rename to dlls/ddraw/ddraw_private.h
diff --git a/dlls/dinput/.cvsignore b/dlls/dinput/.cvsignore
new file mode 100644
index 0000000000000000000000000000000000000000..c1559dcbe5b84a1a91158e26933b9e9e10818173
--- /dev/null
+++ b/dlls/dinput/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+dinput.spec.c
+libdinput.so.1.0
diff --git a/dlls/dinput/Makefile.in b/dlls/dinput/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..b0abec71b50ae3c3f081940878547155ebf18679
--- /dev/null
+++ b/dlls/dinput/Makefile.in
@@ -0,0 +1,16 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = dinput
+SOVERSION = 1.0
+
+SPEC_SRCS = dinput.spec
+
+C_SRCS = \
+	dinput_main.c
+
+@MAKE_DLL_RULES@
+
+### Dependencies:
+
diff --git a/relay32/dinput.spec b/dlls/dinput/dinput.spec
similarity index 100%
rename from relay32/dinput.spec
rename to dlls/dinput/dinput.spec
diff --git a/windows/dinput.c b/dlls/dinput/dinput_main.c
similarity index 99%
rename from windows/dinput.c
rename to dlls/dinput/dinput_main.c
index 3165bfa37c12544b1fbe9a814832d6e2605ee960..32503f5d51aabd75ebbf8ebd6fd3ada25eb0bb80 100644
--- a/windows/dinput.c
+++ b/dlls/dinput/dinput_main.c
@@ -53,7 +53,7 @@
 #include "wingdi.h"
 #include "winuser.h"
 
-DEFAULT_DEBUG_CHANNEL(dinput)
+DEFAULT_DEBUG_CHANNEL(dinput);
 
 /* Wine mouse driver object instances */
 #define WINE_MOUSE_X_AXIS_INSTANCE 0x0001
diff --git a/graphics/Makefile.in b/graphics/Makefile.in
index c04a081a762bd766ce3491edb117d94a2ee7f1b2..b9cd3d8d4e29a4a7cea4f627b7bb32d0e7be573f 100644
--- a/graphics/Makefile.in
+++ b/graphics/Makefile.in
@@ -8,14 +8,6 @@ MODULE    = graphics
 C_SRCS = \
 	bitblt.c \
 	cache.c \
-	d3dcommon.c \
-	d3ddevices.c \
-	d3dexecutebuffer.c \
-	d3dlight.c \
-	d3dmaterial.c \
-	d3dtexture.c \
-	d3dviewport.c \
-	ddraw.c \
 	dispdib.c \
 	driver.c \
 	env.c \
diff --git a/graphics/vga.c b/graphics/vga.c
index 1d5889c574f455d6720fc03dec5c7da3f9e93cac..078bd5c39ad041e5bc808806c9b82fd5180b9cfb 100644
--- a/graphics/vga.c
+++ b/graphics/vga.c
@@ -23,6 +23,8 @@ static DDSURFACEDESC sdesc;
 static LONG vga_polling,vga_refresh;
 static HANDLE poll_timer;
 
+static HRESULT WINAPI (*pDirectDrawCreate)(LPGUID,LPDIRECTDRAW *,LPUNKNOWN);
+
 static void VGA_DeinstallTimer(void)
 {
     if (poll_timer) {
@@ -51,7 +53,12 @@ int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth)
 {
     if (lpddraw) VGA_Exit();
     if (!lpddraw) {
-        DirectDrawCreate(NULL,&lpddraw,NULL);
+        if (!pDirectDrawCreate)
+        {
+            HMODULE hmod = LoadLibraryA( "ddraw.dll" );
+            if (hmod) pDirectDrawCreate = GetProcAddress( hmod, "DirectDrawCreate" );
+        }
+        if (pDirectDrawCreate) pDirectDrawCreate(NULL,&lpddraw,NULL);
         if (!lpddraw) {
             ERR("DirectDraw is not available\n");
             return 1;
diff --git a/relay32/Makefile.in b/relay32/Makefile.in
index c63a22e7f03cffb2a3a59cbfa5a36c2c5e9702a0..abcf3a6ba4d96adaa594bb4a5d73a855309625ba 100644
--- a/relay32/Makefile.in
+++ b/relay32/Makefile.in
@@ -6,8 +6,6 @@ VPATH     = @srcdir@
 MODULE    = relay32
 
 SPEC_SRCS = \
-	ddraw.spec \
-	dinput.spec \
 	gdi32.spec \
 	kernel32.spec \
 	user32.spec \
diff --git a/windows/Makefile.in b/windows/Makefile.in
index c8fdf3d277da9f667ea255b0292746c56d236560..f6900674f4063afa34971ce3c6a524b23e129c77 100644
--- a/windows/Makefile.in
+++ b/windows/Makefile.in
@@ -13,7 +13,6 @@ C_SRCS = \
 	defdlg.c \
 	defwnd.c \
 	dialog.c \
-	dinput.c \
 	driver.c \
 	event.c \
 	focus.c \