NDIS driver - packet communication

I have an NDIS driver that I have written that also has an intermediate(?) level driver that functions like the "packet" driver in the DDK.

I now need to send on IOCTL from this driver to the NDIS driver (to perform a control function). I have tried just calling IoBuildDeviceIoControlRequest and then calling IoCall Driver. I get a blue screen after the IoCall Driver.
The error points to a reference to address 0x10 at IRQL 2.

I am assuming that there is something else that I must do when setting up the IRP.

Can anyone point me in the right direction ?

I am unclear about the handling of stack locations in an IRP - is there something there that I should be doing.

BTW I am expecting the NDIS driver to handle this IOCTL as an "OID", is that correct.

All help appreciated - Mike Wright

mwright012397Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mwright012397Author Commented:
Adjusted points to 190
0
tflaiCommented:
It seems to me that you are calling IoBuildDeviceIoControlRequest in IRQL higher than PASSIVE_LEVEL.  By default, NDIS will call almost all of your driver's dispatch functions (xxxSend, xxxTransferData, xxxRequest, ...) in IRQL DISPATCH_LEVEL.  Only DriverEntry and xxxUnload runs in IRQL PASSIVE_LEVEL.  What you need is to create worker threads in DriverEntry to do those tasks for you.  Using PsCreateSystemThread, you can create threads that runs in PASSIVE_LEVEL.
Also, before you sends the IRP to the lower driver with an IoCallDriver, make sure that you set the completion routine if you want one, and IoGetNextStackLocation to fill out the next I/O stack location structure.
Most of all, look carefully at DDK's help file and sample codes, and you should be able to find more helps.  And good luck debugging...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mwright012397Author Commented:
It is the bit about IoGetNextStackLocation that I am unsure about. Can you point me at a good description of what I need to do with the stack location. How do I set up the stack so that the lower level driver sees the request as an OID ?

Or must I set this up as a DEVICE_CONTROL type and add the handler to my lower level driver ?
0
mwright012397Author Commented:
SOmeone else (on UseNet) suggested that I use NdisRequest instead. I seem to be getting further using that approach at the moment.


0
tflaiCommented:
Oh!  If only passing OIDs is needed, use NdisRequest instead.  The other way is pretty complicated, you should do that if there are no other way to interface the lower driver.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.