DeviceExtension and filter drivers

I am using the following extremely common code at the start of the
FastIoDeviceControl routine in my filter driver:

myFastIoDeviceControl( … )
{
if (DeviceObject != myDevice)
{
extension = DeviceObject->DeviceExtension;
fastio =
extension->FilteredDeviceObject->DriverObject->FastIoDispatch;
if (fastio != NULL)
{
… call down routine via fastio …
}
}

The problem is that there doesn’t seem to be any guaranty that this is my
device with my device extension. Upon rare occaisions it appears to be not my
device extension at all. I would think everyone should be checking for a
valid device extension, but no sample code I can find is doing that. I must
be missing something. Any idea what might be happening? I checked my code
and I am always creating a device with a valid extension.

Thanks for any tips.

Neil


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You should add an addition check:

if (DeviceObject->DriverObject != MyDriverObject)

This will make sure that you own the device object.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Neil Weicher
Sent: Thursday, May 03, 2001 7:43 PM
To: File Systems Developers
Subject: [ntfsd] DeviceExtension and filter drivers

I am using the following extremely common code at the start of the
FastIoDeviceControl routine in my filter driver:

myFastIoDeviceControl( … )
{
if (DeviceObject != myDevice)
{
extension = DeviceObject->DeviceExtension;
fastio =
extension->FilteredDeviceObject->DriverObject->FastIoDispatch;
if (fastio != NULL)
{
… call down routine via fastio …
}
}

The problem is that there doesn’t seem to be any guaranty that this is my
device with my device extension. Upon rare occaisions it appears
to be not my
device extension at all. I would think everyone should be checking for a
valid device extension, but no sample code I can find is doing
that. I must
be missing something. Any idea what might be happening? I
checked my code
and I am always creating a device with a valid extension.

Thanks for any tips.

Neil


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com