CreateFile() and FILE_FLAG_WRITE_THROUGH

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



Hi everyone

If I create a file using CreateFile(), specifying the
FILE_FLAG_WRITE_THROUGH flag, then write to that file, the file still shows
as zero bytes long in the directory and in Windows Explorer, and if I then
turn the power off, that file is still zero bytes long on restart, so the
data I wrote is unavailable. I have tried this test on a variety of
operating systems including Vista, XP and Windows Server 2003/2008 using a
variety of hardware platforms with both SATA and SCSI disk systems, and they
all behave the same way.

Surely the whole point of specifying that flag is that I want the data to be
written to disk, together with it's corresponding metadata, so if a
catastrophic failure occurs, the data is available to me on restart.

My researches of newsgroup articles on this subject suggest that if I want
this, then I also have to use FlushFileBuffers(), but if that is so then
surely I don't need to specify the write through flag since all file and
folder data will be committed to disk when I call that function.

So, what is the point of specifying the write-through flag in this scenario?

I think the documentation of CreateFile() could do with a little
clarification!

Thanks in advance for responses.

Nick

.



Relevant Pages

  • CreateFile() and FILE_FLAG_WRITE_THROUGH
    ... as zero bytes long in the directory and in Windows Explorer, ... Surely the whole point of specifying that flag is that I want the data to be ... I think the documentation of CreateFile() could do with a little ...
    (microsoft.public.win32.programmer.kernel)
  • Re: CreateFile() and FILE_FLAG_WRITE_THROUGH
    ... What does your CreateFile call look like? ... variety of hardware platforms with both SATA and SCSI disk systems, ... Surely the whole point of specifying that flag is that I want the data to ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Do you think 12:00pm is noon or midnight?
    ... also have a "branch on greater" which explicitly excludes zero. ... I am an assembly language programmer, and I definitely consider 0 to ... I do program some RISC micros, of course, but I have programmed others ... on, there a zero flag as well as a sign flag, and the conditional ...
    (alt.usage.english)
  • Re: Encyption of two 256-blocks
    ... Use a wide-block mode. ... followed by zero of more bytes. ... Now start with a flag F set to zero. ... an infinite string of zeros. ...
    (sci.crypt)
  • Re: CreateFile() and FILE_FLAG_WRITE_THROUGH
    ... variety of hardware platforms with both SATA and SCSI disk systems, ... Surely the whole point of specifying that flag is that I want the data to be ... "...together with it's corresponding metadata" is wishful thinking on your ...
    (microsoft.public.win32.programmer.kernel)