A very strange behavior on complete routine

Hi,
I have a question and can not figure out what happen:
Is this possible that I did not set completion routine
but the completion routine still get a call finally?

In IRP_MJ_DIRECTORY_CONTROL, I set a completion
routine only for IRP_MN_QUERY_DIRECTORY. But the
completion routine is still called when
IRP_MN_NOTIFY_CHANGE_DIRECTORY finished. I can not
figure out how this happen.

When the completion routine called, IRP stack is as
this(As it indicates, device object is not valid, the
completion routine failed):

kd> !irp 89b88008
Irp is active with 11 stacks 11 is current(=
0x89b881e0)
No Mdl Thread 89d5b998: Irp stack trace. Pending has
been returned
cmd flg cl Device File Completion-Context
[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[c, 0] 0 0 8a6d8020 00000000 b59859b2-8a621708

\FileSystem\Ntfs FsFilter!FileDirectoryControl
Args: 00000000 00000000 00000000 00000000

[c, 2] 1 1 89cc4020 89ded250 00000000-00000000
pending
89cc4020: is not a device object
Args: 00000020 00000017 00000000 00000000

kd> !fileobj 89ded250
File object (89ded250) is for:\Documents and
Settings\All Users\Start Menu
Related File Object: 0x8a4a7850
Device Object: 0x8a707900 Vpb: 0x8a6f88d8
Access: Read SharedRead SharedWrite SharedDelete
Flags: 0x40000
Handle Created

File Object is currently not busy.
FsContext: 0xe197c568 FsContext2: 0xe197c700
CurrentByteOffset: 0

kd> !devobj 8a707900
Device object (8a707900) is for:
HarddiskVolume2 \Driver\Ftdisk DriverObject 8a756528
Current Irp 00000000 RefCount 3469 Type 00000007 Flags
00001150
Vpb 8a6f88d8 Dacl e100dd44 DevExt 8a7079b8 DevObjExt
8a707aa0 Dope 8a68b938 DevNode 8a70c1c8
ExtensionFlags (0000000000)
AttachedDevice (Upper) 8a742690 \Driver\VolSnap
Device queue is not busy.

kd> !vpb 8a6f88d8
Vpb at 0x8a6f88d8
Flags: 0x1 mounted
DeviceObject: 0x8a6d8020
RealDevice: 0x8a707900
RefCount: 3469
Volume Label:
kd> !devobj 8a6d8020
Device object (8a6d8020) is for:
\FileSystem\Ntfs DriverObject 8a746a58
Current Irp 00000000 RefCount 0 Type 00000008 Flags
00000000
DevExt 8a6d80d8 DevObjExt 8a6d8880
ExtensionFlags (0000000000)
AttachedDevice (Upper) 8a7036f0 \FileSystem\sr
Device queue is not busy.

It is your driver that sets the completion routine, so if your
completion routine is being called, you set it.

I did notice that the lower driver’s stack location reports a strange
value for the minor function (0 is not valid for directory control). So
I suspect there is a bug in your code that is doing more than just
setting the completion routine incorrectly…

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David Wu
Sent: Friday, July 01, 2005 10:54 AM
To: ntfsd redirect
Subject: [ntfsd] A very strange behavior on complete routine

Hi,
I have a question and can not figure out what happen:
Is this possible that I did not set completion routine
but the completion routine still get a call finally?

In IRP_MJ_DIRECTORY_CONTROL, I set a completion
routine only for IRP_MN_QUERY_DIRECTORY. But the
completion routine is still called when
IRP_MN_NOTIFY_CHANGE_DIRECTORY finished. I can not
figure out how this happen.

When the completion routine called, IRP stack is as
this(As it indicates, device object is not valid, the
completion routine failed):

kd> !irp 89b88008
Irp is active with 11 stacks 11 is current(=
0x89b881e0)
No Mdl Thread 89d5b998: Irp stack trace. Pending has
been returned
cmd flg cl Device File Completion-Context
[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[c, 0] 0 0 8a6d8020 00000000 b59859b2-8a621708

\FileSystem\Ntfs FsFilter!FileDirectoryControl
Args: 00000000 00000000 00000000 00000000

[c, 2] 1 1 89cc4020 89ded250 00000000-00000000
pending
89cc4020: is not a device object
Args: 00000020 00000017 00000000 00000000

kd> !fileobj 89ded250
File object (89ded250) is for:\Documents and
Settings\All Users\Start Menu
Related File Object: 0x8a4a7850
Device Object: 0x8a707900 Vpb: 0x8a6f88d8
Access: Read SharedRead SharedWrite SharedDelete
Flags: 0x40000
Handle Created

File Object is currently not busy.
FsContext: 0xe197c568 FsContext2: 0xe197c700
CurrentByteOffset: 0

kd> !devobj 8a707900
Device object (8a707900) is for:
HarddiskVolume2 \Driver\Ftdisk DriverObject 8a756528
Current Irp 00000000 RefCount 3469 Type 00000007 Flags
00001150
Vpb 8a6f88d8 Dacl e100dd44 DevExt 8a7079b8 DevObjExt
8a707aa0 Dope 8a68b938 DevNode 8a70c1c8
ExtensionFlags (0000000000)
AttachedDevice (Upper) 8a742690 \Driver\VolSnap
Device queue is not busy.

kd> !vpb 8a6f88d8
Vpb at 0x8a6f88d8
Flags: 0x1 mounted
DeviceObject: 0x8a6d8020
RealDevice: 0x8a707900
RefCount: 3469
Volume Label:
kd> !devobj 8a6d8020
Device object (8a6d8020) is for:
\FileSystem\Ntfs DriverObject 8a746a58
Current Irp 00000000 RefCount 0 Type 00000008 Flags
00000000
DevExt 8a6d80d8 DevObjExt 8a6d8880
ExtensionFlags (0000000000)
AttachedDevice (Upper) 8a7036f0 \FileSystem\sr
Device queue is not busy.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com