- Don't try to start an interface that wasn't registered

svn path=/trunk/; revision=53300
This commit is contained in:
Cameron Gutman 2011-08-18 17:13:38 +00:00
parent e1776e956d
commit 1a2aa7bc69

View file

@ -66,40 +66,42 @@ Bus_PDO_PnP (
} }
DeviceData->InterfaceName.Length = 0; DeviceData->InterfaceName.Length = 0;
status = STATUS_SUCCESS;
if (!device) if (!device)
{ {
IoRegisterDeviceInterface(DeviceData->Common.Self, status = IoRegisterDeviceInterface(DeviceData->Common.Self,
&GUID_DEVICE_SYS_BUTTON, &GUID_DEVICE_SYS_BUTTON,
NULL, NULL,
&DeviceData->InterfaceName); &DeviceData->InterfaceName);
} }
else if (device->flags.hardware_id && else if (device->flags.hardware_id &&
strstr(device->pnp.hardware_id, ACPI_THERMAL_HID)) strstr(device->pnp.hardware_id, ACPI_THERMAL_HID))
{ {
IoRegisterDeviceInterface(DeviceData->Common.Self, status = IoRegisterDeviceInterface(DeviceData->Common.Self,
&GUID_DEVICE_THERMAL_ZONE, &GUID_DEVICE_THERMAL_ZONE,
NULL, NULL,
&DeviceData->InterfaceName); &DeviceData->InterfaceName);
} }
else if (device->flags.hardware_id && else if (device->flags.hardware_id &&
strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID)) strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID))
{ {
IoRegisterDeviceInterface(DeviceData->Common.Self, status = IoRegisterDeviceInterface(DeviceData->Common.Self,
&GUID_DEVICE_LID, &GUID_DEVICE_LID,
NULL, NULL,
&DeviceData->InterfaceName); &DeviceData->InterfaceName);
} }
else if (device->flags.hardware_id && else if (device->flags.hardware_id &&
strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID)) strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID))
{ {
IoRegisterDeviceInterface(DeviceData->Common.Self, status = IoRegisterDeviceInterface(DeviceData->Common.Self,
&GUID_DEVICE_PROCESSOR, &GUID_DEVICE_PROCESSOR,
NULL, NULL,
&DeviceData->InterfaceName); &DeviceData->InterfaceName);
} }
if (DeviceData->InterfaceName.Length != 0) /* Failure to register an interface is not a fatal failure so don't return a failure status */
if (NT_SUCCESS(status) && DeviceData->InterfaceName.Length != 0)
IoSetDeviceInterfaceState(&DeviceData->InterfaceName, TRUE); IoSetDeviceInterfaceState(&DeviceData->InterfaceName, TRUE);
state.DeviceState = PowerDeviceD0; state.DeviceState = PowerDeviceD0;