This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
To perform input or output on a tape, a backup application must first obtain a handle of the tape device. The following code sample shows you how to use theCreateFile function to open a tape device.
HANDLE hTape; // handle to tape device hTape = CreateFile(TEXT("\\\\.\\TAPE0"), // tape dev to open GENERIC_READ | GENERIC_WRITE, // read/write access 0, // not used 0, // not used OPEN_EXISTING, // req for tape devs 0, // not used NULL); // not used
To back up a directory tree to a tape, an application must use theFindFirstFile andFindNextFile functions to traverse the directory tree. Each time a file is found, the application should get the file attributes by using theGetFileAttributes function.
If there are hard links, an application should determine the number of links, and save the unique identifier of the file in a table for future comparisons. The first time a file is found, the application should useCreateFile to open the file, and theBackupRead function to begin the backup. Then it can use theWriteFile function repeatedly to transfer all the information in the buffer used byBackupRead to the tape. The second time a file is found (checked against the table of file identifiers when there are hard links), the application can write the general file information to the tape, followed by a stream that has an identifier that isBACKUP_LINK.
When restoring files from tape to disk, an application must use theCreateFile,BackupWrite, andReadFile functions. For each file on a tape, the application should useCreateFile to create a new file on disk, andBackupWrite to begin restoring the file. Then the application should useReadFile repeatedly until all the information for the file is read from the tape into the buffer filled byBackupWrite.
If one of the streams in theBackupWrite buffer has aBACKUP_LINK stream identifier, the application must establish a hard link. If the data needed to establish the link does not exist,BackupWrite fails. The application can use a pre-existing catalog to locate and restore the original data, or it can notify the user that the file data to be restored is in a different location.
Was this page helpful?
Was this page helpful?