Initialial implementation of the parallel.sys driver, which is needed for supporting third-party parallel port drivers.

Peter Dons Tychsen (none) donpedro at dhcppc2.
Tue Sep 16 17:58:24 CDT 2008


---
 dlls/parallel.sys/Makefile.in       |   17 +++++++
 dlls/parallel.sys/parallel.c        |   91 +++++++++++++++++++++++++++++++++++
 dlls/parallel.sys/parallel.sys.spec |    1 +
 3 files changed, 109 insertions(+), 0 deletions(-)
 create mode 100644 dlls/parallel.sys/Makefile.in
 create mode 100644 dlls/parallel.sys/parallel.c
 create mode 100644 dlls/parallel.sys/parallel.sys.spec

diff --git a/dlls/parallel.sys/Makefile.in b/dlls/parallel.sys/Makefile.in
new file mode 100644
index 0000000..d6fa974
--- /dev/null
+++ b/dlls/parallel.sys/Makefile.in
@@ -0,0 +1,17 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = parallel.sys
+IMPORTS   = uuid advapi32 ntoskrnl.exe kernel32 ntdll
+DELAYIMPORTS = user32
+EXTRADLLFLAGS = -Wb,--subsystem,native
+EXTRADEFS = @HALINCL@
+EXTRALIBS = @DISKARBITRATIONLIB@
+
+C_SRCS = \
+	parallel.c
+
+ at MAKE_DLL_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/parallel.sys/parallel.c b/dlls/parallel.sys/parallel.c
new file mode 100644
index 0000000..cdad19b
--- /dev/null
+++ b/dlls/parallel.sys/parallel.c
@@ -0,0 +1,91 @@
+/*
+ * Parallel port service implementation
+ *
+ * Copyright 2008 Peter Dons Tychsen 
+ *
+ * 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 <stdarg.h>
+#include <unistd.h>
+
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#include "winioctl.h"
+#include "winreg.h"
+#include "ddk/wdm.h"
+#include "wine/library.h"
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(parallel);
+
+/* handler for ioctls on the parallel device */
+static NTSTATUS WINAPI parallel_ioctl( DEVICE_OBJECT *device, IRP *irp )
+{
+    IO_STACK_LOCATION *irpsp = irp->Tail.Overlay.s.u.CurrentStackLocation;
+
+    TRACE( "ioctl %x insize %u outsize %u\n",
+           irpsp->Parameters.DeviceIoControl.IoControlCode,
+           irpsp->Parameters.DeviceIoControl.InputBufferLength,
+           irpsp->Parameters.DeviceIoControl.OutputBufferLength );
+
+    switch(irpsp->Parameters.DeviceIoControl.IoControlCode)
+    {
+    default:
+        FIXME( "ioctl %x not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode );
+        irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
+        break;
+    }
+    return irp->IoStatus.u.Status;
+}
+
+NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
+{
+    static const WCHAR device_parallelW[] = {'\\','D','e','v','i','c','e','\\','P','a','r','a','l','l','e','l','P','o','r','t','0',0};
+    static const WCHAR link_parallelW[] = {'\\','?','?','\\','L','P','T','0',0};
+    UNICODE_STRING nameW, linkW;
+    DEVICE_OBJECT *device;
+    NTSTATUS status;
+    
+    /* setup ioctl */
+    driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = parallel_ioctl;
+ 
+    RtlInitUnicodeString( &nameW, device_parallelW );
+    RtlInitUnicodeString( &linkW, link_parallelW );
+    
+    /* create all the parallel devices */
+    /* FIXME: Just create 1 device for now */
+    status = IoCreateDevice( driver, 0, &nameW, 0, 0, FALSE, &device );
+    if(status)
+    {
+        return status;
+        FIXME( "failed to create device error %x\n", status );
+    }
+    status = IoCreateSymbolicLink( &linkW, &nameW );
+    if(status)
+    {
+        FIXME( "failed to create symlink error %x\n", status );
+        return status;
+    }
+
+    return status;
+}
diff --git a/dlls/parallel.sys/parallel.sys.spec b/dlls/parallel.sys/parallel.sys.spec
new file mode 100644
index 0000000..76421d7
--- /dev/null
+++ b/dlls/parallel.sys/parallel.sys.spec
@@ -0,0 +1 @@
+# nothing to export
-- 
1.5.4.3


--=-WPhiq6H5L3WIc9yzlttD--




More information about the wine-patches mailing list