I wrote a storage filter and making direct writes to disk. (Actually the IRP should be passed to PargMgr) Everything works good in Windows Server 2003.
Though things are changed in Windows Server 2008, with the SL_FORCE_DIRECT_WRITE flag, my filter still work at most cases. But I found a strange issue. When the disk is in offline state the direct writes to disk return STATUS_SUCCESS but actually writes NOTHING to the disk! It really surprise me.
Anybody has idea on it? Thank you for your time.
Note: Sometimes the return value is a strange number (e.g. 123751000) rather than STATUS_SUCCESS.
Does this surprise you because you expected the data to be written successfully to an offline disk? I’d have been surprised by that result.
The strange value suggests that perhaps something isn’t being initialized. Have you tried seeding a known value into Irp->IoStatus.Status and checking to see if that value gets changed by the layers below?
> Does this surprise you because you expected the data to be written successfully
> to an offline disk? I’d have been surprised by that result.
Yes. I would expected the data to be written successfully to the offline disk. The data could exactly be written to disk when I directly pass the IRP to the disk DeviceObject (an instance of disk.sys). It seems to me the partmgr is doing some tricks.
>The strange value suggests that perhaps something isn’t being initialized. Have
>you tried seeding a known value into Irp->IoStatus.Status and checking to see if
>that value gets changed by the layers below?
Exactly! I just tried and confirmed that. The value is not changed by the below layer. Thanks.
That would mean my filter have to initial the Irp->IoStatus.Status to STATUS_UNSUCCESSFUL or something similar before passing the IRP down to the below layer.
But the question is how do I know the reason why IoCallDriver is not successful? How to get the error code/status? IoCallDriver return STATUS_PENDING, the filter waits for the event and done, and the Irp->IoStatus.Status is not changed by the below layer. It seems there is no way to get the error code/status?