Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NDIS - USB IoCallDriver returns 0xC000000E - Device does not exist while configuring USB - Regd.

88 views
Skip to first unread message

sudheer

unread,
Aug 3, 2007, 9:49:06 AM8/3/07
to
Hi

I am trying to modify the NDISWDM driver code to adapt for an USB
device.

I followed the steps as mentioned \3790.1830\src\network\ndis\ndiswdm
\ndiswdm.htm for adaptation of the driver for an USB device.

It has been mentioned to Configure the USB device in
NICInitAdapterWorker right before allocating Send and Receive
Resources.

The following snippet of code describes the configuration of the
device:

NTSTATUS
USBDSendAndWait ( IN PDEVICE_OBJECT fdo, IN PURB Urb)
{
KEVENT event;
PIRP irp;
PIO_STACK_LOCATION irpSp;
PDEVICE_EXTENSION pdx;
NTSTATUS ntStatus, status = STATUS_SUCCESS;

pdx = fdo->DeviceExtension;

KeInitializeEvent(&event, NotificationEvent, FALSE);

irp = IoAllocateIrp( fdo->StackSize, FALSE );

if (NULL == irp)
{
KPrint(("IoAllocateIrp failed\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}

irpSp = IoGetNextIrpStackLocation( irp );
irpSp->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;

irpSp->Parameters.DeviceIoControl.OutputBufferLength = 0;
irpSp->Parameters.DeviceIoControl.InputBufferLength = 0;
irpSp->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_SUBMIT_URB;
irpSp->FileObject = NULL;
irpSp->DeviceObject = fdo;
irp->MdlAddress = NULL;
irp->AssociatedIrp.SystemBuffer = NULL;
irpSp->Parameters.Others.Argument1 = Urb;

IoSetCompletionRoutine(irp, (PIO_COMPLETION_ROUTINE)
OnRequestComplete,
(PVOID) &event, TRUE, TRUE, TRUE);

ntStatus = IoCallDriver(fdo, irp);

KPrint (("return from IoCallDriver USBD %x\n", ntStatus));

if (ntStatus == STATUS_PENDING)
{
KPrint (("Wait for single object\n"));

status = KeWaitForSingleObject(&event,
Executive,
KernelMode,
FALSE, // Not alertable
NULL);
KPrint (("Wait for single object, returned %x\n", status));
status = irp->IoStatus.Status;
}

return ntStatus;

}


In the above function, the IoCallDriver always returns 0xC000000E
(Device does not exist). I have seen in one of the discussions of
Walter Oney mentioned the configuration of the device as follows:

1. Allocate memory for URB
2. Call IoAllocateIrp to create the IRP. I recommend asking for
an extra stack location here.
3. Initialize 1st stack location with your own device object address.
Fill in the Parameters fields with the address of your URB plus
whatever context pointer you need in order to keep track of the
operation NDIS is asking you to perform.
3. Initialize 2d stack location with IRP_MJ_INTERNAL_DEVICE_CONTROL,
IOCTL_INTERNAL_USB_SUBMIT_URB, and the URB address. The easiest
way to do this is to call IoSetNextIrpStackLocation after step
2, then call IoGetNextIrpStackLocation.
4. Install a completion routine.
5. Call IoCallDriver. Return whatever it returns.
6. In your completion routine, do whatever is required to indicate
the result of the operation to NDIS. Call IoFreeIrp to delete
the IRP and ExFreePool to release the URB. Return
STATUS_MORE_PROCESSING_REQUIRED.


I think the above snippet almost followed, please let me know if any
thing i am missing.

Again the above snippet is also followed as a Synchronous IRP using
IoBuildDeviceIoControlRequest for building IRP, even then the result
is same (0xC000000E)

Please let me know if any modifications required in the code.

Thanks in advance
Regards
Sudheer

Vishal Manan [MSFT]

unread,
Aug 3, 2007, 4:34:08 PM8/3/07
to
You should use KMDF for NDIS WDM drivers. There is an ndis-wdf sample for
realtek wifi USB device which shows how can use KMDF for a USB device. It is
in the Server 2008
beta WDK. Download the WDK from http://connect.microsoft.com/ site.

Vishal

--
This posting is provided "AS IS" with no warranties, and confers no
rights.
http://www.microsoft.com/whdc/driver/wdf/default.mspx

"sudheer" <sudheer...@gmail.com> wrote in message
news:1186148946....@e16g2000pri.googlegroups.com...

sudheer

unread,
Aug 4, 2007, 2:37:29 AM8/4/07
to
Hi Vishal

Thanks very much for your reply. But, can you please tell me why can't
use NDIS WDM in DDK.
MS encouraging using of KMDF by developers is the only reason or is
there any technical difficulties in developing drivers in DDK or any
other reason.
I think as far as KMDF is concerned, its a wrapper on WDM model
encapsulating some of the code to be done by developers. Correct me if
i am wrong.

please let me know if my query is a relevant one or ignore it.

Anyways, i will try to download WDK and will start working on WDK from
now on as i understood that MS will no more support DDK driver
development.

Thanks & Regards
Sudheer


On Aug 4, 1:34 am, "Vishal Manan [MSFT]"


<vish...@online.microsoft.com> wrote:
> You should use KMDF for NDIS WDM drivers. There is an ndis-wdf sample for
> realtek wifi USB device which shows how can use KMDF for a USB device. It is
> in the Server 2008
> beta WDK. Download the WDK fromhttp://connect.microsoft.com/site.
>
> Vishal
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.http://www.microsoft.com/whdc/driver/wdf/default.mspx
>

> "sudheer" <sudheer.papo...@gmail.com> wrote in message

> > Sudheer- Hide quoted text -
>
> - Show quoted text -


Thomas F. Divine

unread,
Aug 4, 2007, 1:50:33 PM8/4/07
to
Vishal,

I believe you are saying the using the KMDF would be better and easier for a
newbie, but are not saying that "legacy" NT-style (aka "WDM") are no longer
supported.

Based on my experience I would agree that using WDF is to be strongly
encouraged, but is not a "requirement".

Please clarify for the OP's benefit. If he is already familiar with WDM
drivers I think he can proceed with that model. Right?

Thomas F. Divine

"Vishal Manan [MSFT]" <vis...@online.microsoft.com> wrote in message
news:%23FdOl2g...@TK2MSFTNGP04.phx.gbl...

Eliyas Yakub [MSFT]

unread,
Aug 5, 2007, 3:44:45 PM8/5/07
to
NDIS miniports that interface with USB stack should be written using KMDF.
AFAIK, it's a WHQL requirement now. By using USB IoTarget and
ContinuousReader interface of KMDF, you can write a much more simple and
robust ndis miniport driver. The realtek sample for wifi USB device in the
Server2003 WDK is a good sample to base your driver. This sample is derived
from ndisedge sample.

-Eliyas


sudheer

unread,
Aug 13, 2007, 1:33:54 AM8/13/07
to
Hi Guys

Thanks very much for your support.

Now i am using NdisEdge sample with USB stack attached to it.
The device has at present 2 endpoints (Bulk) for read and write.
The read and write request of the device is failing with NTSTATUS
error code as C0000010 - STATUS_INVALID_DEVICE_REQUEST.
Can you please tell me what would be the underlying request that the
device is sending when calling NICPostReadRequest from NDIS Driver. Is
the request is same as that of Bulk_Read request of BulkUsb? Which
endpoints are used for sending this requests.

Thanks & Regards
Sudheer


On Aug 6, 12:44 am, "Eliyas Yakub [MSFT]"
<eliy...@online.discussion.microsoft.com> wrote:
> NDISminiports that interface withUSBstack should be written using KMDF.
> AFAIK, it's a WHQL requirement now. By usingUSBIoTarget and


> ContinuousReader interface of KMDF, you can write a much more simple and

> robustndisminiport driver. The realtek sample for wifiUSBdevice in the

sudheer

unread,
Aug 15, 2007, 1:41:07 AM8/15/07
to
Hi Eliyas

I have looked in to usbnwifi sample and compiled that sample for XP
x86 processor, but it is giving warning as the sample is invalid for
the specified OS and also i am not working on 802.11 and dont want any
hardware code to be present.

I just want to read the IP Packets from my USB device and pump the
same to Ndis layer for further processing.

As the development time is very less, I thought of modifying ndisedge
sample.

I dont think any change is required in ndisedge sample expect the
configuration of the device (i.e., in ndiswdm.h and Inf file).
(correct me if i am wrong) and I would like to know where the USB
device should be registered (like the registering the usb device in
sample usbnwifi in hardware initialize) in NICInitAdapterWorker.

Can you please let me know the steps to attach USB stack to ndisedge
sample.

Eliyas Yakub [MSFT]

unread,
Aug 15, 2007, 11:14:30 AM8/15/07
to
The usbnwifi is an NDIS6.0 driver. It will not work on XP. Everything you
need is in these two samples. You just have to understand how they work and
transfer the code from one to the other. You have to do this part yourself.
I don't have any ready made sample for you. Since you are planning to write
an NDIS 5.0 driver, take the 5.0 version of NDISEDGE driver and move all the
code that is required to interface with USB stack from the usbnwifi sample
to this one and customize it to your hardware. The hardware interaction
piece is already separated out nicely in its own module in the wifi sample.
So transferring this code should be easy. Remember both ndis 5.0 and 6.0
models are conceptually similar when it comes to initialization, cleanup. So
for every callback in usbwifi sample, find out what the corresponding
callback is in ndis 5.0 and then transfer the code. This article might help
in understanding the differences between these two models.

http://www.microsoft.com/whdc/device/network/NDIS/NDIS6drvport.mspx

-Eliyas


sudheer

unread,
Aug 16, 2007, 1:05:30 AM8/16/07
to Eliyas Yakub [MSFT]
Hi Eliyas

Thanks for your kind support.

I have already started doing that part of transferring USB code to
NDISEDGE sample (of version NDIS 5.1) and replacing NDIS 6.0 APIs with
NDIS 5.1 that is supported for windows XP. The link provided by you is
very helpful.

Thanks once again and will be back with a new issue (if any) ;)

Thanks & Regards
Sudheer

On Aug 15, 8:14 pm, "Eliyas Yakub [MSFT]"

0 new messages