[Wine-patches] [eterhack 01/12] parport.sys: Add partial implementation of IRP_MJ_PNP handler.

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Чт Май 21 17:53:37 MSD 2009


---
 dlls/parport.sys/parport.c |   45 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/dlls/parport.sys/parport.c b/dlls/parport.sys/parport.c
index 73fb306..20d1b3d 100644
--- a/dlls/parport.sys/parport.c
+++ b/dlls/parport.sys/parport.c
@@ -128,6 +128,50 @@ static NTSTATUS WINAPI parport_ioctl( DEVICE_OBJECT *device, IRP *irp )
     return status;
 }
 
+static NTSTATUS WINAPI parport_pnp( DEVICE_OBJECT *device, IRP *irp )
+{
+    static const WCHAR device_idW[] = {'A','C','P','I','\\',
+                                       'P','N','P','0','4','0','0',0};
+
+    IO_STACK_LOCATION *irpsp = irp->Tail.Overlay.s.u.CurrentStackLocation;
+    NTSTATUS status;
+
+    TRACE( "%p, %p\n", device, irp );
+
+    switch (irpsp->MinorFunction)
+    {
+    case IRP_MN_QUERY_ID:
+        switch (irpsp->Parameters.QueryId.IdType)
+        {
+        case BusQueryDeviceID:
+        {
+            WCHAR *device_id = ExAllocatePool( PagedPool, sizeof(device_idW) );
+
+            if (device_id == NULL)
+            {
+                status = STATUS_INSUFFICIENT_RESOURCES;
+                break;
+            }
+            strcpyW( device_id, device_idW );
+            status = STATUS_SUCCESS;
+            irp->IoStatus.Information = (ULONG_PTR)device_id;
+            break;
+        }
+        default:
+            FIXME( "IRP_MN_QUERY_ID: IdType %u is not implemented\n",
+                    irpsp->Parameters.QueryId.IdType );
+            status = STATUS_NOT_IMPLEMENTED;
+        }
+        break;
+    default:
+        FIXME( "function %08x is not implemented\n", irpsp->MinorFunction );
+        status = STATUS_NOT_IMPLEMENTED;
+    }
+    irp->IoStatus.u.Status = status;
+    IoCompleteRequest( irp, IO_NO_INCREMENT );
+    return STATUS_SUCCESS;
+}
+
 static void create_parport_device( DRIVER_OBJECT *driver, int n, struct parport *pp )
 {
     static const WCHAR parallel_portW[] = {'\\','D','e','v','i','c','e',
@@ -252,6 +296,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
     driver->DriverUnload = parport_unload;
 #ifdef HAVE_LIBIEEE1284
     driver->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = parport_ioctl;
+    driver->MajorFunction[IRP_MJ_PNP] = parport_pnp;
     parport_driver = driver;
     enum_par_devices( driver );
 #endif
-- 
1.6.2.5



Подробная информация о списке рассылки Wine-patches