Interacting with NDIS IM driver.

Hi all,

Does anybody know how the user-mode application will interact with the NDIS
IM driver ?
Bryan suggested for NdisMRegisterDevice and PtDispatch.
According to DDK, NdisMRegisterDevice is used for creating the named device
which the user application can open just like other driver models.
But how to make the request to this driver ? something like DeviceIoControl
?
PtDispatch is not available in DDK or protocol.c (the probable destination).

Amit Manocha

See inline comments.

-Srin.

-----Original Message-----
From: Amit Manocha [mailto:xxxxx@mynetsec.com]
Sent: Friday, May 09, 2003 10:09 PM
To: NT Developers Interest List
Subject: [ntdev] Interacting with NDIS IM driver.

Hi all,

Does anybody know how the user-mode application will interact with the
NDIS
IM driver ?
Bryan suggested for NdisMRegisterDevice and PtDispatch.
According to DDK, NdisMRegisterDevice is used for creating the named
device
which the user application can open just like other driver models.
But how to make the request to this driver ? something like
DeviceIoControl
?
Srin: Yes, you are right. You need to use DeviceIoControl and send
IOCTLs to the IM.

PtDispatch is not available in DDK or protocol.c (the probable
destination).
PtDispatch is in passthru.c file Line number 310 referring
Windows DDK(2600.1106).

Thanks Srin,

Which part of passthru sample will be handling these IOCTLs ?
Is it PtDispatch ? Actually I have older version of DDK, so can’t see the
code of PtDispatch.

Amit

----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Saturday, May 10, 2003 12:19 PM
Subject: [ntdev] RE: Interacting with NDIS IM driver.

> See inline comments.
>
> -Srin.
>
> > -----Original Message-----
> > From: Amit Manocha [mailto:xxxxx@mynetsec.com]
> > Sent: Friday, May 09, 2003 10:09 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Interacting with NDIS IM driver.
> >
> > Hi all,
> >
> > Does anybody know how the user-mode application will interact with the
> NDIS
> > IM driver ?
> > Bryan suggested for NdisMRegisterDevice and PtDispatch.
> > According to DDK, NdisMRegisterDevice is used for creating the named
> device
> > which the user application can open just like other driver models.
> > But how to make the request to this driver ? something like
> DeviceIoControl
> > ?
> Srin: Yes, you are right. You need to use DeviceIoControl and send
> IOCTLs to the IM.
>
> > PtDispatch is not available in DDK or protocol.c (the probable
> destination).
> PtDispatch is in passthru.c file Line number 310 referring
> Windows DDK(2600.1106).
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@mynetsec.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

> Does anybody know how the user-mode application will interact with
the NDIS

IM driver ?
Bryan suggested for NdisMRegisterDevice and PtDispatch.

I expect WMI to be by far better and less issue-rich then
NdisMRegisterDevice.

Max

Hi Amit,
        See in-lines.

Good Luck,


From: “Amit Manocha”

>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] Interacting with NDIS IM driver.
>Date: Sat, 10 May 2003 10:38:48 +0530
>
>Hi all,
>
>Does anybody know how the user-mode application will interact with the NDIS


>IM driver ?



[Yogi] There are various ways by which u can do that. Tell me what is ur application of doin that?



>Bryan suggested for NdisMRegisterDevice and PtDispatch.
>According to DDK, NdisMRegisterDevice is used for creating the named device
>which the user application can open just like other driver models.
>But how to make the request to this driver ? something like DeviceIoControl


>?



[Yogi] This is the best suggestion to access a network device. But again depends on ur requirement.



>PtDispatch is not available in DDK or protocol.c (the probable destination).
>
>Amit Manocha
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com


IIFA Awards. Vote now. Celebrate Indian cinema.

> Which part of passthru sample will be handling these IOCTLs ?

Is it PtDispatch ? Actually I have older version of DDK, so can’t see
the
code of PtDispatch.
[Kumar, Srin] Yes. It is PtDispatch. PtDispatch function in passthru.c
is a generalized dispatch function which handles required MAJOR FUNCTION
codes. you need to add code to handle any specific details. I am copying
the function here for your reference.

NTSTATUS
PtDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
/*++
Routine Description:

Process IRPs sent to this device.

Arguments:

DeviceObject - pointer to a device object
Irp - pointer to an I/O Request Packet

Return Value:

NTSTATUS - STATUS_SUCCESS always - change this when adding
real code to handle ioctls.

–*/
{
PIO_STACK_LOCATION irpStack;
NTSTATUS status = STATUS_SUCCESS;

DBGPRINT((“==>Pt Dispatch\n”));
irpStack = IoGetCurrentIrpStackLocation(Irp);

switch (irpStack->MajorFunction)
{
case IRP_MJ_CREATE:
break;
case IRP_MJ_CLOSE:
break;
case IRP_MJ_DEVICE_CONTROL:
//
// Add code here to handle ioctl commands sent
to passthru.
//
break;
default:
break;
}

Irp->IoStatus.Status = status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);

DBGPRINT((“<== Pt Dispatch\n”));

return status;

}

[Kumar, Srin] -Srin