[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 638
  • Last Modified:

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

0
mwright012397
Asked:
mwright012397
  • 3
  • 2
1 Solution
 
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
 
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now