Microsoft KB Archive/271398

{|
 * width="100%"|

PRB: The Sparse Flag May Not Be Preserved By Using BackupRead or BackupWrite

 * }

Q271398

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), used with:
 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Datacenter Server
 * Microsoft Windows 2000 Professional

-

SYMPTOMS
The BackupRead function is used by backup utilities to create a backup of a file in memory; the BackupWrite function is used to restore the file to disk from the memory buffer. If you use these functions to back up and restore a sparse file, the restored file may not have the sparse attribute.

RESOLUTION
It is the responsibility of the backup utility to apply file attributes to a file after it is restored by using BackupWrite. The application should retrieve the attributes by using GetFileAttributes prior to creating a backup with BackupRead. If a file originally had the sparse attribute (FILE_ATTRIBUTE_SPARSE_FILE), the backup utility must explicitly set the attribute on the restored file. The attribute can be set by using the DeviceIoControl function with the FSCTL_SET_SPARSE flag.

STATUS
This behavior is by design.

MORE INFORMATION
If BackupWrite is used to copy a file that has more than one data stream, the sparse attribute will be applied to the copied file. However, this behavior is not by design (it is coincidental) and should not be relied upon. The backup utility must always apply the necessary file attributes.

Additional query words:

Keywords : kbAPI kbFileIO kbKernBase kbOSWin2000bug kbSDKWin32 kbDSupport kbGrpDSKernBase

Issue type : kbprb

Technology : kbAudDeveloper kbWin32sSearch kbWin32API