[MOUCLASS] Only set the device interface state if we have an interface name

This commit is contained in:
Eric Kohl 2025-05-04 17:28:37 +02:00
parent 5414600e1e
commit 9638666d84

View file

@ -840,7 +840,8 @@ ClassPnp(
}
else
DeviceExtension->FileHandle = NULL;
IoSetDeviceInterfaceState(&DeviceExtension->InterfaceName, TRUE);
if (DeviceExtension->InterfaceName.Length != 0)
IoSetDeviceInterfaceState(&DeviceExtension->InterfaceName, TRUE);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
@ -855,7 +856,8 @@ ClassPnp(
break;
case IRP_MN_REMOVE_DEVICE:
IoSetDeviceInterfaceState(&DeviceExtension->InterfaceName, FALSE);
if (DeviceExtension->InterfaceName.Length != 0)
IoSetDeviceInterfaceState(&DeviceExtension->InterfaceName, FALSE);
if (DeviceExtension->FileHandle)
{
ZwClose(DeviceExtension->FileHandle);