NTSTATUS IsoUsb_QueryCapabilities( IN PDEVICE_OBJECT PdoDeviceObject, IN PIRP Irp ) /*++ Routine Description: This routine generates an internal IRP from this driver to the PDO to obtain information on the Physical Device Object's capabilities. We are most interested in learning which system power states are to be mapped to which device power states for honoring IRP_MJ_SET_POWER Irps. This is a blocking call which waits for the IRP completion routine to set an event on finishing. Arguments: DeviceObject - Physical DeviceObject for this USB controller. Return Value: NTSTATUS value from the IoCallDriver() call. --*/ { PDEVICE_CAPABILITIES DeviceCapabilities = IrpStack->Parameters.DeviceCapabilities.Capabilities; NTSTATUS ntStatus; KEVENT event; // This is a DDK-defined DBG-only macro that ASSERTS we are not running pageable code // at higher than APC_LEVEL. PAGED_CODE(); // Stack für den nächsten Treiber vorbereiten IoCopyCurrentIrpStackLocationToNext(Irp); // init an event to tell us when the completion routine's been called KeInitializeEvent(&event, NotificationEvent, FALSE); // Set a completion routine so it can signal our event when // the next lower driver is done with the Irp IoSetCompletionRoutine(irp, IsoUsb_IrpCompletionRoutine, &event, // pass the event as Context to completion routine TRUE, // invoke on success TRUE, // invoke on error TRUE); // invoke on cancellation of the Irp ntStatus = IoCallDriver(PdoDeviceObject, irp); ISOUSB_KdPrint( DBGLVL_MEDIUM,(" IsoUsb_QueryCapabilities() ntStatus from IoCallDriver to PCI = 0x%x\n", ntStatus)); if (ntStatus == STATUS_PENDING) { // wait for irp to complete KeWaitForSingleObject( &event, Suspended, KernelMode, FALSE, NULL); // ****************** // ntStatus setzen!!! // ****************** ntStatus = Irp->IoStatus.Status; // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } DeviceCapabilities->Removable=TRUE; //VON MIR EINGEFÜGT!!!******** DeviceCapabilities->SurpriseRemovalOK=TRUE; // failed? this is probably a bug ISOUSB_KdPrintCond( DBGLVL_DEFAULT,(!NT_SUCCESS(ntStatus)), ("IsoUsb_QueryCapabilities() failed\n")); return ntStatus; }