CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Angry IoCalldriver returns 0xC000010(NAS_ STATUS_INVALID_DEVICE_REQUEST)

    Hi, all,
    I' m trying to write a WLAN driver for USB interface.
    When I called IoCalldriver to deliver a URB to USB bus, it returns 0xC0000010.
    Can anyone help me? Thanks !
    Below is the part of source generated by DriverStudio 3.2.

    ///////////////////////////////////////////////////////////////////////////////////////////////////
    // usbwifiFindHardware
    // initializes hardware resources
    //
    // Arguments:
    // IN Adapter
    // our adapter object
    //
    // IN WrapperConfigurationContext
    // NDIS configuration context
    //
    // Return Value:
    // Status
    //
    NDIS_STATUS usbwifiFindHardware(
    IN PUSBWIFI_ADAPTER Adapter,
    IN NDIS_HANDLE WrapperConfigurationContext
    )
    {
    NDIS_STATUS status;
    PURB urb;
    PUSB_DEVICE_DESCRIPTOR deviceDescriptor;
    PUSB_CONFIGURATION_DESCRIPTOR configDescriptor;
    USHORT size;
    PUSBD_INTERFACE_LIST_ENTRY interfaceBuffer;
    PUSBD_INTERFACE_LIST_ENTRY interfaceList;
    UCHAR numInterfaces;
    UCHAR index;
    PUSB_INTERFACE_DESCRIPTOR interfaceDescriptor;
    PUSBD_INTERFACE_INFORMATION interfaceInfo;
    PUSB_ENDPOINT_DESCRIPTOR epDescriptor;

    usbwifiDebugPrint(DBG_PNP, DBG_TRACE, __FUNCTION__"++");

    // get device objects
    Adapter->LowerDeviceObject = NULL;


    NdisMGetDeviceProperty(
    Adapter->AdapterHandle,
    &Adapter->PhysicalDeviceObject,
    &Adapter->DeviceObject,
    &Adapter->LowerDeviceObject,
    NULL,
    NULL
    );

    // we will use do{}while(FALSE); structure
    // to help with resource cleanup
    urb = NULL;
    deviceDescriptor = NULL;
    configDescriptor = NULL;
    interfaceBuffer = NULL;

    do
    {
    // we need to allocate an URB to talk
    // to usb bus driver
    urb = (PURB)ExAllocatePoolWithTag(
    NonPagedPool,
    sizeof(URB),
    USBWIFI_POOL_TAG
    );

    if (urb == NULL)
    {
    status = STATUS_INSUFFICIENT_RESOURCES;
    break;
    }

    // first let's read device descriptor
    deviceDescriptor = (PUSB_DEVICE_DESCRIPTOR)ExAllocatePoolWithTag(
    NonPagedPool,
    sizeof(USB_DEVICE_DESCRIPTOR),
    USBWIFI_POOL_TAG
    );
    if (deviceDescriptor == NULL)
    {
    status = STATUS_INSUFFICIENT_RESOURCES;
    break;
    }

    UsbBuildGetDescriptorRequest(
    urb,
    (USHORT)sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST),
    USB_DEVICE_DESCRIPTOR_TYPE,
    0,
    0,
    deviceDescriptor,
    NULL,
    sizeof(USB_DEVICE_DESCRIPTOR),
    NULL
    );

    status = usbwifiSubmitUrbSynch(Adapter, urb);
    if (!NT_SUCCESS(status))
    {
    break;
    }
    .......
    and the usbwifiSubmitUrbSynch function is:


    ///////////////////////////////////////////////////////////////////////////////////////////////////
    // usbwifiSubmitUrbSynch
    // method to synchronously submit an urb to the bus driver.
    //
    // Arguments:
    // IN Adapter
    // our adapter object
    //
    // IN Urb
    // URB to submit
    //
    // Return Value:
    // NT status code.
    //
    NTSTATUS usbwifiSubmitUrbSynch(
    IN PUSBWIFI_ADAPTER Adapter,
    IN PURB Urb
    )
    {
    NTSTATUS status;
    PIRP irp;
    IO_STATUS_BLOCK ioStatus;
    KEVENT event;
    PIO_STACK_LOCATION irpStack;

    usbwifiDebugPrint(DBG_IO, DBG_INFO, __FUNCTION__"++");

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    irp = IoBuildDeviceIoControlRequest(
    IOCTL_INTERNAL_USB_SUBMIT_URB,
    Adapter->LowerDeviceObject,
    NULL,
    0,
    NULL,
    0,
    TRUE,
    &event,
    &ioStatus
    );

    if (irp != NULL)
    {
    irpStack = IoGetNextIrpStackLocation(irp);
    irpStack->Parameters.Others.Argument1 = Urb;

    status = IoCallDriver(Adapter->LowerDeviceObject, irp);
    if (status == STATUS_PENDING)
    {
    KeWaitForSingleObject(
    &event,
    Executive,
    KernelMode,
    FALSE,
    NULL
    );

    status = ioStatus.Status;
    }
    }
    else
    {
    status = STATUS_INSUFFICIENT_RESOURCES;
    }

    usbwifiDebugPrint(DBG_IO, DBG_INFO, __FUNCTION__"--. STATUS %x", status);

    return status;
    }

    Best Regards!

  2. #2

    Re: IoCalldriver returns 0xC000010(NAS_ STATUS_INVALID_DEVICE_REQUEST)

    Hello,

    Is the URB structure filled in with appropriate values before the call to ioCallDriver?

    Peter

  3. #3
    Join Date
    Jun 2009
    Posts
    4

    Re: IoCalldriver returns 0xC000010(NAS_ STATUS_INVALID_DEVICE_REQUEST)

    Quote Originally Posted by PeterBritton View Post
    Hello,

    Is the URB structure filled in with appropriate values before the call to ioCallDriver?

    Peter
    hello, Peter
    I used UsbBuildGetDescriptorRequest MACRO to fill URB structure like below, is there any problem?
    UsbBuildGetDescriptorRequest(
    urb,
    (USHORT)sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST),
    USB_DEVICE_DESCRIPTOR_TYPE,
    0,
    0,
    deviceDescriptor,
    NULL,
    sizeof(USB_DEVICE_DESCRIPTOR),
    NULL
    );

  4. #4
    Join Date
    Jun 2009
    Posts
    4

    Re: IoCalldriver returns 0xC000010(NAS_ STATUS_INVALID_DEVICE_REQUEST)

    should I add a IOCTL_INTERNAL_USB_SUBMIT_URB handle? I saw some USB drivers added it, but all of them are not network driver.

  5. #5

    Re: IoCalldriver returns 0xC000010(NAS_ STATUS_INVALID_DEVICE_REQUEST)

    Hello,

    Does the other driver being called with the URB support "IRP_MJ_INTERNAL_DEVICE_CONTROL"?

    Peter

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured