Tech Journal Back to Tech Journal

How can I flush all the buffers of a disk in Windows?

To flush all buffers for a volume, call FlushFileBuffers with a handle to the volume. Must be Admin priv, When opening a volume with CreateFile, the lpFileName string should be of the form \\.\<x>: or \\?\Volume{GUID}. Do not use a trailing backslash in the volume name; this would indicate the root directory of the drive.

This is easily used to write an application to flush loaded USB media.

[Enum Mount Points:] or GetLogicalDrives()

Last updated on 2007-05-07 04:21:53 -0700, by Shalom Craimer

Back to Tech Journal