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: http://msdn.microsoft.com/library/en-us/fileio/base/enumerating_mount_points.asp] or GetLogicalDrives()
Back to Tech Journal