IOCTL_TAPE_SET_DENSITY

The IOCTL code for IOCTL_TAPE_SET_DENSITY is defined as follows.
#define IOCTL_TAPE_SET_DENSITY \
CTL_CODE(IOCTL_TAPE_BASE, 0x000d, METHOD_BUFFERED, \
	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
The IOCTL sets density for supported devices by using the following structure.
typedef struct _TAPE_DENSITY
{
    UCHAR   ucDensityCode;
    UCHAR   ucDefaultDensity;
    UCHAR   ucPendingDensity;
} TAPE_DENSITY, *PTAPE_DENSITY;

ucDensityCode is ignored. ucDefaultDensity and ucPendingDensity are set by using the tape drive’s mode page 0x25. Caution must be taken when this IOCTL is issued. An incorrect tape density might lead to data corruption.

An example of the IOCTL_TAPE_SET_DENSITY command is
TAPE_DENSITY tape_density;

// Modify fields of tape_density.  For details, see the SCSI specification
// for your hardware.

rc = DeviceIoControl(hDevice,
IOCTL_TAPE_SET_DENSITY,
&tape_density,
sizeof(TAPE_DENSITY),
NULL,
0,
&cb,
(LPOVERLAPPED) NULL);