I observed that the internal protocol of IoCancelFileOpen() changed by WXP
SP2.
In older versions IoCancelFileOpen() sends IRP_MJ_CLEANUP and IRP_MJ_CLOSE.
In WXP SP2 IoCancelFileOpen() sends only IRP_MJ_CLEANUP.
If the reference count of the file object is reduced to zero
IRP_MJ_CLOSE is sent by IoManager.(I Think.)
This changes the flow of IRP_MJ_CREAT and IRP_MJ_CLOSE that a filter driver
sees.
ex.
In older versions
Create -> Filter driver —(Create)-----> Filesystem
STATUS_SUCESS <---------------
IoCancelFileOpen --(CleanUp)–>
–(Close)---->
<- STATUS_ACCESS_DENIED(Filtrer driver generates)
In WXP SP2
Create -> Filter driver —(Create)-----> Filesystem
STATUS_SUCESS <---------------
IoCancelFileOpen --(CleanUp)–>
<- STATUS_ACCESS_DENIED(Filter driver generates)
Close —> ----->
My first question is:
Is this change a well-known fact? Is this a fix of something or new
feature?
I also observed the case Creates and Closes don’t balance in WXP SP2.
If a filter driver fails Create after sending down it and cancel it
by IoCancelFileOpen() in case of file deletion.
ex.
(explorer SHIFT+DEL)
Create -> Filter driver --(Create)------> Filesystem
STATUS_SUCCESS <--------------
IoCancelFileOpen --(CleanUp)–>
<- STATUS_ACCESS_DENIED
Close -> Filter Driver --(Close)------->
<- STATUS_SUCCESS ----------------
Create -> Filter driver --(Create)------> Filesystem
(Retry) STATUS_SUCCESS <--------------
IoCancelFileOpen --(CleanUp)–>
<- STATUS_ACCESS_DENIED
Close -> Filter Driver --(Close)------->
<- STATUS_SUCCESS ----------------
Create -> Filter driver --(Create)------> Filesystem
(Retry) STATUS_SUCCESS <--------------
IoCancelFileOpen --(CleanUp)–>
<- STATUS_ACCESS_DENIED
An external symptom of this is:
If the target of Create is a file in the removable media
you can’t safely remove the device because of the lost Close.
But you can open the file after it because CleanUp has been finished.
My second question is:
Is this a bug of IoManager or something known?
Does someone have the same experience?
If it is a bug one obvious workaround of this is to replace
IoCancelFileOpen()
by sending CleanUp and Close by myself as if old versions.
But I wonder if there is a better solution.
Ichiro Akimoto