Hello,
I am writing a disk filter driver.
I want to block write requests in my DispatchWrite routine.
I am looking for a specified offset in the driver’s I/O stack location at Parameters.Write.ByteOffset and complete the IRP with an error status:
Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_ACCESS_DENIED;
The problem is that Windows is reporting the fallowing error when I try to copy a file to that partition:
Windows - Delayed Write Failed
Windows was unable to save all the data for the file x. The data has been lost… etc.
I want Windows to print some error like “Access Denied”, what status should I return from my DispatchWrite routine?
Why are you asking a question about a storage stack driver in the file
systems group? The answer is you can’t do what you are trying to do the way
you are trying to do it. The OS knows it has the rights to write to that
sector. Any error return will cause an error to occur.
wrote in message news:xxxxx@ntfsd…
> Hello,
>
> I am writing a disk filter driver.
> I want to block write requests in my DispatchWrite routine.
> I am looking for a specified offset in the driver’s I/O stack location at
> Parameters.Write.ByteOffset and complete the IRP with an error status:
>
> Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
> IoCompleteRequest(Irp, IO_NO_INCREMENT);
> return STATUS_ACCESS_DENIED;
>
> The problem is that Windows is reporting the fallowing error when I try to
> copy a file to that partition:
>
> Windows - Delayed Write Failed
> Windows was unable to save all the data for the file x. The data has been
> lost… etc.
>
> I want Windows to print some error like “Access Denied”, what status
> should I return from my DispatchWrite routine?
>
>
Cache the writes either in memory or on the hard disk and return success to
upper driver in the storage stack. File system driver could be driven crazy
with you returning errors for his write attempts.
Regards,
Anton A. Kolomyeytsev
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@inocentric.com
Sent: Tuesday, January 22, 2008 8:48 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Tring to block Windows writing a specified sector to hard disk.
Hello,
I am writing a disk filter driver.
I want to block write requests in my DispatchWrite routine.
I am looking for a specified offset in the driver’s I/O stack location at Parameters.Write.ByteOffset and complete the IRP with an error status:
Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_ACCESS_DENIED;
The problem is that Windows is reporting the fallowing error when I try to copy a file to that partition:
Windows - Delayed Write Failed
Windows was unable to save all the data for the file x. The data has been lost… etc.
I want Windows to print some error like “Access Denied”, what status should I return from my DispatchWrite routine?
NTFSD is sponsored by OSR
For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars
You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
Hi Lucian,
Windows - Delayed Write Failed
Windows was unable to save all the data for the file x. The data has been lost… etc.
I want Windows to print some error like “Access Denied”, what status should I return from my DispatchWrite routine?
First of all as pointed out by David, you can’t do the stuff in storage stack.
And consider this situation. This will help you understand why this is happening.
A file was open in buffered mode (cached). An application issued a Writefile on it. It got written to the cache. The application was informed that the write was successful. But when that data in the cache is being purged to the disk, you fail it. BOOM! The OS gets annoyed…
And prints the message “Delayed write failed”.
Regards,
Ayush Gupta
You must fail MJ_CREATE with write access instead.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
wrote in message news:xxxxx@ntfsd…
> Hello,
>
> I am writing a disk filter driver.
> I want to block write requests in my DispatchWrite routine.
> I am looking for a specified offset in the driver’s I/O stack location at
Parameters.Write.ByteOffset and complete the IRP with an error status:
>
> Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
> IoCompleteRequest(Irp, IO_NO_INCREMENT);
> return STATUS_ACCESS_DENIED;
>
> The problem is that Windows is reporting the fallowing error when I try to
copy a file to that partition:
>
> Windows - Delayed Write Failed
> Windows was unable to save all the data for the file x. The data has been
lost… etc.
>
> I want Windows to print some error like “Access Denied”, what status should I
return from my DispatchWrite routine?
>
>