Solved

NDIS driver - packet communication

Posted on 1998-01-20
5
629 Views
Last Modified: 2013-12-03
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

0
Comment
Question by:mwright012397
  • 3
  • 2
5 Comments
 

Author Comment

by:mwright012397
Comment Utility
Adjusted points to 190
0
 
LVL 4

Accepted Solution

by:
tflai earned 190 total points
Comment Utility
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
 

Author Comment

by:mwright012397
Comment Utility
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
 

Author Comment

by:mwright012397
Comment Utility
SOmeone else (on UseNet) suggested that I use NdisRequest instead. I seem to be getting further using that approach at the moment.


0
 
LVL 4

Expert Comment

by:tflai
Comment Utility
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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now