mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
In case of error, free the input data buffer only if we just allocated it.
svn path=/trunk/; revision=23052
This commit is contained in:
parent
19ff9cb593
commit
d0bbf9199b
2 changed files with 38 additions and 6 deletions
|
@ -126,7 +126,7 @@ ClassDeviceControl(
|
|||
PLIST_ENTRY Head = &((PCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ListHead;
|
||||
if (Head->Flink != Head)
|
||||
{
|
||||
/* We have at least one keyboard */
|
||||
/* We have at least one device */
|
||||
PPORT_DEVICE_EXTENSION DevExt = CONTAINING_RECORD(Head->Flink, PORT_DEVICE_EXTENSION, ListEntry);
|
||||
IoGetCurrentIrpStackLocation(Irp)->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
|
@ -553,6 +553,9 @@ ConnectPortDriver(
|
|||
CONNECT_DATA ConnectData;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Connecting PortDO %p [%wZ] to ClassDO %p\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName, ClassDO);
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
|
||||
ConnectData.ClassDeviceObject = ClassDO;
|
||||
|
@ -590,6 +593,18 @@ ConnectPortDriver(
|
|||
return IoStatus.Status;
|
||||
}
|
||||
|
||||
/* Send IOCTL_INTERNAL_*_DISCONNECT to port */
|
||||
static NTSTATUS
|
||||
DisconnectPortDriver(
|
||||
IN PDEVICE_OBJECT PortDO)
|
||||
{
|
||||
DPRINT("Disconnecting PortDO %p [%wZ]\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName);
|
||||
|
||||
DPRINT1("FIXME: Need to send IOCTL_INTERNAL_*_DISCONNECT\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
ClassAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
|
@ -686,16 +701,17 @@ ClassAddDevice(
|
|||
|
||||
cleanup:
|
||||
if (!(Fdo->Flags & DO_DEVICE_INITIALIZING))
|
||||
DPRINT1("FIXME: Need to send IOCTL_INTERNAL_*_DISCONNECT\n");
|
||||
DisconnectPortDriver(Fdo);
|
||||
if (DeviceExtension)
|
||||
{
|
||||
if (DeviceExtension->LowerDevice)
|
||||
IoDetachDevice(DeviceExtension->LowerDevice);
|
||||
if (DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
|
||||
if (!DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
|
||||
{
|
||||
PCLASS_DEVICE_EXTENSION ClassDeviceExtension;
|
||||
ClassDeviceExtension = (PCLASS_DEVICE_EXTENSION)DeviceExtension->ClassDO->DeviceExtension;
|
||||
ExFreePool(ClassDeviceExtension->PortData);
|
||||
IoDeleteDevice(DeviceExtension->ClassDO);
|
||||
}
|
||||
}
|
||||
if (Fdo)
|
||||
|
|
|
@ -123,7 +123,7 @@ ClassDeviceControl(
|
|||
PLIST_ENTRY Head = &((PCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ListHead;
|
||||
if (Head->Flink != Head)
|
||||
{
|
||||
/* We have at least one mouse */
|
||||
/* We have at least one device */
|
||||
PPORT_DEVICE_EXTENSION DevExt = CONTAINING_RECORD(Head->Flink, PORT_DEVICE_EXTENSION, ListEntry);
|
||||
IoGetCurrentIrpStackLocation(Irp)->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
|
@ -529,6 +529,9 @@ ConnectPortDriver(
|
|||
CONNECT_DATA ConnectData;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Connecting PortDO %p [%wZ] to ClassDO %p\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName, ClassDO);
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
|
||||
ConnectData.ClassDeviceObject = ClassDO;
|
||||
|
@ -566,6 +569,18 @@ ConnectPortDriver(
|
|||
return IoStatus.Status;
|
||||
}
|
||||
|
||||
/* Send IOCTL_INTERNAL_*_DISCONNECT to port */
|
||||
static NTSTATUS
|
||||
DisconnectPortDriver(
|
||||
IN PDEVICE_OBJECT PortDO)
|
||||
{
|
||||
DPRINT("Disconnecting PortDO %p [%wZ]\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName);
|
||||
|
||||
DPRINT1("FIXME: Need to send IOCTL_INTERNAL_*_DISCONNECT\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
ClassAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
|
@ -662,16 +677,17 @@ ClassAddDevice(
|
|||
|
||||
cleanup:
|
||||
if (!(Fdo->Flags & DO_DEVICE_INITIALIZING))
|
||||
DPRINT1("FIXME: Need to send IOCTL_INTERNAL_*_DISCONNECT\n");
|
||||
DisconnectPortDriver(Fdo);
|
||||
if (DeviceExtension)
|
||||
{
|
||||
if (DeviceExtension->LowerDevice)
|
||||
IoDetachDevice(DeviceExtension->LowerDevice);
|
||||
if (DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
|
||||
if (!DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
|
||||
{
|
||||
PCLASS_DEVICE_EXTENSION ClassDeviceExtension;
|
||||
ClassDeviceExtension = (PCLASS_DEVICE_EXTENSION)DeviceExtension->ClassDO->DeviceExtension;
|
||||
ExFreePool(ClassDeviceExtension->PortData);
|
||||
IoDeleteDevice(DeviceExtension->ClassDO);
|
||||
}
|
||||
}
|
||||
if (Fdo)
|
||||
|
|
Loading…
Reference in a new issue