The PrepareTape function prepares the tape to be accessed or removed.
Declare Function PrepareTape Lib "kernel32" Alias "PrepareTape" (ByVal hDevice As Long, ByVal dwOperation As Long, ByVal bimmediate As Long) As Long
|Operating Systems Supported|
|Requires Windows NT 3.1 or later; Win9x/ME: Not supported|
Identifies the device preparing the tape. This handle is created by using the CreateFile function.
Specifies how the tape device is to be prepared. This parameter can be one of the following values:
Performs a low-level format of the tape. Currently, only the QIC117 device supports this feature.
Loads the tape and moves the tape to the beginning.
Locks the tape ejection mechanism so that the tape is not ejected accidentally.
Adjusts the tension by moving the tape to the end of the tape and back to the beginning. This option is not supported by all devices. This value is ignored if it is not supported.
Moves the tape to the beginning for removal from the device. After a successful unload operation, the device returns errors to applications that attempt to access the tape, until the tape is loaded again.
Unlocks the tape ejection mechanism.
Specifies whether to return as soon as the preparation begins. If this parameter is TRUE, the function returns immediately. If it is FALSE, the function does not return until the operation has been completed.
|If the function succeeds, the return value is NO_ERROR. |
If the function fails, the return value is one of the following error codes:
An attempt to access data before the beginning-of-medium marker failed.
A reset condition was detected on the bus.
The end-of-tape marker was reached during an operation.
A filemark was reached during an operation.
A setmark was reached during an operation.
The end-of-data marker was reached during an operation.
The tape could not be partitioned.
The block size is incorrect on a new tape in a multivolume partition.
The partition information could not be found when a tape was being loaded.
The tape that was in the drive has been replaced or removed.
There is no media in the drive.
The tape driver does not support a requested function.
An attempt to lock the ejection mechanism failed.
An attempt to unload the tape failed.
The media is write protected.