IM driver: How check if ZwWriteFile has completed?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Hannes (hannes_at_nospam.nospam)
Date: 05/14/04


Date: Fri, 14 May 2004 15:16:03 -0700

I am writing large amounts of data to disk from an intermediate driver, using ZwWriteFile. In some cases, there is too much data for the disk to keep up, so I need to detect this and throw some data away (which is fine, by the way).

My question is: How do I see if ZwWriteFile is keeping up?

My thread must keep working on other stuff while writing to disk, so just sleeping until it's done is not acceptable.

ZwWriteFile sometimes returns STATUS_PENDING, does this mean that the data will still be written to disk, but it is temporarily placed in a queue somewhere? This return code is not documented in DDK for ZwWriteFile:
"ZwWriteFile either returns STATUS_SUCCESS or an appropriate error status."
STATUS_PENDING is not an error, right?

After getting STATUS_PENDING, how do I know when ZwWriteFile has "caught up"?

I am trying to set SYNCHRONIZE on the ZwCreateFile call, then passing an event into the ZwWriteFile call. Is this allowed?
ZwWriteFile DDK doc says, for the 'Event' parameter: "Device and intermediate drivers should set this parameter to NULL."

If I drop an event in there anyway, it appears to *always* be set by ZwWriteFile, regardless of any backlog of data to be written. For instance, I make sure the event is set, then send my data, and still I get STATUS_PENDING...so the event shouldn't really have been set...

Any ideas, anyone? How do I see if ZwWriteFile is keeping up?

Thanks,

    Hannes.



Relevant Pages

  • Re: IM driver: How check if ZwWriteFile has completed?
    ... Sure you can use SYNCHRONIZE when you open the file. ... to pass the event to ZwWriteFile in this case. ... > I am writing large amounts of data to disk from an intermediate driver, ... there is too much data for the disk to ...
    (microsoft.public.development.device.drivers)
  • Re: Can ZwWriteFile buffer and write in background?
    ... My driver is an intermediate driver, ... don't manage disk writes....I just call ZwWriteFile. ... I want to write many chunks of data to disk, ...
    (microsoft.public.development.device.drivers)
  • Re: IM driver: How check if ZwWriteFile has completed?
    ... I need to check if ZwWriteFile has completed writing to disk. ... (doesn't seem available to my "PASSTHRU" IM driver) ...
    (microsoft.public.development.device.drivers)
  • Re: X-CD Roast question again please
    ... Using generic SCSI-3/mmc CD-R driver. ... Disk sub type: Medium Type A, ... ATIP start of lead in: -11318 ... writing 152 KB of pad data. ...
    (RedHat)
  • FAT thrashing...
    ... The app is writing 128KB chunks of audio to disk via a customized ... It's writing at a rate of about 1.1MB/sec. ... analyzer instrumented to the read/write sections of the driver shows ...
    (microsoft.public.windowsce.platbuilder)