Ndis 5.1 Intermediate Driver Help

Hi,

I am Souvik from Kolkata, India. Currently I am developing a NDIS 5.1 Inetermediate driver.
I have two question in this regard -

  1. I like to run my Intermediate driver for a specific adapter. Let me be clear at this
    point that I have adopted the INF file from the passthru sample that comes with DDK. And
    My code is also an extension of passthru.

I have tried to do that by calling “NdisOpenAdapter” from “PtBindAdapter” function (in Passthru
sample) only for the specific adapter - I was skipping this call for all other adapter installed
in the system But in that case the other adapter can not connect to the network when I install
my driver. Please help me to resolve this issue - it should be be done in run time, not during
installation of driver.

  1. I would like to make a copy of a packet, received from the Protocol layer and to resend it
    to the miniport layer. In fact I like to send the same packet repeatedly. I have been succeeded
    to copy the packet - at least dump of the packets say so. But when I call “NdisSend” with the newly formed packet the system crashes. I tried to send the Packet from my function which gets called from “PtSendPackets” routine In that case which conditions I have to taken care of? Can you please suggest me the way out.

Thanks in advance.

Regards,
Souvik

On May 19, 2007, at 11:36 PM, Souvik Ghosh wrote:

Hi,

I am Souvik from Kolkata, India. Currently I am developing a NDIS
5.1 Inetermediate driver.
I have two question in this regard -

  1. I like to run my Intermediate driver for a specific adapter. Let
    me be clear at this
    point that I have adopted the INF file from the passthru sample
    that comes with DDK. And
    My code is also an extension of passthru.

I have tried to do that by calling “NdisOpenAdapter” from
“PtBindAdapter” function (in Passthru
sample) only for the specific adapter - I was skipping this call
for all other adapter installed
in the system But in that case the other adapter can not connect to
the network when I install
my driver. Please help me to resolve this issue - it should be be
done in run time, not during
installation of driver.

You need more complex logic to do what you suggest than simply not
calling NdisOpenAdapter; that (as you observed) breaks the biding
path. You need to do the code equivalent of “unchecking” the IM
driver in the interface components list on its property page. The
INetCfg documentation in the DDK should help you. It’s a little
cumbersome to work with, but it’s the right way to do this.

Just out of curiosity, how did you figure out why adapters to call
NdisOpenAdapter() on in your current solution? If you have a reliable
way of making that decision, you could just as easily let the IM bind
over all of your adapters and simply go into “pass-through” mode,
with no special logic, in those cases. Should be easy to do.

  1. I would like to make a copy of a packet, received from the
    Protocol layer and to resend it
    to the miniport layer. In fact I like to send the same packet
    repeatedly. I have been succeeded
    to copy the packet - at least dump of the packets say so. But when
    I call “NdisSend” with the newly formed packet the system crashes.
    I tried to send the Packet from my function which gets called from
    “PtSendPackets” routine In that case which conditions I have to
    taken care of? Can you please suggest me the way out.

There are a number of mistakes that people make in handling packets
in IM drivers. I’d recommend Thomas Divine’s excellent resources on
ndis.com and pcausa.com, as well as the DDK’s documentation and
samples. It’s hard to say precisely what bug you’ve coded without
seeing the crash, but regardless, it’d be better for you to
internalize the packet management mechanics for yourself and then fix
your own bug. This is a hard topic for new IM driver developers, and
you’re going to have to master it eventually if you want to be
successful maintaining one.

-Steve

>I have tried to do that by calling “NdisOpenAdapter” from “PtBindAdapter”

function (in Passthru
sample) only for the specific adapter - I was skipping this call for all other
adapter installed
in the system But in that case the other adapter can not connect to the network
when I install
my driver. Please help me to resolve this issue - it should be be done in run
time, not during
installation of driver.

  1. I would like to make a copy of a packet, received from the Protocol layer
    and to resend it
    to the miniport layer. In fact I like to send the same packet repeatedly. I
    have been succeeded
    to copy the packet - at least dump of the packets say so. But when I call
    “NdisSend” with the newly formed packet the system crashes. I tried to send the
    Packet from my function which gets called from “PtSendPackets” routine In that
    case which conditions I have to taken care of? Can you please suggest me the
    way out.

Thanks in advance.

Regards,
Souvik

>I have tried to do that by calling “NdisOpenAdapter” from “PtBindAdapter”

function (in Passthru
sample) only for the specific adapter

You must filter at installation time (INetCfg and the notify object), not at
bind time. At bind time, it is already too late.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Souvik Ghosh
Sent: Sunday, May 20, 2007 12:37 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Ndis 5.1 Intermediate Driver Help

Hi,

I am Souvik from Kolkata, India. Currently I am developing a NDIS 5.1
Inetermediate driver.
I have two question in this regard -

  1. I like to run my Intermediate driver for a specific adapter. Let me be
    clear at this
    point that I have adopted the INF file from the passthru sample that comes
    with DDK. And
    My code is also an extension of passthru.

[PCAUSA] See the sample code on http://www.wd-3.com in the three-part
article “Extending the Passthru NDIS Intermediate Driver Sample”. That
sample uses a companion user-mode application and illustrates a technique
that allows the application to query the IM driver for a list of adapters
that it is bound to. Then the application (based on user input.) can open a
handle on a specific adapter and “run” on only that adapter even if it is,
in fact, bound to multiple adapters.

A typical end-user machine may have multiple adapters.

Before writing any code to control the bindings you need to think about the
logic that you would use to programmatically control the bindings - not the
code. Can you write a simple set of “rules” for selecting the right adapter?
Probably not. In many cases only the user really knows the purpose of each
adapter on his or her host.

So, it is likely (almost certain.) that the user would have to get involved
in the binding selection process.

The simplest way is to tell the user to use the Network Control Panel to
uncheck the unwanted adapters. If you could develop a “rule” for selecting
the binding, then you could adapt the DDK BindView sample application to
uncheck unwanted bindings.

If the adapter of interest is actually identified by a unique Vendor
ID/Product ID, then you could control the binding process using a NDIS
Notify Object.

Good luck,

Thomas F. Divine

I have tried to do that by calling “NdisOpenAdapter” from “PtBindAdapter”
function (in Passthru
sample) only for the specific adapter - I was skipping this call for all
other adapter installed
in the system But in that case the other adapter can not connect to the
network when I install
my driver. Please help me to resolve this issue - it should be be done in
run time, not during
installation of driver.

  1. I would like to make a copy of a packet, received from the Protocol layer
    and to resend it
    to the miniport layer. In fact I like to send the same packet repeatedly. I
    have been succeeded
    to copy the packet - at least dump of the packets say so. But when I call
    “NdisSend” with the newly formed packet the system crashes. I tried to send
    the Packet from my function which gets called from “PtSendPackets” routine
    In that case which conditions I have to taken care of? Can you please
    suggest me the way out.

Thanks in advance.

Regards,
Souvik


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer