[Wine-patches] [17/23] usbhub.sys: Use __wine_{add,start}_device.
Alexander Morozov
=?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Пн Янв 19 18:25:08 MSK 2009
For eterhack branch
----------- следующая часть -----------
From 486737f6ce2c77990bfe4407265a4a7eff741cd9 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Thu, 15 Jan 2009 12:51:14 +0300
Subject: [PATCH] usbhub.sys: Use __wine_{add,start}_device.
---
dlls/usbhub.sys/usbhub.c | 60 +++------------------------------------------
1 files changed, 4 insertions(+), 56 deletions(-)
diff --git a/dlls/usbhub.sys/usbhub.c b/dlls/usbhub.sys/usbhub.c
index 33992c4..479fa07 100644
--- a/dlls/usbhub.sys/usbhub.c
+++ b/dlls/usbhub.sys/usbhub.c
@@ -45,10 +45,11 @@
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(usbhub);
-WINE_DECLARE_DEBUG_CHANNEL(relay);
+extern NTSTATUS CDECL __wine_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *dev );
extern void CDECL wine_complete_request( IRP *irp, UCHAR priority_boost );
extern DRIVER_OBJECT * CDECL __wine_get_driver_object( const WCHAR *service );
+extern NTSTATUS CDECL __wine_start_device( DRIVER_OBJECT *driver );
static unsigned int last_pdo_num;
@@ -377,59 +378,6 @@ static DEVICE_OBJECT *create_pdo( struct DeviceInstance *inst, DRIVER_OBJECT *hu
return usbdev;
}
-static NTSTATUS add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *dev )
-{
- NTSTATUS status;
- NTSTATUS (WINAPI *AddDevice)( PDRIVER_OBJECT, PDEVICE_OBJECT ) =
- driver->DriverExtension->AddDevice;
-
- if (TRACE_ON(relay))
- DPRINTF( "%04x:Call AddDevice %p (%p,%p)\n",
- GetCurrentThreadId(), AddDevice, driver, dev );
-
- status = AddDevice( driver, dev );
-
- if (TRACE_ON(relay))
- DPRINTF( "%04x:Ret AddDevice %p (%p,%p) retval=%08x\n",
- GetCurrentThreadId(), AddDevice, driver, dev, status );
-
- return status;
-}
-
-static void start_device( DRIVER_OBJECT *driver )
-{
- PDRIVER_DISPATCH dispatch = driver->MajorFunction[IRP_MJ_PNP];
- DEVICE_OBJECT *device = driver->DeviceObject;
- IO_STACK_LOCATION *irpsp;
- PIRP irp;
- NTSTATUS status;
-
- if (dispatch == NULL) return;
- irp = IoAllocateIrp( device->StackSize, FALSE );
- if (irp == NULL) return;
-
- --irp->CurrentLocation;
- irpsp = --irp->Tail.Overlay.s.u.CurrentStackLocation;
- irp->RequestorMode = KernelMode;
- irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
- irpsp->MajorFunction = IRP_MJ_PNP;
- irpsp->MinorFunction = IRP_MN_START_DEVICE;
- irpsp->DeviceObject = device;
- device->CurrentIrp = irp;
-
- if (TRACE_ON(relay))
- DPRINTF( "%04x:Call driver dispatch %p (device=%p,irp=%p)\n",
- GetCurrentThreadId(), dispatch, device, irp );
-
- status = dispatch( device, irp );
-
- if (TRACE_ON(relay))
- DPRINTF( "%04x:Ret driver dispatch %p (device=%p,irp=%p) retval=%08x\n",
- GetCurrentThreadId(), dispatch, device, irp, status );
-
- IoFreeIrp( irp );
-}
-
static BOOL enum_reg_usb_devices(void)
{
static const WCHAR usb[] = {'U','S','B',0};
@@ -564,9 +512,9 @@ static DWORD CALLBACK enum_usb_devices( void *usbhubdrv )
while (!(driver = __wine_get_driver_object(
instance->service )))
Sleep( 100 );
- status = add_device( driver, pdo );
+ status = __wine_add_device( driver, pdo );
if (status != STATUS_SUCCESS) break;
- start_device( driver );
+ __wine_start_device( driver );
}
break;
}
--
1.6.0.2.GIT
Подробная информация о списке рассылки Wine-patches