Smart card reader filter driver

Hello all,
I should monitoring IRPs to smart card readers and developed
upper filter driver for class , using the same way as Mark Russinovich for
monitoring keyboard requests in the driver Ctrl2Cap (www.systeminternals.com).

I ser UpperFilter under registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{50DD5230-BA8A-11D1-BF5D-0000F805F530}

It’s work OK and I get result of IRP in IoComplete routine .
But unfortunately in this case IoComplete routine returned DeviceObject =0, and I can not recognize device sending IoCompleteReguest,
I supposed get DeviceObject of low driver performed IoCompleteReguest .
Thanks for help
Mark

If DeviceObject == NULL in your completion routine, this typically means
that you are the driver which allocated (typeically with using
IoAllocateIrp ) the irp which was sent to the device. In this case, it
is by design that DeviceObject is NULL and that you need to store any
information you need in the Context.

If this is an irp that arrived in your driver in your dispatch routine
and you just forwarded it down to the smart card reader, make sure you
are calling IoCopyCurrentIrpStackLocationToNext before calling
IoSetCompletionRoutine and IoCallDriver.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Shnaider
Sent: Monday, March 07, 2005 8:52 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Smart card reader filter driver

Hello all,
I should monitoring IRPs to smart card readers and developed
upper filter driver for class , using the same way as Mark Russinovich
for
monitoring keyboard requests in the driver Ctrl2Cap
(www.systeminternals.com).

I ser UpperFilter under registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{50DD5230-BA8A
-11D1-BF5D-0000F805F530}

It’s work OK and I get result of IRP in IoComplete routine .
But unfortunately in this case IoComplete routine returned
DeviceObject =0, and I can not recognize device sending
IoCompleteReguest,
I supposed get DeviceObject of low driver performed IoCompleteReguest
.
Thanks for help
Mark


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hello Doron,
Thank you very much,
I use IoCopyCurrentIrpStackLocationToNex instead IoSkipCurrentIrpStackLocation,
and IoComplete routine get now right DeviceObject.
Mark

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]On Behalf Of Doron Holan
Sent: Monday, March 07, 2005 10:08 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Smart card reader filter driver

If DeviceObject == NULL in your completion routine, this typically means
that you are the driver which allocated (typeically with using
IoAllocateIrp ) the irp which was sent to the device. In this case, it
is by design that DeviceObject is NULL and that you need to store any
information you need in the Context.

If this is an irp that arrived in your driver in your dispatch routine
and you just forwarded it down to the smart card reader, make sure you
are calling IoCopyCurrentIrpStackLocationToNext before calling
IoSetCompletionRoutine and IoCallDriver.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Shnaider
Sent: Monday, March 07, 2005 8:52 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Smart card reader filter driver

Hello all,
I should monitoring IRPs to smart card readers and developed
upper filter driver for class , using the same way as Mark Russinovich
for
monitoring keyboard requests in the driver Ctrl2Cap
(www.systeminternals.com).

I ser UpperFilter under registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{50DD5230-BA8A
-11D1-BF5D-0000F805F530}

It’s work OK and I get result of IRP in IoComplete routine .
But unfortunately in this case IoComplete routine returned
DeviceObject =0, and I can not recognize device sending
IoCompleteReguest,
I supposed get DeviceObject of low driver performed IoCompleteReguest
.
Thanks for help
Mark


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

>I supposed get DeviceObject of low driver performed IoCompleteReguest .

No. The DeviceObject parameter of the completion routine is either NULL or
your device object, not the lower one.

If you need this parameter to be non-NULL - call IoAllocateIrp with + 1 stack
size, then do:

IoGetNextIrpStackLocation(Irp)->DeviceObject = OurDeviceObject;
IoSetNextIrpStackLocation(Irp);

  • and only then continue to fill the IRP.

The parameter is also non-NULL for the IRPs you received from the up in
dispatch routine and passed them down.

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