Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 1793 of file buspdo.c.
{ IO_STATUS_BLOCK ioStatus; KEVENT pnpEvent; NTSTATUS status; PDEVICE_OBJECT targetObject; PIO_STACK_LOCATION irpStack; PIRP pnpIrp; PAGED_CODE(); // // Initialize the capabilities that we will send down // RtlZeroMemory( DeviceCapabilities, sizeof(DEVICE_CAPABILITIES) ); DeviceCapabilities->Size = sizeof(DEVICE_CAPABILITIES); DeviceCapabilities->Version = 1; DeviceCapabilities->Address = -1; DeviceCapabilities->UINumber = -1; // // Initialize the event // KeInitializeEvent( &pnpEvent, NotificationEvent, FALSE ); targetObject = IoGetAttachedDeviceReference( DeviceObject ); // // Build an Irp // pnpIrp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, targetObject, NULL, 0, NULL, &pnpEvent, &ioStatus ); if (pnpIrp == NULL) { status = STATUS_INSUFFICIENT_RESOURCES; goto GetDeviceCapabilitiesExit; } // // Pnp Irps all begin life as STATUS_NOT_SUPPORTED; // pnpIrp->IoStatus.Status = STATUS_NOT_SUPPORTED; // // Get the top of stack // irpStack = IoGetNextIrpStackLocation( pnpIrp ); // // Set the top of stack // RtlZeroMemory( irpStack, sizeof(IO_STACK_LOCATION ) ); irpStack->MajorFunction = IRP_MJ_PNP; irpStack->MinorFunction = IRP_MN_QUERY_CAPABILITIES; irpStack->Parameters.DeviceCapabilities.Capabilities = DeviceCapabilities; // // Call the driver // status = IoCallDriver( targetObject, pnpIrp ); if (status == STATUS_PENDING) { // // Block until the irp comes back. // Important thing to note here is when you allocate // the memory for an event in the stack you must do a // KernelMode wait instead of UserMode to prevent // the stack from getting paged out. // KeWaitForSingleObject( &pnpEvent, Executive, KernelMode, FALSE, NULL ); status = ioStatus.Status; } GetDeviceCapabilitiesExit: // // Done with reference // ObDereferenceObject( targetObject ); // // Done // return status; }