Re: How to support same multiple card in NDIS WDM MiniPort driver? by Thomas
Thomas
Tue Dec 16 09:01:42 CST 2003
You are right. NDISUIO/NDISPROT does not call NdisMRegisterDevice. Instead,
it calls IoCreateDevice and IoCreateSymbolicLink (Which you cannot use).
(Very) loosely speaking, NdisMRegisterDevice can be thought of as a wrapper
function that calls IoCreateDevice and IoCreateSymbolicLink for you and does
othe rNDIS operations.
After either call you have a symbolic link established for your driver. One
name, and multiple devices. The problem after that point is the same for
your driver (uisng NdisMRegiserDveice) and NDISUIO/NDISPROT (using
IoCreateDevice and IoCreateSymbolicLink).
Thomas F. Divine
www.rawether.net
"lonely" <rescuer@21cn.com> wrote in message
news:ugXbGh6wDHA.2328@TK2MSFTNGP10.phx.gbl...
> Thanks, But I can't find call to NdisMRegisterDevice in NDISUIO sample's
> code,
> DDK's document wrote:
> NDIS_STATUS
> NdisMRegisterDevice(
> IN NDIS_HANDLE NdisWrapperHandle,
> IN PNDIS_STRING DeviceName,
> IN PNDIS_STRING SymbolicName,
> IN PDRIVER_DISPATCH MajorFunctions[],
> OUT PDEVICE_OBJECT *pDeviceObject,
> OUT NDIS_HANDLE *NdisDeviceHandle
> );
> Parameters
> NdisWrapperHandle
> Specifies the handle returned by NdisMInitializeWrapper.
>
> I think 1 miniport driver only has 1 NdisWrapperHandle, is it right? So
> How can I distinguish 2 or more NICs ? because pDeviceObject is output
> parameter, How can I make pDeviceObject relationship with our NIC?
> Thanks
>
>
> "Thomas F. Divine" <tdivine@NOpcausaSPAM.com> wrote in message
> news:#lkBY#xwDHA.536@tk2msftngp13.phx.gbl...
> > Although the DDK NDISPROT (Was NDISUIO) sample is not a NDIS-WDM driver,
> it
> > does illustrate how to open a handle to a specific device on a driver
that
> > has multiple NDIS devices and uses only one call to NdisMRegisterDevice.
> >
> > Hope this helps,
> >
> > Thomas F. Divine
> > www.pcausa.com
> >
> > "lonely" <rescuer@21cn.com> wrote in message
> > news:Ozjy$LuwDHA.2712@TK2MSFTNGP11.phx.gbl...
> > > Thank you very much, Don. I understanding what you meaning.
> > > I use NdisMRegisterDevice, so at User Application mode, I use
> > CreateFile
> > > to open my NICs, and I can get total number of my NICs through my
> IOCTLs.
> > > According the DDK document, it seems that NdisMRegisterDevice can only
> be
> > > called once, so I can only give one DeviceName and SymbolicName to All
> my
> > > same NICs, so my IOCTLS with NdisMRegisterDevice registered is for All
> my
> > > NICs. I must sepecify each NIC with a IOCTL's paramter, that's NIC
> index,
> > or
> > > other. I want to know if we have other better method to specify NIC,
not
> > > through IOCTL parameter.
> > > Thanks again
> > >
> > > "Don Burn" <burn@stopspam.acm.org> wrote in message
> > > news:vtoso8kr9cksdd@corp.supernews.com...
> > > > Look at NdisMSetAttributes or NdisMSetAttributesEx, this allows you
to
> > set
> > > a
> > > > context pointer that is unique for each NIC. This context pointer
> comes
> > > in
> > > > to the Miniport on calls to it, and will allow you to get at private
> > data.
> > > > Build a table or linked list of the areas pointed to by the context
> > > pointer,
> > > > and you IOCTL's can walk the data and find the correct NIC.
> > > >
> > > >
> > > > --
> > > > Don Burn (MVP, Windows DDK)
> > > > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > > > Remove StopSpam from the email to reply
> > > >
> > > > "lonely" <rescuer@21cn.com> wrote in message
> > > > news:uszvFGfwDHA.2048@TK2MSFTNGP10.phx.gbl...
> > > > > Thank you very much, Don. Because I must control every NIC
> through
> > > > > IOCTL, so
> > > > > I must distinguish every NIC. I use NdisMRegisterDevice to get a
> > device
> > > > > object, but How can I distinguish different NIC ? Thanks in
advance.
> > > > >
> > > > > "Don Burn" <burn@stopspam.acm.org> wrote in message
> > > > > news:vtm4t8p6anm28a@corp.supernews.com...
> > > > > > If you have coded thing's correctly this should work
> automatically.
> > > > Your
> > > > > > MiniportInitialize function will be called for each NIC.
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Don Burn (MVP, Windows DDK)
> > > > > > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > > > > > Remove StopSpam from the email to reply
> > > > > >
> > > > > > "lonely" <rescuer@21cn.com> wrote in message
> > > > > > news:e5yc9rSwDHA.2712@tk2msftngp13.phx.gbl...
> > > > > > > Dear sirs,
> > > > > > > I has written a NDIS WDM MiniPort driver, but encounted a
> > > problem,
> > > > > > that
> > > > > > > is
> > > > > > > How can I support 2 or more same cards in my NDIS_WDM driver?
> > > > > > > I can do this in WDM driver through AddDevice function,
> > > > > > > But How can do that in NDIS driver ? how to create diffient
> > > Miniport?
> > > > > > > Thanks in advance.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>