CreateTapePartition function (winbase.h)

The CreateTapePartition function reformats a tape.

Syntax

DWORD CreateTapePartition(
  [in] HANDLE hDevice,
  [in] DWORD  dwPartitionMethod,
  [in] DWORD  dwCount,
  [in] DWORD  dwSize
);

Parameters

[in] hDevice

Handle to the device where the new partition is to be created. This handle is created by using the CreateFile function.

[in] dwPartitionMethod

Type of partition to create. To determine what type of partitions your device supports, see the documentation for your hardware. This parameter can have one of the following values.

Value Meaning
TAPE_FIXED_PARTITIONS
0L
Partitions the tape based on the device's default definition of partitions. The dwCount and dwSize parameters are ignored.
TAPE_INITIATOR_PARTITIONS
2L
Partitions the tape into the number and size of partitions specified by dwCount and dwSize, respectively, except for the last partition. The size of the last partition is the remainder of the tape.
TAPE_SELECT_PARTITIONS
1L
Partitions the tape into the number of partitions specified by dwCount. The dwSize parameter is ignored. The size of the partitions is determined by the device's default partition size. For more specific information, see the documentation for your tape device.

[in] dwCount

Number of partitions to create. The GetTapeParameters function provides the maximum number of partitions a tape can support.

[in] dwSize

Size of each partition, in megabytes. This value is ignored if the dwPartitionMethod parameter is TAPE_SELECT_PARTITIONS.

Return value

If the function succeeds, the return value is NO_ERROR.

If the function fails, it can return one of the following error codes.

Error Description
ERROR_BEGINNING_OF_MEDIA
1102L
An attempt to access data before the beginning-of-medium marker failed.
ERROR_BUS_RESET
1111L
A reset condition was detected on the bus.
ERROR_END_OF_MEDIA
1100L
The end-of-tape marker was reached during an operation.
ERROR_FILEMARK_DETECTED
1101L
A filemark was reached during an operation.
ERROR_SETMARK_DETECTED
1103L
A setmark was reached during an operation.
ERROR_NO_DATA_DETECTED
1104L
The end-of-data marker was reached during an operation.
ERROR_PARTITION_FAILURE
1105L
The tape could not be partitioned.
ERROR_INVALID_BLOCK_LENGTH
1106L
The block size is incorrect on a new tape in a multivolume partition.
ERROR_DEVICE_NOT_PARTITIONED
1107L
The partition information could not be found when a tape was being loaded.
ERROR_MEDIA_CHANGED
1110L
The tape that was in the drive has been replaced or removed.
ERROR_NO_MEDIA_IN_DRIVE
1112L
There is no media in the drive.
ERROR_NOT_SUPPORTED
50L
The tape driver does not support a requested function.
ERROR_UNABLE_TO_LOCK_MEDIA
1108L
An attempt to lock the ejection mechanism failed.
ERROR_UNABLE_TO_UNLOAD_MEDIA
1109L
An attempt to unload the tape failed.
ERROR_WRITE_PROTECT
19L
The media is write protected.

Remarks

Creating partitions reformats the tape. All previous information recorded on the tape is destroyed.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

CreateFile

GetTapeParameters