USBIP IRP_MJ_CREATE
2023-10-23
52
0
上层应用通过CreateFile打开驱动时,只有一种情况是需要失败的,那就是当前设备已经被标识为移除,表示驱动已经卸载。
static PAGEABLE NTSTATUS
vhci_create(__in PDEVICE_OBJECT devobj, __in PIRP Irp)
{
pvdev_t vdev = DEVOBJ_TO_VDEV(devobj);
PAGED_CODE();
DBGI(DBG_GENERAL, "vhci_create(%s): Enter\n", dbg_vdev_type(vdev->type));
// Check to see whether the bus is removed
if (vdev->DevicePnPState == Deleted) {
DBGW(DBG_GENERAL, "vhci_create(%s): no such device\n", dbg_vdev_type(vdev->type));
Irp->IoStatus.Status = STATUS_NO_SUCH_DEVICE;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NO_SUCH_DEVICE;
}
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
DBGI(DBG_GENERAL, "vhci_create(%s): Leave\n", dbg_vdev_type(vdev->type));
return STATUS_SUCCESS;
}
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936