Which Sample i should Consider for My reference for creating virtual network adaptor

Hi All,
I have been assigned the task to create a virtual network adaopter that is supposed to take the actual data from another driver eg usb and make a packet based on the data that i will get from usb driver and send it that will be read by user mode application by using socket or so on.

i am thinking to use the NDIS Virtual Miniport Driver as refernce for my work .

i want to know weather my decision of using the NDIS Virtual Miniport Driver for my work is right or not if yes then If there is any other thing according to you expert people that i should know apart from whatever has been given in the ddk sample and documentation please guide me what should be that and from where i can that.

if my decision of using the above mention example is wrong then which example is best fit for my requirment and from where i can get the help in this regard.

Regards


Tried the new MSN Messenger? It?s cool! Download now.
http://messenger.msn.com/Download/Default.aspx?mkt=en-in

nayan Kumar wrote:

I have been assigned the task to create a virtual network adaopter
that is supposed to take the actual data from another driver eg usb
and make a packet based on the data that i will get from usb driver
and send it that will be read by user mode application by using socket
or so on.

I would actually use the NDISEDGE sample, especially if your lower edge is USB.

nayan kumar wrote:

I have been assigned the task to create a virtual network
adaopter that is supposed to take the actual data from another driver
eg usb and make a packet based on the data that i will get from usb
driver and send it that will be read by user mode application by using
socket or so on.

You are committing an extremely common sin here. Rather than tell us
what your overall goal is, you have focused in on one possible
implementation of a goal, and asked how to implement that, even though
it is very likely not the best plan. What kind of a USB device is it?
What kind of application will be using it? Is this an application that
already exists? What makes you think socket access is the best mechanism?

The reason sockets were created is to allow network connections to be
treated like files. If you want your application to read like a file,
then you should make the driver look like a file, not like a socket.

Where do all these strange requirements come from? Has the concept of a
design review with experienced engineers become a thing of the past?

if my decision of using the above mention example is wrong then which
example is best fit for my requirment and from where i can get the
help in this regard.

We can’t possibly answer this question, because you haven’t told us the
requirement. You’ve only told us your opinion of the right way to meet
your requirement.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I recently used netvmini as a base for an NDIS driver. I am certainly not an expert
at drivers, but I found it to be fine except for 2 things.

  1. There is an outright bug in the function NICIsPacketTransmittable.
    This code tests outgoing packet contents (addressing) to see if they are
    “legal”. One of the last tests is for directed packets and the code comments
    say that it is going to test whether the source MAC address is the same as what
    the driver has recorded as the MAC address of the (virtual) adapter (NIC). Unfortunately,
    the sample code compares the DESTINATION MAC address to the stored MAC
    address. For directed packets, these will never match, so this function ends up
    filtering out all directed packets.
    else if(Adapter->PacketFilter & NDIS_PACKET_TYPE_DIRECTED)
    {
    //
    // This has to be a directed packet. If so, does packet source
    // address match with the mac address of the NIC.
    //
    ETH_COMPARE_NETWORK_ADDRESSES_EQ(
    Address, (should be Address+6) <--------
    Adapter->CurrentAddress,

  2. The netvmini driver creates a list of installed netvmini adapters (driver instances).
    When it goes to send, it walks this list. You won’t really need the list of adapters, but
    it won’t really hurt anything either. It just adds a little bit of confusion.

----- Original Message ----
From: nayan kumar
To: Windows System Software Devs Interest List
Sent: Thursday, January 17, 2008 2:58:21 AM
Subject: [ntdev] Which Sample i should Consider for My reference for creating virtual network adaptor

.hmmessage P
{
margin:0px;padding:0px;}
body.hmmessage
{
FONT-SIZE:10pt;FONT-FAMILY:Tahoma;}

Hi All,

I have been assigned the task to create a virtual network adaopter that is supposed to take the actual data from another driver eg usb and make a packet based on the data that i will get from usb driver and send it that will be read by user mode application by using socket or so on.

i am thinking to use the NDIS Virtual Miniport Driver as refernce for my work .

i want to know weather my decision of using the NDIS Virtual Miniport Driver for my work is right or not if yes then If there is any other thing according to you expert people that i should know apart from whatever has been given in the ddk sample and documentation please guide me what should be that and from where i can that.

if my decision of using the above mention example is wrong then which example is best fit for my requirment and from where i can get the help in this regard.

Regards

Live the life in style with MSN Lifestyle. Check out! Try it now!



NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:

http://www.osr.com/seminars

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

____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Mike,

I think you are getting confused by the naming in the NETVMINI sample.

The code and usage of NICIsPacketTransmittable() is correct. It would make
more sense if the name of the function was

NICIsPacketRecievable() instead, however.

The function checks the DSTMAC to see if it matches the packet filter of the
‘receiving’ adapter, not the sending adapter.

NDIS does not ever expect a NIC to filter based on SRCMAC. Indeed, it
expect that whatever SRCMAC is placed in the packet will be sent onto the
wire.

But you are 100% correct that this is a very good sample to start with when
looking to create a ‘virtual’ Miniport, especially one that might ultimately
wish to push transmitted packets back up to usermode with an ‘inverted’ call
model.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mike Loving
Sent: Thursday, January 17, 2008 2:22 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Which Sample i should Consider for My reference for
creating virtual network adaptor

I recently used netvmini as a base for an NDIS driver. I am certainly not
an expert
at drivers, but I found it to be fine except for 2 things.

  1. There is an outright bug in the function NICIsPacketTransmittable.
    This code tests outgoing packet contents (addressing) to see if they are
    “legal”. One of the last tests is for directed packets and the code
    comments
    say that it is going to test whether the source MAC address is the same as
    what
    the driver has recorded as the MAC address of the (virtual) adapter (NIC).
    Unfortunately,
    the sample code compares the DESTINATION MAC address to the stored MAC
    address. For directed packets, these will never match, so this function
    ends up
    filtering out all directed packets.
    else if(Adapter->PacketFilter & NDIS_PACKET_TYPE_DIRECTED)
    {
    //
    // This has to be a directed packet. If so, does packet source
    // address match with the mac address of the NIC.
    //
    ETH_COMPARE_NETWORK_ADDRESSES_EQ(
    Address, (should be
    Address+6) <--------
    Adapter->CurrentAddress,

  2. The netvmini driver creates a list of installed netvmini adapters (driver
    instances).
    When it goes to send, it walks this list. You won’t really need the list of
    adapters, but
    it won’t really hurt anything either. It just adds a little bit of
    confusion.

----- Original Message ----
From: nayan kumar
To: Windows System Software Devs Interest List
Sent: Thursday, January 17, 2008 2:58:21 AM
Subject: [ntdev] Which Sample i should Consider for My reference for
creating virtual network adaptor

Hi All,
I have been assigned the task to create a virtual network adaopter
that is supposed to take the actual data from another driver eg usb and
make a packet based on the data that i will get from usb driver and send it
that will be read by user mode application by using socket or so on.

i am thinking to use the NDIS Virtual Miniport Driver as refernce for my
work .

i want to know weather my decision of using the NDIS Virtual Miniport Driver
for my work is right or not if yes then If there is any other thing
according to you expert people that i should know apart from whatever has
been given in the ddk sample and documentation please guide me what should
be that and from where i can that.

if my decision of using the above mention example is wrong then which
example is best fit for my requirment and from where i can get the help in
this regard.

Regards

Live the life in style with MSN Lifestyle. Check out! Try
http: it now!

NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

_____

Never miss a thing. Make Yahoo
http: your homepage.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Tim Roberts wrote:

Where do all these strange requirements come from? Has the concept of a
design review with experienced engineers become a thing of the past?

Yes, if only because experienced engineers have become a thing of the past themselves. Too expensive, they can get nayan Kumar to do it for 50% of the cost!

Just wait until he calls KeLowerIrql() while holding a spinlock so he can invoke a callback back to userspace code…

> Too expensive, they can get nayan Kumar to do it for 50% of the cost!

I am afraid in the end of the day his “work” will cost them at least 500% of the actual one…

Just wait until he calls KeLowerIrql() while holding a spinlock so he can invoke
a callback back to userspace code…

They will still have to pay him for investigating the above possibility. In a year or so they will
discover that the whole project is exactly at the same stage it used to be at a year ago - the only thing that has changed is the state of their balance sheet. A this point they will decide to hire an experienced engineer. Apparently, sooner or later they are going to learn all that the hard way…

Anton Bassov

wrote in message news:xxxxx@ntdev…
> I am afraid in the end of the day his “work” will cost them at least 500% of the actual one…

No it won’t. Surprise. Success of the “cheap revolution” shows
that only the value (=cost) and being first to the market decides; quality has lesser priority.

Regards,
–PA

> No it won’t. Surprise. Success of the “cheap revolution” shows that only the value (=cost)

and being first to the market decides; quality has lesser priority.

I am afraid you are speaking about a totally different thing…

Idiomatically, what happens here is that the OP’s clients decided to buy cheap toilet paper and are going to discover “the hard way” that, in actuality, they bought a sandpaper…

Anton Bassov

On Jan 18, 2008 3:15 AM, wrote:
> Idiomatically, what happens here is that the OP’s clients decided to buy
> cheap toilet paper and are going to discover “the hard way” that, in actuality,
> they bought a sandpaper…

Maybe I fail to understand what you are discussing, but if this is
about companies using the “cheapest” way to design Windows drivers…

This is nothing new. Creative Labs are responsible for releasing
sub-par drivers since the dawn of mankind. Their drivers are a public
joke, yet people (including myself, as late as 5 years ago :frowning: )
continue buying their products. Remember their NT4 and Win2k drivers?
They refused to support SMP configurations in any way.

Heck, even nVidia quietly dropped PAE support in ForceWare 8x.xx.
79.11 is the last version that can reliably be used with Windows 2003
Server. (too bad it does not support their latest GPUs) A colleague
wanted to re-install Vista, because the “darn thing kept freezing
while trying to play back video”. I told him to upgrade the nVidia
driver (to something newer than could be found on Dell’s site) and the
problem went away… (I had the same problem on my desktop at home, so
I wasn’t the least bit surprised that he experienced problems with
that particular driver revision)

My audio card (not Creative for once) triggered a BSOD the other day
(when trying to use EAX2 in a game). The support guys’ response was
that I should reseat the PCI card. I suggested that perhaps taking a
look at the memory dump might be prudent, but at that point they
dropped their end of the conversation and in the end it got dull
talking to myself. (the truth is probably that they no longer have
developers of their own, and don’t know how to get in touch with
C-Media who write the reference drivers)

To sum up: The bar is set low. You guys pride yourself in writing good
drivers, but most users just want flashy new hardware and are content
with drivers that will arrive “eventually” and work 90% of the time.
(but of course I hope all this will change ASAP)


Rune

I have no real opinion on this subject, but I like your analogy, Anton.
When I talk about cheapness, this is the one I use, along with cheap
trash bags that break. Even really cheap people usually respond to these.

mm

xxxxx@hotmail.com wrote:

> No it won’t. Surprise. Success of the “cheap revolution” shows that only the value (=cost)
> and being first to the market decides; quality has lesser priority.

I am afraid you are speaking about a totally different thing…

Idiomatically, what happens here is that the OP’s clients decided to buy cheap toilet paper and are going to discover “the hard way” that, in actuality, they bought a sandpaper…

Anton Bassov

Hi All,
I have to write a driver that will be used for Digital Video Bradcast For Handheld device .
For that usb driver has been wrote by some other person that will give me the actual data that will be source for me and then i have to make a packet of the source data send that packet so that user mode application can read the data .application has already been developed by some other person that is working for some other device which doing the similar work but that device is for trresterial use.

Regards

Date: Thu, 17 Jan 2008 09:38:41 -0800> From: xxxxx@probo.com> To: xxxxx@lists.osr.com> Subject: Re: [ntdev] Which Sample i should Consider for My reference for creating virtual network adaptor> > nayan kumar wrote:> >> > I have been assigned the task to create a virtual network > > adaopter that is supposed to take the actual data from another driver > > eg usb and make a packet based on the data that i will get from usb > > driver and send it that will be read by user mode application by using > > socket or so on.> > You are committing an extremely common sin here. Rather than tell us > what your overall goal is, you have focused in on one possible > implementation of a goal, and asked how to implement that, even though > it is very likely not the best plan. What kind of a USB device is it? > What kind of application will be using it? Is this an application that > already exists? What makes you think socket access is the best mechanism?> > The reason sockets were created is to allow network connections to be > treated like files. If you want your application to read like a file, > then you should make the driver look like a file, not like a socket.> > Where do all these strange requirements come from? Has the concept of a > design review with experienced engineers become a thing of the past?> > > > if my decision of using the above mention example is wrong then which > > example is best fit for my requirment and from where i can get the > > help in this regard.> > We can’t possibly answer this question, because you haven’t told us the > requirement. You’ve only told us your opinion of the right way to meet > your requirement.> > – > Tim Roberts, xxxxx@probo.com> Providenza & Boekelheide, Inc.> > > —> NTDEV is sponsored by OSR> > For our schedule of WDF, WDM, debugging and other seminars visit: > http://www.osr.com/seminars\> > To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Post free property ads on Yello Classifieds now! www.yello.in
http://ss1.richmedia.in/recurl.asp?pid=219

> I have to write a driver that will be used for Digital Video Bradcast For Handheld device .

First of all, write a client driver that reads to data from and writes it to the target device by means of IRPs, effectively getting familiar with kernel-level basic - you have to know about IRQL, DPC, paged vs unpaged memory, etc. Otherwise, you are, indeed, more than likely to start posting questions like the ones Chris mentioned.

When you are familiar with kernel basic, you can already add NDIS miniport interface to your driver, so that it can communicate with NDIS at its upper edge. Again, don’t limit yourself to NETVMINI sample - look at ndispot and understand what protocols do and how they interact with underlying adapters; look at filter sample and see how it presents itself as a miniport to underlying protocols. In other words, get familiar with NDIS.

To summarize, get ready a bit of learning - otherwise, you are just bound to flood the NG with numerous post like “I modify XYZ sample… my driver don’t work…please help”.

Anton Bassov

nayan Kumar wrote:

For that usb driver has been wrote by some other person that will
give me the actual data that will be source for me and then i have
to make a packet of the source data send that packet so that user
mode application can read the data .application has already been
developed by some other person that is working for some other
device which doing the similar work but that device is for trresterial use.

It sounds like you’re saying:

  1. the existing USB driver exposes some custom device interface to which a usermode application attaches and pulls data.

  2. your job is to open that same USB driver (from within kernel mode) and then fake an entire TCP/IP stack in your driver so people can read the data using sockets.

If so, that’s one of the dumbest ideas I’ve ever heard.

Hi soviet,
thanks for your help.
do u mean NDISProt 5.x- NDIS 5.x connection-less protocol driver sample

by saying

  • look at ndispot and understand what protocols do and how they interact with underlying adapters; look at filter sample and see how it presents itself as a miniport to underlying protocols. In other words, get familiar with NDIS.

I am sorry if u find this question awkward but i wanted to understand it clearly thats why i am asking this.

Regards


Post free property ads on Yello Classifieds now! www.yello.in
http://ss1.richmedia.in/recurl.asp?pid=220

> do u mean NDISProt 5.x- NDIS 5.x connection-less protocol driver sample

Please read my post again so that you will understand what I mean - I mean UNDERSTANDING
HOW NDIS WORKS!!! All WDK samples are nothing more than a reference that are meant to help you to understand NDIS, so that you should look carefully at them all. You should not model your driver on any existing sample until you understand what it does and *why* it does things this way. Otherwise, as I already said, you are bound to flood the NG with numerous “I modify XYZ sample… my driver don’t work…please help” -style posts…

Anton Bassov

anton bassov wrote:

> do u mean NDISProt 5.x- NDIS 5.x connection-less protocol driver
> sample

Please read my post again so that you will understand what I mean-
I mean UNDERSTANDING HOW NDIS WORKS!!

Don’t you get it? He doesn’t *want* to understand.

The point we are trying to make is that to do your job you need to study
more than just one example. Study every NDIS example you can find -
including samples that are not specifically NDIS miniports. Studying NDIS
protocol drivers will help you understand what the layer above your miniport
is doing. Other samples may illustrate techniques that you may find useful -
but weren’t actually illustrated in the one sample that you may choose to
dive into. The samples were written by several different people, and may
illustrate the same technique in different ways; perhaps you may find one
way more useful and understandable than others.

There are some on this list who are really skilful and to be admired who
would suggest that the best way to write any driver is not to start with a
sample driver at all! Instead, develop the driver from scratch to fit your
specific needs. Use the documentation as your guide instead of a sample.

Finally, before studying NDIS you should study the basics of designing,
developing, building and debugging Windows drivers. My apologies if you
already have this under your belt. Some folks who have never developed a
driver for Windows at all jump in immediately to the development of a
specialized driver (e.g., NDIS, file system, display.) without having any
understanding of the fundamentals.

Thomas F. Divine

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Friday, January 18, 2008 1:41 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Which Sample i should Consider for My reference for
creating virtual network adaptor

Hi soviet,
thanks for your help.
do u mean NDISProt 5.x- NDIS 5.x connection-less protocol driver sample

by saying

  • look at ndispot and understand what protocols do and how they interact
    with underlying adapters; look at filter sample and see how it presents
    itself as a miniport to underlying protocols. In other words, get familiar
    with NDIS.

I am sorry if u find this question awkward but i wanted to understand it
clearly thats why i am asking this.

Regards


Fly HYD-BLR for Rs.499 Log on to MakeMyTrip! Check it out!
http:

NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

> Don’t you get it? He doesn’t *want* to understand.

Probably, this is, indeed, the case. In actuality, don’t be too quick to blame him - probably, he has been given a very fixed time frame like “The driver must be ready by next Monday, no matter what.” . Now he can at least show our replies to his bosses, so that they will (hopefully) realize that they have assigned him an infeasible task (and if they read your post, they will also realize that, in addition to that, they whole thing in itself is just stupid from the technical standpoint)…

Anton Bassov

Thomas,

My apologies if you already have this under your belt

Very unlikely - otherwise, he would have formulated his questions differently. His post is very typical of someone who has been assigned a task that has to be accomplished “by next Monday”, despite having no clue about kernel-level development whatsoever…

Anton Bassov