IOCTL_SET_ACTIVE_PARTITION

This command is used to set the current active partition that is used on tape and locate to a specific logical block id within the partition. If the logical block id is 0, the tape is positioned at BOP. If the partition number specified is 0 along with a logical block id 0, the tape is positioned at both BOP and BOT.

The structure for IOCTL_SET_ACTIVE_PARTITION command is
#define IOCTL_SET_ACTIVE_PARTITION      CTL_CODE(IOCTL_TAPE_BASE, 0x0827, 
METHOD_BUFFERED, 
FILE_READ_ACCESS | FILE_WRITE_ACCESS )
typedef struct _SET_ACTIVE_PARTITION{
  UCHAR partition_number;                  /* Partition number 0-n to change to */
  ULONGLONG logical_block_id;  /* Blockid to locate to within partition */
  char reserved[32];
} SET_ACTIVE_PARTITION, *PSET_ACTIVE_PARTITION;
An example of the IOCTL_SET_ACTIVE_PARTITION command is
DWORD cb;
SET_ACTIVE_PARTITION set_partition;
...
DeviceIoControl(gp->ddHandle0,
               IOCTL_SET_ACTIVE_PARTITION,
               &set_partition,
               (long)sizeof(SET_ACTIVE_PARTITION), 
               NULL,
               0, 
               &cb, 
               (LPOVERLAPPED) NULL);